From f4b77355c6849085b0a841f962abae4ced5e50ba Mon Sep 17 00:00:00 2001 From: Boxy Date: Tue, 17 Jun 2025 15:02:38 +0100 Subject: [PATCH 01/17] Rename hir const arg walking functions --- compiler/rustc_ast_lowering/src/index.rs | 2 +- compiler/rustc_hir/src/intravisit.rs | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/compiler/rustc_ast_lowering/src/index.rs b/compiler/rustc_ast_lowering/src/index.rs index 956cb580d1032..a0a3a973fbeca 100644 --- a/compiler/rustc_ast_lowering/src/index.rs +++ b/compiler/rustc_ast_lowering/src/index.rs @@ -311,7 +311,7 @@ impl<'a, 'hir> Visitor<'hir> for NodeCollector<'a, 'hir> { ); self.with_parent(const_arg.hir_id, |this| { - intravisit::walk_ambig_const_arg(this, const_arg); + intravisit::walk_const_arg(this, const_arg); }); } diff --git a/compiler/rustc_hir/src/intravisit.rs b/compiler/rustc_hir/src/intravisit.rs index 57e49625148c2..c8f6978ee8be1 100644 --- a/compiler/rustc_hir/src/intravisit.rs +++ b/compiler/rustc_hir/src/intravisit.rs @@ -380,7 +380,7 @@ pub trait Visitor<'v>: Sized { /// /// The [`Visitor::visit_infer`] method should be overridden in order to handle infer vars. fn visit_const_arg(&mut self, c: &'v ConstArg<'v, AmbigArg>) -> Self::Result { - walk_ambig_const_arg(self, c) + walk_const_arg(self, c) } #[allow(unused_variables)] @@ -525,7 +525,7 @@ pub trait VisitorExt<'v>: Visitor<'v> { /// Named `visit_const_arg_unambig` instead of `visit_unambig_const_arg` to aid in /// discovery by IDes when `v.visit_const_arg` is written. fn visit_const_arg_unambig(&mut self, c: &'v ConstArg<'v>) -> Self::Result { - walk_const_arg(self, c) + walk_unambig_const_arg(self, c) } } impl<'v, V: Visitor<'v>> VisitorExt<'v> for V {} @@ -1038,7 +1038,7 @@ pub fn walk_ty<'v, V: Visitor<'v>>(visitor: &mut V, typ: &'v Ty<'v, AmbigArg>) - V::Result::output() } -pub fn walk_const_arg<'v, V: Visitor<'v>>( +pub fn walk_unambig_const_arg<'v, V: Visitor<'v>>( visitor: &mut V, const_arg: &'v ConstArg<'v>, ) -> V::Result { @@ -1052,7 +1052,7 @@ pub fn walk_const_arg<'v, V: Visitor<'v>>( } } -pub fn walk_ambig_const_arg<'v, V: Visitor<'v>>( +pub fn walk_const_arg<'v, V: Visitor<'v>>( visitor: &mut V, const_arg: &'v ConstArg<'v, AmbigArg>, ) -> V::Result { From c9264a1f4963182fb31c1da32d191bb3bac930ca Mon Sep 17 00:00:00 2001 From: Boxy Date: Tue, 17 Jun 2025 15:03:02 +0100 Subject: [PATCH 02/17] Don't double visit `HirId`s of inferred const/types --- compiler/rustc_hir/src/intravisit.rs | 2 -- 1 file changed, 2 deletions(-) diff --git a/compiler/rustc_hir/src/intravisit.rs b/compiler/rustc_hir/src/intravisit.rs index c8f6978ee8be1..cb971bedecd2c 100644 --- a/compiler/rustc_hir/src/intravisit.rs +++ b/compiler/rustc_hir/src/intravisit.rs @@ -980,7 +980,6 @@ pub fn walk_unambig_ty<'v, V: Visitor<'v>>(visitor: &mut V, typ: &'v Ty<'v>) -> Some(ambig_ty) => visitor.visit_ty(ambig_ty), None => { let Ty { hir_id, span, kind: _ } = typ; - try_visit!(visitor.visit_id(*hir_id)); visitor.visit_infer(*hir_id, *span, InferKind::Ty(typ)) } } @@ -1046,7 +1045,6 @@ pub fn walk_unambig_const_arg<'v, V: Visitor<'v>>( Some(ambig_ct) => visitor.visit_const_arg(ambig_ct), None => { let ConstArg { hir_id, kind: _ } = const_arg; - try_visit!(visitor.visit_id(*hir_id)); visitor.visit_infer(*hir_id, const_arg.span(), InferKind::Const(const_arg)) } } From 2411fbaa49f8c10d0fc8bc1a41d39d0df2f73f0f Mon Sep 17 00:00:00 2001 From: Boxy Date: Wed, 18 Jun 2025 15:58:00 +0100 Subject: [PATCH 03/17] Link to dev-guide docs --- compiler/rustc_hir/src/hir.rs | 32 ++++++++++++++++++++-------- compiler/rustc_hir/src/intravisit.rs | 22 +++++++++++++++---- 2 files changed, 41 insertions(+), 13 deletions(-) diff --git a/compiler/rustc_hir/src/hir.rs b/compiler/rustc_hir/src/hir.rs index 556f50a85af7d..bd59ad613d63e 100644 --- a/compiler/rustc_hir/src/hir.rs +++ b/compiler/rustc_hir/src/hir.rs @@ -407,10 +407,8 @@ impl<'hir> PathSegment<'hir> { /// that are [just paths](ConstArgKind::Path) (currently just bare const params) /// versus const args that are literals or have arbitrary computations (e.g., `{ 1 + 3 }`). /// -/// The `Unambig` generic parameter represents whether the position this const is from is -/// unambiguously a const or ambiguous as to whether it is a type or a const. When in an -/// ambiguous context the parameter is instantiated with an uninhabited type making the -/// [`ConstArgKind::Infer`] variant unusable and [`GenericArg::Infer`] is used instead. +/// For an explanation of the `Unambig` generic parameter see the dev-guide: +/// https://rustc-dev-guide.rust-lang.org/hir/ambig-unambig-ty-and-consts.html #[derive(Clone, Copy, Debug, HashStable_Generic)] #[repr(C)] pub struct ConstArg<'hir, Unambig = ()> { @@ -429,6 +427,9 @@ impl<'hir> ConstArg<'hir, AmbigArg> { /// In practice this may mean overriding the [`Visitor::visit_infer`][visit_infer] method on hir visitors, or /// specifically matching on [`GenericArg::Infer`] when handling generic arguments. /// + /// For an explanation of what it means for a const arg to be ambig or unambig, see the dev-guide: + /// https://rustc-dev-guide.rust-lang.org/hir/ambig-unambig-ty-and-consts.html + /// /// [visit_infer]: [rustc_hir::intravisit::Visitor::visit_infer] pub fn as_unambig_ct(&self) -> &ConstArg<'hir> { // SAFETY: `ConstArg` is `repr(C)` and `ConstArgKind` is marked `repr(u8)` so that the @@ -444,6 +445,9 @@ impl<'hir> ConstArg<'hir> { /// /// Functions accepting ambiguous consts will not handle the [`ConstArgKind::Infer`] variant, if /// infer consts are relevant to you then care should be taken to handle them separately. + /// + /// For an explanation of what it means for a const arg to be ambig or unambig, see the dev-guide: + /// https://rustc-dev-guide.rust-lang.org/hir/ambig-unambig-ty-and-consts.html pub fn try_as_ambig_ct(&self) -> Option<&ConstArg<'hir, AmbigArg>> { if let ConstArgKind::Infer(_, ()) = self.kind { return None; @@ -475,6 +479,9 @@ impl<'hir, Unambig> ConstArg<'hir, Unambig> { } /// See [`ConstArg`]. +/// +/// For an explanation of the `Unambig` generic parameter see the dev-guide: +/// https://rustc-dev-guide.rust-lang.org/hir/ambig-unambig-ty-and-consts.html #[derive(Clone, Copy, Debug, HashStable_Generic)] #[repr(u8, C)] pub enum ConstArgKind<'hir, Unambig = ()> { @@ -3302,10 +3309,8 @@ pub enum AmbigArg {} #[repr(C)] /// Represents a type in the `HIR`. /// -/// The `Unambig` generic parameter represents whether the position this type is from is -/// unambiguously a type or ambiguous as to whether it is a type or a const. When in an -/// ambiguous context the parameter is instantiated with an uninhabited type making the -/// [`TyKind::Infer`] variant unusable and [`GenericArg::Infer`] is used instead. +/// For an explanation of the `Unambig` generic parameter see the dev-guide: +/// https://rustc-dev-guide.rust-lang.org/hir/ambig-unambig-ty-and-consts.html pub struct Ty<'hir, Unambig = ()> { #[stable_hasher(ignore)] pub hir_id: HirId, @@ -3323,6 +3328,9 @@ impl<'hir> Ty<'hir, AmbigArg> { /// In practice this may mean overriding the [`Visitor::visit_infer`][visit_infer] method on hir visitors, or /// specifically matching on [`GenericArg::Infer`] when handling generic arguments. /// + /// For an explanation of what it means for a type to be ambig or unambig, see the dev-guide: + /// https://rustc-dev-guide.rust-lang.org/hir/ambig-unambig-ty-and-consts.html + /// /// [visit_infer]: [rustc_hir::intravisit::Visitor::visit_infer] pub fn as_unambig_ty(&self) -> &Ty<'hir> { // SAFETY: `Ty` is `repr(C)` and `TyKind` is marked `repr(u8)` so that the layout is @@ -3338,6 +3346,9 @@ impl<'hir> Ty<'hir> { /// /// Functions accepting ambiguous types will not handle the [`TyKind::Infer`] variant, if /// infer types are relevant to you then care should be taken to handle them separately. + /// + /// For an explanation of what it means for a type to be ambig or unambig, see the dev-guide: + /// https://rustc-dev-guide.rust-lang.org/hir/ambig-unambig-ty-and-consts.html pub fn try_as_ambig_ty(&self) -> Option<&Ty<'hir, AmbigArg>> { if let TyKind::Infer(()) = self.kind { return None; @@ -3640,9 +3651,12 @@ pub enum InferDelegationKind { } /// The various kinds of types recognized by the compiler. -#[derive(Debug, Clone, Copy, HashStable_Generic)] +/// +/// For an explanation of the `Unambig` generic parameter see the dev-guide: +/// https://rustc-dev-guide.rust-lang.org/hir/ambig-unambig-ty-and-consts.html // SAFETY: `repr(u8)` is required so that `TyKind<()>` and `TyKind` are layout compatible #[repr(u8, C)] +#[derive(Debug, Clone, Copy, HashStable_Generic)] pub enum TyKind<'hir, Unambig = ()> { /// Actual type should be inherited from `DefId` signature InferDelegation(DefId, InferDelegationKind), diff --git a/compiler/rustc_hir/src/intravisit.rs b/compiler/rustc_hir/src/intravisit.rs index cb971bedecd2c..95fee05a71b9d 100644 --- a/compiler/rustc_hir/src/intravisit.rs +++ b/compiler/rustc_hir/src/intravisit.rs @@ -364,8 +364,8 @@ pub trait Visitor<'v>: Sized { /// All types are treated as ambiguous types for the purposes of hir visiting in /// order to ensure that visitors can handle infer vars without it being too error-prone. /// - /// See the doc comments on [`Ty`] for an explanation of what it means for a type to be - /// ambiguous. + /// For an explanation of what it means for a type to be ambig, see the dev-guide: + /// https://rustc-dev-guide.rust-lang.org/hir/ambig-unambig-ty-and-consts.html /// /// The [`Visitor::visit_infer`] method should be overridden in order to handle infer vars. fn visit_ty(&mut self, t: &'v Ty<'v, AmbigArg>) -> Self::Result { @@ -375,8 +375,8 @@ pub trait Visitor<'v>: Sized { /// All consts are treated as ambiguous consts for the purposes of hir visiting in /// order to ensure that visitors can handle infer vars without it being too error-prone. /// - /// See the doc comments on [`ConstArg`] for an explanation of what it means for a const to be - /// ambiguous. + /// For an explanation of what it means for a const arg to be ambig, see the dev-guide: + /// https://rustc-dev-guide.rust-lang.org/hir/ambig-unambig-ty-and-consts.html /// /// The [`Visitor::visit_infer`] method should be overridden in order to handle infer vars. fn visit_const_arg(&mut self, c: &'v ConstArg<'v, AmbigArg>) -> Self::Result { @@ -516,6 +516,9 @@ pub trait VisitorExt<'v>: Visitor<'v> { /// /// Named `visit_ty_unambig` instead of `visit_unambig_ty` to aid in discovery /// by IDes when `v.visit_ty` is written. + /// + /// For an explanation of what it means for a type to be unambig, see the dev-guide: + /// https://rustc-dev-guide.rust-lang.org/hir/ambig-unambig-ty-and-consts.html fn visit_ty_unambig(&mut self, t: &'v Ty<'v>) -> Self::Result { walk_unambig_ty(self, t) } @@ -524,6 +527,9 @@ pub trait VisitorExt<'v>: Visitor<'v> { /// /// Named `visit_const_arg_unambig` instead of `visit_unambig_const_arg` to aid in /// discovery by IDes when `v.visit_const_arg` is written. + /// + /// For an explanation of what it means for a const arg to be unambig, see the dev-guide: + /// https://rustc-dev-guide.rust-lang.org/hir/ambig-unambig-ty-and-consts.html fn visit_const_arg_unambig(&mut self, c: &'v ConstArg<'v>) -> Self::Result { walk_unambig_const_arg(self, c) } @@ -975,6 +981,8 @@ pub fn walk_generic_arg<'v, V: Visitor<'v>>( } } +/// For an explanation of what it means for a type to be unambig, see the dev-guide: +/// https://rustc-dev-guide.rust-lang.org/hir/ambig-unambig-ty-and-consts.html pub fn walk_unambig_ty<'v, V: Visitor<'v>>(visitor: &mut V, typ: &'v Ty<'v>) -> V::Result { match typ.try_as_ambig_ty() { Some(ambig_ty) => visitor.visit_ty(ambig_ty), @@ -985,6 +993,8 @@ pub fn walk_unambig_ty<'v, V: Visitor<'v>>(visitor: &mut V, typ: &'v Ty<'v>) -> } } +/// For an explanation of what it means for a type to be ambig, see the dev-guide: +/// https://rustc-dev-guide.rust-lang.org/hir/ambig-unambig-ty-and-consts.html pub fn walk_ty<'v, V: Visitor<'v>>(visitor: &mut V, typ: &'v Ty<'v, AmbigArg>) -> V::Result { let Ty { hir_id, span: _, kind } = typ; try_visit!(visitor.visit_id(*hir_id)); @@ -1037,6 +1047,8 @@ pub fn walk_ty<'v, V: Visitor<'v>>(visitor: &mut V, typ: &'v Ty<'v, AmbigArg>) - V::Result::output() } +/// For an explanation of what it means for a const arg to be unambig, see the dev-guide: +/// https://rustc-dev-guide.rust-lang.org/hir/ambig-unambig-ty-and-consts.html pub fn walk_unambig_const_arg<'v, V: Visitor<'v>>( visitor: &mut V, const_arg: &'v ConstArg<'v>, @@ -1050,6 +1062,8 @@ pub fn walk_unambig_const_arg<'v, V: Visitor<'v>>( } } +/// For an explanation of what it means for a const arg to be ambig, see the dev-guide: +/// https://rustc-dev-guide.rust-lang.org/hir/ambig-unambig-ty-and-consts.html pub fn walk_const_arg<'v, V: Visitor<'v>>( visitor: &mut V, const_arg: &'v ConstArg<'v, AmbigArg>, From fa5895ea8c39cb2d8f7078ccd4e78a41aeb2eb84 Mon Sep 17 00:00:00 2001 From: Boxy Date: Wed, 25 Jun 2025 12:29:04 +0100 Subject: [PATCH 04/17] Reviews --- compiler/rustc_hir/src/hir.rs | 27 ++++++--------------------- compiler/rustc_hir/src/intravisit.rs | 20 -------------------- 2 files changed, 6 insertions(+), 41 deletions(-) diff --git a/compiler/rustc_hir/src/hir.rs b/compiler/rustc_hir/src/hir.rs index bd59ad613d63e..380120ecfe285 100644 --- a/compiler/rustc_hir/src/hir.rs +++ b/compiler/rustc_hir/src/hir.rs @@ -408,7 +408,7 @@ impl<'hir> PathSegment<'hir> { /// versus const args that are literals or have arbitrary computations (e.g., `{ 1 + 3 }`). /// /// For an explanation of the `Unambig` generic parameter see the dev-guide: -/// https://rustc-dev-guide.rust-lang.org/hir/ambig-unambig-ty-and-consts.html +/// #[derive(Clone, Copy, Debug, HashStable_Generic)] #[repr(C)] pub struct ConstArg<'hir, Unambig = ()> { @@ -420,16 +420,13 @@ pub struct ConstArg<'hir, Unambig = ()> { impl<'hir> ConstArg<'hir, AmbigArg> { /// Converts a `ConstArg` in an ambiguous position to one in an unambiguous position. /// - /// Functions accepting an unambiguous consts may expect the [`ConstArgKind::Infer`] variant + /// Functions accepting unambiguous consts may expect the [`ConstArgKind::Infer`] variant /// to be used. Care should be taken to separately handle infer consts when calling this /// function as it cannot be handled by downstream code making use of the returned const. /// /// In practice this may mean overriding the [`Visitor::visit_infer`][visit_infer] method on hir visitors, or /// specifically matching on [`GenericArg::Infer`] when handling generic arguments. /// - /// For an explanation of what it means for a const arg to be ambig or unambig, see the dev-guide: - /// https://rustc-dev-guide.rust-lang.org/hir/ambig-unambig-ty-and-consts.html - /// /// [visit_infer]: [rustc_hir::intravisit::Visitor::visit_infer] pub fn as_unambig_ct(&self) -> &ConstArg<'hir> { // SAFETY: `ConstArg` is `repr(C)` and `ConstArgKind` is marked `repr(u8)` so that the @@ -445,9 +442,6 @@ impl<'hir> ConstArg<'hir> { /// /// Functions accepting ambiguous consts will not handle the [`ConstArgKind::Infer`] variant, if /// infer consts are relevant to you then care should be taken to handle them separately. - /// - /// For an explanation of what it means for a const arg to be ambig or unambig, see the dev-guide: - /// https://rustc-dev-guide.rust-lang.org/hir/ambig-unambig-ty-and-consts.html pub fn try_as_ambig_ct(&self) -> Option<&ConstArg<'hir, AmbigArg>> { if let ConstArgKind::Infer(_, ()) = self.kind { return None; @@ -479,9 +473,6 @@ impl<'hir, Unambig> ConstArg<'hir, Unambig> { } /// See [`ConstArg`]. -/// -/// For an explanation of the `Unambig` generic parameter see the dev-guide: -/// https://rustc-dev-guide.rust-lang.org/hir/ambig-unambig-ty-and-consts.html #[derive(Clone, Copy, Debug, HashStable_Generic)] #[repr(u8, C)] pub enum ConstArgKind<'hir, Unambig = ()> { @@ -3305,12 +3296,12 @@ impl<'hir> AssocItemConstraintKind<'hir> { #[derive(Debug, Clone, Copy, HashStable_Generic)] pub enum AmbigArg {} -#[derive(Debug, Clone, Copy, HashStable_Generic)] -#[repr(C)] /// Represents a type in the `HIR`. /// /// For an explanation of the `Unambig` generic parameter see the dev-guide: -/// https://rustc-dev-guide.rust-lang.org/hir/ambig-unambig-ty-and-consts.html +/// +#[derive(Debug, Clone, Copy, HashStable_Generic)] +#[repr(C)] pub struct Ty<'hir, Unambig = ()> { #[stable_hasher(ignore)] pub hir_id: HirId, @@ -3328,9 +3319,6 @@ impl<'hir> Ty<'hir, AmbigArg> { /// In practice this may mean overriding the [`Visitor::visit_infer`][visit_infer] method on hir visitors, or /// specifically matching on [`GenericArg::Infer`] when handling generic arguments. /// - /// For an explanation of what it means for a type to be ambig or unambig, see the dev-guide: - /// https://rustc-dev-guide.rust-lang.org/hir/ambig-unambig-ty-and-consts.html - /// /// [visit_infer]: [rustc_hir::intravisit::Visitor::visit_infer] pub fn as_unambig_ty(&self) -> &Ty<'hir> { // SAFETY: `Ty` is `repr(C)` and `TyKind` is marked `repr(u8)` so that the layout is @@ -3346,9 +3334,6 @@ impl<'hir> Ty<'hir> { /// /// Functions accepting ambiguous types will not handle the [`TyKind::Infer`] variant, if /// infer types are relevant to you then care should be taken to handle them separately. - /// - /// For an explanation of what it means for a type to be ambig or unambig, see the dev-guide: - /// https://rustc-dev-guide.rust-lang.org/hir/ambig-unambig-ty-and-consts.html pub fn try_as_ambig_ty(&self) -> Option<&Ty<'hir, AmbigArg>> { if let TyKind::Infer(()) = self.kind { return None; @@ -3653,7 +3638,7 @@ pub enum InferDelegationKind { /// The various kinds of types recognized by the compiler. /// /// For an explanation of the `Unambig` generic parameter see the dev-guide: -/// https://rustc-dev-guide.rust-lang.org/hir/ambig-unambig-ty-and-consts.html +/// // SAFETY: `repr(u8)` is required so that `TyKind<()>` and `TyKind` are layout compatible #[repr(u8, C)] #[derive(Debug, Clone, Copy, HashStable_Generic)] diff --git a/compiler/rustc_hir/src/intravisit.rs b/compiler/rustc_hir/src/intravisit.rs index 95fee05a71b9d..aa96ff1eb1af8 100644 --- a/compiler/rustc_hir/src/intravisit.rs +++ b/compiler/rustc_hir/src/intravisit.rs @@ -364,9 +364,6 @@ pub trait Visitor<'v>: Sized { /// All types are treated as ambiguous types for the purposes of hir visiting in /// order to ensure that visitors can handle infer vars without it being too error-prone. /// - /// For an explanation of what it means for a type to be ambig, see the dev-guide: - /// https://rustc-dev-guide.rust-lang.org/hir/ambig-unambig-ty-and-consts.html - /// /// The [`Visitor::visit_infer`] method should be overridden in order to handle infer vars. fn visit_ty(&mut self, t: &'v Ty<'v, AmbigArg>) -> Self::Result { walk_ty(self, t) @@ -375,9 +372,6 @@ pub trait Visitor<'v>: Sized { /// All consts are treated as ambiguous consts for the purposes of hir visiting in /// order to ensure that visitors can handle infer vars without it being too error-prone. /// - /// For an explanation of what it means for a const arg to be ambig, see the dev-guide: - /// https://rustc-dev-guide.rust-lang.org/hir/ambig-unambig-ty-and-consts.html - /// /// The [`Visitor::visit_infer`] method should be overridden in order to handle infer vars. fn visit_const_arg(&mut self, c: &'v ConstArg<'v, AmbigArg>) -> Self::Result { walk_const_arg(self, c) @@ -516,9 +510,6 @@ pub trait VisitorExt<'v>: Visitor<'v> { /// /// Named `visit_ty_unambig` instead of `visit_unambig_ty` to aid in discovery /// by IDes when `v.visit_ty` is written. - /// - /// For an explanation of what it means for a type to be unambig, see the dev-guide: - /// https://rustc-dev-guide.rust-lang.org/hir/ambig-unambig-ty-and-consts.html fn visit_ty_unambig(&mut self, t: &'v Ty<'v>) -> Self::Result { walk_unambig_ty(self, t) } @@ -527,9 +518,6 @@ pub trait VisitorExt<'v>: Visitor<'v> { /// /// Named `visit_const_arg_unambig` instead of `visit_unambig_const_arg` to aid in /// discovery by IDes when `v.visit_const_arg` is written. - /// - /// For an explanation of what it means for a const arg to be unambig, see the dev-guide: - /// https://rustc-dev-guide.rust-lang.org/hir/ambig-unambig-ty-and-consts.html fn visit_const_arg_unambig(&mut self, c: &'v ConstArg<'v>) -> Self::Result { walk_unambig_const_arg(self, c) } @@ -981,8 +969,6 @@ pub fn walk_generic_arg<'v, V: Visitor<'v>>( } } -/// For an explanation of what it means for a type to be unambig, see the dev-guide: -/// https://rustc-dev-guide.rust-lang.org/hir/ambig-unambig-ty-and-consts.html pub fn walk_unambig_ty<'v, V: Visitor<'v>>(visitor: &mut V, typ: &'v Ty<'v>) -> V::Result { match typ.try_as_ambig_ty() { Some(ambig_ty) => visitor.visit_ty(ambig_ty), @@ -993,8 +979,6 @@ pub fn walk_unambig_ty<'v, V: Visitor<'v>>(visitor: &mut V, typ: &'v Ty<'v>) -> } } -/// For an explanation of what it means for a type to be ambig, see the dev-guide: -/// https://rustc-dev-guide.rust-lang.org/hir/ambig-unambig-ty-and-consts.html pub fn walk_ty<'v, V: Visitor<'v>>(visitor: &mut V, typ: &'v Ty<'v, AmbigArg>) -> V::Result { let Ty { hir_id, span: _, kind } = typ; try_visit!(visitor.visit_id(*hir_id)); @@ -1047,8 +1031,6 @@ pub fn walk_ty<'v, V: Visitor<'v>>(visitor: &mut V, typ: &'v Ty<'v, AmbigArg>) - V::Result::output() } -/// For an explanation of what it means for a const arg to be unambig, see the dev-guide: -/// https://rustc-dev-guide.rust-lang.org/hir/ambig-unambig-ty-and-consts.html pub fn walk_unambig_const_arg<'v, V: Visitor<'v>>( visitor: &mut V, const_arg: &'v ConstArg<'v>, @@ -1062,8 +1044,6 @@ pub fn walk_unambig_const_arg<'v, V: Visitor<'v>>( } } -/// For an explanation of what it means for a const arg to be ambig, see the dev-guide: -/// https://rustc-dev-guide.rust-lang.org/hir/ambig-unambig-ty-and-consts.html pub fn walk_const_arg<'v, V: Visitor<'v>>( visitor: &mut V, const_arg: &'v ConstArg<'v, AmbigArg>, From 19c6815a212d86c389ef54c3ddb02697ffc45f93 Mon Sep 17 00:00:00 2001 From: lucarlig Date: Fri, 1 Aug 2025 18:27:59 +0100 Subject: [PATCH 05/17] Multiple bounds checking elision failures --- .../bounds-check-elision-slice-min.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 tests/codegen-llvm/bounds-check-elision-slice-min.rs diff --git a/tests/codegen-llvm/bounds-check-elision-slice-min.rs b/tests/codegen-llvm/bounds-check-elision-slice-min.rs new file mode 100644 index 0000000000000..e160e5da50f93 --- /dev/null +++ b/tests/codegen-llvm/bounds-check-elision-slice-min.rs @@ -0,0 +1,19 @@ +//! Regression test for #: +//! Multiple bounds checking elision failures +//! (ensures bounds checks are properly elided, +//! with no calls to panic_bounds_check in the LLVM IR). + +//@ compile-flags: -C opt-level=3 + +#![crate_type = "lib"] + +// CHECK-LABEL: @foo +// CHECK-NOT: panic_bounds_check +#[no_mangle] +pub fn foo(buf: &[u8], alloced_size: usize) -> &[u8] { + if alloced_size.checked_add(1).map(|total| buf.len() < total).unwrap_or(true) { + return &[]; + } + let size = buf[0]; + &buf[1..1 + usize::min(alloced_size, usize::from(size))] +} From ae2f8d921654f01e008824385fb1e1d7b36ce705 Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Thu, 31 Jul 2025 14:56:49 +0000 Subject: [PATCH 06/17] Remove the omit_gdb_pretty_printer_section attribute Disabling loading of pretty printers in the debugger itself is more reliable. Before this commit the .gdb_debug_scripts section couldn't be included in dylibs or rlibs as otherwise there is no way to disable the section anymore without recompiling the entire standard library. --- .../src/attributes/codegen_attrs.rs | 8 - compiler/rustc_attr_parsing/src/context.rs | 6 +- .../rustc_codegen_llvm/src/debuginfo/gdb.rs | 8 +- compiler/rustc_feature/src/builtin_attrs.rs | 5 - compiler/rustc_feature/src/removed.rs | 2 + compiler/rustc_feature/src/unstable.rs | 2 - .../rustc_hir/src/attrs/data_structures.rs | 3 - .../rustc_hir/src/attrs/encode_cross_crate.rs | 1 - compiler/rustc_passes/src/check_attr.rs | 3 +- .../rustc-dev-guide/src/tests/directives.md | 1 + src/tools/compiletest/src/directives.rs | 10 ++ .../src/directives/directive_names.rs | 1 + .../compiletest/src/runtest/debuginfo.rs | 4 +- tests/debuginfo/associated-types.rs | 3 +- .../debuginfo/auxiliary/cross_crate_spans.rs | 2 - .../debuginfo/basic-types-globals-metadata.rs | 3 +- tests/debuginfo/basic-types-globals.rs | 3 +- tests/debuginfo/basic-types-metadata.rs | 3 +- tests/debuginfo/basic-types-mut-globals.rs | 3 +- tests/debuginfo/basic-types.rs | 3 +- tests/debuginfo/borrowed-basic.rs | 3 +- tests/debuginfo/borrowed-c-style-enum.rs | 3 +- tests/debuginfo/borrowed-enum.rs | 3 +- tests/debuginfo/borrowed-struct.rs | 3 +- tests/debuginfo/borrowed-tuple.rs | 3 +- tests/debuginfo/borrowed-unique-basic.rs | 3 +- tests/debuginfo/box.rs | 3 +- tests/debuginfo/boxed-struct.rs | 3 +- .../by-value-non-immediate-argument.rs | 4 +- .../by-value-self-argument-in-trait-impl.rs | 4 +- tests/debuginfo/c-style-enum-in-composite.rs | 3 +- tests/debuginfo/c-style-enum.rs | 3 +- .../debuginfo/closure-in-generic-function.rs | 4 +- tests/debuginfo/constant-debug-locs.rs | 3 +- tests/debuginfo/constant-in-match-pattern.rs | 3 +- tests/debuginfo/coroutine-locals.rs | 4 +- tests/debuginfo/coroutine-objects.rs | 4 +- tests/debuginfo/cross-crate-spans.rs | 8 +- tests/debuginfo/destructured-fn-argument.rs | 3 +- .../destructured-for-loop-variable.rs | 3 +- tests/debuginfo/destructured-local.rs | 3 +- tests/debuginfo/enum-thinlto.rs | 3 +- tests/debuginfo/evec-in-struct.rs | 3 +- tests/debuginfo/extern-c-fn.rs | 4 +- .../debuginfo/function-arg-initialization.rs | 3 +- tests/debuginfo/function-arguments.rs | 5 +- tests/debuginfo/function-names.rs | 3 +- .../function-prologue-stepping-regular.rs | 3 +- tests/debuginfo/gdb-char.rs | 3 +- .../generic-enum-with-different-disr-sizes.rs | 3 +- tests/debuginfo/generic-function.rs | 4 +- tests/debuginfo/generic-functions-nested.rs | 5 +- .../generic-method-on-generic-struct.rs | 4 +- ...eneric-static-method-on-struct-and-enum.rs | 4 +- tests/debuginfo/generic-struct-style-enum.rs | 4 +- tests/debuginfo/generic-struct.rs | 4 +- tests/debuginfo/generic-tuple-style-enum.rs | 3 +- tests/debuginfo/include_string.rs | 3 +- tests/debuginfo/issue-12886.rs | 5 +- tests/debuginfo/issue-22656.rs | 3 +- tests/debuginfo/issue-57822.rs | 4 +- tests/debuginfo/lexical-scope-in-for-loop.rs | 4 +- tests/debuginfo/lexical-scope-in-if.rs | 4 +- tests/debuginfo/lexical-scope-in-match.rs | 4 +- .../lexical-scope-in-stack-closure.rs | 4 +- .../lexical-scope-in-unconditional-loop.rs | 4 +- .../lexical-scope-in-unique-closure.rs | 4 +- tests/debuginfo/lexical-scope-in-while.rs | 4 +- tests/debuginfo/lexical-scope-with-macro.rs | 4 +- .../lexical-scopes-in-block-expression.rs | 3 +- tests/debuginfo/limited-debuginfo.rs | 3 +- tests/debuginfo/method-on-enum.rs | 4 +- tests/debuginfo/method-on-generic-struct.rs | 4 +- tests/debuginfo/method-on-struct.rs | 4 +- tests/debuginfo/method-on-trait.rs | 4 +- tests/debuginfo/method-on-tuple-struct.rs | 4 +- tests/debuginfo/multi-cgu.rs | 4 +- .../multiple-functions-equal-var-names.rs | 3 +- tests/debuginfo/multiple-functions.rs | 3 +- .../name-shadowing-and-scope-nesting.rs | 4 +- tests/debuginfo/option-like-enum.rs | 4 +- .../packed-struct-with-destructor.rs | 3 +- tests/debuginfo/packed-struct.rs | 3 +- tests/debuginfo/recursive-enum.rs | 3 +- tests/debuginfo/recursive-struct.rs | 3 +- tests/debuginfo/reference-debuginfo.rs | 3 +- tests/debuginfo/self-in-default-method.rs | 4 +- .../self-in-generic-default-method.rs | 4 +- tests/debuginfo/shadowed-argument.rs | 4 +- tests/debuginfo/shadowed-variable.rs | 4 +- tests/debuginfo/simd.rs | 3 +- tests/debuginfo/simple-lexical-scope.rs | 4 +- tests/debuginfo/simple-struct.rs | 3 +- tests/debuginfo/simple-tuple.rs | 3 +- .../static-method-on-struct-and-enum.rs | 4 +- tests/debuginfo/strings-and-strs.rs | 3 +- tests/debuginfo/struct-in-enum.rs | 3 +- tests/debuginfo/struct-in-struct.rs | 3 +- tests/debuginfo/struct-namespace.rs | 3 +- tests/debuginfo/struct-style-enum.rs | 3 +- tests/debuginfo/struct-with-destructor.rs | 3 +- tests/debuginfo/trait-pointers.rs | 3 +- tests/debuginfo/tuple-in-struct.rs | 3 +- tests/debuginfo/tuple-in-tuple.rs | 3 +- tests/debuginfo/tuple-struct.rs | 4 +- tests/debuginfo/tuple-style-enum.rs | 3 +- tests/debuginfo/type-names.rs | 3 +- tests/debuginfo/union-smoke.rs | 3 +- tests/debuginfo/unique-enum.rs | 3 +- tests/debuginfo/unreachable-locals.rs | 3 +- tests/debuginfo/unsized.rs | 4 +- .../var-captured-in-nested-closure.rs | 3 +- .../var-captured-in-sendable-closure.rs | 3 +- .../var-captured-in-stack-closure.rs | 3 +- tests/debuginfo/vec-slices.rs | 3 +- tests/debuginfo/vec.rs | 3 +- tests/ui/attributes/malformed-attrs.rs | 4 - tests/ui/attributes/malformed-attrs.stderr | 169 +++++++++--------- ...re-gate-omit-gdb-pretty-printer-section.rs | 2 - ...ate-omit-gdb-pretty-printer-section.stderr | 12 -- 120 files changed, 209 insertions(+), 387 deletions(-) delete mode 100644 tests/ui/feature-gates/feature-gate-omit-gdb-pretty-printer-section.rs delete mode 100644 tests/ui/feature-gates/feature-gate-omit-gdb-pretty-printer-section.stderr diff --git a/compiler/rustc_attr_parsing/src/attributes/codegen_attrs.rs b/compiler/rustc_attr_parsing/src/attributes/codegen_attrs.rs index 7c8ef90ed7f15..c5fb11dbf6a09 100644 --- a/compiler/rustc_attr_parsing/src/attributes/codegen_attrs.rs +++ b/compiler/rustc_attr_parsing/src/attributes/codegen_attrs.rs @@ -374,11 +374,3 @@ impl CombineAttributeParser for TargetFeatureParser { features } } - -pub(crate) struct OmitGdbPrettyPrinterSectionParser; - -impl NoArgsAttributeParser for OmitGdbPrettyPrinterSectionParser { - const PATH: &[Symbol] = &[sym::omit_gdb_pretty_printer_section]; - const ON_DUPLICATE: OnDuplicate = OnDuplicate::Error; - const CREATE: fn(Span) -> AttributeKind = |_| AttributeKind::OmitGdbPrettyPrinterSection; -} diff --git a/compiler/rustc_attr_parsing/src/context.rs b/compiler/rustc_attr_parsing/src/context.rs index 54c0fbcd06262..0fccaf94e27f3 100644 --- a/compiler/rustc_attr_parsing/src/context.rs +++ b/compiler/rustc_attr_parsing/src/context.rs @@ -17,9 +17,8 @@ use crate::attributes::allow_unstable::{ AllowConstFnUnstableParser, AllowInternalUnstableParser, UnstableFeatureBoundParser, }; use crate::attributes::codegen_attrs::{ - ColdParser, CoverageParser, ExportNameParser, NakedParser, NoMangleParser, - OmitGdbPrettyPrinterSectionParser, OptimizeParser, TargetFeatureParser, TrackCallerParser, - UsedParser, + ColdParser, CoverageParser, ExportNameParser, NakedParser, NoMangleParser, OptimizeParser, + TargetFeatureParser, TrackCallerParser, UsedParser, }; use crate::attributes::confusables::ConfusablesParser; use crate::attributes::deprecation::DeprecationParser; @@ -187,7 +186,6 @@ attribute_parsers!( Single>, Single>, Single>, - Single>, Single>, Single>, Single>, diff --git a/compiler/rustc_codegen_llvm/src/debuginfo/gdb.rs b/compiler/rustc_codegen_llvm/src/debuginfo/gdb.rs index bcfa0381cc1b8..6eb7042da6171 100644 --- a/compiler/rustc_codegen_llvm/src/debuginfo/gdb.rs +++ b/compiler/rustc_codegen_llvm/src/debuginfo/gdb.rs @@ -2,9 +2,7 @@ use rustc_codegen_ssa::base::collect_debugger_visualizers_transitive; use rustc_codegen_ssa::traits::*; -use rustc_hir::attrs::AttributeKind; use rustc_hir::def_id::LOCAL_CRATE; -use rustc_hir::find_attr; use rustc_middle::bug; use rustc_middle::middle::debugger_visualizer::DebuggerVisualizerType; use rustc_session::config::{CrateType, DebugInfo}; @@ -86,9 +84,6 @@ pub(crate) fn get_or_insert_gdb_debug_scripts_section_global<'ll>( } pub(crate) fn needs_gdb_debug_scripts_section(cx: &CodegenCx<'_, '_>) -> bool { - let omit_gdb_pretty_printer_section = - find_attr!(cx.tcx.hir_krate_attrs(), AttributeKind::OmitGdbPrettyPrinterSection); - // To ensure the section `__rustc_debug_gdb_scripts_section__` will not create // ODR violations at link time, this section will not be emitted for rlibs since // each rlib could produce a different set of visualizers that would be embedded @@ -117,8 +112,7 @@ pub(crate) fn needs_gdb_debug_scripts_section(cx: &CodegenCx<'_, '_>) -> bool { } }); - !omit_gdb_pretty_printer_section - && cx.sess().opts.debuginfo != DebugInfo::None + cx.sess().opts.debuginfo != DebugInfo::None && cx.sess().target.emit_debug_gdb_scripts && embed_visualizers } diff --git a/compiler/rustc_feature/src/builtin_attrs.rs b/compiler/rustc_feature/src/builtin_attrs.rs index ceb7fc5bf6f8a..5c63d4808db2f 100644 --- a/compiler/rustc_feature/src/builtin_attrs.rs +++ b/compiler/rustc_feature/src/builtin_attrs.rs @@ -1257,11 +1257,6 @@ pub static BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[ TEST, rustc_dummy, Normal, template!(Word /* doesn't matter*/), DuplicatesOk, EncodeCrossCrate::No ), - gated!( - omit_gdb_pretty_printer_section, Normal, template!(Word), - WarnFollowing, EncodeCrossCrate::No, - "the `#[omit_gdb_pretty_printer_section]` attribute is just used for the Rust test suite", - ), rustc_attr!( TEST, pattern_complexity_limit, CrateLevel, template!(NameValueStr: "N"), ErrorFollowing, EncodeCrossCrate::No, diff --git a/compiler/rustc_feature/src/removed.rs b/compiler/rustc_feature/src/removed.rs index 7e174c465d59a..4eee79a2a71e8 100644 --- a/compiler/rustc_feature/src/removed.rs +++ b/compiler/rustc_feature/src/removed.rs @@ -199,6 +199,8 @@ declare_features! ( /// Renamed to `dyn_compatible_for_dispatch`. (removed, object_safe_for_dispatch, "1.83.0", Some(43561), Some("renamed to `dyn_compatible_for_dispatch`"), 131511), + /// Allows using `#[omit_gdb_pretty_printer_section]`. + (removed, omit_gdb_pretty_printer_section, "CURRENT_RUSTC_VERSION", None, None, 144738), /// Allows using `#[on_unimplemented(..)]` on traits. /// (Moved to `rustc_attrs`.) (removed, on_unimplemented, "1.40.0", None, None, 65794), diff --git a/compiler/rustc_feature/src/unstable.rs b/compiler/rustc_feature/src/unstable.rs index e985e04ba3307..1303b3317e05a 100644 --- a/compiler/rustc_feature/src/unstable.rs +++ b/compiler/rustc_feature/src/unstable.rs @@ -225,8 +225,6 @@ declare_features! ( (unstable, multiple_supertrait_upcastable, "1.69.0", None), /// Allow negative trait bounds. This is an internal-only feature for testing the trait solver! (internal, negative_bounds, "1.71.0", None), - /// Allows using `#[omit_gdb_pretty_printer_section]`. - (internal, omit_gdb_pretty_printer_section, "1.5.0", None), /// Set the maximum pattern complexity allowed (not limited by default). (internal, pattern_complexity_limit, "1.78.0", None), /// Allows using pattern types. diff --git a/compiler/rustc_hir/src/attrs/data_structures.rs b/compiler/rustc_hir/src/attrs/data_structures.rs index 80f5e6177f758..80618422b56d6 100644 --- a/compiler/rustc_hir/src/attrs/data_structures.rs +++ b/compiler/rustc_hir/src/attrs/data_structures.rs @@ -391,9 +391,6 @@ pub enum AttributeKind { /// Represents `#[non_exhaustive]` NonExhaustive(Span), - /// Represents `#[omit_gdb_pretty_printer_section]` - OmitGdbPrettyPrinterSection, - /// Represents `#[optimize(size|speed)]` Optimize(OptimizeAttr, Span), diff --git a/compiler/rustc_hir/src/attrs/encode_cross_crate.rs b/compiler/rustc_hir/src/attrs/encode_cross_crate.rs index bbdecb2986e00..9644a597a3117 100644 --- a/compiler/rustc_hir/src/attrs/encode_cross_crate.rs +++ b/compiler/rustc_hir/src/attrs/encode_cross_crate.rs @@ -55,7 +55,6 @@ impl AttributeKind { NoImplicitPrelude(..) => No, NoMangle(..) => Yes, // Needed for rustdoc NonExhaustive(..) => Yes, // Needed for rustdoc - OmitGdbPrettyPrinterSection => No, Optimize(..) => No, ParenSugar(..) => No, PassByValue(..) => Yes, diff --git a/compiler/rustc_passes/src/check_attr.rs b/compiler/rustc_passes/src/check_attr.rs index ede74bdc0df62..2663d5fe99c7a 100644 --- a/compiler/rustc_passes/src/check_attr.rs +++ b/compiler/rustc_passes/src/check_attr.rs @@ -289,8 +289,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> { | AttributeKind::MacroTransparency(_) | AttributeKind::Pointee(..) | AttributeKind::Dummy - | AttributeKind::RustcBuiltinMacro { .. } - | AttributeKind::OmitGdbPrettyPrinterSection, + | AttributeKind::RustcBuiltinMacro { .. }, ) => { /* do nothing */ } Attribute::Parsed(AttributeKind::AsPtr(attr_span)) => { self.check_applied_to_fn_or_method(hir_id, *attr_span, span, target) diff --git a/src/doc/rustc-dev-guide/src/tests/directives.md b/src/doc/rustc-dev-guide/src/tests/directives.md index 89e4d3e9b58ec..08975777210c2 100644 --- a/src/doc/rustc-dev-guide/src/tests/directives.md +++ b/src/doc/rustc-dev-guide/src/tests/directives.md @@ -298,6 +298,7 @@ See [Pretty-printer](compiletest.md#pretty-printer-tests). - [`should-ice`](compiletest.md#incremental-tests) — incremental cfail should ICE - [`reference`] — an annotation linking to a rule in the reference +- `disable-gdb-pretty-printers` — disable gdb pretty printers for debuginfo tests [`reference`]: https://github.com/rust-lang/reference/blob/master/docs/authoring.md#test-rule-annotations diff --git a/src/tools/compiletest/src/directives.rs b/src/tools/compiletest/src/directives.rs index 54511f4fd0855..13e694b7f03ca 100644 --- a/src/tools/compiletest/src/directives.rs +++ b/src/tools/compiletest/src/directives.rs @@ -203,6 +203,8 @@ pub struct TestProps { pub add_core_stubs: bool, /// Whether line annotatins are required for the given error kind. pub dont_require_annotations: HashSet, + /// Whether pretty printers should be disabled in gdb. + pub disable_gdb_pretty_printers: bool, } mod directives { @@ -251,6 +253,7 @@ mod directives { pub const ADD_CORE_STUBS: &'static str = "add-core-stubs"; // This isn't a real directive, just one that is probably mistyped often pub const INCORRECT_COMPILER_FLAGS: &'static str = "compiler-flags"; + pub const DISABLE_GDB_PRETTY_PRINTERS: &'static str = "disable-gdb-pretty-printers"; } impl TestProps { @@ -306,6 +309,7 @@ impl TestProps { has_enzyme: false, add_core_stubs: false, dont_require_annotations: Default::default(), + disable_gdb_pretty_printers: false, } } @@ -654,6 +658,12 @@ impl TestProps { self.dont_require_annotations .insert(ErrorKind::expect_from_user_str(err_kind.trim())); } + + config.set_name_directive( + ln, + DISABLE_GDB_PRETTY_PRINTERS, + &mut self.disable_gdb_pretty_printers, + ); }, ); diff --git a/src/tools/compiletest/src/directives/directive_names.rs b/src/tools/compiletest/src/directives/directive_names.rs index 7fc76a42e0ca1..f7955429d8369 100644 --- a/src/tools/compiletest/src/directives/directive_names.rs +++ b/src/tools/compiletest/src/directives/directive_names.rs @@ -18,6 +18,7 @@ pub(crate) const KNOWN_DIRECTIVE_NAMES: &[&str] = &[ "check-stdout", "check-test-line-numbers-match", "compile-flags", + "disable-gdb-pretty-printers", "doc-flags", "dont-check-compiler-stderr", "dont-check-compiler-stdout", diff --git a/src/tools/compiletest/src/runtest/debuginfo.rs b/src/tools/compiletest/src/runtest/debuginfo.rs index 471e4a4c81934..6114afdc9df57 100644 --- a/src/tools/compiletest/src/runtest/debuginfo.rs +++ b/src/tools/compiletest/src/runtest/debuginfo.rs @@ -259,7 +259,9 @@ impl TestCx<'_> { Some(version) => { println!("NOTE: compiletest thinks it is using GDB version {}", version); - if version > extract_gdb_version("7.4").unwrap() { + if !self.props.disable_gdb_pretty_printers + && version > extract_gdb_version("7.4").unwrap() + { // Add the directory containing the pretty printers to // GDB's script auto loading safe path script_str.push_str(&format!( diff --git a/tests/debuginfo/associated-types.rs b/tests/debuginfo/associated-types.rs index b20bd5209368e..7c2a793c8cd39 100644 --- a/tests/debuginfo/associated-types.rs +++ b/tests/debuginfo/associated-types.rs @@ -1,4 +1,5 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== // gdb-command:run @@ -68,8 +69,6 @@ #![allow(unused_variables)] #![allow(dead_code)] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] trait TraitWithAssocType { type Type; diff --git a/tests/debuginfo/auxiliary/cross_crate_spans.rs b/tests/debuginfo/auxiliary/cross_crate_spans.rs index af853ee0b003d..d0d32c2cbe32a 100644 --- a/tests/debuginfo/auxiliary/cross_crate_spans.rs +++ b/tests/debuginfo/auxiliary/cross_crate_spans.rs @@ -1,8 +1,6 @@ #![crate_type = "rlib"] #![allow(unused_variables)] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] //@ no-prefer-dynamic //@ compile-flags:-g diff --git a/tests/debuginfo/basic-types-globals-metadata.rs b/tests/debuginfo/basic-types-globals-metadata.rs index aec8ff183ad75..fc8f6dc173fcc 100644 --- a/tests/debuginfo/basic-types-globals-metadata.rs +++ b/tests/debuginfo/basic-types-globals-metadata.rs @@ -1,4 +1,5 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers // gdb-command:run // gdb-command:whatis basic_types_globals_metadata::B @@ -35,8 +36,6 @@ #![allow(unused_variables)] #![allow(dead_code)] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] #![feature(f16)] // N.B. These are `mut` only so they don't constant fold away. diff --git a/tests/debuginfo/basic-types-globals.rs b/tests/debuginfo/basic-types-globals.rs index 15a0deb64c125..9d28820ce685c 100644 --- a/tests/debuginfo/basic-types-globals.rs +++ b/tests/debuginfo/basic-types-globals.rs @@ -1,6 +1,7 @@ //@ revisions: lto no-lto //@ compile-flags:-g +//@ disable-gdb-pretty-printers //@ [lto] compile-flags:-C lto //@ [lto] no-prefer-dynamic @@ -39,8 +40,6 @@ // gdb-command:continue #![allow(unused_variables)] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] #![feature(f16)] // N.B. These are `mut` only so they don't constant fold away. diff --git a/tests/debuginfo/basic-types-metadata.rs b/tests/debuginfo/basic-types-metadata.rs index 6b7cfbdebca92..941db81a4decc 100644 --- a/tests/debuginfo/basic-types-metadata.rs +++ b/tests/debuginfo/basic-types-metadata.rs @@ -1,4 +1,5 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers // gdb-command:run // gdb-command:whatis unit @@ -53,8 +54,6 @@ // gdb-command:continue #![allow(unused_variables)] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] #![feature(f16)] fn main() { diff --git a/tests/debuginfo/basic-types-mut-globals.rs b/tests/debuginfo/basic-types-mut-globals.rs index f6a2399d230a8..e979d82b55c62 100644 --- a/tests/debuginfo/basic-types-mut-globals.rs +++ b/tests/debuginfo/basic-types-mut-globals.rs @@ -5,6 +5,7 @@ // its numerical value. //@ compile-flags:-g +//@ disable-gdb-pretty-printers // gdb-command:run @@ -74,8 +75,6 @@ // gdb-check:$30 = 9.25 #![allow(unused_variables)] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] #![feature(f16)] static mut B: bool = false; diff --git a/tests/debuginfo/basic-types.rs b/tests/debuginfo/basic-types.rs index fea5262bc41da..7862f45b3c4e6 100644 --- a/tests/debuginfo/basic-types.rs +++ b/tests/debuginfo/basic-types.rs @@ -5,6 +5,7 @@ // its numerical value. //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -112,8 +113,6 @@ // cdb-check:s : [...] [Type: ref$] #![allow(unused_variables)] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] #![feature(f16)] fn main() { diff --git a/tests/debuginfo/borrowed-basic.rs b/tests/debuginfo/borrowed-basic.rs index 91de691e78e13..334eae38318e6 100644 --- a/tests/debuginfo/borrowed-basic.rs +++ b/tests/debuginfo/borrowed-basic.rs @@ -1,4 +1,5 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -96,8 +97,6 @@ // lldb-check:[...] 3.5 #![allow(unused_variables)] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] #![feature(f16)] fn main() { diff --git a/tests/debuginfo/borrowed-c-style-enum.rs b/tests/debuginfo/borrowed-c-style-enum.rs index 6a91d4f965045..d382a389fe412 100644 --- a/tests/debuginfo/borrowed-c-style-enum.rs +++ b/tests/debuginfo/borrowed-c-style-enum.rs @@ -1,4 +1,5 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -28,8 +29,6 @@ // lldb-check:[...] TheC #![allow(unused_variables)] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] enum ABC { TheA, TheB, TheC } diff --git a/tests/debuginfo/borrowed-enum.rs b/tests/debuginfo/borrowed-enum.rs index c5a795fdede66..517b439ff15ca 100644 --- a/tests/debuginfo/borrowed-enum.rs +++ b/tests/debuginfo/borrowed-enum.rs @@ -1,6 +1,7 @@ //@ min-lldb-version: 1800 //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -28,8 +29,6 @@ // lldb-check:(borrowed_enum::Univariant) *univariant_ref = { value = { 0 = 4820353753753434 } } #![allow(unused_variables)] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] // The first element is to ensure proper alignment, irrespective of the machines word size. Since // the size of the discriminant value is machine dependent, this has be taken into account when diff --git a/tests/debuginfo/borrowed-struct.rs b/tests/debuginfo/borrowed-struct.rs index 245af35f50554..5d64ba3cbefbd 100644 --- a/tests/debuginfo/borrowed-struct.rs +++ b/tests/debuginfo/borrowed-struct.rs @@ -1,4 +1,5 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -52,8 +53,6 @@ // lldb-check:[...] 26.5 #![allow(unused_variables)] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] struct SomeStruct { x: isize, diff --git a/tests/debuginfo/borrowed-tuple.rs b/tests/debuginfo/borrowed-tuple.rs index 9e4ceec033ec6..fd4e22feb0691 100644 --- a/tests/debuginfo/borrowed-tuple.rs +++ b/tests/debuginfo/borrowed-tuple.rs @@ -1,4 +1,5 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -29,8 +30,6 @@ #![allow(unused_variables)] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] fn main() { let stack_val: (i16, f32) = (-14, -19f32); diff --git a/tests/debuginfo/borrowed-unique-basic.rs b/tests/debuginfo/borrowed-unique-basic.rs index 7a9b4d1df825b..54d7f27bb0c80 100644 --- a/tests/debuginfo/borrowed-unique-basic.rs +++ b/tests/debuginfo/borrowed-unique-basic.rs @@ -1,4 +1,5 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -100,8 +101,6 @@ // lldb-check:[...] 3.5 #![allow(unused_variables)] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] #![feature(f16)] fn main() { diff --git a/tests/debuginfo/box.rs b/tests/debuginfo/box.rs index d22566c0b179c..d4612f98a5f17 100644 --- a/tests/debuginfo/box.rs +++ b/tests/debuginfo/box.rs @@ -1,4 +1,5 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -19,8 +20,6 @@ // lldb-check:[...] { 0 = 2 1 = 3.5 } #![allow(unused_variables)] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] fn main() { let a = Box::new(1); diff --git a/tests/debuginfo/boxed-struct.rs b/tests/debuginfo/boxed-struct.rs index 158609fb2ed72..ca072693cdcd0 100644 --- a/tests/debuginfo/boxed-struct.rs +++ b/tests/debuginfo/boxed-struct.rs @@ -1,4 +1,5 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -22,8 +23,6 @@ // lldb-check:[...] { x = 77 y = 777 z = 7777 w = 77777 } #![allow(unused_variables)] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] struct StructWithSomePadding { x: i16, diff --git a/tests/debuginfo/by-value-non-immediate-argument.rs b/tests/debuginfo/by-value-non-immediate-argument.rs index deacea5f6ccd8..b5b0df73a68a4 100644 --- a/tests/debuginfo/by-value-non-immediate-argument.rs +++ b/tests/debuginfo/by-value-non-immediate-argument.rs @@ -1,6 +1,7 @@ //@ min-lldb-version: 1800 //@ min-gdb-version: 13.0 //@ compile-flags:-g +//@ disable-gdb-pretty-printers //@ ignore-windows-gnu: #128973 //@ ignore-aarch64-unknown-linux-gnu (gdb tries to read from 0x0; FIXME: #128973) //@ ignore-powerpc64: #128973 on both -gnu and -musl @@ -62,9 +63,6 @@ // lldb-check:[...] Case1 { x: 0, y: 8970181431921507452 } // lldb-command:continue -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] - #[derive(Clone)] struct Struct { a: isize, diff --git a/tests/debuginfo/by-value-self-argument-in-trait-impl.rs b/tests/debuginfo/by-value-self-argument-in-trait-impl.rs index 6981fdfc9e114..a49a375569b12 100644 --- a/tests/debuginfo/by-value-self-argument-in-trait-impl.rs +++ b/tests/debuginfo/by-value-self-argument-in-trait-impl.rs @@ -1,4 +1,5 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -33,9 +34,6 @@ // lldb-check:[...] { 0 = 4444.5 1 = 5555 2 = 6666 3 = 7777.5 } // lldb-command:continue -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] - trait Trait { fn method(self) -> Self; } diff --git a/tests/debuginfo/c-style-enum-in-composite.rs b/tests/debuginfo/c-style-enum-in-composite.rs index 642879cf3b672..47b4b980f9ccd 100644 --- a/tests/debuginfo/c-style-enum-in-composite.rs +++ b/tests/debuginfo/c-style-enum-in-composite.rs @@ -1,4 +1,5 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -51,8 +52,6 @@ // lldb-check:[...] { 0 = { a = OneHundred b = Vienna } 1 = 9 } #![allow(unused_variables)] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] use self::AnEnum::{OneHundred, OneThousand, OneMillion}; use self::AnotherEnum::{MountainView, Toronto, Vienna}; diff --git a/tests/debuginfo/c-style-enum.rs b/tests/debuginfo/c-style-enum.rs index 08378f7af181c..d5455be0cb56b 100644 --- a/tests/debuginfo/c-style-enum.rs +++ b/tests/debuginfo/c-style-enum.rs @@ -1,6 +1,7 @@ //@ ignore-aarch64 //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -88,8 +89,6 @@ #![allow(unused_variables)] #![allow(dead_code)] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] use self::AutoDiscriminant::{One, Two, Three}; use self::ManualDiscriminant::{OneHundred, OneThousand, OneMillion}; diff --git a/tests/debuginfo/closure-in-generic-function.rs b/tests/debuginfo/closure-in-generic-function.rs index 0c6a6fdfca1b2..0bb72209cc822 100644 --- a/tests/debuginfo/closure-in-generic-function.rs +++ b/tests/debuginfo/closure-in-generic-function.rs @@ -1,4 +1,5 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -33,9 +34,6 @@ // lldb-check:[...] 110 // lldb-command:continue -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] - fn some_generic_fun(a: T1, b: T2) -> (T2, T1) { let closure = |x, y| { diff --git a/tests/debuginfo/constant-debug-locs.rs b/tests/debuginfo/constant-debug-locs.rs index 81115fc3c3847..d13b8648b18a6 100644 --- a/tests/debuginfo/constant-debug-locs.rs +++ b/tests/debuginfo/constant-debug-locs.rs @@ -1,8 +1,7 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers #![allow(dead_code, unused_variables)] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] // This test makes sure that the compiler doesn't crash when trying to assign // debug locations to const-expressions. diff --git a/tests/debuginfo/constant-in-match-pattern.rs b/tests/debuginfo/constant-in-match-pattern.rs index 952db216debf1..922e0a5d8da23 100644 --- a/tests/debuginfo/constant-in-match-pattern.rs +++ b/tests/debuginfo/constant-in-match-pattern.rs @@ -1,8 +1,7 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers #![allow(dead_code, unused_variables)] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] // This test makes sure that the compiler doesn't crash when trying to assign // debug locations to 'constant' patterns in match expressions. diff --git a/tests/debuginfo/coroutine-locals.rs b/tests/debuginfo/coroutine-locals.rs index f3593adc9453a..c2b8aef8a6738 100644 --- a/tests/debuginfo/coroutine-locals.rs +++ b/tests/debuginfo/coroutine-locals.rs @@ -1,4 +1,5 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -44,8 +45,7 @@ // lldb-command:v c // lldb-check:(int) c = 6 -#![feature(omit_gdb_pretty_printer_section, coroutines, coroutine_trait, stmt_expr_attributes)] -#![omit_gdb_pretty_printer_section] +#![feature(coroutines, coroutine_trait, stmt_expr_attributes)] use std::ops::Coroutine; use std::pin::Pin; diff --git a/tests/debuginfo/coroutine-objects.rs b/tests/debuginfo/coroutine-objects.rs index 242c76c2989e3..7ead154cbdb1f 100644 --- a/tests/debuginfo/coroutine-objects.rs +++ b/tests/debuginfo/coroutine-objects.rs @@ -5,6 +5,7 @@ // ensure that LLDB won't crash at least (like #57822). //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -53,8 +54,7 @@ // cdb-check: b : Returned [Type: enum2$] // cdb-check: [+0x[...]] _ref__a : 0x[...] : 6 [Type: int *] -#![feature(omit_gdb_pretty_printer_section, coroutines, coroutine_trait, stmt_expr_attributes)] -#![omit_gdb_pretty_printer_section] +#![feature(coroutines, coroutine_trait, stmt_expr_attributes)] use std::ops::Coroutine; use std::pin::Pin; diff --git a/tests/debuginfo/cross-crate-spans.rs b/tests/debuginfo/cross-crate-spans.rs index e337aaf5a6c9c..38176e46909c5 100644 --- a/tests/debuginfo/cross-crate-spans.rs +++ b/tests/debuginfo/cross-crate-spans.rs @@ -1,15 +1,13 @@ -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] - //@ aux-build:cross_crate_spans.rs extern crate cross_crate_spans; //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== -// gdb-command:break cross_crate_spans.rs:14 +// gdb-command:break cross_crate_spans.rs:12 // gdb-command:run // gdb-command:print result @@ -32,7 +30,7 @@ extern crate cross_crate_spans; // === LLDB TESTS ================================================================================== -// lldb-command:b cross_crate_spans.rs:14 +// lldb-command:b cross_crate_spans.rs:12 // lldb-command:run // lldb-command:v result diff --git a/tests/debuginfo/destructured-fn-argument.rs b/tests/debuginfo/destructured-fn-argument.rs index 37a7bb2b77864..fe8f91588e06a 100644 --- a/tests/debuginfo/destructured-fn-argument.rs +++ b/tests/debuginfo/destructured-fn-argument.rs @@ -1,4 +1,5 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -299,8 +300,6 @@ #![allow(unused_variables)] #![feature(box_patterns)] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] use self::Univariant::Unit; diff --git a/tests/debuginfo/destructured-for-loop-variable.rs b/tests/debuginfo/destructured-for-loop-variable.rs index cc16be1268ae7..01c524083daee 100644 --- a/tests/debuginfo/destructured-for-loop-variable.rs +++ b/tests/debuginfo/destructured-for-loop-variable.rs @@ -1,4 +1,5 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -141,8 +142,6 @@ #![allow(unused_variables)] #![feature(box_patterns)] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] struct Struct { x: i16, diff --git a/tests/debuginfo/destructured-local.rs b/tests/debuginfo/destructured-local.rs index fad96ca7d4b66..ff24c924aada3 100644 --- a/tests/debuginfo/destructured-local.rs +++ b/tests/debuginfo/destructured-local.rs @@ -1,4 +1,5 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -232,8 +233,6 @@ #![allow(unused_variables)] #![feature(box_patterns)] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] use self::Univariant::Unit; diff --git a/tests/debuginfo/enum-thinlto.rs b/tests/debuginfo/enum-thinlto.rs index af77145c312d7..6eb33b2ef46a7 100644 --- a/tests/debuginfo/enum-thinlto.rs +++ b/tests/debuginfo/enum-thinlto.rs @@ -1,5 +1,6 @@ //@ min-lldb-version: 1800 //@ compile-flags:-g -Z thinlto +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -16,8 +17,6 @@ // lldb-check:(enum_thinlto::ABC) *abc = { value = { x = 0 y = 8970181431921507452 } $discr$ = 0 } #![allow(unused_variables)] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] // The first element is to ensure proper alignment, irrespective of the machines word size. Since // the size of the discriminant value is machine dependent, this has be taken into account when diff --git a/tests/debuginfo/evec-in-struct.rs b/tests/debuginfo/evec-in-struct.rs index 303669cf06cd2..f08c436bbe3ae 100644 --- a/tests/debuginfo/evec-in-struct.rs +++ b/tests/debuginfo/evec-in-struct.rs @@ -1,4 +1,5 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -38,8 +39,6 @@ // lldb-check:[...] { x = { [0] = 22 [1] = 23 } y = { [0] = 24 [1] = 25 } } #![allow(unused_variables)] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] struct NoPadding1 { x: [u32; 3], diff --git a/tests/debuginfo/extern-c-fn.rs b/tests/debuginfo/extern-c-fn.rs index 4642073faabcb..7130658f2d82b 100644 --- a/tests/debuginfo/extern-c-fn.rs +++ b/tests/debuginfo/extern-c-fn.rs @@ -1,4 +1,5 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== // gdb-command:run @@ -32,9 +33,6 @@ #![allow(unused_variables)] #![allow(dead_code)] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] - #[no_mangle] pub unsafe extern "C" fn fn_with_c_abi(s: *const u8, len: i32) -> i32 { diff --git a/tests/debuginfo/function-arg-initialization.rs b/tests/debuginfo/function-arg-initialization.rs index ae54d56623c60..03fb1e2d062f5 100644 --- a/tests/debuginfo/function-arg-initialization.rs +++ b/tests/debuginfo/function-arg-initialization.rs @@ -8,6 +8,7 @@ //@ min-lldb-version: 1800 //@ compile-flags:-g -Zmir-enable-passes=-SingleUseConsts // SingleUseConsts shouldn't need to be disabled, see #128945 +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -214,8 +215,6 @@ #![allow(unused_variables)] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] fn immediate_args(a: isize, b: bool, c: f64) { zzz(); // #break diff --git a/tests/debuginfo/function-arguments.rs b/tests/debuginfo/function-arguments.rs index 21c0c7d859cc9..64d026a705bfb 100644 --- a/tests/debuginfo/function-arguments.rs +++ b/tests/debuginfo/function-arguments.rs @@ -1,4 +1,5 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -32,10 +33,6 @@ // lldb-check:[...] 3000 // lldb-command:continue - -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] - fn main() { fun(111102, true); diff --git a/tests/debuginfo/function-names.rs b/tests/debuginfo/function-names.rs index c51884451e56f..b5aec5c595e73 100644 --- a/tests/debuginfo/function-names.rs +++ b/tests/debuginfo/function-names.rs @@ -2,6 +2,7 @@ //@ min-gdb-version: 10.1 //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -78,8 +79,6 @@ // cdb-check:[...] a!function_names::const_generic_fn_bool (void) #![allow(unused_variables)] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] #![feature(adt_const_params, coroutines, coroutine_trait, stmt_expr_attributes)] #![allow(incomplete_features)] diff --git a/tests/debuginfo/function-prologue-stepping-regular.rs b/tests/debuginfo/function-prologue-stepping-regular.rs index 07b9356fb507f..f61128ca2df1d 100644 --- a/tests/debuginfo/function-prologue-stepping-regular.rs +++ b/tests/debuginfo/function-prologue-stepping-regular.rs @@ -4,6 +4,7 @@ //@ min-lldb-version: 1800 //@ ignore-gdb //@ compile-flags:-g +//@ disable-gdb-pretty-printers // lldb-command:breakpoint set --name immediate_args // lldb-command:breakpoint set --name non_immediate_args @@ -116,8 +117,6 @@ // lldb-command:continue #![allow(unused_variables)] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] fn immediate_args(a: isize, b: bool, c: f64) { () diff --git a/tests/debuginfo/gdb-char.rs b/tests/debuginfo/gdb-char.rs index 7d8608d4f5119..d296e675fa3e6 100644 --- a/tests/debuginfo/gdb-char.rs +++ b/tests/debuginfo/gdb-char.rs @@ -3,6 +3,7 @@ //@ min-gdb-version: 11.2 //@ compile-flags: -g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -11,8 +12,6 @@ // gdb-check:$1 = 97 'a' #![allow(unused_variables)] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] fn main() { let ch: char = 'a'; diff --git a/tests/debuginfo/generic-enum-with-different-disr-sizes.rs b/tests/debuginfo/generic-enum-with-different-disr-sizes.rs index e723543a37b20..5c5f05d9c4b1c 100644 --- a/tests/debuginfo/generic-enum-with-different-disr-sizes.rs +++ b/tests/debuginfo/generic-enum-with-different-disr-sizes.rs @@ -1,6 +1,7 @@ //@ ignore-lldb: FIXME(#27089) //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== // gdb-command:run @@ -57,8 +58,6 @@ #![allow(unused_variables)] #![allow(dead_code)] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] // This test case makes sure that we get correct type descriptions for the enum // discriminant of different instantiations of the same generic enum type where, diff --git a/tests/debuginfo/generic-function.rs b/tests/debuginfo/generic-function.rs index 4be8d5ad45aa5..ab3cb6953ace4 100644 --- a/tests/debuginfo/generic-function.rs +++ b/tests/debuginfo/generic-function.rs @@ -1,4 +1,5 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -44,9 +45,6 @@ // lldb-check:[...] { a = 6 b = 7.5 } // lldb-command:continue -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] - #[derive(Clone)] struct Struct { a: isize, diff --git a/tests/debuginfo/generic-functions-nested.rs b/tests/debuginfo/generic-functions-nested.rs index 7e0c20f890384..8ac2b8b9d7a1d 100644 --- a/tests/debuginfo/generic-functions-nested.rs +++ b/tests/debuginfo/generic-functions-nested.rs @@ -1,4 +1,5 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -57,10 +58,6 @@ // lldb-check:[...] 2.5 // lldb-command:continue - -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] - fn outer(a: TA) { inner(a.clone(), 1); inner(a.clone(), 2.5f64); diff --git a/tests/debuginfo/generic-method-on-generic-struct.rs b/tests/debuginfo/generic-method-on-generic-struct.rs index 9c587ca2839bd..36a94f2999d7d 100644 --- a/tests/debuginfo/generic-method-on-generic-struct.rs +++ b/tests/debuginfo/generic-method-on-generic-struct.rs @@ -1,4 +1,5 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -99,9 +100,6 @@ // lldb-check:[...] -10.5 // lldb-command:continue -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] - #[derive(Copy, Clone)] struct Struct { x: T diff --git a/tests/debuginfo/generic-static-method-on-struct-and-enum.rs b/tests/debuginfo/generic-static-method-on-struct-and-enum.rs index 79fe2144cf4bc..09b515d69e495 100644 --- a/tests/debuginfo/generic-static-method-on-struct-and-enum.rs +++ b/tests/debuginfo/generic-static-method-on-struct-and-enum.rs @@ -1,4 +1,5 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers // gdb-command:run @@ -19,9 +20,6 @@ // gdb-command:continue -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] - struct Struct { x: isize } diff --git a/tests/debuginfo/generic-struct-style-enum.rs b/tests/debuginfo/generic-struct-style-enum.rs index a5529ab8027d1..4f580f8c515d2 100644 --- a/tests/debuginfo/generic-struct-style-enum.rs +++ b/tests/debuginfo/generic-struct-style-enum.rs @@ -1,4 +1,5 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers // gdb-command:set print union on // gdb-command:run @@ -16,9 +17,6 @@ // gdb-check:$4 = generic_struct_style_enum::Univariant::TheOnlyCase{a: -1} -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] - use self::Regular::{Case1, Case2, Case3}; use self::Univariant::TheOnlyCase; diff --git a/tests/debuginfo/generic-struct.rs b/tests/debuginfo/generic-struct.rs index f26d823d4f2e7..0196ca435447b 100644 --- a/tests/debuginfo/generic-struct.rs +++ b/tests/debuginfo/generic-struct.rs @@ -1,4 +1,5 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -49,9 +50,6 @@ // cdb-check:[...]value [Type: generic_struct::AGenericStruct] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] - struct AGenericStruct { key: TKey, value: TValue diff --git a/tests/debuginfo/generic-tuple-style-enum.rs b/tests/debuginfo/generic-tuple-style-enum.rs index 4a5996645cb47..719b5c6161f00 100644 --- a/tests/debuginfo/generic-tuple-style-enum.rs +++ b/tests/debuginfo/generic-tuple-style-enum.rs @@ -1,4 +1,5 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -30,8 +31,6 @@ // lldb-command:v univariant -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] use self::Regular::{Case1, Case2, Case3}; use self::Univariant::TheOnlyCase; diff --git a/tests/debuginfo/include_string.rs b/tests/debuginfo/include_string.rs index 704b85e1ac2d0..4ec23b68262a2 100644 --- a/tests/debuginfo/include_string.rs +++ b/tests/debuginfo/include_string.rs @@ -2,6 +2,7 @@ // ^ test temporarily disabled as it fails under gdb 15 //@ compile-flags:-g +//@ disable-gdb-pretty-printers // gdb-command:run // gdb-command:print string1.length // gdb-check:$1 = 48 @@ -26,8 +27,6 @@ // lldb-command:continue #![allow(unused_variables)] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] // This test case makes sure that debug info does not ICE when include_str is // used multiple times (see issue #11322). diff --git a/tests/debuginfo/issue-12886.rs b/tests/debuginfo/issue-12886.rs index 48250e885374d..5574294cd57c9 100644 --- a/tests/debuginfo/issue-12886.rs +++ b/tests/debuginfo/issue-12886.rs @@ -2,14 +2,13 @@ //@ ignore-aarch64 //@ compile-flags:-g +//@ disable-gdb-pretty-printers // gdb-command:run // gdb-command:next -// gdb-check:[...]23[...]let s = Some(5).unwrap(); // #break +// gdb-check:[...]22[...]let s = Some(5).unwrap(); // #break // gdb-command:continue -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] // IF YOU MODIFY THIS FILE, BE CAREFUL TO ADAPT THE LINE NUMBERS IN THE DEBUGGER COMMANDS diff --git a/tests/debuginfo/issue-22656.rs b/tests/debuginfo/issue-22656.rs index eb0b38cfa4d6b..3407c0524ebb1 100644 --- a/tests/debuginfo/issue-22656.rs +++ b/tests/debuginfo/issue-22656.rs @@ -5,6 +5,7 @@ //@ ignore-gdb //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === LLDB TESTS ================================================================================== // lldb-command:run @@ -16,8 +17,6 @@ #![allow(unused_variables)] #![allow(dead_code)] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] struct ZeroSizedStruct; diff --git a/tests/debuginfo/issue-57822.rs b/tests/debuginfo/issue-57822.rs index 7abac1c14d327..ba4e01196a4cb 100644 --- a/tests/debuginfo/issue-57822.rs +++ b/tests/debuginfo/issue-57822.rs @@ -3,6 +3,7 @@ //@ min-lldb-version: 1800 //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -24,8 +25,7 @@ // lldb-command:v b // lldb-check:(issue_57822::main::{coroutine_env#3}) b = { value = { a = { value = { y = 2 } $discr$ = '\x02' } } $discr$ = '\x02' } -#![feature(omit_gdb_pretty_printer_section, coroutines, coroutine_trait, stmt_expr_attributes)] -#![omit_gdb_pretty_printer_section] +#![feature(coroutines, coroutine_trait, stmt_expr_attributes)] use std::ops::Coroutine; use std::pin::Pin; diff --git a/tests/debuginfo/lexical-scope-in-for-loop.rs b/tests/debuginfo/lexical-scope-in-for-loop.rs index 08f244f89a02e..f591f48ad59d9 100644 --- a/tests/debuginfo/lexical-scope-in-for-loop.rs +++ b/tests/debuginfo/lexical-scope-in-for-loop.rs @@ -1,4 +1,5 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -73,9 +74,6 @@ // lldb-check:[...] 1000000 // lldb-command:continue -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] - fn main() { let range = [1, 2, 3]; diff --git a/tests/debuginfo/lexical-scope-in-if.rs b/tests/debuginfo/lexical-scope-in-if.rs index c0e1f2f3e05cc..2b3a4ee5fc4a4 100644 --- a/tests/debuginfo/lexical-scope-in-if.rs +++ b/tests/debuginfo/lexical-scope-in-if.rs @@ -1,4 +1,5 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -121,9 +122,6 @@ // lldb-check:[...] -1 // lldb-command:continue -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] - fn main() { let x = 999; diff --git a/tests/debuginfo/lexical-scope-in-match.rs b/tests/debuginfo/lexical-scope-in-match.rs index 9169c19c6a331..0e369c6ca1645 100644 --- a/tests/debuginfo/lexical-scope-in-match.rs +++ b/tests/debuginfo/lexical-scope-in-match.rs @@ -1,4 +1,5 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -113,9 +114,6 @@ // lldb-check:[...] 232 // lldb-command:continue -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] - struct Struct { x: isize, y: isize diff --git a/tests/debuginfo/lexical-scope-in-stack-closure.rs b/tests/debuginfo/lexical-scope-in-stack-closure.rs index d01162c39d69f..483d5dda86ce5 100644 --- a/tests/debuginfo/lexical-scope-in-stack-closure.rs +++ b/tests/debuginfo/lexical-scope-in-stack-closure.rs @@ -1,4 +1,5 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -57,9 +58,6 @@ // lldb-check:[...] false // lldb-command:continue -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] - fn main() { let x = false; diff --git a/tests/debuginfo/lexical-scope-in-unconditional-loop.rs b/tests/debuginfo/lexical-scope-in-unconditional-loop.rs index dfec570218f34..129d0b8c83deb 100644 --- a/tests/debuginfo/lexical-scope-in-unconditional-loop.rs +++ b/tests/debuginfo/lexical-scope-in-unconditional-loop.rs @@ -1,4 +1,5 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -119,9 +120,6 @@ // lldb-check:[...] 2 // lldb-command:continue -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] - fn main() { let mut x = 0; diff --git a/tests/debuginfo/lexical-scope-in-unique-closure.rs b/tests/debuginfo/lexical-scope-in-unique-closure.rs index db84005121aff..93bea18d7cd9b 100644 --- a/tests/debuginfo/lexical-scope-in-unique-closure.rs +++ b/tests/debuginfo/lexical-scope-in-unique-closure.rs @@ -1,4 +1,5 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -58,9 +59,6 @@ // lldb-command:continue -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] - fn main() { let x = false; diff --git a/tests/debuginfo/lexical-scope-in-while.rs b/tests/debuginfo/lexical-scope-in-while.rs index d6536d77545ba..5fe76851bd7f0 100644 --- a/tests/debuginfo/lexical-scope-in-while.rs +++ b/tests/debuginfo/lexical-scope-in-while.rs @@ -1,4 +1,5 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -119,9 +120,6 @@ // lldb-check:[...] 2 // lldb-command:continue -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] - fn main() { let mut x = 0; diff --git a/tests/debuginfo/lexical-scope-with-macro.rs b/tests/debuginfo/lexical-scope-with-macro.rs index 6e8fef201eadc..efec9a3b1ce7d 100644 --- a/tests/debuginfo/lexical-scope-with-macro.rs +++ b/tests/debuginfo/lexical-scope-with-macro.rs @@ -1,4 +1,5 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -97,9 +98,6 @@ // lldb-check:[...] 400 // lldb-command:continue -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] - macro_rules! trivial { ($e1:expr) => ($e1) } diff --git a/tests/debuginfo/lexical-scopes-in-block-expression.rs b/tests/debuginfo/lexical-scopes-in-block-expression.rs index cd27c88db58e9..bec69ec87e849 100644 --- a/tests/debuginfo/lexical-scopes-in-block-expression.rs +++ b/tests/debuginfo/lexical-scopes-in-block-expression.rs @@ -1,4 +1,5 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -336,8 +337,6 @@ #![allow(unused_variables)] #![allow(unused_assignments)] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] static mut MUT_INT: isize = 0; diff --git a/tests/debuginfo/limited-debuginfo.rs b/tests/debuginfo/limited-debuginfo.rs index fb453d8078ce9..c3b516460aa34 100644 --- a/tests/debuginfo/limited-debuginfo.rs +++ b/tests/debuginfo/limited-debuginfo.rs @@ -1,6 +1,7 @@ //@ ignore-lldb //@ compile-flags:-C debuginfo=1 +//@ disable-gdb-pretty-printers // Make sure functions have proper names // gdb-command:info functions @@ -18,8 +19,6 @@ #![allow(unused_variables)] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] struct Struct { a: i64, diff --git a/tests/debuginfo/method-on-enum.rs b/tests/debuginfo/method-on-enum.rs index 754b4a2dc26c5..f86cf8ccfdf76 100644 --- a/tests/debuginfo/method-on-enum.rs +++ b/tests/debuginfo/method-on-enum.rs @@ -2,6 +2,7 @@ //@ min-gdb-version: 13.0 //@ compile-flags:-g +//@ disable-gdb-pretty-printers //@ ignore-windows-gnu: #128973 @@ -104,9 +105,6 @@ // lldb-check:[...] -10 // lldb-command:continue -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] - #[derive(Copy, Clone)] enum Enum { Variant1 { x: u16, y: u16 }, diff --git a/tests/debuginfo/method-on-generic-struct.rs b/tests/debuginfo/method-on-generic-struct.rs index 1e6c9d66178aa..5da952fa4e106 100644 --- a/tests/debuginfo/method-on-generic-struct.rs +++ b/tests/debuginfo/method-on-generic-struct.rs @@ -1,4 +1,5 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -99,9 +100,6 @@ // lldb-check:[...] -10 // lldb-command:continue -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] - #[derive(Copy, Clone)] struct Struct { x: T diff --git a/tests/debuginfo/method-on-struct.rs b/tests/debuginfo/method-on-struct.rs index 91f609365e9a5..83badd8dbf01f 100644 --- a/tests/debuginfo/method-on-struct.rs +++ b/tests/debuginfo/method-on-struct.rs @@ -1,4 +1,5 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -99,9 +100,6 @@ // lldb-check:[...] -10 // lldb-command:continue -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] - #[derive(Copy, Clone)] struct Struct { x: isize diff --git a/tests/debuginfo/method-on-trait.rs b/tests/debuginfo/method-on-trait.rs index 7b95e1f81c701..c91b255bd6afe 100644 --- a/tests/debuginfo/method-on-trait.rs +++ b/tests/debuginfo/method-on-trait.rs @@ -1,4 +1,5 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -99,9 +100,6 @@ // lldb-check:[...] -10 // lldb-command:continue -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] - #[derive(Copy, Clone)] struct Struct { x: isize diff --git a/tests/debuginfo/method-on-tuple-struct.rs b/tests/debuginfo/method-on-tuple-struct.rs index 04c00d883025e..7e6e724d42eb5 100644 --- a/tests/debuginfo/method-on-tuple-struct.rs +++ b/tests/debuginfo/method-on-tuple-struct.rs @@ -1,4 +1,5 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -99,9 +100,6 @@ // lldb-check:[...] -10 // lldb-command:continue -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] - #[derive(Copy, Clone)] struct TupleStruct(isize, f64); diff --git a/tests/debuginfo/multi-cgu.rs b/tests/debuginfo/multi-cgu.rs index 3bb5269adeadd..ca4146da405e5 100644 --- a/tests/debuginfo/multi-cgu.rs +++ b/tests/debuginfo/multi-cgu.rs @@ -2,6 +2,7 @@ // compiled with multiple codegen units. (see #39160) //@ compile-flags:-g -Ccodegen-units=2 +//@ disable-gdb-pretty-printers // === GDB TESTS =============================================================== @@ -29,9 +30,6 @@ // lldb-command:continue -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] - mod a { pub fn foo(xxx: u32) { super::_zzz(); // #break diff --git a/tests/debuginfo/multiple-functions-equal-var-names.rs b/tests/debuginfo/multiple-functions-equal-var-names.rs index 6ae9225d55c38..2bc40b87e6f5e 100644 --- a/tests/debuginfo/multiple-functions-equal-var-names.rs +++ b/tests/debuginfo/multiple-functions-equal-var-names.rs @@ -1,4 +1,5 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -32,8 +33,6 @@ // lldb-check:[...] 30303 #![allow(unused_variables)] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] fn function_one() { let abc = 10101; diff --git a/tests/debuginfo/multiple-functions.rs b/tests/debuginfo/multiple-functions.rs index 3f7a0ded91b0b..5469408c78fb0 100644 --- a/tests/debuginfo/multiple-functions.rs +++ b/tests/debuginfo/multiple-functions.rs @@ -1,4 +1,5 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -32,8 +33,6 @@ // lldb-check:[...] 30303 #![allow(unused_variables)] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] fn function_one() { let a = 10101; diff --git a/tests/debuginfo/name-shadowing-and-scope-nesting.rs b/tests/debuginfo/name-shadowing-and-scope-nesting.rs index d3829b60713d7..e8d85473d8639 100644 --- a/tests/debuginfo/name-shadowing-and-scope-nesting.rs +++ b/tests/debuginfo/name-shadowing-and-scope-nesting.rs @@ -1,4 +1,5 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -81,9 +82,6 @@ // lldb-check:[...] 20 // lldb-command:continue -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] - fn main() { let x = false; let y = true; diff --git a/tests/debuginfo/option-like-enum.rs b/tests/debuginfo/option-like-enum.rs index 72a41986dcef0..5a55b143fbbd5 100644 --- a/tests/debuginfo/option-like-enum.rs +++ b/tests/debuginfo/option-like-enum.rs @@ -2,6 +2,7 @@ //@ min-gdb-version: 13.0 //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -69,9 +70,6 @@ // lldb-check:[...] Nope -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] - // If a struct has exactly two variants, one of them is empty, and the other one // contains a non-nullable pointer, then this value is used as the discriminator. // The test cases in this file make sure that something readable is generated for diff --git a/tests/debuginfo/packed-struct-with-destructor.rs b/tests/debuginfo/packed-struct-with-destructor.rs index f923d36953c7a..0c5725ca25cd6 100644 --- a/tests/debuginfo/packed-struct-with-destructor.rs +++ b/tests/debuginfo/packed-struct-with-destructor.rs @@ -1,4 +1,5 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -60,8 +61,6 @@ #![allow(unused_variables)] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] #[repr(packed)] struct Packed { diff --git a/tests/debuginfo/packed-struct.rs b/tests/debuginfo/packed-struct.rs index 2b3652fe86113..3bc39adee831d 100644 --- a/tests/debuginfo/packed-struct.rs +++ b/tests/debuginfo/packed-struct.rs @@ -1,4 +1,5 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -46,8 +47,6 @@ // lldb-check:[...] 40 #![allow(unused_variables)] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] #[repr(packed)] struct Packed { diff --git a/tests/debuginfo/recursive-enum.rs b/tests/debuginfo/recursive-enum.rs index b861e6d617c88..5fb339f54f396 100644 --- a/tests/debuginfo/recursive-enum.rs +++ b/tests/debuginfo/recursive-enum.rs @@ -1,14 +1,13 @@ //@ ignore-lldb //@ compile-flags:-g +//@ disable-gdb-pretty-printers // gdb-command:run // Test whether compiling a recursive enum definition crashes debug info generation. The test case // is taken from issue #11083 and #135093. #![allow(unused_variables)] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] pub struct Window<'a> { callbacks: WindowCallbacks<'a> diff --git a/tests/debuginfo/recursive-struct.rs b/tests/debuginfo/recursive-struct.rs index a97eb295eb437..5be909928480f 100644 --- a/tests/debuginfo/recursive-struct.rs +++ b/tests/debuginfo/recursive-struct.rs @@ -1,6 +1,7 @@ //@ ignore-lldb //@ compile-flags:-g +//@ disable-gdb-pretty-printers // gdb-command:run @@ -58,8 +59,6 @@ // gdb-command:continue #![allow(unused_variables)] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] use self::Opt::{Empty, Val}; use std::boxed::Box as B; diff --git a/tests/debuginfo/reference-debuginfo.rs b/tests/debuginfo/reference-debuginfo.rs index 773c3ae4bc366..242da1dd65410 100644 --- a/tests/debuginfo/reference-debuginfo.rs +++ b/tests/debuginfo/reference-debuginfo.rs @@ -3,6 +3,7 @@ // and leaves codegen to create a ladder of allocations so as `*a == b`. // //@ compile-flags:-g -Zmir-enable-passes=+ReferencePropagation,-ConstDebugInfo +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -106,8 +107,6 @@ // lldb-check:[...] 3.5 #![allow(unused_variables)] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] #![feature(f16)] fn main() { diff --git a/tests/debuginfo/self-in-default-method.rs b/tests/debuginfo/self-in-default-method.rs index 02fc01d96eb3c..4297129e0cf8c 100644 --- a/tests/debuginfo/self-in-default-method.rs +++ b/tests/debuginfo/self-in-default-method.rs @@ -1,4 +1,5 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -99,9 +100,6 @@ // lldb-check:[...] -10 // lldb-command:continue -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] - #[derive(Copy, Clone)] struct Struct { x: isize diff --git a/tests/debuginfo/self-in-generic-default-method.rs b/tests/debuginfo/self-in-generic-default-method.rs index 65018e549ee04..e7ffa05f4188e 100644 --- a/tests/debuginfo/self-in-generic-default-method.rs +++ b/tests/debuginfo/self-in-generic-default-method.rs @@ -1,4 +1,5 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -99,9 +100,6 @@ // lldb-check:[...] -10.5 // lldb-command:continue -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] - #[derive(Copy, Clone)] struct Struct { x: isize diff --git a/tests/debuginfo/shadowed-argument.rs b/tests/debuginfo/shadowed-argument.rs index 3a575b4addfd5..3a0f0ad17a819 100644 --- a/tests/debuginfo/shadowed-argument.rs +++ b/tests/debuginfo/shadowed-argument.rs @@ -1,4 +1,5 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -46,9 +47,6 @@ // lldb-command:continue -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] - fn a_function(x: bool, y: bool) { zzz(); // #break sentinel(); diff --git a/tests/debuginfo/shadowed-variable.rs b/tests/debuginfo/shadowed-variable.rs index 752e4c233f12e..6a658a7c49430 100644 --- a/tests/debuginfo/shadowed-variable.rs +++ b/tests/debuginfo/shadowed-variable.rs @@ -1,4 +1,5 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -68,9 +69,6 @@ // lldb-check:[...] 20 // lldb-command:continue -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] - fn main() { let x = false; let y = true; diff --git a/tests/debuginfo/simd.rs b/tests/debuginfo/simd.rs index 12675a71a5708..43cd7130b252d 100644 --- a/tests/debuginfo/simd.rs +++ b/tests/debuginfo/simd.rs @@ -7,6 +7,7 @@ //@ ignore-s390x //@ compile-flags:-g +//@ disable-gdb-pretty-printers // gdb-command:run // gdb-command:print vi8x16 @@ -35,8 +36,6 @@ // gdb-command:continue #![allow(unused_variables)] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] #![feature(repr_simd)] #[repr(simd)] diff --git a/tests/debuginfo/simple-lexical-scope.rs b/tests/debuginfo/simple-lexical-scope.rs index 6008489bd65db..64afcf8d61dce 100644 --- a/tests/debuginfo/simple-lexical-scope.rs +++ b/tests/debuginfo/simple-lexical-scope.rs @@ -1,4 +1,5 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -66,9 +67,6 @@ // lldb-command:continue -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] - fn main() { let x = false; diff --git a/tests/debuginfo/simple-struct.rs b/tests/debuginfo/simple-struct.rs index bb6b2b798102c..da09a8a3ce027 100644 --- a/tests/debuginfo/simple-struct.rs +++ b/tests/debuginfo/simple-struct.rs @@ -1,4 +1,5 @@ //@ compile-flags: -g -Zmir-enable-passes=-CheckAlignment +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -84,8 +85,6 @@ #![allow(unused_variables)] #![allow(dead_code)] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] struct NoPadding16 { x: u16, diff --git a/tests/debuginfo/simple-tuple.rs b/tests/debuginfo/simple-tuple.rs index 82467ef3bcf20..f086472d72569 100644 --- a/tests/debuginfo/simple-tuple.rs +++ b/tests/debuginfo/simple-tuple.rs @@ -1,4 +1,5 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -121,8 +122,6 @@ #![allow(unused_variables)] #![allow(dead_code)] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] static mut NO_PADDING_8: (i8, u8) = (-50, 50); static mut NO_PADDING_16: (i16, i16, u16) = (-1, 2, 3); diff --git a/tests/debuginfo/static-method-on-struct-and-enum.rs b/tests/debuginfo/static-method-on-struct-and-enum.rs index b487512a52f13..2a3502712de1c 100644 --- a/tests/debuginfo/static-method-on-struct-and-enum.rs +++ b/tests/debuginfo/static-method-on-struct-and-enum.rs @@ -1,4 +1,5 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -41,9 +42,6 @@ // lldb-check:[...] 5 // lldb-command:continue -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] - struct Struct { x: isize } diff --git a/tests/debuginfo/strings-and-strs.rs b/tests/debuginfo/strings-and-strs.rs index 7d550408bec37..392cf697e110b 100644 --- a/tests/debuginfo/strings-and-strs.rs +++ b/tests/debuginfo/strings-and-strs.rs @@ -2,6 +2,7 @@ //@ min-lldb-version: 1800 //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== // gdb-command:run @@ -40,8 +41,6 @@ #![allow(unused_variables)] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] pub struct Foo<'a> { inner: &'a str, diff --git a/tests/debuginfo/struct-in-enum.rs b/tests/debuginfo/struct-in-enum.rs index bc2c59fe4aa99..c5a7fb95e1e52 100644 --- a/tests/debuginfo/struct-in-enum.rs +++ b/tests/debuginfo/struct-in-enum.rs @@ -1,6 +1,7 @@ //@ min-lldb-version: 1800 //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -30,8 +31,6 @@ // lldb-check:[...] TheOnlyCase(Struct { x: 123, y: 456, z: 789 }) #![allow(unused_variables)] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] use self::Regular::{Case1, Case2}; use self::Univariant::TheOnlyCase; diff --git a/tests/debuginfo/struct-in-struct.rs b/tests/debuginfo/struct-in-struct.rs index 3cf48470391b8..c818df31b4b11 100644 --- a/tests/debuginfo/struct-in-struct.rs +++ b/tests/debuginfo/struct-in-struct.rs @@ -1,4 +1,5 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -43,8 +44,6 @@ // lldb-check:[...] { x = { x = 25 } y = { x = { x = 26 y = 27 } y = { x = 28 y = 29 } z = { x = 30 y = 31 } } z = { x = { x = { x = 32 } } } } #![allow(unused_variables)] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] struct Simple { x: i32 diff --git a/tests/debuginfo/struct-namespace.rs b/tests/debuginfo/struct-namespace.rs index 9578841910034..d56c84c4f13bc 100644 --- a/tests/debuginfo/struct-namespace.rs +++ b/tests/debuginfo/struct-namespace.rs @@ -1,5 +1,6 @@ //@ ignore-gdb //@ compile-flags:-g +//@ disable-gdb-pretty-printers // Check that structs get placed in the correct namespace @@ -16,8 +17,6 @@ #![allow(unused_variables)] #![allow(dead_code)] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] struct Struct1 { a: u32, diff --git a/tests/debuginfo/struct-style-enum.rs b/tests/debuginfo/struct-style-enum.rs index cea9f3def8bc3..1f28fe4fea159 100644 --- a/tests/debuginfo/struct-style-enum.rs +++ b/tests/debuginfo/struct-style-enum.rs @@ -1,5 +1,6 @@ //@ min-lldb-version: 1800 //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -36,8 +37,6 @@ // lldb-check:(struct_style_enum::Univariant) univariant = { value = { a = -1 } } #![allow(unused_variables)] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] use self::Regular::{Case1, Case2, Case3}; use self::Univariant::TheOnlyCase; diff --git a/tests/debuginfo/struct-with-destructor.rs b/tests/debuginfo/struct-with-destructor.rs index c159824980a20..4d2ce8ff79db7 100644 --- a/tests/debuginfo/struct-with-destructor.rs +++ b/tests/debuginfo/struct-with-destructor.rs @@ -1,4 +1,5 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -32,8 +33,6 @@ // lldb-check:[...] { a = { a = { x = 7890 y = 9870 } } } #![allow(unused_variables)] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] struct NoDestructor { x: i32, diff --git a/tests/debuginfo/trait-pointers.rs b/tests/debuginfo/trait-pointers.rs index 71da71b897ad9..5cdefe94e5075 100644 --- a/tests/debuginfo/trait-pointers.rs +++ b/tests/debuginfo/trait-pointers.rs @@ -1,10 +1,9 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers // gdb-command:run // lldb-command:run #![allow(unused_variables)] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] trait Trait { fn method(&self) -> isize { 0 } diff --git a/tests/debuginfo/tuple-in-struct.rs b/tests/debuginfo/tuple-in-struct.rs index a74d6203f5f5d..bef96fad50c6e 100644 --- a/tests/debuginfo/tuple-in-struct.rs +++ b/tests/debuginfo/tuple-in-struct.rs @@ -1,4 +1,5 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers // gdb-command:run @@ -28,8 +29,6 @@ // gdb-check:$10 = tuple_in_struct::MixedPadding {x: ((40, 41, 42), (43, 44)), y: (45, 46, 47, 48)} #![allow(unused_variables)] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] struct NoPadding1 { x: (i32, i32), diff --git a/tests/debuginfo/tuple-in-tuple.rs b/tests/debuginfo/tuple-in-tuple.rs index d4388095ad721..7bf97764c5c74 100644 --- a/tests/debuginfo/tuple-in-tuple.rs +++ b/tests/debuginfo/tuple-in-tuple.rs @@ -1,4 +1,5 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -111,8 +112,6 @@ // cdb-check:[...][1] : 22 [Type: [...]] #![allow(unused_variables)] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] fn main() { let no_padding1: ((u32, u32), u32, u32) = ((0, 1), 2, 3); diff --git a/tests/debuginfo/tuple-struct.rs b/tests/debuginfo/tuple-struct.rs index 0110203a7c79e..a1bdaf1f3bb3a 100644 --- a/tests/debuginfo/tuple-struct.rs +++ b/tests/debuginfo/tuple-struct.rs @@ -1,4 +1,5 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -50,9 +51,6 @@ // structs. -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] - struct NoPadding16(u16, i16); struct NoPadding32(i32, f32, u32); struct NoPadding64(f64, i64, u64); diff --git a/tests/debuginfo/tuple-style-enum.rs b/tests/debuginfo/tuple-style-enum.rs index a759ad61c056c..6113ccc10a1bb 100644 --- a/tests/debuginfo/tuple-style-enum.rs +++ b/tests/debuginfo/tuple-style-enum.rs @@ -1,6 +1,7 @@ //@ min-lldb-version: 1800 //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -37,8 +38,6 @@ // lldb-check:(tuple_style_enum::Univariant) univariant = { value = { 0 = -1 } } #![allow(unused_variables)] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] use self::Regular::{Case1, Case2, Case3}; use self::Univariant::TheOnlyCase; diff --git a/tests/debuginfo/type-names.rs b/tests/debuginfo/type-names.rs index ac61fef48fe16..ecf7c597c0c05 100644 --- a/tests/debuginfo/type-names.rs +++ b/tests/debuginfo/type-names.rs @@ -6,6 +6,7 @@ //@ min-gdb-version: 9.2 //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS ================================================================================== @@ -271,8 +272,6 @@ // cdb-check:struct type_names::mod1::extern$0::ForeignType2 * foreign2 = [...] #![allow(unused_variables)] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] #![feature(extern_types)] use std::marker::PhantomData; diff --git a/tests/debuginfo/union-smoke.rs b/tests/debuginfo/union-smoke.rs index 6043240069e39..bd253794bd852 100644 --- a/tests/debuginfo/union-smoke.rs +++ b/tests/debuginfo/union-smoke.rs @@ -1,4 +1,5 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -18,8 +19,6 @@ // lldb-check:[...] { a = { 0 = '\x01' 1 = '\x01' } b = 257 } #![allow(unused)] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] union U { a: (u8, u8), diff --git a/tests/debuginfo/unique-enum.rs b/tests/debuginfo/unique-enum.rs index 230429278aa59..e5a9c55013560 100644 --- a/tests/debuginfo/unique-enum.rs +++ b/tests/debuginfo/unique-enum.rs @@ -1,6 +1,7 @@ //@ min-lldb-version: 1800 //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -30,8 +31,6 @@ // lldb-check:(unique_enum::Univariant) *univariant = { value = { 0 = 123234 } } #![allow(unused_variables)] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] // The first element is to ensure proper alignment, irrespective of the machines word size. Since // the size of the discriminant value is machine dependent, this has be taken into account when diff --git a/tests/debuginfo/unreachable-locals.rs b/tests/debuginfo/unreachable-locals.rs index d4416387e0b9e..4d3f01fe423bd 100644 --- a/tests/debuginfo/unreachable-locals.rs +++ b/tests/debuginfo/unreachable-locals.rs @@ -1,8 +1,7 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers #![allow(unused_variables)] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] // No need to actually run the debugger, just make sure that the compiler can // handle locals in unreachable code. diff --git a/tests/debuginfo/unsized.rs b/tests/debuginfo/unsized.rs index edd9f5af557d8..e34eaaaacb979 100644 --- a/tests/debuginfo/unsized.rs +++ b/tests/debuginfo/unsized.rs @@ -1,4 +1,5 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers //@ ignore-gdb-version: 13.1 - 99.0 // ^ https://sourceware.org/bugzilla/show_bug.cgi?id=30330 @@ -41,9 +42,6 @@ // cdb-check:[+0x000] pointer : 0x[...] [Type: unsized::Foo > *] // cdb-check:[...] vtable : 0x[...] [Type: unsigned [...]int[...] (*)[4]] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] - struct Foo { value: T, } diff --git a/tests/debuginfo/var-captured-in-nested-closure.rs b/tests/debuginfo/var-captured-in-nested-closure.rs index 4e8700015ba6c..1795a352802fd 100644 --- a/tests/debuginfo/var-captured-in-nested-closure.rs +++ b/tests/debuginfo/var-captured-in-nested-closure.rs @@ -1,4 +1,5 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -115,8 +116,6 @@ // cdb-check:closure_local : 8 [Type: [...]] #![allow(unused_variables)] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] struct Struct { a: isize, diff --git a/tests/debuginfo/var-captured-in-sendable-closure.rs b/tests/debuginfo/var-captured-in-sendable-closure.rs index cbb09daeb5f79..2b0d4bb430a10 100644 --- a/tests/debuginfo/var-captured-in-sendable-closure.rs +++ b/tests/debuginfo/var-captured-in-sendable-closure.rs @@ -1,4 +1,5 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -28,8 +29,6 @@ // lldb-check:[...] 5 #![allow(unused_variables)] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] struct Struct { a: isize, diff --git a/tests/debuginfo/var-captured-in-stack-closure.rs b/tests/debuginfo/var-captured-in-stack-closure.rs index 0f84ea57b0076..7fda71c2297bf 100644 --- a/tests/debuginfo/var-captured-in-stack-closure.rs +++ b/tests/debuginfo/var-captured-in-stack-closure.rs @@ -1,4 +1,5 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -100,8 +101,6 @@ // cdb-check:owned : 0x[...] : 6 [Type: [...] *] #![allow(unused_variables)] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] struct Struct { a: isize, diff --git a/tests/debuginfo/vec-slices.rs b/tests/debuginfo/vec-slices.rs index 2b4d624976ab5..2a4e413612fcc 100644 --- a/tests/debuginfo/vec-slices.rs +++ b/tests/debuginfo/vec-slices.rs @@ -2,6 +2,7 @@ // ^ test temporarily disabled as it fails under gdb 15 //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -71,8 +72,6 @@ // lldb-check:[...] size=2 { [0] = { x = 10 y = 11 z = 12 } [1] = { x = 13 y = 14 z = 15 } } #![allow(dead_code, unused_variables)] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] struct AStruct { x: i16, diff --git a/tests/debuginfo/vec.rs b/tests/debuginfo/vec.rs index 1093e38d87805..fd75e7005af54 100644 --- a/tests/debuginfo/vec.rs +++ b/tests/debuginfo/vec.rs @@ -1,4 +1,5 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -16,8 +17,6 @@ // lldb-check:[...] { [0] = 1 [1] = 2 [2] = 3 } #![allow(unused_variables)] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] static mut VECT: [i32; 3] = [1, 2, 3]; diff --git a/tests/ui/attributes/malformed-attrs.rs b/tests/ui/attributes/malformed-attrs.rs index 2a8b7b41e58fd..0d5bf69d548ce 100644 --- a/tests/ui/attributes/malformed-attrs.rs +++ b/tests/ui/attributes/malformed-attrs.rs @@ -20,13 +20,9 @@ #![feature(linkage)] #![feature(cfi_encoding, extern_types)] #![feature(patchable_function_entry)] -#![feature(omit_gdb_pretty_printer_section)] #![feature(fundamental)] -#![omit_gdb_pretty_printer_section = 1] -//~^ ERROR malformed `omit_gdb_pretty_printer_section` attribute input - #![windows_subsystem] //~^ ERROR malformed diff --git a/tests/ui/attributes/malformed-attrs.stderr b/tests/ui/attributes/malformed-attrs.stderr index 814a1e5f69192..1b51075b4e888 100644 --- a/tests/ui/attributes/malformed-attrs.stderr +++ b/tests/ui/attributes/malformed-attrs.stderr @@ -1,5 +1,5 @@ error[E0539]: malformed `cfg` attribute input - --> $DIR/malformed-attrs.rs:103:1 + --> $DIR/malformed-attrs.rs:99:1 | LL | #[cfg] | ^^^^^^ @@ -8,7 +8,7 @@ LL | #[cfg] | help: must be of the form: `#[cfg(predicate)]` error: malformed `cfg_attr` attribute input - --> $DIR/malformed-attrs.rs:105:1 + --> $DIR/malformed-attrs.rs:101:1 | LL | #[cfg_attr] | ^^^^^^^^^^^ @@ -20,49 +20,49 @@ LL | #[cfg_attr(condition, attribute, other_attribute, ...)] | ++++++++++++++++++++++++++++++++++++++++++++ error[E0463]: can't find crate for `wloop` - --> $DIR/malformed-attrs.rs:212:1 + --> $DIR/malformed-attrs.rs:208:1 | LL | extern crate wloop; | ^^^^^^^^^^^^^^^^^^^ can't find crate error: malformed `windows_subsystem` attribute input - --> $DIR/malformed-attrs.rs:30:1 + --> $DIR/malformed-attrs.rs:26:1 | LL | #![windows_subsystem] | ^^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#![windows_subsystem = "windows|console"]` error: malformed `crate_name` attribute input - --> $DIR/malformed-attrs.rs:75:1 + --> $DIR/malformed-attrs.rs:71:1 | LL | #[crate_name] | ^^^^^^^^^^^^^ help: must be of the form: `#[crate_name = "name"]` error: malformed `no_sanitize` attribute input - --> $DIR/malformed-attrs.rs:93:1 + --> $DIR/malformed-attrs.rs:89:1 | LL | #[no_sanitize] | ^^^^^^^^^^^^^^ help: must be of the form: `#[no_sanitize(address, kcfi, memory, thread)]` error: malformed `instruction_set` attribute input - --> $DIR/malformed-attrs.rs:107:1 + --> $DIR/malformed-attrs.rs:103:1 | LL | #[instruction_set] | ^^^^^^^^^^^^^^^^^^ help: must be of the form: `#[instruction_set(set)]` error: malformed `patchable_function_entry` attribute input - --> $DIR/malformed-attrs.rs:109:1 + --> $DIR/malformed-attrs.rs:105:1 | LL | #[patchable_function_entry] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#[patchable_function_entry(prefix_nops = m, entry_nops = n)]` error: malformed `coroutine` attribute input - --> $DIR/malformed-attrs.rs:112:5 + --> $DIR/malformed-attrs.rs:108:5 | LL | #[coroutine = 63] || {} | ^^^^^^^^^^^^^^^^^ help: must be of the form: `#[coroutine]` error: malformed `must_not_suspend` attribute input - --> $DIR/malformed-attrs.rs:133:1 + --> $DIR/malformed-attrs.rs:129:1 | LL | #[must_not_suspend()] | ^^^^^^^^^^^^^^^^^^^^^ @@ -77,67 +77,67 @@ LL + #[must_not_suspend] | error: malformed `cfi_encoding` attribute input - --> $DIR/malformed-attrs.rs:135:1 + --> $DIR/malformed-attrs.rs:131:1 | LL | #[cfi_encoding] | ^^^^^^^^^^^^^^^ help: must be of the form: `#[cfi_encoding = "encoding"]` error: malformed `linkage` attribute input - --> $DIR/malformed-attrs.rs:174:5 + --> $DIR/malformed-attrs.rs:170:5 | LL | #[linkage] | ^^^^^^^^^^ help: must be of the form: `#[linkage = "external|internal|..."]` error: malformed `allow` attribute input - --> $DIR/malformed-attrs.rs:179:1 + --> $DIR/malformed-attrs.rs:175:1 | LL | #[allow] | ^^^^^^^^ help: must be of the form: `#[allow(lint1, lint2, ..., /*opt*/ reason = "...")]` error: malformed `expect` attribute input - --> $DIR/malformed-attrs.rs:181:1 + --> $DIR/malformed-attrs.rs:177:1 | LL | #[expect] | ^^^^^^^^^ help: must be of the form: `#[expect(lint1, lint2, ..., /*opt*/ reason = "...")]` error: malformed `warn` attribute input - --> $DIR/malformed-attrs.rs:183:1 + --> $DIR/malformed-attrs.rs:179:1 | LL | #[warn] | ^^^^^^^ help: must be of the form: `#[warn(lint1, lint2, ..., /*opt*/ reason = "...")]` error: malformed `deny` attribute input - --> $DIR/malformed-attrs.rs:185:1 + --> $DIR/malformed-attrs.rs:181:1 | LL | #[deny] | ^^^^^^^ help: must be of the form: `#[deny(lint1, lint2, ..., /*opt*/ reason = "...")]` error: malformed `forbid` attribute input - --> $DIR/malformed-attrs.rs:187:1 + --> $DIR/malformed-attrs.rs:183:1 | LL | #[forbid] | ^^^^^^^^^ help: must be of the form: `#[forbid(lint1, lint2, ..., /*opt*/ reason = "...")]` error: malformed `debugger_visualizer` attribute input - --> $DIR/malformed-attrs.rs:189:1 + --> $DIR/malformed-attrs.rs:185:1 | LL | #[debugger_visualizer] | ^^^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#[debugger_visualizer(natvis_file = "...", gdb_script_file = "...")]` error: malformed `thread_local` attribute input - --> $DIR/malformed-attrs.rs:204:1 + --> $DIR/malformed-attrs.rs:200:1 | LL | #[thread_local()] | ^^^^^^^^^^^^^^^^^ help: must be of the form: `#[thread_local]` error: malformed `no_link` attribute input - --> $DIR/malformed-attrs.rs:208:1 + --> $DIR/malformed-attrs.rs:204:1 | LL | #[no_link()] | ^^^^^^^^^^^^ help: must be of the form: `#[no_link]` error: malformed `macro_export` attribute input - --> $DIR/malformed-attrs.rs:215:1 + --> $DIR/malformed-attrs.rs:211:1 | LL | #[macro_export = 18] | ^^^^^^^^^^^^^^^^^^^^ @@ -152,31 +152,31 @@ LL + #[macro_export] | error: malformed `allow_internal_unsafe` attribute input - --> $DIR/malformed-attrs.rs:217:1 + --> $DIR/malformed-attrs.rs:213:1 | LL | #[allow_internal_unsafe = 1] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#[allow_internal_unsafe]` error: the `#[proc_macro]` attribute is only usable with crates of the `proc-macro` crate type - --> $DIR/malformed-attrs.rs:100:1 + --> $DIR/malformed-attrs.rs:96:1 | LL | #[proc_macro = 18] | ^^^^^^^^^^^^^^^^^^ error: the `#[proc_macro_attribute]` attribute is only usable with crates of the `proc-macro` crate type - --> $DIR/malformed-attrs.rs:117:1 + --> $DIR/malformed-attrs.rs:113:1 | LL | #[proc_macro_attribute = 19] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: the `#[proc_macro_derive]` attribute is only usable with crates of the `proc-macro` crate type - --> $DIR/malformed-attrs.rs:124:1 + --> $DIR/malformed-attrs.rs:120:1 | LL | #[proc_macro_derive] | ^^^^^^^^^^^^^^^^^^^^ error[E0658]: allow_internal_unsafe side-steps the unsafe_code lint - --> $DIR/malformed-attrs.rs:217:1 + --> $DIR/malformed-attrs.rs:213:1 | LL | #[allow_internal_unsafe = 1] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -185,7 +185,7 @@ LL | #[allow_internal_unsafe = 1] = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error: valid forms for the attribute are `#[doc(hidden|inline|...)]` and `#[doc = "string"]` - --> $DIR/malformed-attrs.rs:44:1 + --> $DIR/malformed-attrs.rs:40:1 | LL | #[doc] | ^^^^^^ @@ -195,7 +195,7 @@ LL | #[doc] = note: `#[deny(ill_formed_attribute_input)]` on by default error: valid forms for the attribute are `#[doc(hidden|inline|...)]` and `#[doc = "string"]` - --> $DIR/malformed-attrs.rs:77:1 + --> $DIR/malformed-attrs.rs:73:1 | LL | #[doc] | ^^^^^^ @@ -204,7 +204,7 @@ LL | #[doc] = note: for more information, see issue #57571 error: attribute must be of the form `#[link(name = "...", /*opt*/ kind = "dylib|static|...", /*opt*/ wasm_import_module = "...", /*opt*/ import_name_type = "decorated|noprefix|undecorated")]` - --> $DIR/malformed-attrs.rs:84:1 + --> $DIR/malformed-attrs.rs:80:1 | LL | #[link] | ^^^^^^^ @@ -213,7 +213,7 @@ LL | #[link] = note: for more information, see issue #57571 error: invalid argument - --> $DIR/malformed-attrs.rs:189:1 + --> $DIR/malformed-attrs.rs:185:1 | LL | #[debugger_visualizer] | ^^^^^^^^^^^^^^^^^^^^^^ @@ -222,35 +222,26 @@ LL | #[debugger_visualizer] = note: OR = note: expected: `gdb_script_file = "..."` -error[E0565]: malformed `omit_gdb_pretty_printer_section` attribute input - --> $DIR/malformed-attrs.rs:27:1 - | -LL | #![omit_gdb_pretty_printer_section = 1] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---^ - | | | - | | didn't expect any arguments here - | help: must be of the form: `#[omit_gdb_pretty_printer_section]` - error[E0539]: malformed `export_name` attribute input - --> $DIR/malformed-attrs.rs:33:1 + --> $DIR/malformed-attrs.rs:29:1 | LL | #[unsafe(export_name)] | ^^^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#[export_name = "name"]` error: `rustc_allow_const_fn_unstable` expects a list of feature names - --> $DIR/malformed-attrs.rs:35:1 + --> $DIR/malformed-attrs.rs:31:1 | LL | #[rustc_allow_const_fn_unstable] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: `allow_internal_unstable` expects a list of feature names - --> $DIR/malformed-attrs.rs:38:1 + --> $DIR/malformed-attrs.rs:34:1 | LL | #[allow_internal_unstable] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0539]: malformed `rustc_confusables` attribute input - --> $DIR/malformed-attrs.rs:40:1 + --> $DIR/malformed-attrs.rs:36:1 | LL | #[rustc_confusables] | ^^^^^^^^^^^^^^^^^^^^ @@ -259,7 +250,7 @@ LL | #[rustc_confusables] | help: must be of the form: `#[rustc_confusables("name1", "name2", ...)]` error[E0539]: malformed `deprecated` attribute input - --> $DIR/malformed-attrs.rs:42:1 + --> $DIR/malformed-attrs.rs:38:1 | LL | #[deprecated = 5] | ^^^^^^^^^^^^^^^-^ @@ -279,13 +270,13 @@ LL + #[deprecated] | error[E0539]: malformed `rustc_macro_transparency` attribute input - --> $DIR/malformed-attrs.rs:47:1 + --> $DIR/malformed-attrs.rs:43:1 | LL | #[rustc_macro_transparency] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#[rustc_macro_transparency = "transparent|semitransparent|opaque"]` error[E0539]: malformed `repr` attribute input - --> $DIR/malformed-attrs.rs:49:1 + --> $DIR/malformed-attrs.rs:45:1 | LL | #[repr] | ^^^^^^^ @@ -294,7 +285,7 @@ LL | #[repr] | help: must be of the form: `#[repr(C | Rust | align(...) | packed(...) | | transparent)]` error[E0565]: malformed `rustc_as_ptr` attribute input - --> $DIR/malformed-attrs.rs:52:1 + --> $DIR/malformed-attrs.rs:48:1 | LL | #[rustc_as_ptr = 5] | ^^^^^^^^^^^^^^^---^ @@ -303,7 +294,7 @@ LL | #[rustc_as_ptr = 5] | help: must be of the form: `#[rustc_as_ptr]` error[E0539]: malformed `rustc_align` attribute input - --> $DIR/malformed-attrs.rs:57:1 + --> $DIR/malformed-attrs.rs:53:1 | LL | #[rustc_align] | ^^^^^^^^^^^^^^ @@ -312,7 +303,7 @@ LL | #[rustc_align] | help: must be of the form: `#[rustc_align()]` error[E0539]: malformed `optimize` attribute input - --> $DIR/malformed-attrs.rs:59:1 + --> $DIR/malformed-attrs.rs:55:1 | LL | #[optimize] | ^^^^^^^^^^^ @@ -321,7 +312,7 @@ LL | #[optimize] | help: must be of the form: `#[optimize(size|speed|none)]` error[E0565]: malformed `cold` attribute input - --> $DIR/malformed-attrs.rs:61:1 + --> $DIR/malformed-attrs.rs:57:1 | LL | #[cold = 1] | ^^^^^^^---^ @@ -330,13 +321,13 @@ LL | #[cold = 1] | help: must be of the form: `#[cold]` error: valid forms for the attribute are `#[must_use = "reason"]` and `#[must_use]` - --> $DIR/malformed-attrs.rs:63:1 + --> $DIR/malformed-attrs.rs:59:1 | LL | #[must_use()] | ^^^^^^^^^^^^^ error[E0565]: malformed `no_mangle` attribute input - --> $DIR/malformed-attrs.rs:65:1 + --> $DIR/malformed-attrs.rs:61:1 | LL | #[no_mangle = 1] | ^^^^^^^^^^^^---^ @@ -345,7 +336,7 @@ LL | #[no_mangle = 1] | help: must be of the form: `#[no_mangle]` error[E0565]: malformed `naked` attribute input - --> $DIR/malformed-attrs.rs:67:1 + --> $DIR/malformed-attrs.rs:63:1 | LL | #[unsafe(naked())] | ^^^^^^^^^^^^^^--^^ @@ -354,7 +345,7 @@ LL | #[unsafe(naked())] | help: must be of the form: `#[naked]` error[E0565]: malformed `track_caller` attribute input - --> $DIR/malformed-attrs.rs:69:1 + --> $DIR/malformed-attrs.rs:65:1 | LL | #[track_caller()] | ^^^^^^^^^^^^^^--^ @@ -363,13 +354,13 @@ LL | #[track_caller()] | help: must be of the form: `#[track_caller]` error[E0539]: malformed `export_name` attribute input - --> $DIR/malformed-attrs.rs:71:1 + --> $DIR/malformed-attrs.rs:67:1 | LL | #[export_name()] | ^^^^^^^^^^^^^^^^ help: must be of the form: `#[export_name = "name"]` error[E0805]: malformed `used` attribute input - --> $DIR/malformed-attrs.rs:73:1 + --> $DIR/malformed-attrs.rs:69:1 | LL | #[used()] | ^^^^^^--^ @@ -385,7 +376,7 @@ LL + #[used] | error[E0539]: malformed `target_feature` attribute input - --> $DIR/malformed-attrs.rs:80:1 + --> $DIR/malformed-attrs.rs:76:1 | LL | #[target_feature] | ^^^^^^^^^^^^^^^^^ @@ -394,7 +385,7 @@ LL | #[target_feature] | help: must be of the form: `#[target_feature(enable = "feat1, feat2")]` error[E0565]: malformed `export_stable` attribute input - --> $DIR/malformed-attrs.rs:82:1 + --> $DIR/malformed-attrs.rs:78:1 | LL | #[export_stable = 1] | ^^^^^^^^^^^^^^^^---^ @@ -403,19 +394,19 @@ LL | #[export_stable = 1] | help: must be of the form: `#[export_stable]` error[E0539]: malformed `link_name` attribute input - --> $DIR/malformed-attrs.rs:87:1 + --> $DIR/malformed-attrs.rs:83:1 | LL | #[link_name] | ^^^^^^^^^^^^ help: must be of the form: `#[link_name = "name"]` error[E0539]: malformed `link_section` attribute input - --> $DIR/malformed-attrs.rs:89:1 + --> $DIR/malformed-attrs.rs:85:1 | LL | #[link_section] | ^^^^^^^^^^^^^^^ help: must be of the form: `#[link_section = "name"]` error[E0539]: malformed `coverage` attribute input - --> $DIR/malformed-attrs.rs:91:1 + --> $DIR/malformed-attrs.rs:87:1 | LL | #[coverage] | ^^^^^^^^^^^ this attribute is only valid with either `on` or `off` as an argument @@ -428,7 +419,7 @@ LL | #[coverage(on)] | ++++ error[E0565]: malformed `no_implicit_prelude` attribute input - --> $DIR/malformed-attrs.rs:98:1 + --> $DIR/malformed-attrs.rs:94:1 | LL | #[no_implicit_prelude = 23] | ^^^^^^^^^^^^^^^^^^^^^^----^ @@ -437,7 +428,7 @@ LL | #[no_implicit_prelude = 23] | help: must be of the form: `#[no_implicit_prelude]` error[E0565]: malformed `proc_macro` attribute input - --> $DIR/malformed-attrs.rs:100:1 + --> $DIR/malformed-attrs.rs:96:1 | LL | #[proc_macro = 18] | ^^^^^^^^^^^^^----^ @@ -446,7 +437,7 @@ LL | #[proc_macro = 18] | help: must be of the form: `#[proc_macro]` error[E0565]: malformed `proc_macro_attribute` attribute input - --> $DIR/malformed-attrs.rs:117:1 + --> $DIR/malformed-attrs.rs:113:1 | LL | #[proc_macro_attribute = 19] | ^^^^^^^^^^^^^^^^^^^^^^^----^ @@ -455,7 +446,7 @@ LL | #[proc_macro_attribute = 19] | help: must be of the form: `#[proc_macro_attribute]` error[E0539]: malformed `must_use` attribute input - --> $DIR/malformed-attrs.rs:120:1 + --> $DIR/malformed-attrs.rs:116:1 | LL | #[must_use = 1] | ^^^^^^^^^^^^^-^ @@ -472,7 +463,7 @@ LL + #[must_use] | error[E0539]: malformed `proc_macro_derive` attribute input - --> $DIR/malformed-attrs.rs:124:1 + --> $DIR/malformed-attrs.rs:120:1 | LL | #[proc_macro_derive] | ^^^^^^^^^^^^^^^^^^^^ @@ -481,7 +472,7 @@ LL | #[proc_macro_derive] | help: must be of the form: `#[proc_macro_derive(TraitName, /*opt*/ attributes(name1, name2, ...))]` error[E0539]: malformed `rustc_layout_scalar_valid_range_start` attribute input - --> $DIR/malformed-attrs.rs:129:1 + --> $DIR/malformed-attrs.rs:125:1 | LL | #[rustc_layout_scalar_valid_range_start] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -490,7 +481,7 @@ LL | #[rustc_layout_scalar_valid_range_start] | help: must be of the form: `#[rustc_layout_scalar_valid_range_start(start)]` error[E0539]: malformed `rustc_layout_scalar_valid_range_end` attribute input - --> $DIR/malformed-attrs.rs:131:1 + --> $DIR/malformed-attrs.rs:127:1 | LL | #[rustc_layout_scalar_valid_range_end] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -499,7 +490,7 @@ LL | #[rustc_layout_scalar_valid_range_end] | help: must be of the form: `#[rustc_layout_scalar_valid_range_end(end)]` error[E0565]: malformed `marker` attribute input - --> $DIR/malformed-attrs.rs:156:1 + --> $DIR/malformed-attrs.rs:152:1 | LL | #[marker = 3] | ^^^^^^^^^---^ @@ -508,7 +499,7 @@ LL | #[marker = 3] | help: must be of the form: `#[marker]` error[E0565]: malformed `fundamental` attribute input - --> $DIR/malformed-attrs.rs:158:1 + --> $DIR/malformed-attrs.rs:154:1 | LL | #[fundamental()] | ^^^^^^^^^^^^^--^ @@ -517,7 +508,7 @@ LL | #[fundamental()] | help: must be of the form: `#[fundamental]` error[E0565]: malformed `ffi_pure` attribute input - --> $DIR/malformed-attrs.rs:166:5 + --> $DIR/malformed-attrs.rs:162:5 | LL | #[unsafe(ffi_pure = 1)] | ^^^^^^^^^^^^^^^^^^---^^ @@ -526,7 +517,7 @@ LL | #[unsafe(ffi_pure = 1)] | help: must be of the form: `#[ffi_pure]` error[E0539]: malformed `link_ordinal` attribute input - --> $DIR/malformed-attrs.rs:168:5 + --> $DIR/malformed-attrs.rs:164:5 | LL | #[link_ordinal] | ^^^^^^^^^^^^^^^ @@ -535,7 +526,7 @@ LL | #[link_ordinal] | help: must be of the form: `#[link_ordinal(ordinal)]` error[E0565]: malformed `ffi_const` attribute input - --> $DIR/malformed-attrs.rs:172:5 + --> $DIR/malformed-attrs.rs:168:5 | LL | #[unsafe(ffi_const = 1)] | ^^^^^^^^^^^^^^^^^^^---^^ @@ -544,7 +535,7 @@ LL | #[unsafe(ffi_const = 1)] | help: must be of the form: `#[ffi_const]` error[E0565]: malformed `automatically_derived` attribute input - --> $DIR/malformed-attrs.rs:192:1 + --> $DIR/malformed-attrs.rs:188:1 | LL | #[automatically_derived = 18] | ^^^^^^^^^^^^^^^^^^^^^^^^----^ @@ -553,7 +544,7 @@ LL | #[automatically_derived = 18] | help: must be of the form: `#[automatically_derived]` error[E0565]: malformed `non_exhaustive` attribute input - --> $DIR/malformed-attrs.rs:198:1 + --> $DIR/malformed-attrs.rs:194:1 | LL | #[non_exhaustive = 1] | ^^^^^^^^^^^^^^^^^---^ @@ -562,13 +553,13 @@ LL | #[non_exhaustive = 1] | help: must be of the form: `#[non_exhaustive]` error: valid forms for the attribute are `#[macro_use(name1, name2, ...)]` and `#[macro_use]` - --> $DIR/malformed-attrs.rs:210:1 + --> $DIR/malformed-attrs.rs:206:1 | LL | #[macro_use = 1] | ^^^^^^^^^^^^^^^^ error[E0565]: malformed `type_const` attribute input - --> $DIR/malformed-attrs.rs:144:5 + --> $DIR/malformed-attrs.rs:140:5 | LL | #[type_const = 1] | ^^^^^^^^^^^^^---^ @@ -577,7 +568,7 @@ LL | #[type_const = 1] | help: must be of the form: `#[type_const]` error: attribute should be applied to `const fn` - --> $DIR/malformed-attrs.rs:35:1 + --> $DIR/malformed-attrs.rs:31:1 | LL | #[rustc_allow_const_fn_unstable] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -589,19 +580,19 @@ LL | | } | |_- not a `const fn` error: `#[repr(align(...))]` is not supported on function items - --> $DIR/malformed-attrs.rs:49:1 + --> $DIR/malformed-attrs.rs:45:1 | LL | #[repr] | ^^^^^^^ | help: use `#[rustc_align(...)]` instead - --> $DIR/malformed-attrs.rs:49:1 + --> $DIR/malformed-attrs.rs:45:1 | LL | #[repr] | ^^^^^^^ warning: `#[diagnostic::do_not_recommend]` does not expect any arguments - --> $DIR/malformed-attrs.rs:150:1 + --> $DIR/malformed-attrs.rs:146:1 | LL | #[diagnostic::do_not_recommend()] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -609,7 +600,7 @@ LL | #[diagnostic::do_not_recommend()] = note: `#[warn(malformed_diagnostic_attributes)]` on by default warning: missing options for `on_unimplemented` attribute - --> $DIR/malformed-attrs.rs:139:1 + --> $DIR/malformed-attrs.rs:135:1 | LL | #[diagnostic::on_unimplemented] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -617,7 +608,7 @@ LL | #[diagnostic::on_unimplemented] = help: at least one of the `message`, `note` and `label` options are expected warning: malformed `on_unimplemented` attribute - --> $DIR/malformed-attrs.rs:141:1 + --> $DIR/malformed-attrs.rs:137:1 | LL | #[diagnostic::on_unimplemented = 1] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ invalid option found here @@ -625,7 +616,7 @@ LL | #[diagnostic::on_unimplemented = 1] = help: only `message`, `note` and `label` are allowed as options error: valid forms for the attribute are `#[inline(always|never)]` and `#[inline]` - --> $DIR/malformed-attrs.rs:54:1 + --> $DIR/malformed-attrs.rs:50:1 | LL | #[inline = 5] | ^^^^^^^^^^^^^ @@ -634,7 +625,7 @@ LL | #[inline = 5] = note: for more information, see issue #57571 error: valid forms for the attribute are `#[ignore = "reason"]` and `#[ignore]` - --> $DIR/malformed-attrs.rs:95:1 + --> $DIR/malformed-attrs.rs:91:1 | LL | #[ignore()] | ^^^^^^^^^^^ @@ -643,7 +634,7 @@ LL | #[ignore()] = note: for more information, see issue #57571 error: valid forms for the attribute are `#[ignore = "reason"]` and `#[ignore]` - --> $DIR/malformed-attrs.rs:224:1 + --> $DIR/malformed-attrs.rs:220:1 | LL | #[ignore = 1] | ^^^^^^^^^^^^^ @@ -652,7 +643,7 @@ LL | #[ignore = 1] = note: for more information, see issue #57571 error[E0308]: mismatched types - --> $DIR/malformed-attrs.rs:112:23 + --> $DIR/malformed-attrs.rs:108:23 | LL | fn test() { | - help: a return type might be missing here: `-> _` @@ -660,9 +651,9 @@ LL | #[coroutine = 63] || {} | ^^^^^ expected `()`, found coroutine | = note: expected unit type `()` - found coroutine `{coroutine@$DIR/malformed-attrs.rs:112:23: 112:25}` + found coroutine `{coroutine@$DIR/malformed-attrs.rs:108:23: 108:25}` -error: aborting due to 75 previous errors; 3 warnings emitted +error: aborting due to 74 previous errors; 3 warnings emitted Some errors have detailed explanations: E0308, E0463, E0539, E0565, E0658, E0805. For more information about an error, try `rustc --explain E0308`. diff --git a/tests/ui/feature-gates/feature-gate-omit-gdb-pretty-printer-section.rs b/tests/ui/feature-gates/feature-gate-omit-gdb-pretty-printer-section.rs deleted file mode 100644 index 66bf7973832ec..0000000000000 --- a/tests/ui/feature-gates/feature-gate-omit-gdb-pretty-printer-section.rs +++ /dev/null @@ -1,2 +0,0 @@ -#[omit_gdb_pretty_printer_section] //~ ERROR the `#[omit_gdb_pretty_printer_section]` attribute is -fn main() {} diff --git a/tests/ui/feature-gates/feature-gate-omit-gdb-pretty-printer-section.stderr b/tests/ui/feature-gates/feature-gate-omit-gdb-pretty-printer-section.stderr deleted file mode 100644 index 2e1d27fb7764d..0000000000000 --- a/tests/ui/feature-gates/feature-gate-omit-gdb-pretty-printer-section.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0658]: the `#[omit_gdb_pretty_printer_section]` attribute is just used for the Rust test suite - --> $DIR/feature-gate-omit-gdb-pretty-printer-section.rs:1:1 - | -LL | #[omit_gdb_pretty_printer_section] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = help: add `#![feature(omit_gdb_pretty_printer_section)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0658`. From 2f60cef412ab56b17c62f2ea44ce72094be8d947 Mon Sep 17 00:00:00 2001 From: Lukas Wirth Date: Sat, 2 Aug 2025 08:46:15 +0200 Subject: [PATCH 07/17] `Interner` arg to `EarlyBinder` does not affect auto traits Conceptually `EarlyBinder` does not contain an `Interner` so it shouldn't tell Rust it does via `PhantomData`. This is necessary for rust-analyzer as it stores `EarlyBinder`s in query results which require `Sync`, placing restrictions on our interner setup. --- compiler/rustc_type_ir/src/binder.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/rustc_type_ir/src/binder.rs b/compiler/rustc_type_ir/src/binder.rs index a7b915c48455b..202d81df5aec3 100644 --- a/compiler/rustc_type_ir/src/binder.rs +++ b/compiler/rustc_type_ir/src/binder.rs @@ -357,7 +357,7 @@ impl TypeVisitor for ValidateBoundVars { pub struct EarlyBinder { value: T, #[derive_where(skip(Debug))] - _tcx: PhantomData, + _tcx: PhantomData I>, } /// For early binders, you should first call `instantiate` before using any visitors. From 870b58f4d060cc63c2969faa3f54da7802c4881e Mon Sep 17 00:00:00 2001 From: Noratrieb <48135649+Noratrieb@users.noreply.github.com> Date: Sat, 2 Aug 2025 11:27:38 +0200 Subject: [PATCH 08/17] Update E0562 to account for the new impl trait positions --- compiler/rustc_error_codes/src/error_codes/E0562.md | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/compiler/rustc_error_codes/src/error_codes/E0562.md b/compiler/rustc_error_codes/src/error_codes/E0562.md index 95f038df56d63..af7b219fb1207 100644 --- a/compiler/rustc_error_codes/src/error_codes/E0562.md +++ b/compiler/rustc_error_codes/src/error_codes/E0562.md @@ -1,5 +1,4 @@ -Abstract return types (written `impl Trait` for some trait `Trait`) are only -allowed as function and inherent impl return types. +`impl Trait` is only allowed as a function return and argument type. Erroneous code example: @@ -14,7 +13,7 @@ fn main() { } ``` -Make sure `impl Trait` only appears in return-type position. +Make sure `impl Trait` appears in a function signature. ``` fn count_to_n(n: usize) -> impl Iterator { @@ -28,6 +27,6 @@ fn main() { } ``` -See [RFC 1522] for more details. +See the [reference] for more details on `impl Trait`. -[RFC 1522]: https://github.com/rust-lang/rfcs/blob/master/text/1522-conservative-impl-trait.md +[reference]: https://doc.rust-lang.org/stable/reference/types/impl-trait.html From 40f587aa0d0a792b3f4e558e739c591534778eb3 Mon Sep 17 00:00:00 2001 From: Zalathar Date: Sat, 2 Aug 2025 23:07:45 +1000 Subject: [PATCH 09/17] Flatten `hash_owner_nodes` with an early-return --- compiler/rustc_middle/src/hir/mod.rs | 42 ++++++++++++++-------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/compiler/rustc_middle/src/hir/mod.rs b/compiler/rustc_middle/src/hir/mod.rs index 6c07e49734ab0..a928703542fd5 100644 --- a/compiler/rustc_middle/src/hir/mod.rs +++ b/compiler/rustc_middle/src/hir/mod.rs @@ -175,32 +175,32 @@ impl<'tcx> TyCtxt<'tcx> { delayed_lints: &[DelayedLint], define_opaque: Option<&[(Span, LocalDefId)]>, ) -> (Option, Option, Option) { - if self.needs_crate_hash() { - self.with_stable_hashing_context(|mut hcx| { - let mut stable_hasher = StableHasher::new(); - node.hash_stable(&mut hcx, &mut stable_hasher); - // Bodies are stored out of line, so we need to pull them explicitly in the hash. - bodies.hash_stable(&mut hcx, &mut stable_hasher); - let h1 = stable_hasher.finish(); + if !self.needs_crate_hash() { + return (None, None, None); + } - let mut stable_hasher = StableHasher::new(); - attrs.hash_stable(&mut hcx, &mut stable_hasher); + self.with_stable_hashing_context(|mut hcx| { + let mut stable_hasher = StableHasher::new(); + node.hash_stable(&mut hcx, &mut stable_hasher); + // Bodies are stored out of line, so we need to pull them explicitly in the hash. + bodies.hash_stable(&mut hcx, &mut stable_hasher); + let h1 = stable_hasher.finish(); - // Hash the defined opaque types, which are not present in the attrs. - define_opaque.hash_stable(&mut hcx, &mut stable_hasher); + let mut stable_hasher = StableHasher::new(); + attrs.hash_stable(&mut hcx, &mut stable_hasher); - let h2 = stable_hasher.finish(); + // Hash the defined opaque types, which are not present in the attrs. + define_opaque.hash_stable(&mut hcx, &mut stable_hasher); - // hash lints emitted during ast lowering - let mut stable_hasher = StableHasher::new(); - delayed_lints.hash_stable(&mut hcx, &mut stable_hasher); - let h3 = stable_hasher.finish(); + let h2 = stable_hasher.finish(); - (Some(h1), Some(h2), Some(h3)) - }) - } else { - (None, None, None) - } + // hash lints emitted during ast lowering + let mut stable_hasher = StableHasher::new(); + delayed_lints.hash_stable(&mut hcx, &mut stable_hasher); + let h3 = stable_hasher.finish(); + + (Some(h1), Some(h2), Some(h3)) + }) } } From d3e597a1322575dd15ede6a032402488fdc6161d Mon Sep 17 00:00:00 2001 From: Zalathar Date: Sat, 2 Aug 2025 23:06:48 +1000 Subject: [PATCH 10/17] Return a struct with named fields from `hash_owner_nodes` --- compiler/rustc_ast_lowering/src/lib.rs | 2 +- compiler/rustc_middle/src/hir/mod.rs | 22 +++++++++++++++++++--- compiler/rustc_middle/src/ty/context.rs | 2 +- 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/compiler/rustc_ast_lowering/src/lib.rs b/compiler/rustc_ast_lowering/src/lib.rs index 189c82b614c2d..d097e3cbaa822 100644 --- a/compiler/rustc_ast_lowering/src/lib.rs +++ b/compiler/rustc_ast_lowering/src/lib.rs @@ -675,7 +675,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { let bodies = SortedMap::from_presorted_elements(bodies); // Don't hash unless necessary, because it's expensive. - let (opt_hash_including_bodies, attrs_hash, delayed_lints_hash) = + let rustc_middle::hir::Hashes { opt_hash_including_bodies, attrs_hash, delayed_lints_hash } = self.tcx.hash_owner_nodes(node, &bodies, &attrs, &delayed_lints, define_opaque); let num_nodes = self.item_local_id_counter.as_usize(); let (nodes, parenting) = index::index_hir(self.tcx, node, &bodies, num_nodes); diff --git a/compiler/rustc_middle/src/hir/mod.rs b/compiler/rustc_middle/src/hir/mod.rs index a928703542fd5..67bc89692ff79 100644 --- a/compiler/rustc_middle/src/hir/mod.rs +++ b/compiler/rustc_middle/src/hir/mod.rs @@ -174,9 +174,13 @@ impl<'tcx> TyCtxt<'tcx> { attrs: &SortedMap, delayed_lints: &[DelayedLint], define_opaque: Option<&[(Span, LocalDefId)]>, - ) -> (Option, Option, Option) { + ) -> Hashes { if !self.needs_crate_hash() { - return (None, None, None); + return Hashes { + opt_hash_including_bodies: None, + attrs_hash: None, + delayed_lints_hash: None, + }; } self.with_stable_hashing_context(|mut hcx| { @@ -199,11 +203,23 @@ impl<'tcx> TyCtxt<'tcx> { delayed_lints.hash_stable(&mut hcx, &mut stable_hasher); let h3 = stable_hasher.finish(); - (Some(h1), Some(h2), Some(h3)) + Hashes { + opt_hash_including_bodies: Some(h1), + attrs_hash: Some(h2), + delayed_lints_hash: Some(h3), + } }) } } +/// Hashes computed by [`TyCtxt::hash_owner_nodes`] if necessary. +#[derive(Clone, Copy, Debug)] +pub struct Hashes { + pub opt_hash_including_bodies: Option, + pub attrs_hash: Option, + pub delayed_lints_hash: Option, +} + pub fn provide(providers: &mut Providers) { providers.hir_crate_items = map::hir_crate_items; providers.crate_hash = map::crate_hash; diff --git a/compiler/rustc_middle/src/ty/context.rs b/compiler/rustc_middle/src/ty/context.rs index f4ee3d7971c3f..d583c5d496edc 100644 --- a/compiler/rustc_middle/src/ty/context.rs +++ b/compiler/rustc_middle/src/ty/context.rs @@ -1381,7 +1381,7 @@ impl<'tcx> TyCtxtFeed<'tcx, LocalDefId> { let bodies = Default::default(); let attrs = hir::AttributeMap::EMPTY; - let (opt_hash_including_bodies, _, _) = + let rustc_middle::hir::Hashes { opt_hash_including_bodies, .. } = self.tcx.hash_owner_nodes(node, &bodies, &attrs.map, &[], attrs.define_opaque); let node = node.into(); self.opt_hir_owner_nodes(Some(self.tcx.arena.alloc(hir::OwnerNodes { From f87e829d6e8782ac719acb38236d4eeae06f62dd Mon Sep 17 00:00:00 2001 From: Kivooeo Date: Sat, 2 Aug 2025 20:36:45 +0500 Subject: [PATCH 11/17] update flags for consistency --- compiler/rustc_codegen_ssa/src/back/link.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/compiler/rustc_codegen_ssa/src/back/link.rs b/compiler/rustc_codegen_ssa/src/back/link.rs index 162fbf3d6e249..b69fbf61185d7 100644 --- a/compiler/rustc_codegen_ssa/src/back/link.rs +++ b/compiler/rustc_codegen_ssa/src/back/link.rs @@ -1011,11 +1011,12 @@ fn link_natively( (Strip::Debuginfo, _) => { strip_with_external_utility(sess, stripcmd, out_filename, &["--strip-debug"]) } - // Per the manpage, `-x` is the maximum safe strip level for dynamic libraries. (#93988) + + // Per the manpage, --discard-all is the maximum safe strip level for dynamic libraries. (#93988) ( Strip::Symbols, CrateType::Dylib | CrateType::Cdylib | CrateType::ProcMacro | CrateType::Sdylib, - ) => strip_with_external_utility(sess, stripcmd, out_filename, &["-x"]), + ) => strip_with_external_utility(sess, stripcmd, out_filename, &["--discard-all"]), (Strip::Symbols, _) => { strip_with_external_utility(sess, stripcmd, out_filename, &["--strip-all"]) } From 8ca798616acbbb87f80d74bd16c0e753a3cadc33 Mon Sep 17 00:00:00 2001 From: Kivooeo Date: Sat, 2 Aug 2025 21:26:39 +0500 Subject: [PATCH 12/17] update links --- compiler/rustc_hir_typeck/src/method/confirm.rs | 2 +- compiler/rustc_hir_typeck/src/method/probe.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/compiler/rustc_hir_typeck/src/method/confirm.rs b/compiler/rustc_hir_typeck/src/method/confirm.rs index 8d9f7eaf17746..5a182dabebb85 100644 --- a/compiler/rustc_hir_typeck/src/method/confirm.rs +++ b/compiler/rustc_hir_typeck/src/method/confirm.rs @@ -116,7 +116,7 @@ impl<'a, 'tcx> ConfirmContext<'a, 'tcx> { // If there is a `Self: Sized` bound and `Self` is a trait object, it is possible that // something which derefs to `Self` actually implements the trait and the caller // wanted to make a static dispatch on it but forgot to import the trait. - // See test `tests/ui/issue-35976.rs`. + // See test `tests/ui/issues/issue-35976.rs`. // // In that case, we'll error anyway, but we'll also re-run the search with all traits // in scope, and if we find another method which can be used, we'll output an diff --git a/compiler/rustc_hir_typeck/src/method/probe.rs b/compiler/rustc_hir_typeck/src/method/probe.rs index 1f3969bd93c3c..3ca3b56b87e01 100644 --- a/compiler/rustc_hir_typeck/src/method/probe.rs +++ b/compiler/rustc_hir_typeck/src/method/probe.rs @@ -2051,7 +2051,7 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> { /// probe. This will result in a pending obligation so when more type-info is available we can /// make the final decision. /// - /// Example (`tests/ui/method-two-trait-defer-resolution-1.rs`): + /// Example (`tests/ui/methods/method-two-trait-defer-resolution-1.rs`): /// /// ```ignore (illustrative) /// trait Foo { ... } From 97435739ff5563ff87cc153b8eb09450997f68fd Mon Sep 17 00:00:00 2001 From: github-actions Date: Sun, 3 Aug 2025 00:27:18 +0000 Subject: [PATCH 13/17] cargo update compiler & tools dependencies: Locking 14 packages to latest compatible versions Updating clap v4.5.41 -> v4.5.42 Updating clap_builder v4.5.41 -> v4.5.42 Updating jsonpath-rust v1.0.3 -> v1.0.4 Updating libredox v0.1.6 -> v0.1.9 Updating object v0.37.1 -> v0.37.2 Updating redox_syscall v0.5.16 -> v0.5.17 Updating redox_users v0.5.0 -> v0.5.2 Updating rustc-demangle v0.1.25 -> v0.1.26 Updating serde_json v1.0.141 -> v1.0.142 Updating wasm-encoder v0.235.0 -> v0.236.0 Updating wasmparser v0.235.0 -> v0.236.0 Updating wast v235.0.0 -> v236.0.0 Updating wat v1.235.0 -> v1.236.0 Updating windows-targets v0.53.2 -> v0.53.3 note: pass `--verbose` to see 36 unchanged dependencies behind latest library dependencies: Locking 3 packages to latest compatible versions Updating object v0.37.1 -> v0.37.2 Updating rustc-demangle v0.1.25 -> v0.1.26 Updating unwinding v0.2.7 -> v0.2.8 note: pass `--verbose` to see 2 unchanged dependencies behind latest rustbook dependencies: Locking 6 packages to latest compatible versions Updating cc v1.2.30 -> v1.2.31 Updating clap v4.5.41 -> v4.5.42 Updating clap_builder v4.5.41 -> v4.5.42 Updating redox_syscall v0.5.16 -> v0.5.17 Updating serde_json v1.0.141 -> v1.0.142 Updating windows-targets v0.53.2 -> v0.53.3 --- Cargo.lock | 77 ++++++++++++++++++----------------- library/Cargo.lock | 13 +++--- src/tools/rustbook/Cargo.lock | 27 ++++++------ 3 files changed, 59 insertions(+), 58 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d9cfda17ad929..a966493f1397a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -518,9 +518,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.41" +version = "4.5.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be92d32e80243a54711e5d7ce823c35c41c9d929dc4ab58e1276f625841aadf9" +checksum = "ed87a9d530bb41a67537289bafcac159cb3ee28460e0a4571123d2a778a6a882" dependencies = [ "clap_builder", "clap_derive", @@ -538,9 +538,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.41" +version = "4.5.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "707eab41e9622f9139419d573eca0900137718000c517d47da73045f54331c3d" +checksum = "64f4f3f3c77c94aff3c7e9aac9a2ca1974a5adf392a8bb751e827d6d127ab966" dependencies = [ "anstream", "anstyle", @@ -1171,7 +1171,7 @@ checksum = "e01a3366d27ee9890022452ee61b2b63a67e6f13f58900b651ff5665f0bb1fab" dependencies = [ "libc", "option-ext", - "redox_users 0.5.0", + "redox_users 0.5.2", "windows-sys 0.60.2", ] @@ -2094,9 +2094,9 @@ dependencies = [ [[package]] name = "jsonpath-rust" -version = "1.0.3" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d057f8fd19e20c3f14d3663983397155739b6bc1148dc5cd4c4a1a5b3130eb0" +checksum = "633a7320c4bb672863a3782e89b9094ad70285e097ff6832cddd0ec615beadfa" dependencies = [ "pest", "pest_derive", @@ -2190,7 +2190,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "07033963ba89ebaf1584d767badaa2e8fcec21aedea6b8c0346d487d49c28667" dependencies = [ "cfg-if", - "windows-targets 0.53.2", + "windows-targets 0.53.3", ] [[package]] @@ -2201,9 +2201,9 @@ checksum = "f9fbbcab51052fe104eb5e5d351cf728d30a5be1fe14d9be8a3b097481fb97de" [[package]] name = "libredox" -version = "0.1.6" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4488594b9328dee448adb906d8b126d9b7deb7cf5c22161ee591610bb1be83c0" +checksum = "391290121bad3d37fbddad76d8f5d1c1c314cfc646d143d7e07a3086ddff0ce3" dependencies = [ "bitflags", "libc", @@ -2643,9 +2643,9 @@ dependencies = [ [[package]] name = "object" -version = "0.37.1" +version = "0.37.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03fd943161069e1768b4b3d050890ba48730e590f57e56d4aa04e7e090e61b4a" +checksum = "b3e3d0a7419f081f4a808147e845310313a39f322d7ae1f996b7f001d6cbed04" dependencies = [ "crc32fast", "flate2", @@ -2653,7 +2653,7 @@ dependencies = [ "indexmap", "memchr", "ruzstd 0.8.1", - "wasmparser 0.234.0", + "wasmparser 0.236.0", ] [[package]] @@ -3167,9 +3167,9 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.5.16" +version = "0.5.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7251471db004e509f4e75a62cca9435365b5ec7bcdff530d612ac7c87c44a792" +checksum = "5407465600fb0548f1442edf71dd20683c6ed326200ace4b1ef0763521bb3b77" dependencies = [ "bitflags", ] @@ -3187,9 +3187,9 @@ dependencies = [ [[package]] name = "redox_users" -version = "0.5.0" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd6f9d3d47bdd2ad6945c5015a226ec6155d0bcdfd8f7cd29f86b71f8de99d2b" +checksum = "a4e608c6638b9c18977b00b475ac1f28d14e84b27d8d42f70e0bf1e3dec127ac" dependencies = [ "getrandom 0.2.16", "libredox", @@ -3279,7 +3279,7 @@ dependencies = [ "build_helper", "gimli 0.32.0", "libc", - "object 0.37.1", + "object 0.37.2", "regex", "serde_json", "similar", @@ -3301,9 +3301,9 @@ dependencies = [ [[package]] name = "rustc-demangle" -version = "0.1.25" +version = "0.1.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "989e6739f80c4ad5b13e0fd7fe89531180375b18520cc8c82080e4dc4035b84f" +checksum = "56f7d92ca342cea22a06f2121d944b4fd82af56988c270852495420f961d4ace" [[package]] name = "rustc-hash" @@ -3569,7 +3569,7 @@ dependencies = [ "itertools", "libc", "measureme", - "object 0.37.1", + "object 0.37.2", "rustc-demangle", "rustc_abi", "rustc_ast", @@ -3607,7 +3607,7 @@ dependencies = [ "cc", "itertools", "libc", - "object 0.37.1", + "object 0.37.2", "pathdiff", "regex", "rustc_abi", @@ -4642,7 +4642,7 @@ name = "rustc_target" version = "0.0.0" dependencies = [ "bitflags", - "object 0.37.1", + "object 0.37.2", "rustc_abi", "rustc_data_structures", "rustc_fs_util", @@ -5039,9 +5039,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.141" +version = "1.0.142" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30b9eff21ebe718216c6ec64e1d9ac57087aad11efc64e32002bce4a0d4c03d3" +checksum = "030fedb782600dcbd6f02d479bf0d817ac3bb40d644745b769d6a96bc3afc5a7" dependencies = [ "itoa", "memchr", @@ -6099,12 +6099,12 @@ dependencies = [ [[package]] name = "wasm-encoder" -version = "0.235.0" +version = "0.236.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3bc393c395cb621367ff02d854179882b9a351b4e0c93d1397e6090b53a5c2a" +checksum = "3108979166ab0d3c7262d2e16a2190ffe784b2a5beb963edef154b5e8e07680b" dependencies = [ "leb128fmt", - "wasmparser 0.235.0", + "wasmparser 0.236.0", ] [[package]] @@ -6144,9 +6144,9 @@ dependencies = [ [[package]] name = "wasmparser" -version = "0.235.0" +version = "0.236.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "161296c618fa2d63f6ed5fffd1112937e803cb9ec71b32b01a76321555660917" +checksum = "16d1eee846a705f6f3cb9d7b9f79b54583810f1fb57a1e3aea76d1742db2e3d2" dependencies = [ "bitflags", "indexmap", @@ -6155,22 +6155,22 @@ dependencies = [ [[package]] name = "wast" -version = "235.0.0" +version = "236.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1eda4293f626c99021bb3a6fbe4fbbe90c0e31a5ace89b5f620af8925de72e13" +checksum = "11d6b6faeab519ba6fbf9b26add41617ca6f5553f99ebc33d876e591d2f4f3c6" dependencies = [ "bumpalo", "leb128fmt", "memchr", "unicode-width 0.2.1", - "wasm-encoder 0.235.0", + "wasm-encoder 0.236.0", ] [[package]] name = "wat" -version = "1.235.0" +version = "1.236.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e777e0327115793cb96ab220b98f85327ec3d11f34ec9e8d723264522ef206aa" +checksum = "cc31704322400f461f7f31a5f9190d5488aaeafb63ae69ad2b5888d2704dcb08" dependencies = [ "wast", ] @@ -6426,7 +6426,7 @@ version = "0.60.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb" dependencies = [ - "windows-targets 0.53.2", + "windows-targets 0.53.3", ] [[package]] @@ -6462,10 +6462,11 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.53.2" +version = "0.53.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c66f69fcc9ce11da9966ddb31a40968cad001c5bedeb5c2b82ede4253ab48aef" +checksum = "d5fe6031c4041849d7c496a8ded650796e7b6ecc19df1a431c1a363342e5dc91" dependencies = [ + "windows-link", "windows_aarch64_gnullvm 0.53.0", "windows_aarch64_msvc 0.53.0", "windows_i686_gnu 0.53.0", diff --git a/library/Cargo.lock b/library/Cargo.lock index 988f4a8f7d51f..09228825086ee 100644 --- a/library/Cargo.lock +++ b/library/Cargo.lock @@ -169,9 +169,9 @@ dependencies = [ [[package]] name = "object" -version = "0.37.1" +version = "0.37.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03fd943161069e1768b4b3d050890ba48730e590f57e56d4aa04e7e090e61b4a" +checksum = "b3e3d0a7419f081f4a808147e845310313a39f322d7ae1f996b7f001d6cbed04" dependencies = [ "memchr", "rustc-std-workspace-alloc", @@ -259,9 +259,9 @@ dependencies = [ [[package]] name = "rustc-demangle" -version = "0.1.25" +version = "0.1.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "989e6739f80c4ad5b13e0fd7fe89531180375b18520cc8c82080e4dc4035b84f" +checksum = "56f7d92ca342cea22a06f2121d944b4fd82af56988c270852495420f961d4ace" dependencies = [ "rustc-std-workspace-core", ] @@ -384,11 +384,10 @@ dependencies = [ [[package]] name = "unwinding" -version = "0.2.7" +version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d80f6c2bfede213d9a90b4a14f3eb99b84e33c52df6c1a15de0a100f5a88751" +checksum = "60612c845ef41699f39dc8c5391f252942c0a88b7d15da672eff0d14101bbd6d" dependencies = [ - "compiler_builtins", "gimli", "rustc-std-workspace-core", ] diff --git a/src/tools/rustbook/Cargo.lock b/src/tools/rustbook/Cargo.lock index 5f30c75732c7e..d0eeab2206237 100644 --- a/src/tools/rustbook/Cargo.lock +++ b/src/tools/rustbook/Cargo.lock @@ -156,9 +156,9 @@ checksum = "46c5e41b57b8bba42a04676d81cb89e9ee8e859a1a66f80a5a72e1cb76b34d43" [[package]] name = "cc" -version = "1.2.30" +version = "1.2.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "deec109607ca693028562ed836a5f1c4b8bd77755c4e132fc5ce11b0b6211ae7" +checksum = "c3a42d84bb6b69d3a8b3eaacf0d88f179e1929695e1ad012b6cf64d9caaa5fd2" dependencies = [ "shlex", ] @@ -185,9 +185,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.41" +version = "4.5.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be92d32e80243a54711e5d7ce823c35c41c9d929dc4ab58e1276f625841aadf9" +checksum = "ed87a9d530bb41a67537289bafcac159cb3ee28460e0a4571123d2a778a6a882" dependencies = [ "clap_builder", "clap_derive", @@ -195,9 +195,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.41" +version = "4.5.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "707eab41e9622f9139419d573eca0900137718000c517d47da73045f54331c3d" +checksum = "64f4f3f3c77c94aff3c7e9aac9a2ca1974a5adf392a8bb751e827d6d127ab966" dependencies = [ "anstream", "anstyle", @@ -1343,9 +1343,9 @@ checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" [[package]] name = "redox_syscall" -version = "0.5.16" +version = "0.5.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7251471db004e509f4e75a62cca9435365b5ec7bcdff530d612ac7c87c44a792" +checksum = "5407465600fb0548f1442edf71dd20683c6ed326200ace4b1ef0763521bb3b77" dependencies = [ "bitflags 2.9.1", ] @@ -1459,9 +1459,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.141" +version = "1.0.142" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30b9eff21ebe718216c6ec64e1d9ac57087aad11efc64e32002bce4a0d4c03d3" +checksum = "030fedb782600dcbd6f02d479bf0d817ac3bb40d644745b769d6a96bc3afc5a7" dependencies = [ "itoa", "memchr", @@ -1969,7 +1969,7 @@ version = "0.60.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb" dependencies = [ - "windows-targets 0.53.2", + "windows-targets 0.53.3", ] [[package]] @@ -1990,10 +1990,11 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.53.2" +version = "0.53.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c66f69fcc9ce11da9966ddb31a40968cad001c5bedeb5c2b82ede4253ab48aef" +checksum = "d5fe6031c4041849d7c496a8ded650796e7b6ecc19df1a431c1a363342e5dc91" dependencies = [ + "windows-link", "windows_aarch64_gnullvm 0.53.0", "windows_aarch64_msvc 0.53.0", "windows_i686_gnu 0.53.0", From 2ddf0ca9f5402ce6a710d35a5beb2067201ff23d Mon Sep 17 00:00:00 2001 From: Zalathar Date: Sat, 2 Aug 2025 12:44:51 +1000 Subject: [PATCH 14/17] Change `ProcRes::print_info` to `format_info` This method now returns a string instead of printing directly to (possibly-captured) stdout. --- src/tools/compiletest/src/runtest.rs | 9 +++++---- src/tools/compiletest/src/runtest/rustdoc_json.rs | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index ba7fcadbc2e59..12a5e55e77b4c 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -2957,7 +2957,8 @@ pub struct ProcRes { } impl ProcRes { - pub fn print_info(&self) { + #[must_use] + pub fn format_info(&self) -> String { fn render(name: &str, contents: &str) -> String { let contents = json::extract_rendered(contents); let contents = contents.trim_end(); @@ -2973,20 +2974,20 @@ impl ProcRes { } } - println!( + format!( "status: {}\ncommand: {}\n{}\n{}\n", self.status, self.cmdline, render("stdout", &self.stdout), render("stderr", &self.stderr), - ); + ) } pub fn fatal(&self, err: Option<&str>, on_failure: impl FnOnce()) -> ! { if let Some(e) = err { println!("\nerror: {}", e); } - self.print_info(); + println!("{}", self.format_info()); on_failure(); // Use resume_unwind instead of panic!() to prevent a panic message + backtrace from // compiletest, which is unnecessary noise. diff --git a/src/tools/compiletest/src/runtest/rustdoc_json.rs b/src/tools/compiletest/src/runtest/rustdoc_json.rs index 4f35efedfde49..7c23665c39026 100644 --- a/src/tools/compiletest/src/runtest/rustdoc_json.rs +++ b/src/tools/compiletest/src/runtest/rustdoc_json.rs @@ -31,7 +31,7 @@ impl TestCx<'_> { if !res.status.success() { self.fatal_proc_rec_with_ctx("jsondocck failed!", &res, |_| { println!("Rustdoc Output:"); - proc_res.print_info(); + println!("{}", proc_res.format_info()); }) } From d1d44d44f15f32ea4c53abc2dbb35bd8304e582e Mon Sep 17 00:00:00 2001 From: Zalathar Date: Sat, 2 Aug 2025 12:57:30 +1000 Subject: [PATCH 15/17] Consolidate all `ProcRes` unwinds into one code path --- src/tools/compiletest/src/runtest.rs | 50 ++++++++++--------- src/tools/compiletest/src/runtest/rustdoc.rs | 4 +- .../compiletest/src/runtest/rustdoc_json.rs | 2 +- 3 files changed, 29 insertions(+), 27 deletions(-) diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index 12a5e55e77b4c..b1f8e461aef8a 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -354,13 +354,10 @@ impl<'test> TestCx<'test> { } } else { if proc_res.status.success() { - { - self.error(&format!("{} test did not emit an error", self.config.mode)); - if self.config.mode == crate::common::TestMode::Ui { - println!("note: by default, ui tests are expected not to compile"); - } - proc_res.fatal(None, || ()); - }; + let err = &format!("{} test did not emit an error", self.config.mode); + let extra_note = (self.config.mode == crate::common::TestMode::Ui) + .then_some("note: by default, ui tests are expected not to compile"); + self.fatal_proc_rec_general(err, extra_note, proc_res, || ()); } if !self.props.dont_check_failure_status { @@ -2010,18 +2007,34 @@ impl<'test> TestCx<'test> { } fn fatal_proc_rec(&self, err: &str, proc_res: &ProcRes) -> ! { - self.error(err); - proc_res.fatal(None, || ()); + self.fatal_proc_rec_general(err, None, proc_res, || ()); } - fn fatal_proc_rec_with_ctx( + /// Underlying implementation of [`Self::fatal_proc_rec`], providing some + /// extra capabilities not needed by most callers. + fn fatal_proc_rec_general( &self, err: &str, + extra_note: Option<&str>, proc_res: &ProcRes, - on_failure: impl FnOnce(Self), + callback_before_unwind: impl FnOnce(), ) -> ! { self.error(err); - proc_res.fatal(None, || on_failure(*self)); + + // Some callers want to print additional notes after the main error message. + if let Some(note) = extra_note { + println!("{note}"); + } + + // Print the details and output of the subprocess that caused this test to fail. + println!("{}", proc_res.format_info()); + + // Some callers want print more context or show a custom diff before the unwind occurs. + callback_before_unwind(); + + // Use resume_unwind instead of panic!() to prevent a panic message + backtrace from + // compiletest, which is unnecessary noise. + std::panic::resume_unwind(Box::new(())); } // codegen tests (using FileCheck) @@ -2080,7 +2093,7 @@ impl<'test> TestCx<'test> { if cfg!(target_os = "freebsd") { "ISO-8859-1" } else { "UTF-8" } } - fn compare_to_default_rustdoc(&mut self, out_dir: &Utf8Path) { + fn compare_to_default_rustdoc(&self, out_dir: &Utf8Path) { if !self.config.has_html_tidy { return; } @@ -2982,17 +2995,6 @@ impl ProcRes { render("stderr", &self.stderr), ) } - - pub fn fatal(&self, err: Option<&str>, on_failure: impl FnOnce()) -> ! { - if let Some(e) = err { - println!("\nerror: {}", e); - } - println!("{}", self.format_info()); - on_failure(); - // Use resume_unwind instead of panic!() to prevent a panic message + backtrace from - // compiletest, which is unnecessary noise. - std::panic::resume_unwind(Box::new(())); - } } #[derive(Debug)] diff --git a/src/tools/compiletest/src/runtest/rustdoc.rs b/src/tools/compiletest/src/runtest/rustdoc.rs index 236f021ce827c..4a143aa5824e7 100644 --- a/src/tools/compiletest/src/runtest/rustdoc.rs +++ b/src/tools/compiletest/src/runtest/rustdoc.rs @@ -28,8 +28,8 @@ impl TestCx<'_> { } let res = self.run_command_to_procres(&mut cmd); if !res.status.success() { - self.fatal_proc_rec_with_ctx("htmldocck failed!", &res, |mut this| { - this.compare_to_default_rustdoc(&out_dir) + self.fatal_proc_rec_general("htmldocck failed!", None, &res, || { + self.compare_to_default_rustdoc(&out_dir); }); } } diff --git a/src/tools/compiletest/src/runtest/rustdoc_json.rs b/src/tools/compiletest/src/runtest/rustdoc_json.rs index 7c23665c39026..083398f927455 100644 --- a/src/tools/compiletest/src/runtest/rustdoc_json.rs +++ b/src/tools/compiletest/src/runtest/rustdoc_json.rs @@ -29,7 +29,7 @@ impl TestCx<'_> { ); if !res.status.success() { - self.fatal_proc_rec_with_ctx("jsondocck failed!", &res, |_| { + self.fatal_proc_rec_general("jsondocck failed!", None, &res, || { println!("Rustdoc Output:"); println!("{}", proc_res.format_info()); }) From 1063b0f09010ffae99b6a3b55bec5539876ce57e Mon Sep 17 00:00:00 2001 From: Zalathar Date: Sat, 2 Aug 2025 13:07:01 +1000 Subject: [PATCH 16/17] Change `TestCx::error` to `error_prefix`, which returns a string This reduces the amount of "hidden" printing in error-reporting code, which will be helpful when overhauling compiletest's error handling and output capture. --- src/tools/compiletest/src/runtest.rs | 36 +++++++++++++++++----------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index b1f8e461aef8a..35670ba89e997 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -603,7 +603,10 @@ impl<'test> TestCx<'test> { ); } else { for pattern in missing_patterns { - self.error(&format!("error pattern '{}' not found!", pattern)); + println!( + "\n{prefix}: error pattern '{pattern}' not found!", + prefix = self.error_prefix() + ); } self.fatal_proc_rec("multiple error patterns not found", proc_res); } @@ -821,10 +824,11 @@ impl<'test> TestCx<'test> { // - only known line - meh, but suggested // - others are not worth suggesting if !unexpected.is_empty() { - self.error(&format!( - "{} diagnostics reported in JSON output but not expected in test file", - unexpected.len(), - )); + println!( + "\n{prefix}: {n} diagnostics reported in JSON output but not expected in test file", + prefix = self.error_prefix(), + n = unexpected.len(), + ); for error in &unexpected { print_error(error); let mut suggestions = Vec::new(); @@ -854,10 +858,11 @@ impl<'test> TestCx<'test> { } } if !not_found.is_empty() { - self.error(&format!( - "{} diagnostics expected in test file but not reported in JSON output", - not_found.len() - )); + println!( + "\n{prefix}: {n} diagnostics expected in test file but not reported in JSON output", + prefix = self.error_prefix(), + n = not_found.len(), + ); for error in ¬_found { print_error(error); let mut suggestions = Vec::new(); @@ -1992,16 +1997,19 @@ impl<'test> TestCx<'test> { output_base_name(self.config, self.testpaths, self.safe_revision()) } - fn error(&self, err: &str) { + /// Prefix to print before error messages. Normally just `error`, but also + /// includes the revision name for tests that use revisions. + #[must_use] + fn error_prefix(&self) -> String { match self.revision { - Some(rev) => println!("\nerror in revision `{}`: {}", rev, err), - None => println!("\nerror: {}", err), + Some(rev) => format!("error in revision `{rev}`"), + None => format!("error"), } } #[track_caller] fn fatal(&self, err: &str) -> ! { - self.error(err); + println!("\n{prefix}: {err}", prefix = self.error_prefix()); error!("fatal error, panic: {:?}", err); panic!("fatal error"); } @@ -2019,7 +2027,7 @@ impl<'test> TestCx<'test> { proc_res: &ProcRes, callback_before_unwind: impl FnOnce(), ) -> ! { - self.error(err); + println!("\n{prefix}: {err}", prefix = self.error_prefix()); // Some callers want to print additional notes after the main error message. if let Some(note) = extra_note { From caa3cf120ed74575a1573369b3daa3cf14738cb3 Mon Sep 17 00:00:00 2001 From: ash Date: Sat, 2 Aug 2025 18:16:48 -0600 Subject: [PATCH 17/17] explicit tail call tests with indirect operands in LLVM, small test for indexing into a function table as described by RFC 3407 --- tests/ui/explicit-tail-calls/drop-order.rs | 2 - tests/ui/explicit-tail-calls/indexer.rs | 22 +++++++++ .../recursion-etc-u64wrapper.rs | 48 +++++++++++++++++++ .../recursion-etc-u64wrapper.stderr | 19 ++++++++ 4 files changed, 89 insertions(+), 2 deletions(-) create mode 100644 tests/ui/explicit-tail-calls/indexer.rs create mode 100644 tests/ui/explicit-tail-calls/recursion-etc-u64wrapper.rs create mode 100644 tests/ui/explicit-tail-calls/recursion-etc-u64wrapper.stderr diff --git a/tests/ui/explicit-tail-calls/drop-order.rs b/tests/ui/explicit-tail-calls/drop-order.rs index 242336be4845e..58e1afbdf0c51 100644 --- a/tests/ui/explicit-tail-calls/drop-order.rs +++ b/tests/ui/explicit-tail-calls/drop-order.rs @@ -1,5 +1,3 @@ -// FIXME(explicit_tail_calls): enable this test once rustc_codegen_ssa supports tail calls -//@ ignore-test: tail calls are not implemented in rustc_codegen_ssa yet, so this causes 🧊 //@ run-pass #![expect(incomplete_features)] #![feature(explicit_tail_calls)] diff --git a/tests/ui/explicit-tail-calls/indexer.rs b/tests/ui/explicit-tail-calls/indexer.rs new file mode 100644 index 0000000000000..5644506b2f584 --- /dev/null +++ b/tests/ui/explicit-tail-calls/indexer.rs @@ -0,0 +1,22 @@ +//@ run-pass +// Indexing taken from +// https://github.com/phi-go/rfcs/blob/guaranteed-tco/text%2F0000-explicit-tail-calls.md#tail-call-elimination +// no other test has utilized the "function table" +// described in the RFC aside from this one at this point. +#![expect(incomplete_features)] +#![feature(explicit_tail_calls)] + +fn f0(_: usize) {} +fn f1(_: usize) {} +fn f2(_: usize) {} + +fn indexer(idx: usize) { + let v: [fn(usize); 3] = [f0, f1, f2]; + become v[idx](idx) +} + +fn main() { + for idx in 0..3 { + indexer(idx); + } +} diff --git a/tests/ui/explicit-tail-calls/recursion-etc-u64wrapper.rs b/tests/ui/explicit-tail-calls/recursion-etc-u64wrapper.rs new file mode 100644 index 0000000000000..e0fd28e2eeb5f --- /dev/null +++ b/tests/ui/explicit-tail-calls/recursion-etc-u64wrapper.rs @@ -0,0 +1,48 @@ +//@ build-fail +//@ normalize-stderr: "note: .*\n\n" -> "" +//@ normalize-stderr: "thread 'rustc' panicked.*\n" -> "" +//@ normalize-stderr: "(error: internal compiler error: [^:]+):\d+:\d+: " -> "$1:LL:CC: " +//@ rustc-env:RUST_BACKTRACE=0 +//@ known-bug: #144293 +//@ failure-status: 101 +// Same as recursion-etc but eggs LLVM emission into giving indirect arguments. +#![expect(incomplete_features)] +#![feature(explicit_tail_calls)] + +use std::hint::black_box; + +struct U64Wrapper { + pub x: u64, + pub arbitrary: String, +} + +fn count(curr: U64Wrapper, top: U64Wrapper) -> U64Wrapper { + if black_box(curr.x) >= top.x { + curr + } else { + become count( + U64Wrapper { + x: curr.x + 1, + arbitrary: curr.arbitrary, + }, + top, + ) + } +} + +fn main() { + println!( + "{}", + count( + U64Wrapper { + x: 0, + arbitrary: "hello!".into() + }, + black_box(U64Wrapper { + x: 1000000, + arbitrary: "goodbye!".into() + }) + ) + .x + ); +} diff --git a/tests/ui/explicit-tail-calls/recursion-etc-u64wrapper.stderr b/tests/ui/explicit-tail-calls/recursion-etc-u64wrapper.stderr new file mode 100644 index 0000000000000..e754a86fc852f --- /dev/null +++ b/tests/ui/explicit-tail-calls/recursion-etc-u64wrapper.stderr @@ -0,0 +1,19 @@ +error: internal compiler error: $COMPILER_DIR_REAL/rustc_codegen_ssa/src/mir/block.rs:LL:CC: arguments using PassMode::Indirect are currently not supported for tail calls + --> $DIR/recursion-etc-u64wrapper.rs:23:16 + | +LL | become count( + | ________________^ +LL | | U64Wrapper { +LL | | x: curr.x + 1, +LL | | arbitrary: curr.arbitrary, +LL | | }, +LL | | top, +LL | | ) + | |_________^ + + +Box +query stack during panic: +end of query stack +error: aborting due to 1 previous error +