Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
e477732
Don't strip shebang in expr-ctxt `include!(…)`
fmease Sep 9, 2025
7d0300b
Fix +vfp3,-d32 target configuration
adamgemmell Dec 3, 2025
4ed68f0
Remove redundant -d32 in target specs
adamgemmell Dec 3, 2025
df38e15
Add const default for OnceCell and OnceLock
tisonkun Dec 9, 2025
0428dd5
miri: add -Zbinary-dep-depinfo to dependency builds
RalfJung Dec 11, 2025
cc68f22
Enable llvm-libunwind by default for Hexagon targets
androm3da Dec 14, 2025
3493f8c
fix docustring on fetch_or
agavra Dec 15, 2025
897e88c
add test for 149980
jdonszelmann Dec 19, 2025
c316c05
refactor how eii expansion is wrapped fixing 149980
jdonszelmann Dec 19, 2025
19f74f4
Use the same length type for `TestableCase::Slice` and `TestKind::Len`
Zalathar Dec 20, 2025
5d8a096
change non-canonical clone impl to {*self}, fix some doc comments
hkBst Dec 19, 2025
c556e9c
[rustdoc] Add missing close tags in extern crate reexports
Dec 20, 2025
93fbf3b
Drop the From derive macro from the v1 prelude
jtgeibel Dec 20, 2025
b7a0f84
tests/debuginfo/function-arg-initialization.rs: Stop disabling Single…
Enselic Dec 20, 2025
8825e1f
library/coretests/tests/fmt/mod.rs: Add HRTB fn pointer case
Enselic Dec 17, 2025
685e4b6
Add comment with link to issue and open tags
Dec 21, 2025
37af3f6
GVN: Adds the `insert_unique` method
dianqk Dec 21, 2025
74af408
rustdoc: handle macro expansions in types
el-ev Dec 21, 2025
e5b8188
Rollup merge of #146377 - fmease:no-incl-shebang-expr, r=Urgau
JonathanBrouwer Dec 21, 2025
ba0ec17
Rollup merge of #149512 - adamgemmell:dev/adagem01/armv7-d32-fix, r=A…
JonathanBrouwer Dec 21, 2025
1fc60c2
Rollup merge of #149812 - tisonkun:oncelock-const-default, r=Mark-Sim…
JonathanBrouwer Dec 21, 2025
e10321a
Rollup merge of #149882 - RalfJung:miri-dep-build, r=Mark-Simulacrum
JonathanBrouwer Dec 21, 2025
952fb18
Rollup merge of #150009 - androm3da:bcain/hex_unwind, r=Mark-Simulacrum
JonathanBrouwer Dec 21, 2025
33dc9fc
Rollup merge of #150035 - agavra:patch-1, r=Mark-Simulacrum
JonathanBrouwer Dec 21, 2025
93bc64f
Rollup merge of #150082 - Enselic:hrtb-fn-pointer, r=fee1-dead
JonathanBrouwer Dec 21, 2025
db2e6b6
Rollup merge of #150160 - jdonszelmann:fix-149980, r=Kivooeo
JonathanBrouwer Dec 21, 2025
94771c3
Rollup merge of #150184 - Zalathar:slice-len, r=saethlin
JonathanBrouwer Dec 21, 2025
9cac665
Rollup merge of #150185 - lambda:rustdoc-missing-close-tags-reexport,…
JonathanBrouwer Dec 21, 2025
db16dda
Rollup merge of #150191 - hkBst:clippy-fix-15, r=Kivooeo
JonathanBrouwer Dec 21, 2025
f20e888
Rollup merge of #150203 - jtgeibel:drop-From-derive-macro-from-prelud…
JonathanBrouwer Dec 21, 2025
1b8efdb
Rollup merge of #150210 - Enselic:run-mir-pass, r=saethlin
JonathanBrouwer Dec 21, 2025
365a9da
Rollup merge of #150221 - el-ev:missing-par-ice-150154, r=fmease
JonathanBrouwer Dec 21, 2025
036831e
Rollup merge of #150223 - dianqk:gvn-insert_unique, r=cjgillot
JonathanBrouwer Dec 21, 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
3 changes: 3 additions & 0 deletions compiler/rustc_ast_pretty/src/pprust/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ pub fn where_bound_predicate_to_string(where_bound_predicate: &ast::WhereBoundPr
State::new().where_bound_predicate_to_string(where_bound_predicate)
}

/// # Panics
///
/// Panics if `pat.kind` is `PatKind::Missing`.
pub fn pat_to_string(pat: &ast::Pat) -> String {
State::new().pat_to_string(pat)
}
Expand Down
45 changes: 20 additions & 25 deletions compiler/rustc_builtin_macros/src/eii.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,18 @@ fn eii_(
) -> Vec<Annotatable> {
let eii_attr_span = ecx.with_def_site_ctxt(eii_attr_span);

let (item, stmt) = if let Annotatable::Item(item) = item {
(item, false)
let (item, wrap_item): (_, &dyn Fn(_) -> _) = if let Annotatable::Item(item) = item {
(item, &Annotatable::Item)
} else if let Annotatable::Stmt(ref stmt) = item
&& let StmtKind::Item(ref item) = stmt.kind
{
(item.clone(), true)
(item.clone(), &|item| {
Annotatable::Stmt(Box::new(Stmt {
id: DUMMY_NODE_ID,
kind: StmtKind::Item(item),
span: eii_attr_span,
}))
})
} else {
ecx.dcx().emit_err(EiiSharedMacroExpectedFunction {
span: eii_attr_span,
Expand All @@ -74,23 +80,25 @@ fn eii_(
return vec![item];
};

let orig_item = item.clone();

let item = *item;

let ast::Item { attrs, id: _, span: _, vis, kind: ItemKind::Fn(func), tokens: _ } = item else {
let ast::Item { attrs, id: _, span: _, vis, kind: ItemKind::Fn(func), tokens: _ } =
item.as_ref()
else {
ecx.dcx().emit_err(EiiSharedMacroExpectedFunction {
span: eii_attr_span,
name: path_to_string(&meta_item.path),
});
return vec![Annotatable::Item(Box::new(item))];
return vec![wrap_item(item)];
};
// only clone what we need
let attrs = attrs.clone();
let func = (**func).clone();
let vis = vis.clone();

let attrs_from_decl =
filter_attrs_for_multiple_eii_attr(ecx, attrs, eii_attr_span, &meta_item.path);

let Ok(macro_name) = name_for_impl_macro(ecx, &func, &meta_item) else {
return vec![Annotatable::Item(orig_item)];
return vec![wrap_item(item)];
};

// span of the declaring item without attributes
Expand All @@ -115,7 +123,7 @@ fn eii_(
ecx,
eii_attr_span,
item_span,
*func,
func,
vis,
&attrs_from_decl,
)));
Expand All @@ -128,20 +136,7 @@ fn eii_(
decl_span,
)));

if stmt {
return_items
.into_iter()
.map(|i| {
Annotatable::Stmt(Box::new(Stmt {
id: DUMMY_NODE_ID,
kind: StmtKind::Item(i),
span: eii_attr_span,
}))
})
.collect()
} else {
return_items.into_iter().map(|i| Annotatable::Item(i)).collect()
}
return_items.into_iter().map(wrap_item).collect()
}

/// Decide on the name of the macro that can be used to implement the EII.
Expand Down
4 changes: 1 addition & 3 deletions compiler/rustc_builtin_macros/src/source_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,7 @@ pub(crate) fn expand_include<'cx>(
let mut p = unwrap_or_emit_fatal(new_parser_from_file(
self.psess,
&self.path,
// Don't strip frontmatter for backward compatibility, `---` may be the start of a
// manifold negation. FIXME: Ideally, we wouldn't strip shebangs here either.
StripTokens::Shebang,
StripTokens::Nothing,
Some(self.span),
));
let expr = parse_expr(&mut p).ok()?;
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_graphviz/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ impl<'a> Id<'a> {
/// it in the generated .dot file. They can also provide more
/// elaborate (and non-unique) label text that is used in the graphviz
/// rendered output.
///
/// The graph instance is responsible for providing the DOT compatible
/// identifiers for the nodes and (optionally) rendered labels for the nodes and
/// edges, as well as an identifier for the graph itself.
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_middle/src/ty/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2654,7 +2654,7 @@ struct InternedInSet<'tcx, T: ?Sized + PointeeSized>(&'tcx T);

impl<'tcx, T: 'tcx + ?Sized + PointeeSized> Clone for InternedInSet<'tcx, T> {
fn clone(&self) -> Self {
InternedInSet(self.0)
*self
}
}

Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_mir_build/src/builder/matches/buckets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
&TestKind::Len { len: test_len, op: BinOp::Eq },
&TestableCase::Slice { len, variable_length },
) => {
match (test_len.cmp(&(len as u64)), variable_length) {
match (test_len.cmp(&len), variable_length) {
(Ordering::Equal, false) => {
// on true, min_len = len = $actual_length,
// on false, len != $actual_length
Expand Down Expand Up @@ -251,7 +251,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
&TestableCase::Slice { len, variable_length },
) => {
// the test is `$actual_len >= test_len`
match (test_len.cmp(&(len as u64)), variable_length) {
match (test_len.cmp(&len), variable_length) {
(Ordering::Equal, true) => {
// $actual_len >= test_len = pat_len,
// so we can match.
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_mir_build/src/builder/matches/match_pair.rs
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ impl<'tcx> MatchPairTree<'tcx> {
None
} else {
Some(TestableCase::Slice {
len: prefix.len() + suffix.len(),
len: u64::try_from(prefix.len() + suffix.len()).unwrap(),
variable_length: slice.is_some(),
})
}
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_mir_build/src/builder/matches/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1264,7 +1264,7 @@ enum TestableCase<'tcx> {
Variant { adt_def: ty::AdtDef<'tcx>, variant_index: VariantIdx },
Constant { value: ty::Value<'tcx> },
Range(Arc<PatRange<'tcx>>),
Slice { len: usize, variable_length: bool },
Slice { len: u64, variable_length: bool },
Deref { temp: Place<'tcx>, mutability: Mutability },
Never,
Or { pats: Box<[FlatPat<'tcx>]> },
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_mir_build/src/builder/matches/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {

TestableCase::Slice { len, variable_length } => {
let op = if variable_length { BinOp::Ge } else { BinOp::Eq };
TestKind::Len { len: len as u64, op }
TestKind::Len { len, op }
}

TestableCase::Deref { temp, mutability } => TestKind::Deref { temp, mutability },
Expand Down
43 changes: 20 additions & 23 deletions compiler/rustc_mir_transform/src/gvn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,19 @@ impl<'body, 'a, 'tcx> VnState<'body, 'a, 'tcx> {
self.ecx.typing_env()
}

fn insert_unique(
&mut self,
ty: Ty<'tcx>,
value: impl FnOnce(VnOpaque) -> Value<'a, 'tcx>,
) -> VnIndex {
let index = self.values.insert_unique(ty, value);
let _index = self.evaluated.push(None);
debug_assert_eq!(index, _index);
let _index = self.rev_locals.push(SmallVec::new());
debug_assert_eq!(index, _index);
index
}

#[instrument(level = "trace", skip(self), ret)]
fn insert(&mut self, ty: Ty<'tcx>, value: Value<'a, 'tcx>) -> VnIndex {
let (index, new) = self.values.insert(ty, value);
Expand All @@ -437,11 +450,8 @@ impl<'body, 'a, 'tcx> VnState<'body, 'a, 'tcx> {
/// from all the others.
#[instrument(level = "trace", skip(self), ret)]
fn new_opaque(&mut self, ty: Ty<'tcx>) -> VnIndex {
let index = self.values.insert_unique(ty, Value::Opaque);
let _index = self.evaluated.push(Some(None));
debug_assert_eq!(index, _index);
let _index = self.rev_locals.push(SmallVec::new());
debug_assert_eq!(index, _index);
let index = self.insert_unique(ty, Value::Opaque);
self.evaluated[index] = Some(None);
index
}

Expand Down Expand Up @@ -470,42 +480,29 @@ impl<'body, 'a, 'tcx> VnState<'body, 'a, 'tcx> {
projection.map(|proj| proj.try_map(|index| self.locals[index], |ty| ty).ok_or(()));
let projection = self.arena.try_alloc_from_iter(projection).ok()?;

let index = self.values.insert_unique(ty, |provenance| Value::Address {
let index = self.insert_unique(ty, |provenance| Value::Address {
base,
projection,
kind,
provenance,
});
let _index = self.evaluated.push(None);
debug_assert_eq!(index, _index);
let _index = self.rev_locals.push(SmallVec::new());
debug_assert_eq!(index, _index);

Some(index)
}

#[instrument(level = "trace", skip(self), ret)]
fn insert_constant(&mut self, value: Const<'tcx>) -> VnIndex {
let (index, new) = if value.is_deterministic() {
if value.is_deterministic() {
// The constant is deterministic, no need to disambiguate.
let constant = Value::Constant { value, disambiguator: None };
self.values.insert(value.ty(), constant)
self.insert(value.ty(), constant)
} else {
// Multiple mentions of this constant will yield different values,
// so assign a different `disambiguator` to ensure they do not get the same `VnIndex`.
let index = self.values.insert_unique(value.ty(), |disambiguator| Value::Constant {
self.insert_unique(value.ty(), |disambiguator| Value::Constant {
value,
disambiguator: Some(disambiguator),
});
(index, true)
};
if new {
let _index = self.evaluated.push(None);
debug_assert_eq!(index, _index);
let _index = self.rev_locals.push(SmallVec::new());
debug_assert_eq!(index, _index);
})
}
index
}

#[inline]
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_pattern_analysis/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ pub struct MatchArm<'p, Cx: PatCx> {

impl<'p, Cx: PatCx> Clone for MatchArm<'p, Cx> {
fn clone(&self) -> Self {
Self { pat: self.pat, has_guard: self.has_guard, arm_data: self.arm_data }
*self
}
}

Expand Down
5 changes: 1 addition & 4 deletions compiler/rustc_pattern_analysis/src/pat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,10 +174,7 @@ pub(crate) enum PatOrWild<'p, Cx: PatCx> {

impl<'p, Cx: PatCx> Clone for PatOrWild<'p, Cx> {
fn clone(&self) -> Self {
match self {
PatOrWild::Wild => PatOrWild::Wild,
PatOrWild::Pat(pat) => PatOrWild::Pat(pat),
}
*self
}
}

Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_pattern_analysis/src/usefulness.rs
Original file line number Diff line number Diff line change
Expand Up @@ -824,7 +824,7 @@ struct PlaceCtxt<'a, Cx: PatCx> {
impl<'a, Cx: PatCx> Copy for PlaceCtxt<'a, Cx> {}
impl<'a, Cx: PatCx> Clone for PlaceCtxt<'a, Cx> {
fn clone(&self) -> Self {
Self { cx: self.cx, ty: self.ty }
*self
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ pub(crate) fn target() -> Target {
options: TargetOptions {
abi: Abi::EabiHf,
llvm_floatabi: Some(FloatAbi::Hard),
features: "+strict-align,+v6,+vfp2,-d32".into(),
features: "+strict-align,+v6,+vfp2".into(),
max_atomic_width: Some(64),
mcount: "\u{1}__gnu_mcount_nc".into(),
llvm_mcount_intrinsic: Some("llvm.arm.gnu.eabi.mcount".into()),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pub(crate) fn target() -> Target {
llvm_floatabi: Some(FloatAbi::Hard),
// Most of these settings are copied from the arm_unknown_linux_gnueabihf
// target.
features: "+strict-align,+v6,+vfp2,-d32".into(),
features: "+strict-align,+v6,+vfp2".into(),
max_atomic_width: Some(64),
mcount: "\u{1}mcount".into(),
// FIXME(compiler-team#422): musl targets should be dynamically linked by default.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ pub(crate) fn target() -> Target {
options: TargetOptions {
abi: Abi::EabiHf,
llvm_floatabi: Some(FloatAbi::Hard),
features: "+v6,+vfp2,-d32".into(),
features: "+v6,+vfp2".into(),
max_atomic_width: Some(64),
mcount: "\u{1}__gnu_mcount_nc".into(),
llvm_mcount_intrinsic: Some("llvm.arm.gnu.eabi.mcount".into()),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ pub(crate) fn target() -> Target {
options: TargetOptions {
abi: Abi::EabiHf,
llvm_floatabi: Some(FloatAbi::Hard),
features: "+v6,+vfp2,-d32".into(),
features: "+v6,+vfp2".into(),
max_atomic_width: Some(64),
mcount: "__mcount".into(),
..base::netbsd::opts()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ pub(crate) fn target() -> Target {
options: TargetOptions {
abi: Abi::Eabi,
llvm_floatabi: Some(FloatAbi::Soft),
features: "+v7,+thumb-mode,+thumb2,+vfp3,-d32,-neon".into(),
features: "+v7,+thumb-mode,+thumb2,+vfp3d16,-neon".into(),
supported_sanitizers: SanitizerSet::ADDRESS,
max_atomic_width: Some(64),
..base
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ pub(crate) fn target() -> Target {
options: TargetOptions {
abi: Abi::EabiHf,
llvm_floatabi: Some(FloatAbi::Hard),
features: "+v7,+vfp3,-d32,+thumb2,-neon".into(),
features: "+v7,+vfp3d16,+thumb2,-neon".into(),
max_atomic_width: Some(64),
mcount: "\u{1}__gnu_mcount_nc".into(),
..base::freebsd::opts()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ pub(crate) fn target() -> Target {
abi: Abi::EabiHf,
llvm_floatabi: Some(FloatAbi::Hard),
// Info about features at https://wiki.debian.org/ArmHardFloatPort
features: "+v7,+vfp3,-d32,+thumb2,-neon".into(),
features: "+v7,+vfp3d16,+thumb2,-neon".into(),
max_atomic_width: Some(64),
mcount: "\u{1}__gnu_mcount_nc".into(),
llvm_mcount_intrinsic: Some("llvm.arm.gnu.eabi.mcount".into()),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ pub(crate) fn target() -> Target {
options: TargetOptions {
abi: Abi::EabiHf,
llvm_floatabi: Some(FloatAbi::Hard),
features: "+v7,+vfp3,-d32,+thumb2,-neon".into(),
features: "+v7,+vfp3d16,+thumb2,-neon".into(),
max_atomic_width: Some(64),
mcount: "\u{1}mcount".into(),
// FIXME(compiler-team#422): musl targets should be dynamically linked by default.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ pub(crate) fn target() -> Target {

options: TargetOptions {
// Info about features at https://wiki.debian.org/ArmHardFloatPort
features: "+v7,+vfp3,-d32,+thumb2,-neon".into(),
features: "+v7,+vfp3d16,+thumb2,-neon".into(),
cpu: "generic".into(),
max_atomic_width: Some(64),
mcount: "_mcount".into(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ pub(crate) fn target() -> Target {
options: TargetOptions {
abi: Abi::EabiHf,
llvm_floatabi: Some(FloatAbi::Hard),
features: "+v7,+vfp3,-d32,+thumb2,-neon".into(),
features: "+v7,+vfp3d16,+thumb2,-neon".into(),
max_atomic_width: Some(64),
mcount: "__mcount".into(),
..base::netbsd::opts()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pub(crate) fn target() -> Target {
abi: Abi::EabiHf,
llvm_floatabi: Some(FloatAbi::Hard),
// Info about features at https://wiki.debian.org/ArmHardFloatPort
features: "+v7,+vfp3,-d32,+thumb2,-neon".into(),
features: "+v7,+vfp3d16,+thumb2,-neon".into(),
max_atomic_width: Some(64),
..base::vxworks::opts()
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pub(crate) fn target() -> Target {
abi: Abi::EabiHf,
llvm_floatabi: Some(FloatAbi::Hard),
linker: Some("arm-kmc-eabi-gcc".into()),
features: "+v7,+vfp3,-d32,+thumb2,-neon".into(),
features: "+v7,+vfp3d16,+thumb2,-neon".into(),
relocation_model: RelocModel::Static,
disable_redzone: true,
max_atomic_width: Some(64),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pub(crate) fn target() -> Target {
llvm_floatabi: Some(FloatAbi::Hard),
linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes),
linker: Some("rust-lld".into()),
features: "+v7,+vfp3,-d32,+thumb2,-neon,+strict-align".into(),
features: "+v7,+vfp3d16,+thumb2,-neon,+strict-align".into(),
relocation_model: RelocModel::Static,
disable_redzone: true,
max_atomic_width: Some(64),
Expand Down
Loading
Loading