Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
fefc6d2
Show backtrace on allocation failures when possible
bjorn3 Oct 15, 2025
1f23b48
rustdoc: Properly highlight shebang and frontmatter
fmease Oct 29, 2025
a5f0713
rustdoc: Recognize more weak keywords when highlighting Rust code
fmease Oct 28, 2025
0582085
rustdoc: Refactor keyword highlighting and make metavars take precedence
fmease Oct 28, 2025
cb5dc78
Broken test to show alwaysinline attribute not being applied
JamieCunliffe Oct 27, 2025
f3fe6ba
Fix rust-by-example spanish translation
ehuss Nov 6, 2025
91ed7a6
Move and update safety comment
bjorn3 Nov 6, 2025
1a9cc78
re-use `self.get_all_attrs` result for pass indirectly attribute
folkertdev Nov 6, 2025
12cde30
Add note for identifier with attempted hygiene violation
chenyukang Nov 7, 2025
c92ef47
Fix suggestion for returning async closures
chenyukang Nov 6, 2025
5ed01e9
Switch hexagon targets to rust-lld
androm3da Nov 7, 2025
fc20a28
Modify contributor email entries in .mailmap
hkBst Oct 28, 2025
a7aedeb
implement SIMD funnel shifts in const-eval
sayantn Oct 9, 2025
f2794ce
Switch clean `print` methods into a function
GuillaumeGomez Nov 6, 2025
0f03429
Replace `Display::fmt` with `write_char`
GuillaumeGomez Nov 7, 2025
fdced17
[bootstrap] Make `--open` option work with `doc src/tools/error_index…
GuillaumeGomez Nov 7, 2025
c07f11a
don't completely reset `HeadUsages`
lcnr Nov 7, 2025
c5c6ee5
Fix issue with callsite inline attribute not being applied sometimes.
JamieCunliffe Oct 27, 2025
e2c5c18
Review comments
JamieCunliffe Oct 27, 2025
057127c
update isolate_highest_one for NonZero<T>
vrtgs Oct 14, 2025
eac0c5a
Remove eslint-js from npm dependencies
Kobzol Nov 7, 2025
cf6f6ee
Rollup merge of #147404 - JamieCunliffe:inline-always, r=jackh726
jhpratt Nov 8, 2025
67c0a91
Rollup merge of #147534 - sayantn:simd-funnel-shifts, r=RalfJung
jhpratt Nov 8, 2025
b9a72b1
Rollup merge of #147686 - vrtgs:non-zero-isolate, r=joboet
jhpratt Nov 8, 2025
ec23ffa
Rollup merge of #148020 - bjorn3:oom_backtrace, r=Mark-Simulacrum
jhpratt Nov 8, 2025
5734f27
Rollup merge of #148204 - hkBst:patch-5, r=nnethercote
jhpratt Nov 8, 2025
0ffb294
Rollup merge of #148230 - fmease:rustdoc-highlight-tweaks, r=Guillaum…
jhpratt Nov 8, 2025
bddfae5
Rollup merge of #148555 - ehuss:rust-by-example-es, r=Kobzol
jhpratt Nov 8, 2025
e2639f3
Rollup merge of #148556 - chenyukang:yukang-fix-148493-async-closure,…
jhpratt Nov 8, 2025
a5e77ea
Rollup merge of #148585 - GuillaumeGomez:improve-format-code, r=yotam…
jhpratt Nov 8, 2025
2892cbb
Rollup merge of #148600 - folkertdev:pass-indirectly-reuse-attrs, r=J…
jhpratt Nov 8, 2025
1363194
Rollup merge of #148612 - chenyukang:yukang-fix-148580-macro-hygiene-…
jhpratt Nov 8, 2025
df5b31e
Rollup merge of #148613 - androm3da:bcain/hex_lld, r=JonathanBrouwer,…
jhpratt Nov 8, 2025
af8636b
Rollup merge of #148644 - GuillaumeGomez:error-index-index-open, r=Ko…
jhpratt Nov 8, 2025
90160f1
Rollup merge of #148649 - lcnr:rarwwww, r=BoxyUwU
jhpratt Nov 8, 2025
b5bfefe
Rollup merge of #148675 - Kobzol:eslint-js, r=yotamofek
jhpratt Nov 8, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions .mailmap
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Aaron Todd <[email protected]>
Abhishek Chanda <[email protected]> Abhishek Chanda <[email protected]>
Abhijeet Bhagat <[email protected]>
Abroskin Alexander <[email protected]>
Adolfo Ochagavía <[email protected]>
Adolfo Ochagavía <[email protected]> <[email protected]>
Adrian Heine né Lang <[email protected]>
Adrien Tétar <[email protected]>
Ahmed Charles <[email protected]> <[email protected]>
Expand All @@ -36,6 +36,7 @@ Amanda Stjerna <[email protected]> <[email protected]>
Amanda Stjerna <[email protected]> <[email protected]>
Amanieu d'Antras <[email protected]> <[email protected]>
Amos Onn <[email protected]>
Amos Wenger <[email protected]> <[email protected]>
Ana-Maria Mihalache <[email protected]>
Anatoly Ikorsky <[email protected]>
Andre Bogus <[email protected]>
Expand Down Expand Up @@ -276,7 +277,8 @@ Irina Popa <[email protected]>
Ivan Ivaschenko <[email protected]>
ivan tkachenko <[email protected]>
J. J. Weber <[email protected]>
Jack Huey <[email protected]> <[email protected]>
Jack Huey <[email protected]> <[email protected]>
Jack Huey <[email protected]> <[email protected]>
Jacob <[email protected]>
Jacob Hoffman-Andrews <[email protected]> <[email protected]>
Jacob Greenfield <[email protected]>
Expand All @@ -292,6 +294,8 @@ Jakub Adam Wieczorek <[email protected]>
Jakub Adam Wieczorek <[email protected]> <[email protected]>
Jakub Adam Wieczorek <[email protected]> <[email protected]>
Jakub Adam Wieczorek <[email protected]> <[email protected]>
Jakub Adam Wieczorek <[email protected]> <[email protected]>
Jakub Adam Wieczorek <[email protected]> <[email protected]>
Jakub Beránek <[email protected]> <[email protected]>
James [Undefined] <[email protected]>
James Deng <[email protected]> <[email protected]>
Expand All @@ -303,6 +307,7 @@ Jamie Hill-Daniel <[email protected]> <[email protected]>
Jana Dönszelmann <[email protected]>
Jana Dönszelmann <[email protected]> <[email protected]>
Jana Dönszelmann <[email protected]> <[email protected]>
Jane Lusby <[email protected]> <[email protected]>
Jan-Erik Rediger <[email protected]> <[email protected]>
Jaro Fietz <[email protected]>
Jason Fager <[email protected]>
Expand All @@ -313,6 +318,7 @@ Jason Toffaletti <[email protected]> Jason Toffaletti <[email protected]>
Jauhien Piatlicki <[email protected]> Jauhien Piatlicki <[email protected]>
Jay True <[email protected]>
Jeremy Letang <[email protected]>
Jeremy Soller <[email protected]> <[email protected]>
Jeremy Sorensen <[email protected]>
Jeremy Stucki <[email protected]> <[email protected]>
Jeremy Stucki <[email protected]> <[email protected]>
Expand All @@ -336,6 +342,7 @@ John Kåre Alsaker <[email protected]>
John Kåre Alsaker <[email protected]> <[email protected]>
John Talling <[email protected]>
John Van Enk <[email protected]>
Jon Gjengset <[email protected]> <[email protected]>
Jonas Tepe <[email protected]>
Jonathan Bailey <[email protected]> <[email protected]>
Jonathan Chan Kwan Yin <[email protected]>
Expand Down Expand Up @@ -424,7 +431,7 @@ Malo Jaffré <[email protected]>
Manish Goregaokar <[email protected]>
Mara Bos <[email protected]>
Marcell Pardavi <[email protected]>
Marco Ieni <[email protected]>
Marco Ieni <[email protected]> <[email protected]>
Marcus Klaas de Vries <[email protected]>
Margaret Meyerhofer <[email protected]> <mmeyerho@andrew>
Marijn Schouten <[email protected]> <[email protected]>
Expand Down Expand Up @@ -531,6 +538,7 @@ Oliver Scherer <[email protected]> <[email protected]>
Oliver Scherer <[email protected]> <[email protected]>
Oliver Scherer <[email protected]> <[email protected]>
Oliver Scherer <[email protected]>
Onur Özkan <[email protected]> <[email protected]>
Onur Özkan <[email protected]> <[email protected]>
Onur Özkan <[email protected]>
Ömer Sinan Ağacan <[email protected]>
Expand Down Expand Up @@ -591,6 +599,7 @@ Rusty Blitzerr <[email protected]>
RustyYato <[email protected]>
Ruud van Asseldonk <[email protected]> Ruud van Asseldonk <[email protected]>
Ryan Leung <[email protected]>
Ryan Levick <[email protected]> <[email protected]>
Ryan Scheel <[email protected]>
Ryan Sullivant <[email protected]>
Ryan Wiedemann <[email protected]>
Expand Down Expand Up @@ -686,6 +695,8 @@ Weihang Lo <[email protected]>
Weihang Lo <[email protected]> <[email protected]>
Wesley Wiser <[email protected]> <[email protected]>
whitequark <[email protected]>
Will Crichton <[email protected]> <[email protected]>
Will Crichton <[email protected]> <[email protected]>
William Ting <[email protected]> <[email protected]>
Wim Looman <[email protected]> <[email protected]>
Wim Looman <[email protected]> <[email protected]>
Expand All @@ -695,6 +706,8 @@ Xinye Tao <[email protected]>
Xuefeng Wu <[email protected]> Xuefeng Wu <[email protected]>
Xuefeng Wu <[email protected]> XuefengWu <[email protected]>
York Xiang <[email protected]>
Yoshua Wuyts <[email protected]> <[email protected]>
Yoshua Wuyts <[email protected]> <[email protected]>
Yotam Ofek <[email protected]> <[email protected]>
Youngsoo Son <[email protected]> <[email protected]>
Youngsuk Kim <[email protected]>
Expand Down
10 changes: 7 additions & 3 deletions compiler/rustc_codegen_llvm/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use rustc_codegen_ssa::mir::place::PlaceRef;
use rustc_codegen_ssa::traits::*;
use rustc_data_structures::small_c_str::SmallCStr;
use rustc_hir::def_id::DefId;
use rustc_middle::middle::codegen_fn_attrs::CodegenFnAttrs;
use rustc_middle::middle::codegen_fn_attrs::{CodegenFnAttrs, TargetFeature, TargetFeatureKind};
use rustc_middle::ty::layout::{
FnAbiError, FnAbiOfHelpers, FnAbiRequest, HasTypingEnv, LayoutError, LayoutOfHelpers,
TyAndLayout,
Expand Down Expand Up @@ -1417,14 +1417,18 @@ impl<'a, 'll, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> {
// Attributes on the function definition being called
let fn_defn_attrs = self.cx.tcx.codegen_fn_attrs(instance.def_id());
if let Some(fn_call_attrs) = fn_call_attrs
&& !fn_call_attrs.target_features.is_empty()
// If there is an inline attribute and a target feature that matches
// we will add the attribute to the callsite otherwise we'll omit
// this and not add the attribute to prevent soundness issues.
&& let Some(inlining_rule) = attributes::inline_attr(&self.cx, self.cx.tcx, instance)
&& self.cx.tcx.is_target_feature_call_safe(
&fn_call_attrs.target_features,
&fn_defn_attrs.target_features,
&fn_call_attrs.target_features.iter().cloned().chain(
self.cx.tcx.sess.target_features.iter().map(|feat| TargetFeature {
name: *feat,
kind: TargetFeatureKind::Implied,
})
).collect::<Vec<_>>(),
)
{
attributes::apply_to_callsite(
Expand Down
54 changes: 53 additions & 1 deletion compiler/rustc_const_eval/src/interpret/intrinsics/simd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use rustc_abi::{BackendRepr, Endian};
use rustc_apfloat::ieee::{Double, Half, Quad, Single};
use rustc_apfloat::{Float, Round};
use rustc_middle::mir::interpret::{InterpErrorKind, Pointer, UndefinedBehaviorInfo};
use rustc_middle::ty::{FloatTy, SimdAlign};
use rustc_middle::ty::{FloatTy, ScalarInt, SimdAlign};
use rustc_middle::{bug, err_ub_format, mir, span_bug, throw_unsup_format, ty};
use rustc_span::{Symbol, sym};
use tracing::trace;
Expand Down Expand Up @@ -744,6 +744,58 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
self.write_scalar(val, &dest)?;
}
}
sym::simd_funnel_shl | sym::simd_funnel_shr => {
let (left, _) = self.project_to_simd(&args[0])?;
let (right, _) = self.project_to_simd(&args[1])?;
let (shift, _) = self.project_to_simd(&args[2])?;
let (dest, _) = self.project_to_simd(&dest)?;

let (len, elem_ty) = args[0].layout.ty.simd_size_and_type(*self.tcx);
let (elem_size, _signed) = elem_ty.int_size_and_signed(*self.tcx);
let elem_size_bits = u128::from(elem_size.bits());

let is_left = intrinsic_name == sym::simd_funnel_shl;

for i in 0..len {
let left =
self.read_scalar(&self.project_index(&left, i)?)?.to_bits(elem_size)?;
let right =
self.read_scalar(&self.project_index(&right, i)?)?.to_bits(elem_size)?;
let shift_bits =
self.read_scalar(&self.project_index(&shift, i)?)?.to_bits(elem_size)?;

if shift_bits >= elem_size_bits {
throw_ub_format!(
"overflowing shift by {shift_bits} in `{intrinsic_name}` in lane {i}"
);
}
let inv_shift_bits = u32::try_from(elem_size_bits - shift_bits).unwrap();

// A funnel shift left by S can be implemented as `(x << S) | y.unbounded_shr(SIZE - S)`.
// The `unbounded_shr` is needed because otherwise if `S = 0`, it would be `x | y`
// when it should be `x`.
//
// This selects the least-significant `SIZE - S` bits of `x`, followed by the `S` most
// significant bits of `y`. As `left` and `right` both occupy the lower `SIZE` bits,
// we can treat the lower `SIZE` bits as an integer of the right width and use
// the same implementation, but on a zero-extended `x` and `y`. This works because
// `x << S` just pushes the `SIZE-S` MSBs out, and `y >> (SIZE - S)` shifts in
// zeros, as it is zero-extended. To the lower `SIZE` bits, this looks just like a
// funnel shift left.
//
// Note that the `unbounded_sh{l,r}`s are needed only in case we are using this on
// `u128xN` and `inv_shift_bits == 128`.
let result_bits = if is_left {
(left << shift_bits) | right.unbounded_shr(inv_shift_bits)
} else {
left.unbounded_shl(inv_shift_bits) | (right >> shift_bits)
};
let (result, _overflow) = ScalarInt::truncate_from_uint(result_bits, elem_size);

let dest = self.project_index(&dest, i)?;
self.write_scalar(result, &dest)?;
}
}

// Unsupported intrinsic: skip the return_to_block below.
_ => return interp_ok(false),
Expand Down
15 changes: 15 additions & 0 deletions compiler/rustc_hir_analysis/src/collect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1263,6 +1263,21 @@ pub fn suggest_impl_trait<'tcx>(
infcx.tcx.lang_items().future_output(),
format_as_assoc,
),
(
infcx.tcx.lang_items().async_fn_trait(),
infcx.tcx.lang_items().async_fn_once_output(),
format_as_parenthesized,
),
(
infcx.tcx.lang_items().async_fn_mut_trait(),
infcx.tcx.lang_items().async_fn_once_output(),
format_as_parenthesized,
),
(
infcx.tcx.lang_items().async_fn_once_trait(),
infcx.tcx.lang_items().async_fn_once_output(),
format_as_parenthesized,
),
(
infcx.tcx.lang_items().fn_trait(),
infcx.tcx.lang_items().fn_once_output(),
Expand Down
2 changes: 2 additions & 0 deletions compiler/rustc_middle/src/ty/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2088,6 +2088,8 @@ impl<'tcx> TyCtxt<'tcx> {
self.sess.dcx()
}

/// Checks to see if the caller (`body_features`) has all the features required by the callee
/// (`callee_features`).
pub fn is_target_feature_call_safe(
self,
callee_features: &[TargetFeature],
Expand Down
10 changes: 3 additions & 7 deletions compiler/rustc_middle/src/ty/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1512,9 +1512,8 @@ impl<'tcx> TyCtxt<'tcx> {
field_shuffle_seed ^= user_seed;
}

if let Some(reprs) =
find_attr!(self.get_all_attrs(did), AttributeKind::Repr { reprs, .. } => reprs)
{
let attributes = self.get_all_attrs(did);
if let Some(reprs) = find_attr!(attributes, AttributeKind::Repr { reprs, .. } => reprs) {
for (r, _) in reprs {
flags.insert(match *r {
attr::ReprRust => ReprFlags::empty(),
Expand Down Expand Up @@ -1574,10 +1573,7 @@ impl<'tcx> TyCtxt<'tcx> {
}

// See `TyAndLayout::pass_indirectly_in_non_rustic_abis` for details.
if find_attr!(
self.get_all_attrs(did),
AttributeKind::RustcPassIndirectlyInNonRusticAbis(..)
) {
if find_attr!(attributes, AttributeKind::RustcPassIndirectlyInNonRusticAbis(..)) {
flags.insert(ReprFlags::PASS_INDIRECTLY_IN_NON_RUSTIC_ABIS);
}

Expand Down
24 changes: 24 additions & 0 deletions compiler/rustc_resolve/src/late/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1125,6 +1125,8 @@ impl<'ast, 'ra, 'tcx> LateResolutionVisitor<'_, 'ast, 'ra, 'tcx> {
}
}
}

self.suggest_ident_hidden_by_hygiene(err, path, span);
} else if err_code == E0412 {
if let Some(correct) = Self::likely_rust_type(path) {
err.span_suggestion(
Expand All @@ -1138,6 +1140,28 @@ impl<'ast, 'ra, 'tcx> LateResolutionVisitor<'_, 'ast, 'ra, 'tcx> {
}
}

fn suggest_ident_hidden_by_hygiene(&self, err: &mut Diag<'_>, path: &[Segment], span: Span) {
let [segment] = path else { return };

let ident = segment.ident;
let callsite_span = span.source_callsite();
for rib in self.ribs[ValueNS].iter().rev() {
for (binding_ident, _) in &rib.bindings {
if binding_ident.name == ident.name
&& !binding_ident.span.eq_ctxt(span)
&& !binding_ident.span.from_expansion()
&& binding_ident.span.lo() < callsite_span.lo()
{
err.span_help(
binding_ident.span,
"an identifier with the same name exists, but is not accessible due to macro hygiene",
);
return;
}
}
}
}

/// Emit special messages for unresolved `Self` and `self`.
fn suggest_self_ty(
&self,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ pub(crate) fn target() -> Target {
base.features = "-small-data,+hvx-length128b".into();

base.has_rpath = true;
base.linker = Some("rust-lld".into());
base.linker_flavor = LinkerFlavor::Unix(Cc::Yes);

base.c_enum_min_bits = Some(8);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ pub(crate) fn target() -> Target {
max_atomic_width: Some(32),
emit_debug_gdb_scripts: false,
c_enum_min_bits: Some(8),
linker: Some("rust-lld".into()),
..Default::default()
},
}
Expand Down
17 changes: 14 additions & 3 deletions compiler/rustc_type_ir/src/search_graph/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use derive_where::derive_where;
#[cfg(feature = "nightly")]
use rustc_macros::{Decodable_NoContext, Encodable_NoContext, HashStable_NoContext};
use rustc_type_ir::data_structures::HashMap;
use tracing::{debug, instrument};
use tracing::{debug, instrument, trace};

mod stack;
use stack::{Stack, StackDepth, StackEntry};
Expand Down Expand Up @@ -916,6 +916,7 @@ impl<D: Delegate<Cx = X>, X: Cx> SearchGraph<D> {
/// heads from the stack. This may not necessarily mean that we've actually
/// reached a fixpoint for that cycle head, which impacts the way we rebase
/// provisional cache entries.
#[derive_where(Debug; X: Cx)]
enum RebaseReason<X: Cx> {
NoCycleUsages,
Ambiguity(X::AmbiguityInfo),
Expand Down Expand Up @@ -950,6 +951,7 @@ impl<D: Delegate<Cx = X>, X: Cx> SearchGraph<D, X> {
/// cache entries to also be ambiguous. This causes some undesirable ambiguity for nested
/// goals whose result doesn't actually depend on this cycle head, but that's acceptable
/// to me.
#[instrument(level = "trace", skip(self, cx))]
fn rebase_provisional_cache_entries(
&mut self,
cx: X,
Expand All @@ -969,6 +971,7 @@ impl<D: Delegate<Cx = X>, X: Cx> SearchGraph<D, X> {
let popped_head = if heads.highest_cycle_head_index() == popped_head_index {
heads.remove_highest_cycle_head()
} else {
debug_assert!(heads.highest_cycle_head_index() < popped_head_index);
return true;
};

Expand Down Expand Up @@ -1057,6 +1060,8 @@ impl<D: Delegate<Cx = X>, X: Cx> SearchGraph<D, X> {
new_highest_head_index,
));

trace!(?input, ?entry, "rebased provisional cache entry");

true
});
!entries.is_empty()
Expand Down Expand Up @@ -1379,7 +1384,8 @@ impl<D: Delegate<Cx = X>, X: Cx> SearchGraph<D, X> {
}

// Clear all provisional cache entries which depend on a previous provisional
// result of this goal and rerun.
// result of this goal and rerun. This does not remove goals which accessed this
// goal without depending on its result.
self.clear_dependent_provisional_results_for_rerun();

debug!(?result, "fixpoint changed provisional results");
Expand All @@ -1399,7 +1405,12 @@ impl<D: Delegate<Cx = X>, X: Cx> SearchGraph<D, X> {
// similar to the previous iterations when reevaluating, it's better
// for caching if the reevaluation also starts out with `false`.
encountered_overflow: false,
usages: None,
// We keep provisional cache entries around if they used this goal
// without depending on its result.
//
// We still need to drop or rebase these cache entries once we've
// finished evaluating this goal.
usages: Some(HeadUsages::default()),
candidate_usages: None,
});
}
Expand Down
9 changes: 6 additions & 3 deletions library/core/src/num/nonzero.rs
Original file line number Diff line number Diff line change
Expand Up @@ -660,12 +660,15 @@ macro_rules! nonzero_integer {
without modifying the original"]
#[inline(always)]
pub const fn isolate_highest_one(self) -> Self {
let n = self.get() & (((1 as $Int) << (<$Int>::BITS - 1)).wrapping_shr(self.leading_zeros()));

// SAFETY:
// `self` is non-zero, so masking to preserve only the most
// significant set bit will result in a non-zero `n`.
unsafe { NonZero::new_unchecked(n) }
// and self.leading_zeros() is always < $INT::BITS since
// at least one of the bits in the number is not zero
unsafe {
let bit = (((1 as $Uint) << (<$Uint>::BITS - 1)).unchecked_shr(self.leading_zeros()));
NonZero::new_unchecked(bit as $Int)
}
}

/// Returns `self` with only the least significant bit set.
Expand Down
Loading
Loading