From 13ef6d4efc52eaed9e2c67ecaa334c9a51cde5fc Mon Sep 17 00:00:00 2001 From: Amir Ayupov Date: Fri, 29 Dec 2023 11:39:30 -0800 Subject: [PATCH 001/103] [BOLT] Use CDSort and CDSplit CDSort and CDSplit are the most recent versions of function ordering and function splitting algorithms with some improvements over the previous baseline (ext-tsp and two-way splitting). --- src/tools/opt-dist/src/bolt.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/tools/opt-dist/src/bolt.rs b/src/tools/opt-dist/src/bolt.rs index f694c08f9b93..eb10426f0604 100644 --- a/src/tools/opt-dist/src/bolt.rs +++ b/src/tools/opt-dist/src/bolt.rs @@ -62,9 +62,11 @@ pub fn bolt_optimize(path: &Utf8Path, profile: &BoltProfile) -> anyhow::Result<( // Reorder basic blocks within functions .arg("-reorder-blocks=ext-tsp") // Reorder functions within the binary - .arg("-reorder-functions=hfsort+") + .arg("-reorder-functions=cdsort") // Split function code into hot and code regions .arg("-split-functions") + // Split using best available strategy (three-way splitting, Cache-Directed Sort) + .arg("-split-strategy=cdsplit") // Split as many basic blocks as possible .arg("-split-all-cold") // Move jump tables to a separate section From 8b576d553678688ece127b6f6a25b611e8726c05 Mon Sep 17 00:00:00 2001 From: gvozdvmozgu Date: Sat, 24 Feb 2024 08:14:38 -0500 Subject: [PATCH 002/103] fix attribute validation on associated items in traits --- compiler/rustc_ast_passes/src/ast_validation.rs | 1 + .../validation-on-associated-items-issue-121537.rs | 7 +++++++ .../validation-on-associated-items-issue-121537.stderr | 8 ++++++++ 3 files changed, 16 insertions(+) create mode 100644 tests/ui/attributes/validation-on-associated-items-issue-121537.rs create mode 100644 tests/ui/attributes/validation-on-associated-items-issue-121537.stderr diff --git a/compiler/rustc_ast_passes/src/ast_validation.rs b/compiler/rustc_ast_passes/src/ast_validation.rs index 8c9ad8360876..3330b2c06117 100644 --- a/compiler/rustc_ast_passes/src/ast_validation.rs +++ b/compiler/rustc_ast_passes/src/ast_validation.rs @@ -1519,6 +1519,7 @@ impl<'a> Visitor<'a> for AstValidator<'a> { generics, body.as_deref(), ); + walk_list!(self, visit_attribute, &item.attrs); self.visit_fn(kind, item.span, item.id); } AssocItemKind::Type(_) => { diff --git a/tests/ui/attributes/validation-on-associated-items-issue-121537.rs b/tests/ui/attributes/validation-on-associated-items-issue-121537.rs new file mode 100644 index 000000000000..60e5a21eec77 --- /dev/null +++ b/tests/ui/attributes/validation-on-associated-items-issue-121537.rs @@ -0,0 +1,7 @@ +trait MyTrait { + #[doc = MyTrait] + //~^ ERROR attribute value must be a literal + fn myfun(); +} + +fn main() {} diff --git a/tests/ui/attributes/validation-on-associated-items-issue-121537.stderr b/tests/ui/attributes/validation-on-associated-items-issue-121537.stderr new file mode 100644 index 000000000000..9c37bb823179 --- /dev/null +++ b/tests/ui/attributes/validation-on-associated-items-issue-121537.stderr @@ -0,0 +1,8 @@ +error: attribute value must be a literal + --> $DIR/validation-on-associated-items-issue-121537.rs:2:13 + | +LL | #[doc = MyTrait] + | ^^^^^^^ + +error: aborting due to 1 previous error + From 98dcd8505470b328c7177dbaa4fad68352692c2a Mon Sep 17 00:00:00 2001 From: Gary Guo Date: Tue, 26 Dec 2023 15:28:42 +0000 Subject: [PATCH 003/103] Change InlineAsm to allow multiple targets instead --- src/base.rs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/base.rs b/src/base.rs index a7e76fbc128e..1ce920f3bdb7 100644 --- a/src/base.rs +++ b/src/base.rs @@ -445,7 +445,7 @@ fn codegen_fn_body(fx: &mut FunctionCx<'_, '_, '_>, start_block: Block) { template, operands, options, - destination, + targets, line_spans: _, unwind: _, } => { @@ -456,13 +456,25 @@ fn codegen_fn_body(fx: &mut FunctionCx<'_, '_, '_>, start_block: Block) { ); } + let have_labels = if options.contains(InlineAsmOptions::NORETURN) { + !targets.is_empty() + } else { + targets.len() > 1 + }; + if have_labels { + fx.tcx.dcx().span_fatal( + source_info.span, + "cranelift doesn't support labels in inline assembly.", + ); + } + crate::inline_asm::codegen_inline_asm_terminator( fx, source_info.span, template, operands, *options, - *destination, + targets.get(0).copied(), ); } TerminatorKind::UnwindTerminate(reason) => { From 8cec9989b2a8b39da211d819f1c05fab94886b34 Mon Sep 17 00:00:00 2001 From: Gary Guo Date: Tue, 26 Dec 2023 16:07:35 +0000 Subject: [PATCH 004/103] Implement asm goto in MIR and MIR lowering --- src/global_asm.rs | 3 ++- src/inline_asm.rs | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/global_asm.rs b/src/global_asm.rs index da07b66c762e..44650898de89 100644 --- a/src/global_asm.rs +++ b/src/global_asm.rs @@ -78,7 +78,8 @@ pub(crate) fn codegen_global_asm_item(tcx: TyCtxt<'_>, global_asm: &mut String, InlineAsmOperand::In { .. } | InlineAsmOperand::Out { .. } | InlineAsmOperand::InOut { .. } - | InlineAsmOperand::SplitInOut { .. } => { + | InlineAsmOperand::SplitInOut { .. } + | InlineAsmOperand::Label { .. } => { span_bug!(op_sp, "invalid operand type for global_asm!") } } diff --git a/src/inline_asm.rs b/src/inline_asm.rs index 7793b1b70924..171ee88a11c7 100644 --- a/src/inline_asm.rs +++ b/src/inline_asm.rs @@ -129,6 +129,9 @@ pub(crate) fn codegen_inline_asm_terminator<'tcx>( let instance = Instance::mono(fx.tcx, def_id).polymorphize(fx.tcx); CInlineAsmOperand::Symbol { symbol: fx.tcx.symbol_name(instance).name.to_owned() } } + InlineAsmOperand::Label { .. } => { + span_bug!(span, "asm! label operands are not yet supported"); + } }) .collect::>(); From a11756ca757e37aa19fb5101aa44f8c82cd17d81 Mon Sep 17 00:00:00 2001 From: Oli Scherer Date: Fri, 23 Feb 2024 12:11:11 +0000 Subject: [PATCH 005/103] Forbid implementing `Freeze` even if the trait is stabilized --- example/mini_core.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/example/mini_core.rs b/example/mini_core.rs index a79909ce0c87..47db7ee36918 100644 --- a/example/mini_core.rs +++ b/example/mini_core.rs @@ -8,6 +8,7 @@ rustc_attrs, transparent_unions, auto_traits, + freeze_impls, thread_local )] #![no_core] From c121a26ab978681db9133865089a67a3d9723eda Mon Sep 17 00:00:00 2001 From: Tyler Mandry Date: Tue, 27 Feb 2024 17:08:48 -0800 Subject: [PATCH 006/103] Split refining_impl_trait lint into _reachable, _internal variants --- compiler/rustc_hir_analysis/messages.ftl | 1 + .../src/check/compare_impl_item/refine.rs | 33 +++---- compiler/rustc_hir_analysis/src/errors.rs | 1 + compiler/rustc_lint/src/lib.rs | 6 ++ compiler/rustc_lint_defs/src/builtin.rs | 90 ++++++++++++++++--- src/tools/lint-docs/src/groups.rs | 4 + .../async-example-desugared-boxed.stderr | 2 + .../async-example-desugared-manual.stderr | 2 + .../bad-item-bound-within-rpitit.stderr | 3 +- tests/ui/impl-trait/in-trait/foreign.rs | 30 ++++++- tests/ui/impl-trait/in-trait/foreign.stderr | 39 ++++++++ tests/ui/impl-trait/in-trait/refine.rs | 3 + tests/ui/impl-trait/in-trait/refine.stderr | 58 +++++++++++- 13 files changed, 239 insertions(+), 33 deletions(-) create mode 100644 tests/ui/impl-trait/in-trait/foreign.stderr diff --git a/compiler/rustc_hir_analysis/messages.ftl b/compiler/rustc_hir_analysis/messages.ftl index e376411cd95c..41e3005545e5 100644 --- a/compiler/rustc_hir_analysis/messages.ftl +++ b/compiler/rustc_hir_analysis/messages.ftl @@ -347,6 +347,7 @@ hir_analysis_rpitit_refined = impl trait in impl method signature does not match .label = return type from trait method defined here .unmatched_bound_label = this bound is stronger than that defined on the trait .note = add `#[allow(refining_impl_trait)]` if it is intended for this to be part of the public API of this crate + .feedback_note = we are soliciting feedback, see issue #121718 for more information hir_analysis_self_in_impl_self = `Self` is not valid in the self type of an impl block diff --git a/compiler/rustc_hir_analysis/src/check/compare_impl_item/refine.rs b/compiler/rustc_hir_analysis/src/check/compare_impl_item/refine.rs index 29dc434ab453..a3edf625c96a 100644 --- a/compiler/rustc_hir_analysis/src/check/compare_impl_item/refine.rs +++ b/compiler/rustc_hir_analysis/src/check/compare_impl_item/refine.rs @@ -2,7 +2,7 @@ use rustc_data_structures::fx::FxIndexSet; use rustc_hir as hir; use rustc_hir::def_id::DefId; use rustc_infer::infer::{outlives::env::OutlivesEnvironment, TyCtxtInferExt}; -use rustc_lint_defs::builtin::REFINING_IMPL_TRAIT; +use rustc_lint_defs::builtin::{REFINING_IMPL_TRAIT_INTERNAL, REFINING_IMPL_TRAIT_REACHABLE}; use rustc_middle::traits::{ObligationCause, Reveal}; use rustc_middle::ty::{ self, Ty, TyCtxt, TypeFoldable, TypeFolder, TypeSuperVisitable, TypeVisitable, TypeVisitor, @@ -24,26 +24,23 @@ pub(super) fn check_refining_return_position_impl_trait_in_trait<'tcx>( if !tcx.impl_method_has_trait_impl_trait_tys(impl_m.def_id) { return; } + // unreachable traits don't have any library guarantees, there's no need to do this check. - if trait_m + let is_internal = trait_m .container_id(tcx) .as_local() .is_some_and(|trait_def_id| !tcx.effective_visibilities(()).is_reachable(trait_def_id)) - { - return; - } + // If a type in the trait ref is private, then there's also no reason to do this check. + || impl_trait_ref.args.iter().any(|arg| { + if let Some(ty) = arg.as_type() + && let Some(self_visibility) = type_visibility(tcx, ty) + { + return !self_visibility.is_public(); + } + false + }); - // If a type in the trait ref is private, then there's also no reason to do this check. let impl_def_id = impl_m.container_id(tcx); - for arg in impl_trait_ref.args { - if let Some(ty) = arg.as_type() - && let Some(self_visibility) = type_visibility(tcx, ty) - && !self_visibility.is_public() - { - return; - } - } - let impl_m_args = ty::GenericArgs::identity_for_item(tcx, impl_m.def_id); let trait_m_to_impl_m_args = impl_m_args.rebase_onto(tcx, impl_def_id, impl_trait_ref.args); let bound_trait_m_sig = tcx.fn_sig(trait_m.def_id).instantiate(tcx, trait_m_to_impl_m_args); @@ -86,6 +83,7 @@ pub(super) fn check_refining_return_position_impl_trait_in_trait<'tcx>( trait_m.def_id, impl_m.def_id, None, + is_internal, ); return; }; @@ -105,6 +103,7 @@ pub(super) fn check_refining_return_position_impl_trait_in_trait<'tcx>( trait_m.def_id, impl_m.def_id, None, + is_internal, ); return; } @@ -199,6 +198,7 @@ pub(super) fn check_refining_return_position_impl_trait_in_trait<'tcx>( trait_m.def_id, impl_m.def_id, Some(span), + is_internal, ); return; } @@ -239,6 +239,7 @@ fn report_mismatched_rpitit_signature<'tcx>( trait_m_def_id: DefId, impl_m_def_id: DefId, unmatched_bound: Option, + is_internal: bool, ) { let mapping = std::iter::zip( tcx.fn_sig(trait_m_def_id).skip_binder().bound_vars(), @@ -291,7 +292,7 @@ fn report_mismatched_rpitit_signature<'tcx>( let span = unmatched_bound.unwrap_or(span); tcx.emit_node_span_lint( - REFINING_IMPL_TRAIT, + if is_internal { REFINING_IMPL_TRAIT_INTERNAL } else { REFINING_IMPL_TRAIT_REACHABLE }, tcx.local_def_id_to_hir_id(impl_m_def_id.expect_local()), span, crate::errors::ReturnPositionImplTraitInTraitRefined { diff --git a/compiler/rustc_hir_analysis/src/errors.rs b/compiler/rustc_hir_analysis/src/errors.rs index 5330260fbf51..dac62c22f890 100644 --- a/compiler/rustc_hir_analysis/src/errors.rs +++ b/compiler/rustc_hir_analysis/src/errors.rs @@ -1072,6 +1072,7 @@ pub struct UnusedAssociatedTypeBounds { #[derive(LintDiagnostic)] #[diag(hir_analysis_rpitit_refined)] #[note] +#[note(hir_analysis_feedback_note)] pub(crate) struct ReturnPositionImplTraitInTraitRefined<'tcx> { #[suggestion(applicability = "maybe-incorrect", code = "{pre}{return_ty}{post}")] pub impl_return_span: Span, diff --git a/compiler/rustc_lint/src/lib.rs b/compiler/rustc_lint/src/lib.rs index 250c4adb948e..31c80c4d75bb 100644 --- a/compiler/rustc_lint/src/lib.rs +++ b/compiler/rustc_lint/src/lib.rs @@ -313,6 +313,12 @@ fn register_builtins(store: &mut LintStore) { // MACRO_USE_EXTERN_CRATE ); + add_lint_group!( + "refining_impl_trait", + REFINING_IMPL_TRAIT_REACHABLE, + REFINING_IMPL_TRAIT_INTERNAL + ); + // Register renamed and removed lints. store.register_renamed("single_use_lifetime", "single_use_lifetimes"); store.register_renamed("elided_lifetime_in_path", "elided_lifetimes_in_paths"); diff --git a/compiler/rustc_lint_defs/src/builtin.rs b/compiler/rustc_lint_defs/src/builtin.rs index 94f8bbe2437f..e2ede2c25cfc 100644 --- a/compiler/rustc_lint_defs/src/builtin.rs +++ b/compiler/rustc_lint_defs/src/builtin.rs @@ -77,7 +77,8 @@ declare_lint_pass! { PROC_MACRO_BACK_COMPAT, PROC_MACRO_DERIVE_RESOLUTION_FALLBACK, PUB_USE_OF_PRIVATE_EXTERN_CRATE, - REFINING_IMPL_TRAIT, + REFINING_IMPL_TRAIT_INTERNAL, + REFINING_IMPL_TRAIT_REACHABLE, RENAMED_AND_REMOVED_LINTS, REPR_TRANSPARENT_EXTERNAL_PRIVATE_FIELDS, RUST_2021_INCOMPATIBLE_CLOSURE_CAPTURES, @@ -4310,8 +4311,10 @@ declare_lint! { } declare_lint! { - /// The `refining_impl_trait` lint detects usages of return-position impl - /// traits in trait signatures which are refined by implementations. + /// The `refining_impl_trait_reachable` lint detects `impl Trait` return + /// types in method signatures that are refined by a publically reachable + /// trait implementation, meaning the implementation adds information about + /// the return type that is not present in the trait. /// /// ### Example /// @@ -4333,7 +4336,7 @@ declare_lint! { /// fn main() { /// // users can observe that the return type of /// // `<&str as AsDisplay>::as_display()` is `&str`. - /// let x: &str = "".as_display(); + /// let _x: &str = "".as_display(); /// } /// ``` /// @@ -4341,13 +4344,80 @@ declare_lint! { /// /// ### Explanation /// - /// Return-position impl trait in traits (RPITITs) desugar to associated types, - /// and callers of methods for types where the implementation is known are + /// Callers of methods for types where the implementation is known are /// able to observe the types written in the impl signature. This may be - /// intended behavior, but may also pose a semver hazard for authors of libraries - /// who do not wish to make stronger guarantees about the types than what is - /// written in the trait signature. - pub REFINING_IMPL_TRAIT, + /// intended behavior, but may also lead to implementation details being + /// revealed unintentionally. In particular, it may pose a semver hazard + /// for authors of libraries who do not wish to make stronger guarantees + /// about the types than what is written in the trait signature. + /// + /// `refining_impl_trait` is a lint group composed of two lints: + /// + /// * `refining_impl_trait_reachable`, for refinements that are publically + /// reachable outside a crate, and + /// * `refining_impl_trait_internal`, for refinements that are only visible + /// within a crate. + /// + /// We are seeking feedback on each of these lints; see issue + /// [#121718](https://github.com/rust-lang/rust/issues/121718) for more + /// information. + pub REFINING_IMPL_TRAIT_REACHABLE, + Warn, + "impl trait in impl method signature does not match trait method signature", +} + +declare_lint! { + /// The `refining_impl_trait_internal` lint detects `impl Trait` return + /// types in method signatures that are refined by a trait implementation, + /// meaning the implementation adds information about the return type that + /// is not present in the trait. + /// + /// ### Example + /// + /// ```rust,compile_fail + /// #![deny(refining_impl_trait)] + /// + /// use std::fmt::Display; + /// + /// trait AsDisplay { + /// fn as_display(&self) -> impl Display; + /// } + /// + /// impl<'s> AsDisplay for &'s str { + /// fn as_display(&self) -> Self { + /// *self + /// } + /// } + /// + /// fn main() { + /// // users can observe that the return type of + /// // `<&str as AsDisplay>::as_display()` is `&str`. + /// let _x: &str = "".as_display(); + /// } + /// ``` + /// + /// {{produces}} + /// + /// ### Explanation + /// + /// Callers of methods for types where the implementation is known are + /// able to observe the types written in the impl signature. This may be + /// intended behavior, but may also lead to implementation details being + /// revealed unintentionally. In particular, it may pose a semver hazard + /// for authors of libraries who do not wish to make stronger guarantees + /// about the types than what is written in the trait signature. + /// + /// `refining_impl_trait` is a lint group composed of two lints: + /// + /// * `refining_impl_trait_reachable`, for refinements that are publically + /// reachable outside a crate, and + /// * `refining_impl_trait_internal`, for refinements that are only visible + /// within a crate. + /// + /// We are seeking feedback on each of these lints; see issue + /// [#121718](https://github.com/rust-lang/rust/issues/121718) for more + /// information. + pub REFINING_IMPL_TRAIT_INTERNAL, Warn, "impl trait in impl method signature does not match trait method signature", } diff --git a/src/tools/lint-docs/src/groups.rs b/src/tools/lint-docs/src/groups.rs index c5cd30ccc343..0c39f2fa6010 100644 --- a/src/tools/lint-docs/src/groups.rs +++ b/src/tools/lint-docs/src/groups.rs @@ -16,6 +16,10 @@ static GROUP_DESCRIPTIONS: &[(&str, &str)] = &[ ("rust-2018-compatibility", "Lints used to transition code from the 2015 edition to 2018"), ("rust-2021-compatibility", "Lints used to transition code from the 2018 edition to 2021"), ("rust-2024-compatibility", "Lints used to transition code from the 2021 edition to 2024"), + ( + "refining-impl-trait", + "Detects refinement of `impl Trait` return types by trait implementations", + ), ]; type LintGroups = BTreeMap>; diff --git a/tests/ui/async-await/in-trait/async-example-desugared-boxed.stderr b/tests/ui/async-await/in-trait/async-example-desugared-boxed.stderr index 54aba77cc05d..36f90c7bcd5f 100644 --- a/tests/ui/async-await/in-trait/async-example-desugared-boxed.stderr +++ b/tests/ui/async-await/in-trait/async-example-desugared-boxed.stderr @@ -8,11 +8,13 @@ LL | fn foo(&self) -> Pin + '_>> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: add `#[allow(refining_impl_trait)]` if it is intended for this to be part of the public API of this crate + = note: we are soliciting feedback, see issue #121718 for more information note: the lint level is defined here --> $DIR/async-example-desugared-boxed.rs:13:12 | LL | #[warn(refining_impl_trait)] | ^^^^^^^^^^^^^^^^^^^ + = note: `#[warn(refining_impl_trait_reachable)]` implied by `#[warn(refining_impl_trait)]` help: replace the return type so that it matches the trait | LL | fn foo(&self) -> impl Future { diff --git a/tests/ui/async-await/in-trait/async-example-desugared-manual.stderr b/tests/ui/async-await/in-trait/async-example-desugared-manual.stderr index d94afd92c569..8e39559071f1 100644 --- a/tests/ui/async-await/in-trait/async-example-desugared-manual.stderr +++ b/tests/ui/async-await/in-trait/async-example-desugared-manual.stderr @@ -8,11 +8,13 @@ LL | fn foo(&self) -> MyFuture { | ^^^^^^^^ | = note: add `#[allow(refining_impl_trait)]` if it is intended for this to be part of the public API of this crate + = note: we are soliciting feedback, see issue #121718 for more information note: the lint level is defined here --> $DIR/async-example-desugared-manual.rs:21:12 | LL | #[warn(refining_impl_trait)] | ^^^^^^^^^^^^^^^^^^^ + = note: `#[warn(refining_impl_trait_reachable)]` implied by `#[warn(refining_impl_trait)]` help: replace the return type so that it matches the trait | LL | fn foo(&self) -> impl Future { diff --git a/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit.stderr b/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit.stderr index c898d17f4b70..022df6f906cf 100644 --- a/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit.stderr +++ b/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit.stderr @@ -22,7 +22,8 @@ LL | fn iter(&self) -> impl 'a + Iterator> { | ^^ this bound is stronger than that defined on the trait | = note: add `#[allow(refining_impl_trait)]` if it is intended for this to be part of the public API of this crate - = note: `#[warn(refining_impl_trait)]` on by default + = note: we are soliciting feedback, see issue #121718 for more information + = note: `#[warn(refining_impl_trait_reachable)]` on by default help: replace the return type so that it matches the trait | LL | fn iter(&self) -> impl Iterator::Item<'_>> + '_ { diff --git a/tests/ui/impl-trait/in-trait/foreign.rs b/tests/ui/impl-trait/in-trait/foreign.rs index e28bc9e00cbb..ca759afc2e6e 100644 --- a/tests/ui/impl-trait/in-trait/foreign.rs +++ b/tests/ui/impl-trait/in-trait/foreign.rs @@ -17,9 +17,29 @@ impl Foo for Local { } } -struct LocalIgnoreRefining; -impl Foo for LocalIgnoreRefining { - #[deny(refining_impl_trait)] +struct LocalOnlyRefiningA; +impl Foo for LocalOnlyRefiningA { + #[warn(refining_impl_trait)] + fn bar(self) -> Arc { + //~^ WARN impl method signature does not match trait method signature + Arc::new(String::new()) + } +} + +struct LocalOnlyRefiningB; +impl Foo for LocalOnlyRefiningB { + #[warn(refining_impl_trait)] + #[allow(refining_impl_trait_reachable)] + fn bar(self) -> Arc { + //~^ WARN impl method signature does not match trait method signature + Arc::new(String::new()) + } +} + +struct LocalOnlyRefiningC; +impl Foo for LocalOnlyRefiningC { + #[warn(refining_impl_trait)] + #[allow(refining_impl_trait_internal)] fn bar(self) -> Arc { Arc::new(String::new()) } @@ -34,5 +54,7 @@ fn main() { let &() = Foreign.bar(); let x: Arc = Local.bar(); - let x: Arc = LocalIgnoreRefining.bar(); + let x: Arc = LocalOnlyRefiningA.bar(); + let x: Arc = LocalOnlyRefiningB.bar(); + let x: Arc = LocalOnlyRefiningC.bar(); } diff --git a/tests/ui/impl-trait/in-trait/foreign.stderr b/tests/ui/impl-trait/in-trait/foreign.stderr new file mode 100644 index 000000000000..1a5a4f2432b1 --- /dev/null +++ b/tests/ui/impl-trait/in-trait/foreign.stderr @@ -0,0 +1,39 @@ +warning: impl trait in impl method signature does not match trait method signature + --> $DIR/foreign.rs:23:21 + | +LL | fn bar(self) -> Arc { + | ^^^^^^^^^^^ + | + = note: add `#[allow(refining_impl_trait)]` if it is intended for this to be part of the public API of this crate + = note: we are soliciting feedback, see issue #121718 for more information +note: the lint level is defined here + --> $DIR/foreign.rs:22:12 + | +LL | #[warn(refining_impl_trait)] + | ^^^^^^^^^^^^^^^^^^^ + = note: `#[warn(refining_impl_trait_internal)]` implied by `#[warn(refining_impl_trait)]` +help: replace the return type so that it matches the trait + | +LL | fn bar(self) -> impl Deref { + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +warning: impl trait in impl method signature does not match trait method signature + --> $DIR/foreign.rs:33:21 + | +LL | fn bar(self) -> Arc { + | ^^^^^^^^^^^ + | + = note: add `#[allow(refining_impl_trait)]` if it is intended for this to be part of the public API of this crate + = note: we are soliciting feedback, see issue #121718 for more information +note: the lint level is defined here + --> $DIR/foreign.rs:31:12 + | +LL | #[warn(refining_impl_trait)] + | ^^^^^^^^^^^^^^^^^^^ +help: replace the return type so that it matches the trait + | +LL | fn bar(self) -> impl Deref { + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +warning: 2 warnings emitted + diff --git a/tests/ui/impl-trait/in-trait/refine.rs b/tests/ui/impl-trait/in-trait/refine.rs index 100e6da06a88..6813c3bbf270 100644 --- a/tests/ui/impl-trait/in-trait/refine.rs +++ b/tests/ui/impl-trait/in-trait/refine.rs @@ -25,6 +25,7 @@ impl Foo for C { struct Private; impl Foo for Private { fn bar() -> () {} + //~^ ERROR impl method signature does not match trait method signature } pub trait Arg { @@ -32,6 +33,7 @@ pub trait Arg { } impl Arg for A { fn bar() -> () {} + //~^ ERROR impl method signature does not match trait method signature } pub trait Late { @@ -52,6 +54,7 @@ mod unreachable { struct E; impl UnreachablePub for E { fn bar() {} + //~^ ERROR impl method signature does not match trait method signature } } diff --git a/tests/ui/impl-trait/in-trait/refine.stderr b/tests/ui/impl-trait/in-trait/refine.stderr index 96a9bc059c84..8d30b0359216 100644 --- a/tests/ui/impl-trait/in-trait/refine.stderr +++ b/tests/ui/impl-trait/in-trait/refine.stderr @@ -8,11 +8,13 @@ LL | fn bar() -> impl Copy {} | ^^^^ this bound is stronger than that defined on the trait | = note: add `#[allow(refining_impl_trait)]` if it is intended for this to be part of the public API of this crate + = note: we are soliciting feedback, see issue #121718 for more information note: the lint level is defined here --> $DIR/refine.rs:1:9 | LL | #![deny(refining_impl_trait)] | ^^^^^^^^^^^^^^^^^^^ + = note: `#[deny(refining_impl_trait_reachable)]` implied by `#[deny(refining_impl_trait)]` help: replace the return type so that it matches the trait | LL | fn bar() -> impl Sized {} @@ -28,6 +30,7 @@ LL | fn bar() {} | ^^^^^^^^ | = note: add `#[allow(refining_impl_trait)]` if it is intended for this to be part of the public API of this crate + = note: we are soliciting feedback, see issue #121718 for more information help: replace the return type so that it matches the trait | LL | fn bar()-> impl Sized {} @@ -43,13 +46,47 @@ LL | fn bar() -> () {} | ^^ | = note: add `#[allow(refining_impl_trait)]` if it is intended for this to be part of the public API of this crate + = note: we are soliciting feedback, see issue #121718 for more information help: replace the return type so that it matches the trait | LL | fn bar() -> impl Sized {} | ~~~~~~~~~~ error: impl trait in impl method signature does not match trait method signature - --> $DIR/refine.rs:43:27 + --> $DIR/refine.rs:27:17 + | +LL | fn bar() -> impl Sized; + | ---------- return type from trait method defined here +... +LL | fn bar() -> () {} + | ^^ + | + = note: add `#[allow(refining_impl_trait)]` if it is intended for this to be part of the public API of this crate + = note: we are soliciting feedback, see issue #121718 for more information + = note: `#[deny(refining_impl_trait_internal)]` implied by `#[deny(refining_impl_trait)]` +help: replace the return type so that it matches the trait + | +LL | fn bar() -> impl Sized {} + | ~~~~~~~~~~ + +error: impl trait in impl method signature does not match trait method signature + --> $DIR/refine.rs:35:17 + | +LL | fn bar() -> impl Sized; + | ---------- return type from trait method defined here +... +LL | fn bar() -> () {} + | ^^ + | + = note: add `#[allow(refining_impl_trait)]` if it is intended for this to be part of the public API of this crate + = note: we are soliciting feedback, see issue #121718 for more information +help: replace the return type so that it matches the trait + | +LL | fn bar() -> impl Sized {} + | ~~~~~~~~~~ + +error: impl trait in impl method signature does not match trait method signature + --> $DIR/refine.rs:45:27 | LL | fn bar<'a>(&'a self) -> impl Sized + 'a; | --------------- return type from trait method defined here @@ -58,10 +95,27 @@ LL | fn bar(&self) -> impl Copy + '_ {} | ^^^^ this bound is stronger than that defined on the trait | = note: add `#[allow(refining_impl_trait)]` if it is intended for this to be part of the public API of this crate + = note: we are soliciting feedback, see issue #121718 for more information help: replace the return type so that it matches the trait | LL | fn bar(&self) -> impl Sized + '_ {} | ~~~~~~~~~~~~~~~ -error: aborting due to 4 previous errors +error: impl trait in impl method signature does not match trait method signature + --> $DIR/refine.rs:56:9 + | +LL | fn bar() -> impl Sized; + | ---------- return type from trait method defined here +... +LL | fn bar() {} + | ^^^^^^^^ + | + = note: add `#[allow(refining_impl_trait)]` if it is intended for this to be part of the public API of this crate + = note: we are soliciting feedback, see issue #121718 for more information +help: replace the return type so that it matches the trait + | +LL | fn bar()-> impl Sized {} + | +++++++++++++ + +error: aborting due to 7 previous errors From c2cc90402b6a896c3273a57e506d6c02a1ec6038 Mon Sep 17 00:00:00 2001 From: Michael Howell Date: Thu, 7 Mar 2024 20:01:28 -0700 Subject: [PATCH 007/103] diagnostics: suggest `Clone` bounds when noop `clone()` --- .../src/traits/error_reporting/suggestions.rs | 60 +++++++++++++++---- tests/ui/suggestions/clone-bounds-121524.rs | 19 ++++++ .../ui/suggestions/clone-bounds-121524.stderr | 19 ++++++ 3 files changed, 88 insertions(+), 10 deletions(-) create mode 100644 tests/ui/suggestions/clone-bounds-121524.rs create mode 100644 tests/ui/suggestions/clone-bounds-121524.stderr diff --git a/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs b/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs index 1241227a5af3..0dc59a4578a9 100644 --- a/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs +++ b/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs @@ -987,10 +987,6 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> { else { return false; }; - let arg_node = self.tcx.hir_node(*arg_hir_id); - let Node::Expr(Expr { kind: hir::ExprKind::Path(_), .. }) = arg_node else { - return false; - }; let clone_trait = self.tcx.require_lang_item(LangItem::Clone, None); let has_clone = |ty| { @@ -998,6 +994,39 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> { .must_apply_modulo_regions() }; + let existing_clone_call = match self.tcx.hir_node(*arg_hir_id) { + // It's just a variable. Propose cloning it. + Node::Expr(Expr { kind: hir::ExprKind::Path(_), .. }) => None, + // It's already a call to `clone()`. We might be able to suggest + // adding a `+ Clone` bound, though. + Node::Expr(Expr { + kind: + hir::ExprKind::MethodCall( + hir::PathSegment { ident, .. }, + _receiver, + &[], + call_span, + ), + hir_id, + .. + }) if ident.name == sym::clone + && !call_span.from_expansion() + && !has_clone(*inner_ty) => + { + // We only care about method calls corresponding to the real `Clone` trait. + let Some(typeck_results) = self.typeck_results.as_ref() else { return false }; + let Some((DefKind::AssocFn, did)) = typeck_results.type_dependent_def(*hir_id) + else { + return false; + }; + if self.tcx.trait_of_item(did) != Some(clone_trait) { + return false; + } + Some(ident.span) + } + _ => return false, + }; + let new_obligation = self.mk_trait_obligation_with_new_self_ty( obligation.param_env, trait_pred.map_bound(|trait_pred| (trait_pred, *inner_ty)), @@ -1015,12 +1044,23 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> { None, ); } - err.span_suggestion_verbose( - obligation.cause.span.shrink_to_hi(), - "consider using clone here", - ".clone()".to_string(), - Applicability::MaybeIncorrect, - ); + if let Some(existing_clone_call) = existing_clone_call { + err.span_note( + existing_clone_call, + format!( + "this `clone()` copies the reference, \ + which does not do anything, \ + because `{inner_ty}` does not implement `Clone`" + ), + ); + } else { + err.span_suggestion_verbose( + obligation.cause.span.shrink_to_hi(), + "consider using clone here", + ".clone()".to_string(), + Applicability::MaybeIncorrect, + ); + } return true; } false diff --git a/tests/ui/suggestions/clone-bounds-121524.rs b/tests/ui/suggestions/clone-bounds-121524.rs new file mode 100644 index 000000000000..8cd60b452de0 --- /dev/null +++ b/tests/ui/suggestions/clone-bounds-121524.rs @@ -0,0 +1,19 @@ +#[derive(Clone)] +struct ThingThatDoesAThing; + +trait DoesAThing {} + +impl DoesAThing for ThingThatDoesAThing {} + +fn clones_impl_ref_inline(thing: &impl DoesAThing) { + //~^ HELP consider further restricting this bound + drops_impl_owned(thing.clone()); //~ ERROR E0277 + //~^ NOTE copies the reference + //~| NOTE the trait `DoesAThing` is not implemented for `&impl DoesAThing` +} + +fn drops_impl_owned(_thing: impl DoesAThing) { } + +fn main() { + clones_impl_ref_inline(&ThingThatDoesAThing); +} diff --git a/tests/ui/suggestions/clone-bounds-121524.stderr b/tests/ui/suggestions/clone-bounds-121524.stderr new file mode 100644 index 000000000000..6d60508a4a14 --- /dev/null +++ b/tests/ui/suggestions/clone-bounds-121524.stderr @@ -0,0 +1,19 @@ +error[E0277]: the trait bound `&impl DoesAThing: DoesAThing` is not satisfied + --> $DIR/clone-bounds-121524.rs:10:22 + | +LL | drops_impl_owned(thing.clone()); + | ^^^^^^^^^^^^^ the trait `DoesAThing` is not implemented for `&impl DoesAThing` + | +note: this `clone()` copies the reference, which does not do anything, because `impl DoesAThing` does not implement `Clone` + --> $DIR/clone-bounds-121524.rs:10:28 + | +LL | drops_impl_owned(thing.clone()); + | ^^^^^ +help: consider further restricting this bound + | +LL | fn clones_impl_ref_inline(thing: &impl DoesAThing + Clone) { + | +++++++ + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0277`. From 5ec45d3d7a42234a03a1dc681e794ecb6f276725 Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Fri, 8 Mar 2024 20:41:29 +0000 Subject: [PATCH 008/103] Merge commit '54cbb6e7531f95e086d5c3dd0d5e73bfbe3545ba' into sync_cg_clif-2024-03-08 --- .github/workflows/main.yml | 17 +- .gitignore | 23 ++- Cargo.lock | 56 +++--- Cargo.toml | 12 +- Readme.md | 5 - build_system/prepare.rs | 27 ++- build_system/tests.rs | 4 +- ...oretests-Disable-not-compiling-tests.patch | 2 +- .../0023-coretests-Ignore-failing-tests.patch | 26 --- patches/stdlib-lock.toml | 9 +- rust-toolchain | 2 +- rustfmt.toml | 1 - scripts/test_rustc_tests.sh | 26 ++- src/common.rs | 17 +- src/constant.rs | 8 +- src/intrinsics/llvm_x86.rs | 175 ++++++++++++++++++ src/intrinsics/mod.rs | 5 +- src/intrinsics/simd.rs | 8 +- y.rs | 6 - 19 files changed, 308 insertions(+), 121 deletions(-) delete mode 100644 patches/0023-coretests-Ignore-failing-tests.patch delete mode 100755 y.rs diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index cf9a105538df..5f0f3e6549c9 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -44,9 +44,10 @@ jobs: env: TARGET_TRIPLE: x86_64-apple-darwin # cross-compile from Linux to Windows using mingw - - os: ubuntu-latest - env: - TARGET_TRIPLE: x86_64-pc-windows-gnu + # FIXME The wine version in Ubuntu 22.04 is missing ProcessPrng + #- os: ubuntu-latest + # env: + # TARGET_TRIPLE: x86_64-pc-windows-gnu - os: ubuntu-latest env: TARGET_TRIPLE: aarch64-unknown-linux-gnu @@ -80,11 +81,11 @@ jobs: if: matrix.os == 'windows-latest' && matrix.env.TARGET_TRIPLE == 'x86_64-pc-windows-gnu' run: rustup set default-host x86_64-pc-windows-gnu - - name: Install MinGW toolchain and wine - if: matrix.os == 'ubuntu-latest' && matrix.env.TARGET_TRIPLE == 'x86_64-pc-windows-gnu' - run: | - sudo apt-get update - sudo apt-get install -y gcc-mingw-w64-x86-64 wine-stable + #- name: Install MinGW toolchain and wine + # if: matrix.os == 'ubuntu-latest' && matrix.env.TARGET_TRIPLE == 'x86_64-pc-windows-gnu' + # run: | + # sudo apt-get update + # sudo apt-get install -y gcc-mingw-w64-x86-64 wine-stable - name: Install AArch64 toolchain and qemu if: matrix.os == 'ubuntu-latest' && matrix.env.TARGET_TRIPLE == 'aarch64-unknown-linux-gnu' diff --git a/.gitignore b/.gitignore index e6ac8c8408da..7915fa138f8f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,18 +1,21 @@ -/target -/build_system/target -**/*.rs.bk -*.rlib -*.o -perf.data -perf.data.old -*.events -*.string* +# Build artifacts during normal use /y.bin /y.bin.dSYM /y.exe /y.pdb +/download /build /dist +/target +/build_system/target + +# Downloaded by certain scripts /rust -/download /git-fixed-subtree.sh + +# Various things that can be created during development +*.rlib +*.o +perf.data +perf.data.old +*.mm_profdata diff --git a/Cargo.lock b/Cargo.lock index b70a1234af39..e308cf80284a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -46,18 +46,18 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "cranelift-bforest" -version = "0.104.0" +version = "0.105.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d819feeda4c420a18f1e28236ca0ce1177b22bf7c8a44ddee92dfe40de15bcf0" +checksum = "9515fcc42b6cb5137f76b84c1a6f819782d0cf12473d145d3bc5cd67eedc8bc2" dependencies = [ "cranelift-entity", ] [[package]] name = "cranelift-codegen" -version = "0.104.0" +version = "0.105.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9b8d03d5bdbca7e5f72b0e0a0f69933ed1f09e24be6c075aa6fe3f802b0cc0c" +checksum = "1ad827c6071bfe6d22de1bc331296a29f9ddc506ff926d8415b435ec6a6efce0" dependencies = [ "bumpalo", "cranelift-bforest", @@ -76,39 +76,39 @@ dependencies = [ [[package]] name = "cranelift-codegen-meta" -version = "0.104.0" +version = "0.105.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3fd3664e38e51649b17dc30cfdd561273fe2f590dcd013fb75d9eabc6272dfb" +checksum = "10e6b36237a9ca2ce2fb4cc7741d418a080afa1327402138412ef85d5367bef1" dependencies = [ "cranelift-codegen-shared", ] [[package]] name = "cranelift-codegen-shared" -version = "0.104.0" +version = "0.105.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b031ec5e605828975952622b5a77d49126f20ffe88d33719a0af66b23a0fc36" +checksum = "c36bf4bfb86898a94ccfa773a1f86e8a5346b1983ff72059bdd2db4600325251" [[package]] name = "cranelift-control" -version = "0.104.0" +version = "0.105.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fada054d017cf2ed8f7ed2336e0517fc1b19e6825be1790de9eb00c94788362b" +checksum = "7cbf36560e7a6bd1409ca91e7b43b2cc7ed8429f343d7605eadf9046e8fac0d0" dependencies = [ "arbitrary", ] [[package]] name = "cranelift-entity" -version = "0.104.0" +version = "0.105.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "177b6f94ae8de6348eb45bf977c79ab9e3c40fc3ac8cb7ed8109560ea39bee7d" +checksum = "a71e11061a75b1184c09bea97c026a88f08b59ade96a7bb1f259d4ea0df2e942" [[package]] name = "cranelift-frontend" -version = "0.104.0" +version = "0.105.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebebd23a69a23e3ddea78e98ff3a2de222e88c8e045d81ef4a72f042e0d79dbd" +checksum = "af5d4da63143ee3485c7bcedde0a818727d737d1083484a0ceedb8950c89e495" dependencies = [ "cranelift-codegen", "log", @@ -118,15 +118,15 @@ dependencies = [ [[package]] name = "cranelift-isle" -version = "0.104.0" +version = "0.105.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1571bfc14df8966d12c6121b5325026591a4b4009e22fea0fe3765ab7cd33b96" +checksum = "457a9832b089e26f5eea70dcf49bed8ec6edafed630ce7c83161f24d46ab8085" [[package]] name = "cranelift-jit" -version = "0.104.0" +version = "0.105.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f61e236d7622c3c43016e8b0f3ba27136e21ac7de328c7fda902e61db1de851" +checksum = "0af95fe68d5a10919012c8db82b1d59820405b8001c8c6d05f94b08031334fa9" dependencies = [ "anyhow", "cranelift-codegen", @@ -144,9 +144,9 @@ dependencies = [ [[package]] name = "cranelift-module" -version = "0.104.0" +version = "0.105.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f30c6820342015c5009070e3e48d1da7b13521399de904663f1c84f5ee839657" +checksum = "11b0b201fa10a4014062d4c56c307c8d18fdf9a84cb5279efe6080241f42c7a7" dependencies = [ "anyhow", "cranelift-codegen", @@ -155,9 +155,9 @@ dependencies = [ [[package]] name = "cranelift-native" -version = "0.104.0" +version = "0.105.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35a69c37e0c10b46fe5527f2397ac821046efbf5f7ec112c8b84df25712f465b" +checksum = "9b490d579df1ce365e1ea359e24ed86d82289fa785153327c2f6a69a59a731e4" dependencies = [ "cranelift-codegen", "libc", @@ -166,9 +166,9 @@ dependencies = [ [[package]] name = "cranelift-object" -version = "0.104.0" +version = "0.105.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24425a329b4343177d5f1852243841dcec17f929d72c0e7f41262140155e55e7" +checksum = "fb7e821ac6db471bcdbd004e5a4fa0d374f1046bd3a2ce278c332e0b0c01ca63" dependencies = [ "anyhow", "cranelift-codegen", @@ -241,9 +241,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.148" +version = "0.2.153" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cdc71e17332e86d2e1d38c1f99edcb6288ee11b815fb1a4b049eaa2114d369b" +checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" [[package]] name = "libloading" @@ -410,9 +410,9 @@ checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" [[package]] name = "wasmtime-jit-icache-coherence" -version = "17.0.0" +version = "18.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bdc26415bb89e9ccd3bdc498fef63aabf665c4c0dd710c107691deb9694955da" +checksum = "33f4121cb29dda08139b2824a734dd095d83ce843f2d613a84eb580b9cfc17ac" dependencies = [ "cfg-if", "libc", diff --git a/Cargo.toml b/Cargo.toml index 586ce2286f97..c0b9e27b179d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,12 +8,12 @@ crate-type = ["dylib"] [dependencies] # These have to be in sync with each other -cranelift-codegen = { version = "0.104", default-features = false, features = ["std", "unwind", "all-arch"] } -cranelift-frontend = { version = "0.104" } -cranelift-module = { version = "0.104" } -cranelift-native = { version = "0.104" } -cranelift-jit = { version = "0.104", optional = true } -cranelift-object = { version = "0.104" } +cranelift-codegen = { version = "0.105.2", default-features = false, features = ["std", "unwind", "all-arch"] } +cranelift-frontend = { version = "0.105.2" } +cranelift-module = { version = "0.105.2" } +cranelift-native = { version = "0.105.2" } +cranelift-jit = { version = "0.105.2", optional = true } +cranelift-object = { version = "0.105.2" } target-lexicon = "0.12.0" gimli = { version = "0.28", default-features = false, features = ["write"]} object = { version = "0.32", default-features = false, features = ["std", "read_core", "write", "archive", "coff", "elf", "macho", "pe"] } diff --git a/Readme.md b/Readme.md index 4f4552619639..a297b22326f3 100644 --- a/Readme.md +++ b/Readme.md @@ -123,11 +123,6 @@ You need to do this steps to successfully compile and use the cranelift backend You can also set `rust-analyzer.rustc.source` to your rust workspace to get rust-analyzer to understand your changes. -## Configuration - -See the documentation on the `BackendConfig` struct in [config.rs](src/config.rs) for all -configuration options. - ## Not yet supported * SIMD ([tracked here](https://github.com/rust-lang/rustc_codegen_cranelift/issues/171), `std::simd` fully works, `std::arch` is partially supported) diff --git a/build_system/prepare.rs b/build_system/prepare.rs index c68968b4fde2..3677d0a7d360 100644 --- a/build_system/prepare.rs +++ b/build_system/prepare.rs @@ -1,5 +1,6 @@ use std::ffi::OsStr; use std::fs; +use std::hash::{Hash, Hasher}; use std::path::{Path, PathBuf}; use std::process::Command; @@ -71,7 +72,11 @@ fn hash_file(file: &std::path::Path) -> u64 { let contents = std::fs::read(file).unwrap(); #[allow(deprecated)] let mut hasher = std::hash::SipHasher::new(); - std::hash::Hash::hash(&contents, &mut hasher); + // The following is equivalent to + // std::hash::Hash::hash(&contents, &mut hasher); + // but gives the same result independent of host byte order. + hasher.write_usize(contents.len().to_le()); + Hash::hash_slice(&contents, &mut hasher); std::hash::Hasher::finish(&hasher) } @@ -80,16 +85,26 @@ fn hash_dir(dir: &std::path::Path) -> u64 { for entry in std::fs::read_dir(dir).unwrap() { let entry = entry.unwrap(); if entry.file_type().unwrap().is_dir() { - sub_hashes - .insert(entry.file_name().to_str().unwrap().to_owned(), hash_dir(&entry.path())); + sub_hashes.insert( + entry.file_name().to_str().unwrap().to_owned(), + hash_dir(&entry.path()).to_le(), + ); } else { - sub_hashes - .insert(entry.file_name().to_str().unwrap().to_owned(), hash_file(&entry.path())); + sub_hashes.insert( + entry.file_name().to_str().unwrap().to_owned(), + hash_file(&entry.path()).to_le(), + ); } } #[allow(deprecated)] let mut hasher = std::hash::SipHasher::new(); - std::hash::Hash::hash(&sub_hashes, &mut hasher); + // The following is equivalent to + // std::hash::Hash::hash(&sub_hashes, &mut hasher); + // but gives the same result independent of host byte order. + hasher.write_usize(sub_hashes.len().to_le()); + for elt in sub_hashes { + elt.hash(&mut hasher); + } std::hash::Hasher::finish(&hasher) } diff --git a/build_system/tests.rs b/build_system/tests.rs index 818f3d6f08d2..1c3e615c7aba 100644 --- a/build_system/tests.rs +++ b/build_system/tests.rs @@ -133,8 +133,8 @@ pub(crate) static REGEX: CargoProject = CargoProject::new(®EX_REPO.source_dir pub(crate) static PORTABLE_SIMD_REPO: GitRepo = GitRepo::github( "rust-lang", "portable-simd", - "97007cc2e70df8c97326ce896a79e2f0ce4dd98b", - "e54a16035cedf205", + "5794c837bc605c4cd9dbb884285976dfdb293cce", + "a64d8fdd0ed0d9c4", "portable-simd", ); diff --git a/patches/0022-coretests-Disable-not-compiling-tests.patch b/patches/0022-coretests-Disable-not-compiling-tests.patch index 6afa5c71fe51..5442c3cef9ec 100644 --- a/patches/0022-coretests-Disable-not-compiling-tests.patch +++ b/patches/0022-coretests-Disable-not-compiling-tests.patch @@ -39,6 +39,6 @@ index 42a26ae..5ac1042 100644 +#![cfg(test)] #![feature(alloc_layout_extra)] #![feature(array_chunks)] - #![feature(array_methods)] + #![feature(array_windows)] -- 2.21.0 (Apple Git-122) diff --git a/patches/0023-coretests-Ignore-failing-tests.patch b/patches/0023-coretests-Ignore-failing-tests.patch deleted file mode 100644 index 385f5a8a2e03..000000000000 --- a/patches/0023-coretests-Ignore-failing-tests.patch +++ /dev/null @@ -1,26 +0,0 @@ -From dd82e95c9de212524e14fc60155de1ae40156dfc Mon Sep 17 00:00:00 2001 -From: bjorn3 -Date: Sun, 24 Nov 2019 15:34:06 +0100 -Subject: [PATCH] [core] Ignore failing tests - ---- - library/core/tests/iter.rs | 4 ++++ - library/core/tests/num/bignum.rs | 10 ++++++++++ - library/core/tests/num/mod.rs | 5 +++-- - library/core/tests/time.rs | 1 + - 4 files changed, 18 insertions(+), 2 deletions(-) - -diff --git a/atomic.rs b/atomic.rs -index 13b12db..96fe4b9 100644 ---- a/atomic.rs -+++ b/atomic.rs -@@ -185,6 +185,7 @@ fn ptr_bitops() { - } - - #[test] -+#[cfg_attr(target_arch = "s390x", ignore)] // s390x backend doesn't support stack alignment >8 bytes - #[cfg(any(not(target_arch = "arm"), target_os = "linux"))] // Missing intrinsic in compiler-builtins - fn ptr_bitops_tagging() { - #[repr(align(16))] --- -2.21.0 (Apple Git-122) diff --git a/patches/stdlib-lock.toml b/patches/stdlib-lock.toml index ad63b0768d31..369f9c88be11 100644 --- a/patches/stdlib-lock.toml +++ b/patches/stdlib-lock.toml @@ -150,9 +150,9 @@ dependencies = [ [[package]] name = "hermit-abi" -version = "0.3.3" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7" +checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" dependencies = [ "compiler_builtins", "rustc-std-workspace-alloc", @@ -161,9 +161,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.150" +version = "0.2.153" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89d92a4743f9a61002fae18374ed11e7973f530cb3a3255fb354818118b2203c" +checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" dependencies = [ "rustc-std-workspace-core", ] @@ -398,6 +398,7 @@ version = "0.0.0" dependencies = [ "core", "getopts", + "libc", "panic_abort", "panic_unwind", "std", diff --git a/rust-toolchain b/rust-toolchain index ccd7edbc2a91..e9f225b4e9e1 100644 --- a/rust-toolchain +++ b/rust-toolchain @@ -1,3 +1,3 @@ [toolchain] -channel = "nightly-2024-01-26" +channel = "nightly-2024-03-08" components = ["rust-src", "rustc-dev", "llvm-tools"] diff --git a/rustfmt.toml b/rustfmt.toml index 0f884187addd..6f4d4413c25d 100644 --- a/rustfmt.toml +++ b/rustfmt.toml @@ -1,5 +1,4 @@ ignore = [ - "y.rs", "example/gen_block_iterate.rs", # uses edition 2024 ] diff --git a/scripts/test_rustc_tests.sh b/scripts/test_rustc_tests.sh index 636f2875a687..e884577d519d 100755 --- a/scripts/test_rustc_tests.sh +++ b/scripts/test_rustc_tests.sh @@ -10,12 +10,26 @@ pushd rust command -v rg >/dev/null 2>&1 || cargo install ripgrep +# FIXME(rust-lang/rust#122196) fix stage0 rmake.rs run-make tests and remove +# this workaround +for test in $(ls tests/run-make); do + if [[ -e "tests/run-make/$test/rmake.rs" ]]; then + rm -r "tests/run-make/$test" + fi +done + +# FIXME remove this workaround once ICE tests no longer emit an outdated nightly message +for test in $(rg -i --files-with-matches "//@(\[.*\])? failure-status: 101" tests/ui); do + echo "rm $test" + rm $test +done + rm -r tests/ui/{unsized-locals/,lto/,linkage*} || true for test in $(rg --files-with-matches "lto" tests/{codegen-units,ui,incremental}); do rm $test done -for test in $(rg -i --files-with-matches "//(\[\w+\])?~[^\|]*\s*ERR|// error-pattern:|// build-fail|// run-fail|-Cllvm-args" tests/ui); do +for test in $(rg -i --files-with-matches "//(\[\w+\])?~[^\|]*\s*ERR|//@ error-pattern:|//@(\[.*\])? build-fail|//@(\[.*\])? run-fail|-Cllvm-args" tests/ui); do rm $test done @@ -43,8 +57,8 @@ rm tests/ui/proc-macro/allowed-signatures.rs rm tests/ui/proc-macro/no-mangle-in-proc-macro-issue-111888.rs # vendor intrinsics -rm tests/ui/sse2.rs # CodegenBackend::target_features not yet implemented rm tests/ui/simd/array-type.rs # "Index argument for `simd_insert` is not a constant" +rm tests/ui/asm/x86_64/evex512-implicit-feature.rs # unimplemented AVX512 x86 vendor intrinsic # exotic linkages rm tests/ui/issues/issue-33992.rs # unsupported linkages @@ -62,14 +76,12 @@ rm -r tests/run-pass-valgrind/unsized-locals # misc unimplemented things rm tests/ui/intrinsics/intrinsic-nearby.rs # unimplemented nearbyintf32 and nearbyintf64 intrinsics rm tests/ui/target-feature/missing-plusminus.rs # error not implemented -rm tests/ui/fn/dyn-fn-alignment.rs # wants a 256 byte alignment rm -r tests/run-make/emit-named-files # requires full --emit support rm -r tests/run-make/repr128-dwarf # debuginfo test rm -r tests/run-make/split-debuginfo # same rm -r tests/run-make/symbols-include-type-name # --emit=asm not supported rm -r tests/run-make/target-specs # i686 not supported by Cranelift rm -r tests/run-make/mismatching-target-triples # same -rm tests/ui/asm/x86_64/issue-82869.rs # vector regs in inline asm not yet supported rm tests/ui/asm/x86_64/issue-96797.rs # const and sym inline asm operands don't work entirely correctly # requires LTO @@ -109,8 +121,6 @@ rm -r tests/run-make/optimization-remarks-dir # remarks are LLVM specific rm tests/ui/mir/mir_misc_casts.rs # depends on deduplication of constants rm tests/ui/mir/mir_raw_fat_ptr.rs # same rm tests/ui/consts/issue-33537.rs # same -rm tests/ui/layout/valid_range_oob.rs # different ICE message -rm tests/ui/const-generics/generic_const_exprs/issue-80742.rs # gives error instead of ICE with cg_clif # rustdoc-clif passes extra args, suppressing the help message when no args are passed rm -r tests/run-make/issue-88756-default-output @@ -119,15 +129,12 @@ rm -r tests/run-make/issue-88756-default-output # should work when using ./x.py test the way it is intended # ============================================================ rm -r tests/run-make/remap-path-prefix-dwarf # requires llvm-dwarfdump -rm -r tests/ui/consts/missing_span_in_backtrace.rs # expects sysroot source to be elsewhere # genuine bugs # ============ rm tests/incremental/spike-neg1.rs # errors out for some reason rm tests/incremental/spike-neg2.rs # same -rm tests/ui/simd/simd-bitmask.rs # simd_bitmask doesn't implement [u*; N] return type - rm -r tests/run-make/issue-51671 # wrong filename given in case of --emit=obj rm -r tests/run-make/issue-30063 # same rm -r tests/run-make/multiple-emits # same @@ -145,6 +152,7 @@ rm tests/ui/codegen/subtyping-enforces-type-equality.rs # assert_assignable bug # ====================== rm tests/ui/backtrace.rs # TODO warning rm tests/ui/process/nofile-limit.rs # TODO some AArch64 linking issue +rm tests/ui/async-await/async-closures/once.rs # FIXME bug in the rustc FnAbi calculation code rm tests/ui/stdio-is-blocking.rs # really slow with unoptimized libstd diff --git a/src/common.rs b/src/common.rs index e35ec4fe1c74..7e29d407a1fa 100644 --- a/src/common.rs +++ b/src/common.rs @@ -392,18 +392,25 @@ impl<'tcx> FunctionCx<'_, '_, 'tcx> { } pub(crate) fn create_stack_slot(&mut self, size: u32, align: u32) -> Pointer { - if align <= 16 { + let abi_align = if self.tcx.sess.target.arch == "s390x" { 8 } else { 16 }; + if align <= abi_align { let stack_slot = self.bcx.create_sized_stack_slot(StackSlotData { kind: StackSlotKind::ExplicitSlot, - // FIXME Don't force the size to a multiple of 16 bytes once Cranelift gets a way to - // specify stack slot alignment. - size: (size + 15) / 16 * 16, + // FIXME Don't force the size to a multiple of bytes once Cranelift gets + // a way to specify stack slot alignment. + size: (size + abi_align - 1) / abi_align * abi_align, }); Pointer::stack_slot(stack_slot) } else { // Alignment is too big to handle using the above hack. Dynamically realign a stack slot // instead. This wastes some space for the realignment. - let base_ptr = self.create_stack_slot(size + align, 16).get_addr(self); + let stack_slot = self.bcx.create_sized_stack_slot(StackSlotData { + kind: StackSlotKind::ExplicitSlot, + // FIXME Don't force the size to a multiple of bytes once Cranelift gets + // a way to specify stack slot alignment. + size: (size + align) / abi_align * abi_align, + }); + let base_ptr = self.bcx.ins().stack_addr(self.pointer_type, stack_slot, 0); let misalign_offset = self.bcx.ins().urem_imm(base_ptr, i64::from(align)); let realign_offset = self.bcx.ins().irsub_imm(misalign_offset, i64::from(align)); Pointer::new(self.bcx.ins().iadd(base_ptr, realign_offset)) diff --git a/src/constant.rs b/src/constant.rs index b6de688130c7..18c5960ffc68 100644 --- a/src/constant.rs +++ b/src/constant.rs @@ -372,7 +372,13 @@ fn define_all_allocs(tcx: TyCtxt<'_>, module: &mut dyn Module, cx: &mut Constant } let bytes = alloc.inspect_with_uninit_and_ptr_outside_interpreter(0..alloc.len()).to_vec(); - data.define(bytes.into_boxed_slice()); + if bytes.is_empty() { + // FIXME(bytecodealliance/wasmtime#7918) cranelift-jit has a bug where it causes UB on + // empty data objects + data.define(Box::new([0])); + } else { + data.define(bytes.into_boxed_slice()); + } for &(offset, prov) in alloc.provenance().ptrs().iter() { let alloc_id = prov.alloc_id(); diff --git a/src/intrinsics/llvm_x86.rs b/src/intrinsics/llvm_x86.rs index 2e3e7ce986b3..1615dc5de697 100644 --- a/src/intrinsics/llvm_x86.rs +++ b/src/intrinsics/llvm_x86.rs @@ -170,6 +170,65 @@ pub(crate) fn codegen_x86_llvm_intrinsic_call<'tcx>( } } + "llvm.x86.sse.add.ss" => { + // https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_add_ss&ig_expand=171 + intrinsic_args!(fx, args => (a, b); intrinsic); + + assert_eq!(a.layout(), b.layout()); + assert_eq!(a.layout(), ret.layout()); + let layout = a.layout(); + + let (_, lane_ty) = layout.ty.simd_size_and_type(fx.tcx); + assert!(lane_ty.is_floating_point()); + let ret_lane_layout = fx.layout_of(lane_ty); + + ret.write_cvalue(fx, a); + + let a_lane = a.value_lane(fx, 0).load_scalar(fx); + let b_lane = b.value_lane(fx, 0).load_scalar(fx); + + let res = fx.bcx.ins().fadd(a_lane, b_lane); + + let res_lane = CValue::by_val(res, ret_lane_layout); + ret.place_lane(fx, 0).write_cvalue(fx, res_lane); + } + + "llvm.x86.sse.sqrt.ps" => { + // https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_sqrt_ps&ig_expand=6245 + intrinsic_args!(fx, args => (a); intrinsic); + + // FIXME use vector instructions when possible + simd_for_each_lane(fx, a, ret, &|fx, _lane_ty, _res_lane_ty, lane| { + fx.bcx.ins().sqrt(lane) + }); + } + + "llvm.x86.sse.max.ps" => { + // https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_max_ps&ig_expand=4357 + intrinsic_args!(fx, args => (a, b); intrinsic); + + simd_pair_for_each_lane( + fx, + a, + b, + ret, + &|fx, _lane_ty, _res_lane_ty, a_lane, b_lane| fx.bcx.ins().fmax(a_lane, b_lane), + ); + } + + "llvm.x86.sse.min.ps" => { + // https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_min_ps&ig_expand=4489 + intrinsic_args!(fx, args => (a, b); intrinsic); + + simd_pair_for_each_lane( + fx, + a, + b, + ret, + &|fx, _lane_ty, _res_lane_ty, a_lane, b_lane| fx.bcx.ins().fmin(a_lane, b_lane), + ); + } + "llvm.x86.sse.cmp.ps" | "llvm.x86.sse2.cmp.pd" => { let (x, y, kind) = match args { [x, y, kind] => (x, y, kind), @@ -1067,6 +1126,122 @@ pub(crate) fn codegen_x86_llvm_intrinsic_call<'tcx>( ); } + "llvm.x86.sha1rnds4" => { + // https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_sha1rnds4_epu32&ig_expand=5877 + intrinsic_args!(fx, args => (a, b, _func); intrinsic); + + let a = a.load_scalar(fx); + let b = b.load_scalar(fx); + + let func = if let Some(func) = + crate::constant::mir_operand_get_const_val(fx, &args[2].node) + { + func + } else { + fx.tcx + .dcx() + .span_fatal(span, "Func argument for `_mm_sha1rnds4_epu32` is not a constant"); + }; + + let func = func.try_to_u8().unwrap_or_else(|_| panic!("kind not scalar: {:?}", func)); + + codegen_inline_asm_inner( + fx, + &[InlineAsmTemplatePiece::String(format!("sha1rnds4 xmm1, xmm2, {func}"))], + &[ + CInlineAsmOperand::InOut { + reg: InlineAsmRegOrRegClass::Reg(InlineAsmReg::X86(X86InlineAsmReg::xmm1)), + _late: true, + in_value: a, + out_place: Some(ret), + }, + CInlineAsmOperand::In { + reg: InlineAsmRegOrRegClass::Reg(InlineAsmReg::X86(X86InlineAsmReg::xmm2)), + value: b, + }, + ], + InlineAsmOptions::NOSTACK | InlineAsmOptions::PURE | InlineAsmOptions::NOMEM, + ); + } + + "llvm.x86.sha1msg1" => { + // https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_sha1msg1_epu32&ig_expand=5874 + intrinsic_args!(fx, args => (a, b); intrinsic); + + let a = a.load_scalar(fx); + let b = b.load_scalar(fx); + + codegen_inline_asm_inner( + fx, + &[InlineAsmTemplatePiece::String("sha1msg1 xmm1, xmm2".to_string())], + &[ + CInlineAsmOperand::InOut { + reg: InlineAsmRegOrRegClass::Reg(InlineAsmReg::X86(X86InlineAsmReg::xmm1)), + _late: true, + in_value: a, + out_place: Some(ret), + }, + CInlineAsmOperand::In { + reg: InlineAsmRegOrRegClass::Reg(InlineAsmReg::X86(X86InlineAsmReg::xmm2)), + value: b, + }, + ], + InlineAsmOptions::NOSTACK | InlineAsmOptions::PURE | InlineAsmOptions::NOMEM, + ); + } + + "llvm.x86.sha1msg2" => { + // https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_sha1msg2_epu32&ig_expand=5875 + intrinsic_args!(fx, args => (a, b); intrinsic); + + let a = a.load_scalar(fx); + let b = b.load_scalar(fx); + + codegen_inline_asm_inner( + fx, + &[InlineAsmTemplatePiece::String("sha1msg2 xmm1, xmm2".to_string())], + &[ + CInlineAsmOperand::InOut { + reg: InlineAsmRegOrRegClass::Reg(InlineAsmReg::X86(X86InlineAsmReg::xmm1)), + _late: true, + in_value: a, + out_place: Some(ret), + }, + CInlineAsmOperand::In { + reg: InlineAsmRegOrRegClass::Reg(InlineAsmReg::X86(X86InlineAsmReg::xmm2)), + value: b, + }, + ], + InlineAsmOptions::NOSTACK | InlineAsmOptions::PURE | InlineAsmOptions::NOMEM, + ); + } + + "llvm.x86.sha1nexte" => { + // https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_sha1nexte_epu32&ig_expand=5876 + intrinsic_args!(fx, args => (a, b); intrinsic); + + let a = a.load_scalar(fx); + let b = b.load_scalar(fx); + + codegen_inline_asm_inner( + fx, + &[InlineAsmTemplatePiece::String("sha1nexte xmm1, xmm2".to_string())], + &[ + CInlineAsmOperand::InOut { + reg: InlineAsmRegOrRegClass::Reg(InlineAsmReg::X86(X86InlineAsmReg::xmm1)), + _late: true, + in_value: a, + out_place: Some(ret), + }, + CInlineAsmOperand::In { + reg: InlineAsmRegOrRegClass::Reg(InlineAsmReg::X86(X86InlineAsmReg::xmm2)), + value: b, + }, + ], + InlineAsmOptions::NOSTACK | InlineAsmOptions::PURE | InlineAsmOptions::NOMEM, + ); + } + "llvm.x86.sha256rnds2" => { // https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_sha256rnds2_epu32&ig_expand=5977 intrinsic_args!(fx, args => (a, b, k); intrinsic); diff --git a/src/intrinsics/mod.rs b/src/intrinsics/mod.rs index 9b8167fa2bf2..8b86a116df1f 100644 --- a/src/intrinsics/mod.rs +++ b/src/intrinsics/mod.rs @@ -391,12 +391,15 @@ fn codegen_float_intrinsic_call<'tcx>( | sym::ceilf32 | sym::ceilf64 | sym::truncf32 - | sym::truncf64 => { + | sym::truncf64 + | sym::sqrtf32 + | sym::sqrtf64 => { let val = match intrinsic { sym::fabsf32 | sym::fabsf64 => fx.bcx.ins().fabs(args[0]), sym::floorf32 | sym::floorf64 => fx.bcx.ins().floor(args[0]), sym::ceilf32 | sym::ceilf64 => fx.bcx.ins().ceil(args[0]), sym::truncf32 | sym::truncf64 => fx.bcx.ins().trunc(args[0]), + sym::sqrtf32 | sym::sqrtf64 => fx.bcx.ins().sqrt(args[0]), _ => unreachable!(), }; diff --git a/src/intrinsics/simd.rs b/src/intrinsics/simd.rs index 8f662808522b..79da970a58ef 100644 --- a/src/intrinsics/simd.rs +++ b/src/intrinsics/simd.rs @@ -853,7 +853,13 @@ pub(super) fn codegen_simd_intrinsic_call<'tcx>( }; for lane in 0..lane_count { - let m_lane = fx.bcx.ins().ushr_imm(m, u64::from(lane) as i64); + // The bit order of the mask depends on the byte endianness, LSB-first for + // little endian and MSB-first for big endian. + let mask_lane = match fx.tcx.sess.target.endian { + Endian::Big => lane_count - 1 - lane, + Endian::Little => lane, + }; + let m_lane = fx.bcx.ins().ushr_imm(m, u64::from(mask_lane) as i64); let m_lane = fx.bcx.ins().band_imm(m_lane, 1); let a_lane = a.value_lane(fx, lane).load_scalar(fx); let b_lane = b.value_lane(fx, lane).load_scalar(fx); diff --git a/y.rs b/y.rs deleted file mode 100755 index e806a64d9434..000000000000 --- a/y.rs +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env bash -#![deny(unsafe_code)] /*This line is ignored by bash -# This block is ignored by rustc -echo "Warning: y.rs is a deprecated alias for y.sh" 1>&2 -exec ./y.sh "$@" -*/ From 127c232050df04a4ae06fc536a428c34e248c5d9 Mon Sep 17 00:00:00 2001 From: Ben Kimock Date: Mon, 26 Feb 2024 21:25:27 -0500 Subject: [PATCH 009/103] Distinguish between library and lang UB in assert_unsafe_precondition --- src/base.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/base.rs b/src/base.rs index 1ce920f3bdb7..2415c2c90b22 100644 --- a/src/base.rs +++ b/src/base.rs @@ -779,7 +779,7 @@ fn codegen_stmt<'tcx>( NullOp::OffsetOf(fields) => { layout.offset_of_subfield(fx, fields.iter()).bytes() } - NullOp::DebugAssertions => { + NullOp::UbCheck(_) => { let val = fx.tcx.sess.opts.debug_assertions; let val = CValue::by_val( fx.bcx.ins().iconst(types::I8, i64::try_from(val).unwrap()), From f5a192b736e5cac51a91f55872448e498334c745 Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Sat, 9 Mar 2024 16:20:13 +0000 Subject: [PATCH 010/103] Rustup to rustc 1.78.0-nightly (46b180ec2 2024-03-08) --- rust-toolchain | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-toolchain b/rust-toolchain index e9f225b4e9e1..47b565ce0d04 100644 --- a/rust-toolchain +++ b/rust-toolchain @@ -1,3 +1,3 @@ [toolchain] -channel = "nightly-2024-03-08" +channel = "nightly-2024-03-09" components = ["rust-src", "rustc-dev", "llvm-tools"] From e18201decadb238d8eb428f2af862e61015227b9 Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Sat, 9 Mar 2024 17:35:49 +0000 Subject: [PATCH 011/103] Fix rustc test suite --- scripts/test_rustc_tests.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/test_rustc_tests.sh b/scripts/test_rustc_tests.sh index e884577d519d..f39487913c12 100755 --- a/scripts/test_rustc_tests.sh +++ b/scripts/test_rustc_tests.sh @@ -83,6 +83,7 @@ rm -r tests/run-make/symbols-include-type-name # --emit=asm not supported rm -r tests/run-make/target-specs # i686 not supported by Cranelift rm -r tests/run-make/mismatching-target-triples # same rm tests/ui/asm/x86_64/issue-96797.rs # const and sym inline asm operands don't work entirely correctly +rm tests/ui/asm/x86_64/goto.rs # inline asm labels not supported # requires LTO rm -r tests/run-make/cdylib From 07633821ed63360d4d7464998c29f4f588930a03 Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Sat, 9 Mar 2024 18:42:26 +0000 Subject: [PATCH 012/103] Add bcryptprimitives.dll shim for wine --- .github/workflows/main.yml | 30 +++++++++++++++++++----------- patches/bcryptprimitives.rs | 22 ++++++++++++++++++++++ 2 files changed, 41 insertions(+), 11 deletions(-) create mode 100644 patches/bcryptprimitives.rs diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 5f0f3e6549c9..526871d0c05f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -44,10 +44,9 @@ jobs: env: TARGET_TRIPLE: x86_64-apple-darwin # cross-compile from Linux to Windows using mingw - # FIXME The wine version in Ubuntu 22.04 is missing ProcessPrng - #- os: ubuntu-latest - # env: - # TARGET_TRIPLE: x86_64-pc-windows-gnu + - os: ubuntu-latest + env: + TARGET_TRIPLE: x86_64-pc-windows-gnu - os: ubuntu-latest env: TARGET_TRIPLE: aarch64-unknown-linux-gnu @@ -81,11 +80,11 @@ jobs: if: matrix.os == 'windows-latest' && matrix.env.TARGET_TRIPLE == 'x86_64-pc-windows-gnu' run: rustup set default-host x86_64-pc-windows-gnu - #- name: Install MinGW toolchain and wine - # if: matrix.os == 'ubuntu-latest' && matrix.env.TARGET_TRIPLE == 'x86_64-pc-windows-gnu' - # run: | - # sudo apt-get update - # sudo apt-get install -y gcc-mingw-w64-x86-64 wine-stable + - name: Install MinGW toolchain and wine + if: matrix.os == 'ubuntu-latest' && matrix.env.TARGET_TRIPLE == 'x86_64-pc-windows-gnu' + run: | + sudo apt-get update + sudo apt-get install -y gcc-mingw-w64-x86-64 wine-stable - name: Install AArch64 toolchain and qemu if: matrix.os == 'ubuntu-latest' && matrix.env.TARGET_TRIPLE == 'aarch64-unknown-linux-gnu' @@ -108,6 +107,15 @@ jobs: - name: Prepare dependencies run: ./y.sh prepare + # The Wine version shipped with Ubuntu 22.04 doesn't implement bcryptprimitives.dll + - name: Build bcryptprimitives.dll shim for Wine + if: matrix.os == 'ubuntu-latest' && matrix.env.TARGET_TRIPLE == 'x86_64-pc-windows-gnu' + run: | + rustup target add x86_64-pc-windows-gnu + mkdir wine_shims + rustc patches/bcryptprimitives.rs -Copt-level=3 -Clto=fat --out-dir wine_shims --target x86_64-pc-windows-gnu + echo "WINEPATH=$(pwd)/wine_shims" >> $GITHUB_ENV + - name: Build run: ./y.sh build --sysroot none @@ -234,11 +242,11 @@ jobs: if: matrix.os == 'windows-latest' && matrix.env.TARGET_TRIPLE == 'x86_64-pc-windows-gnu' run: rustup set default-host x86_64-pc-windows-gnu - - name: Install MinGW toolchain and wine + - name: Install MinGW toolchain if: matrix.os == 'ubuntu-latest' && matrix.env.TARGET_TRIPLE == 'x86_64-pc-windows-gnu' run: | sudo apt-get update - sudo apt-get install -y gcc-mingw-w64-x86-64 wine-stable + sudo apt-get install -y gcc-mingw-w64-x86-64 - name: Prepare dependencies run: ./y.sh prepare diff --git a/patches/bcryptprimitives.rs b/patches/bcryptprimitives.rs new file mode 100644 index 000000000000..4d186485aac1 --- /dev/null +++ b/patches/bcryptprimitives.rs @@ -0,0 +1,22 @@ +// Shim for bcryptprimitives.dll. The Wine version shipped with Ubuntu 22.04 +// doesn't support it yet. Authored by @ChrisDenton + +#![crate_type = "cdylib"] +#![allow(nonstandard_style)] + +#[no_mangle] +pub unsafe extern "system" fn ProcessPrng(mut pbData: *mut u8, mut cbData: usize) -> i32 { + while cbData > 0 { + let size = core::cmp::min(cbData, u32::MAX as usize); + RtlGenRandom(pbData, size as u32); + cbData -= size; + pbData = pbData.add(size); + } + 1 +} + +#[link(name = "advapi32")] +extern "system" { + #[link_name = "SystemFunction036"] + pub fn RtlGenRandom(RandomBuffer: *mut u8, RandomBufferLength: u32) -> u8; +} From 7e79dcdc06a2bbd4a1d3250b23dbfc024bf0a86f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Sat, 9 Mar 2024 20:02:47 +0000 Subject: [PATCH 013/103] Drive-by fix string fmt --- compiler/rustc_borrowck/src/diagnostics/mod.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/compiler/rustc_borrowck/src/diagnostics/mod.rs b/compiler/rustc_borrowck/src/diagnostics/mod.rs index 560928d39414..4ebbe592628a 100644 --- a/compiler/rustc_borrowck/src/diagnostics/mod.rs +++ b/compiler/rustc_borrowck/src/diagnostics/mod.rs @@ -1226,20 +1226,20 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> { { let msg = match &errors[..] { [] => "you can `clone` the value and consume it, but this \ - might not be your desired behavior" + might not be your desired behavior" .to_string(), [error] => { format!( - "you could `clone` the value and consume it, if \ - the `{}` trait bound could be satisfied", + "you could `clone` the value and consume it, if the \ + `{}` trait bound could be satisfied", error.obligation.predicate, ) } [errors @ .., last] => { format!( - "you could `clone` the value and consume it, if \ - the following trait bounds could be satisfied: {} \ - and `{}`", + "you could `clone` the value and consume it, if the \ + following trait bounds could be satisfied: \ + {} and `{}`", errors .iter() .map(|e| format!("`{}`", e.obligation.predicate)) From f25809d2d33e1141d73487e55fe155f41762aef3 Mon Sep 17 00:00:00 2001 From: onur-ozkan Date: Sun, 10 Mar 2024 09:16:24 +0300 Subject: [PATCH 014/103] fix `long-linker-command-lines` failure caused by `rust.rpath=false` Signed-off-by: onur-ozkan --- tests/run-make/long-linker-command-lines/Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/run-make/long-linker-command-lines/Makefile b/tests/run-make/long-linker-command-lines/Makefile index f864ea74f4a9..b573038e344a 100644 --- a/tests/run-make/long-linker-command-lines/Makefile +++ b/tests/run-make/long-linker-command-lines/Makefile @@ -1,6 +1,8 @@ # ignore-cross-compile include ../tools.mk +export LD_LIBRARY_PATH := $(HOST_RPATH_DIR) + all: $(RUSTC) foo.rs -g -O RUSTC="$(RUSTC_ORIGINAL)" $(call RUN,foo) From 01affeb53a32f2e29bb90ebd3eff4c4c687e6746 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Sun, 10 Mar 2024 11:49:27 +0100 Subject: [PATCH 015/103] use Instance::expect_resolve() instead of unwraping Instance::resolve() --- src/main_shim.rs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/main_shim.rs b/src/main_shim.rs index 6535c3a367b8..1abfded8b11f 100644 --- a/src/main_shim.rs +++ b/src/main_shim.rs @@ -115,14 +115,12 @@ pub(crate) fn maybe_create_entry_wrapper( termination_trait, ) .unwrap(); - let report = Instance::resolve( + let report = Instance::expect_resolve( tcx, ParamEnv::reveal_all(), report.def_id, tcx.mk_args(&[GenericArg::from(main_ret_ty)]), ) - .unwrap() - .unwrap() .polymorphize(tcx); let report_name = tcx.symbol_name(report).name; @@ -142,14 +140,12 @@ pub(crate) fn maybe_create_entry_wrapper( } } else if is_main_fn { let start_def_id = tcx.require_lang_item(LangItem::Start, None); - let start_instance = Instance::resolve( + let start_instance = Instance::expect_resolve( tcx, ParamEnv::reveal_all(), start_def_id, tcx.mk_args(&[main_ret_ty.into()]), ) - .unwrap() - .unwrap() .polymorphize(tcx); let start_func_id = import_function(tcx, m, start_instance); From 2d48a3a7bca119eba5648db12e74142bb93d27ea Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Sat, 2 Mar 2024 01:29:20 +0100 Subject: [PATCH 016/103] Move generic `NonZero` `rustc_layout_scalar_valid_range_start` attribute to inner type. --- library/core/src/num/nonzero.rs | 125 +++++++++++------- .../consts/const-eval/raw-bytes.32bit.stderr | 4 +- .../consts/const-eval/raw-bytes.64bit.stderr | 4 +- tests/ui/consts/const-eval/ub-nonnull.stderr | 4 +- tests/ui/lint/clashing-extern-fn.stderr | 67 +++++++++- tests/ui/lint/invalid_value.stderr | 27 +--- tests/ui/lint/lint-ctypes-enum.stderr | 120 ++++++++++++++++- .../ui/print_type_sizes/niche-filling.stdout | 2 + 8 files changed, 268 insertions(+), 85 deletions(-) diff --git a/library/core/src/num/nonzero.rs b/library/core/src/num/nonzero.rs index 6cbcac20ea1b..b853771b9ea5 100644 --- a/library/core/src/num/nonzero.rs +++ b/library/core/src/num/nonzero.rs @@ -6,21 +6,12 @@ use crate::hash::{Hash, Hasher}; use crate::intrinsics; use crate::marker::StructuralPartialEq; use crate::ops::{BitOr, BitOrAssign, Div, Neg, Rem}; +use crate::ptr; use crate::str::FromStr; use super::from_str_radix; use super::{IntErrorKind, ParseIntError}; -mod private { - #[unstable( - feature = "nonzero_internals", - reason = "implementation detail which may disappear or be replaced at any time", - issue = "none" - )] - #[const_trait] - pub trait Sealed {} -} - /// A marker trait for primitive types which can be zero. /// /// This is an implementation detail for [NonZero]\ which may disappear or be replaced at any time. @@ -34,38 +25,70 @@ mod private { issue = "none" )] #[const_trait] -pub unsafe trait ZeroablePrimitive: Sized + Copy + private::Sealed {} +pub unsafe trait ZeroablePrimitive: Sized + Copy + private::Sealed { + #[doc(hidden)] + type NonZeroInner: Sized + Copy; +} macro_rules! impl_zeroable_primitive { - ($primitive:ty) => { - #[unstable( - feature = "nonzero_internals", - reason = "implementation detail which may disappear or be replaced at any time", - issue = "none" - )] - impl const private::Sealed for $primitive {} + ($($NonZeroInner:ident ( $primitive:ty )),+ $(,)?) => { + mod private { + #[unstable( + feature = "nonzero_internals", + reason = "implementation detail which may disappear or be replaced at any time", + issue = "none" + )] + #[const_trait] + pub trait Sealed {} - #[unstable( - feature = "nonzero_internals", - reason = "implementation detail which may disappear or be replaced at any time", - issue = "none" - )] - unsafe impl const ZeroablePrimitive for $primitive {} + $( + #[derive(Debug, Clone, Copy, PartialEq)] + #[repr(transparent)] + #[rustc_layout_scalar_valid_range_start(1)] + #[rustc_nonnull_optimization_guaranteed] + #[unstable( + feature = "nonzero_internals", + reason = "implementation detail which may disappear or be replaced at any time", + issue = "none" + )] + pub struct $NonZeroInner($primitive); + )+ + } + + $( + #[unstable( + feature = "nonzero_internals", + reason = "implementation detail which may disappear or be replaced at any time", + issue = "none" + )] + impl const private::Sealed for $primitive {} + + #[unstable( + feature = "nonzero_internals", + reason = "implementation detail which may disappear or be replaced at any time", + issue = "none" + )] + unsafe impl const ZeroablePrimitive for $primitive { + type NonZeroInner = private::$NonZeroInner; + } + )+ }; } -impl_zeroable_primitive!(u8); -impl_zeroable_primitive!(u16); -impl_zeroable_primitive!(u32); -impl_zeroable_primitive!(u64); -impl_zeroable_primitive!(u128); -impl_zeroable_primitive!(usize); -impl_zeroable_primitive!(i8); -impl_zeroable_primitive!(i16); -impl_zeroable_primitive!(i32); -impl_zeroable_primitive!(i64); -impl_zeroable_primitive!(i128); -impl_zeroable_primitive!(isize); +impl_zeroable_primitive!( + NonZeroU8Inner(u8), + NonZeroU16Inner(u16), + NonZeroU32Inner(u32), + NonZeroU64Inner(u64), + NonZeroU128Inner(u128), + NonZeroUsizeInner(usize), + NonZeroI8Inner(i8), + NonZeroI16Inner(i16), + NonZeroI32Inner(i32), + NonZeroI64Inner(i64), + NonZeroI128Inner(i128), + NonZeroIsizeInner(isize), +); /// A value that is known not to equal zero. /// @@ -80,10 +103,8 @@ impl_zeroable_primitive!(isize); /// ``` #[unstable(feature = "generic_nonzero", issue = "120257")] #[repr(transparent)] -#[rustc_layout_scalar_valid_range_start(1)] -#[rustc_nonnull_optimization_guaranteed] #[rustc_diagnostic_item = "NonZero"] -pub struct NonZero(T); +pub struct NonZero(T::NonZeroInner); macro_rules! impl_nonzero_fmt { ($Trait:ident) => { @@ -114,8 +135,7 @@ where { #[inline] fn clone(&self) -> Self { - // SAFETY: The contained value is non-zero. - unsafe { Self(self.0) } + Self(self.0) } } @@ -188,19 +208,19 @@ where #[inline] fn max(self, other: Self) -> Self { // SAFETY: The maximum of two non-zero values is still non-zero. - unsafe { Self(self.get().max(other.get())) } + unsafe { Self::new_unchecked(self.get().max(other.get())) } } #[inline] fn min(self, other: Self) -> Self { // SAFETY: The minimum of two non-zero values is still non-zero. - unsafe { Self(self.get().min(other.get())) } + unsafe { Self::new_unchecked(self.get().min(other.get())) } } #[inline] fn clamp(self, min: Self, max: Self) -> Self { // SAFETY: A non-zero value clamped between two non-zero values is still non-zero. - unsafe { Self(self.get().clamp(min.get(), max.get())) } + unsafe { Self::new_unchecked(self.get().clamp(min.get(), max.get())) } } } @@ -240,7 +260,7 @@ where #[inline] fn bitor(self, rhs: Self) -> Self::Output { // SAFETY: Bitwise OR of two non-zero values is still non-zero. - unsafe { Self(self.get() | rhs.get()) } + unsafe { Self::new_unchecked(self.get() | rhs.get()) } } } @@ -254,7 +274,7 @@ where #[inline] fn bitor(self, rhs: T) -> Self::Output { // SAFETY: Bitwise OR of a non-zero value with anything is still non-zero. - unsafe { Self(self.get() | rhs) } + unsafe { Self::new_unchecked(self.get() | rhs) } } } @@ -268,7 +288,7 @@ where #[inline] fn bitor(self, rhs: NonZero) -> Self::Output { // SAFETY: Bitwise OR of anything with a non-zero value is still non-zero. - unsafe { NonZero(self | rhs.get()) } + unsafe { NonZero::new_unchecked(self | rhs.get()) } } } @@ -346,7 +366,7 @@ where pub fn from_mut(n: &mut T) -> Option<&mut Self> { // SAFETY: Memory layout optimization guarantees that `Option>` has // the same layout and size as `T`, with `0` representing `None`. - let opt_n = unsafe { &mut *(n as *mut T as *mut Option) }; + let opt_n = unsafe { &mut *(ptr::from_mut(n).cast::>()) }; opt_n.as_mut() } @@ -390,12 +410,17 @@ where // memory somewhere. If the value of `self` was from by-value argument // of some not-inlined function, LLVM don't have range metadata // to understand that the value cannot be zero. - match Self::new(self.0) { - Some(Self(n)) => n, + // + // SAFETY: `Self` is guaranteed to have the same layout as `Option`. + match unsafe { intrinsics::transmute_unchecked(self) } { None => { // SAFETY: `NonZero` is guaranteed to only contain non-zero values, so this is unreachable. unsafe { intrinsics::unreachable() } } + Some(Self(inner)) => { + // SAFETY: `T::NonZeroInner` is guaranteed to have the same layout as `T`. + unsafe { intrinsics::transmute_unchecked(inner) } + } } } } diff --git a/tests/ui/consts/const-eval/raw-bytes.32bit.stderr b/tests/ui/consts/const-eval/raw-bytes.32bit.stderr index c06c30741164..c1748c2e2376 100644 --- a/tests/ui/consts/const-eval/raw-bytes.32bit.stderr +++ b/tests/ui/consts/const-eval/raw-bytes.32bit.stderr @@ -68,7 +68,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/raw-bytes.rs:59:1 | LL | const NULL_U8: NonZero = unsafe { mem::transmute(0u8) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0, but expected something greater or equal to 1 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered 0, but expected something greater or equal to 1 | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 1, align: 1) { @@ -79,7 +79,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/raw-bytes.rs:61:1 | LL | const NULL_USIZE: NonZero = unsafe { mem::transmute(0usize) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0, but expected something greater or equal to 1 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered 0, but expected something greater or equal to 1 | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 4, align: 4) { diff --git a/tests/ui/consts/const-eval/raw-bytes.64bit.stderr b/tests/ui/consts/const-eval/raw-bytes.64bit.stderr index 0589280524ca..eb97eab9db75 100644 --- a/tests/ui/consts/const-eval/raw-bytes.64bit.stderr +++ b/tests/ui/consts/const-eval/raw-bytes.64bit.stderr @@ -68,7 +68,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/raw-bytes.rs:59:1 | LL | const NULL_U8: NonZero = unsafe { mem::transmute(0u8) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0, but expected something greater or equal to 1 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered 0, but expected something greater or equal to 1 | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 1, align: 1) { @@ -79,7 +79,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/raw-bytes.rs:61:1 | LL | const NULL_USIZE: NonZero = unsafe { mem::transmute(0usize) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0, but expected something greater or equal to 1 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered 0, but expected something greater or equal to 1 | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 8, align: 8) { diff --git a/tests/ui/consts/const-eval/ub-nonnull.stderr b/tests/ui/consts/const-eval/ub-nonnull.stderr index 70b961fe1cd4..ab0fb2abdb30 100644 --- a/tests/ui/consts/const-eval/ub-nonnull.stderr +++ b/tests/ui/consts/const-eval/ub-nonnull.stderr @@ -19,7 +19,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/ub-nonnull.rs:24:1 | LL | const NULL_U8: NonZero = unsafe { mem::transmute(0u8) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0, but expected something greater or equal to 1 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered 0, but expected something greater or equal to 1 | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: $SIZE, align: $ALIGN) { @@ -30,7 +30,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/ub-nonnull.rs:26:1 | LL | const NULL_USIZE: NonZero = unsafe { mem::transmute(0usize) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0, but expected something greater or equal to 1 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered 0, but expected something greater or equal to 1 | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: $SIZE, align: $ALIGN) { diff --git a/tests/ui/lint/clashing-extern-fn.stderr b/tests/ui/lint/clashing-extern-fn.stderr index 86ee789aeb22..22d9b4d76f13 100644 --- a/tests/ui/lint/clashing-extern-fn.stderr +++ b/tests/ui/lint/clashing-extern-fn.stderr @@ -1,3 +1,31 @@ +warning: `extern` block uses type `Option>`, which is not FFI-safe + --> $DIR/clashing-extern-fn.rs:369:43 + | +LL | fn option_non_zero_usize() -> Option>; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe + | + = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum + = note: enum has no representation hint + = note: `#[warn(improper_ctypes)]` on by default + +warning: `extern` block uses type `Option>`, which is not FFI-safe + --> $DIR/clashing-extern-fn.rs:370:43 + | +LL | fn option_non_zero_isize() -> Option>; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe + | + = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum + = note: enum has no representation hint + +warning: `extern` block uses type `Option`, which is not FFI-safe + --> $DIR/clashing-extern-fn.rs:428:46 + | +LL | fn hidden_niche_transparent() -> Option; + | ^^^^^^^^^^^^^^^^^^^ not FFI-safe + | + = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum + = note: enum has no representation hint + warning: `extern` block uses type `Option`, which is not FFI-safe --> $DIR/clashing-extern-fn.rs:430:55 | @@ -6,7 +34,6 @@ LL | fn hidden_niche_transparent_no_niche() -> Option>>`, which is not FFI-safe --> $DIR/clashing-extern-fn.rs:434:46 @@ -178,6 +205,30 @@ LL | fn non_null_ptr() -> *const usize; = note: expected `unsafe extern "C" fn() -> NonNull` found `unsafe extern "C" fn() -> *const usize` +warning: `option_non_zero_usize` redeclared with a different signature + --> $DIR/clashing-extern-fn.rs:369:13 + | +LL | fn option_non_zero_usize() -> usize; + | ----------------------------------- `option_non_zero_usize` previously declared here +... +LL | fn option_non_zero_usize() -> Option>; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration + | + = note: expected `unsafe extern "C" fn() -> usize` + found `unsafe extern "C" fn() -> Option>` + +warning: `option_non_zero_isize` redeclared with a different signature + --> $DIR/clashing-extern-fn.rs:370:13 + | +LL | fn option_non_zero_isize() -> isize; + | ----------------------------------- `option_non_zero_isize` previously declared here +... +LL | fn option_non_zero_isize() -> Option>; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration + | + = note: expected `unsafe extern "C" fn() -> isize` + found `unsafe extern "C" fn() -> Option>` + warning: `option_non_zero_usize_incorrect` redeclared with a different signature --> $DIR/clashing-extern-fn.rs:374:13 | @@ -202,6 +253,18 @@ LL | fn option_non_null_ptr_incorrect() -> *const isize; = note: expected `unsafe extern "C" fn() -> *const usize` found `unsafe extern "C" fn() -> *const isize` +warning: `hidden_niche_transparent` redeclared with a different signature + --> $DIR/clashing-extern-fn.rs:428:13 + | +LL | fn hidden_niche_transparent() -> usize; + | -------------------------------------- `hidden_niche_transparent` previously declared here +... +LL | fn hidden_niche_transparent() -> Option; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration + | + = note: expected `unsafe extern "C" fn() -> usize` + found `unsafe extern "C" fn() -> Option` + warning: `hidden_niche_transparent_no_niche` redeclared with a different signature --> $DIR/clashing-extern-fn.rs:430:13 | @@ -226,5 +289,5 @@ LL | fn hidden_niche_unsafe_cell() -> Option usize` found `unsafe extern "C" fn() -> Option>>` -warning: 19 warnings emitted +warning: 25 warnings emitted diff --git a/tests/ui/lint/invalid_value.stderr b/tests/ui/lint/invalid_value.stderr index 955d01bd5d90..e45d061a1f05 100644 --- a/tests/ui/lint/invalid_value.stderr +++ b/tests/ui/lint/invalid_value.stderr @@ -320,10 +320,7 @@ error: the type `(NonZero, i32)` does not permit zero-initialization --> $DIR/invalid_value.rs:94:41 | LL | let _val: (NonZero, i32) = mem::zeroed(); - | ^^^^^^^^^^^^^ - | | - | this code causes undefined behavior when executed - | help: use `MaybeUninit` instead, and only call `assume_init` after initialization is done + | ^^^^^^^^^^^^^ this code causes undefined behavior when executed | = note: `std::num::NonZero` must be non-null @@ -331,13 +328,9 @@ error: the type `(NonZero, i32)` does not permit being left uninitialized --> $DIR/invalid_value.rs:95:41 | LL | let _val: (NonZero, i32) = mem::uninitialized(); - | ^^^^^^^^^^^^^^^^^^^^ - | | - | this code causes undefined behavior when executed - | help: use `MaybeUninit` instead, and only call `assume_init` after initialization is done + | ^^^^^^^^^^^^^^^^^^^^ this code causes undefined behavior when executed | = note: `std::num::NonZero` must be non-null - = note: integers must be initialized error: the type `*const dyn Send` does not permit zero-initialization --> $DIR/invalid_value.rs:97:37 @@ -411,10 +404,7 @@ error: the type `OneFruitNonZero` does not permit zero-initialization --> $DIR/invalid_value.rs:106:37 | LL | let _val: OneFruitNonZero = mem::zeroed(); - | ^^^^^^^^^^^^^ - | | - | this code causes undefined behavior when executed - | help: use `MaybeUninit` instead, and only call `assume_init` after initialization is done + | ^^^^^^^^^^^^^ this code causes undefined behavior when executed | = note: `OneFruitNonZero` must be non-null note: because `std::num::NonZero` must be non-null (in this field of the only potentially inhabited enum variant) @@ -427,10 +417,7 @@ error: the type `OneFruitNonZero` does not permit being left uninitialized --> $DIR/invalid_value.rs:107:37 | LL | let _val: OneFruitNonZero = mem::uninitialized(); - | ^^^^^^^^^^^^^^^^^^^^ - | | - | this code causes undefined behavior when executed - | help: use `MaybeUninit` instead, and only call `assume_init` after initialization is done + | ^^^^^^^^^^^^^^^^^^^^ this code causes undefined behavior when executed | = note: `OneFruitNonZero` must be non-null note: because `std::num::NonZero` must be non-null (in this field of the only potentially inhabited enum variant) @@ -438,7 +425,6 @@ note: because `std::num::NonZero` must be non-null (in this field of the on | LL | Banana(NonZero), | ^^^^^^^^^^^^ - = note: integers must be initialized error: the type `bool` does not permit being left uninitialized --> $DIR/invalid_value.rs:111:26 @@ -607,10 +593,7 @@ error: the type `NonZero` does not permit zero-initialization --> $DIR/invalid_value.rs:153:34 | LL | let _val: NonZero = mem::transmute(0); - | ^^^^^^^^^^^^^^^^^ - | | - | this code causes undefined behavior when executed - | help: use `MaybeUninit` instead, and only call `assume_init` after initialization is done + | ^^^^^^^^^^^^^^^^^ this code causes undefined behavior when executed | = note: `std::num::NonZero` must be non-null diff --git a/tests/ui/lint/lint-ctypes-enum.stderr b/tests/ui/lint/lint-ctypes-enum.stderr index 48be3eb5a563..b1bacbeceda2 100644 --- a/tests/ui/lint/lint-ctypes-enum.stderr +++ b/tests/ui/lint/lint-ctypes-enum.stderr @@ -45,21 +45,131 @@ note: the type is defined here LL | enum T { | ^^^^^^ -error: `extern` block uses type `u128`, which is not FFI-safe +error: `extern` block uses type `Option>`, which is not FFI-safe + --> $DIR/lint-ctypes-enum.rs:71:21 + | +LL | fn nonzero_u8(x: Option>); + | ^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe + | + = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum + = note: enum has no representation hint + +error: `extern` block uses type `Option>`, which is not FFI-safe + --> $DIR/lint-ctypes-enum.rs:72:22 + | +LL | fn nonzero_u16(x: Option>); + | ^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe + | + = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum + = note: enum has no representation hint + +error: `extern` block uses type `Option>`, which is not FFI-safe + --> $DIR/lint-ctypes-enum.rs:73:22 + | +LL | fn nonzero_u32(x: Option>); + | ^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe + | + = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum + = note: enum has no representation hint + +error: `extern` block uses type `Option>`, which is not FFI-safe + --> $DIR/lint-ctypes-enum.rs:74:22 + | +LL | fn nonzero_u64(x: Option>); + | ^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe + | + = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum + = note: enum has no representation hint + +error: `extern` block uses type `Option>`, which is not FFI-safe --> $DIR/lint-ctypes-enum.rs:75:23 | LL | fn nonzero_u128(x: Option>); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe | - = note: 128-bit integers don't currently have a known stable ABI + = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum + = note: enum has no representation hint -error: `extern` block uses type `i128`, which is not FFI-safe +error: `extern` block uses type `Option>`, which is not FFI-safe + --> $DIR/lint-ctypes-enum.rs:77:24 + | +LL | fn nonzero_usize(x: Option>); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe + | + = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum + = note: enum has no representation hint + +error: `extern` block uses type `Option>`, which is not FFI-safe + --> $DIR/lint-ctypes-enum.rs:78:21 + | +LL | fn nonzero_i8(x: Option>); + | ^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe + | + = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum + = note: enum has no representation hint + +error: `extern` block uses type `Option>`, which is not FFI-safe + --> $DIR/lint-ctypes-enum.rs:79:22 + | +LL | fn nonzero_i16(x: Option>); + | ^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe + | + = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum + = note: enum has no representation hint + +error: `extern` block uses type `Option>`, which is not FFI-safe + --> $DIR/lint-ctypes-enum.rs:80:22 + | +LL | fn nonzero_i32(x: Option>); + | ^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe + | + = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum + = note: enum has no representation hint + +error: `extern` block uses type `Option>`, which is not FFI-safe + --> $DIR/lint-ctypes-enum.rs:81:22 + | +LL | fn nonzero_i64(x: Option>); + | ^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe + | + = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum + = note: enum has no representation hint + +error: `extern` block uses type `Option>`, which is not FFI-safe --> $DIR/lint-ctypes-enum.rs:82:23 | LL | fn nonzero_i128(x: Option>); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe | - = note: 128-bit integers don't currently have a known stable ABI + = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum + = note: enum has no representation hint + +error: `extern` block uses type `Option>`, which is not FFI-safe + --> $DIR/lint-ctypes-enum.rs:84:24 + | +LL | fn nonzero_isize(x: Option>); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe + | + = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum + = note: enum has no representation hint + +error: `extern` block uses type `Option>>`, which is not FFI-safe + --> $DIR/lint-ctypes-enum.rs:85:29 + | +LL | fn transparent_struct(x: Option>>); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe + | + = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum + = note: enum has no representation hint + +error: `extern` block uses type `Option>>`, which is not FFI-safe + --> $DIR/lint-ctypes-enum.rs:86:27 + | +LL | fn transparent_enum(x: Option>>); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe + | + = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum + = note: enum has no representation hint error: `extern` block uses type `Option>>`, which is not FFI-safe --> $DIR/lint-ctypes-enum.rs:87:28 @@ -88,5 +198,5 @@ LL | fn no_result(x: Result<(), num::NonZero>); = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum = note: enum has no representation hint -error: aborting due to 8 previous errors +error: aborting due to 20 previous errors diff --git a/tests/ui/print_type_sizes/niche-filling.stdout b/tests/ui/print_type_sizes/niche-filling.stdout index 53a58ccc4eef..eeb5de532412 100644 --- a/tests/ui/print_type_sizes/niche-filling.stdout +++ b/tests/ui/print_type_sizes/niche-filling.stdout @@ -68,6 +68,8 @@ print-type-size type: `Union2, u32>`: 4 bytes, alignment: print-type-size variant `Union2`: 4 bytes print-type-size field `.a`: 4 bytes print-type-size field `.b`: 4 bytes, offset: 0 bytes, alignment: 4 bytes +print-type-size type: `core::num::nonzero::private::NonZeroU32Inner`: 4 bytes, alignment: 4 bytes +print-type-size field `.0`: 4 bytes print-type-size type: `std::num::NonZero`: 4 bytes, alignment: 4 bytes print-type-size field `.0`: 4 bytes print-type-size type: `std::option::Option>`: 4 bytes, alignment: 4 bytes From 85dfb479df1eba4efe2aa8823de169648cc5b439 Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Sat, 2 Mar 2024 15:25:00 +0100 Subject: [PATCH 017/103] Fix lint. --- compiler/rustc_lint/src/types.rs | 44 +++++---- library/core/src/num/nonzero.rs | 1 + tests/ui/lint/clashing-extern-fn.stderr | 67 +------------ tests/ui/lint/lint-ctypes-enum.stderr | 120 +----------------------- 4 files changed, 35 insertions(+), 197 deletions(-) diff --git a/compiler/rustc_lint/src/types.rs b/compiler/rustc_lint/src/types.rs index 5d36a8b3d0e9..500efefbb119 100644 --- a/compiler/rustc_lint/src/types.rs +++ b/compiler/rustc_lint/src/types.rs @@ -984,7 +984,14 @@ pub fn transparent_newtype_field<'a, 'tcx>( } /// Is type known to be non-null? -fn ty_is_known_nonnull<'tcx>(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>, mode: CItemKind) -> bool { +fn ty_is_known_nonnull<'tcx>( + tcx: TyCtxt<'tcx>, + param_env: ty::ParamEnv<'tcx>, + ty: Ty<'tcx>, + mode: CItemKind, +) -> bool { + let ty = tcx.try_normalize_erasing_regions(param_env, ty).unwrap_or(ty); + match ty.kind() { ty::FnPtr(_) => true, ty::Ref(..) => true, @@ -1004,7 +1011,7 @@ fn ty_is_known_nonnull<'tcx>(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>, mode: CItemKind) - def.variants() .iter() .filter_map(|variant| transparent_newtype_field(tcx, variant)) - .any(|field| ty_is_known_nonnull(tcx, field.ty(tcx, args), mode)) + .any(|field| ty_is_known_nonnull(tcx, param_env, field.ty(tcx, args), mode)) } _ => false, } @@ -1012,7 +1019,13 @@ fn ty_is_known_nonnull<'tcx>(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>, mode: CItemKind) - /// Given a non-null scalar (or transparent) type `ty`, return the nullable version of that type. /// If the type passed in was not scalar, returns None. -fn get_nullable_type<'tcx>(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>) -> Option> { +fn get_nullable_type<'tcx>( + tcx: TyCtxt<'tcx>, + param_env: ty::ParamEnv<'tcx>, + ty: Ty<'tcx>, +) -> Option> { + let ty = tcx.try_normalize_erasing_regions(param_env, ty).unwrap_or(ty); + Some(match *ty.kind() { ty::Adt(field_def, field_args) => { let inner_field_ty = { @@ -1028,22 +1041,19 @@ fn get_nullable_type<'tcx>(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>) -> Option> .expect("No non-zst fields in transparent type.") .ty(tcx, field_args) }; - return get_nullable_type(tcx, inner_field_ty); + return get_nullable_type(tcx, param_env, inner_field_ty); } ty::Int(ty) => Ty::new_int(tcx, ty), ty::Uint(ty) => Ty::new_uint(tcx, ty), ty::RawPtr(ty_mut) => Ty::new_ptr(tcx, ty_mut), // As these types are always non-null, the nullable equivalent of - // Option of these types are their raw pointer counterparts. + // `Option` of these types are their raw pointer counterparts. ty::Ref(_region, ty, mutbl) => Ty::new_ptr(tcx, ty::TypeAndMut { ty, mutbl }), - ty::FnPtr(..) => { - // There is no nullable equivalent for Rust's function pointers -- you - // must use an Option _> to represent it. - ty - } - - // We should only ever reach this case if ty_is_known_nonnull is extended - // to other types. + // There is no nullable equivalent for Rust's function pointers, + // you must use an `Option _>` to represent it. + ty::FnPtr(..) => ty, + // We should only ever reach this case if `ty_is_known_nonnull` is + // extended to other types. ref unhandled => { debug!( "get_nullable_type: Unhandled scalar kind: {:?} while checking {:?}", @@ -1056,7 +1066,7 @@ fn get_nullable_type<'tcx>(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>) -> Option> /// Check if this enum can be safely exported based on the "nullable pointer optimization". If it /// can, return the type that `ty` can be safely converted to, otherwise return `None`. -/// Currently restricted to function pointers, boxes, references, `core::num::NonZero*`, +/// Currently restricted to function pointers, boxes, references, `core::num::NonZero`, /// `core::ptr::NonNull`, and `#[repr(transparent)]` newtypes. /// FIXME: This duplicates code in codegen. pub(crate) fn repr_nullable_ptr<'tcx>( @@ -1075,7 +1085,7 @@ pub(crate) fn repr_nullable_ptr<'tcx>( _ => return None, }; - if !ty_is_known_nonnull(tcx, field_ty, ckind) { + if !ty_is_known_nonnull(tcx, param_env, field_ty, ckind) { return None; } @@ -1099,10 +1109,10 @@ pub(crate) fn repr_nullable_ptr<'tcx>( WrappingRange { start: 0, end } if end == field_ty_scalar.size(&tcx).unsigned_int_max() - 1 => { - return Some(get_nullable_type(tcx, field_ty).unwrap()); + return Some(get_nullable_type(tcx, param_env, field_ty).unwrap()); } WrappingRange { start: 1, .. } => { - return Some(get_nullable_type(tcx, field_ty).unwrap()); + return Some(get_nullable_type(tcx, param_env, field_ty).unwrap()); } WrappingRange { start, end } => { unreachable!("Unhandled start and end range: ({}, {})", start, end) diff --git a/library/core/src/num/nonzero.rs b/library/core/src/num/nonzero.rs index b853771b9ea5..89d2b4f7dc1d 100644 --- a/library/core/src/num/nonzero.rs +++ b/library/core/src/num/nonzero.rs @@ -103,6 +103,7 @@ impl_zeroable_primitive!( /// ``` #[unstable(feature = "generic_nonzero", issue = "120257")] #[repr(transparent)] +#[rustc_nonnull_optimization_guaranteed] #[rustc_diagnostic_item = "NonZero"] pub struct NonZero(T::NonZeroInner); diff --git a/tests/ui/lint/clashing-extern-fn.stderr b/tests/ui/lint/clashing-extern-fn.stderr index 22d9b4d76f13..86ee789aeb22 100644 --- a/tests/ui/lint/clashing-extern-fn.stderr +++ b/tests/ui/lint/clashing-extern-fn.stderr @@ -1,31 +1,3 @@ -warning: `extern` block uses type `Option>`, which is not FFI-safe - --> $DIR/clashing-extern-fn.rs:369:43 - | -LL | fn option_non_zero_usize() -> Option>; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe - | - = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum - = note: enum has no representation hint - = note: `#[warn(improper_ctypes)]` on by default - -warning: `extern` block uses type `Option>`, which is not FFI-safe - --> $DIR/clashing-extern-fn.rs:370:43 - | -LL | fn option_non_zero_isize() -> Option>; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe - | - = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum - = note: enum has no representation hint - -warning: `extern` block uses type `Option`, which is not FFI-safe - --> $DIR/clashing-extern-fn.rs:428:46 - | -LL | fn hidden_niche_transparent() -> Option; - | ^^^^^^^^^^^^^^^^^^^ not FFI-safe - | - = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum - = note: enum has no representation hint - warning: `extern` block uses type `Option`, which is not FFI-safe --> $DIR/clashing-extern-fn.rs:430:55 | @@ -34,6 +6,7 @@ LL | fn hidden_niche_transparent_no_niche() -> Option>>`, which is not FFI-safe --> $DIR/clashing-extern-fn.rs:434:46 @@ -205,30 +178,6 @@ LL | fn non_null_ptr() -> *const usize; = note: expected `unsafe extern "C" fn() -> NonNull` found `unsafe extern "C" fn() -> *const usize` -warning: `option_non_zero_usize` redeclared with a different signature - --> $DIR/clashing-extern-fn.rs:369:13 - | -LL | fn option_non_zero_usize() -> usize; - | ----------------------------------- `option_non_zero_usize` previously declared here -... -LL | fn option_non_zero_usize() -> Option>; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration - | - = note: expected `unsafe extern "C" fn() -> usize` - found `unsafe extern "C" fn() -> Option>` - -warning: `option_non_zero_isize` redeclared with a different signature - --> $DIR/clashing-extern-fn.rs:370:13 - | -LL | fn option_non_zero_isize() -> isize; - | ----------------------------------- `option_non_zero_isize` previously declared here -... -LL | fn option_non_zero_isize() -> Option>; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration - | - = note: expected `unsafe extern "C" fn() -> isize` - found `unsafe extern "C" fn() -> Option>` - warning: `option_non_zero_usize_incorrect` redeclared with a different signature --> $DIR/clashing-extern-fn.rs:374:13 | @@ -253,18 +202,6 @@ LL | fn option_non_null_ptr_incorrect() -> *const isize; = note: expected `unsafe extern "C" fn() -> *const usize` found `unsafe extern "C" fn() -> *const isize` -warning: `hidden_niche_transparent` redeclared with a different signature - --> $DIR/clashing-extern-fn.rs:428:13 - | -LL | fn hidden_niche_transparent() -> usize; - | -------------------------------------- `hidden_niche_transparent` previously declared here -... -LL | fn hidden_niche_transparent() -> Option; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration - | - = note: expected `unsafe extern "C" fn() -> usize` - found `unsafe extern "C" fn() -> Option` - warning: `hidden_niche_transparent_no_niche` redeclared with a different signature --> $DIR/clashing-extern-fn.rs:430:13 | @@ -289,5 +226,5 @@ LL | fn hidden_niche_unsafe_cell() -> Option usize` found `unsafe extern "C" fn() -> Option>>` -warning: 25 warnings emitted +warning: 19 warnings emitted diff --git a/tests/ui/lint/lint-ctypes-enum.stderr b/tests/ui/lint/lint-ctypes-enum.stderr index b1bacbeceda2..48be3eb5a563 100644 --- a/tests/ui/lint/lint-ctypes-enum.stderr +++ b/tests/ui/lint/lint-ctypes-enum.stderr @@ -45,131 +45,21 @@ note: the type is defined here LL | enum T { | ^^^^^^ -error: `extern` block uses type `Option>`, which is not FFI-safe - --> $DIR/lint-ctypes-enum.rs:71:21 - | -LL | fn nonzero_u8(x: Option>); - | ^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe - | - = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum - = note: enum has no representation hint - -error: `extern` block uses type `Option>`, which is not FFI-safe - --> $DIR/lint-ctypes-enum.rs:72:22 - | -LL | fn nonzero_u16(x: Option>); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe - | - = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum - = note: enum has no representation hint - -error: `extern` block uses type `Option>`, which is not FFI-safe - --> $DIR/lint-ctypes-enum.rs:73:22 - | -LL | fn nonzero_u32(x: Option>); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe - | - = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum - = note: enum has no representation hint - -error: `extern` block uses type `Option>`, which is not FFI-safe - --> $DIR/lint-ctypes-enum.rs:74:22 - | -LL | fn nonzero_u64(x: Option>); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe - | - = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum - = note: enum has no representation hint - -error: `extern` block uses type `Option>`, which is not FFI-safe +error: `extern` block uses type `u128`, which is not FFI-safe --> $DIR/lint-ctypes-enum.rs:75:23 | LL | fn nonzero_u128(x: Option>); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe | - = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum - = note: enum has no representation hint + = note: 128-bit integers don't currently have a known stable ABI -error: `extern` block uses type `Option>`, which is not FFI-safe - --> $DIR/lint-ctypes-enum.rs:77:24 - | -LL | fn nonzero_usize(x: Option>); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe - | - = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum - = note: enum has no representation hint - -error: `extern` block uses type `Option>`, which is not FFI-safe - --> $DIR/lint-ctypes-enum.rs:78:21 - | -LL | fn nonzero_i8(x: Option>); - | ^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe - | - = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum - = note: enum has no representation hint - -error: `extern` block uses type `Option>`, which is not FFI-safe - --> $DIR/lint-ctypes-enum.rs:79:22 - | -LL | fn nonzero_i16(x: Option>); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe - | - = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum - = note: enum has no representation hint - -error: `extern` block uses type `Option>`, which is not FFI-safe - --> $DIR/lint-ctypes-enum.rs:80:22 - | -LL | fn nonzero_i32(x: Option>); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe - | - = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum - = note: enum has no representation hint - -error: `extern` block uses type `Option>`, which is not FFI-safe - --> $DIR/lint-ctypes-enum.rs:81:22 - | -LL | fn nonzero_i64(x: Option>); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe - | - = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum - = note: enum has no representation hint - -error: `extern` block uses type `Option>`, which is not FFI-safe +error: `extern` block uses type `i128`, which is not FFI-safe --> $DIR/lint-ctypes-enum.rs:82:23 | LL | fn nonzero_i128(x: Option>); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe | - = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum - = note: enum has no representation hint - -error: `extern` block uses type `Option>`, which is not FFI-safe - --> $DIR/lint-ctypes-enum.rs:84:24 - | -LL | fn nonzero_isize(x: Option>); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe - | - = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum - = note: enum has no representation hint - -error: `extern` block uses type `Option>>`, which is not FFI-safe - --> $DIR/lint-ctypes-enum.rs:85:29 - | -LL | fn transparent_struct(x: Option>>); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe - | - = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum - = note: enum has no representation hint - -error: `extern` block uses type `Option>>`, which is not FFI-safe - --> $DIR/lint-ctypes-enum.rs:86:27 - | -LL | fn transparent_enum(x: Option>>); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe - | - = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum - = note: enum has no representation hint + = note: 128-bit integers don't currently have a known stable ABI error: `extern` block uses type `Option>>`, which is not FFI-safe --> $DIR/lint-ctypes-enum.rs:87:28 @@ -198,5 +88,5 @@ LL | fn no_result(x: Result<(), num::NonZero>); = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum = note: enum has no representation hint -error: aborting due to 20 previous errors +error: aborting due to 8 previous errors From b5c11d1e381fa855b03a5ea2d3a6aa74f8972fea Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Sat, 2 Mar 2024 18:37:17 +0100 Subject: [PATCH 018/103] Fix `miri` tests. --- .../tests/fail/validity/cast_fn_ptr_invalid_callee_ret.stderr | 4 ++-- .../tests/fail/validity/cast_fn_ptr_invalid_caller_arg.stderr | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/tools/miri/tests/fail/validity/cast_fn_ptr_invalid_callee_ret.stderr b/src/tools/miri/tests/fail/validity/cast_fn_ptr_invalid_callee_ret.stderr index 7d481940acec..35de45352225 100644 --- a/src/tools/miri/tests/fail/validity/cast_fn_ptr_invalid_callee_ret.stderr +++ b/src/tools/miri/tests/fail/validity/cast_fn_ptr_invalid_callee_ret.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: constructing invalid value: encountered 0, but expected something greater or equal to 1 +error: Undefined Behavior: constructing invalid value at .0: encountered 0, but expected something greater or equal to 1 --> $DIR/cast_fn_ptr_invalid_callee_ret.rs:LL:CC | LL | f(); - | ^^^ constructing invalid value: encountered 0, but expected something greater or equal to 1 + | ^^^ constructing invalid value at .0: encountered 0, but expected something greater or equal to 1 | = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information diff --git a/src/tools/miri/tests/fail/validity/cast_fn_ptr_invalid_caller_arg.stderr b/src/tools/miri/tests/fail/validity/cast_fn_ptr_invalid_caller_arg.stderr index b1a2bd2c79a4..81d775f6d7f5 100644 --- a/src/tools/miri/tests/fail/validity/cast_fn_ptr_invalid_caller_arg.stderr +++ b/src/tools/miri/tests/fail/validity/cast_fn_ptr_invalid_caller_arg.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: constructing invalid value: encountered 0, but expected something greater or equal to 1 +error: Undefined Behavior: constructing invalid value at .0: encountered 0, but expected something greater or equal to 1 --> $DIR/cast_fn_ptr_invalid_caller_arg.rs:LL:CC | LL | Call(_res = f(*ptr), ReturnTo(retblock), UnwindContinue()) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0, but expected something greater or equal to 1 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered 0, but expected something greater or equal to 1 | = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information From fe7be63daed8ddce4fc1cf7ba65cb5fb3b27ca75 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Sun, 10 Mar 2024 12:39:53 +0100 Subject: [PATCH 019/103] add comments explaining where post-mono const eval errors abort compilation --- src/constant.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/constant.rs b/src/constant.rs index 18c5960ffc68..cec479218b71 100644 --- a/src/constant.rs +++ b/src/constant.rs @@ -71,7 +71,7 @@ pub(crate) fn eval_mir_constant<'tcx>( // This cannot fail because we checked all required_consts in advance. let val = cv .eval(fx.tcx, ty::ParamEnv::reveal_all(), Some(constant.span)) - .expect("erroneous constant not captured by required_consts"); + .expect("erroneous constant missed by mono item collection"); (val, cv.ty()) } From 2f84c7610f41fd6f1b448b947e9643ca7b513649 Mon Sep 17 00:00:00 2001 From: WANG Rui Date: Mon, 11 Mar 2024 11:28:34 +0800 Subject: [PATCH 020/103] configure.py: add flag for loongarch64 musl-root --- src/bootstrap/configure.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/bootstrap/configure.py b/src/bootstrap/configure.py index 4257c0f7991a..fa4663190620 100755 --- a/src/bootstrap/configure.py +++ b/src/bootstrap/configure.py @@ -130,6 +130,8 @@ v("musl-root-riscv32gc", "target.riscv32gc-unknown-linux-musl.musl-root", "riscv32gc-unknown-linux-musl install directory") v("musl-root-riscv64gc", "target.riscv64gc-unknown-linux-musl.musl-root", "riscv64gc-unknown-linux-musl install directory") +v("musl-root-loongarch64", "target.loongarch64-unknown-linux-musl.musl-root", + "loongarch64-unknown-linux-musl install directory") v("qemu-armhf-rootfs", "target.arm-unknown-linux-gnueabihf.qemu-rootfs", "rootfs in qemu testing, you probably don't want to use this") v("qemu-aarch64-rootfs", "target.aarch64-unknown-linux-gnu.qemu-rootfs", From 494ce1e22471454808c730680a4661719cc4c9dd Mon Sep 17 00:00:00 2001 From: onur-ozkan Date: Tue, 12 Mar 2024 11:34:14 +0300 Subject: [PATCH 021/103] prevent notifying the same changes more than once Signed-off-by: onur-ozkan --- src/bootstrap/src/bin/main.rs | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/bootstrap/src/bin/main.rs b/src/bootstrap/src/bin/main.rs index 070d951dba99..98495f25bc66 100644 --- a/src/bootstrap/src/bin/main.rs +++ b/src/bootstrap/src/bin/main.rs @@ -7,6 +7,7 @@ use std::io::Write; use std::process; +use std::str::FromStr; use std::{ env, fs::{self, OpenOptions}, @@ -136,16 +137,25 @@ fn check_version(config: &Config) -> Option { let latest_change_id = CONFIG_CHANGE_HISTORY.last().unwrap().change_id; let warned_id_path = config.out.join("bootstrap").join(".last-warned-change-id"); - if let Some(id) = config.change_id { + if let Some(mut id) = config.change_id { if id == latest_change_id { return None; } - if let Ok(last_warned_id) = fs::read_to_string(&warned_id_path) { - if latest_change_id.to_string() == last_warned_id { - return None; + // Always try to use `change-id` from .last-warned-change-id first. If it doesn't exist, + // then use the one from the config.toml. This way we never show the same warnings + // more than once. + if let Ok(t) = fs::read_to_string(&warned_id_path) { + let last_warned_id = + usize::from_str(&t).expect(&format!("{} is corrupted.", warned_id_path.display())); + + // We only use the last_warned_id if it exists in `CONFIG_CHANGE_HISTORY`. + // Otherwise, we may retrieve all the changes if it's not the highest value. + // For better understanding, refer to `change_tracker::find_recent_config_change_ids`. + if CONFIG_CHANGE_HISTORY.iter().any(|config| config.change_id == last_warned_id) { + id = last_warned_id; } - } + }; let changes = find_recent_config_change_ids(id); From b25203e30f4c418c41cf09fd22906dc596e02ad2 Mon Sep 17 00:00:00 2001 From: Chris Denton Date: Sun, 3 Mar 2024 14:44:58 +0000 Subject: [PATCH 022/103] Bump windows-bindgen to 0.54.0 --- Cargo.lock | 10 +-- .../std/src/sys/pal/windows/c/windows_sys.rs | 62 +++++++++---------- src/tools/generate-windows-sys/Cargo.toml | 2 +- 3 files changed, 38 insertions(+), 36 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 16aed3dc49ca..b5aba6765ccd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6279,12 +6279,14 @@ dependencies = [ [[package]] name = "windows-bindgen" -version = "0.52.0" +version = "0.54.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "970efb0b6849eb8a87a898f586af7cc167567b070014c7434514c0bde0ca341c" +checksum = "d86976b4742897f1df038908f5af6c0c1a291262eecf3e05abf1799bd3002dc2" dependencies = [ "proc-macro2", "rayon", + "serde", + "serde_json", "syn 2.0.52", "windows-metadata", ] @@ -6300,9 +6302,9 @@ dependencies = [ [[package]] name = "windows-metadata" -version = "0.52.0" +version = "0.54.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "218fd59201e26acdbb894fa2b302d1de84bf3eec7d0eb894ac8e9c5a854ee4ef" +checksum = "e44370b8367d7fd54085dff98fa774ead5070dd15aa892270a370555e35d04c2" [[package]] name = "windows-sys" diff --git a/library/std/src/sys/pal/windows/c/windows_sys.rs b/library/std/src/sys/pal/windows/c/windows_sys.rs index baaa8257d845..8e5738b30b48 100644 --- a/library/std/src/sys/pal/windows/c/windows_sys.rs +++ b/library/std/src/sys/pal/windows/c/windows_sys.rs @@ -1,4 +1,4 @@ -// Bindings generated by `windows-bindgen` 0.52.0 +// Bindings generated by `windows-bindgen` 0.54.0 #![allow(non_snake_case, non_upper_case_globals, non_camel_case_types, dead_code, clippy::all)] #[link(name = "advapi32")] @@ -17,11 +17,11 @@ extern "system" { } #[link(name = "kernel32")] extern "system" { - pub fn AcquireSRWLockExclusive(srwlock: *mut SRWLOCK) -> (); + pub fn AcquireSRWLockExclusive(srwlock: *mut SRWLOCK); } #[link(name = "kernel32")] extern "system" { - pub fn AcquireSRWLockShared(srwlock: *mut SRWLOCK) -> (); + pub fn AcquireSRWLockShared(srwlock: *mut SRWLOCK); } #[link(name = "kernel32")] extern "system" { @@ -150,7 +150,7 @@ extern "system" { } #[link(name = "kernel32")] extern "system" { - pub fn DeleteProcThreadAttributeList(lpattributelist: LPPROC_THREAD_ATTRIBUTE_LIST) -> (); + pub fn DeleteProcThreadAttributeList(lpattributelist: LPPROC_THREAD_ATTRIBUTE_LIST); } #[link(name = "kernel32")] extern "system" { @@ -338,11 +338,11 @@ extern "system" { } #[link(name = "kernel32")] extern "system" { - pub fn GetSystemInfo(lpsysteminfo: *mut SYSTEM_INFO) -> (); + pub fn GetSystemInfo(lpsysteminfo: *mut SYSTEM_INFO); } #[link(name = "kernel32")] extern "system" { - pub fn GetSystemTimeAsFileTime(lpsystemtimeasfiletime: *mut FILETIME) -> (); + pub fn GetSystemTimeAsFileTime(lpsystemtimeasfiletime: *mut FILETIME); } #[link(name = "kernel32")] extern "system" { @@ -445,11 +445,11 @@ extern "system" { } #[link(name = "kernel32")] extern "system" { - pub fn ReleaseSRWLockExclusive(srwlock: *mut SRWLOCK) -> (); + pub fn ReleaseSRWLockExclusive(srwlock: *mut SRWLOCK); } #[link(name = "kernel32")] extern "system" { - pub fn ReleaseSRWLockShared(srwlock: *mut SRWLOCK) -> (); + pub fn ReleaseSRWLockShared(srwlock: *mut SRWLOCK); } #[link(name = "kernel32")] extern "system" { @@ -503,7 +503,7 @@ extern "system" { } #[link(name = "kernel32")] extern "system" { - pub fn SetLastError(dwerrcode: WIN32_ERROR) -> (); + pub fn SetLastError(dwerrcode: WIN32_ERROR); } #[link(name = "kernel32")] extern "system" { @@ -522,7 +522,7 @@ extern "system" { } #[link(name = "kernel32")] extern "system" { - pub fn Sleep(dwmilliseconds: u32) -> (); + pub fn Sleep(dwmilliseconds: u32); } #[link(name = "kernel32")] extern "system" { @@ -596,11 +596,11 @@ extern "system" { } #[link(name = "kernel32")] extern "system" { - pub fn WakeAllConditionVariable(conditionvariable: *mut CONDITION_VARIABLE) -> (); + pub fn WakeAllConditionVariable(conditionvariable: *mut CONDITION_VARIABLE); } #[link(name = "kernel32")] extern "system" { - pub fn WakeConditionVariable(conditionvariable: *mut CONDITION_VARIABLE) -> (); + pub fn WakeConditionVariable(conditionvariable: *mut CONDITION_VARIABLE); } #[link(name = "kernel32")] extern "system" { @@ -760,7 +760,7 @@ extern "system" { } #[link(name = "ws2_32")] extern "system" { - pub fn freeaddrinfo(paddrinfo: *const ADDRINFOA) -> (); + pub fn freeaddrinfo(paddrinfo: *const ADDRINFOA); } #[link(name = "ws2_32")] extern "system" { @@ -3083,9 +3083,9 @@ impl ::core::clone::Clone for EXCEPTION_RECORD { *self } } -pub const EXCEPTION_STACK_OVERFLOW: NTSTATUS = -1073741571i32; +pub const EXCEPTION_STACK_OVERFLOW: NTSTATUS = 0xC00000FD_u32 as _; pub const EXTENDED_STARTUPINFO_PRESENT: PROCESS_CREATION_FLAGS = 524288u32; -pub const E_NOTIMPL: HRESULT = -2147467263i32; +pub const E_NOTIMPL: HRESULT = 0x80004001_u32 as _; pub const ExceptionCollidedUnwind: EXCEPTION_DISPOSITION = 3i32; pub const ExceptionContinueExecution: EXCEPTION_DISPOSITION = 0i32; pub const ExceptionContinueSearch: EXCEPTION_DISPOSITION = 1i32; @@ -3646,7 +3646,7 @@ pub type LPOVERLAPPED_COMPLETION_ROUTINE = ::core::option::Option< dwerrorcode: u32, dwnumberofbytestransfered: u32, lpoverlapped: *mut OVERLAPPED, - ) -> (), + ), >; pub type LPPROC_THREAD_ATTRIBUTE_LIST = *mut ::core::ffi::c_void; pub type LPPROGRESS_ROUTINE = ::core::option::Option< @@ -3672,7 +3672,7 @@ pub type LPWSAOVERLAPPED_COMPLETION_ROUTINE = ::core::option::Option< cbtransferred: u32, lpoverlapped: *mut OVERLAPPED, dwflags: u32, - ) -> (), + ), >; #[repr(C)] pub struct M128A { @@ -3771,7 +3771,7 @@ pub type PIO_APC_ROUTINE = ::core::option::Option< apccontext: *mut ::core::ffi::c_void, iostatusblock: *mut IO_STATUS_BLOCK, reserved: u32, - ) -> (), + ), >; pub const PIPE_ACCEPT_REMOTE_CLIENTS: NAMED_PIPE_MODE = 0u32; pub const PIPE_ACCESS_DUPLEX: FILE_FLAGS_AND_ATTRIBUTES = 3u32; @@ -3814,7 +3814,7 @@ pub type PTIMERAPCROUTINE = ::core::option::Option< lpargtocompletionroutine: *const ::core::ffi::c_void, dwtimerlowvalue: u32, dwtimerhighvalue: u32, - ) -> (), + ), >; pub type PWSTR = *mut u16; pub const READ_CONTROL: FILE_ACCESS_RIGHTS = 131072u32; @@ -3847,7 +3847,7 @@ pub type SET_FILE_POINTER_MOVE_METHOD = u32; #[repr(C)] pub struct SOCKADDR { pub sa_family: ADDRESS_FAMILY, - pub sa_data: [u8; 14], + pub sa_data: [i8; 14], } impl ::core::marker::Copy for SOCKADDR {} impl ::core::clone::Clone for SOCKADDR { @@ -3858,7 +3858,7 @@ impl ::core::clone::Clone for SOCKADDR { #[repr(C)] pub struct SOCKADDR_UN { pub sun_family: ADDRESS_FAMILY, - pub sun_path: [u8; 108], + pub sun_path: [i8; 108], } impl ::core::marker::Copy for SOCKADDR_UN {} impl ::core::clone::Clone for SOCKADDR_UN { @@ -3949,12 +3949,12 @@ impl ::core::clone::Clone for STARTUPINFOW { } } pub type STARTUPINFOW_FLAGS = u32; -pub const STATUS_DELETE_PENDING: NTSTATUS = -1073741738i32; -pub const STATUS_END_OF_FILE: NTSTATUS = -1073741807i32; -pub const STATUS_INVALID_PARAMETER: NTSTATUS = -1073741811i32; -pub const STATUS_NOT_IMPLEMENTED: NTSTATUS = -1073741822i32; -pub const STATUS_PENDING: NTSTATUS = 259i32; -pub const STATUS_SUCCESS: NTSTATUS = 0i32; +pub const STATUS_DELETE_PENDING: NTSTATUS = 0xC0000056_u32 as _; +pub const STATUS_END_OF_FILE: NTSTATUS = 0xC0000011_u32 as _; +pub const STATUS_INVALID_PARAMETER: NTSTATUS = 0xC000000D_u32 as _; +pub const STATUS_NOT_IMPLEMENTED: NTSTATUS = 0xC0000002_u32 as _; +pub const STATUS_PENDING: NTSTATUS = 0x103_u32 as _; +pub const STATUS_SUCCESS: NTSTATUS = 0x0_u32 as _; pub const STD_ERROR_HANDLE: STD_HANDLE = 4294967284u32; pub type STD_HANDLE = u32; pub const STD_INPUT_HANDLE: STD_HANDLE = 4294967286u32; @@ -4115,8 +4115,8 @@ pub struct WSADATA { pub iMaxSockets: u16, pub iMaxUdpDg: u16, pub lpVendorInfo: PSTR, - pub szDescription: [u8; 257], - pub szSystemStatus: [u8; 129], + pub szDescription: [i8; 257], + pub szSystemStatus: [i8; 129], } #[cfg(any(target_arch = "aarch64", target_arch = "x86_64"))] impl ::core::marker::Copy for WSADATA {} @@ -4131,8 +4131,8 @@ impl ::core::clone::Clone for WSADATA { pub struct WSADATA { pub wVersion: u16, pub wHighVersion: u16, - pub szDescription: [u8; 257], - pub szSystemStatus: [u8; 129], + pub szDescription: [i8; 257], + pub szSystemStatus: [i8; 129], pub iMaxSockets: u16, pub iMaxUdpDg: u16, pub lpVendorInfo: PSTR, diff --git a/src/tools/generate-windows-sys/Cargo.toml b/src/tools/generate-windows-sys/Cargo.toml index d8a7a06efc6d..ca137211f4ea 100644 --- a/src/tools/generate-windows-sys/Cargo.toml +++ b/src/tools/generate-windows-sys/Cargo.toml @@ -4,4 +4,4 @@ version = "0.1.0" edition = "2021" [dependencies.windows-bindgen] -version = "0.52.0" +version = "0.54.0" From 8e870c8ed194e34e6fdd6fa1160dffee10e6a210 Mon Sep 17 00:00:00 2001 From: Chris Denton Date: Thu, 7 Mar 2024 16:06:57 +0000 Subject: [PATCH 023/103] Bump windows-bindgen to 0.55.0 --- Cargo.lock | 8 +- .../std/src/sys/pal/windows/c/windows_sys.rs | 364 +++++++++--------- src/tools/generate-windows-sys/Cargo.toml | 2 +- 3 files changed, 186 insertions(+), 188 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b5aba6765ccd..a7553153e322 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6279,9 +6279,9 @@ dependencies = [ [[package]] name = "windows-bindgen" -version = "0.54.0" +version = "0.55.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d86976b4742897f1df038908f5af6c0c1a291262eecf3e05abf1799bd3002dc2" +checksum = "073ff8a486ebad239d557809d2cd5fe5e04ee1de29e09c6cd83fb0bae19b8a4c" dependencies = [ "proc-macro2", "rayon", @@ -6302,9 +6302,9 @@ dependencies = [ [[package]] name = "windows-metadata" -version = "0.54.0" +version = "0.55.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e44370b8367d7fd54085dff98fa774ead5070dd15aa892270a370555e35d04c2" +checksum = "b602635050172a1fc57a35040d4d225baefc6098fefd97094919921d95961a7d" [[package]] name = "windows-sys" diff --git a/library/std/src/sys/pal/windows/c/windows_sys.rs b/library/std/src/sys/pal/windows/c/windows_sys.rs index 8e5738b30b48..d180122d735f 100644 --- a/library/std/src/sys/pal/windows/c/windows_sys.rs +++ b/library/std/src/sys/pal/windows/c/windows_sys.rs @@ -1,4 +1,4 @@ -// Bindings generated by `windows-bindgen` 0.54.0 +// Bindings generated by `windows-bindgen` 0.55.0 #![allow(non_snake_case, non_upper_case_globals, non_camel_case_types, dead_code, clippy::all)] #[link(name = "advapi32")] @@ -12,8 +12,7 @@ extern "system" { #[link(name = "advapi32")] extern "system" { #[link_name = "SystemFunction036"] - pub fn RtlGenRandom(randombuffer: *mut ::core::ffi::c_void, randombufferlength: u32) - -> BOOLEAN; + pub fn RtlGenRandom(randombuffer: *mut core::ffi::c_void, randombufferlength: u32) -> BOOLEAN; } #[link(name = "kernel32")] extern "system" { @@ -47,7 +46,7 @@ extern "system" { lpexistingfilename: PCWSTR, lpnewfilename: PCWSTR, lpprogressroutine: LPPROGRESS_ROUTINE, - lpdata: *const ::core::ffi::c_void, + lpdata: *const core::ffi::c_void, pbcancel: *mut BOOL, dwcopyflags: u32, ) -> BOOL; @@ -110,7 +109,7 @@ extern "system" { lpthreadattributes: *const SECURITY_ATTRIBUTES, binherithandles: BOOL, dwcreationflags: PROCESS_CREATION_FLAGS, - lpenvironment: *const ::core::ffi::c_void, + lpenvironment: *const core::ffi::c_void, lpcurrentdirectory: PCWSTR, lpstartupinfo: *const STARTUPINFOW, lpprocessinformation: *mut PROCESS_INFORMATION, @@ -130,7 +129,7 @@ extern "system" { lpthreadattributes: *const SECURITY_ATTRIBUTES, dwstacksize: usize, lpstartaddress: LPTHREAD_START_ROUTINE, - lpparameter: *const ::core::ffi::c_void, + lpparameter: *const core::ffi::c_void, dwcreationflags: THREAD_CREATION_FLAGS, lpthreadid: *mut u32, ) -> HANDLE; @@ -157,9 +156,9 @@ extern "system" { pub fn DeviceIoControl( hdevice: HANDLE, dwiocontrolcode: u32, - lpinbuffer: *const ::core::ffi::c_void, + lpinbuffer: *const core::ffi::c_void, ninbuffersize: u32, - lpoutbuffer: *mut ::core::ffi::c_void, + lpoutbuffer: *mut core::ffi::c_void, noutbuffersize: u32, lpbytesreturned: *mut u32, lpoverlapped: *mut OVERLAPPED, @@ -201,7 +200,7 @@ extern "system" { extern "system" { pub fn FormatMessageW( dwflags: FORMAT_MESSAGE_OPTIONS, - lpsource: *const ::core::ffi::c_void, + lpsource: *const core::ffi::c_void, dwmessageid: u32, dwlanguageid: u32, lpbuffer: PWSTR, @@ -269,7 +268,7 @@ extern "system" { pub fn GetFileInformationByHandleEx( hfile: HANDLE, fileinformationclass: FILE_INFO_BY_HANDLE_CLASS, - lpfileinformation: *mut ::core::ffi::c_void, + lpfileinformation: *mut core::ffi::c_void, dwbuffersize: u32, ) -> BOOL; } @@ -362,7 +361,7 @@ extern "system" { lpinitonce: *mut INIT_ONCE, dwflags: u32, fpending: *mut BOOL, - lpcontext: *mut *mut ::core::ffi::c_void, + lpcontext: *mut *mut core::ffi::c_void, ) -> BOOL; } #[link(name = "kernel32")] @@ -370,7 +369,7 @@ extern "system" { pub fn InitOnceComplete( lpinitonce: *mut INIT_ONCE, dwflags: u32, - lpcontext: *const ::core::ffi::c_void, + lpcontext: *const core::ffi::c_void, ) -> BOOL; } #[link(name = "kernel32")] @@ -417,7 +416,7 @@ extern "system" { extern "system" { pub fn ReadConsoleW( hconsoleinput: HANDLE, - lpbuffer: *mut ::core::ffi::c_void, + lpbuffer: *mut core::ffi::c_void, nnumberofcharstoread: u32, lpnumberofcharsread: *mut u32, pinputcontrol: *const CONSOLE_READCONSOLE_CONTROL, @@ -475,7 +474,7 @@ extern "system" { pub fn SetFileInformationByHandle( hfile: HANDLE, fileinformationclass: FILE_INFO_BY_HANDLE_CLASS, - lpfileinformation: *const ::core::ffi::c_void, + lpfileinformation: *const core::ffi::c_void, dwbuffersize: u32, ) -> BOOL; } @@ -516,7 +515,7 @@ extern "system" { lpduetime: *const i64, lperiod: i32, pfncompletionroutine: PTIMERAPCROUTINE, - lpargtocompletionroutine: *const ::core::ffi::c_void, + lpargtocompletionroutine: *const core::ffi::c_void, fresume: BOOL, ) -> BOOL; } @@ -555,11 +554,11 @@ extern "system" { } #[link(name = "kernel32")] extern "system" { - pub fn TlsGetValue(dwtlsindex: u32) -> *mut ::core::ffi::c_void; + pub fn TlsGetValue(dwtlsindex: u32) -> *mut core::ffi::c_void; } #[link(name = "kernel32")] extern "system" { - pub fn TlsSetValue(dwtlsindex: u32, lptlsvalue: *const ::core::ffi::c_void) -> BOOL; + pub fn TlsSetValue(dwtlsindex: u32, lptlsvalue: *const core::ffi::c_void) -> BOOL; } #[link(name = "kernel32")] extern "system" { @@ -575,9 +574,9 @@ extern "system" { lpattributelist: LPPROC_THREAD_ATTRIBUTE_LIST, dwflags: u32, attribute: usize, - lpvalue: *const ::core::ffi::c_void, + lpvalue: *const core::ffi::c_void, cbsize: usize, - lppreviousvalue: *mut ::core::ffi::c_void, + lppreviousvalue: *mut core::ffi::c_void, lpreturnsize: *const usize, ) -> BOOL; } @@ -619,10 +618,10 @@ extern "system" { extern "system" { pub fn WriteConsoleW( hconsoleoutput: HANDLE, - lpbuffer: *const ::core::ffi::c_void, + lpbuffer: *const core::ffi::c_void, nnumberofcharstowrite: u32, lpnumberofcharswritten: *mut u32, - lpreserved: *const ::core::ffi::c_void, + lpreserved: *const core::ffi::c_void, ) -> BOOL; } #[link(name = "kernel32")] @@ -647,7 +646,7 @@ extern "system" { shareaccess: FILE_SHARE_MODE, createdisposition: NTCREATEFILE_CREATE_DISPOSITION, createoptions: NTCREATEFILE_CREATE_OPTIONS, - eabuffer: *const ::core::ffi::c_void, + eabuffer: *const core::ffi::c_void, ealength: u32, ) -> NTSTATUS; } @@ -657,9 +656,9 @@ extern "system" { filehandle: HANDLE, event: HANDLE, apcroutine: PIO_APC_ROUTINE, - apccontext: *const ::core::ffi::c_void, + apccontext: *const core::ffi::c_void, iostatusblock: *mut IO_STATUS_BLOCK, - buffer: *mut ::core::ffi::c_void, + buffer: *mut core::ffi::c_void, length: u32, byteoffset: *const i64, key: *const u32, @@ -671,9 +670,9 @@ extern "system" { filehandle: HANDLE, event: HANDLE, apcroutine: PIO_APC_ROUTINE, - apccontext: *const ::core::ffi::c_void, + apccontext: *const core::ffi::c_void, iostatusblock: *mut IO_STATUS_BLOCK, - buffer: *const ::core::ffi::c_void, + buffer: *const core::ffi::c_void, length: u32, byteoffset: *const i64, key: *const u32, @@ -852,8 +851,8 @@ pub struct ADDRINFOA { pub ai_addr: *mut SOCKADDR, pub ai_next: *mut ADDRINFOA, } -impl ::core::marker::Copy for ADDRINFOA {} -impl ::core::clone::Clone for ADDRINFOA { +impl Copy for ADDRINFOA {} +impl Clone for ADDRINFOA { fn clone(&self) -> Self { *self } @@ -871,8 +870,8 @@ pub union ARM64_NT_NEON128 { pub H: [u16; 8], pub B: [u8; 16], } -impl ::core::marker::Copy for ARM64_NT_NEON128 {} -impl ::core::clone::Clone for ARM64_NT_NEON128 { +impl Copy for ARM64_NT_NEON128 {} +impl Clone for ARM64_NT_NEON128 { fn clone(&self) -> Self { *self } @@ -882,8 +881,8 @@ pub struct ARM64_NT_NEON128_0 { pub Low: u64, pub High: i64, } -impl ::core::marker::Copy for ARM64_NT_NEON128_0 {} -impl ::core::clone::Clone for ARM64_NT_NEON128_0 { +impl Copy for ARM64_NT_NEON128_0 {} +impl Clone for ARM64_NT_NEON128_0 { fn clone(&self) -> Self { *self } @@ -904,8 +903,8 @@ pub struct BY_HANDLE_FILE_INFORMATION { pub nFileIndexHigh: u32, pub nFileIndexLow: u32, } -impl ::core::marker::Copy for BY_HANDLE_FILE_INFORMATION {} -impl ::core::clone::Clone for BY_HANDLE_FILE_INFORMATION { +impl Copy for BY_HANDLE_FILE_INFORMATION {} +impl Clone for BY_HANDLE_FILE_INFORMATION { fn clone(&self) -> Self { *self } @@ -915,10 +914,10 @@ pub const CALLBACK_STREAM_SWITCH: LPPROGRESS_ROUTINE_CALLBACK_REASON = 1u32; pub type COMPARESTRING_RESULT = i32; #[repr(C)] pub struct CONDITION_VARIABLE { - pub Ptr: *mut ::core::ffi::c_void, + pub Ptr: *mut core::ffi::c_void, } -impl ::core::marker::Copy for CONDITION_VARIABLE {} -impl ::core::clone::Clone for CONDITION_VARIABLE { +impl Copy for CONDITION_VARIABLE {} +impl Clone for CONDITION_VARIABLE { fn clone(&self) -> Self { *self } @@ -931,8 +930,8 @@ pub struct CONSOLE_READCONSOLE_CONTROL { pub dwCtrlWakeupMask: u32, pub dwControlKeyState: u32, } -impl ::core::marker::Copy for CONSOLE_READCONSOLE_CONTROL {} -impl ::core::clone::Clone for CONSOLE_READCONSOLE_CONTROL { +impl Copy for CONSOLE_READCONSOLE_CONTROL {} +impl Clone for CONSOLE_READCONSOLE_CONTROL { fn clone(&self) -> Self { *self } @@ -954,9 +953,9 @@ pub struct CONTEXT { pub Wvr: [u64; 2], } #[cfg(target_arch = "aarch64")] -impl ::core::marker::Copy for CONTEXT {} +impl Copy for CONTEXT {} #[cfg(target_arch = "aarch64")] -impl ::core::clone::Clone for CONTEXT { +impl Clone for CONTEXT { fn clone(&self) -> Self { *self } @@ -968,9 +967,9 @@ pub union CONTEXT_0 { pub X: [u64; 31], } #[cfg(target_arch = "aarch64")] -impl ::core::marker::Copy for CONTEXT_0 {} +impl Copy for CONTEXT_0 {} #[cfg(target_arch = "aarch64")] -impl ::core::clone::Clone for CONTEXT_0 { +impl Clone for CONTEXT_0 { fn clone(&self) -> Self { *self } @@ -1011,9 +1010,9 @@ pub struct CONTEXT_0_0 { pub Lr: u64, } #[cfg(target_arch = "aarch64")] -impl ::core::marker::Copy for CONTEXT_0_0 {} +impl Copy for CONTEXT_0_0 {} #[cfg(target_arch = "aarch64")] -impl ::core::clone::Clone for CONTEXT_0_0 { +impl Clone for CONTEXT_0_0 { fn clone(&self) -> Self { *self } @@ -1069,9 +1068,9 @@ pub struct CONTEXT { pub LastExceptionFromRip: u64, } #[cfg(target_arch = "x86_64")] -impl ::core::marker::Copy for CONTEXT {} +impl Copy for CONTEXT {} #[cfg(target_arch = "x86_64")] -impl ::core::clone::Clone for CONTEXT { +impl Clone for CONTEXT { fn clone(&self) -> Self { *self } @@ -1083,9 +1082,9 @@ pub union CONTEXT_0 { pub Anonymous: CONTEXT_0_0, } #[cfg(target_arch = "x86_64")] -impl ::core::marker::Copy for CONTEXT_0 {} +impl Copy for CONTEXT_0 {} #[cfg(target_arch = "x86_64")] -impl ::core::clone::Clone for CONTEXT_0 { +impl Clone for CONTEXT_0 { fn clone(&self) -> Self { *self } @@ -1113,9 +1112,9 @@ pub struct CONTEXT_0_0 { pub Xmm15: M128A, } #[cfg(target_arch = "x86_64")] -impl ::core::marker::Copy for CONTEXT_0_0 {} +impl Copy for CONTEXT_0_0 {} #[cfg(target_arch = "x86_64")] -impl ::core::clone::Clone for CONTEXT_0_0 { +impl Clone for CONTEXT_0_0 { fn clone(&self) -> Self { *self } @@ -1150,9 +1149,9 @@ pub struct CONTEXT { pub ExtendedRegisters: [u8; 512], } #[cfg(target_arch = "x86")] -impl ::core::marker::Copy for CONTEXT {} +impl Copy for CONTEXT {} #[cfg(target_arch = "x86")] -impl ::core::clone::Clone for CONTEXT { +impl Clone for CONTEXT { fn clone(&self) -> Self { *self } @@ -3073,12 +3072,12 @@ pub struct EXCEPTION_RECORD { pub ExceptionCode: NTSTATUS, pub ExceptionFlags: u32, pub ExceptionRecord: *mut EXCEPTION_RECORD, - pub ExceptionAddress: *mut ::core::ffi::c_void, + pub ExceptionAddress: *mut core::ffi::c_void, pub NumberParameters: u32, pub ExceptionInformation: [usize; 15], } -impl ::core::marker::Copy for EXCEPTION_RECORD {} -impl ::core::clone::Clone for EXCEPTION_RECORD { +impl Copy for EXCEPTION_RECORD {} +impl Clone for EXCEPTION_RECORD { fn clone(&self) -> Self { *self } @@ -3093,15 +3092,15 @@ pub const ExceptionNestedException: EXCEPTION_DISPOSITION = 2i32; pub type FACILITY_CODE = u32; pub const FACILITY_NT_BIT: FACILITY_CODE = 268435456u32; pub const FALSE: BOOL = 0i32; -pub type FARPROC = ::core::option::Option isize>; +pub type FARPROC = Option isize>; pub const FAST_FAIL_FATAL_APP_EXIT: u32 = 7u32; #[repr(C)] pub struct FD_SET { pub fd_count: u32, pub fd_array: [SOCKET; 64], } -impl ::core::marker::Copy for FD_SET {} -impl ::core::clone::Clone for FD_SET { +impl Copy for FD_SET {} +impl Clone for FD_SET { fn clone(&self) -> Self { *self } @@ -3111,8 +3110,8 @@ pub struct FILETIME { pub dwLowDateTime: u32, pub dwHighDateTime: u32, } -impl ::core::marker::Copy for FILETIME {} -impl ::core::clone::Clone for FILETIME { +impl Copy for FILETIME {} +impl Clone for FILETIME { fn clone(&self) -> Self { *self } @@ -3124,8 +3123,8 @@ pub const FILE_ADD_SUBDIRECTORY: FILE_ACCESS_RIGHTS = 4u32; pub struct FILE_ALLOCATION_INFO { pub AllocationSize: i64, } -impl ::core::marker::Copy for FILE_ALLOCATION_INFO {} -impl ::core::clone::Clone for FILE_ALLOCATION_INFO { +impl Copy for FILE_ALLOCATION_INFO {} +impl Clone for FILE_ALLOCATION_INFO { fn clone(&self) -> Self { *self } @@ -3156,8 +3155,8 @@ pub struct FILE_ATTRIBUTE_TAG_INFO { pub FileAttributes: u32, pub ReparseTag: u32, } -impl ::core::marker::Copy for FILE_ATTRIBUTE_TAG_INFO {} -impl ::core::clone::Clone for FILE_ATTRIBUTE_TAG_INFO { +impl Copy for FILE_ATTRIBUTE_TAG_INFO {} +impl Clone for FILE_ATTRIBUTE_TAG_INFO { fn clone(&self) -> Self { *self } @@ -3173,8 +3172,8 @@ pub struct FILE_BASIC_INFO { pub ChangeTime: i64, pub FileAttributes: u32, } -impl ::core::marker::Copy for FILE_BASIC_INFO {} -impl ::core::clone::Clone for FILE_BASIC_INFO { +impl Copy for FILE_BASIC_INFO {} +impl Clone for FILE_BASIC_INFO { fn clone(&self) -> Self { *self } @@ -3201,8 +3200,8 @@ pub const FILE_DISPOSITION_FLAG_POSIX_SEMANTICS: FILE_DISPOSITION_INFO_EX_FLAGS pub struct FILE_DISPOSITION_INFO { pub DeleteFile: BOOLEAN, } -impl ::core::marker::Copy for FILE_DISPOSITION_INFO {} -impl ::core::clone::Clone for FILE_DISPOSITION_INFO { +impl Copy for FILE_DISPOSITION_INFO {} +impl Clone for FILE_DISPOSITION_INFO { fn clone(&self) -> Self { *self } @@ -3211,8 +3210,8 @@ impl ::core::clone::Clone for FILE_DISPOSITION_INFO { pub struct FILE_DISPOSITION_INFO_EX { pub Flags: FILE_DISPOSITION_INFO_EX_FLAGS, } -impl ::core::marker::Copy for FILE_DISPOSITION_INFO_EX {} -impl ::core::clone::Clone for FILE_DISPOSITION_INFO_EX { +impl Copy for FILE_DISPOSITION_INFO_EX {} +impl Clone for FILE_DISPOSITION_INFO_EX { fn clone(&self) -> Self { *self } @@ -3223,8 +3222,8 @@ pub const FILE_END: SET_FILE_POINTER_MOVE_METHOD = 2u32; pub struct FILE_END_OF_FILE_INFO { pub EndOfFile: i64, } -impl ::core::marker::Copy for FILE_END_OF_FILE_INFO {} -impl ::core::clone::Clone for FILE_END_OF_FILE_INFO { +impl Copy for FILE_END_OF_FILE_INFO {} +impl Clone for FILE_END_OF_FILE_INFO { fn clone(&self) -> Self { *self } @@ -3264,8 +3263,8 @@ pub struct FILE_ID_BOTH_DIR_INFO { pub FileId: i64, pub FileName: [u16; 1], } -impl ::core::marker::Copy for FILE_ID_BOTH_DIR_INFO {} -impl ::core::clone::Clone for FILE_ID_BOTH_DIR_INFO { +impl Copy for FILE_ID_BOTH_DIR_INFO {} +impl Clone for FILE_ID_BOTH_DIR_INFO { fn clone(&self) -> Self { *self } @@ -3275,8 +3274,8 @@ pub type FILE_INFO_BY_HANDLE_CLASS = i32; pub struct FILE_IO_PRIORITY_HINT_INFO { pub PriorityHint: PRIORITY_HINT, } -impl ::core::marker::Copy for FILE_IO_PRIORITY_HINT_INFO {} -impl ::core::clone::Clone for FILE_IO_PRIORITY_HINT_INFO { +impl Copy for FILE_IO_PRIORITY_HINT_INFO {} +impl Clone for FILE_IO_PRIORITY_HINT_INFO { fn clone(&self) -> Self { *self } @@ -3318,8 +3317,8 @@ pub struct FILE_STANDARD_INFO { pub DeletePending: BOOLEAN, pub Directory: BOOLEAN, } -impl ::core::marker::Copy for FILE_STANDARD_INFO {} -impl ::core::clone::Clone for FILE_STANDARD_INFO { +impl Copy for FILE_STANDARD_INFO {} +impl Clone for FILE_STANDARD_INFO { fn clone(&self) -> Self { *self } @@ -3353,9 +3352,9 @@ pub struct FLOATING_SAVE_AREA { pub Cr0NpxState: u32, } #[cfg(any(target_arch = "aarch64", target_arch = "x86_64"))] -impl ::core::marker::Copy for FLOATING_SAVE_AREA {} +impl Copy for FLOATING_SAVE_AREA {} #[cfg(any(target_arch = "aarch64", target_arch = "x86_64"))] -impl ::core::clone::Clone for FLOATING_SAVE_AREA { +impl Clone for FLOATING_SAVE_AREA { fn clone(&self) -> Self { *self } @@ -3374,9 +3373,9 @@ pub struct FLOATING_SAVE_AREA { pub Spare0: u32, } #[cfg(target_arch = "x86")] -impl ::core::marker::Copy for FLOATING_SAVE_AREA {} +impl Copy for FLOATING_SAVE_AREA {} #[cfg(target_arch = "x86")] -impl ::core::clone::Clone for FLOATING_SAVE_AREA { +impl Clone for FLOATING_SAVE_AREA { fn clone(&self) -> Self { *self } @@ -3429,8 +3428,8 @@ pub struct GUID { pub data3: u16, pub data4: [u8; 8], } -impl ::core::marker::Copy for GUID {} -impl ::core::clone::Clone for GUID { +impl Copy for GUID {} +impl Clone for GUID { fn clone(&self) -> Self { *self } @@ -3445,21 +3444,21 @@ impl GUID { } } } -pub type HANDLE = *mut ::core::ffi::c_void; +pub type HANDLE = *mut core::ffi::c_void; pub type HANDLE_FLAGS = u32; pub const HANDLE_FLAG_INHERIT: HANDLE_FLAGS = 1u32; pub const HANDLE_FLAG_PROTECT_FROM_CLOSE: HANDLE_FLAGS = 2u32; pub const HIGH_PRIORITY_CLASS: PROCESS_CREATION_FLAGS = 128u32; -pub type HLOCAL = *mut ::core::ffi::c_void; -pub type HMODULE = *mut ::core::ffi::c_void; +pub type HLOCAL = *mut core::ffi::c_void; +pub type HMODULE = *mut core::ffi::c_void; pub type HRESULT = i32; pub const IDLE_PRIORITY_CLASS: PROCESS_CREATION_FLAGS = 64u32; #[repr(C)] pub struct IN6_ADDR { pub u: IN6_ADDR_0, } -impl ::core::marker::Copy for IN6_ADDR {} -impl ::core::clone::Clone for IN6_ADDR { +impl Copy for IN6_ADDR {} +impl Clone for IN6_ADDR { fn clone(&self) -> Self { *self } @@ -3469,8 +3468,8 @@ pub union IN6_ADDR_0 { pub Byte: [u8; 16], pub Word: [u16; 8], } -impl ::core::marker::Copy for IN6_ADDR_0 {} -impl ::core::clone::Clone for IN6_ADDR_0 { +impl Copy for IN6_ADDR_0 {} +impl Clone for IN6_ADDR_0 { fn clone(&self) -> Self { *self } @@ -3480,10 +3479,10 @@ pub const INHERIT_CALLER_PRIORITY: PROCESS_CREATION_FLAGS = 131072u32; pub const INHERIT_PARENT_AFFINITY: PROCESS_CREATION_FLAGS = 65536u32; #[repr(C)] pub union INIT_ONCE { - pub Ptr: *mut ::core::ffi::c_void, + pub Ptr: *mut core::ffi::c_void, } -impl ::core::marker::Copy for INIT_ONCE {} -impl ::core::clone::Clone for INIT_ONCE { +impl Copy for INIT_ONCE {} +impl Clone for INIT_ONCE { fn clone(&self) -> Self { *self } @@ -3495,8 +3494,8 @@ pub const INVALID_SOCKET: SOCKET = -1i32 as _; pub struct IN_ADDR { pub S_un: IN_ADDR_0, } -impl ::core::marker::Copy for IN_ADDR {} -impl ::core::clone::Clone for IN_ADDR { +impl Copy for IN_ADDR {} +impl Clone for IN_ADDR { fn clone(&self) -> Self { *self } @@ -3507,8 +3506,8 @@ pub union IN_ADDR_0 { pub S_un_w: IN_ADDR_0_1, pub S_addr: u32, } -impl ::core::marker::Copy for IN_ADDR_0 {} -impl ::core::clone::Clone for IN_ADDR_0 { +impl Copy for IN_ADDR_0 {} +impl Clone for IN_ADDR_0 { fn clone(&self) -> Self { *self } @@ -3520,8 +3519,8 @@ pub struct IN_ADDR_0_0 { pub s_b3: u8, pub s_b4: u8, } -impl ::core::marker::Copy for IN_ADDR_0_0 {} -impl ::core::clone::Clone for IN_ADDR_0_0 { +impl Copy for IN_ADDR_0_0 {} +impl Clone for IN_ADDR_0_0 { fn clone(&self) -> Self { *self } @@ -3531,8 +3530,8 @@ pub struct IN_ADDR_0_1 { pub s_w1: u16, pub s_w2: u16, } -impl ::core::marker::Copy for IN_ADDR_0_1 {} -impl ::core::clone::Clone for IN_ADDR_0_1 { +impl Copy for IN_ADDR_0_1 {} +impl Clone for IN_ADDR_0_1 { fn clone(&self) -> Self { *self } @@ -3544,8 +3543,8 @@ pub struct IO_STATUS_BLOCK { pub Anonymous: IO_STATUS_BLOCK_0, pub Information: usize, } -impl ::core::marker::Copy for IO_STATUS_BLOCK {} -impl ::core::clone::Clone for IO_STATUS_BLOCK { +impl Copy for IO_STATUS_BLOCK {} +impl Clone for IO_STATUS_BLOCK { fn clone(&self) -> Self { *self } @@ -3553,10 +3552,10 @@ impl ::core::clone::Clone for IO_STATUS_BLOCK { #[repr(C)] pub union IO_STATUS_BLOCK_0 { pub Status: NTSTATUS, - pub Pointer: *mut ::core::ffi::c_void, + pub Pointer: *mut core::ffi::c_void, } -impl ::core::marker::Copy for IO_STATUS_BLOCK_0 {} -impl ::core::clone::Clone for IO_STATUS_BLOCK_0 { +impl Copy for IO_STATUS_BLOCK_0 {} +impl Clone for IO_STATUS_BLOCK_0 { fn clone(&self) -> Self { *self } @@ -3606,8 +3605,8 @@ pub struct IPV6_MREQ { pub ipv6mr_multiaddr: IN6_ADDR, pub ipv6mr_interface: u32, } -impl ::core::marker::Copy for IPV6_MREQ {} -impl ::core::clone::Clone for IPV6_MREQ { +impl Copy for IPV6_MREQ {} +impl Clone for IPV6_MREQ { fn clone(&self) -> Self { *self } @@ -3621,8 +3620,8 @@ pub struct IP_MREQ { pub imr_multiaddr: IN_ADDR, pub imr_interface: IN_ADDR, } -impl ::core::marker::Copy for IP_MREQ {} -impl ::core::clone::Clone for IP_MREQ { +impl Copy for IP_MREQ {} +impl Clone for IP_MREQ { fn clone(&self) -> Self { *self } @@ -3635,21 +3634,21 @@ pub struct LINGER { pub l_onoff: u16, pub l_linger: u16, } -impl ::core::marker::Copy for LINGER {} -impl ::core::clone::Clone for LINGER { +impl Copy for LINGER {} +impl Clone for LINGER { fn clone(&self) -> Self { *self } } -pub type LPOVERLAPPED_COMPLETION_ROUTINE = ::core::option::Option< +pub type LPOVERLAPPED_COMPLETION_ROUTINE = Option< unsafe extern "system" fn( dwerrorcode: u32, dwnumberofbytestransfered: u32, lpoverlapped: *mut OVERLAPPED, ), >; -pub type LPPROC_THREAD_ATTRIBUTE_LIST = *mut ::core::ffi::c_void; -pub type LPPROGRESS_ROUTINE = ::core::option::Option< +pub type LPPROC_THREAD_ATTRIBUTE_LIST = *mut core::ffi::c_void; +pub type LPPROGRESS_ROUTINE = Option< unsafe extern "system" fn( totalfilesize: i64, totalbytestransferred: i64, @@ -3659,14 +3658,13 @@ pub type LPPROGRESS_ROUTINE = ::core::option::Option< dwcallbackreason: LPPROGRESS_ROUTINE_CALLBACK_REASON, hsourcefile: HANDLE, hdestinationfile: HANDLE, - lpdata: *const ::core::ffi::c_void, + lpdata: *const core::ffi::c_void, ) -> u32, >; pub type LPPROGRESS_ROUTINE_CALLBACK_REASON = u32; -pub type LPTHREAD_START_ROUTINE = ::core::option::Option< - unsafe extern "system" fn(lpthreadparameter: *mut ::core::ffi::c_void) -> u32, ->; -pub type LPWSAOVERLAPPED_COMPLETION_ROUTINE = ::core::option::Option< +pub type LPTHREAD_START_ROUTINE = + Option u32>; +pub type LPWSAOVERLAPPED_COMPLETION_ROUTINE = Option< unsafe extern "system" fn( dwerror: u32, cbtransferred: u32, @@ -3679,8 +3677,8 @@ pub struct M128A { pub Low: u64, pub High: i64, } -impl ::core::marker::Copy for M128A {} -impl ::core::clone::Clone for M128A { +impl Copy for M128A {} +impl Clone for M128A { fn clone(&self) -> Self { *self } @@ -3717,11 +3715,11 @@ pub struct OBJECT_ATTRIBUTES { pub RootDirectory: HANDLE, pub ObjectName: *const UNICODE_STRING, pub Attributes: u32, - pub SecurityDescriptor: *const ::core::ffi::c_void, - pub SecurityQualityOfService: *const ::core::ffi::c_void, + pub SecurityDescriptor: *const core::ffi::c_void, + pub SecurityQualityOfService: *const core::ffi::c_void, } -impl ::core::marker::Copy for OBJECT_ATTRIBUTES {} -impl ::core::clone::Clone for OBJECT_ATTRIBUTES { +impl Copy for OBJECT_ATTRIBUTES {} +impl Clone for OBJECT_ATTRIBUTES { fn clone(&self) -> Self { *self } @@ -3736,8 +3734,8 @@ pub struct OVERLAPPED { pub Anonymous: OVERLAPPED_0, pub hEvent: HANDLE, } -impl ::core::marker::Copy for OVERLAPPED {} -impl ::core::clone::Clone for OVERLAPPED { +impl Copy for OVERLAPPED {} +impl Clone for OVERLAPPED { fn clone(&self) -> Self { *self } @@ -3745,10 +3743,10 @@ impl ::core::clone::Clone for OVERLAPPED { #[repr(C)] pub union OVERLAPPED_0 { pub Anonymous: OVERLAPPED_0_0, - pub Pointer: *mut ::core::ffi::c_void, + pub Pointer: *mut core::ffi::c_void, } -impl ::core::marker::Copy for OVERLAPPED_0 {} -impl ::core::clone::Clone for OVERLAPPED_0 { +impl Copy for OVERLAPPED_0 {} +impl Clone for OVERLAPPED_0 { fn clone(&self) -> Self { *self } @@ -3758,17 +3756,17 @@ pub struct OVERLAPPED_0_0 { pub Offset: u32, pub OffsetHigh: u32, } -impl ::core::marker::Copy for OVERLAPPED_0_0 {} -impl ::core::clone::Clone for OVERLAPPED_0_0 { +impl Copy for OVERLAPPED_0_0 {} +impl Clone for OVERLAPPED_0_0 { fn clone(&self) -> Self { *self } } pub type PCSTR = *const u8; pub type PCWSTR = *const u16; -pub type PIO_APC_ROUTINE = ::core::option::Option< +pub type PIO_APC_ROUTINE = Option< unsafe extern "system" fn( - apccontext: *mut ::core::ffi::c_void, + apccontext: *mut core::ffi::c_void, iostatusblock: *mut IO_STATUS_BLOCK, reserved: u32, ), @@ -3796,8 +3794,8 @@ pub struct PROCESS_INFORMATION { pub dwProcessId: u32, pub dwThreadId: u32, } -impl ::core::marker::Copy for PROCESS_INFORMATION {} -impl ::core::clone::Clone for PROCESS_INFORMATION { +impl Copy for PROCESS_INFORMATION {} +impl Clone for PROCESS_INFORMATION { fn clone(&self) -> Self { *self } @@ -3809,9 +3807,9 @@ pub const PROFILE_SERVER: PROCESS_CREATION_FLAGS = 1073741824u32; pub const PROFILE_USER: PROCESS_CREATION_FLAGS = 268435456u32; pub const PROGRESS_CONTINUE: u32 = 0u32; pub type PSTR = *mut u8; -pub type PTIMERAPCROUTINE = ::core::option::Option< +pub type PTIMERAPCROUTINE = Option< unsafe extern "system" fn( - lpargtocompletionroutine: *const ::core::ffi::c_void, + lpargtocompletionroutine: *const core::ffi::c_void, dwtimerlowvalue: u32, dwtimerhighvalue: u32, ), @@ -3826,11 +3824,11 @@ pub const SECURITY_ANONYMOUS: FILE_FLAGS_AND_ATTRIBUTES = 0u32; #[repr(C)] pub struct SECURITY_ATTRIBUTES { pub nLength: u32, - pub lpSecurityDescriptor: *mut ::core::ffi::c_void, + pub lpSecurityDescriptor: *mut core::ffi::c_void, pub bInheritHandle: BOOL, } -impl ::core::marker::Copy for SECURITY_ATTRIBUTES {} -impl ::core::clone::Clone for SECURITY_ATTRIBUTES { +impl Copy for SECURITY_ATTRIBUTES {} +impl Clone for SECURITY_ATTRIBUTES { fn clone(&self) -> Self { *self } @@ -3849,8 +3847,8 @@ pub struct SOCKADDR { pub sa_family: ADDRESS_FAMILY, pub sa_data: [i8; 14], } -impl ::core::marker::Copy for SOCKADDR {} -impl ::core::clone::Clone for SOCKADDR { +impl Copy for SOCKADDR {} +impl Clone for SOCKADDR { fn clone(&self) -> Self { *self } @@ -3860,8 +3858,8 @@ pub struct SOCKADDR_UN { pub sun_family: ADDRESS_FAMILY, pub sun_path: [i8; 108], } -impl ::core::marker::Copy for SOCKADDR_UN {} -impl ::core::clone::Clone for SOCKADDR_UN { +impl Copy for SOCKADDR_UN {} +impl Clone for SOCKADDR_UN { fn clone(&self) -> Self { *self } @@ -3882,10 +3880,10 @@ pub const SO_SNDTIMEO: i32 = 4101i32; pub const SPECIFIC_RIGHTS_ALL: FILE_ACCESS_RIGHTS = 65535u32; #[repr(C)] pub struct SRWLOCK { - pub Ptr: *mut ::core::ffi::c_void, + pub Ptr: *mut core::ffi::c_void, } -impl ::core::marker::Copy for SRWLOCK {} -impl ::core::clone::Clone for SRWLOCK { +impl Copy for SRWLOCK {} +impl Clone for SRWLOCK { fn clone(&self) -> Self { *self } @@ -3915,8 +3913,8 @@ pub struct STARTUPINFOEXW { pub StartupInfo: STARTUPINFOW, pub lpAttributeList: LPPROC_THREAD_ATTRIBUTE_LIST, } -impl ::core::marker::Copy for STARTUPINFOEXW {} -impl ::core::clone::Clone for STARTUPINFOEXW { +impl Copy for STARTUPINFOEXW {} +impl Clone for STARTUPINFOEXW { fn clone(&self) -> Self { *self } @@ -3942,8 +3940,8 @@ pub struct STARTUPINFOW { pub hStdOutput: HANDLE, pub hStdError: HANDLE, } -impl ::core::marker::Copy for STARTUPINFOW {} -impl ::core::clone::Clone for STARTUPINFOW { +impl Copy for STARTUPINFOW {} +impl Clone for STARTUPINFOW { fn clone(&self) -> Self { *self } @@ -3969,8 +3967,8 @@ pub const SYNCHRONIZE: FILE_ACCESS_RIGHTS = 1048576u32; pub struct SYSTEM_INFO { pub Anonymous: SYSTEM_INFO_0, pub dwPageSize: u32, - pub lpMinimumApplicationAddress: *mut ::core::ffi::c_void, - pub lpMaximumApplicationAddress: *mut ::core::ffi::c_void, + pub lpMinimumApplicationAddress: *mut core::ffi::c_void, + pub lpMaximumApplicationAddress: *mut core::ffi::c_void, pub dwActiveProcessorMask: usize, pub dwNumberOfProcessors: u32, pub dwProcessorType: u32, @@ -3978,8 +3976,8 @@ pub struct SYSTEM_INFO { pub wProcessorLevel: u16, pub wProcessorRevision: u16, } -impl ::core::marker::Copy for SYSTEM_INFO {} -impl ::core::clone::Clone for SYSTEM_INFO { +impl Copy for SYSTEM_INFO {} +impl Clone for SYSTEM_INFO { fn clone(&self) -> Self { *self } @@ -3989,8 +3987,8 @@ pub union SYSTEM_INFO_0 { pub dwOemId: u32, pub Anonymous: SYSTEM_INFO_0_0, } -impl ::core::marker::Copy for SYSTEM_INFO_0 {} -impl ::core::clone::Clone for SYSTEM_INFO_0 { +impl Copy for SYSTEM_INFO_0 {} +impl Clone for SYSTEM_INFO_0 { fn clone(&self) -> Self { *self } @@ -4000,8 +3998,8 @@ pub struct SYSTEM_INFO_0_0 { pub wProcessorArchitecture: PROCESSOR_ARCHITECTURE, pub wReserved: u16, } -impl ::core::marker::Copy for SYSTEM_INFO_0_0 {} -impl ::core::clone::Clone for SYSTEM_INFO_0_0 { +impl Copy for SYSTEM_INFO_0_0 {} +impl Clone for SYSTEM_INFO_0_0 { fn clone(&self) -> Self { *self } @@ -4017,8 +4015,8 @@ pub struct TIMEVAL { pub tv_sec: i32, pub tv_usec: i32, } -impl ::core::marker::Copy for TIMEVAL {} -impl ::core::clone::Clone for TIMEVAL { +impl Copy for TIMEVAL {} +impl Clone for TIMEVAL { fn clone(&self) -> Self { *self } @@ -4054,8 +4052,8 @@ pub struct UNICODE_STRING { pub MaximumLength: u16, pub Buffer: PWSTR, } -impl ::core::marker::Copy for UNICODE_STRING {} -impl ::core::clone::Clone for UNICODE_STRING { +impl Copy for UNICODE_STRING {} +impl Clone for UNICODE_STRING { fn clone(&self) -> Self { *self } @@ -4085,8 +4083,8 @@ pub struct WIN32_FIND_DATAW { pub cFileName: [u16; 260], pub cAlternateFileName: [u16; 14], } -impl ::core::marker::Copy for WIN32_FIND_DATAW {} -impl ::core::clone::Clone for WIN32_FIND_DATAW { +impl Copy for WIN32_FIND_DATAW {} +impl Clone for WIN32_FIND_DATAW { fn clone(&self) -> Self { *self } @@ -4101,8 +4099,8 @@ pub struct WSABUF { pub len: u32, pub buf: PSTR, } -impl ::core::marker::Copy for WSABUF {} -impl ::core::clone::Clone for WSABUF { +impl Copy for WSABUF {} +impl Clone for WSABUF { fn clone(&self) -> Self { *self } @@ -4119,9 +4117,9 @@ pub struct WSADATA { pub szSystemStatus: [i8; 129], } #[cfg(any(target_arch = "aarch64", target_arch = "x86_64"))] -impl ::core::marker::Copy for WSADATA {} +impl Copy for WSADATA {} #[cfg(any(target_arch = "aarch64", target_arch = "x86_64"))] -impl ::core::clone::Clone for WSADATA { +impl Clone for WSADATA { fn clone(&self) -> Self { *self } @@ -4138,9 +4136,9 @@ pub struct WSADATA { pub lpVendorInfo: PSTR, } #[cfg(target_arch = "x86")] -impl ::core::marker::Copy for WSADATA {} +impl Copy for WSADATA {} #[cfg(target_arch = "x86")] -impl ::core::clone::Clone for WSADATA { +impl Clone for WSADATA { fn clone(&self) -> Self { *self } @@ -4204,8 +4202,8 @@ pub struct WSAPROTOCOLCHAIN { pub ChainLen: i32, pub ChainEntries: [u32; 7], } -impl ::core::marker::Copy for WSAPROTOCOLCHAIN {} -impl ::core::clone::Clone for WSAPROTOCOLCHAIN { +impl Copy for WSAPROTOCOLCHAIN {} +impl Clone for WSAPROTOCOLCHAIN { fn clone(&self) -> Self { *self } @@ -4233,8 +4231,8 @@ pub struct WSAPROTOCOL_INFOW { pub dwProviderReserved: u32, pub szProtocol: [u16; 256], } -impl ::core::marker::Copy for WSAPROTOCOL_INFOW {} -impl ::core::clone::Clone for WSAPROTOCOL_INFOW { +impl Copy for WSAPROTOCOL_INFOW {} +impl Clone for WSAPROTOCOL_INFOW { fn clone(&self) -> Self { *self } @@ -4308,9 +4306,9 @@ pub struct XSAVE_FORMAT { pub Reserved4: [u8; 96], } #[cfg(any(target_arch = "aarch64", target_arch = "x86_64"))] -impl ::core::marker::Copy for XSAVE_FORMAT {} +impl Copy for XSAVE_FORMAT {} #[cfg(any(target_arch = "aarch64", target_arch = "x86_64"))] -impl ::core::clone::Clone for XSAVE_FORMAT { +impl Clone for XSAVE_FORMAT { fn clone(&self) -> Self { *self } @@ -4336,9 +4334,9 @@ pub struct XSAVE_FORMAT { pub Reserved4: [u8; 224], } #[cfg(target_arch = "x86")] -impl ::core::marker::Copy for XSAVE_FORMAT {} +impl Copy for XSAVE_FORMAT {} #[cfg(target_arch = "x86")] -impl ::core::clone::Clone for XSAVE_FORMAT { +impl Clone for XSAVE_FORMAT { fn clone(&self) -> Self { *self } diff --git a/src/tools/generate-windows-sys/Cargo.toml b/src/tools/generate-windows-sys/Cargo.toml index ca137211f4ea..9ea26defdc48 100644 --- a/src/tools/generate-windows-sys/Cargo.toml +++ b/src/tools/generate-windows-sys/Cargo.toml @@ -4,4 +4,4 @@ version = "0.1.0" edition = "2021" [dependencies.windows-bindgen] -version = "0.54.0" +version = "0.55.0" From 6cb2f03c034bacd7fbc916381b0e9a5e5928fdc1 Mon Sep 17 00:00:00 2001 From: Chris Denton Date: Thu, 7 Mar 2024 16:12:40 +0000 Subject: [PATCH 024/103] Convert [u8] to [i8] in test --- library/std/src/fs/tests.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/library/std/src/fs/tests.rs b/library/std/src/fs/tests.rs index a65e78542bf2..65dec3863cc6 100644 --- a/library/std/src/fs/tests.rs +++ b/library/std/src/fs/tests.rs @@ -1782,6 +1782,7 @@ fn windows_unix_socket_exists() { } let mut addr = c::SOCKADDR_UN { sun_family: c::AF_UNIX, sun_path: mem::zeroed() }; let bytes = socket_path.as_os_str().as_encoded_bytes(); + let bytes = core::slice::from_raw_parts(bytes.as_ptr().cast::(), bytes.len()); addr.sun_path[..bytes.len()].copy_from_slice(bytes); let len = mem::size_of_val(&addr) as i32; let result = c::bind(socket, ptr::addr_of!(addr).cast::(), len); From 2a9d1ed538546483702622a22132f75e24f34ab9 Mon Sep 17 00:00:00 2001 From: Chris Wailes Date: Tue, 17 Oct 2023 16:18:59 -0700 Subject: [PATCH 025/103] Add `-Z external-sanitizer-runtime` This adds the unstable `-Z external-sanitizer-runtime` flag that will prevent rustc from emitting linker paths for the in-tree LLVM sanitizer runtime library. --- compiler/rustc_codegen_ssa/src/back/link.rs | 1 + compiler/rustc_session/src/options.rs | 2 ++ 2 files changed, 3 insertions(+) diff --git a/compiler/rustc_codegen_ssa/src/back/link.rs b/compiler/rustc_codegen_ssa/src/back/link.rs index e70cc9b62161..a37663b59724 100644 --- a/compiler/rustc_codegen_ssa/src/back/link.rs +++ b/compiler/rustc_codegen_ssa/src/back/link.rs @@ -1206,6 +1206,7 @@ fn add_sanitizer_libraries( // Everywhere else the runtimes are currently distributed as static // libraries which should be linked to executables only. let needs_runtime = !sess.target.is_like_android + && !sess.opts.unstable_opts.external_clangrt && match crate_type { CrateType::Executable => true, CrateType::Dylib | CrateType::Cdylib | CrateType::ProcMacro => { diff --git a/compiler/rustc_session/src/options.rs b/compiler/rustc_session/src/options.rs index 2f018fbaa867..bf7f047af5bd 100644 --- a/compiler/rustc_session/src/options.rs +++ b/compiler/rustc_session/src/options.rs @@ -1645,6 +1645,8 @@ options! { "emit the bc module with thin LTO info (default: yes)"), export_executable_symbols: bool = (false, parse_bool, [TRACKED], "export symbols from executables, as if they were dynamic libraries"), + external_clangrt: bool = (false, parse_bool, [UNTRACKED], + "rely on user specified linker commands to find clangrt"), extra_const_ub_checks: bool = (false, parse_bool, [TRACKED], "turns on more checks to detect const UB, which can be slow (default: no)"), #[rustc_lint_opt_deny_field_access("use `Session::fewer_names` instead of this field")] From bf2858a05f510b8a0317d25d7dc587afbd16acfc Mon Sep 17 00:00:00 2001 From: Chris Wailes Date: Wed, 13 Mar 2024 11:13:25 -0700 Subject: [PATCH 026/103] Split a complex conditional into separate statements --- compiler/rustc_codegen_ssa/src/back/link.rs | 36 +++++++++++++-------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/compiler/rustc_codegen_ssa/src/back/link.rs b/compiler/rustc_codegen_ssa/src/back/link.rs index a37663b59724..0491b3a26953 100644 --- a/compiler/rustc_codegen_ssa/src/back/link.rs +++ b/compiler/rustc_codegen_ssa/src/back/link.rs @@ -1201,21 +1201,29 @@ fn add_sanitizer_libraries( crate_type: CrateType, linker: &mut dyn Linker, ) { - // On macOS and Windows using MSVC the runtimes are distributed as dylibs - // which should be linked to both executables and dynamic libraries. - // Everywhere else the runtimes are currently distributed as static - // libraries which should be linked to executables only. - let needs_runtime = !sess.target.is_like_android - && !sess.opts.unstable_opts.external_clangrt - && match crate_type { - CrateType::Executable => true, - CrateType::Dylib | CrateType::Cdylib | CrateType::ProcMacro => { - sess.target.is_like_osx || sess.target.is_like_msvc - } - CrateType::Rlib | CrateType::Staticlib => false, - }; + if sess.target.is_like_android { + // Sanitizer runtime libraries are provided dynamically on Android + // targets. + return; + } - if !needs_runtime { + if sess.opts.unstable_opts.external_clangrt { + // Linking against in-tree sanitizer runtimes is disabled via + // `-Z external-clangrt` + return; + } + + // On macOS the runtimes are distributed as dylibs which should be linked to + // both executables and dynamic shared objects. On most other platforms the + // runtimes are currently distributed as static libraries which should be + // linked to executables only. + if matches!(crate_type, CrateType::Rlib | CrateType::Staticlib) { + return; + } + + if matches!(crate_type, CrateType::Dylib | CrateType::Cdylib | CrateType::ProcMacro) + && (sess.target.is_like_osx || sess.target.is_like_msvc) + { return; } From a5cb61d39ba92beb8b48d9b4dfe72ac06fa4503c Mon Sep 17 00:00:00 2001 From: beepster4096 <19316085+beepster4096@users.noreply.github.com> Date: Wed, 13 Mar 2024 12:34:29 -0700 Subject: [PATCH 027/103] cleanup prefixes iterator --- .../src/diagnostics/conflict_errors.rs | 27 ++---- compiler/rustc_borrowck/src/prefixes.rs | 89 +++++-------------- 2 files changed, 28 insertions(+), 88 deletions(-) diff --git a/compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs b/compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs index 0776f455efd9..cec79a4a3f53 100644 --- a/compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs +++ b/compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs @@ -39,7 +39,7 @@ use crate::diagnostics::conflict_errors::StorageDeadOrDrop::LocalStorageDead; use crate::diagnostics::{find_all_local_uses, CapturedMessageOpt}; use crate::{ borrow_set::BorrowData, diagnostics::Instance, prefixes::IsPrefixOf, - InitializationRequiringAction, MirBorrowckCtxt, PrefixSet, WriteKind, + InitializationRequiringAction, MirBorrowckCtxt, WriteKind, }; use super::{ @@ -114,7 +114,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> { self.buffer_error(err); } else { if let Some((reported_place, _)) = self.has_move_error(&move_out_indices) { - if self.prefixes(*reported_place, PrefixSet::All).any(|p| p == used_place) { + if used_place.is_prefix_of(*reported_place) { debug!( "report_use_of_moved_or_uninitialized place: error suppressed mois={:?}", move_out_indices @@ -1995,21 +1995,14 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> { kind: Option, ) { let drop_span = place_span.1; - let root_place = - self.prefixes(borrow.borrowed_place.as_ref(), PrefixSet::All).last().unwrap(); + let borrowed_local = borrow.borrowed_place.local; let borrow_spans = self.retrieve_borrow_spans(borrow); let borrow_span = borrow_spans.var_or_use_path_span(); - assert!(root_place.projection.is_empty()); - let proper_span = self.body.local_decls[root_place.local].source_info.span; + let proper_span = self.body.local_decls[borrowed_local].source_info.span; - let root_place_projection = self.infcx.tcx.mk_place_elems(root_place.projection); - - if self.access_place_error_reported.contains(&( - Place { local: root_place.local, projection: root_place_projection }, - borrow_span, - )) { + if self.access_place_error_reported.contains(&(Place::from(borrowed_local), borrow_span)) { debug!( "suppressing access_place error when borrow doesn't live long enough for {:?}", borrow_span @@ -2017,12 +2010,8 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> { return; } - self.access_place_error_reported.insert(( - Place { local: root_place.local, projection: root_place_projection }, - borrow_span, - )); + self.access_place_error_reported.insert((Place::from(borrowed_local), borrow_span)); - let borrowed_local = borrow.borrowed_place.local; if self.body.local_decls[borrowed_local].is_ref_to_thread_local() { let err = self.report_thread_local_value_does_not_live_long_enough(drop_span, borrow_span); @@ -2544,9 +2533,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> { }; (format!("{local_kind}`{place_desc}`"), format!("`{place_desc}` is borrowed here")) } else { - let root_place = - self.prefixes(borrow.borrowed_place.as_ref(), PrefixSet::All).last().unwrap(); - let local = root_place.local; + let local = borrow.borrowed_place.local; match self.body.local_kind(local) { LocalKind::Arg => ( "function parameter".to_string(), diff --git a/compiler/rustc_borrowck/src/prefixes.rs b/compiler/rustc_borrowck/src/prefixes.rs index 8bb3dc88b346..8a3a089d0eeb 100644 --- a/compiler/rustc_borrowck/src/prefixes.rs +++ b/compiler/rustc_borrowck/src/prefixes.rs @@ -1,7 +1,4 @@ -//! From the NLL RFC: "The deep [aka 'supporting'] prefixes for an -//! place are formed by stripping away fields and derefs, except that -//! we stop when we reach the deref of a shared reference. [...] " -//! +//! From the NLL RFC: //! "Shallow prefixes are found by stripping away fields, but stop at //! any dereference. So: writing a path like `a` is illegal if `a.b` //! is borrowed. But: writing `a` is legal if `*a` is borrowed, @@ -9,9 +6,7 @@ use super::MirBorrowckCtxt; -use rustc_hir as hir; -use rustc_middle::mir::{Body, PlaceRef, ProjectionElem}; -use rustc_middle::ty::{self, TyCtxt}; +use rustc_middle::mir::{PlaceRef, ProjectionElem}; pub trait IsPrefixOf<'tcx> { fn is_prefix_of(&self, other: PlaceRef<'tcx>) -> bool; @@ -25,9 +20,7 @@ impl<'tcx> IsPrefixOf<'tcx> for PlaceRef<'tcx> { } } -pub(super) struct Prefixes<'cx, 'tcx> { - body: &'cx Body<'tcx>, - tcx: TyCtxt<'tcx>, +pub(super) struct Prefixes<'tcx> { kind: PrefixSet, next: Option>, } @@ -39,24 +32,18 @@ pub(super) enum PrefixSet { All, /// Stops at any dereference. Shallow, - /// Stops at the deref of a shared reference. - Supporting, } impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> { /// Returns an iterator over the prefixes of `place` /// (inclusive) from longest to smallest, potentially /// terminating the iteration early based on `kind`. - pub(super) fn prefixes( - &self, - place_ref: PlaceRef<'tcx>, - kind: PrefixSet, - ) -> Prefixes<'cx, 'tcx> { - Prefixes { next: Some(place_ref), kind, body: self.body, tcx: self.infcx.tcx } + pub(super) fn prefixes(&self, place_ref: PlaceRef<'tcx>, kind: PrefixSet) -> Prefixes<'tcx> { + Prefixes { next: Some(place_ref), kind } } } -impl<'cx, 'tcx> Iterator for Prefixes<'cx, 'tcx> { +impl<'tcx> Iterator for Prefixes<'tcx> { type Item = PlaceRef<'tcx>; fn next(&mut self) -> Option { let mut cursor = self.next?; @@ -91,57 +78,23 @@ impl<'cx, 'tcx> Iterator for Prefixes<'cx, 'tcx> { panic!("Subtype projection is not allowed before borrow check") } ProjectionElem::Deref => { - // (handled below) + match self.kind { + PrefixSet::Shallow => { + // Shallow prefixes are found by stripping away + // fields, but stop at *any* dereference. + // So we can just stop the traversal now. + self.next = None; + return Some(cursor); + } + PrefixSet::All => { + // All prefixes: just blindly enqueue the base + // of the projection. + self.next = Some(cursor_base); + return Some(cursor); + } + } } } - - assert_eq!(elem, ProjectionElem::Deref); - - match self.kind { - PrefixSet::Shallow => { - // Shallow prefixes are found by stripping away - // fields, but stop at *any* dereference. - // So we can just stop the traversal now. - self.next = None; - return Some(cursor); - } - PrefixSet::All => { - // All prefixes: just blindly enqueue the base - // of the projection. - self.next = Some(cursor_base); - return Some(cursor); - } - PrefixSet::Supporting => { - // Fall through! - } - } - - assert_eq!(self.kind, PrefixSet::Supporting); - // Supporting prefixes: strip away fields and - // derefs, except we stop at the deref of a shared - // reference. - - let ty = cursor_base.ty(self.body, self.tcx).ty; - match ty.kind() { - ty::RawPtr(_) | ty::Ref(_ /*rgn*/, _ /*ty*/, hir::Mutability::Not) => { - // don't continue traversing over derefs of raw pointers or shared - // borrows. - self.next = None; - return Some(cursor); - } - - ty::Ref(_ /*rgn*/, _ /*ty*/, hir::Mutability::Mut) => { - self.next = Some(cursor_base); - return Some(cursor); - } - - ty::Adt(..) if ty.is_box() => { - self.next = Some(cursor_base); - return Some(cursor); - } - - _ => panic!("unknown type fed to Projection Deref."), - } } } } From 2d3435b4df844bb0c25b86bb73519a3c867a92a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Sat, 9 Mar 2024 20:18:43 +0000 Subject: [PATCH 028/103] Detect calls to `.clone()` on `T: !Clone` types on borrowck errors When encountering a lifetime error on a type that *holds* a type that doesn't implement `Clone`, explore the item's body for potential calls to `.clone()` that are only cloning the reference `&T` instead of `T` because `T: !Clone`. If we find this, suggest `T: Clone`. ``` error[E0502]: cannot borrow `*list` as mutable because it is also borrowed as immutable --> $DIR/clone-on-ref.rs:7:5 | LL | for v in list.iter() { | ---- immutable borrow occurs here LL | cloned_items.push(v.clone()) | ------- this call doesn't do anything, the result is still `&T` because `T` doesn't implement `Clone` LL | } LL | list.push(T::default()); | ^^^^^^^^^^^^^^^^^^^^^^^ mutable borrow occurs here LL | LL | drop(cloned_items); | ------------ immutable borrow later used here | help: consider further restricting this bound | LL | fn foo(list: &mut Vec) { | +++++++ ``` ``` error[E0505]: cannot move out of `x` because it is borrowed --> $DIR/clone-on-ref.rs:23:10 | LL | fn qux(x: A) { | - binding `x` declared here LL | let a = &x; | -- borrow of `x` occurs here LL | let b = a.clone(); | ------- this call doesn't do anything, the result is still `&A` because `A` doesn't implement `Clone` LL | drop(x); | ^ move out of `x` occurs here LL | LL | println!("{b:?}"); | ----- borrow later used here | help: consider annotating `A` with `#[derive(Clone)]` | LL + #[derive(Clone)] LL | struct A; | ``` --- .../src/diagnostics/conflict_errors.rs | 113 ++++++++++++++++-- tests/ui/borrowck/clone-on-ref.fixed | 32 +++++ tests/ui/borrowck/clone-on-ref.rs | 31 +++++ tests/ui/borrowck/clone-on-ref.stderr | 64 ++++++++++ 4 files changed, 233 insertions(+), 7 deletions(-) create mode 100644 tests/ui/borrowck/clone-on-ref.fixed create mode 100644 tests/ui/borrowck/clone-on-ref.rs create mode 100644 tests/ui/borrowck/clone-on-ref.stderr diff --git a/compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs b/compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs index 0776f455efd9..fcbad4724752 100644 --- a/compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs +++ b/compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs @@ -12,7 +12,6 @@ use rustc_hir::def::{DefKind, Res}; use rustc_hir::intravisit::{walk_block, walk_expr, Visitor}; use rustc_hir::{CoroutineDesugaring, PatField}; use rustc_hir::{CoroutineKind, CoroutineSource, LangItem}; -use rustc_infer::traits::ObligationCause; use rustc_middle::hir::nested_filter::OnlyBodies; use rustc_middle::mir::tcx::PlaceTy; use rustc_middle::mir::{ @@ -21,16 +20,21 @@ use rustc_middle::mir::{ PlaceRef, ProjectionElem, Rvalue, Statement, StatementKind, Terminator, TerminatorKind, VarBindingForm, }; -use rustc_middle::ty::{self, suggest_constraining_type_params, PredicateKind, Ty, TyCtxt}; +use rustc_middle::ty::{ + self, suggest_constraining_type_params, PredicateKind, ToPredicate, Ty, TyCtxt, + TypeSuperVisitable, TypeVisitor, +}; use rustc_middle::util::CallKind; use rustc_mir_dataflow::move_paths::{InitKind, MoveOutIndex, MovePathIndex}; +use rustc_span::def_id::DefId; use rustc_span::def_id::LocalDefId; use rustc_span::hygiene::DesugaringKind; use rustc_span::symbol::{kw, sym, Ident}; use rustc_span::{BytePos, Span, Symbol}; use rustc_trait_selection::infer::InferCtxtExt; +use rustc_trait_selection::traits::error_reporting::suggestions::TypeErrCtxtExt; use rustc_trait_selection::traits::error_reporting::FindExprBySpan; -use rustc_trait_selection::traits::ObligationCtxt; +use rustc_trait_selection::traits::{Obligation, ObligationCause, ObligationCtxt}; use std::iter; use crate::borrow_set::TwoPhaseActivation; @@ -283,7 +287,8 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> { // something that already has `Fn`-like bounds (or is a closure), so we can't // restrict anyways. } else { - self.suggest_adding_copy_bounds(&mut err, ty, span); + let copy_did = self.infcx.tcx.require_lang_item(LangItem::Copy, Some(span)); + self.suggest_adding_bounds(&mut err, ty, copy_did, span); } if needs_note { @@ -775,7 +780,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> { } } - fn suggest_adding_copy_bounds(&self, err: &mut Diag<'_>, ty: Ty<'tcx>, span: Span) { + fn suggest_adding_bounds(&self, err: &mut Diag<'_>, ty: Ty<'tcx>, def_id: DefId, span: Span) { let tcx = self.infcx.tcx; let generics = tcx.generics_of(self.mir_def_id()); @@ -788,10 +793,9 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> { }; // Try to find predicates on *generic params* that would allow copying `ty` let ocx = ObligationCtxt::new(self.infcx); - let copy_did = tcx.require_lang_item(LangItem::Copy, Some(span)); let cause = ObligationCause::misc(span, self.mir_def_id()); - ocx.register_bound(cause, self.param_env, ty, copy_did); + ocx.register_bound(cause, self.param_env, ty, def_id); let errors = ocx.select_all_or_error(); // Only emit suggestion if all required predicates are on generic @@ -877,6 +881,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> { Some(borrow_span), None, ); + self.suggest_copy_for_type_in_cloned_ref(&mut err, place); self.buffer_error(err); } @@ -1215,10 +1220,104 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> { ); self.suggest_using_local_if_applicable(&mut err, location, issued_borrow, explanation); + self.suggest_copy_for_type_in_cloned_ref(&mut err, place); err } + fn suggest_copy_for_type_in_cloned_ref(&self, err: &mut Diag<'tcx>, place: Place<'tcx>) { + let tcx = self.infcx.tcx; + let hir = tcx.hir(); + let Some(body_id) = tcx.hir_node(self.mir_hir_id()).body_id() else { return }; + struct FindUselessClone<'hir> { + pub clones: Vec<&'hir hir::Expr<'hir>>, + } + impl<'hir> FindUselessClone<'hir> { + pub fn new() -> Self { + Self { clones: vec![] } + } + } + + impl<'v> Visitor<'v> for FindUselessClone<'v> { + fn visit_expr(&mut self, ex: &'v hir::Expr<'v>) { + // FIXME: use `lookup_method_for_diagnostic`? + if let hir::ExprKind::MethodCall(segment, _rcvr, args, _span) = ex.kind + && segment.ident.name == sym::clone + && args.len() == 0 + { + self.clones.push(ex); + } + hir::intravisit::walk_expr(self, ex); + } + } + let mut expr_finder = FindUselessClone::new(); + + let body = hir.body(body_id).value; + expr_finder.visit_expr(body); + + pub struct Holds<'tcx> { + ty: Ty<'tcx>, + holds: bool, + } + + impl<'tcx> TypeVisitor> for Holds<'tcx> { + type Result = std::ops::ControlFlow<()>; + + fn visit_ty(&mut self, t: Ty<'tcx>) -> Self::Result { + if t == self.ty { + self.holds = true; + } + t.super_visit_with(self) + } + } + + let mut types_to_constrain = FxIndexSet::default(); + + let local_ty = self.body.local_decls[place.local].ty; + let typeck_results = tcx.typeck(self.mir_def_id()); + let clone = tcx.require_lang_item(LangItem::Clone, Some(body.span)); + for expr in expr_finder.clones { + if let hir::ExprKind::MethodCall(_, rcvr, _, span) = expr.kind + && let Some(rcvr_ty) = typeck_results.node_type_opt(rcvr.hir_id) + && let Some(ty) = typeck_results.node_type_opt(expr.hir_id) + && rcvr_ty == ty + && let ty::Ref(_, inner, _) = rcvr_ty.kind() + && let inner = inner.peel_refs() + && let mut v = (Holds { ty: inner, holds: false }) + && let _ = v.visit_ty(local_ty) + && v.holds + && let None = self.infcx.type_implements_trait_shallow(clone, inner, self.param_env) + { + err.span_label( + span, + format!( + "this call doesn't do anything, the result is still `{rcvr_ty}` \ + because `{inner}` doesn't implement `Clone`", + ), + ); + types_to_constrain.insert(inner); + } + } + for ty in types_to_constrain { + self.suggest_adding_bounds(err, ty, clone, body.span); + if let ty::Adt(..) = ty.kind() { + // The type doesn't implement Clone. + let trait_ref = ty::Binder::dummy(ty::TraitRef::new(self.infcx.tcx, clone, [ty])); + let obligation = Obligation::new( + self.infcx.tcx, + ObligationCause::dummy(), + self.param_env, + trait_ref, + ); + self.infcx.err_ctxt().suggest_derive( + &obligation, + err, + trait_ref.to_predicate(self.infcx.tcx), + ); + } + } + } + #[instrument(level = "debug", skip(self, err))] fn suggest_using_local_if_applicable( &self, diff --git a/tests/ui/borrowck/clone-on-ref.fixed b/tests/ui/borrowck/clone-on-ref.fixed new file mode 100644 index 000000000000..b6927ba590e3 --- /dev/null +++ b/tests/ui/borrowck/clone-on-ref.fixed @@ -0,0 +1,32 @@ +//@ run-rustfix +fn foo(list: &mut Vec) { + let mut cloned_items = Vec::new(); + for v in list.iter() { + cloned_items.push(v.clone()) + } + list.push(T::default()); + //~^ ERROR cannot borrow `*list` as mutable because it is also borrowed as immutable + drop(cloned_items); +} +fn bar(x: T) { + let a = &x; + let b = a.clone(); + drop(x); + //~^ ERROR cannot move out of `x` because it is borrowed + println!("{b}"); +} +#[derive(Debug)] +#[derive(Clone)] +struct A; +fn qux(x: A) { + let a = &x; + let b = a.clone(); + drop(x); + //~^ ERROR cannot move out of `x` because it is borrowed + println!("{b:?}"); +} +fn main() { + foo(&mut vec![1, 2, 3]); + bar(""); + qux(A); +} diff --git a/tests/ui/borrowck/clone-on-ref.rs b/tests/ui/borrowck/clone-on-ref.rs new file mode 100644 index 000000000000..f8c94d3cce31 --- /dev/null +++ b/tests/ui/borrowck/clone-on-ref.rs @@ -0,0 +1,31 @@ +//@ run-rustfix +fn foo(list: &mut Vec) { + let mut cloned_items = Vec::new(); + for v in list.iter() { + cloned_items.push(v.clone()) + } + list.push(T::default()); + //~^ ERROR cannot borrow `*list` as mutable because it is also borrowed as immutable + drop(cloned_items); +} +fn bar(x: T) { + let a = &x; + let b = a.clone(); + drop(x); + //~^ ERROR cannot move out of `x` because it is borrowed + println!("{b}"); +} +#[derive(Debug)] +struct A; +fn qux(x: A) { + let a = &x; + let b = a.clone(); + drop(x); + //~^ ERROR cannot move out of `x` because it is borrowed + println!("{b:?}"); +} +fn main() { + foo(&mut vec![1, 2, 3]); + bar(""); + qux(A); +} diff --git a/tests/ui/borrowck/clone-on-ref.stderr b/tests/ui/borrowck/clone-on-ref.stderr new file mode 100644 index 000000000000..ee4fcadf55ae --- /dev/null +++ b/tests/ui/borrowck/clone-on-ref.stderr @@ -0,0 +1,64 @@ +error[E0502]: cannot borrow `*list` as mutable because it is also borrowed as immutable + --> $DIR/clone-on-ref.rs:7:5 + | +LL | for v in list.iter() { + | ---- immutable borrow occurs here +LL | cloned_items.push(v.clone()) + | ------- this call doesn't do anything, the result is still `&T` because `T` doesn't implement `Clone` +LL | } +LL | list.push(T::default()); + | ^^^^^^^^^^^^^^^^^^^^^^^ mutable borrow occurs here +LL | +LL | drop(cloned_items); + | ------------ immutable borrow later used here + | +help: consider further restricting this bound + | +LL | fn foo(list: &mut Vec) { + | +++++++ + +error[E0505]: cannot move out of `x` because it is borrowed + --> $DIR/clone-on-ref.rs:14:10 + | +LL | fn bar(x: T) { + | - binding `x` declared here +LL | let a = &x; + | -- borrow of `x` occurs here +LL | let b = a.clone(); + | ------- this call doesn't do anything, the result is still `&T` because `T` doesn't implement `Clone` +LL | drop(x); + | ^ move out of `x` occurs here +LL | +LL | println!("{b}"); + | --- borrow later used here + | +help: consider further restricting this bound + | +LL | fn bar(x: T) { + | +++++++ + +error[E0505]: cannot move out of `x` because it is borrowed + --> $DIR/clone-on-ref.rs:23:10 + | +LL | fn qux(x: A) { + | - binding `x` declared here +LL | let a = &x; + | -- borrow of `x` occurs here +LL | let b = a.clone(); + | ------- this call doesn't do anything, the result is still `&A` because `A` doesn't implement `Clone` +LL | drop(x); + | ^ move out of `x` occurs here +LL | +LL | println!("{b:?}"); + | ----- borrow later used here + | +help: consider annotating `A` with `#[derive(Clone)]` + | +LL + #[derive(Clone)] +LL | struct A; + | + +error: aborting due to 3 previous errors + +Some errors have detailed explanations: E0502, E0505. +For more information about an error, try `rustc --explain E0502`. From b367c25367117a4ada5c9a1c807b74f0efcf6d51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Sat, 9 Mar 2024 20:32:13 +0000 Subject: [PATCH 029/103] Tweak wording --- compiler/rustc_mir_build/messages.ftl | 2 +- ...can-live-while-the-other-survives-1.stderr | 4 +- ...t-by-move-and-ref-inverse-promotion.stderr | 2 +- ...orrowck-pat-by-move-and-ref-inverse.stderr | 50 +++++++++---------- .../borrowck-pat-ref-mut-twice.stderr | 8 +-- ...inding-modes-both-sides-independent.stderr | 2 +- .../ui/suggestions/ref-pattern-binding.stderr | 4 +- 7 files changed, 36 insertions(+), 36 deletions(-) diff --git a/compiler/rustc_mir_build/messages.ftl b/compiler/rustc_mir_build/messages.ftl index 8a6ccdb85782..1de691f32a70 100644 --- a/compiler/rustc_mir_build/messages.ftl +++ b/compiler/rustc_mir_build/messages.ftl @@ -24,7 +24,7 @@ mir_build_borrow_of_layout_constrained_field_requires_unsafe_unsafe_op_in_unsafe mir_build_borrow_of_moved_value = borrow of moved value .label = value moved into `{$name}` here - .occurs_because_label = move occurs because `{$name}` has type `{$ty}` which does not implement the `Copy` trait + .occurs_because_label = move occurs because `{$name}` has type `{$ty}`, which does not implement the `Copy` trait .value_borrowed_label = value borrowed here after move .suggestion = borrow this binding in the pattern to avoid moving the value diff --git a/tests/ui/pattern/bindings-after-at/bind-by-move-neither-can-live-while-the-other-survives-1.stderr b/tests/ui/pattern/bindings-after-at/bind-by-move-neither-can-live-while-the-other-survives-1.stderr index 25838fbf0abd..16a93a0d47d2 100644 --- a/tests/ui/pattern/bindings-after-at/bind-by-move-neither-can-live-while-the-other-survives-1.stderr +++ b/tests/ui/pattern/bindings-after-at/bind-by-move-neither-can-live-while-the-other-survives-1.stderr @@ -13,7 +13,7 @@ LL | Some(_z @ ref _y) => {} | ^^ ------ value borrowed here after move | | | value moved into `_z` here - | move occurs because `_z` has type `X` which does not implement the `Copy` trait + | move occurs because `_z` has type `X`, which does not implement the `Copy` trait | help: borrow this binding in the pattern to avoid moving the value | @@ -35,7 +35,7 @@ LL | Some(_z @ ref mut _y) => {} | ^^ ---------- value borrowed here after move | | | value moved into `_z` here - | move occurs because `_z` has type `X` which does not implement the `Copy` trait + | move occurs because `_z` has type `X`, which does not implement the `Copy` trait | help: borrow this binding in the pattern to avoid moving the value | diff --git a/tests/ui/pattern/bindings-after-at/borrowck-pat-by-move-and-ref-inverse-promotion.stderr b/tests/ui/pattern/bindings-after-at/borrowck-pat-by-move-and-ref-inverse-promotion.stderr index 815a4ade9956..ea04d4bc055a 100644 --- a/tests/ui/pattern/bindings-after-at/borrowck-pat-by-move-and-ref-inverse-promotion.stderr +++ b/tests/ui/pattern/bindings-after-at/borrowck-pat-by-move-and-ref-inverse-promotion.stderr @@ -5,7 +5,7 @@ LL | let a @ ref b = U; | ^ ----- value borrowed here after move | | | value moved into `a` here - | move occurs because `a` has type `U` which does not implement the `Copy` trait + | move occurs because `a` has type `U`, which does not implement the `Copy` trait | help: borrow this binding in the pattern to avoid moving the value | diff --git a/tests/ui/pattern/bindings-after-at/borrowck-pat-by-move-and-ref-inverse.stderr b/tests/ui/pattern/bindings-after-at/borrowck-pat-by-move-and-ref-inverse.stderr index fd7a51388bc1..25c940a3200a 100644 --- a/tests/ui/pattern/bindings-after-at/borrowck-pat-by-move-and-ref-inverse.stderr +++ b/tests/ui/pattern/bindings-after-at/borrowck-pat-by-move-and-ref-inverse.stderr @@ -5,7 +5,7 @@ LL | let a @ ref b = U; | ^ ----- value borrowed here after move | | | value moved into `a` here - | move occurs because `a` has type `U` which does not implement the `Copy` trait + | move occurs because `a` has type `U`, which does not implement the `Copy` trait | help: borrow this binding in the pattern to avoid moving the value | @@ -20,7 +20,7 @@ LL | let a @ (mut b @ ref mut c, d @ ref e) = (U, U); | | | | | value borrowed here after move | value moved into `a` here - | move occurs because `a` has type `(U, U)` which does not implement the `Copy` trait + | move occurs because `a` has type `(U, U)`, which does not implement the `Copy` trait | help: borrow this binding in the pattern to avoid moving the value | @@ -34,7 +34,7 @@ LL | let a @ (mut b @ ref mut c, d @ ref e) = (U, U); | ^^^^^ --------- value borrowed here after move | | | value moved into `b` here - | move occurs because `b` has type `U` which does not implement the `Copy` trait + | move occurs because `b` has type `U`, which does not implement the `Copy` trait | help: borrow this binding in the pattern to avoid moving the value | @@ -48,7 +48,7 @@ LL | let a @ (mut b @ ref mut c, d @ ref e) = (U, U); | ^ ----- value borrowed here after move | | | value moved into `d` here - | move occurs because `d` has type `U` which does not implement the `Copy` trait + | move occurs because `d` has type `U`, which does not implement the `Copy` trait | help: borrow this binding in the pattern to avoid moving the value | @@ -63,7 +63,7 @@ LL | let a @ [ref mut b, ref c] = [U, U]; | | | | | value borrowed here after move | value moved into `a` here - | move occurs because `a` has type `[U; 2]` which does not implement the `Copy` trait + | move occurs because `a` has type `[U; 2]`, which does not implement the `Copy` trait | help: borrow this binding in the pattern to avoid moving the value | @@ -77,7 +77,7 @@ LL | let a @ ref b = u(); | ^ ----- value borrowed here after move | | | value moved into `a` here - | move occurs because `a` has type `U` which does not implement the `Copy` trait + | move occurs because `a` has type `U`, which does not implement the `Copy` trait | help: borrow this binding in the pattern to avoid moving the value | @@ -92,7 +92,7 @@ LL | let a @ (mut b @ ref mut c, d @ ref e) = (u(), u()); | | | | | value borrowed here after move | value moved into `a` here - | move occurs because `a` has type `(U, U)` which does not implement the `Copy` trait + | move occurs because `a` has type `(U, U)`, which does not implement the `Copy` trait | help: borrow this binding in the pattern to avoid moving the value | @@ -106,7 +106,7 @@ LL | let a @ (mut b @ ref mut c, d @ ref e) = (u(), u()); | ^^^^^ --------- value borrowed here after move | | | value moved into `b` here - | move occurs because `b` has type `U` which does not implement the `Copy` trait + | move occurs because `b` has type `U`, which does not implement the `Copy` trait | help: borrow this binding in the pattern to avoid moving the value | @@ -120,7 +120,7 @@ LL | let a @ (mut b @ ref mut c, d @ ref e) = (u(), u()); | ^ ----- value borrowed here after move | | | value moved into `d` here - | move occurs because `d` has type `U` which does not implement the `Copy` trait + | move occurs because `d` has type `U`, which does not implement the `Copy` trait | help: borrow this binding in the pattern to avoid moving the value | @@ -135,7 +135,7 @@ LL | let a @ [ref mut b, ref c] = [u(), u()]; | | | | | value borrowed here after move | value moved into `a` here - | move occurs because `a` has type `[U; 2]` which does not implement the `Copy` trait + | move occurs because `a` has type `[U; 2]`, which does not implement the `Copy` trait | help: borrow this binding in the pattern to avoid moving the value | @@ -149,7 +149,7 @@ LL | a @ Some(ref b) => {} | ^ ----- value borrowed here after move | | | value moved into `a` here - | move occurs because `a` has type `Option` which does not implement the `Copy` trait + | move occurs because `a` has type `Option`, which does not implement the `Copy` trait | help: borrow this binding in the pattern to avoid moving the value | @@ -164,7 +164,7 @@ LL | a @ Some((mut b @ ref mut c, d @ ref e)) => {} | | | | | value borrowed here after move | value moved into `a` here - | move occurs because `a` has type `Option<(U, U)>` which does not implement the `Copy` trait + | move occurs because `a` has type `Option<(U, U)>`, which does not implement the `Copy` trait | help: borrow this binding in the pattern to avoid moving the value | @@ -178,7 +178,7 @@ LL | a @ Some((mut b @ ref mut c, d @ ref e)) => {} | ^^^^^ --------- value borrowed here after move | | | value moved into `b` here - | move occurs because `b` has type `U` which does not implement the `Copy` trait + | move occurs because `b` has type `U`, which does not implement the `Copy` trait | help: borrow this binding in the pattern to avoid moving the value | @@ -192,7 +192,7 @@ LL | a @ Some((mut b @ ref mut c, d @ ref e)) => {} | ^ ----- value borrowed here after move | | | value moved into `d` here - | move occurs because `d` has type `U` which does not implement the `Copy` trait + | move occurs because `d` has type `U`, which does not implement the `Copy` trait | help: borrow this binding in the pattern to avoid moving the value | @@ -207,7 +207,7 @@ LL | mut a @ Some([ref b, ref mut c]) => {} | | | | | value borrowed here after move | value moved into `a` here - | move occurs because `a` has type `Option<[U; 2]>` which does not implement the `Copy` trait + | move occurs because `a` has type `Option<[U; 2]>`, which does not implement the `Copy` trait | help: borrow this binding in the pattern to avoid moving the value | @@ -221,7 +221,7 @@ LL | a @ Some(ref b) => {} | ^ ----- value borrowed here after move | | | value moved into `a` here - | move occurs because `a` has type `Option` which does not implement the `Copy` trait + | move occurs because `a` has type `Option`, which does not implement the `Copy` trait | help: borrow this binding in the pattern to avoid moving the value | @@ -236,7 +236,7 @@ LL | a @ Some((mut b @ ref mut c, d @ ref e)) => {} | | | | | value borrowed here after move | value moved into `a` here - | move occurs because `a` has type `Option<(U, U)>` which does not implement the `Copy` trait + | move occurs because `a` has type `Option<(U, U)>`, which does not implement the `Copy` trait | help: borrow this binding in the pattern to avoid moving the value | @@ -250,7 +250,7 @@ LL | a @ Some((mut b @ ref mut c, d @ ref e)) => {} | ^^^^^ --------- value borrowed here after move | | | value moved into `b` here - | move occurs because `b` has type `U` which does not implement the `Copy` trait + | move occurs because `b` has type `U`, which does not implement the `Copy` trait | help: borrow this binding in the pattern to avoid moving the value | @@ -264,7 +264,7 @@ LL | a @ Some((mut b @ ref mut c, d @ ref e)) => {} | ^ ----- value borrowed here after move | | | value moved into `d` here - | move occurs because `d` has type `U` which does not implement the `Copy` trait + | move occurs because `d` has type `U`, which does not implement the `Copy` trait | help: borrow this binding in the pattern to avoid moving the value | @@ -279,7 +279,7 @@ LL | mut a @ Some([ref b, ref mut c]) => {} | | | | | value borrowed here after move | value moved into `a` here - | move occurs because `a` has type `Option<[U; 2]>` which does not implement the `Copy` trait + | move occurs because `a` has type `Option<[U; 2]>`, which does not implement the `Copy` trait | help: borrow this binding in the pattern to avoid moving the value | @@ -349,7 +349,7 @@ LL | fn f1(a @ ref b: U) {} | ^ ----- value borrowed here after move | | | value moved into `a` here - | move occurs because `a` has type `U` which does not implement the `Copy` trait + | move occurs because `a` has type `U`, which does not implement the `Copy` trait | help: borrow this binding in the pattern to avoid moving the value | @@ -364,7 +364,7 @@ LL | fn f2(mut a @ (b @ ref c, mut d @ ref e): (U, U)) {} | | | | | value borrowed here after move | value moved into `a` here - | move occurs because `a` has type `(U, U)` which does not implement the `Copy` trait + | move occurs because `a` has type `(U, U)`, which does not implement the `Copy` trait | help: borrow this binding in the pattern to avoid moving the value | @@ -378,7 +378,7 @@ LL | fn f2(mut a @ (b @ ref c, mut d @ ref e): (U, U)) {} | ^ ----- value borrowed here after move | | | value moved into `b` here - | move occurs because `b` has type `U` which does not implement the `Copy` trait + | move occurs because `b` has type `U`, which does not implement the `Copy` trait | help: borrow this binding in the pattern to avoid moving the value | @@ -392,7 +392,7 @@ LL | fn f2(mut a @ (b @ ref c, mut d @ ref e): (U, U)) {} | ^^^^^ ----- value borrowed here after move | | | value moved into `d` here - | move occurs because `d` has type `U` which does not implement the `Copy` trait + | move occurs because `d` has type `U`, which does not implement the `Copy` trait | help: borrow this binding in the pattern to avoid moving the value | @@ -417,7 +417,7 @@ LL | fn f3(a @ [ref mut b, ref c]: [U; 2]) {} | | | | | value borrowed here after move | value moved into `a` here - | move occurs because `a` has type `[U; 2]` which does not implement the `Copy` trait + | move occurs because `a` has type `[U; 2]`, which does not implement the `Copy` trait | help: borrow this binding in the pattern to avoid moving the value | diff --git a/tests/ui/pattern/bindings-after-at/borrowck-pat-ref-mut-twice.stderr b/tests/ui/pattern/bindings-after-at/borrowck-pat-ref-mut-twice.stderr index 3446148d2b15..76085f897ff5 100644 --- a/tests/ui/pattern/bindings-after-at/borrowck-pat-ref-mut-twice.stderr +++ b/tests/ui/pattern/bindings-after-at/borrowck-pat-ref-mut-twice.stderr @@ -78,7 +78,7 @@ LL | let a @ (ref mut b, ref mut c) = (U, U); | | | | | value borrowed here after move | value moved into `a` here - | move occurs because `a` has type `(U, U)` which does not implement the `Copy` trait + | move occurs because `a` has type `(U, U)`, which does not implement the `Copy` trait | help: borrow this binding in the pattern to avoid moving the value | @@ -94,7 +94,7 @@ LL | let a @ (b, [c, d]) = &mut val; // Same as ^-- | | | value borrowed here after move | | value borrowed here after move | value moved into `a` here - | move occurs because `a` has type `&mut (U, [U; 2])` which does not implement the `Copy` trait + | move occurs because `a` has type `&mut (U, [U; 2])`, which does not implement the `Copy` trait | help: borrow this binding in the pattern to avoid moving the value | @@ -108,7 +108,7 @@ LL | let a @ &mut ref mut b = &mut U; | ^ --------- value borrowed here after move | | | value moved into `a` here - | move occurs because `a` has type `&mut U` which does not implement the `Copy` trait + | move occurs because `a` has type `&mut U`, which does not implement the `Copy` trait | help: borrow this binding in the pattern to avoid moving the value | @@ -123,7 +123,7 @@ LL | let a @ &mut (ref mut b, ref mut c) = &mut (U, U); | | | | | value borrowed here after move | value moved into `a` here - | move occurs because `a` has type `&mut (U, U)` which does not implement the `Copy` trait + | move occurs because `a` has type `&mut (U, U)`, which does not implement the `Copy` trait | help: borrow this binding in the pattern to avoid moving the value | diff --git a/tests/ui/pattern/bindings-after-at/default-binding-modes-both-sides-independent.stderr b/tests/ui/pattern/bindings-after-at/default-binding-modes-both-sides-independent.stderr index 36515c1a29bb..a0a43e83a6a0 100644 --- a/tests/ui/pattern/bindings-after-at/default-binding-modes-both-sides-independent.stderr +++ b/tests/ui/pattern/bindings-after-at/default-binding-modes-both-sides-independent.stderr @@ -29,7 +29,7 @@ LL | Ok(ref a @ b) | Err(b @ ref a) => { | ^ ----- value borrowed here after move | | | value moved into `b` here - | move occurs because `b` has type `NotCopy` which does not implement the `Copy` trait + | move occurs because `b` has type `NotCopy`, which does not implement the `Copy` trait | help: borrow this binding in the pattern to avoid moving the value | diff --git a/tests/ui/suggestions/ref-pattern-binding.stderr b/tests/ui/suggestions/ref-pattern-binding.stderr index 69ce5d440af8..af21c6aef700 100644 --- a/tests/ui/suggestions/ref-pattern-binding.stderr +++ b/tests/ui/suggestions/ref-pattern-binding.stderr @@ -5,7 +5,7 @@ LL | let _moved @ ref _from = String::from("foo"); | ^^^^^^ --------- value borrowed here after move | | | value moved into `_moved` here - | move occurs because `_moved` has type `String` which does not implement the `Copy` trait + | move occurs because `_moved` has type `String`, which does not implement the `Copy` trait | help: borrow this binding in the pattern to avoid moving the value | @@ -35,7 +35,7 @@ LL | let _moved @ S { ref f } = S { f: String::from("foo") }; | ^^^^^^ ----- value borrowed here after move | | | value moved into `_moved` here - | move occurs because `_moved` has type `S` which does not implement the `Copy` trait + | move occurs because `_moved` has type `S`, which does not implement the `Copy` trait | help: borrow this binding in the pattern to avoid moving the value | From 0953608debfa9d3df955f976e7bc857584ba1ed0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Tue, 12 Mar 2024 17:21:15 +0000 Subject: [PATCH 030/103] Account for UnOps in borrowck message --- compiler/rustc_borrowck/messages.ftl | 3 +++ compiler/rustc_borrowck/src/diagnostics/mod.rs | 11 +++++++++-- compiler/rustc_borrowck/src/session_diagnostics.rs | 5 +++++ tests/ui/unop-move-semantics.stderr | 4 ++-- 4 files changed, 19 insertions(+), 4 deletions(-) diff --git a/compiler/rustc_borrowck/messages.ftl b/compiler/rustc_borrowck/messages.ftl index bf14d5eb9a0a..f2ca509e14bb 100644 --- a/compiler/rustc_borrowck/messages.ftl +++ b/compiler/rustc_borrowck/messages.ftl @@ -16,6 +16,9 @@ borrowck_borrow_due_to_use_closure = borrowck_borrow_due_to_use_coroutine = borrow occurs due to use in coroutine +borrowck_calling_operator_moves = + calling this operator moves the value + borrowck_calling_operator_moves_lhs = calling this operator moves the left-hand side diff --git a/compiler/rustc_borrowck/src/diagnostics/mod.rs b/compiler/rustc_borrowck/src/diagnostics/mod.rs index 4ebbe592628a..914f68a38b4f 100644 --- a/compiler/rustc_borrowck/src/diagnostics/mod.rs +++ b/compiler/rustc_borrowck/src/diagnostics/mod.rs @@ -1050,7 +1050,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> { ); err.subdiagnostic(self.dcx(), CaptureReasonNote::FnOnceMoveInCall { var_span }); } - CallKind::Operator { self_arg, .. } => { + CallKind::Operator { self_arg, trait_id, .. } => { let self_arg = self_arg.unwrap(); err.subdiagnostic( self.dcx(), @@ -1062,9 +1062,16 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> { }, ); if self.fn_self_span_reported.insert(fn_span) { + let lang = self.infcx.tcx.lang_items(); err.subdiagnostic( self.dcx(), - CaptureReasonNote::LhsMoveByOperator { span: self_arg.span }, + if [lang.not_trait(), lang.deref_trait(), lang.neg_trait()] + .contains(&Some(trait_id)) + { + CaptureReasonNote::UnOpMoveByOperator { span: self_arg.span } + } else { + CaptureReasonNote::LhsMoveByOperator { span: self_arg.span } + }, ); } } diff --git a/compiler/rustc_borrowck/src/session_diagnostics.rs b/compiler/rustc_borrowck/src/session_diagnostics.rs index a055ce95e8ef..77021ae4321d 100644 --- a/compiler/rustc_borrowck/src/session_diagnostics.rs +++ b/compiler/rustc_borrowck/src/session_diagnostics.rs @@ -368,6 +368,11 @@ pub(crate) enum CaptureReasonNote { #[primary_span] var_span: Span, }, + #[note(borrowck_calling_operator_moves)] + UnOpMoveByOperator { + #[primary_span] + span: Span, + }, #[note(borrowck_calling_operator_moves_lhs)] LhsMoveByOperator { #[primary_span] diff --git a/tests/ui/unop-move-semantics.stderr b/tests/ui/unop-move-semantics.stderr index b6de7976ac94..187dd66b2fe5 100644 --- a/tests/ui/unop-move-semantics.stderr +++ b/tests/ui/unop-move-semantics.stderr @@ -9,7 +9,7 @@ LL | LL | x.clone(); | ^ value borrowed here after move | -note: calling this operator moves the left-hand side +note: calling this operator moves the value --> $SRC_DIR/core/src/ops/bit.rs:LL:COL help: consider cloning the value if the performance cost is acceptable | @@ -57,7 +57,7 @@ LL | !*m; | |move occurs because `*m` has type `T`, which does not implement the `Copy` trait | `*m` moved due to usage in operator | -note: calling this operator moves the left-hand side +note: calling this operator moves the value --> $SRC_DIR/core/src/ops/bit.rs:LL:COL error[E0507]: cannot move out of `*n` which is behind a shared reference From 80bb15ed91d728e39acc2dcb5a3ed5db59862687 Mon Sep 17 00:00:00 2001 From: Trevor Gross Date: Sat, 2 Mar 2024 21:40:18 -0500 Subject: [PATCH 031/103] Add compiler support for parsing `f16` and `f128` --- compiler/rustc_ast/src/util/literal.rs | 2 + .../rustc_middle/src/mir/interpret/value.rs | 22 +++++++++- compiler/rustc_middle/src/ty/consts/int.rs | 44 ++++++++++++++++++- compiler/rustc_mir_build/src/build/mod.rs | 8 ++-- 4 files changed, 71 insertions(+), 5 deletions(-) diff --git a/compiler/rustc_ast/src/util/literal.rs b/compiler/rustc_ast/src/util/literal.rs index 5ed2762b7262..a17c7708e4a0 100644 --- a/compiler/rustc_ast/src/util/literal.rs +++ b/compiler/rustc_ast/src/util/literal.rs @@ -276,8 +276,10 @@ fn filtered_float_lit( Some(suffix) => LitKind::Float( symbol, ast::LitFloatType::Suffixed(match suffix { + sym::f16 => ast::FloatTy::F16, sym::f32 => ast::FloatTy::F32, sym::f64 => ast::FloatTy::F64, + sym::f128 => ast::FloatTy::F128, _ => return Err(LitError::InvalidFloatSuffix(suffix)), }), ), diff --git a/compiler/rustc_middle/src/mir/interpret/value.rs b/compiler/rustc_middle/src/mir/interpret/value.rs index e937c17c8ace..24d4a79c7d79 100644 --- a/compiler/rustc_middle/src/mir/interpret/value.rs +++ b/compiler/rustc_middle/src/mir/interpret/value.rs @@ -3,7 +3,7 @@ use std::fmt; use either::{Either, Left, Right}; use rustc_apfloat::{ - ieee::{Double, Single}, + ieee::{Double, Half, Quad, Single}, Float, }; use rustc_macros::HashStable; @@ -201,6 +201,11 @@ impl Scalar { Self::from_int(i, cx.data_layout().pointer_size) } + #[inline] + pub fn from_f16(f: Half) -> Self { + Scalar::Int(f.into()) + } + #[inline] pub fn from_f32(f: Single) -> Self { Scalar::Int(f.into()) @@ -211,6 +216,11 @@ impl Scalar { Scalar::Int(f.into()) } + #[inline] + pub fn from_f128(f: Quad) -> Self { + Scalar::Int(f.into()) + } + /// This is almost certainly not the method you want! You should dispatch on the type /// and use `to_{u8,u16,...}`/`scalar_to_ptr` to perform ptr-to-int / int-to-ptr casts as needed. /// @@ -422,6 +432,11 @@ impl<'tcx, Prov: Provenance> Scalar { Ok(F::from_bits(self.to_bits(Size::from_bits(F::BITS))?)) } + #[inline] + pub fn to_f16(self) -> InterpResult<'tcx, Half> { + self.to_float() + } + #[inline] pub fn to_f32(self) -> InterpResult<'tcx, Single> { self.to_float() @@ -431,4 +446,9 @@ impl<'tcx, Prov: Provenance> Scalar { pub fn to_f64(self) -> InterpResult<'tcx, Double> { self.to_float() } + + #[inline] + pub fn to_f128(self) -> InterpResult<'tcx, Quad> { + self.to_float() + } } diff --git a/compiler/rustc_middle/src/ty/consts/int.rs b/compiler/rustc_middle/src/ty/consts/int.rs index a70e01645f46..71d7dfd8b01e 100644 --- a/compiler/rustc_middle/src/ty/consts/int.rs +++ b/compiler/rustc_middle/src/ty/consts/int.rs @@ -1,4 +1,4 @@ -use rustc_apfloat::ieee::{Double, Single}; +use rustc_apfloat::ieee::{Double, Half, Quad, Single}; use rustc_apfloat::Float; use rustc_errors::{DiagArgValue, IntoDiagArg}; use rustc_serialize::{Decodable, Decoder, Encodable, Encoder}; @@ -369,6 +369,11 @@ impl ScalarInt { Ok(F::from_bits(self.to_bits(Size::from_bits(F::BITS))?)) } + #[inline] + pub fn try_to_f16(self) -> Result { + self.try_to_float() + } + #[inline] pub fn try_to_f32(self) -> Result { self.try_to_float() @@ -378,6 +383,11 @@ impl ScalarInt { pub fn try_to_f64(self) -> Result { self.try_to_float() } + + #[inline] + pub fn try_to_f128(self) -> Result { + self.try_to_float() + } } macro_rules! from { @@ -450,6 +460,22 @@ impl TryFrom for char { } } +impl From for ScalarInt { + #[inline] + fn from(f: Half) -> Self { + // We trust apfloat to give us properly truncated data. + Self { data: f.to_bits(), size: NonZero::new((Half::BITS / 8) as u8).unwrap() } + } +} + +impl TryFrom for Half { + type Error = Size; + #[inline] + fn try_from(int: ScalarInt) -> Result { + int.to_bits(Size::from_bytes(2)).map(Self::from_bits) + } +} + impl From for ScalarInt { #[inline] fn from(f: Single) -> Self { @@ -482,6 +508,22 @@ impl TryFrom for Double { } } +impl From for ScalarInt { + #[inline] + fn from(f: Quad) -> Self { + // We trust apfloat to give us properly truncated data. + Self { data: f.to_bits(), size: NonZero::new((Quad::BITS / 8) as u8).unwrap() } + } +} + +impl TryFrom for Quad { + type Error = Size; + #[inline] + fn try_from(int: ScalarInt) -> Result { + int.to_bits(Size::from_bytes(16)).map(Self::from_bits) + } +} + impl fmt::Debug for ScalarInt { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { // Dispatch to LowerHex below. diff --git a/compiler/rustc_mir_build/src/build/mod.rs b/compiler/rustc_mir_build/src/build/mod.rs index 45954bdb114f..615a5e69319e 100644 --- a/compiler/rustc_mir_build/src/build/mod.rs +++ b/compiler/rustc_mir_build/src/build/mod.rs @@ -1,7 +1,7 @@ use crate::build::expr::as_place::PlaceBuilder; use crate::build::scope::DropKind; use itertools::Itertools; -use rustc_apfloat::ieee::{Double, Single}; +use rustc_apfloat::ieee::{Double, Half, Quad, Single}; use rustc_apfloat::Float; use rustc_ast::attr; use rustc_data_structures::fx::FxHashMap; @@ -1053,7 +1053,8 @@ pub(crate) fn parse_float_into_scalar( ) -> Option { let num = num.as_str(); match float_ty { - ty::FloatTy::F16 => unimplemented!("f16_f128"), + // FIXME(f16_f128): When available, compare to the library parser as with `f32` and `f64` + ty::FloatTy::F16 => num.parse::().ok().map(Scalar::from_f16), ty::FloatTy::F32 => { let Ok(rust_f) = num.parse::() else { return None }; let mut f = num @@ -1100,7 +1101,8 @@ pub(crate) fn parse_float_into_scalar( Some(Scalar::from_f64(f)) } - ty::FloatTy::F128 => unimplemented!("f16_f128"), + // FIXME(f16_f128): When available, compare to the library parser as with `f32` and `f64` + ty::FloatTy::F128 => num.parse::().ok().map(Scalar::from_f128), } } From dc650952988de0f7321b5db56f26706530bf7212 Mon Sep 17 00:00:00 2001 From: Trevor Gross Date: Sat, 2 Mar 2024 21:44:24 -0500 Subject: [PATCH 032/103] Enable `f16` and `f128` in HIR --- compiler/rustc_hir/src/hir.rs | 11 +++++------ compiler/rustc_lint/src/types.rs | 5 +++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/compiler/rustc_hir/src/hir.rs b/compiler/rustc_hir/src/hir.rs index 8a7d32997b02..9d1b15daa073 100644 --- a/compiler/rustc_hir/src/hir.rs +++ b/compiler/rustc_hir/src/hir.rs @@ -2444,7 +2444,7 @@ pub enum PrimTy { impl PrimTy { /// All of the primitive types - pub const ALL: [Self; 17] = [ + pub const ALL: [Self; 19] = [ // any changes here should also be reflected in `PrimTy::from_name` Self::Int(IntTy::I8), Self::Int(IntTy::I16), @@ -2458,9 +2458,10 @@ impl PrimTy { Self::Uint(UintTy::U64), Self::Uint(UintTy::U128), Self::Uint(UintTy::Usize), + Self::Float(FloatTy::F16), Self::Float(FloatTy::F32), Self::Float(FloatTy::F64), - // FIXME(f16_f128): add these when enabled below + Self::Float(FloatTy::F128), Self::Bool, Self::Char, Self::Str, @@ -2508,12 +2509,10 @@ impl PrimTy { sym::u64 => Self::Uint(UintTy::U64), sym::u128 => Self::Uint(UintTy::U128), sym::usize => Self::Uint(UintTy::Usize), + sym::f16 => Self::Float(FloatTy::F16), sym::f32 => Self::Float(FloatTy::F32), sym::f64 => Self::Float(FloatTy::F64), - // FIXME(f16_f128): enabling these will open the gates of f16 and f128 being - // understood by rustc. - // sym::f16 => Self::Float(FloatTy::F16), - // sym::f128 => Self::Float(FloatTy::F128), + sym::f128 => Self::Float(FloatTy::F128), sym::bool => Self::Bool, sym::char => Self::Char, sym::str => Self::Str, diff --git a/compiler/rustc_lint/src/types.rs b/compiler/rustc_lint/src/types.rs index 5d36a8b3d0e9..51fe08d4af1a 100644 --- a/compiler/rustc_lint/src/types.rs +++ b/compiler/rustc_lint/src/types.rs @@ -561,10 +561,11 @@ fn lint_literal<'tcx>( ty::Float(t) => { let is_infinite = match lit.node { ast::LitKind::Float(v, _) => match t { - ty::FloatTy::F16 => unimplemented!("f16_f128"), + // FIXME(f16_f128): add this check once we have library support + ty::FloatTy::F16 => Ok(false), ty::FloatTy::F32 => v.as_str().parse().map(f32::is_infinite), ty::FloatTy::F64 => v.as_str().parse().map(f64::is_infinite), - ty::FloatTy::F128 => unimplemented!("f16_f128"), + ty::FloatTy::F128 => Ok(false), }, _ => bug!(), }; From f2abc7f853377800030d7f4df50d990865868745 Mon Sep 17 00:00:00 2001 From: Chris Denton Date: Tue, 12 Mar 2024 18:41:16 +0000 Subject: [PATCH 033/103] Check all tier 1 targets in PR CI --- src/ci/docker/host-x86_64/mingw-check/Dockerfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/ci/docker/host-x86_64/mingw-check/Dockerfile b/src/ci/docker/host-x86_64/mingw-check/Dockerfile index 30d3a52d82b8..1b57b54e483e 100644 --- a/src/ci/docker/host-x86_64/mingw-check/Dockerfile +++ b/src/ci/docker/host-x86_64/mingw-check/Dockerfile @@ -41,6 +41,8 @@ COPY host-x86_64/mingw-check/validate-error-codes.sh /scripts/ ENV RUN_CHECK_WITH_PARALLEL_QUERIES 1 ENV SCRIPT python3 ../x.py --stage 2 test src/tools/expand-yaml-anchors && \ + # check library crates on all tier 1 targets + python3 ../x.py check --stage 0 --set build.optimized-compiler-builtins=false core alloc std --target=aarch64-unknown-linux-gnu,i686-pc-windows-msvc,i686-unknown-linux-gnu,x86_64-apple-darwin,x86_64-pc-windows-gnu,x86_64-pc-windows-msvc && \ python3 ../x.py check --target=i686-pc-windows-gnu --host=i686-pc-windows-gnu && \ python3 ../x.py clippy compiler -Aclippy::all -Dclippy::correctness && \ python3 ../x.py build --stage 0 src/tools/build-manifest && \ From d5e5ef5c8958d3e59969652821d3cd0b8e185345 Mon Sep 17 00:00:00 2001 From: Chris Denton Date: Thu, 14 Mar 2024 06:52:40 +0000 Subject: [PATCH 034/103] Add comments explaining tier 1 PR checks --- src/ci/docker/host-x86_64/mingw-check/Dockerfile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/ci/docker/host-x86_64/mingw-check/Dockerfile b/src/ci/docker/host-x86_64/mingw-check/Dockerfile index 1b57b54e483e..e5aa81d83d5a 100644 --- a/src/ci/docker/host-x86_64/mingw-check/Dockerfile +++ b/src/ci/docker/host-x86_64/mingw-check/Dockerfile @@ -41,7 +41,9 @@ COPY host-x86_64/mingw-check/validate-error-codes.sh /scripts/ ENV RUN_CHECK_WITH_PARALLEL_QUERIES 1 ENV SCRIPT python3 ../x.py --stage 2 test src/tools/expand-yaml-anchors && \ - # check library crates on all tier 1 targets + # Check library crates on all tier 1 targets. + # We disable optimized compiler built-ins because that requires a C toolchain for the target. + # We also skip the x86_64-unknown-linux-gnu target as it is well-tested by other jobs. python3 ../x.py check --stage 0 --set build.optimized-compiler-builtins=false core alloc std --target=aarch64-unknown-linux-gnu,i686-pc-windows-msvc,i686-unknown-linux-gnu,x86_64-apple-darwin,x86_64-pc-windows-gnu,x86_64-pc-windows-msvc && \ python3 ../x.py check --target=i686-pc-windows-gnu --host=i686-pc-windows-gnu && \ python3 ../x.py clippy compiler -Aclippy::all -Dclippy::correctness && \ From 3c49fe0cbd86b452ba519ffe98ece4a620caee23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20W=C3=B6rister?= Date: Mon, 19 Feb 2024 14:03:09 +0100 Subject: [PATCH 035/103] link.exe: don't embed full path to PDB file in binary. --- compiler/rustc_codegen_ssa/src/back/linker.rs | 9 +++++++++ tests/run-make/pdb-alt-path/Makefile | 20 +++++++++++++++++++ tests/run-make/pdb-alt-path/main.rs | 3 +++ 3 files changed, 32 insertions(+) create mode 100644 tests/run-make/pdb-alt-path/Makefile create mode 100644 tests/run-make/pdb-alt-path/main.rs diff --git a/compiler/rustc_codegen_ssa/src/back/linker.rs b/compiler/rustc_codegen_ssa/src/back/linker.rs index b4e054417f31..65bff08d7813 100644 --- a/compiler/rustc_codegen_ssa/src/back/linker.rs +++ b/compiler/rustc_codegen_ssa/src/back/linker.rs @@ -929,6 +929,15 @@ impl<'a> Linker for MsvcLinker<'a> { // from the CodeView line tables in the object files. self.cmd.arg("/DEBUG"); + // Default to emitting only the file name of the PDB file into + // the binary instead of the full path. Emitting the full path + // may leak private information (such as user names). + // See https://github.com/rust-lang/rust/issues/87825. + // + // This default behavior can be overridden by explicitly passing + // `-Clink-arg=/PDBALTPATH:...` to rustc. + self.cmd.arg("/PDBALTPATH:%_PDB%"); + // This will cause the Microsoft linker to embed .natvis info into the PDB file let natvis_dir_path = self.sess.sysroot.join("lib\\rustlib\\etc"); if let Ok(natvis_dir) = fs::read_dir(&natvis_dir_path) { diff --git a/tests/run-make/pdb-alt-path/Makefile b/tests/run-make/pdb-alt-path/Makefile new file mode 100644 index 000000000000..d7d435957a38 --- /dev/null +++ b/tests/run-make/pdb-alt-path/Makefile @@ -0,0 +1,20 @@ +include ../tools.mk + +# only-windows-msvc + +all: + # Test that we don't have the full path to the PDB file in the binary + $(RUSTC) main.rs -g --crate-name my_crate_name --crate-type bin + $(CGREP) "my_crate_name.pdb" < $(TMPDIR)/my_crate_name.exe + $(CGREP) -v "\\my_crate_name.pdb" < $(TMPDIR)/my_crate_name.exe + + # Test that backtraces still can find debuginfo by checking that they contain symbol names and + # source locations. + RUST_BACKTRACE="full" $(TMPDIR)/my_crate_name.exe &> $(TMPDIR)/backtrace.txt || exit 0 + $(CGREP) "my_crate_name::main" < $(TMPDIR)/backtrace.txt + $(CGREP) "pdb-alt-path\\main.rs:2" < $(TMPDIR)/backtrace.txt + + # Test that explicitly passed `-Clink-arg=/PDBALTPATH:...` is respected + $(RUSTC) main.rs -g --crate-name my_crate_name --crate-type bin -Clink-arg=/PDBALTPATH:abcdefg.pdb + $(CGREP) "abcdefg.pdb" < $(TMPDIR)/my_crate_name.exe + $(CGREP) -v "my_crate_name.pdb" < $(TMPDIR)/my_crate_name.exe diff --git a/tests/run-make/pdb-alt-path/main.rs b/tests/run-make/pdb-alt-path/main.rs new file mode 100644 index 000000000000..e95109fd08a3 --- /dev/null +++ b/tests/run-make/pdb-alt-path/main.rs @@ -0,0 +1,3 @@ +fn main() { + panic!("backtrace please"); +} From e1c3a5a7aa25362636751989aec5222f928def91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20W=C3=B6rister?= Date: Wed, 13 Mar 2024 11:44:50 +0100 Subject: [PATCH 036/103] Force frame pointers in pdb-alt-path test case --- tests/run-make/pdb-alt-path/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/run-make/pdb-alt-path/Makefile b/tests/run-make/pdb-alt-path/Makefile index d7d435957a38..5795dae97c25 100644 --- a/tests/run-make/pdb-alt-path/Makefile +++ b/tests/run-make/pdb-alt-path/Makefile @@ -4,7 +4,7 @@ include ../tools.mk all: # Test that we don't have the full path to the PDB file in the binary - $(RUSTC) main.rs -g --crate-name my_crate_name --crate-type bin + $(RUSTC) main.rs -g --crate-name my_crate_name --crate-type bin -Cforce-frame-pointers $(CGREP) "my_crate_name.pdb" < $(TMPDIR)/my_crate_name.exe $(CGREP) -v "\\my_crate_name.pdb" < $(TMPDIR)/my_crate_name.exe @@ -15,6 +15,6 @@ all: $(CGREP) "pdb-alt-path\\main.rs:2" < $(TMPDIR)/backtrace.txt # Test that explicitly passed `-Clink-arg=/PDBALTPATH:...` is respected - $(RUSTC) main.rs -g --crate-name my_crate_name --crate-type bin -Clink-arg=/PDBALTPATH:abcdefg.pdb + $(RUSTC) main.rs -g --crate-name my_crate_name --crate-type bin -Clink-arg=/PDBALTPATH:abcdefg.pdb -Cforce-frame-pointers $(CGREP) "abcdefg.pdb" < $(TMPDIR)/my_crate_name.exe $(CGREP) -v "my_crate_name.pdb" < $(TMPDIR)/my_crate_name.exe From 0a094bae28a00117b99262621ff22876796d2885 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20W=C3=B6rister?= Date: Thu, 14 Mar 2024 11:03:15 +0100 Subject: [PATCH 037/103] Make pdb-alt-path test more unwind-friendly for i686-pc-windows-msvc --- tests/run-make/pdb-alt-path/Makefile | 6 +++--- tests/run-make/pdb-alt-path/main.rs | 25 +++++++++++++++++++++++-- 2 files changed, 26 insertions(+), 5 deletions(-) diff --git a/tests/run-make/pdb-alt-path/Makefile b/tests/run-make/pdb-alt-path/Makefile index 5795dae97c25..7a0ae3bf2ef0 100644 --- a/tests/run-make/pdb-alt-path/Makefile +++ b/tests/run-make/pdb-alt-path/Makefile @@ -10,9 +10,9 @@ all: # Test that backtraces still can find debuginfo by checking that they contain symbol names and # source locations. - RUST_BACKTRACE="full" $(TMPDIR)/my_crate_name.exe &> $(TMPDIR)/backtrace.txt || exit 0 - $(CGREP) "my_crate_name::main" < $(TMPDIR)/backtrace.txt - $(CGREP) "pdb-alt-path\\main.rs:2" < $(TMPDIR)/backtrace.txt + $(TMPDIR)/my_crate_name.exe &> $(TMPDIR)/backtrace.txt + $(CGREP) "my_crate_name::fn_in_backtrace" < $(TMPDIR)/backtrace.txt + $(CGREP) "main.rs:15" < $(TMPDIR)/backtrace.txt # Test that explicitly passed `-Clink-arg=/PDBALTPATH:...` is respected $(RUSTC) main.rs -g --crate-name my_crate_name --crate-type bin -Clink-arg=/PDBALTPATH:abcdefg.pdb -Cforce-frame-pointers diff --git a/tests/run-make/pdb-alt-path/main.rs b/tests/run-make/pdb-alt-path/main.rs index e95109fd08a3..d38d540fbc25 100644 --- a/tests/run-make/pdb-alt-path/main.rs +++ b/tests/run-make/pdb-alt-path/main.rs @@ -1,3 +1,24 @@ -fn main() { - panic!("backtrace please"); +// The various #[inline(never)] annotations and std::hint::black_box calls are +// an attempt to make unwinding as non-flaky as possible on i686-pc-windows-msvc. + +#[inline(never)] +fn generate_backtrace(x: &u32) { + std::hint::black_box(x); + let bt = std::backtrace::Backtrace::force_capture(); + println!("{}", bt); + std::hint::black_box(x); +} + +#[inline(never)] +fn fn_in_backtrace(x: &u32) { + std::hint::black_box(x); + generate_backtrace(x); + std::hint::black_box(x); +} + +fn main() { + let x = &41; + std::hint::black_box(x); + fn_in_backtrace(x); + std::hint::black_box(x); } From 8da262139af11628512d1d9bce059310461a1fa8 Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Thu, 14 Mar 2024 12:15:05 +0100 Subject: [PATCH 038/103] print ghosts --- src/librustdoc/html/render/print_item.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/librustdoc/html/render/print_item.rs b/src/librustdoc/html/render/print_item.rs index d588f219739f..4f74ae096fba 100644 --- a/src/librustdoc/html/render/print_item.rs +++ b/src/librustdoc/html/render/print_item.rs @@ -517,6 +517,11 @@ fn item_module(w: &mut Buffer, cx: &mut Context<'_>, item: &clean::Item, items: } _ => "", }; + let hidden_emoji = if myitem.is_doc_hidden() { + " ðŸ‘» " + } else { + "" + }; w.write_str(ITEM_TABLE_ROW_OPEN); let docs = @@ -531,6 +536,7 @@ fn item_module(w: &mut Buffer, cx: &mut Context<'_>, item: &clean::Item, items: "\ From 39e36af85620ab5f3344a2ec5f838b2c3d68eab6 Mon Sep 17 00:00:00 2001 From: clubby789 Date: Thu, 14 Mar 2024 11:24:09 +0000 Subject: [PATCH 039/103] Bump `cargo update` PR more often --- .github/workflows/dependencies.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/dependencies.yml b/.github/workflows/dependencies.yml index 97ed891c491d..c182f3245e5d 100644 --- a/.github/workflows/dependencies.yml +++ b/.github/workflows/dependencies.yml @@ -6,6 +6,8 @@ on: schedule: # Run weekly - cron: '0 0 * * Sun' + # Re-bump deps every 4 hours + - cron: '0 */4 * * *' workflow_dispatch: # Needed so we can run it manually permissions: @@ -135,8 +137,8 @@ jobs: gh pr edit cargo_update --title "${PR_TITLE}" --body-file body.md --repo $GITHUB_REPOSITORY - name: open new pull request - # Only run if there wasn't an existing PR - if: steps.edit.outcome != 'success' + # Only run if there wasn't an existing PR and if this is the weekly run + if: steps.edit.outcome != 'success' && github.event.schedule == '0 0 * * Sun' env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: gh pr create --title "${PR_TITLE}" --body-file body.md --repo $GITHUB_REPOSITORY From 343c77c102608e7b9090789ea365a21d0156d191 Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Thu, 14 Mar 2024 12:39:27 +0100 Subject: [PATCH 040/103] Refactor visibility_print_with_space to directly take an item --- src/librustdoc/clean/inline.rs | 16 ++++++-- src/librustdoc/clean/mod.rs | 3 +- src/librustdoc/clean/types.rs | 2 +- src/librustdoc/clean/utils.rs | 5 ++- src/librustdoc/html/format.rs | 12 +++--- src/librustdoc/html/render/mod.rs | 7 ++-- src/librustdoc/html/render/print_item.rs | 48 ++++++++---------------- 7 files changed, 42 insertions(+), 51 deletions(-) diff --git a/src/librustdoc/clean/inline.rs b/src/librustdoc/clean/inline.rs index 77a78f57e950..6f86c6450d96 100644 --- a/src/librustdoc/clean/inline.rs +++ b/src/librustdoc/clean/inline.rs @@ -62,6 +62,9 @@ pub(crate) fn try_inline( attrs_without_docs.as_ref().map(|(attrs, def_id)| (&attrs[..], *def_id)); let import_def_id = attrs.and_then(|(_, def_id)| def_id); + + let (attrs, cfg) = merge_attrs(cx, load_attrs(cx, did), attrs); + let kind = match res { Res::Def(DefKind::Trait, did) => { record_extern_fqn(cx, did, ItemType::Trait); @@ -131,7 +134,7 @@ pub(crate) fn try_inline( cx.with_param_env(did, |cx| clean::ConstantItem(build_const(cx, did))) } Res::Def(DefKind::Macro(kind), did) => { - let mac = build_macro(cx, did, name, import_def_id, kind); + let mac = build_macro(cx, did, name, import_def_id, kind, attrs.is_doc_hidden()); let type_kind = match kind { MacroKind::Bang => ItemType::Macro, @@ -144,7 +147,6 @@ pub(crate) fn try_inline( _ => return None, }; - let (attrs, cfg) = merge_attrs(cx, load_attrs(cx, did), attrs); cx.inlined.insert(did.into()); let mut item = clean::Item::from_def_id_and_attrs_and_parts(did, Some(name), kind, Box::new(attrs), cfg); @@ -751,6 +753,7 @@ fn build_macro( name: Symbol, import_def_id: Option, macro_kind: MacroKind, + is_doc_hidden: bool, ) -> clean::ItemKind { match CStore::from_tcx(cx.tcx).load_macro_untracked(def_id, cx.tcx) { LoadedMacro::MacroDef(item_def, _) => match macro_kind { @@ -758,7 +761,14 @@ fn build_macro( if let ast::ItemKind::MacroDef(ref def) = item_def.kind { let vis = cx.tcx.visibility(import_def_id.unwrap_or(def_id)); clean::MacroItem(clean::Macro { - source: utils::display_macro_source(cx, name, def, def_id, vis), + source: utils::display_macro_source( + cx, + name, + def, + def_id, + vis, + is_doc_hidden, + ), }) } else { unreachable!() diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index b32d3ad562d0..ec4c6d991f1a 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -2796,7 +2796,8 @@ fn clean_maybe_renamed_item<'tcx>( ItemKind::Macro(ref macro_def, MacroKind::Bang) => { let ty_vis = cx.tcx.visibility(def_id); MacroItem(Macro { - source: display_macro_source(cx, name, macro_def, def_id, ty_vis), + // FIXME this shouldn't be false + source: display_macro_source(cx, name, macro_def, def_id, ty_vis, false), }) } ItemKind::Macro(_, macro_kind) => clean_proc_macro(item, &mut name, macro_kind, cx), diff --git a/src/librustdoc/clean/types.rs b/src/librustdoc/clean/types.rs index c35baeb4cf58..a51f6360df2a 100644 --- a/src/librustdoc/clean/types.rs +++ b/src/librustdoc/clean/types.rs @@ -1161,7 +1161,7 @@ impl Attributes { false } - fn is_doc_hidden(&self) -> bool { + pub(crate) fn is_doc_hidden(&self) -> bool { self.has_doc_flag(sym::hidden) } diff --git a/src/librustdoc/clean/utils.rs b/src/librustdoc/clean/utils.rs index 57916ff0ff78..5464aa63ea80 100644 --- a/src/librustdoc/clean/utils.rs +++ b/src/librustdoc/clean/utils.rs @@ -625,6 +625,7 @@ pub(super) fn display_macro_source( def: &ast::MacroDef, def_id: DefId, vis: ty::Visibility, + is_doc_hidden: bool, ) -> String { // Extract the spans of all matchers. They represent the "interface" of the macro. let matchers = def.body.tokens.chunks(4).map(|arm| &arm[0]); @@ -635,7 +636,7 @@ pub(super) fn display_macro_source( if matchers.len() <= 1 { format!( "{vis}macro {name}{matchers} {{\n ...\n}}", - vis = visibility_to_src_with_space(Some(vis), cx.tcx, def_id), + vis = visibility_to_src_with_space(Some(vis), cx.tcx, def_id, is_doc_hidden), matchers = matchers .map(|matcher| render_macro_matcher(cx.tcx, matcher)) .collect::(), @@ -643,7 +644,7 @@ pub(super) fn display_macro_source( } else { format!( "{vis}macro {name} {{\n{arms}}}", - vis = visibility_to_src_with_space(Some(vis), cx.tcx, def_id), + vis = visibility_to_src_with_space(Some(vis), cx.tcx, def_id, is_doc_hidden), arms = render_macro_arms(cx.tcx, matchers, ","), ) } diff --git a/src/librustdoc/html/format.rs b/src/librustdoc/html/format.rs index afd5eb42d019..1973c2a6021c 100644 --- a/src/librustdoc/html/format.rs +++ b/src/librustdoc/html/format.rs @@ -29,8 +29,7 @@ use rustc_target::spec::abi::Abi; use itertools::Itertools; use crate::clean::{ - self, types::ExternalLocation, utils::find_nearest_parent_module, ExternalCrate, ItemId, - PrimitiveType, + self, types::ExternalLocation, utils::find_nearest_parent_module, ExternalCrate, PrimitiveType, }; use crate::formats::cache::Cache; use crate::formats::item_type::ItemType; @@ -1506,20 +1505,18 @@ impl clean::FnDecl { } pub(crate) fn visibility_print_with_space<'a, 'tcx: 'a>( - visibility: Option>, - item_did: ItemId, + item: &clean::Item, cx: &'a Context<'tcx>, ) -> impl Display + 'a + Captures<'tcx> { use std::fmt::Write as _; - - let to_print: Cow<'static, str> = match visibility { + let to_print: Cow<'static, str> = match item.visibility(cx.tcx()) { None => "".into(), Some(ty::Visibility::Public) => "pub ".into(), Some(ty::Visibility::Restricted(vis_did)) => { // FIXME(camelid): This may not work correctly if `item_did` is a module. // However, rustdoc currently never displays a module's // visibility, so it shouldn't matter. - let parent_module = find_nearest_parent_module(cx.tcx(), item_did.expect_def_id()); + let parent_module = find_nearest_parent_module(cx.tcx(), item.item_id.expect_def_id()); if vis_did.is_crate_root() { "pub(crate) ".into() @@ -1557,6 +1554,7 @@ pub(crate) fn visibility_to_src_with_space<'a, 'tcx: 'a>( visibility: Option>, tcx: TyCtxt<'tcx>, item_did: DefId, + _is_doc_hidden: bool, ) -> impl Display + 'a + Captures<'tcx> { let to_print: Cow<'static, str> = match visibility { None => "".into(), diff --git a/src/librustdoc/html/render/mod.rs b/src/librustdoc/html/render/mod.rs index fe83095f944a..54d51ca009b2 100644 --- a/src/librustdoc/html/render/mod.rs +++ b/src/librustdoc/html/render/mod.rs @@ -883,7 +883,7 @@ fn assoc_const( w, "{indent}{vis}const {name}{generics}: {ty}", indent = " ".repeat(indent), - vis = visibility_print_with_space(it.visibility(tcx), it.item_id, cx), + vis = visibility_print_with_space(it, cx), href = assoc_href_attr(it, link, cx), name = it.name.as_ref().unwrap(), generics = generics.print(cx), @@ -912,12 +912,11 @@ fn assoc_type( indent: usize, cx: &Context<'_>, ) { - let tcx = cx.tcx(); write!( w, "{indent}{vis}type {name}{generics}", indent = " ".repeat(indent), - vis = visibility_print_with_space(it.visibility(tcx), it.item_id, cx), + vis = visibility_print_with_space(it, cx), href = assoc_href_attr(it, link, cx), name = it.name.as_ref().unwrap(), generics = generics.print(cx), @@ -945,7 +944,7 @@ fn assoc_method( let tcx = cx.tcx(); let header = meth.fn_header(tcx).expect("Trying to get header from a non-function item"); let name = meth.name.as_ref().unwrap(); - let vis = visibility_print_with_space(meth.visibility(tcx), meth.item_id, cx).to_string(); + let vis = visibility_print_with_space(meth, cx).to_string(); let defaultness = print_default_space(meth.is_default()); // FIXME: Once https://github.com/rust-lang/rust/issues/67792 is implemented, we can remove // this condition. diff --git a/src/librustdoc/html/render/print_item.rs b/src/librustdoc/html/render/print_item.rs index 4f74ae096fba..d2a03d584027 100644 --- a/src/librustdoc/html/render/print_item.rs +++ b/src/librustdoc/html/render/print_item.rs @@ -445,14 +445,14 @@ fn item_module(w: &mut Buffer, cx: &mut Context<'_>, item: &clean::Item, items: Some(src) => write!( w, "
{}extern crate {} as {};", - visibility_print_with_space(myitem.visibility(tcx), myitem.item_id, cx), + visibility_print_with_space(myitem, cx), anchor(myitem.item_id.expect_def_id(), src, cx), myitem.name.unwrap(), ), None => write!( w, "
{}extern crate {};", - visibility_print_with_space(myitem.visibility(tcx), myitem.item_id, cx), + visibility_print_with_space(myitem, cx), anchor(myitem.item_id.expect_def_id(), myitem.name.unwrap(), cx), ), } @@ -491,7 +491,7 @@ fn item_module(w: &mut Buffer, cx: &mut Context<'_>, item: &clean::Item, items: {vis}{imp}\
\ {stab_tags_before}{stab_tags}{stab_tags_after}", - vis = visibility_print_with_space(myitem.visibility(tcx), myitem.item_id, cx), + vis = visibility_print_with_space(myitem, cx), imp = import.print(cx), ); w.write_str(ITEM_TABLE_ROW_CLOSE); @@ -631,7 +631,7 @@ fn item_function(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, f: &cle let unsafety = header.unsafety.print_with_space(); let abi = print_abi_with_space(header.abi).to_string(); let asyncness = header.asyncness.print_with_space(); - let visibility = visibility_print_with_space(it.visibility(tcx), it.item_id, cx).to_string(); + let visibility = visibility_print_with_space(it, cx).to_string(); let name = it.name.unwrap(); let generics_len = format!("{:#}", f.generics.print(cx)).len(); @@ -688,7 +688,7 @@ fn item_trait(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, t: &clean: w, "{attrs}{vis}{unsafety}{is_auto}trait {name}{generics}{bounds}", attrs = render_attributes_in_pre(it, "", cx), - vis = visibility_print_with_space(it.visibility(tcx), it.item_id, cx), + vis = visibility_print_with_space(it, cx), unsafety = t.unsafety(tcx).print_with_space(), is_auto = if t.is_auto(tcx) { "auto " } else { "" }, name = it.name.unwrap(), @@ -1243,7 +1243,7 @@ fn item_type_alias(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, t: &c w, "{attrs}{vis}type {name}{generics}{where_clause} = {type_};", attrs = render_attributes_in_pre(it, "", cx), - vis = visibility_print_with_space(it.visibility(cx.tcx()), it.item_id, cx), + vis = visibility_print_with_space(it, cx), name = it.name.unwrap(), generics = t.generics.print(cx), where_clause = print_where_clause(&t.generics, cx, 0, Ending::Newline), @@ -1522,14 +1522,13 @@ fn print_tuple_struct_fields<'a, 'cx: 'a>( } fn item_enum(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, e: &clean::Enum) { - let tcx = cx.tcx(); let count_variants = e.variants().count(); wrap_item(w, |w| { render_attributes_in_code(w, it, cx); write!( w, "{}enum {}{}", - visibility_print_with_space(it.visibility(tcx), it.item_id, cx), + visibility_print_with_space(it, cx), it.name.unwrap(), e.generics.print(cx), ); @@ -1860,7 +1859,7 @@ fn item_constant(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, c: &cle write!( w, "{vis}const {name}{generics}: {typ}{where_clause}", - vis = visibility_print_with_space(it.visibility(tcx), it.item_id, cx), + vis = visibility_print_with_space(it, cx), name = it.name.unwrap(), generics = c.generics.print(cx), typ = c.type_.print(cx), @@ -1964,7 +1963,7 @@ fn item_static(w: &mut impl fmt::Write, cx: &mut Context<'_>, it: &clean::Item, write!( buffer, "{vis}static {mutability}{name}: {typ}", - vis = visibility_print_with_space(it.visibility(cx.tcx()), it.item_id, cx), + vis = visibility_print_with_space(it, cx), mutability = s.mutability.print_with_space(), name = it.name.unwrap(), typ = s.type_.print(cx) @@ -1982,7 +1981,7 @@ fn item_foreign_type(w: &mut impl fmt::Write, cx: &mut Context<'_>, it: &clean:: write!( buffer, " {}type {};\n}}", - visibility_print_with_space(it.visibility(cx.tcx()), it.item_id, cx), + visibility_print_with_space(it, cx), it.name.unwrap(), ) .unwrap(); @@ -2139,13 +2138,7 @@ fn render_union<'a, 'cx: 'a>( cx: &'a Context<'cx>, ) -> impl fmt::Display + 'a + Captures<'cx> { display_fn(move |mut f| { - let tcx = cx.tcx(); - write!( - f, - "{}union {}", - visibility_print_with_space(it.visibility(tcx), it.item_id, cx), - it.name.unwrap(), - )?; + write!(f, "{}union {}", visibility_print_with_space(it, cx), it.name.unwrap(),)?; let where_displayed = g .map(|g| { @@ -2175,7 +2168,7 @@ fn render_union<'a, 'cx: 'a>( write!( f, " {}{}: {},\n", - visibility_print_with_space(field.visibility(tcx), field.item_id, cx), + visibility_print_with_space(field, cx), field.name.unwrap(), ty.print(cx) )?; @@ -2203,11 +2196,10 @@ fn render_struct( structhead: bool, cx: &Context<'_>, ) { - let tcx = cx.tcx(); write!( w, "{}{}{}", - visibility_print_with_space(it.visibility(tcx), it.item_id, cx), + visibility_print_with_space(it, cx), if structhead { "struct " } else { "" }, it.name.unwrap() ); @@ -2236,7 +2228,6 @@ fn render_struct_fields( has_stripped_entries: bool, cx: &Context<'_>, ) { - let tcx = cx.tcx(); match ty { None => { let where_displayed = @@ -2260,7 +2251,7 @@ fn render_struct_fields( write!( w, "\n{tab} {vis}{name}: {ty},", - vis = visibility_print_with_space(field.visibility(tcx), field.item_id, cx), + vis = visibility_print_with_space(field, cx), name = field.name.unwrap(), ty = ty.print(cx), ); @@ -2296,16 +2287,7 @@ fn render_struct_fields( match *field.kind { clean::StrippedItem(box clean::StructFieldItem(..)) => write!(w, "_"), clean::StructFieldItem(ref ty) => { - write!( - w, - "{}{}", - visibility_print_with_space( - field.visibility(tcx), - field.item_id, - cx - ), - ty.print(cx), - ) + write!(w, "{}{}", visibility_print_with_space(field, cx), ty.print(cx),) } _ => unreachable!(), } From 102015645d37579145c0ba955f22ece95d98c3bd Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Thu, 14 Mar 2024 13:53:03 +0100 Subject: [PATCH 041/103] print doc(hidden) --- src/librustdoc/html/format.rs | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/librustdoc/html/format.rs b/src/librustdoc/html/format.rs index 1973c2a6021c..745001e035e7 100644 --- a/src/librustdoc/html/format.rs +++ b/src/librustdoc/html/format.rs @@ -1509,7 +1509,9 @@ pub(crate) fn visibility_print_with_space<'a, 'tcx: 'a>( cx: &'a Context<'tcx>, ) -> impl Display + 'a + Captures<'tcx> { use std::fmt::Write as _; - let to_print: Cow<'static, str> = match item.visibility(cx.tcx()) { + + let hidden: &'static str = if item.is_doc_hidden() { "#[doc(hidden)] " } else { "" }; + let vis: Cow<'static, str> = match item.visibility(cx.tcx()) { None => "".into(), Some(ty::Visibility::Public) => "pub ".into(), Some(ty::Visibility::Restricted(vis_did)) => { @@ -1544,7 +1546,10 @@ pub(crate) fn visibility_print_with_space<'a, 'tcx: 'a>( } } }; - display_fn(move |f| f.write_str(&to_print)) + display_fn(move |f| { + f.write_str(&hidden)?; + f.write_str(&vis) + }) } /// This function is the same as print_with_space, except that it renders no links. @@ -1554,9 +1559,10 @@ pub(crate) fn visibility_to_src_with_space<'a, 'tcx: 'a>( visibility: Option>, tcx: TyCtxt<'tcx>, item_did: DefId, - _is_doc_hidden: bool, + is_doc_hidden: bool, ) -> impl Display + 'a + Captures<'tcx> { - let to_print: Cow<'static, str> = match visibility { + let hidden: &'static str = if is_doc_hidden { "#[doc(hidden)] " } else { "" }; + let vis: Cow<'static, str> = match visibility { None => "".into(), Some(ty::Visibility::Public) => "pub ".into(), Some(ty::Visibility::Restricted(vis_did)) => { @@ -1580,7 +1586,10 @@ pub(crate) fn visibility_to_src_with_space<'a, 'tcx: 'a>( } } }; - display_fn(move |f| f.write_str(&to_print)) + display_fn(move |f| { + f.write_str(&hidden)?; + f.write_str(&vis) + }) } pub(crate) trait PrintWithSpace { From bd03fad8ee6554fbc57758d65015361f766468dd Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Thu, 14 Mar 2024 14:30:38 +0100 Subject: [PATCH 042/103] Make compact --- src/librustdoc/html/render/print_item.rs | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/librustdoc/html/render/print_item.rs b/src/librustdoc/html/render/print_item.rs index d2a03d584027..0af3f3bc9934 100644 --- a/src/librustdoc/html/render/print_item.rs +++ b/src/librustdoc/html/render/print_item.rs @@ -511,17 +511,18 @@ fn item_module(w: &mut Buffer, cx: &mut Context<'_>, item: &clean::Item, items: _ => "", }; - let visibility_emoji = match myitem.visibility(tcx) { + let visibility_and_hidden = match myitem.visibility(tcx) { Some(ty::Visibility::Restricted(_)) => { - " ðŸ”’ " + if myitem.is_doc_hidden() { + " ðŸ”’ " + } else { + // Don't separate with a space when there are two of them + " ðŸ”’👻 " + } } + _ if myitem.is_doc_hidden() => " ðŸ‘» ", _ => "", }; - let hidden_emoji = if myitem.is_doc_hidden() { - " ðŸ‘» " - } else { - "" - }; w.write_str(ITEM_TABLE_ROW_OPEN); let docs = @@ -535,14 +536,13 @@ fn item_module(w: &mut Buffer, cx: &mut Context<'_>, item: &clean::Item, items: w, "
\ {name}\ - {visibility_emoji}\ - {hidden_emoji}\ + {visibility_and_hidden}\ {unsafety_flag}\ {stab_tags}\
\ {docs_before}{docs}{docs_after}", name = myitem.name.unwrap(), - visibility_emoji = visibility_emoji, + visibility_and_hidden = visibility_and_hidden, stab_tags = extra_info_tags(myitem, item, tcx), class = myitem.type_(), unsafety_flag = unsafety_flag, From 26028209e808377d52ea36618b2cf2d75e0bcd6c Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Thu, 14 Mar 2024 14:40:54 +0100 Subject: [PATCH 043/103] tests --- tests/rustdoc/display-hidden-items.rs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/tests/rustdoc/display-hidden-items.rs b/tests/rustdoc/display-hidden-items.rs index 76124554767f..901ca17d4d2c 100644 --- a/tests/rustdoc/display-hidden-items.rs +++ b/tests/rustdoc/display-hidden-items.rs @@ -5,19 +5,22 @@ #![crate_name = "foo"] // @has 'foo/index.html' -// @has - '//*[@id="reexport.hidden_reexport"]/code' 'pub use hidden::inside_hidden as hidden_reexport;' +// @has - '//*[@class="item-name"]/span[@title="Hidden item"]' '👻' + +// @has - '//*[@id="reexport.hidden_reexport"]/code' '#[doc(hidden)] pub use hidden::inside_hidden as hidden_reexport;' #[doc(hidden)] pub use hidden::inside_hidden as hidden_reexport; // @has - '//*[@class="item-name"]/a[@class="trait"]' 'TraitHidden' // @has 'foo/trait.TraitHidden.html' +// @has - '//code' '#[doc(hidden)] pub trait TraitHidden' #[doc(hidden)] pub trait TraitHidden {} // @has 'foo/index.html' '//*[@class="item-name"]/a[@class="trait"]' 'Trait' pub trait Trait { // @has 'foo/trait.Trait.html' - // @has - '//*[@id="associatedconstant.BAR"]/*[@class="code-header"]' 'const BAR: u32 = 0u32' + // @has - '//*[@id="associatedconstant.BAR"]/*[@class="code-header"]' '#[doc(hidden)] const BAR: u32 = 0u32' #[doc(hidden)] const BAR: u32 = 0; @@ -41,14 +44,15 @@ impl Struct { } impl Trait for Struct { - // @has - '//*[@id="associatedconstant.BAR"]/*[@class="code-header"]' 'const BAR: u32 = 0u32' - // @has - '//*[@id="method.foo"]/*[@class="code-header"]' 'fn foo()' + // @has - '//*[@id="associatedconstant.BAR"]/*[@class="code-header"]' '#[doc(hidden)] const BAR: u32 = 0u32' + // @has - '//*[@id="method.foo"]/*[@class="code-header"]' '#[doc(hidden)] fn foo()' } // @has - '//*[@id="impl-TraitHidden-for-Struct"]/*[@class="code-header"]' 'impl TraitHidden for Struct' impl TraitHidden for Struct {} // @has 'foo/index.html' '//*[@class="item-name"]/a[@class="enum"]' 'HiddenEnum' // @has 'foo/enum.HiddenEnum.html' +// @has - '//code' '#[doc(hidden)] pub enum HiddenEnum' #[doc(hidden)] pub enum HiddenEnum { A, From 580e5b855d58d2076460b7a16c87e622b7d68960 Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Thu, 14 Mar 2024 15:07:30 +0100 Subject: [PATCH 044/103] inline --- src/librustdoc/html/format.rs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/librustdoc/html/format.rs b/src/librustdoc/html/format.rs index 745001e035e7..312765d3e6d0 100644 --- a/src/librustdoc/html/format.rs +++ b/src/librustdoc/html/format.rs @@ -1509,8 +1509,6 @@ pub(crate) fn visibility_print_with_space<'a, 'tcx: 'a>( cx: &'a Context<'tcx>, ) -> impl Display + 'a + Captures<'tcx> { use std::fmt::Write as _; - - let hidden: &'static str = if item.is_doc_hidden() { "#[doc(hidden)] " } else { "" }; let vis: Cow<'static, str> = match item.visibility(cx.tcx()) { None => "".into(), Some(ty::Visibility::Public) => "pub ".into(), @@ -1546,8 +1544,13 @@ pub(crate) fn visibility_print_with_space<'a, 'tcx: 'a>( } } }; + + let is_doc_hidden = item.is_doc_hidden(); display_fn(move |f| { - f.write_str(&hidden)?; + if is_doc_hidden { + f.write_str("#[doc(hidden)] ")?; + } + f.write_str(&vis) }) } @@ -1561,7 +1564,6 @@ pub(crate) fn visibility_to_src_with_space<'a, 'tcx: 'a>( item_did: DefId, is_doc_hidden: bool, ) -> impl Display + 'a + Captures<'tcx> { - let hidden: &'static str = if is_doc_hidden { "#[doc(hidden)] " } else { "" }; let vis: Cow<'static, str> = match visibility { None => "".into(), Some(ty::Visibility::Public) => "pub ".into(), @@ -1587,7 +1589,9 @@ pub(crate) fn visibility_to_src_with_space<'a, 'tcx: 'a>( } }; display_fn(move |f| { - f.write_str(&hidden)?; + if is_doc_hidden { + f.write_str("#[doc(hidden)] ")?; + } f.write_str(&vis) }) } From 9718144599d633c95efe6459566a4f86087467ee Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Thu, 14 Mar 2024 15:08:16 +0100 Subject: [PATCH 045/103] fix polarity --- src/librustdoc/html/render/print_item.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/librustdoc/html/render/print_item.rs b/src/librustdoc/html/render/print_item.rs index 0af3f3bc9934..5d4f1acc4b18 100644 --- a/src/librustdoc/html/render/print_item.rs +++ b/src/librustdoc/html/render/print_item.rs @@ -514,10 +514,10 @@ fn item_module(w: &mut Buffer, cx: &mut Context<'_>, item: &clean::Item, items: let visibility_and_hidden = match myitem.visibility(tcx) { Some(ty::Visibility::Restricted(_)) => { if myitem.is_doc_hidden() { - " ðŸ”’ " - } else { // Don't separate with a space when there are two of them " ðŸ”’👻 " + } else { + " ðŸ”’ " } } _ if myitem.is_doc_hidden() => " ðŸ‘» ", From 54d83beb3897fcfbc79e26fce467792ae5857ffb Mon Sep 17 00:00:00 2001 From: Oli Scherer Date: Thu, 14 Mar 2024 13:54:00 +0000 Subject: [PATCH 046/103] Add test --- ...codegen_private_const_fn_only_used_in_const_eval.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 tests/codegen/dont_codegen_private_const_fn_only_used_in_const_eval.rs diff --git a/tests/codegen/dont_codegen_private_const_fn_only_used_in_const_eval.rs b/tests/codegen/dont_codegen_private_const_fn_only_used_in_const_eval.rs new file mode 100644 index 000000000000..723ac015cdc1 --- /dev/null +++ b/tests/codegen/dont_codegen_private_const_fn_only_used_in_const_eval.rs @@ -0,0 +1,10 @@ +//! This test checks that we do not monomorphize functions that are only +//! used to evaluate static items, but never used in runtime code. + +//@compile-flags: --crate-type=lib -Copt-level=0 + +const fn foo() {} + +pub static FOO: () = foo(); + +// CHECK: define{{.*}}foo{{.*}} From 8332b47cae210e88457ea466e4cd48265f05f113 Mon Sep 17 00:00:00 2001 From: Oli Scherer Date: Tue, 12 Mar 2024 06:40:23 +0000 Subject: [PATCH 047/103] Stop walking the bodies of statics for reachability, and evaluate them instead --- compiler/rustc_passes/src/reachable.rs | 89 +++++++++++-------- ...rivate_const_fn_only_used_in_const_eval.rs | 2 +- 2 files changed, 52 insertions(+), 39 deletions(-) diff --git a/compiler/rustc_passes/src/reachable.rs b/compiler/rustc_passes/src/reachable.rs index e86c0522b3cd..0dd3185fc83f 100644 --- a/compiler/rustc_passes/src/reachable.rs +++ b/compiler/rustc_passes/src/reachable.rs @@ -6,6 +6,7 @@ // reachable as well. use hir::def_id::LocalDefIdSet; +use rustc_data_structures::stack::ensure_sufficient_stack; use rustc_hir as hir; use rustc_hir::def::{DefKind, Res}; use rustc_hir::def_id::{DefId, LocalDefId}; @@ -65,23 +66,8 @@ impl<'tcx> Visitor<'tcx> for ReachableContext<'tcx> { _ => None, }; - if let Some(res) = res - && let Some(def_id) = res.opt_def_id().and_then(|el| el.as_local()) - { - if self.def_id_represents_local_inlined_item(def_id.to_def_id()) { - self.worklist.push(def_id); - } else { - match res { - // Reachable constants and reachable statics can have their contents inlined - // into other crates. Mark them as reachable and recurse into their body. - Res::Def(DefKind::Const | DefKind::AssocConst | DefKind::Static { .. }, _) => { - self.worklist.push(def_id); - } - _ => { - self.reachable_symbols.insert(def_id); - } - } - } + if let Some(res) = res { + self.propagate_item(res); } intravisit::walk_expr(self, expr) @@ -201,17 +187,9 @@ impl<'tcx> ReachableContext<'tcx> { hir::ItemKind::Const(_, _, init) => { self.visit_nested_body(init); } - - // Reachable statics are inlined if read from another constant or static - // in other crates. Additionally anonymous nested statics may be created - // when evaluating a static, so preserve those, too. - hir::ItemKind::Static(_, _, init) => { - // FIXME(oli-obk): remove this body walking and instead walk the evaluated initializer - // to find nested items that end up in the final value instead of also marking symbols - // as reachable that are only needed for evaluation. - self.visit_nested_body(init); + hir::ItemKind::Static(..) => { if let Ok(alloc) = self.tcx.eval_static_initializer(item.owner_id.def_id) { - self.propagate_statics_from_alloc(item.owner_id.def_id, alloc); + self.propagate_from_alloc(alloc); } } @@ -281,25 +259,60 @@ impl<'tcx> ReachableContext<'tcx> { } } - /// Finds anonymous nested statics created for nested allocations and adds them to `reachable_symbols`. - fn propagate_statics_from_alloc(&mut self, root: LocalDefId, alloc: ConstAllocation<'tcx>) { + /// Finds things to add to `reachable_symbols` within allocations. + /// In contrast to visit_nested_body this ignores things that were only needed to evaluate + /// the allocation. + fn propagate_from_alloc(&mut self, alloc: ConstAllocation<'tcx>) { if !self.any_library { return; } for (_, prov) in alloc.0.provenance().ptrs().iter() { match self.tcx.global_alloc(prov.alloc_id()) { GlobalAlloc::Static(def_id) => { - if let Some(def_id) = def_id.as_local() - && self.tcx.local_parent(def_id) == root - // This is the main purpose of this function: add the def_id we find - // to `reachable_symbols`. - && self.reachable_symbols.insert(def_id) - && let Ok(alloc) = self.tcx.eval_static_initializer(def_id) - { - self.propagate_statics_from_alloc(root, alloc); + self.propagate_item(Res::Def(self.tcx.def_kind(def_id), def_id)) + } + GlobalAlloc::Function(instance) => { + self.propagate_item(Res::Def( + self.tcx.def_kind(instance.def_id()), + instance.def_id(), + )) + // TODO: walk generic args + } + GlobalAlloc::VTable(ty, trait_ref) => todo!("{ty:?}, {trait_ref:?}"), + GlobalAlloc::Memory(alloc) => self.propagate_from_alloc(alloc), + } + } + } + + fn propagate_item(&mut self, res: Res) { + let Res::Def(kind, def_id) = res else { return }; + let Some(def_id) = def_id.as_local() else { return }; + match kind { + DefKind::Static { nested: true, .. } => { + // This is the main purpose of this function: add the def_id we find + // to `reachable_symbols`. + if self.reachable_symbols.insert(def_id) { + if let Ok(alloc) = self.tcx.eval_static_initializer(def_id) { + // This cannot cause infinite recursion, because we abort by inserting into the + // work list once we hit a normal static. Nested statics, even if they somehow + // become recursive, are also not infinitely recursing, because of the + // `reachable_symbols` check above. + // We still need to protect against stack overflow due to deeply nested statics. + ensure_sufficient_stack(|| self.propagate_from_alloc(alloc)); } } - GlobalAlloc::Function(_) | GlobalAlloc::VTable(_, _) | GlobalAlloc::Memory(_) => {} + } + // Reachable constants and reachable statics can have their contents inlined + // into other crates. Mark them as reachable and recurse into their body. + DefKind::Const | DefKind::AssocConst | DefKind::Static { .. } => { + self.worklist.push(def_id); + } + _ => { + if self.def_id_represents_local_inlined_item(def_id.to_def_id()) { + self.worklist.push(def_id); + } else { + self.reachable_symbols.insert(def_id); + } } } } diff --git a/tests/codegen/dont_codegen_private_const_fn_only_used_in_const_eval.rs b/tests/codegen/dont_codegen_private_const_fn_only_used_in_const_eval.rs index 723ac015cdc1..eeeaebe52dd1 100644 --- a/tests/codegen/dont_codegen_private_const_fn_only_used_in_const_eval.rs +++ b/tests/codegen/dont_codegen_private_const_fn_only_used_in_const_eval.rs @@ -7,4 +7,4 @@ const fn foo() {} pub static FOO: () = foo(); -// CHECK: define{{.*}}foo{{.*}} +// CHECK-NOT: define{{.*}}foo{{.*}} From 746e4eff263527ba8960552ea62db11ab9821644 Mon Sep 17 00:00:00 2001 From: Oli Scherer Date: Tue, 12 Mar 2024 07:00:01 +0000 Subject: [PATCH 048/103] Test and implement reachability for trait objects and generic parameters of functions --- Cargo.lock | 1 + compiler/rustc_passes/Cargo.toml | 1 + compiler/rustc_passes/src/reachable.rs | 35 ++++++++++++++++--- compiler/rustc_privacy/src/lib.rs | 4 +-- .../cross-crate/auxiliary/static_init_aux.rs | 21 +++++++++++ tests/ui/cross-crate/static-init.rs | 4 +++ 6 files changed, 60 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 16aed3dc49ca..94e2570ebafc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4400,6 +4400,7 @@ dependencies = [ "rustc_lexer", "rustc_macros", "rustc_middle", + "rustc_privacy", "rustc_session", "rustc_span", "rustc_target", diff --git a/compiler/rustc_passes/Cargo.toml b/compiler/rustc_passes/Cargo.toml index 6abfa08c5308..b45a8dae277e 100644 --- a/compiler/rustc_passes/Cargo.toml +++ b/compiler/rustc_passes/Cargo.toml @@ -18,6 +18,7 @@ rustc_index = { path = "../rustc_index" } rustc_lexer = { path = "../rustc_lexer" } rustc_macros = { path = "../rustc_macros" } rustc_middle = { path = "../rustc_middle" } +rustc_privacy = { path = "../rustc_privacy" } rustc_session = { path = "../rustc_session" } rustc_span = { path = "../rustc_span" } rustc_target = { path = "../rustc_target" } diff --git a/compiler/rustc_passes/src/reachable.rs b/compiler/rustc_passes/src/reachable.rs index 0dd3185fc83f..718c2345397e 100644 --- a/compiler/rustc_passes/src/reachable.rs +++ b/compiler/rustc_passes/src/reachable.rs @@ -16,7 +16,8 @@ use rustc_middle::middle::codegen_fn_attrs::{CodegenFnAttrFlags, CodegenFnAttrs} use rustc_middle::middle::privacy::{self, Level}; use rustc_middle::mir::interpret::{ConstAllocation, GlobalAlloc}; use rustc_middle::query::Providers; -use rustc_middle::ty::{self, TyCtxt}; +use rustc_middle::ty::{self, ExistentialTraitRef, TyCtxt}; +use rustc_privacy::DefIdVisitor; use rustc_session::config::CrateType; use rustc_target::spec::abi::Abi; @@ -272,13 +273,22 @@ impl<'tcx> ReachableContext<'tcx> { self.propagate_item(Res::Def(self.tcx.def_kind(def_id), def_id)) } GlobalAlloc::Function(instance) => { + // Manually visit to actually see the instance's `DefId`. Type visitors won't see it self.propagate_item(Res::Def( self.tcx.def_kind(instance.def_id()), instance.def_id(), - )) - // TODO: walk generic args + )); + self.visit(instance.args); + } + GlobalAlloc::VTable(ty, trait_ref) => { + self.visit(ty); + // Manually visit to actually see the trait's `DefId`. Type visitors won't see it + if let Some(trait_ref) = trait_ref { + let ExistentialTraitRef { def_id, args } = trait_ref.skip_binder(); + self.visit_def_id(def_id, "", &""); + self.visit(args); + } } - GlobalAlloc::VTable(ty, trait_ref) => todo!("{ty:?}, {trait_ref:?}"), GlobalAlloc::Memory(alloc) => self.propagate_from_alloc(alloc), } } @@ -318,6 +328,23 @@ impl<'tcx> ReachableContext<'tcx> { } } +impl<'tcx> DefIdVisitor<'tcx> for ReachableContext<'tcx> { + type Result = (); + + fn tcx(&self) -> TyCtxt<'tcx> { + self.tcx + } + + fn visit_def_id( + &mut self, + def_id: DefId, + _kind: &str, + _descr: &dyn std::fmt::Display, + ) -> Self::Result { + self.propagate_item(Res::Def(self.tcx.def_kind(def_id), def_id)) + } +} + fn check_item<'tcx>( tcx: TyCtxt<'tcx>, id: hir::ItemId, diff --git a/compiler/rustc_privacy/src/lib.rs b/compiler/rustc_privacy/src/lib.rs index 9f8cb8fcb41e..073982ca5c37 100644 --- a/compiler/rustc_privacy/src/lib.rs +++ b/compiler/rustc_privacy/src/lib.rs @@ -67,7 +67,7 @@ impl<'tcx> fmt::Display for LazyDefPathStr<'tcx> { /// First, it doesn't have overridable `fn visit_trait_ref`, so we have to catch trait `DefId`s /// manually. Second, it doesn't visit some type components like signatures of fn types, or traits /// in `impl Trait`, see individual comments in `DefIdVisitorSkeleton::visit_ty`. -trait DefIdVisitor<'tcx> { +pub trait DefIdVisitor<'tcx> { type Result: VisitorResult = (); const SHALLOW: bool = false; const SKIP_ASSOC_TYS: bool = false; @@ -98,7 +98,7 @@ trait DefIdVisitor<'tcx> { } } -struct DefIdVisitorSkeleton<'v, 'tcx, V: ?Sized> { +pub struct DefIdVisitorSkeleton<'v, 'tcx, V: ?Sized> { def_id_visitor: &'v mut V, visited_opaque_tys: FxHashSet, dummy: PhantomData>, diff --git a/tests/ui/cross-crate/auxiliary/static_init_aux.rs b/tests/ui/cross-crate/auxiliary/static_init_aux.rs index 5e172ef3198a..dca708733b92 100644 --- a/tests/ui/cross-crate/auxiliary/static_init_aux.rs +++ b/tests/ui/cross-crate/auxiliary/static_init_aux.rs @@ -1,6 +1,8 @@ pub static V: &u32 = &X; pub static F: fn() = f; pub static G: fn() = G0; +pub static H: &(dyn Fn() + Sync) = &h; +pub static I: fn() = Helper(j).mk(); static X: u32 = 42; static G0: fn() = g; @@ -12,3 +14,22 @@ pub fn v() -> *const u32 { fn f() {} fn g() {} + +fn h() {} + +#[derive(Copy, Clone)] +struct Helper(T); + +impl Helper { + const fn mk(self) -> fn() { + i:: + } +} + +fn i() { + assert_eq!(std::mem::size_of::(), 0); + // unsafe to work around the lack of a `Default` impl for function items + unsafe { (std::mem::transmute_copy::<(), T>(&()))() } +} + +fn j() {} diff --git a/tests/ui/cross-crate/static-init.rs b/tests/ui/cross-crate/static-init.rs index 090ad5f810e1..c4697a1d010c 100644 --- a/tests/ui/cross-crate/static-init.rs +++ b/tests/ui/cross-crate/static-init.rs @@ -6,6 +6,8 @@ extern crate static_init_aux as aux; static V: &u32 = aux::V; static F: fn() = aux::F; static G: fn() = aux::G; +static H: &(dyn Fn() + Sync) = aux::H; +static I: fn() = aux::I; fn v() -> *const u32 { V @@ -15,4 +17,6 @@ fn main() { assert_eq!(aux::v(), crate::v()); F(); G(); + H(); + I(); } From 04524c8f6aef8a8a1b3b80edb93815e86caeddfa Mon Sep 17 00:00:00 2001 From: Michael Goulet Date: Mon, 11 Mar 2024 16:57:18 +0000 Subject: [PATCH 049/103] Consolidate WF for aliases --- .../rustc_trait_selection/src/traits/wf.rs | 28 ++++++------------- .../in-trait/return-dont-satisfy-bounds.rs | 1 + .../return-dont-satisfy-bounds.stderr | 18 +++++++++++- .../ui/lifetimes/issue-76168-hr-outlives-3.rs | 1 + .../issue-76168-hr-outlives-3.stderr | 23 ++++++++++++--- .../type-match-with-late-bound.stderr | 23 ++++++++++++++- 6 files changed, 68 insertions(+), 26 deletions(-) diff --git a/compiler/rustc_trait_selection/src/traits/wf.rs b/compiler/rustc_trait_selection/src/traits/wf.rs index f89daf033f6c..64f02bfd3211 100644 --- a/compiler/rustc_trait_selection/src/traits/wf.rs +++ b/compiler/rustc_trait_selection/src/traits/wf.rs @@ -164,7 +164,7 @@ pub fn clause_obligations<'tcx>( wf.compute(ty.into()); } ty::ClauseKind::Projection(t) => { - wf.compute_projection(t.projection_ty); + wf.compute_alias(t.projection_ty); wf.compute(match t.term.unpack() { ty::TermKind::Ty(ty) => ty.into(), ty::TermKind::Const(c) => c.into(), @@ -436,9 +436,9 @@ impl<'a, 'tcx> WfPredicates<'a, 'tcx> { } } - /// Pushes the obligations required for `trait_ref::Item` to be WF + /// Pushes the obligations required for an alias (except inherent) to be WF /// into `self.out`. - fn compute_projection(&mut self, data: ty::AliasTy<'tcx>) { + fn compute_alias(&mut self, data: ty::AliasTy<'tcx>) { // A projection is well-formed if // // (a) its predicates hold (*) @@ -466,6 +466,9 @@ impl<'a, 'tcx> WfPredicates<'a, 'tcx> { self.compute_projection_args(data.args); } + /// Pushes the obligations required for an inherent alias to be WF + /// into `self.out`. + // FIXME(inherent_associated_types): Merge this function with `fn compute_alias`. fn compute_inherent_projection(&mut self, data: ty::AliasTy<'tcx>) { // An inherent projection is well-formed if // @@ -688,8 +691,8 @@ impl<'a, 'tcx> TypeVisitor> for WfPredicates<'a, 'tcx> { // Simple cases that are WF if their type args are WF. } - ty::Alias(ty::Projection, data) => { - self.compute_projection(data); + ty::Alias(ty::Projection | ty::Opaque | ty::Weak, data) => { + self.compute_alias(data); return; // Subtree handled by compute_projection. } ty::Alias(ty::Inherent, data) => { @@ -791,21 +794,6 @@ impl<'a, 'tcx> TypeVisitor> for WfPredicates<'a, 'tcx> { // types appearing in the fn signature. } - ty::Alias(ty::Opaque, ty::AliasTy { def_id, args, .. }) => { - // All of the requirements on type parameters - // have already been checked for `impl Trait` in - // return position. We do need to check type-alias-impl-trait though. - if self.tcx().is_type_alias_impl_trait(def_id) { - let obligations = self.nominal_obligations(def_id, args); - self.out.extend(obligations); - } - } - - ty::Alias(ty::Weak, ty::AliasTy { def_id, args, .. }) => { - let obligations = self.nominal_obligations(def_id, args); - self.out.extend(obligations); - } - ty::Dynamic(data, r, _) => { // WfObject // diff --git a/tests/ui/impl-trait/in-trait/return-dont-satisfy-bounds.rs b/tests/ui/impl-trait/in-trait/return-dont-satisfy-bounds.rs index ff265e576b90..84bc39d92630 100644 --- a/tests/ui/impl-trait/in-trait/return-dont-satisfy-bounds.rs +++ b/tests/ui/impl-trait/in-trait/return-dont-satisfy-bounds.rs @@ -9,6 +9,7 @@ impl Foo for Bar { //~^ ERROR: the trait bound `impl Foo: Foo` is not satisfied [E0277] //~| ERROR: the trait bound `Bar: Foo` is not satisfied [E0277] //~| ERROR: impl has stricter requirements than trait + //~| ERROR: the trait bound `F2: Foo` is not satisfied self } } diff --git a/tests/ui/impl-trait/in-trait/return-dont-satisfy-bounds.stderr b/tests/ui/impl-trait/in-trait/return-dont-satisfy-bounds.stderr index 12725c3456fd..fbf82a24b501 100644 --- a/tests/ui/impl-trait/in-trait/return-dont-satisfy-bounds.stderr +++ b/tests/ui/impl-trait/in-trait/return-dont-satisfy-bounds.stderr @@ -11,6 +11,22 @@ note: required by a bound in `Foo::{synthetic#0}` LL | fn foo(self) -> impl Foo; | ^^^^^^ required by this bound in `Foo::{synthetic#0}` +error[E0277]: the trait bound `F2: Foo` is not satisfied + --> $DIR/return-dont-satisfy-bounds.rs:8:34 + | +LL | fn foo>(self) -> impl Foo { + | ^^^^^^^^^^^^ the trait `Foo` is not implemented for `F2` + | +note: required by a bound in `>::foo` + --> $DIR/return-dont-satisfy-bounds.rs:8:16 + | +LL | fn foo>(self) -> impl Foo { + | ^^^^^^^ required by this bound in `>::foo` +help: consider further restricting this bound + | +LL | fn foo + Foo>(self) -> impl Foo { + | +++++++++ + error[E0276]: impl has stricter requirements than trait --> $DIR/return-dont-satisfy-bounds.rs:8:16 | @@ -32,7 +48,7 @@ LL | self = help: the trait `Foo` is implemented for `Bar` = help: for that trait implementation, expected `char`, found `u8` -error: aborting due to 3 previous errors +error: aborting due to 4 previous errors Some errors have detailed explanations: E0276, E0277. For more information about an error, try `rustc --explain E0276`. diff --git a/tests/ui/lifetimes/issue-76168-hr-outlives-3.rs b/tests/ui/lifetimes/issue-76168-hr-outlives-3.rs index 85eeb5d4c901..eab436fa3419 100644 --- a/tests/ui/lifetimes/issue-76168-hr-outlives-3.rs +++ b/tests/ui/lifetimes/issue-76168-hr-outlives-3.rs @@ -7,6 +7,7 @@ async fn wrapper(f: F) //~^ ERROR: expected a `FnOnce(&'a mut i32)` closure, found `i32` //~| ERROR: expected a `FnOnce(&'a mut i32)` closure, found `i32` //~| ERROR: expected a `FnOnce(&'a mut i32)` closure, found `i32` +//~| ERROR: expected a `FnOnce(&'a mut i32)` closure, found `i32` where F:, for<'a> >::Output: Future + 'a, diff --git a/tests/ui/lifetimes/issue-76168-hr-outlives-3.stderr b/tests/ui/lifetimes/issue-76168-hr-outlives-3.stderr index 578ba149baf3..e9f97d1d93bd 100644 --- a/tests/ui/lifetimes/issue-76168-hr-outlives-3.stderr +++ b/tests/ui/lifetimes/issue-76168-hr-outlives-3.stderr @@ -5,7 +5,7 @@ LL | / async fn wrapper(f: F) LL | | LL | | LL | | -LL | | where +... | LL | | F:, LL | | for<'a> >::Output: Future + 'a, | |__________________________________________________________________________^ expected an `FnOnce(&'a mut i32)` closure, found `i32` @@ -27,7 +27,7 @@ LL | / async fn wrapper(f: F) LL | | LL | | LL | | -LL | | where +... | LL | | F:, LL | | for<'a> >::Output: Future + 'a, | |__________________________________________________________________________^ expected an `FnOnce(&'a mut i32)` closure, found `i32` @@ -35,7 +35,22 @@ LL | | for<'a> >::Output: Future + 'a = help: the trait `for<'a> FnOnce<(&'a mut i32,)>` is not implemented for `i32` error[E0277]: expected a `FnOnce(&'a mut i32)` closure, found `i32` - --> $DIR/issue-76168-hr-outlives-3.rs:13:1 + --> $DIR/issue-76168-hr-outlives-3.rs:6:1 + | +LL | / async fn wrapper(f: F) +LL | | +LL | | +LL | | +... | +LL | | F:, +LL | | for<'a> >::Output: Future + 'a, + | |__________________________________________________________________________^ expected an `FnOnce(&'a mut i32)` closure, found `i32` + | + = help: the trait `for<'a> FnOnce<(&'a mut i32,)>` is not implemented for `i32` + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error[E0277]: expected a `FnOnce(&'a mut i32)` closure, found `i32` + --> $DIR/issue-76168-hr-outlives-3.rs:14:1 | LL | / { LL | | @@ -46,6 +61,6 @@ LL | | } | = help: the trait `for<'a> FnOnce<(&'a mut i32,)>` is not implemented for `i32` -error: aborting due to 4 previous errors +error: aborting due to 5 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/traits/non_lifetime_binders/type-match-with-late-bound.stderr b/tests/ui/traits/non_lifetime_binders/type-match-with-late-bound.stderr index 6c259621466d..40e16dde6e4a 100644 --- a/tests/ui/traits/non_lifetime_binders/type-match-with-late-bound.stderr +++ b/tests/ui/traits/non_lifetime_binders/type-match-with-late-bound.stderr @@ -7,6 +7,27 @@ LL | #![feature(non_lifetime_binders)] = note: see issue #108185 for more information = note: `#[warn(incomplete_features)]` on by default +error[E0309]: the placeholder type `!1_"F"` may not live long enough + --> $DIR/type-match-with-late-bound.rs:8:1 + | +LL | async fn walk2<'a, T: 'a>(_: T) + | ^ -- the placeholder type `!1_"F"` must be valid for the lifetime `'a` as defined here... + | _| + | | +LL | | where +LL | | for F: 'a, + | |_________________^ ...so that the type `F` will meet its required lifetime bounds... + | +note: ...that is required by this bound + --> $DIR/type-match-with-late-bound.rs:10:15 + | +LL | for F: 'a, + | ^^ +help: consider adding an explicit lifetime bound + | +LL | for F: 'a, !1_"F": 'a + | ~~~~~~~~~~~~ + error[E0309]: the placeholder type `!1_"F"` may not live long enough --> $DIR/type-match-with-late-bound.rs:11:1 | @@ -35,6 +56,6 @@ help: consider adding an explicit lifetime bound LL | for F: 'a, !2_"F": 'a | ~~~~~~~~~~~~ -error: aborting due to 2 previous errors; 1 warning emitted +error: aborting due to 3 previous errors; 1 warning emitted For more information about this error, try `rustc --explain E0309`. From bc532a6307b498eb050e9553c186bf63369c4690 Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Sat, 2 Mar 2024 19:44:35 +0100 Subject: [PATCH 050/103] Hide implementation details for `NonZero` auto traits. --- library/core/src/num/nonzero.rs | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/library/core/src/num/nonzero.rs b/library/core/src/num/nonzero.rs index 89d2b4f7dc1d..1f7a4e276f55 100644 --- a/library/core/src/num/nonzero.rs +++ b/library/core/src/num/nonzero.rs @@ -4,8 +4,9 @@ use crate::cmp::Ordering; use crate::fmt; use crate::hash::{Hash, Hasher}; use crate::intrinsics; -use crate::marker::StructuralPartialEq; +use crate::marker::{Freeze, StructuralPartialEq}; use crate::ops::{BitOr, BitOrAssign, Div, Neg, Rem}; +use crate::panic::{RefUnwindSafe, UnwindSafe}; use crate::ptr; use crate::str::FromStr; @@ -129,6 +130,26 @@ impl_nonzero_fmt!(Octal); impl_nonzero_fmt!(LowerHex); impl_nonzero_fmt!(UpperHex); +macro_rules! impl_nonzero_auto_trait { + (unsafe $Trait:ident) => { + #[stable(feature = "nonzero", since = "1.28.0")] + unsafe impl $Trait for NonZero where T: ZeroablePrimitive + $Trait {} + }; + ($Trait:ident) => { + #[stable(feature = "nonzero", since = "1.28.0")] + impl $Trait for NonZero where T: ZeroablePrimitive + $Trait {} + }; +} + +// Implement auto-traits manually based on `T` to avoid docs exposing +// the `ZeroablePrimitive::NonZeroInner` implementation detail. +impl_nonzero_auto_trait!(unsafe Freeze); +impl_nonzero_auto_trait!(RefUnwindSafe); +impl_nonzero_auto_trait!(unsafe Send); +impl_nonzero_auto_trait!(unsafe Sync); +impl_nonzero_auto_trait!(Unpin); +impl_nonzero_auto_trait!(UnwindSafe); + #[stable(feature = "nonzero", since = "1.28.0")] impl Clone for NonZero where From 40f8227d6df463a6af592d631efb260d19924474 Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Wed, 6 Mar 2024 17:28:45 +0100 Subject: [PATCH 051/103] Fix lint. --- compiler/rustc_lint/src/builtin.rs | 2 ++ tests/ui/lint/invalid_value.stderr | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/compiler/rustc_lint/src/builtin.rs b/compiler/rustc_lint/src/builtin.rs index 5f0af6aee6ac..f1f3c26c4568 100644 --- a/compiler/rustc_lint/src/builtin.rs +++ b/compiler/rustc_lint/src/builtin.rs @@ -2468,6 +2468,8 @@ impl<'tcx> LateLintPass<'tcx> for InvalidValue { ty: Ty<'tcx>, init: InitKind, ) -> Option { + let ty = cx.tcx.try_normalize_erasing_regions(cx.param_env, ty).unwrap_or(ty); + use rustc_type_ir::TyKind::*; match ty.kind() { // Primitive types that don't like 0 as a value. diff --git a/tests/ui/lint/invalid_value.stderr b/tests/ui/lint/invalid_value.stderr index e45d061a1f05..b4e7421829f8 100644 --- a/tests/ui/lint/invalid_value.stderr +++ b/tests/ui/lint/invalid_value.stderr @@ -323,6 +323,7 @@ LL | let _val: (NonZero, i32) = mem::zeroed(); | ^^^^^^^^^^^^^ this code causes undefined behavior when executed | = note: `std::num::NonZero` must be non-null + = note: because `core::num::nonzero::private::NonZeroU32Inner` must be non-null error: the type `(NonZero, i32)` does not permit being left uninitialized --> $DIR/invalid_value.rs:95:41 @@ -331,6 +332,8 @@ LL | let _val: (NonZero, i32) = mem::uninitialized(); | ^^^^^^^^^^^^^^^^^^^^ this code causes undefined behavior when executed | = note: `std::num::NonZero` must be non-null + = note: because `core::num::nonzero::private::NonZeroU32Inner` must be non-null + = note: integers must be initialized error: the type `*const dyn Send` does not permit zero-initialization --> $DIR/invalid_value.rs:97:37 @@ -412,6 +415,7 @@ note: because `std::num::NonZero` must be non-null (in this field of the on | LL | Banana(NonZero), | ^^^^^^^^^^^^ + = note: because `core::num::nonzero::private::NonZeroU32Inner` must be non-null error: the type `OneFruitNonZero` does not permit being left uninitialized --> $DIR/invalid_value.rs:107:37 @@ -425,6 +429,8 @@ note: because `std::num::NonZero` must be non-null (in this field of the on | LL | Banana(NonZero), | ^^^^^^^^^^^^ + = note: because `core::num::nonzero::private::NonZeroU32Inner` must be non-null + = note: integers must be initialized error: the type `bool` does not permit being left uninitialized --> $DIR/invalid_value.rs:111:26 @@ -596,6 +602,7 @@ LL | let _val: NonZero = mem::transmute(0); | ^^^^^^^^^^^^^^^^^ this code causes undefined behavior when executed | = note: `std::num::NonZero` must be non-null + = note: because `core::num::nonzero::private::NonZeroU32Inner` must be non-null error: the type `NonNull` does not permit zero-initialization --> $DIR/invalid_value.rs:156:34 From ecee730c45cdc7a582734d6440acba08a1214f82 Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Sat, 9 Mar 2024 16:38:50 +0100 Subject: [PATCH 052/103] Try fixing `debuginfo` test. --- src/etc/lldb_commands | 2 +- src/etc/natvis/libcore.natvis | 5 ++++- src/etc/rust_types.py | 2 +- src/tools/compiletest/src/runtest.rs | 2 +- tests/debuginfo/numeric-types.rs | 24 ++++++++++++------------ 5 files changed, 19 insertions(+), 16 deletions(-) diff --git a/src/etc/lldb_commands b/src/etc/lldb_commands index ed66ecf30729..5304f2ca34a2 100644 --- a/src/etc/lldb_commands +++ b/src/etc/lldb_commands @@ -15,5 +15,5 @@ type summary add -F lldb_lookup.summary_lookup -e -x -h "^(core::([a-z_]+::)+)C type summary add -F lldb_lookup.summary_lookup -e -x -h "^(core::([a-z_]+::)+)Ref<.+>$" --category Rust type summary add -F lldb_lookup.summary_lookup -e -x -h "^(core::([a-z_]+::)+)RefMut<.+>$" --category Rust type summary add -F lldb_lookup.summary_lookup -e -x -h "^(core::([a-z_]+::)+)RefCell<.+>$" --category Rust -type summary add -F lldb_lookup.summary_lookup -e -x -h "^core::num::([a-z_]+::)*NonZero.+$" --category Rust +type summary add -F lldb_lookup.summary_lookup -e -x -h "^core::num::([a-z_]+::)*NonZero<.+>$" --category Rust type category enable Rust diff --git a/src/etc/natvis/libcore.natvis b/src/etc/natvis/libcore.natvis index 5e0c21a13a9f..8a441cf20935 100644 --- a/src/etc/natvis/libcore.natvis +++ b/src/etc/natvis/libcore.natvis @@ -42,7 +42,10 @@ - {__0} + {__0.__0} + + __0.__0 + diff --git a/src/etc/rust_types.py b/src/etc/rust_types.py index bf512bc99b8f..3b2d2f9e9834 100644 --- a/src/etc/rust_types.py +++ b/src/etc/rust_types.py @@ -50,7 +50,7 @@ STD_CELL_REGEX = re.compile(r"^(core::(\w+::)+)Cell<.+>$") STD_REF_REGEX = re.compile(r"^(core::(\w+::)+)Ref<.+>$") STD_REF_MUT_REGEX = re.compile(r"^(core::(\w+::)+)RefMut<.+>$") STD_REF_CELL_REGEX = re.compile(r"^(core::(\w+::)+)RefCell<.+>$") -STD_NONZERO_NUMBER_REGEX = re.compile(r"^core::num::([a-z_]+::)*NonZero.+$") +STD_NONZERO_NUMBER_REGEX = re.compile(r"^core::num::([a-z_]+::)*NonZero<.+>$") TUPLE_ITEM_REGEX = re.compile(r"__\d+$") diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index ae0db88d873b..1e1c5fb20d40 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -1495,7 +1495,7 @@ impl<'test> TestCx<'test> { "^(core::([a-z_]+::)+)Ref<.+>$", "^(core::([a-z_]+::)+)RefMut<.+>$", "^(core::([a-z_]+::)+)RefCell<.+>$", - "^core::num::([a-z_]+::)*NonZero.+$", + "^core::num::([a-z_]+::)*NonZero<.+>$", ]; // In newer versions of lldb, persistent results (the `$N =` part at the start of diff --git a/tests/debuginfo/numeric-types.rs b/tests/debuginfo/numeric-types.rs index 74c9e5e1dc3f..9ea770652b1e 100644 --- a/tests/debuginfo/numeric-types.rs +++ b/tests/debuginfo/numeric-types.rs @@ -203,40 +203,40 @@ // lldb-command:run // lldb-command:print/d nz_i8 -// lldb-check:[...]$0 = 11 { __0 = 11 } +// lldb-check:[...]$0 = None { __0 = { 0 = 11 } } // lldb-command:print nz_i16 -// lldb-check:[...]$1 = 22 { __0 = 22 } +// lldb-check:[...]$1 = None { __0 = { 0 = 22 } } // lldb-command:print nz_i32 -// lldb-check:[...]$2 = 33 { __0 = 33 } +// lldb-check:[...]$2 = None { __0 = { 0 = 33 } } // lldb-command:print nz_i64 -// lldb-check:[...]$3 = 44 { __0 = 44 } +// lldb-check:[...]$3 = None { __0 = { 0 = 44 } } // lldb-command:print nz_i128 -// lldb-check:[...]$4 = 55 { __0 = 55 } +// lldb-check:[...]$4 = None { __0 = { 0 = 55 } } // lldb-command:print nz_isize -// lldb-check:[...]$5 = 66 { __0 = 66 } +// lldb-check:[...]$5 = None { __0 = { 0 = 66 } } // lldb-command:print/d nz_u8 -// lldb-check:[...]$6 = 77 { __0 = 77 } +// lldb-check:[...]$6 = None { __0 = { 0 = 77 } } // lldb-command:print nz_u16 -// lldb-check:[...]$7 = 88 { __0 = 88 } +// lldb-check:[...]$7 = None { __0 = { 0 = 88 } } // lldb-command:print nz_u32 -// lldb-check:[...]$8 = 99 { __0 = 99 } +// lldb-check:[...]$8 = None { __0 = { 0 = 99 } } // lldb-command:print nz_u64 -// lldb-check:[...]$9 = 100 { __0 = 100 } +// lldb-check:[...]$9 = None { __0 = { 0 = 100 } } // lldb-command:print nz_u128 -// lldb-check:[...]$10 = 111 { __0 = 111 } +// lldb-check:[...]$10 = None { __0 = { 0 = 111 } } // lldb-command:print nz_usize -// lldb-check:[...]$11 = 122 { __0 = 122 } +// lldb-check:[...]$11 = None { __0 = { 0 = 122 } } #![feature(generic_nonzero)] use std::num::*; From 4a799082fe5768fdc991a64f07debfb56b703622 Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Sun, 10 Mar 2024 06:45:39 +0100 Subject: [PATCH 053/103] Fix `StdNonZeroNumberSummaryProvider`. --- src/etc/lldb_commands | 2 +- src/etc/lldb_providers.py | 11 ++++++---- src/etc/rust_types.py | 30 ++++++++++++++-------------- src/tools/compiletest/src/runtest.rs | 2 +- tests/debuginfo/numeric-types.rs | 26 +++++++++++++----------- 5 files changed, 38 insertions(+), 33 deletions(-) diff --git a/src/etc/lldb_commands b/src/etc/lldb_commands index 5304f2ca34a2..615d13ccd0ff 100644 --- a/src/etc/lldb_commands +++ b/src/etc/lldb_commands @@ -15,5 +15,5 @@ type summary add -F lldb_lookup.summary_lookup -e -x -h "^(core::([a-z_]+::)+)C type summary add -F lldb_lookup.summary_lookup -e -x -h "^(core::([a-z_]+::)+)Ref<.+>$" --category Rust type summary add -F lldb_lookup.summary_lookup -e -x -h "^(core::([a-z_]+::)+)RefMut<.+>$" --category Rust type summary add -F lldb_lookup.summary_lookup -e -x -h "^(core::([a-z_]+::)+)RefCell<.+>$" --category Rust -type summary add -F lldb_lookup.summary_lookup -e -x -h "^core::num::([a-z_]+::)*NonZero<.+>$" --category Rust +type summary add -F lldb_lookup.summary_lookup -e -x -h "^(core::([a-z_]+::)+)NonZero<.+>$" --category Rust type category enable Rust diff --git a/src/etc/lldb_providers.py b/src/etc/lldb_providers.py index cfb3f0a4eaeb..319660f0ddc5 100644 --- a/src/etc/lldb_providers.py +++ b/src/etc/lldb_providers.py @@ -743,7 +743,10 @@ class StdRefSyntheticProvider: def StdNonZeroNumberSummaryProvider(valobj, _dict): # type: (SBValue, dict) -> str - objtype = valobj.GetType() - field = objtype.GetFieldAtIndex(0) - element = valobj.GetChildMemberWithName(field.name) - return element.GetValue() + inner = valobj.GetChildAtIndex(0) + inner_inner = inner.GetChildAtIndex(0) + + if inner_inner.GetTypeName() in ['char', 'unsigned char']: + return str(inner_inner.GetValueAsSigned()) + else: + return inner_inner.GetValue() diff --git a/src/etc/rust_types.py b/src/etc/rust_types.py index 3b2d2f9e9834..2b06683ef93c 100644 --- a/src/etc/rust_types.py +++ b/src/etc/rust_types.py @@ -34,23 +34,23 @@ class RustType(object): STD_NONZERO_NUMBER = "StdNonZeroNumber" -STD_STRING_REGEX = re.compile(r"^(alloc::(\w+::)+)String$") +STD_STRING_REGEX = re.compile(r"^(alloc::([a-z_]+::)+)String$") STD_STR_REGEX = re.compile(r"^&(mut )?str$") STD_SLICE_REGEX = re.compile(r"^&(mut )?\[.+\]$") -STD_OS_STRING_REGEX = re.compile(r"^(std::ffi::(\w+::)+)OsString$") -STD_VEC_REGEX = re.compile(r"^(alloc::(\w+::)+)Vec<.+>$") -STD_VEC_DEQUE_REGEX = re.compile(r"^(alloc::(\w+::)+)VecDeque<.+>$") -STD_BTREE_SET_REGEX = re.compile(r"^(alloc::(\w+::)+)BTreeSet<.+>$") -STD_BTREE_MAP_REGEX = re.compile(r"^(alloc::(\w+::)+)BTreeMap<.+>$") -STD_HASH_MAP_REGEX = re.compile(r"^(std::collections::(\w+::)+)HashMap<.+>$") -STD_HASH_SET_REGEX = re.compile(r"^(std::collections::(\w+::)+)HashSet<.+>$") -STD_RC_REGEX = re.compile(r"^(alloc::(\w+::)+)Rc<.+>$") -STD_ARC_REGEX = re.compile(r"^(alloc::(\w+::)+)Arc<.+>$") -STD_CELL_REGEX = re.compile(r"^(core::(\w+::)+)Cell<.+>$") -STD_REF_REGEX = re.compile(r"^(core::(\w+::)+)Ref<.+>$") -STD_REF_MUT_REGEX = re.compile(r"^(core::(\w+::)+)RefMut<.+>$") -STD_REF_CELL_REGEX = re.compile(r"^(core::(\w+::)+)RefCell<.+>$") -STD_NONZERO_NUMBER_REGEX = re.compile(r"^core::num::([a-z_]+::)*NonZero<.+>$") +STD_OS_STRING_REGEX = re.compile(r"^(std::ffi::([a-z_]+::)+)OsString$") +STD_VEC_REGEX = re.compile(r"^(alloc::([a-z_]+::)+)Vec<.+>$") +STD_VEC_DEQUE_REGEX = re.compile(r"^(alloc::([a-z_]+::)+)VecDeque<.+>$") +STD_BTREE_SET_REGEX = re.compile(r"^(alloc::([a-z_]+::)+)BTreeSet<.+>$") +STD_BTREE_MAP_REGEX = re.compile(r"^(alloc::([a-z_]+::)+)BTreeMap<.+>$") +STD_HASH_MAP_REGEX = re.compile(r"^(std::collections::([a-z_]+::)+)HashMap<.+>$") +STD_HASH_SET_REGEX = re.compile(r"^(std::collections::([a-z_]+::)+)HashSet<.+>$") +STD_RC_REGEX = re.compile(r"^(alloc::([a-z_]+::)+)Rc<.+>$") +STD_ARC_REGEX = re.compile(r"^(alloc::([a-z_]+::)+)Arc<.+>$") +STD_CELL_REGEX = re.compile(r"^(core::([a-z_]+::)+)Cell<.+>$") +STD_REF_REGEX = re.compile(r"^(core::([a-z_]+::)+)Ref<.+>$") +STD_REF_MUT_REGEX = re.compile(r"^(core::([a-z_]+::)+)RefMut<.+>$") +STD_REF_CELL_REGEX = re.compile(r"^(core::([a-z_]+::)+)RefCell<.+>$") +STD_NONZERO_NUMBER_REGEX = re.compile(r"^(core::([a-z_]+::)+)NonZero<.+>$") TUPLE_ITEM_REGEX = re.compile(r"__\d+$") diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index 1e1c5fb20d40..386db1a64b83 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -1495,7 +1495,7 @@ impl<'test> TestCx<'test> { "^(core::([a-z_]+::)+)Ref<.+>$", "^(core::([a-z_]+::)+)RefMut<.+>$", "^(core::([a-z_]+::)+)RefCell<.+>$", - "^core::num::([a-z_]+::)*NonZero<.+>$", + "^(core::([a-z_]+::)+)NonZero<.+>$", ]; // In newer versions of lldb, persistent results (the `$N =` part at the start of diff --git a/tests/debuginfo/numeric-types.rs b/tests/debuginfo/numeric-types.rs index 9ea770652b1e..f662fa7ed549 100644 --- a/tests/debuginfo/numeric-types.rs +++ b/tests/debuginfo/numeric-types.rs @@ -203,40 +203,42 @@ // lldb-command:run // lldb-command:print/d nz_i8 -// lldb-check:[...]$0 = None { __0 = { 0 = 11 } } +// lldb-check:[...]$0 = 11 { __0 = { 0 = 11 } } // lldb-command:print nz_i16 -// lldb-check:[...]$1 = None { __0 = { 0 = 22 } } +// lldb-check:[...]$1 = 22 { __0 = { 0 = 22 } } // lldb-command:print nz_i32 -// lldb-check:[...]$2 = None { __0 = { 0 = 33 } } +// lldb-check:[...]$2 = 33 { __0 = { 0 = 33 } } // lldb-command:print nz_i64 -// lldb-check:[...]$3 = None { __0 = { 0 = 44 } } +// lldb-check:[...]$3 = 44 { __0 = { 0 = 44 } } // lldb-command:print nz_i128 -// lldb-check:[...]$4 = None { __0 = { 0 = 55 } } +// lldb-check:[...]$4 = 55 { __0 = { 0 = 55 } } // lldb-command:print nz_isize -// lldb-check:[...]$5 = None { __0 = { 0 = 66 } } +// FIXME: `lldb_lookup.summary_lookup` is never called for `NonZero` for some reason. +// // lldb-check:[...]$5 = 66 { __0 = { 0 = 66 } } // lldb-command:print/d nz_u8 -// lldb-check:[...]$6 = None { __0 = { 0 = 77 } } +// lldb-check:[...]$6 = 77 { __0 = { 0 = 77 } } // lldb-command:print nz_u16 -// lldb-check:[...]$7 = None { __0 = { 0 = 88 } } +// lldb-check:[...]$7 = 88 { __0 = { 0 = 88 } } // lldb-command:print nz_u32 -// lldb-check:[...]$8 = None { __0 = { 0 = 99 } } +// lldb-check:[...]$8 = 99 { __0 = { 0 = 99 } } // lldb-command:print nz_u64 -// lldb-check:[...]$9 = None { __0 = { 0 = 100 } } +// lldb-check:[...]$9 = 100 { __0 = { 0 = 100 } } // lldb-command:print nz_u128 -// lldb-check:[...]$10 = None { __0 = { 0 = 111 } } +// lldb-check:[...]$10 = 111 { __0 = { 0 = 111 } } // lldb-command:print nz_usize -// lldb-check:[...]$11 = None { __0 = { 0 = 122 } } +// FIXME: `lldb_lookup.summary_lookup` is never called for `NonZero` for some reason. +// // lldb-check:[...]$11 = 122 { __0 = { 0 = 122 } } #![feature(generic_nonzero)] use std::num::*; From 36a8daeb44ebee51fb769a106e5aafbbb4a59ebb Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Sun, 10 Mar 2024 13:43:41 +0100 Subject: [PATCH 054/103] Deduplicate `lldb_commands`. --- src/tools/compiletest/src/runtest.rs | 42 ++++++---------------------- 1 file changed, 9 insertions(+), 33 deletions(-) diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index 386db1a64b83..e26e9df6f16b 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -1474,29 +1474,8 @@ impl<'test> TestCx<'test> { // Switch LLDB into "Rust mode" let rust_src_root = self.config.find_rust_src_root().expect("Could not find Rust source root"); - let rust_pp_module_rel_path = Path::new("./src/etc/lldb_lookup.py"); - let rust_pp_module_abs_path = - rust_src_root.join(rust_pp_module_rel_path).to_str().unwrap().to_owned(); - - let rust_type_regexes = vec![ - "^(alloc::([a-z_]+::)+)String$", - "^&(mut )?str$", - "^&(mut )?\\[.+\\]$", - "^(std::ffi::([a-z_]+::)+)OsString$", - "^(alloc::([a-z_]+::)+)Vec<.+>$", - "^(alloc::([a-z_]+::)+)VecDeque<.+>$", - "^(alloc::([a-z_]+::)+)BTreeSet<.+>$", - "^(alloc::([a-z_]+::)+)BTreeMap<.+>$", - "^(std::collections::([a-z_]+::)+)HashMap<.+>$", - "^(std::collections::([a-z_]+::)+)HashSet<.+>$", - "^(alloc::([a-z_]+::)+)Rc<.+>$", - "^(alloc::([a-z_]+::)+)Arc<.+>$", - "^(core::([a-z_]+::)+)Cell<.+>$", - "^(core::([a-z_]+::)+)Ref<.+>$", - "^(core::([a-z_]+::)+)RefMut<.+>$", - "^(core::([a-z_]+::)+)RefCell<.+>$", - "^(core::([a-z_]+::)+)NonZero<.+>$", - ]; + let rust_pp_module_rel_path = Path::new("./src/etc"); + let rust_pp_module_abs_path = rust_src_root.join(rust_pp_module_rel_path); // In newer versions of lldb, persistent results (the `$N =` part at the start of // expressions you have evaluated that let you re-use the result) aren't printed, but lots @@ -1507,16 +1486,13 @@ impl<'test> TestCx<'test> { script_str.push_str("command unalias p\n"); script_str.push_str("command alias p expr --\n"); - script_str - .push_str(&format!("command script import {}\n", &rust_pp_module_abs_path[..])[..]); - script_str.push_str("type synthetic add -l lldb_lookup.synthetic_lookup -x '.*' "); - script_str.push_str("--category Rust\n"); - for type_regex in rust_type_regexes { - script_str.push_str("type summary add -F lldb_lookup.summary_lookup -e -x -h "); - script_str.push_str(&format!("'{}' ", type_regex)); - script_str.push_str("--category Rust\n"); - } - script_str.push_str("type category enable Rust\n"); + script_str.push_str(&format!( + "command script import {}/lldb_lookup.py\n", + rust_pp_module_abs_path.to_str().unwrap() + )); + File::open(rust_pp_module_abs_path.join("lldb_commands")) + .and_then(|mut file| file.read_to_string(&mut script_str)) + .expect("Failed to read lldb_commands"); // Set breakpoints on every line that contains the string "#break" let source_file_name = self.testpaths.file.file_name().unwrap().to_string_lossy(); From 75fba9d574dfd85d9046ddda67d2da2da86ce61c Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Sun, 10 Mar 2024 14:55:58 +0100 Subject: [PATCH 055/103] Remove LLDB persistent results in `compiletest`. --- src/tools/compiletest/src/runtest.rs | 9 -- tests/debuginfo/associated-types.rs | 18 ++-- tests/debuginfo/basic-types.rs | 26 ++--- tests/debuginfo/borrowed-basic.rs | 26 ++--- tests/debuginfo/borrowed-c-style-enum.rs | 6 +- tests/debuginfo/borrowed-struct.rs | 14 +-- tests/debuginfo/borrowed-tuple.rs | 6 +- tests/debuginfo/borrowed-unique-basic.rs | 26 ++--- tests/debuginfo/box.rs | 4 +- tests/debuginfo/boxed-struct.rs | 4 +- .../by-value-non-immediate-argument.rs | 14 +-- .../by-value-self-argument-in-trait-impl.rs | 6 +- tests/debuginfo/c-style-enum-in-composite.rs | 14 +-- tests/debuginfo/c-style-enum.rs | 14 +-- tests/debuginfo/captured-fields-1.rs | 12 +-- tests/debuginfo/captured-fields-2.rs | 4 +- .../debuginfo/closure-in-generic-function.rs | 8 +- tests/debuginfo/coroutine-locals.rs | 16 +-- tests/debuginfo/coroutine-objects.rs | 8 +- tests/debuginfo/cross-crate-spans.rs | 12 +-- tests/debuginfo/destructured-fn-argument.rs | 98 +++++++++---------- .../destructured-for-loop-variable.rs | 48 ++++----- tests/debuginfo/destructured-local.rs | 86 ++++++++-------- tests/debuginfo/drop-locations.rs | 12 +-- tests/debuginfo/empty-string.rs | 4 +- tests/debuginfo/enum-thinlto.rs | 2 +- tests/debuginfo/evec-in-struct.rs | 10 +- tests/debuginfo/extern-c-fn.rs | 8 +- .../debuginfo/function-arg-initialization.rs | 64 ++++++------ tests/debuginfo/function-arguments.rs | 8 +- .../function-prologue-stepping-regular.rs | 64 ++++++------ .../generic-enum-with-different-disr-sizes.rs | 16 +-- tests/debuginfo/generic-function.rs | 12 +-- tests/debuginfo/generic-functions-nested.rs | 16 +-- .../generic-method-on-generic-struct.rs | 30 +++--- tests/debuginfo/generic-struct.rs | 8 +- tests/debuginfo/include_string.rs | 6 +- tests/debuginfo/issue-22656.rs | 4 +- tests/debuginfo/issue-57822.rs | 4 +- tests/debuginfo/lexical-scope-in-for-loop.rs | 14 +-- tests/debuginfo/lexical-scope-in-if.rs | 32 +++--- tests/debuginfo/lexical-scope-in-match.rs | 36 +++---- .../lexical-scope-in-stack-closure.rs | 12 +-- .../lexical-scope-in-unconditional-loop.rs | 26 ++--- .../lexical-scope-in-unique-closure.rs | 12 +-- tests/debuginfo/lexical-scope-in-while.rs | 26 ++--- tests/debuginfo/lexical-scope-with-macro.rs | 30 +++--- .../lexical-scopes-in-block-expression.rs | 96 +++++++++--------- tests/debuginfo/macro-stepping.rs | 20 ++-- tests/debuginfo/method-on-enum.rs | 30 +++--- tests/debuginfo/method-on-generic-struct.rs | 30 +++--- tests/debuginfo/method-on-struct.rs | 30 +++--- tests/debuginfo/method-on-trait.rs | 30 +++--- tests/debuginfo/method-on-tuple-struct.rs | 30 +++--- tests/debuginfo/multi-cgu.rs | 4 +- .../multiple-functions-equal-var-names.rs | 6 +- tests/debuginfo/multiple-functions.rs | 6 +- .../name-shadowing-and-scope-nesting.rs | 24 ++--- tests/debuginfo/no_mangle-info.rs | 4 +- tests/debuginfo/numeric-types.rs | 26 +++-- tests/debuginfo/option-like-enum.rs | 20 ++-- .../packed-struct-with-destructor.rs | 16 +-- tests/debuginfo/packed-struct.rs | 12 +-- tests/debuginfo/pretty-slices.rs | 8 +- tests/debuginfo/pretty-std-collections.rs | 8 +- tests/debuginfo/pretty-std.rs | 14 +-- tests/debuginfo/rc_arc.rs | 4 +- tests/debuginfo/reference-debuginfo.rs | 28 +++--- .../regression-bad-location-list-67992.rs | 2 +- tests/debuginfo/self-in-default-method.rs | 30 +++--- .../self-in-generic-default-method.rs | 30 +++--- tests/debuginfo/shadowed-argument.rs | 12 +-- tests/debuginfo/shadowed-variable.rs | 20 ++-- tests/debuginfo/should-fail.rs | 2 +- tests/debuginfo/simple-lexical-scope.rs | 14 +-- tests/debuginfo/simple-struct.rs | 12 +-- tests/debuginfo/simple-tuple.rs | 14 +-- .../static-method-on-struct-and-enum.rs | 10 +- tests/debuginfo/struct-in-enum.rs | 6 +- tests/debuginfo/struct-in-struct.rs | 16 +-- tests/debuginfo/struct-namespace.rs | 8 +- tests/debuginfo/struct-with-destructor.rs | 8 +- tests/debuginfo/tuple-in-tuple.rs | 14 +-- tests/debuginfo/tuple-struct.rs | 12 +-- tests/debuginfo/union-smoke.rs | 4 +- .../var-captured-in-nested-closure.rs | 24 ++--- .../var-captured-in-sendable-closure.rs | 6 +- .../var-captured-in-stack-closure.rs | 20 ++-- tests/debuginfo/vec-slices.rs | 12 +-- tests/debuginfo/vec.rs | 2 +- 90 files changed, 824 insertions(+), 835 deletions(-) diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index e26e9df6f16b..8655d3512e10 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -1477,15 +1477,6 @@ impl<'test> TestCx<'test> { let rust_pp_module_rel_path = Path::new("./src/etc"); let rust_pp_module_abs_path = rust_src_root.join(rust_pp_module_rel_path); - // In newer versions of lldb, persistent results (the `$N =` part at the start of - // expressions you have evaluated that let you re-use the result) aren't printed, but lots - // of rustc's debuginfo tests rely on these, so re-enable this. - // See . - script_str.push_str("command unalias print\n"); - script_str.push_str("command alias print expr --\n"); - script_str.push_str("command unalias p\n"); - script_str.push_str("command alias p expr --\n"); - script_str.push_str(&format!( "command script import {}/lldb_lookup.py\n", rust_pp_module_abs_path.to_str().unwrap() diff --git a/tests/debuginfo/associated-types.rs b/tests/debuginfo/associated-types.rs index ab41073b7c44..182541b038a0 100644 --- a/tests/debuginfo/associated-types.rs +++ b/tests/debuginfo/associated-types.rs @@ -43,41 +43,41 @@ // lldb-command:run // lldb-command:print arg -// lldbg-check:[...]$0 = { b = -1, b1 = 0 } +// lldbg-check:[...] { b = -1, b1 = 0 } // lldbr-check:(associated_types::Struct) arg = { b = -1, b1 = 0 } // lldb-command:continue // lldb-command:print inferred -// lldbg-check:[...]$1 = 1 +// lldbg-check:[...] 1 // lldbr-check:(i64) inferred = 1 // lldb-command:print explicitly -// lldbg-check:[...]$2 = 1 +// lldbg-check:[...] 1 // lldbr-check:(i64) explicitly = 1 // lldb-command:continue // lldb-command:print arg -// lldbg-check:[...]$3 = 2 +// lldbg-check:[...] 2 // lldbr-check:(i64) arg = 2 // lldb-command:continue // lldb-command:print arg -// lldbg-check:[...]$4 = (4, 5) +// lldbg-check:[...] (4, 5) // lldbr-check:((i32, i64)) arg = { = 4 = 5 } // lldb-command:continue // lldb-command:print a -// lldbg-check:[...]$5 = 6 +// lldbg-check:[...] 6 // lldbr-check:(i32) a = 6 // lldb-command:print b -// lldbg-check:[...]$6 = 7 +// lldbg-check:[...] 7 // lldbr-check:(i64) b = 7 // lldb-command:continue // lldb-command:print a -// lldbg-check:[...]$7 = 8 +// lldbg-check:[...] 8 // lldbr-check:(i64) a = 8 // lldb-command:print b -// lldbg-check:[...]$8 = 9 +// lldbg-check:[...] 9 // lldbr-check:(i32) b = 9 // lldb-command:continue diff --git a/tests/debuginfo/basic-types.rs b/tests/debuginfo/basic-types.rs index 8319b71bfcda..3a023a890f37 100644 --- a/tests/debuginfo/basic-types.rs +++ b/tests/debuginfo/basic-types.rs @@ -51,10 +51,10 @@ // lldb-command:run // lldb-command:print b -// lldbg-check:[...]$0 = false +// lldbg-check:[...] false // lldbr-check:(bool) b = false // lldb-command:print i -// lldbg-check:[...]$1 = -1 +// lldbg-check:[...] -1 // lldbr-check:(isize) i = -1 // NOTE: only rust-enabled lldb supports 32bit chars @@ -62,37 +62,37 @@ // lldbr-check:(char) c = 'a' // lldb-command:print i8 -// lldbg-check:[...]$2 = 'D' +// lldbg-check:[...] 'D' // lldbr-check:(i8) i8 = 68 // lldb-command:print i16 -// lldbg-check:[...]$3 = -16 +// lldbg-check:[...] -16 // lldbr-check:(i16) i16 = -16 // lldb-command:print i32 -// lldbg-check:[...]$4 = -32 +// lldbg-check:[...] -32 // lldbr-check:(i32) i32 = -32 // lldb-command:print i64 -// lldbg-check:[...]$5 = -64 +// lldbg-check:[...] -64 // lldbr-check:(i64) i64 = -64 // lldb-command:print u -// lldbg-check:[...]$6 = 1 +// lldbg-check:[...] 1 // lldbr-check:(usize) u = 1 // lldb-command:print u8 -// lldbg-check:[...]$7 = 'd' +// lldbg-check:[...] 'd' // lldbr-check:(u8) u8 = 100 // lldb-command:print u16 -// lldbg-check:[...]$8 = 16 +// lldbg-check:[...] 16 // lldbr-check:(u16) u16 = 16 // lldb-command:print u32 -// lldbg-check:[...]$9 = 32 +// lldbg-check:[...] 32 // lldbr-check:(u32) u32 = 32 // lldb-command:print u64 -// lldbg-check:[...]$10 = 64 +// lldbg-check:[...] 64 // lldbr-check:(u64) u64 = 64 // lldb-command:print f32 -// lldbg-check:[...]$11 = 2.5 +// lldbg-check:[...] 2.5 // lldbr-check:(f32) f32 = 2.5 // lldb-command:print f64 -// lldbg-check:[...]$12 = 3.5 +// lldbg-check:[...] 3.5 // lldbr-check:(f64) f64 = 3.5 // === CDB TESTS =================================================================================== diff --git a/tests/debuginfo/borrowed-basic.rs b/tests/debuginfo/borrowed-basic.rs index 52d61f33e7c0..e30131190af5 100644 --- a/tests/debuginfo/borrowed-basic.rs +++ b/tests/debuginfo/borrowed-basic.rs @@ -53,11 +53,11 @@ // lldb-command:run // lldb-command:print *bool_ref -// lldbg-check:[...]$0 = true +// lldbg-check:[...] true // lldbr-check:(bool) *bool_ref = true // lldb-command:print *int_ref -// lldbg-check:[...]$1 = -1 +// lldbg-check:[...] -1 // lldbr-check:(isize) *int_ref = -1 // NOTE: only rust-enabled lldb supports 32bit chars @@ -65,47 +65,47 @@ // lldbr-check:(char) *char_ref = 'a' // lldb-command:print *i8_ref -// lldbg-check:[...]$2 = 'D' +// lldbg-check:[...] 'D' // lldbr-check:(i8) *i8_ref = 68 // lldb-command:print *i16_ref -// lldbg-check:[...]$3 = -16 +// lldbg-check:[...] -16 // lldbr-check:(i16) *i16_ref = -16 // lldb-command:print *i32_ref -// lldbg-check:[...]$4 = -32 +// lldbg-check:[...] -32 // lldbr-check:(i32) *i32_ref = -32 // lldb-command:print *i64_ref -// lldbg-check:[...]$5 = -64 +// lldbg-check:[...] -64 // lldbr-check:(i64) *i64_ref = -64 // lldb-command:print *uint_ref -// lldbg-check:[...]$6 = 1 +// lldbg-check:[...] 1 // lldbr-check:(usize) *uint_ref = 1 // lldb-command:print *u8_ref -// lldbg-check:[...]$7 = 'd' +// lldbg-check:[...] 'd' // lldbr-check:(u8) *u8_ref = 100 // lldb-command:print *u16_ref -// lldbg-check:[...]$8 = 16 +// lldbg-check:[...] 16 // lldbr-check:(u16) *u16_ref = 16 // lldb-command:print *u32_ref -// lldbg-check:[...]$9 = 32 +// lldbg-check:[...] 32 // lldbr-check:(u32) *u32_ref = 32 // lldb-command:print *u64_ref -// lldbg-check:[...]$10 = 64 +// lldbg-check:[...] 64 // lldbr-check:(u64) *u64_ref = 64 // lldb-command:print *f32_ref -// lldbg-check:[...]$11 = 2.5 +// lldbg-check:[...] 2.5 // lldbr-check:(f32) *f32_ref = 2.5 // lldb-command:print *f64_ref -// lldbg-check:[...]$12 = 3.5 +// lldbg-check:[...] 3.5 // lldbr-check:(f64) *f64_ref = 3.5 #![allow(unused_variables)] diff --git a/tests/debuginfo/borrowed-c-style-enum.rs b/tests/debuginfo/borrowed-c-style-enum.rs index 950a05a0992f..c6a8bf953866 100644 --- a/tests/debuginfo/borrowed-c-style-enum.rs +++ b/tests/debuginfo/borrowed-c-style-enum.rs @@ -23,15 +23,15 @@ // lldb-command:run // lldb-command:print *the_a_ref -// lldbg-check:[...]$0 = TheA +// lldbg-check:[...] TheA // lldbr-check:(borrowed_c_style_enum::ABC) *the_a_ref = borrowed_c_style_enum::ABC::TheA // lldb-command:print *the_b_ref -// lldbg-check:[...]$1 = TheB +// lldbg-check:[...] TheB // lldbr-check:(borrowed_c_style_enum::ABC) *the_b_ref = borrowed_c_style_enum::ABC::TheB // lldb-command:print *the_c_ref -// lldbg-check:[...]$2 = TheC +// lldbg-check:[...] TheC // lldbr-check:(borrowed_c_style_enum::ABC) *the_c_ref = borrowed_c_style_enum::ABC::TheC #![allow(unused_variables)] diff --git a/tests/debuginfo/borrowed-struct.rs b/tests/debuginfo/borrowed-struct.rs index 467de7878ee7..96ceec42ab55 100644 --- a/tests/debuginfo/borrowed-struct.rs +++ b/tests/debuginfo/borrowed-struct.rs @@ -35,31 +35,31 @@ // lldb-command:run // lldb-command:print *stack_val_ref -// lldbg-check:[...]$0 = { x = 10 y = 23.5 } +// lldbg-check:[...] { x = 10 y = 23.5 } // lldbr-check:(borrowed_struct::SomeStruct) *stack_val_ref = (x = 10, y = 23.5) // lldb-command:print *stack_val_interior_ref_1 -// lldbg-check:[...]$1 = 10 +// lldbg-check:[...] 10 // lldbr-check:(isize) *stack_val_interior_ref_1 = 10 // lldb-command:print *stack_val_interior_ref_2 -// lldbg-check:[...]$2 = 23.5 +// lldbg-check:[...] 23.5 // lldbr-check:(f64) *stack_val_interior_ref_2 = 23.5 // lldb-command:print *ref_to_unnamed -// lldbg-check:[...]$3 = { x = 11 y = 24.5 } +// lldbg-check:[...] { x = 11 y = 24.5 } // lldbr-check:(borrowed_struct::SomeStruct) *ref_to_unnamed = (x = 11, y = 24.5) // lldb-command:print *unique_val_ref -// lldbg-check:[...]$4 = { x = 13 y = 26.5 } +// lldbg-check:[...] { x = 13 y = 26.5 } // lldbr-check:(borrowed_struct::SomeStruct) *unique_val_ref = (x = 13, y = 26.5) // lldb-command:print *unique_val_interior_ref_1 -// lldbg-check:[...]$5 = 13 +// lldbg-check:[...] 13 // lldbr-check:(isize) *unique_val_interior_ref_1 = 13 // lldb-command:print *unique_val_interior_ref_2 -// lldbg-check:[...]$6 = 26.5 +// lldbg-check:[...] 26.5 // lldbr-check:(f64) *unique_val_interior_ref_2 = 26.5 #![allow(unused_variables)] diff --git a/tests/debuginfo/borrowed-tuple.rs b/tests/debuginfo/borrowed-tuple.rs index 4fe1abbaba2c..8d9c5e9fd2d4 100644 --- a/tests/debuginfo/borrowed-tuple.rs +++ b/tests/debuginfo/borrowed-tuple.rs @@ -24,15 +24,15 @@ // lldb-command:run // lldb-command:print *stack_val_ref -// lldbg-check:[...]$0 = { 0 = -14 1 = -19 } +// lldbg-check:[...] { 0 = -14 1 = -19 } // lldbr-check:((i16, f32)) *stack_val_ref = { 0 = -14 1 = -19 } // lldb-command:print *ref_to_unnamed -// lldbg-check:[...]$1 = { 0 = -15 1 = -20 } +// lldbg-check:[...] { 0 = -15 1 = -20 } // lldbr-check:((i16, f32)) *ref_to_unnamed = { 0 = -15 1 = -20 } // lldb-command:print *unique_val_ref -// lldbg-check:[...]$2 = { 0 = -17 1 = -22 } +// lldbg-check:[...] { 0 = -17 1 = -22 } // lldbr-check:((i16, f32)) *unique_val_ref = { 0 = -17 1 = -22 } diff --git a/tests/debuginfo/borrowed-unique-basic.rs b/tests/debuginfo/borrowed-unique-basic.rs index ae843c355bc5..38e6ce0a6ae5 100644 --- a/tests/debuginfo/borrowed-unique-basic.rs +++ b/tests/debuginfo/borrowed-unique-basic.rs @@ -56,11 +56,11 @@ // lldb-command:run // lldb-command:print *bool_ref -// lldbg-check:[...]$0 = true +// lldbg-check:[...] true // lldbr-check:(bool) *bool_ref = true // lldb-command:print *int_ref -// lldbg-check:[...]$1 = -1 +// lldbg-check:[...] -1 // lldbr-check:(isize) *int_ref = -1 // NOTE: only rust-enabled lldb supports 32bit chars @@ -68,47 +68,47 @@ // lldbr-check:(char) *char_ref = 97 // lldb-command:print *i8_ref -// lldbg-check:[...]$2 = 68 +// lldbg-check:[...] 68 // lldbr-check:(i8) *i8_ref = 68 // lldb-command:print *i16_ref -// lldbg-check:[...]$3 = -16 +// lldbg-check:[...] -16 // lldbr-check:(i16) *i16_ref = -16 // lldb-command:print *i32_ref -// lldbg-check:[...]$4 = -32 +// lldbg-check:[...] -32 // lldbr-check:(i32) *i32_ref = -32 // lldb-command:print *i64_ref -// lldbg-check:[...]$5 = -64 +// lldbg-check:[...] -64 // lldbr-check:(i64) *i64_ref = -64 // lldb-command:print *uint_ref -// lldbg-check:[...]$6 = 1 +// lldbg-check:[...] 1 // lldbr-check:(usize) *uint_ref = 1 // lldb-command:print *u8_ref -// lldbg-check:[...]$7 = 100 +// lldbg-check:[...] 100 // lldbr-check:(u8) *u8_ref = 100 // lldb-command:print *u16_ref -// lldbg-check:[...]$8 = 16 +// lldbg-check:[...] 16 // lldbr-check:(u16) *u16_ref = 16 // lldb-command:print *u32_ref -// lldbg-check:[...]$9 = 32 +// lldbg-check:[...] 32 // lldbr-check:(u32) *u32_ref = 32 // lldb-command:print *u64_ref -// lldbg-check:[...]$10 = 64 +// lldbg-check:[...] 64 // lldbr-check:(u64) *u64_ref = 64 // lldb-command:print *f32_ref -// lldbg-check:[...]$11 = 2.5 +// lldbg-check:[...] 2.5 // lldbr-check:(f32) *f32_ref = 2.5 // lldb-command:print *f64_ref -// lldbg-check:[...]$12 = 3.5 +// lldbg-check:[...] 3.5 // lldbr-check:(f64) *f64_ref = 3.5 #![allow(unused_variables)] diff --git a/tests/debuginfo/box.rs b/tests/debuginfo/box.rs index f2e744e87b91..2c309a4eb287 100644 --- a/tests/debuginfo/box.rs +++ b/tests/debuginfo/box.rs @@ -17,10 +17,10 @@ // lldb-command:run // lldb-command:print *a -// lldbg-check:[...]$0 = 1 +// lldbg-check:[...] 1 // lldbr-check:(i32) *a = 1 // lldb-command:print *b -// lldbg-check:[...]$1 = { 0 = 2 1 = 3.5 } +// lldbg-check:[...] { 0 = 2 1 = 3.5 } // lldbr-check:((i32, f64)) *b = { 0 = 2 1 = 3.5 } #![allow(unused_variables)] diff --git a/tests/debuginfo/boxed-struct.rs b/tests/debuginfo/boxed-struct.rs index c47bffb3a384..be2f1a7a8677 100644 --- a/tests/debuginfo/boxed-struct.rs +++ b/tests/debuginfo/boxed-struct.rs @@ -20,11 +20,11 @@ // lldb-command:run // lldb-command:print *boxed_with_padding -// lldbg-check:[...]$0 = { x = 99 y = 999 z = 9999 w = 99999 } +// lldbg-check:[...] { x = 99 y = 999 z = 9999 w = 99999 } // lldbr-check:(boxed_struct::StructWithSomePadding) *boxed_with_padding = { x = 99 y = 999 z = 9999 w = 99999 } // lldb-command:print *boxed_with_dtor -// lldbg-check:[...]$1 = { x = 77 y = 777 z = 7777 w = 77777 } +// lldbg-check:[...] { x = 77 y = 777 z = 7777 w = 77777 } // lldbr-check:(boxed_struct::StructWithDestructor) *boxed_with_dtor = { x = 77 y = 777 z = 7777 w = 77777 } #![allow(unused_variables)] diff --git a/tests/debuginfo/by-value-non-immediate-argument.rs b/tests/debuginfo/by-value-non-immediate-argument.rs index 52e3dc9a76bc..413eefa3f2de 100644 --- a/tests/debuginfo/by-value-non-immediate-argument.rs +++ b/tests/debuginfo/by-value-non-immediate-argument.rs @@ -42,27 +42,27 @@ // lldb-command:run // lldb-command:print s -// lldb-check:[...]$0 = Struct { a: 1, b: 2.5 } +// lldb-check:[...] Struct { a: 1, b: 2.5 } // lldb-command:continue // lldb-command:print x -// lldb-check:[...]$1 = Struct { a: 3, b: 4.5 } +// lldb-check:[...] Struct { a: 3, b: 4.5 } // lldb-command:print y -// lldb-check:[...]$2 = 5 +// lldb-check:[...] 5 // lldb-command:print z -// lldb-check:[...]$3 = 6.5 +// lldb-check:[...] 6.5 // lldb-command:continue // lldb-command:print a -// lldb-check:[...]$4 = (7, 8, 9.5, 10.5) +// lldb-check:[...] (7, 8, 9.5, 10.5) // lldb-command:continue // lldb-command:print a -// lldb-check:[...]$5 = Newtype(11.5, 12.5, 13, 14) +// lldb-check:[...] Newtype(11.5, 12.5, 13, 14) // lldb-command:continue // lldb-command:print x -// lldb-check:[...]$6 = Case1 { x: 0, y: 8970181431921507452 } +// lldb-check:[...] Case1 { x: 0, y: 8970181431921507452 } // lldb-command:continue #![feature(omit_gdb_pretty_printer_section)] 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 247d6c27a06e..7b52d054b321 100644 --- a/tests/debuginfo/by-value-self-argument-in-trait-impl.rs +++ b/tests/debuginfo/by-value-self-argument-in-trait-impl.rs @@ -26,17 +26,17 @@ // lldb-command:run // lldb-command:print self -// lldbg-check:[...]$0 = 1111 +// lldbg-check:[...] 1111 // lldbr-check:(isize) self = 1111 // lldb-command:continue // lldb-command:print self -// lldbg-check:[...]$1 = { x = 2222 y = 3333 } +// lldbg-check:[...] { x = 2222 y = 3333 } // lldbr-check:(by_value_self_argument_in_trait_impl::Struct) self = { x = 2222 y = 3333 } // lldb-command:continue // lldb-command:print self -// lldbg-check:[...] $2 = { 0 = 4444.5 1 = 5555 2 = 6666 3 = 7777.5 } +// lldbg-check:[...] { 0 = 4444.5 1 = 5555 2 = 6666 3 = 7777.5 } // lldbr-check:((f64, isize, isize, f64)) self = { 0 = 4444.5 1 = 5555 2 = 6666 3 = 7777.5 } // lldb-command:continue diff --git a/tests/debuginfo/c-style-enum-in-composite.rs b/tests/debuginfo/c-style-enum-in-composite.rs index 3f0968f09afd..82d38038eafa 100644 --- a/tests/debuginfo/c-style-enum-in-composite.rs +++ b/tests/debuginfo/c-style-enum-in-composite.rs @@ -39,31 +39,31 @@ // lldb-command:run // lldb-command:print tuple_interior_padding -// lldbg-check:[...]$0 = { 0 = 0 1 = OneHundred } +// lldbg-check:[...] { 0 = 0 1 = OneHundred } // lldbr-check:((i16, c_style_enum_in_composite::AnEnum)) tuple_interior_padding = { 0 = 0 1 = OneHundred } // lldb-command:print tuple_padding_at_end -// lldbg-check:[...]$1 = { 0 = { 0 = 1 1 = OneThousand } 1 = 2 } +// lldbg-check:[...] { 0 = { 0 = 1 1 = OneThousand } 1 = 2 } // lldbr-check:(((u64, c_style_enum_in_composite::AnEnum), u64)) tuple_padding_at_end = { 0 = { 0 = 1 1 = OneThousand } 1 = 2 } // lldb-command:print tuple_different_enums -// lldbg-check:[...]$2 = { 0 = OneThousand 1 = MountainView 2 = OneMillion 3 = Vienna } +// lldbg-check:[...] { 0 = OneThousand 1 = MountainView 2 = OneMillion 3 = Vienna } // lldbr-check:((c_style_enum_in_composite::AnEnum, c_style_enum_in_composite::AnotherEnum, c_style_enum_in_composite::AnEnum, c_style_enum_in_composite::AnotherEnum)) tuple_different_enums = { 0 = c_style_enum_in_composite::AnEnum::OneThousand 1 = c_style_enum_in_composite::AnotherEnum::MountainView 2 = c_style_enum_in_composite::AnEnum::OneMillion 3 = c_style_enum_in_composite::AnotherEnum::Vienna } // lldb-command:print padded_struct -// lldbg-check:[...]$3 = { a = 3 b = OneMillion c = 4 d = Toronto e = 5 } +// lldbg-check:[...] { a = 3 b = OneMillion c = 4 d = Toronto e = 5 } // lldbr-check:(c_style_enum_in_composite::PaddedStruct) padded_struct = { a = 3 b = c_style_enum_in_composite::AnEnum::OneMillion c = 4 d = Toronto e = 5 } // lldb-command:print packed_struct -// lldbg-check:[...]$4 = { a = 6 b = OneHundred c = 7 d = Vienna e = 8 } +// lldbg-check:[...] { a = 6 b = OneHundred c = 7 d = Vienna e = 8 } // lldbr-check:(c_style_enum_in_composite::PackedStruct) packed_struct = { a = 6 b = c_style_enum_in_composite::AnEnum::OneHundred c = 7 d = Vienna e = 8 } // lldb-command:print non_padded_struct -// lldbg-check:[...]$5 = { a = OneMillion b = MountainView c = OneThousand d = Toronto } +// lldbg-check:[...] { a = OneMillion b = MountainView c = OneThousand d = Toronto } // lldbr-check:(c_style_enum_in_composite::NonPaddedStruct) non_padded_struct = { a = c_style_enum_in_composite::AnEnum::OneMillion, b = c_style_enum_in_composite::AnotherEnum::MountainView, c = c_style_enum_in_composite::AnEnum::OneThousand, d = c_style_enum_in_composite::AnotherEnum::Toronto } // lldb-command:print struct_with_drop -// lldbg-check:[...]$6 = { 0 = { a = OneHundred b = Vienna } 1 = 9 } +// lldbg-check:[...] { 0 = { a = OneHundred b = Vienna } 1 = 9 } // lldbr-check:((c_style_enum_in_composite::StructWithDrop, i64)) struct_with_drop = { 0 = { a = c_style_enum_in_composite::AnEnum::OneHundred b = c_style_enum_in_composite::AnotherEnum::Vienna } 1 = 9 } #![allow(unused_variables)] diff --git a/tests/debuginfo/c-style-enum.rs b/tests/debuginfo/c-style-enum.rs index 2794575d3287..4d84324df2cf 100644 --- a/tests/debuginfo/c-style-enum.rs +++ b/tests/debuginfo/c-style-enum.rs @@ -97,31 +97,31 @@ // lldb-command:run // lldb-command:print auto_one -// lldbg-check:[...]$0 = One +// lldbg-check:[...] One // lldbr-check:(c_style_enum::AutoDiscriminant) auto_one = c_style_enum::AutoDiscriminant::One // lldb-command:print auto_two -// lldbg-check:[...]$1 = Two +// lldbg-check:[...] Two // lldbr-check:(c_style_enum::AutoDiscriminant) auto_two = c_style_enum::AutoDiscriminant::Two // lldb-command:print auto_three -// lldbg-check:[...]$2 = Three +// lldbg-check:[...] Three // lldbr-check:(c_style_enum::AutoDiscriminant) auto_three = c_style_enum::AutoDiscriminant::Three // lldb-command:print manual_one_hundred -// lldbg-check:[...]$3 = OneHundred +// lldbg-check:[...] OneHundred // lldbr-check:(c_style_enum::ManualDiscriminant) manual_one_hundred = c_style_enum::ManualDiscriminant::OneHundred // lldb-command:print manual_one_thousand -// lldbg-check:[...]$4 = OneThousand +// lldbg-check:[...] OneThousand // lldbr-check:(c_style_enum::ManualDiscriminant) manual_one_thousand = c_style_enum::ManualDiscriminant::OneThousand // lldb-command:print manual_one_million -// lldbg-check:[...]$5 = OneMillion +// lldbg-check:[...] OneMillion // lldbr-check:(c_style_enum::ManualDiscriminant) manual_one_million = c_style_enum::ManualDiscriminant::OneMillion // lldb-command:print single_variant -// lldbg-check:[...]$6 = TheOnlyVariant +// lldbg-check:[...] TheOnlyVariant // lldbr-check:(c_style_enum::SingleVariant) single_variant = c_style_enum::SingleVariant::TheOnlyVariant #![allow(unused_variables)] diff --git a/tests/debuginfo/captured-fields-1.rs b/tests/debuginfo/captured-fields-1.rs index f5fdf4fb3d9c..bcc5a1796876 100644 --- a/tests/debuginfo/captured-fields-1.rs +++ b/tests/debuginfo/captured-fields-1.rs @@ -26,22 +26,22 @@ // lldb-command:run // lldb-command:print test -// lldbg-check:(captured_fields_1::main::{closure_env#0}) $0 = { _ref__my_ref__my_field1 = 0x[...] } +// lldbg-check:(captured_fields_1::main::{closure_env#0}) { _ref__my_ref__my_field1 = 0x[...] } // lldb-command:continue // lldb-command:print test -// lldbg-check:(captured_fields_1::main::{closure_env#1}) $1 = { _ref__my_ref__my_field2 = 0x[...] } +// lldbg-check:(captured_fields_1::main::{closure_env#1}) { _ref__my_ref__my_field2 = 0x[...] } // lldb-command:continue // lldb-command:print test -// lldbg-check:(captured_fields_1::main::{closure_env#2}) $2 = { _ref__my_ref = 0x[...] } +// lldbg-check:(captured_fields_1::main::{closure_env#2}) { _ref__my_ref = 0x[...] } // lldb-command:continue // lldb-command:print test -// lldbg-check:(captured_fields_1::main::{closure_env#3}) $3 = { my_ref = 0x[...] } +// lldbg-check:(captured_fields_1::main::{closure_env#3}) { my_ref = 0x[...] } // lldb-command:continue // lldb-command:print test -// lldbg-check:(captured_fields_1::main::{closure_env#4}) $4 = { my_var__my_field2 = 22 } +// lldbg-check:(captured_fields_1::main::{closure_env#4}) { my_var__my_field2 = 22 } // lldb-command:continue // lldb-command:print test -// lldbg-check:(captured_fields_1::main::{closure_env#5}) $5 = { my_var = { my_field1 = 11 my_field2 = 22 } } +// lldbg-check:(captured_fields_1::main::{closure_env#5}) { my_var = { my_field1 = 11 my_field2 = 22 } } // lldb-command:continue #![allow(unused)] diff --git a/tests/debuginfo/captured-fields-2.rs b/tests/debuginfo/captured-fields-2.rs index aaf4fa1bc454..7191d3f84d2a 100644 --- a/tests/debuginfo/captured-fields-2.rs +++ b/tests/debuginfo/captured-fields-2.rs @@ -14,10 +14,10 @@ // lldb-command:run // lldb-command:print my_ref__my_field1 -// lldbg-check:(unsigned int) $0 = 11 +// lldbg-check:(unsigned int) 11 // lldb-command:continue // lldb-command:print my_var__my_field2 -// lldbg-check:(unsigned int) $1 = 22 +// lldbg-check:(unsigned int) 22 // lldb-command:continue #![allow(unused)] diff --git a/tests/debuginfo/closure-in-generic-function.rs b/tests/debuginfo/closure-in-generic-function.rs index 676a624191c2..c48858e4a0a5 100644 --- a/tests/debuginfo/closure-in-generic-function.rs +++ b/tests/debuginfo/closure-in-generic-function.rs @@ -24,18 +24,18 @@ // lldb-command:run // lldb-command:print x -// lldbg-check:[...]$0 = 0.5 +// lldbg-check:[...] 0.5 // lldbr-check:(f64) x = 0.5 // lldb-command:print y -// lldbg-check:[...]$1 = 10 +// lldbg-check:[...] 10 // lldbr-check:(i32) y = 10 // lldb-command:continue // lldb-command:print *x -// lldbg-check:[...]$2 = 29 +// lldbg-check:[...] 29 // lldbr-check:(i32) *x = 29 // lldb-command:print *y -// lldbg-check:[...]$3 = 110 +// lldbg-check:[...] 110 // lldbr-check:(i32) *y = 110 // lldb-command:continue diff --git a/tests/debuginfo/coroutine-locals.rs b/tests/debuginfo/coroutine-locals.rs index 0430e1d313bd..80a68434dab5 100644 --- a/tests/debuginfo/coroutine-locals.rs +++ b/tests/debuginfo/coroutine-locals.rs @@ -28,30 +28,30 @@ // lldb-command:run // lldb-command:print a -// lldbg-check:(int) $0 = 5 +// lldbg-check:(int) 5 // lldbr-check:(int) a = 5 // lldb-command:print c -// lldbg-check:(int) $1 = 6 +// lldbg-check:(int) 6 // lldbr-check:(int) c = 6 // lldb-command:print d -// lldbg-check:(int) $2 = 7 +// lldbg-check:(int) 7 // lldbr-check:(int) d = 7 // lldb-command:continue // lldb-command:print a -// lldbg-check:(int) $3 = 7 +// lldbg-check:(int) 7 // lldbr-check:(int) a = 7 // lldb-command:print c -// lldbg-check:(int) $4 = 6 +// lldbg-check:(int) 6 // lldbr-check:(int) c = 6 // lldb-command:print e -// lldbg-check:(int) $5 = 8 +// lldbg-check:(int) 8 // lldbr-check:(int) e = 8 // lldb-command:continue // lldb-command:print a -// lldbg-check:(int) $6 = 8 +// lldbg-check:(int) 8 // lldbr-check:(int) a = 8 // lldb-command:print c -// lldbg-check:(int) $7 = 6 +// lldbg-check:(int) 6 // lldbr-check:(int) c = 6 #![feature(omit_gdb_pretty_printer_section, coroutines, coroutine_trait)] diff --git a/tests/debuginfo/coroutine-objects.rs b/tests/debuginfo/coroutine-objects.rs index 98b37ac2001d..9f14cb3f8ec4 100644 --- a/tests/debuginfo/coroutine-objects.rs +++ b/tests/debuginfo/coroutine-objects.rs @@ -26,16 +26,16 @@ // lldb-command:run // lldb-command:print b -// lldbg-check:(coroutine_objects::main::{coroutine_env#0}) $0 = +// lldbg-check:(coroutine_objects::main::{coroutine_env#0}) // lldb-command:continue // lldb-command:print b -// lldbg-check:(coroutine_objects::main::{coroutine_env#0}) $1 = +// lldbg-check:(coroutine_objects::main::{coroutine_env#0}) // lldb-command:continue // lldb-command:print b -// lldbg-check:(coroutine_objects::main::{coroutine_env#0}) $2 = +// lldbg-check:(coroutine_objects::main::{coroutine_env#0}) // lldb-command:continue // lldb-command:print b -// lldbg-check:(coroutine_objects::main::{coroutine_env#0}) $3 = +// lldbg-check:(coroutine_objects::main::{coroutine_env#0}) // === CDB TESTS =================================================================================== diff --git a/tests/debuginfo/cross-crate-spans.rs b/tests/debuginfo/cross-crate-spans.rs index 75550e1794cc..9f3538c4e1d4 100644 --- a/tests/debuginfo/cross-crate-spans.rs +++ b/tests/debuginfo/cross-crate-spans.rs @@ -44,24 +44,24 @@ extern crate cross_crate_spans; // lldb-command:run // lldb-command:print result -// lldbg-check:[...]$0 = { 0 = 17 1 = 17 } +// lldbg-check:[...] { 0 = 17 1 = 17 } // lldbr-check:((u32, u32)) result = { 0 = 17 1 = 17 } // lldb-command:print a_variable -// lldbg-check:[...]$1 = 123456789 +// lldbg-check:[...] 123456789 // lldbr-check:(u32) a_variable = 123456789 // lldb-command:print another_variable -// lldbg-check:[...]$2 = 123456789.5 +// lldbg-check:[...] 123456789.5 // lldbr-check:(f64) another_variable = 123456789.5 // lldb-command:continue // lldb-command:print result -// lldbg-check:[...]$3 = { 0 = 1212 1 = 1212 } +// lldbg-check:[...] { 0 = 1212 1 = 1212 } // lldbr-check:((i16, i16)) result = { 0 = 1212 1 = 1212 } // lldb-command:print a_variable -// lldbg-check:[...]$4 = 123456789 +// lldbg-check:[...] 123456789 // lldbr-check:(u32) a_variable = 123456789 // lldb-command:print another_variable -// lldbg-check:[...]$5 = 123456789.5 +// lldbg-check:[...] 123456789.5 // lldbr-check:(f64) another_variable = 123456789.5 // lldb-command:continue diff --git a/tests/debuginfo/destructured-fn-argument.rs b/tests/debuginfo/destructured-fn-argument.rs index e6e697c518a1..2748bdb08b96 100644 --- a/tests/debuginfo/destructured-fn-argument.rs +++ b/tests/debuginfo/destructured-fn-argument.rs @@ -164,195 +164,195 @@ // lldb-command:run // lldb-command:print a -// lldbg-check:[...]$0 = 1 +// lldbg-check:[...] 1 // lldbr-check:(isize) a = 1 // lldb-command:print b -// lldbg-check:[...]$1 = false +// lldbg-check:[...] false // lldbr-check:(bool) b = false // lldb-command:continue // lldb-command:print a -// lldbg-check:[...]$2 = 2 +// lldbg-check:[...] 2 // lldbr-check:(isize) a = 2 // lldb-command:print b -// lldbg-check:[...]$3 = 3 +// lldbg-check:[...] 3 // lldbr-check:(u16) b = 3 // lldb-command:print c -// lldbg-check:[...]$4 = 4 +// lldbg-check:[...] 4 // lldbr-check:(u16) c = 4 // lldb-command:continue // lldb-command:print a -// lldbg-check:[...]$5 = 5 +// lldbg-check:[...] 5 // lldbr-check:(isize) a = 5 // lldb-command:print b -// lldbg-check:[...]$6 = { 0 = 6 1 = 7 } +// lldbg-check:[...] { 0 = 6 1 = 7 } // lldbr-check:((u32, u32)) b = { 0 = 6 1 = 7 } // lldb-command:continue // lldb-command:print h -// lldbg-check:[...]$7 = 8 +// lldbg-check:[...] 8 // lldbr-check:(i16) h = 8 // lldb-command:print i -// lldbg-check:[...]$8 = { a = 9 b = 10 } +// lldbg-check:[...] { a = 9 b = 10 } // lldbr-check:(destructured_fn_argument::Struct) i = { a = 9 b = 10 } // lldb-command:print j -// lldbg-check:[...]$9 = 11 +// lldbg-check:[...] 11 // lldbr-check:(i16) j = 11 // lldb-command:continue // lldb-command:print k -// lldbg-check:[...]$10 = 12 +// lldbg-check:[...] 12 // lldbr-check:(i64) k = 12 // lldb-command:print l -// lldbg-check:[...]$11 = 13 +// lldbg-check:[...] 13 // lldbr-check:(i32) l = 13 // lldb-command:continue // lldb-command:print m -// lldbg-check:[...]$12 = 14 +// lldbg-check:[...] 14 // lldbr-check:(isize) m = 14 // lldb-command:print n -// lldbg-check:[...]$13 = 16 +// lldbg-check:[...] 16 // lldbr-check:(i32) n = 16 // lldb-command:continue // lldb-command:print o -// lldbg-check:[...]$14 = 18 +// lldbg-check:[...] 18 // lldbr-check:(i32) o = 18 // lldb-command:continue // lldb-command:print p -// lldbg-check:[...]$15 = 19 +// lldbg-check:[...] 19 // lldbr-check:(i64) p = 19 // lldb-command:print q -// lldbg-check:[...]$16 = 20 +// lldbg-check:[...] 20 // lldbr-check:(i32) q = 20 // lldb-command:print r -// lldbg-check:[...]$17 = { a = 21 b = 22 } +// lldbg-check:[...] { a = 21 b = 22 } // lldbr-check:(destructured_fn_argument::Struct) r = { a = 21, b = 22 } // lldb-command:continue // lldb-command:print s -// lldbg-check:[...]$18 = 24 +// lldbg-check:[...] 24 // lldbr-check:(i32) s = 24 // lldb-command:print t -// lldbg-check:[...]$19 = 23 +// lldbg-check:[...] 23 // lldbr-check:(i64) t = 23 // lldb-command:continue // lldb-command:print u -// lldbg-check:[...]$20 = 25 +// lldbg-check:[...] 25 // lldbr-check:(i16) u = 25 // lldb-command:print v -// lldbg-check:[...]$21 = 26 +// lldbg-check:[...] 26 // lldbr-check:(i32) v = 26 // lldb-command:print w -// lldbg-check:[...]$22 = 27 +// lldbg-check:[...] 27 // lldbr-check:(i64) w = 27 // lldb-command:print x -// lldbg-check:[...]$23 = 28 +// lldbg-check:[...] 28 // lldbr-check:(i32) x = 28 // lldb-command:print y -// lldbg-check:[...]$24 = 29 +// lldbg-check:[...] 29 // lldbr-check:(i64) y = 29 // lldb-command:print z -// lldbg-check:[...]$25 = 30 +// lldbg-check:[...] 30 // lldbr-check:(i32) z = 30 // lldb-command:print ae -// lldbg-check:[...]$26 = 31 +// lldbg-check:[...] 31 // lldbr-check:(i64) ae = 31 // lldb-command:print oe -// lldbg-check:[...]$27 = 32 +// lldbg-check:[...] 32 // lldbr-check:(i32) oe = 32 // lldb-command:print ue -// lldbg-check:[...]$28 = 33 +// lldbg-check:[...] 33 // lldbr-check:(u16) ue = 33 // lldb-command:continue // lldb-command:print aa -// lldbg-check:[...]$29 = { 0 = 34 1 = 35 } +// lldbg-check:[...] { 0 = 34 1 = 35 } // lldbr-check:((isize, isize)) aa = { 0 = 34 1 = 35 } // lldb-command:continue // lldb-command:print bb -// lldbg-check:[...]$30 = { 0 = 36 1 = 37 } +// lldbg-check:[...] { 0 = 36 1 = 37 } // lldbr-check:((isize, isize)) bb = { 0 = 36 1 = 37 } // lldb-command:continue // lldb-command:print cc -// lldbg-check:[...]$31 = 38 +// lldbg-check:[...] 38 // lldbr-check:(isize) cc = 38 // lldb-command:continue // lldb-command:print dd -// lldbg-check:[...]$32 = { 0 = 40 1 = 41 2 = 42 } +// lldbg-check:[...] { 0 = 40 1 = 41 2 = 42 } // lldbr-check:((isize, isize, isize)) dd = { 0 = 40 1 = 41 2 = 42 } // lldb-command:continue // lldb-command:print *ee -// lldbg-check:[...]$33 = { 0 = 43 1 = 44 2 = 45 } +// lldbg-check:[...] { 0 = 43 1 = 44 2 = 45 } // lldbr-check:((isize, isize, isize)) *ee = { 0 = 43 1 = 44 2 = 45 } // lldb-command:continue // lldb-command:print *ff -// lldbg-check:[...]$34 = 46 +// lldbg-check:[...] 46 // lldbr-check:(isize) *ff = 46 // lldb-command:print gg -// lldbg-check:[...]$35 = { 0 = 47 1 = 48 } +// lldbg-check:[...] { 0 = 47 1 = 48 } // lldbr-check:((isize, isize)) gg = { 0 = 47 1 = 48 } // lldb-command:continue // lldb-command:print *hh -// lldbg-check:[...]$36 = 50 +// lldbg-check:[...] 50 // lldbr-check:(i32) *hh = 50 // lldb-command:continue // lldb-command:print ii -// lldbg-check:[...]$37 = 51 +// lldbg-check:[...] 51 // lldbr-check:(i32) ii = 51 // lldb-command:continue // lldb-command:print *jj -// lldbg-check:[...]$38 = 52 +// lldbg-check:[...] 52 // lldbr-check:(i32) *jj = 52 // lldb-command:continue // lldb-command:print kk -// lldbg-check:[...]$39 = 53 +// lldbg-check:[...] 53 // lldbr-check:(f64) kk = 53 // lldb-command:print ll -// lldbg-check:[...]$40 = 54 +// lldbg-check:[...] 54 // lldbr-check:(isize) ll = 54 // lldb-command:continue // lldb-command:print mm -// lldbg-check:[...]$41 = 55 +// lldbg-check:[...] 55 // lldbr-check:(f64) mm = 55 // lldb-command:print *nn -// lldbg-check:[...]$42 = 56 +// lldbg-check:[...] 56 // lldbr-check:(isize) *nn = 56 // lldb-command:continue // lldb-command:print oo -// lldbg-check:[...]$43 = 57 +// lldbg-check:[...] 57 // lldbr-check:(isize) oo = 57 // lldb-command:print pp -// lldbg-check:[...]$44 = 58 +// lldbg-check:[...] 58 // lldbr-check:(isize) pp = 58 // lldb-command:print qq -// lldbg-check:[...]$45 = 59 +// lldbg-check:[...] 59 // lldbr-check:(isize) qq = 59 // lldb-command:continue // lldb-command:print rr -// lldbg-check:[...]$46 = 60 +// lldbg-check:[...] 60 // lldbr-check:(isize) rr = 60 // lldb-command:print ss -// lldbg-check:[...]$47 = 61 +// lldbg-check:[...] 61 // lldbr-check:(isize) ss = 61 // lldb-command:print tt -// lldbg-check:[...]$48 = 62 +// lldbg-check:[...] 62 // lldbr-check:(isize) tt = 62 // lldb-command:continue diff --git a/tests/debuginfo/destructured-for-loop-variable.rs b/tests/debuginfo/destructured-for-loop-variable.rs index 3e27d122c4be..e583804cb1e9 100644 --- a/tests/debuginfo/destructured-for-loop-variable.rs +++ b/tests/debuginfo/destructured-for-loop-variable.rs @@ -85,89 +85,89 @@ // DESTRUCTURED STRUCT // lldb-command:print x -// lldbg-check:[...]$0 = 400 +// lldbg-check:[...] 400 // lldbr-check:(i16) x = 400 // lldb-command:print y -// lldbg-check:[...]$1 = 401.5 +// lldbg-check:[...] 401.5 // lldbr-check:(f32) y = 401.5 // lldb-command:print z -// lldbg-check:[...]$2 = true +// lldbg-check:[...] true // lldbr-check:(bool) z = true // lldb-command:continue // DESTRUCTURED TUPLE // lldb-command:print _i8 -// lldbg-check:[...]$3 = 0x6f +// lldbg-check:[...] 0x6f // lldbr-check:(i8) _i8 = 111 // lldb-command:print _u8 -// lldbg-check:[...]$4 = 0x70 +// lldbg-check:[...] 0x70 // lldbr-check:(u8) _u8 = 112 // lldb-command:print _i16 -// lldbg-check:[...]$5 = -113 +// lldbg-check:[...] -113 // lldbr-check:(i16) _i16 = -113 // lldb-command:print _u16 -// lldbg-check:[...]$6 = 114 +// lldbg-check:[...] 114 // lldbr-check:(u16) _u16 = 114 // lldb-command:print _i32 -// lldbg-check:[...]$7 = -115 +// lldbg-check:[...] -115 // lldbr-check:(i32) _i32 = -115 // lldb-command:print _u32 -// lldbg-check:[...]$8 = 116 +// lldbg-check:[...] 116 // lldbr-check:(u32) _u32 = 116 // lldb-command:print _i64 -// lldbg-check:[...]$9 = -117 +// lldbg-check:[...] -117 // lldbr-check:(i64) _i64 = -117 // lldb-command:print _u64 -// lldbg-check:[...]$10 = 118 +// lldbg-check:[...] 118 // lldbr-check:(u64) _u64 = 118 // lldb-command:print _f32 -// lldbg-check:[...]$11 = 119.5 +// lldbg-check:[...] 119.5 // lldbr-check:(f32) _f32 = 119.5 // lldb-command:print _f64 -// lldbg-check:[...]$12 = 120.5 +// lldbg-check:[...] 120.5 // lldbr-check:(f64) _f64 = 120.5 // lldb-command:continue // MORE COMPLEX CASE // lldb-command:print v1 -// lldbg-check:[...]$13 = 80000 +// lldbg-check:[...] 80000 // lldbr-check:(i32) v1 = 80000 // lldb-command:print x1 -// lldbg-check:[...]$14 = 8000 +// lldbg-check:[...] 8000 // lldbr-check:(i16) x1 = 8000 // lldb-command:print *y1 -// lldbg-check:[...]$15 = 80001.5 +// lldbg-check:[...] 80001.5 // lldbr-check:(f32) *y1 = 80001.5 // lldb-command:print z1 -// lldbg-check:[...]$16 = false +// lldbg-check:[...] false // lldbr-check:(bool) z1 = false // lldb-command:print *x2 -// lldbg-check:[...]$17 = -30000 +// lldbg-check:[...] -30000 // lldbr-check:(i16) *x2 = -30000 // lldb-command:print y2 -// lldbg-check:[...]$18 = -300001.5 +// lldbg-check:[...] -300001.5 // lldbr-check:(f32) y2 = -300001.5 // lldb-command:print *z2 -// lldbg-check:[...]$19 = true +// lldbg-check:[...] true // lldbr-check:(bool) *z2 = true // lldb-command:print v2 -// lldbg-check:[...]$20 = 854237.5 +// lldbg-check:[...] 854237.5 // lldbr-check:(f64) v2 = 854237.5 // lldb-command:continue // SIMPLE IDENTIFIER // lldb-command:print i -// lldbg-check:[...]$21 = 1234 +// lldbg-check:[...] 1234 // lldbr-check:(i32) i = 1234 // lldb-command:continue // lldb-command:print simple_struct_ident -// lldbg-check:[...]$22 = { x = 3537 y = 35437.5 z = true } +// lldbg-check:[...] { x = 3537 y = 35437.5 z = true } // lldbr-check:(destructured_for_loop_variable::Struct) simple_struct_ident = { x = 3537 y = 35437.5 z = true } // lldb-command:continue // lldb-command:print simple_tuple_ident -// lldbg-check:[...]$23 = { 0 = 34903493 1 = 232323 } +// lldbg-check:[...] { 0 = 34903493 1 = 232323 } // lldbr-check:((u32, i64)) simple_tuple_ident = { 0 = 34903493 1 = 232323 } // lldb-command:continue diff --git a/tests/debuginfo/destructured-local.rs b/tests/debuginfo/destructured-local.rs index 3e0557382b3c..9993407815e0 100644 --- a/tests/debuginfo/destructured-local.rs +++ b/tests/debuginfo/destructured-local.rs @@ -130,156 +130,156 @@ // lldb-command:run // lldb-command:print a -// lldbg-check:[...]$0 = 1 +// lldbg-check:[...] 1 // lldbr-check:(isize) a = 1 // lldb-command:print b -// lldbg-check:[...]$1 = false +// lldbg-check:[...] false // lldbr-check:(bool) b = false // lldb-command:print c -// lldbg-check:[...]$2 = 2 +// lldbg-check:[...] 2 // lldbr-check:(isize) c = 2 // lldb-command:print d -// lldbg-check:[...]$3 = 3 +// lldbg-check:[...] 3 // lldbr-check:(u16) d = 3 // lldb-command:print e -// lldbg-check:[...]$4 = 4 +// lldbg-check:[...] 4 // lldbr-check:(u16) e = 4 // lldb-command:print f -// lldbg-check:[...]$5 = 5 +// lldbg-check:[...] 5 // lldbr-check:(isize) f = 5 // lldb-command:print g -// lldbg-check:[...]$6 = { 0 = 6 1 = 7 } +// lldbg-check:[...] { 0 = 6 1 = 7 } // lldbr-check:((u32, u32)) g = { 0 = 6 1 = 7 } // lldb-command:print h -// lldbg-check:[...]$7 = 8 +// lldbg-check:[...] 8 // lldbr-check:(i16) h = 8 // lldb-command:print i -// lldbg-check:[...]$8 = { a = 9 b = 10 } +// lldbg-check:[...] { a = 9 b = 10 } // lldbr-check:(destructured_local::Struct) i = { a = 9 b = 10 } // lldb-command:print j -// lldbg-check:[...]$9 = 11 +// lldbg-check:[...] 11 // lldbr-check:(i16) j = 11 // lldb-command:print k -// lldbg-check:[...]$10 = 12 +// lldbg-check:[...] 12 // lldbr-check:(i64) k = 12 // lldb-command:print l -// lldbg-check:[...]$11 = 13 +// lldbg-check:[...] 13 // lldbr-check:(i32) l = 13 // lldb-command:print m -// lldbg-check:[...]$12 = 14 +// lldbg-check:[...] 14 // lldbr-check:(i32) m = 14 // lldb-command:print n -// lldbg-check:[...]$13 = 16 +// lldbg-check:[...] 16 // lldbr-check:(i32) n = 16 // lldb-command:print o -// lldbg-check:[...]$14 = 18 +// lldbg-check:[...] 18 // lldbr-check:(i32) o = 18 // lldb-command:print p -// lldbg-check:[...]$15 = 19 +// lldbg-check:[...] 19 // lldbr-check:(i64) p = 19 // lldb-command:print q -// lldbg-check:[...]$16 = 20 +// lldbg-check:[...] 20 // lldbr-check:(i32) q = 20 // lldb-command:print r -// lldbg-check:[...]$17 = { a = 21 b = 22 } +// lldbg-check:[...] { a = 21 b = 22 } // lldbr-check:(destructured_local::Struct) r = { a = 21 b = 22 } // lldb-command:print s -// lldbg-check:[...]$18 = 24 +// lldbg-check:[...] 24 // lldbr-check:(i32) s = 24 // lldb-command:print t -// lldbg-check:[...]$19 = 23 +// lldbg-check:[...] 23 // lldbr-check:(i64) t = 23 // lldb-command:print u -// lldbg-check:[...]$20 = 25 +// lldbg-check:[...] 25 // lldbr-check:(i32) u = 25 // lldb-command:print v -// lldbg-check:[...]$21 = 26 +// lldbg-check:[...] 26 // lldbr-check:(i32) v = 26 // lldb-command:print w -// lldbg-check:[...]$22 = 27 +// lldbg-check:[...] 27 // lldbr-check:(i32) w = 27 // lldb-command:print x -// lldbg-check:[...]$23 = 28 +// lldbg-check:[...] 28 // lldbr-check:(i32) x = 28 // lldb-command:print y -// lldbg-check:[...]$24 = 29 +// lldbg-check:[...] 29 // lldbr-check:(i64) y = 29 // lldb-command:print z -// lldbg-check:[...]$25 = 30 +// lldbg-check:[...] 30 // lldbr-check:(i32) z = 30 // lldb-command:print ae -// lldbg-check:[...]$26 = 31 +// lldbg-check:[...] 31 // lldbr-check:(i64) ae = 31 // lldb-command:print oe -// lldbg-check:[...]$27 = 32 +// lldbg-check:[...] 32 // lldbr-check:(i32) oe = 32 // lldb-command:print ue -// lldbg-check:[...]$28 = 33 +// lldbg-check:[...] 33 // lldbr-check:(i32) ue = 33 // lldb-command:print aa -// lldbg-check:[...]$29 = { 0 = 34 1 = 35 } +// lldbg-check:[...] { 0 = 34 1 = 35 } // lldbr-check:((i32, i32)) aa = { 0 = 34 1 = 35 } // lldb-command:print bb -// lldbg-check:[...]$30 = { 0 = 36 1 = 37 } +// lldbg-check:[...] { 0 = 36 1 = 37 } // lldbr-check:((i32, i32)) bb = { 0 = 36 1 = 37 } // lldb-command:print cc -// lldbg-check:[...]$31 = 38 +// lldbg-check:[...] 38 // lldbr-check:(i32) cc = 38 // lldb-command:print dd -// lldbg-check:[...]$32 = { 0 = 40 1 = 41 2 = 42 } +// lldbg-check:[...] { 0 = 40 1 = 41 2 = 42 } // lldbr-check:((i32, i32, i32)) dd = { 0 = 40 1 = 41 2 = 42} // lldb-command:print *ee -// lldbg-check:[...]$33 = { 0 = 43 1 = 44 2 = 45 } +// lldbg-check:[...] { 0 = 43 1 = 44 2 = 45 } // lldbr-check:((i32, i32, i32)) *ee = { 0 = 43 1 = 44 2 = 45} // lldb-command:print *ff -// lldbg-check:[...]$34 = 46 +// lldbg-check:[...] 46 // lldbr-check:(i32) *ff = 46 // lldb-command:print gg -// lldbg-check:[...]$35 = { 0 = 47 1 = 48 } +// lldbg-check:[...] { 0 = 47 1 = 48 } // lldbr-check:((i32, i32)) gg = { 0 = 47 1 = 48 } // lldb-command:print *hh -// lldbg-check:[...]$36 = 50 +// lldbg-check:[...] 50 // lldbr-check:(i32) *hh = 50 // lldb-command:print ii -// lldbg-check:[...]$37 = 51 +// lldbg-check:[...] 51 // lldbr-check:(i32) ii = 51 // lldb-command:print *jj -// lldbg-check:[...]$38 = 52 +// lldbg-check:[...] 52 // lldbr-check:(i32) *jj = 52 // lldb-command:print kk -// lldbg-check:[...]$39 = 53 +// lldbg-check:[...] 53 // lldbr-check:(f64) kk = 53 // lldb-command:print ll -// lldbg-check:[...]$40 = 54 +// lldbg-check:[...] 54 // lldbr-check:(isize) ll = 54 // lldb-command:print mm -// lldbg-check:[...]$41 = 55 +// lldbg-check:[...] 55 // lldbr-check:(f64) mm = 55 // lldb-command:print *nn -// lldbg-check:[...]$42 = 56 +// lldbg-check:[...] 56 // lldbr-check:(isize) *nn = 56 diff --git a/tests/debuginfo/drop-locations.rs b/tests/debuginfo/drop-locations.rs index 6404bf9c3dad..15b2d0de7fe9 100644 --- a/tests/debuginfo/drop-locations.rs +++ b/tests/debuginfo/drop-locations.rs @@ -43,22 +43,22 @@ // lldb-command:run // lldb-command:next // lldb-command:frame select -// lldb-check:[...]#loc1[...] +// lldb-check:[...] #loc1 [...] // lldb-command:next // lldb-command:frame select -// lldb-check:[...]#loc2[...] +// lldb-check:[...] #loc2 [...] // lldb-command:next // lldb-command:frame select -// lldb-check:[...]#loc3[...] +// lldb-check:[...] #loc3 [...] // lldb-command:next // lldb-command:frame select -// lldb-check:[...]#loc4[...] +// lldb-check:[...] #loc4 [...] // lldb-command:next // lldb-command:frame select -// lldb-check:[...]#loc5[...] +// lldb-check:[...] #loc5 [...] // lldb-command:next // lldb-command:frame select -// lldb-check:[...]#loc6[...] +// lldb-check:[...] #loc6 [...] fn main() { diff --git a/tests/debuginfo/empty-string.rs b/tests/debuginfo/empty-string.rs index 838e160e74ea..2afdfc8ad04b 100644 --- a/tests/debuginfo/empty-string.rs +++ b/tests/debuginfo/empty-string.rs @@ -20,10 +20,10 @@ // lldb-command: run // lldb-command: fr v empty_string -// lldb-check:[...]empty_string = "" { vec = size=0 } +// lldb-check:[...] empty_string = "" { vec = size=0 } // lldb-command: fr v empty_str -// lldb-check:[...]empty_str = "" { data_ptr = [...] length = 0 } +// lldb-check:[...] empty_str = "" { data_ptr = [...] length = 0 } fn main() { let empty_string = String::new(); diff --git a/tests/debuginfo/enum-thinlto.rs b/tests/debuginfo/enum-thinlto.rs index 5c27fe4271ca..2e541663147f 100644 --- a/tests/debuginfo/enum-thinlto.rs +++ b/tests/debuginfo/enum-thinlto.rs @@ -15,7 +15,7 @@ // lldb-command:run // lldb-command:print *abc -// lldbg-check:(enum_thinlto::ABC) $0 = +// lldbg-check:(enum_thinlto::ABC) // lldbr-check:(enum_thinlto::ABC) *abc = (x = 0, y = 8970181431921507452) #![allow(unused_variables)] diff --git a/tests/debuginfo/evec-in-struct.rs b/tests/debuginfo/evec-in-struct.rs index d238cc9eded1..0e6565830a9b 100644 --- a/tests/debuginfo/evec-in-struct.rs +++ b/tests/debuginfo/evec-in-struct.rs @@ -31,22 +31,22 @@ // lldb-command:run // lldb-command:print no_padding1 -// lldbg-check:[...]$0 = { x = { [0] = 0 [1] = 1 [2] = 2 } y = -3 z = { [0] = 4.5 [1] = 5.5 } } +// lldbg-check:[...] { x = { [0] = 0 [1] = 1 [2] = 2 } y = -3 z = { [0] = 4.5 [1] = 5.5 } } // lldbr-check:(evec_in_struct::NoPadding1) no_padding1 = { x = { [0] = 0 [1] = 1 [2] = 2 } y = -3 z = { [0] = 4.5 [1] = 5.5 } } // lldb-command:print no_padding2 -// lldbg-check:[...]$1 = { x = { [0] = 6 [1] = 7 [2] = 8 } y = { [0] = { [0] = 9 [1] = 10 } [1] = { [0] = 11 [1] = 12 } } } +// lldbg-check:[...] { x = { [0] = 6 [1] = 7 [2] = 8 } y = { [0] = { [0] = 9 [1] = 10 } [1] = { [0] = 11 [1] = 12 } } } // lldbr-check:(evec_in_struct::NoPadding2) no_padding2 = { x = { [0] = 6 [1] = 7 [2] = 8 } y = { [0] = { [0] = 9 [1] = 10 } [1] = { [0] = 11 [1] = 12 } } } // lldb-command:print struct_internal_padding -// lldbg-check:[...]$2 = { x = { [0] = 13 [1] = 14 } y = { [0] = 15 [1] = 16 } } +// lldbg-check:[...] { x = { [0] = 13 [1] = 14 } y = { [0] = 15 [1] = 16 } } // lldbr-check:(evec_in_struct::StructInternalPadding) struct_internal_padding = { x = { [0] = 13 [1] = 14 } y = { [0] = 15 [1] = 16 } } // lldb-command:print single_vec -// lldbg-check:[...]$3 = { x = { [0] = 17 [1] = 18 [2] = 19 [3] = 20 [4] = 21 } } +// lldbg-check:[...] { x = { [0] = 17 [1] = 18 [2] = 19 [3] = 20 [4] = 21 } } // lldbr-check:(evec_in_struct::SingleVec) single_vec = { x = { [0] = 17 [1] = 18 [2] = 19 [3] = 20 [4] = 21 } } // lldb-command:print struct_padded_at_end -// lldbg-check:[...]$4 = { x = { [0] = 22 [1] = 23 } y = { [0] = 24 [1] = 25 } } +// lldbg-check:[...] { x = { [0] = 22 [1] = 23 } y = { [0] = 24 [1] = 25 } } // lldbr-check:(evec_in_struct::StructPaddedAtEnd) struct_padded_at_end = { x = { [0] = 22 [1] = 23 } y = { [0] = 24 [1] = 25 } } #![allow(unused_variables)] diff --git a/tests/debuginfo/extern-c-fn.rs b/tests/debuginfo/extern-c-fn.rs index 62c2b6099692..0d2eb9e6daf0 100644 --- a/tests/debuginfo/extern-c-fn.rs +++ b/tests/debuginfo/extern-c-fn.rs @@ -22,16 +22,16 @@ // lldb-command:run // lldb-command:print len -// lldbg-check:[...]$0 = 20 +// lldbg-check:[...] 20 // lldbr-check:(i32) len = 20 // lldb-command:print local0 -// lldbg-check:[...]$1 = 19 +// lldbg-check:[...] 19 // lldbr-check:(i32) local0 = 19 // lldb-command:print local1 -// lldbg-check:[...]$2 = true +// lldbg-check:[...] true // lldbr-check:(bool) local1 = true // lldb-command:print local2 -// lldbg-check:[...]$3 = 20.5 +// lldbg-check:[...] 20.5 // lldbr-check:(f64) local2 = 20.5 // lldb-command:continue diff --git a/tests/debuginfo/function-arg-initialization.rs b/tests/debuginfo/function-arg-initialization.rs index 4bdaefd9bdd2..5288aa2e6f16 100644 --- a/tests/debuginfo/function-arg-initialization.rs +++ b/tests/debuginfo/function-arg-initialization.rs @@ -120,99 +120,99 @@ // IMMEDIATE ARGS // lldb-command:print a -// lldb-check:[...]$0 = 1 +// lldb-check:[...] 1 // lldb-command:print b -// lldb-check:[...]$1 = true +// lldb-check:[...] true // lldb-command:print c -// lldb-check:[...]$2 = 2.5 +// lldb-check:[...] 2.5 // lldb-command:continue // NON IMMEDIATE ARGS // lldb-command:print a -// lldb-check:[...]$3 = BigStruct { a: 3, b: 4, c: 5, d: 6, e: 7, f: 8, g: 9, h: 10 } +// lldb-check:[...] BigStruct { a: 3, b: 4, c: 5, d: 6, e: 7, f: 8, g: 9, h: 10 } // lldb-command:print b -// lldb-check:[...]$4 = BigStruct { a: 11, b: 12, c: 13, d: 14, e: 15, f: 16, g: 17, h: 18 } +// lldb-check:[...] BigStruct { a: 11, b: 12, c: 13, d: 14, e: 15, f: 16, g: 17, h: 18 } // lldb-command:continue // BINDING // lldb-command:print a -// lldb-check:[...]$5 = 19 +// lldb-check:[...] 19 // lldb-command:print b -// lldb-check:[...]$6 = 20 +// lldb-check:[...] 20 // lldb-command:print c -// lldb-check:[...]$7 = 21.5 +// lldb-check:[...] 21.5 // lldb-command:continue // ASSIGNMENT // lldb-command:print a -// lldb-check:[...]$8 = 22 +// lldb-check:[...] 22 // lldb-command:print b -// lldb-check:[...]$9 = 23 +// lldb-check:[...] 23 // lldb-command:print c -// lldb-check:[...]$10 = 24.5 +// lldb-check:[...] 24.5 // lldb-command:continue // FUNCTION CALL // lldb-command:print x -// lldb-check:[...]$11 = 25 +// lldb-check:[...] 25 // lldb-command:print y -// lldb-check:[...]$12 = 26 +// lldb-check:[...] 26 // lldb-command:print z -// lldb-check:[...]$13 = 27.5 +// lldb-check:[...] 27.5 // lldb-command:continue // EXPR // lldb-command:print x -// lldb-check:[...]$14 = 28 +// lldb-check:[...] 28 // lldb-command:print y -// lldb-check:[...]$15 = 29 +// lldb-check:[...] 29 // lldb-command:print z -// lldb-check:[...]$16 = 30.5 +// lldb-check:[...] 30.5 // lldb-command:continue // RETURN EXPR // lldb-command:print x -// lldb-check:[...]$17 = 31 +// lldb-check:[...] 31 // lldb-command:print y -// lldb-check:[...]$18 = 32 +// lldb-check:[...] 32 // lldb-command:print z -// lldb-check:[...]$19 = 33.5 +// lldb-check:[...] 33.5 // lldb-command:continue // ARITHMETIC EXPR // lldb-command:print x -// lldb-check:[...]$20 = 34 +// lldb-check:[...] 34 // lldb-command:print y -// lldb-check:[...]$21 = 35 +// lldb-check:[...] 35 // lldb-command:print z -// lldb-check:[...]$22 = 36.5 +// lldb-check:[...] 36.5 // lldb-command:continue // IF EXPR // lldb-command:print x -// lldb-check:[...]$23 = 37 +// lldb-check:[...] 37 // lldb-command:print y -// lldb-check:[...]$24 = 38 +// lldb-check:[...] 38 // lldb-command:print z -// lldb-check:[...]$25 = 39.5 +// lldb-check:[...] 39.5 // lldb-command:continue // WHILE EXPR // lldb-command:print x -// lldb-check:[...]$26 = 40 +// lldb-check:[...] 40 // lldb-command:print y -// lldb-check:[...]$27 = 41 +// lldb-check:[...] 41 // lldb-command:print z -// lldb-check:[...]$28 = 42 +// lldb-check:[...] 42 // lldb-command:continue // LOOP EXPR // lldb-command:print x -// lldb-check:[...]$29 = 43 +// lldb-check:[...] 43 // lldb-command:print y -// lldb-check:[...]$30 = 44 +// lldb-check:[...] 44 // lldb-command:print z -// lldb-check:[...]$31 = 45 +// lldb-check:[...] 45 // lldb-command:continue diff --git a/tests/debuginfo/function-arguments.rs b/tests/debuginfo/function-arguments.rs index c6b865bd458e..84271d07b389 100644 --- a/tests/debuginfo/function-arguments.rs +++ b/tests/debuginfo/function-arguments.rs @@ -23,18 +23,18 @@ // lldb-command:run // lldb-command:print x -// lldbg-check:[...]$0 = 111102 +// lldbg-check:[...] 111102 // lldbr-check:(isize) x = 111102 // lldb-command:print y -// lldbg-check:[...]$1 = true +// lldbg-check:[...] true // lldbr-check:(bool) y = true // lldb-command:continue // lldb-command:print a -// lldbg-check:[...]$2 = 2000 +// lldbg-check:[...] 2000 // lldbr-check:(i32) a = 2000 // lldb-command:print b -// lldbg-check:[...]$3 = 3000 +// lldbg-check:[...] 3000 // lldbr-check:(i64) b = 3000 // lldb-command:continue diff --git a/tests/debuginfo/function-prologue-stepping-regular.rs b/tests/debuginfo/function-prologue-stepping-regular.rs index e52d17a70bd7..02567fd013e5 100644 --- a/tests/debuginfo/function-prologue-stepping-regular.rs +++ b/tests/debuginfo/function-prologue-stepping-regular.rs @@ -21,99 +21,99 @@ // IMMEDIATE ARGS // lldb-command:print a -// lldb-check:[...]$0 = 1 +// lldb-check:[...] 1 // lldb-command:print b -// lldb-check:[...]$1 = true +// lldb-check:[...] true // lldb-command:print c -// lldb-check:[...]$2 = 2.5 +// lldb-check:[...] 2.5 // lldb-command:continue // NON IMMEDIATE ARGS // lldb-command:print a -// lldb-check:[...]$3 = { a = 3, b = 4, c = 5, d = 6, e = 7, f = 8, g = 9, h = 10 } +// lldb-check:[...] { a = 3, b = 4, c = 5, d = 6, e = 7, f = 8, g = 9, h = 10 } // lldb-command:print b -// lldb-check:[...]$4 = { a = 11, b = 12, c = 13, d = 14, e = 15, f = 16, g = 17, h = 18 } +// lldb-check:[...] { a = 11, b = 12, c = 13, d = 14, e = 15, f = 16, g = 17, h = 18 } // lldb-command:continue // BINDING // lldb-command:print a -// lldb-check:[...]$5 = 19 +// lldb-check:[...] 19 // lldb-command:print b -// lldb-check:[...]$6 = 20 +// lldb-check:[...] 20 // lldb-command:print c -// lldb-check:[...]$7 = 21.5 +// lldb-check:[...] 21.5 // lldb-command:continue // ASSIGNMENT // lldb-command:print a -// lldb-check:[...]$8 = 22 +// lldb-check:[...] 22 // lldb-command:print b -// lldb-check:[...]$9 = 23 +// lldb-check:[...] 23 // lldb-command:print c -// lldb-check:[...]$10 = 24.5 +// lldb-check:[...] 24.5 // lldb-command:continue // FUNCTION CALL // lldb-command:print x -// lldb-check:[...]$11 = 25 +// lldb-check:[...] 25 // lldb-command:print y -// lldb-check:[...]$12 = 26 +// lldb-check:[...] 26 // lldb-command:print z -// lldb-check:[...]$13 = 27.5 +// lldb-check:[...] 27.5 // lldb-command:continue // EXPR // lldb-command:print x -// lldb-check:[...]$14 = 28 +// lldb-check:[...] 28 // lldb-command:print y -// lldb-check:[...]$15 = 29 +// lldb-check:[...] 29 // lldb-command:print z -// lldb-check:[...]$16 = 30.5 +// lldb-check:[...] 30.5 // lldb-command:continue // RETURN EXPR // lldb-command:print x -// lldb-check:[...]$17 = 31 +// lldb-check:[...] 31 // lldb-command:print y -// lldb-check:[...]$18 = 32 +// lldb-check:[...] 32 // lldb-command:print z -// lldb-check:[...]$19 = 33.5 +// lldb-check:[...] 33.5 // lldb-command:continue // ARITHMETIC EXPR // lldb-command:print x -// lldb-check:[...]$20 = 34 +// lldb-check:[...] 34 // lldb-command:print y -// lldb-check:[...]$21 = 35 +// lldb-check:[...] 35 // lldb-command:print z -// lldb-check:[...]$22 = 36.5 +// lldb-check:[...] 36.5 // lldb-command:continue // IF EXPR // lldb-command:print x -// lldb-check:[...]$23 = 37 +// lldb-check:[...] 37 // lldb-command:print y -// lldb-check:[...]$24 = 38 +// lldb-check:[...] 38 // lldb-command:print z -// lldb-check:[...]$25 = 39.5 +// lldb-check:[...] 39.5 // lldb-command:continue // WHILE EXPR // lldb-command:print x -// lldb-check:[...]$26 = 40 +// lldb-check:[...] 40 // lldb-command:print y -// lldb-check:[...]$27 = 41 +// lldb-check:[...] 41 // lldb-command:print z -// lldb-check:[...]$28 = 42 +// lldb-check:[...] 42 // lldb-command:continue // LOOP EXPR // lldb-command:print x -// lldb-check:[...]$29 = 43 +// lldb-check:[...] 43 // lldb-command:print y -// lldb-check:[...]$30 = 44 +// lldb-check:[...] 44 // lldb-command:print z -// lldb-check:[...]$31 = 45 +// lldb-check:[...] 45 // lldb-command:continue #![allow(unused_variables)] diff --git a/tests/debuginfo/generic-enum-with-different-disr-sizes.rs b/tests/debuginfo/generic-enum-with-different-disr-sizes.rs index 6a8aa831c404..a7e97194e5df 100644 --- a/tests/debuginfo/generic-enum-with-different-disr-sizes.rs +++ b/tests/debuginfo/generic-enum-with-different-disr-sizes.rs @@ -40,22 +40,22 @@ // lldb-command:run // lldb-command:print eight_bytes1 -// lldb-check:[...]$0 = Variant1(100) +// lldb-check:[...] Variant1(100) // lldb-command:print four_bytes1 -// lldb-check:[...]$1 = Variant1(101) +// lldb-check:[...] Variant1(101) // lldb-command:print two_bytes1 -// lldb-check:[...]$2 = Variant1(102) +// lldb-check:[...] Variant1(102) // lldb-command:print one_byte1 -// lldb-check:[...]$3 = Variant1('A') +// lldb-check:[...] Variant1('A') // lldb-command:print eight_bytes2 -// lldb-check:[...]$4 = Variant2(100) +// lldb-check:[...] Variant2(100) // lldb-command:print four_bytes2 -// lldb-check:[...]$5 = Variant2(101) +// lldb-check:[...] Variant2(101) // lldb-command:print two_bytes2 -// lldb-check:[...]$6 = Variant2(102) +// lldb-check:[...] Variant2(102) // lldb-command:print one_byte2 -// lldb-check:[...]$7 = Variant2('A') +// lldb-check:[...] Variant2('A') // lldb-command:continue diff --git a/tests/debuginfo/generic-function.rs b/tests/debuginfo/generic-function.rs index eab781d2150d..5c33d0d8520b 100644 --- a/tests/debuginfo/generic-function.rs +++ b/tests/debuginfo/generic-function.rs @@ -30,26 +30,26 @@ // lldb-command:run // lldb-command:print *t0 -// lldbg-check:[...]$0 = 1 +// lldbg-check:[...] 1 // lldbr-check:(i32) *t0 = 1 // lldb-command:print *t1 -// lldbg-check:[...]$1 = 2.5 +// lldbg-check:[...] 2.5 // lldbr-check:(f64) *t1 = 2.5 // lldb-command:continue // lldb-command:print *t0 -// lldbg-check:[...]$2 = 3.5 +// lldbg-check:[...] 3.5 // lldbr-check:(f64) *t0 = 3.5 // lldb-command:print *t1 -// lldbg-check:[...]$3 = 4 +// lldbg-check:[...] 4 // lldbr-check:(u16) *t1 = 4 // lldb-command:continue // lldb-command:print *t0 -// lldbg-check:[...]$4 = 5 +// lldbg-check:[...] 5 // lldbr-check:(i32) *t0 = 5 // lldb-command:print *t1 -// lldbg-check:[...]$5 = { a = 6 b = 7.5 } +// lldbg-check:[...] { a = 6 b = 7.5 } // lldbr-check:(generic_function::Struct) *t1 = { a = 6 b = 7.5 } // lldb-command:continue diff --git a/tests/debuginfo/generic-functions-nested.rs b/tests/debuginfo/generic-functions-nested.rs index a146015246e8..4be0ab80f650 100644 --- a/tests/debuginfo/generic-functions-nested.rs +++ b/tests/debuginfo/generic-functions-nested.rs @@ -36,34 +36,34 @@ // lldb-command:run // lldb-command:print x -// lldbg-check:[...]$0 = -1 +// lldbg-check:[...] -1 // lldbr-check:(i32) x = -1 // lldb-command:print y -// lldbg-check:[...]$1 = 1 +// lldbg-check:[...] 1 // lldbr-check:(i32) y = 1 // lldb-command:continue // lldb-command:print x -// lldbg-check:[...]$2 = -1 +// lldbg-check:[...] -1 // lldbr-check:(i32) x = -1 // lldb-command:print y -// lldbg-check:[...]$3 = 2.5 +// lldbg-check:[...] 2.5 // lldbr-check:(f64) y = 2.5 // lldb-command:continue // lldb-command:print x -// lldbg-check:[...]$4 = -2.5 +// lldbg-check:[...] -2.5 // lldbr-check:(f64) x = -2.5 // lldb-command:print y -// lldbg-check:[...]$5 = 1 +// lldbg-check:[...] 1 // lldbr-check:(i32) y = 1 // lldb-command:continue // lldb-command:print x -// lldbg-check:[...]$6 = -2.5 +// lldbg-check:[...] -2.5 // lldbr-check:(f64) x = -2.5 // lldb-command:print y -// lldbg-check:[...]$7 = 2.5 +// lldbg-check:[...] 2.5 // lldbr-check:(f64) y = 2.5 // lldb-command:continue diff --git a/tests/debuginfo/generic-method-on-generic-struct.rs b/tests/debuginfo/generic-method-on-generic-struct.rs index dd1f482f3fa6..dea1c17ad416 100644 --- a/tests/debuginfo/generic-method-on-generic-struct.rs +++ b/tests/debuginfo/generic-method-on-generic-struct.rs @@ -65,61 +65,61 @@ // STACK BY REF // lldb-command:print *self -// lldbg-check:[...]$0 = { x = { 0 = 8888, 1 = -8888 } } +// lldbg-check:[...] { x = { 0 = 8888, 1 = -8888 } } // lldbr-check:(generic_method_on_generic_struct::Struct<(u32, i32)>) *self = { x = { 0 = 8888 1 = -8888 } } // lldb-command:print arg1 -// lldbg-check:[...]$1 = -1 +// lldbg-check:[...] -1 // lldbr-check:(isize) arg1 = -1 // lldb-command:print arg2 -// lldbg-check:[...]$2 = 2 +// lldbg-check:[...] 2 // lldbr-check:(u16) arg2 = 2 // lldb-command:continue // STACK BY VAL // lldb-command:print self -// lldbg-check:[...]$3 = { x = { 0 = 8888, 1 = -8888 } } +// lldbg-check:[...] { x = { 0 = 8888, 1 = -8888 } } // lldbr-check:(generic_method_on_generic_struct::Struct<(u32, i32)>) self = { x = { 0 = 8888, 1 = -8888 } } // lldb-command:print arg1 -// lldbg-check:[...]$4 = -3 +// lldbg-check:[...] -3 // lldbr-check:(isize) arg1 = -3 // lldb-command:print arg2 -// lldbg-check:[...]$5 = -4 +// lldbg-check:[...] -4 // lldbr-check:(i16) arg2 = -4 // lldb-command:continue // OWNED BY REF // lldb-command:print *self -// lldbg-check:[...]$6 = { x = 1234.5 } +// lldbg-check:[...] { x = 1234.5 } // lldbr-check:(generic_method_on_generic_struct::Struct) *self = { x = 1234.5 } // lldb-command:print arg1 -// lldbg-check:[...]$7 = -5 +// lldbg-check:[...] -5 // lldbr-check:(isize) arg1 = -5 // lldb-command:print arg2 -// lldbg-check:[...]$8 = -6 +// lldbg-check:[...] -6 // lldbr-check:(i32) arg2 = -6 // lldb-command:continue // OWNED BY VAL // lldb-command:print self -// lldbg-check:[...]$9 = { x = 1234.5 } +// lldbg-check:[...] { x = 1234.5 } // lldbr-check:(generic_method_on_generic_struct::Struct) self = { x = 1234.5 } // lldb-command:print arg1 -// lldbg-check:[...]$10 = -7 +// lldbg-check:[...] -7 // lldbr-check:(isize) arg1 = -7 // lldb-command:print arg2 -// lldbg-check:[...]$11 = -8 +// lldbg-check:[...] -8 // lldbr-check:(i64) arg2 = -8 // lldb-command:continue // OWNED MOVED // lldb-command:print *self -// lldbg-check:[...]$12 = { x = 1234.5 } +// lldbg-check:[...] { x = 1234.5 } // lldbr-check:(generic_method_on_generic_struct::Struct) *self = { x = 1234.5 } // lldb-command:print arg1 -// lldbg-check:[...]$13 = -9 +// lldbg-check:[...] -9 // lldbr-check:(isize) arg1 = -9 // lldb-command:print arg2 -// lldbg-check:[...]$14 = -10.5 +// lldbg-check:[...] -10.5 // lldbr-check:(f32) arg2 = -10.5 // lldb-command:continue diff --git a/tests/debuginfo/generic-struct.rs b/tests/debuginfo/generic-struct.rs index 82ed17618aaa..4c442feec6ac 100644 --- a/tests/debuginfo/generic-struct.rs +++ b/tests/debuginfo/generic-struct.rs @@ -26,17 +26,17 @@ // lldb-command:run // lldb-command:print int_int -// lldbg-check:[...]$0 = AGenericStruct { key: 0, value: 1 } +// lldbg-check:[...] AGenericStruct { key: 0, value: 1 } // lldbr-check:(generic_struct::AGenericStruct) int_int = AGenericStruct { key: 0, value: 1 } // lldb-command:print int_float -// lldbg-check:[...]$1 = AGenericStruct { key: 2, value: 3.5 } +// lldbg-check:[...] AGenericStruct { key: 2, value: 3.5 } // lldbr-check:(generic_struct::AGenericStruct) int_float = AGenericStruct { key: 2, value: 3.5 } // lldb-command:print float_int -// lldbg-check:[...]$2 = AGenericStruct { key: 4.5, value: 5 } +// lldbg-check:[...] AGenericStruct { key: 4.5, value: 5 } // lldbr-check:(generic_struct::AGenericStruct) float_int = AGenericStruct { key: 4.5, value: 5 } // lldb-command:print float_int_float -// lldbg-check:[...]$3 = AGenericStruct> { key: 6.5, value: AGenericStruct { key: 7, value: 8.5 } } +// lldbg-check:[...] AGenericStruct> { key: 6.5, value: AGenericStruct { key: 7, value: 8.5 } } // lldbr-check:(generic_struct::AGenericStruct>) float_int_float = AGenericStruct> { key: 6.5, value: AGenericStruct { key: 7, value: 8.5 } } // === CDB TESTS =================================================================================== diff --git a/tests/debuginfo/include_string.rs b/tests/debuginfo/include_string.rs index 6f7d2b28b418..77b2d7dec5f9 100644 --- a/tests/debuginfo/include_string.rs +++ b/tests/debuginfo/include_string.rs @@ -16,13 +16,13 @@ // lldb-command:run // lldb-command:print string1.length -// lldbg-check:[...]$0 = 48 +// lldbg-check:[...] 48 // lldbr-check:(usize) length = 48 // lldb-command:print string2.length -// lldbg-check:[...]$1 = 49 +// lldbg-check:[...] 49 // lldbr-check:(usize) length = 49 // lldb-command:print string3.length -// lldbg-check:[...]$2 = 50 +// lldbg-check:[...] 50 // lldbr-check:(usize) length = 50 // lldb-command:continue diff --git a/tests/debuginfo/issue-22656.rs b/tests/debuginfo/issue-22656.rs index acbe2b12a248..375967f2072a 100644 --- a/tests/debuginfo/issue-22656.rs +++ b/tests/debuginfo/issue-22656.rs @@ -11,10 +11,10 @@ // lldb-command:run // lldb-command:print v -// lldbg-check:[...]$0 = size=3 { [0] = 1 [1] = 2 [2] = 3 } +// lldbg-check:[...] size=3 { [0] = 1 [1] = 2 [2] = 3 } // lldbr-check:(alloc::vec::Vec) v = size=3 { [0] = 1 [1] = 2 [2] = 3 } // lldb-command:print zs -// lldbg-check:[...]$1 = { x = y = 123 z = w = 456 } +// lldbg-check:[...] { x = y = 123 z = w = 456 } // lldbr-check:(issue_22656::StructWithZeroSizedField) zs = { x = y = 123 z = w = 456 } // lldbr-command:continue diff --git a/tests/debuginfo/issue-57822.rs b/tests/debuginfo/issue-57822.rs index f4ef45f1d74b..5d0973c1d6b3 100644 --- a/tests/debuginfo/issue-57822.rs +++ b/tests/debuginfo/issue-57822.rs @@ -21,10 +21,10 @@ // lldb-command:run // lldb-command:print g -// lldbg-check:(issue_57822::main::{closure_env#1}) $0 = { f = { x = 1 } } +// lldbg-check:(issue_57822::main::{closure_env#1}) { f = { x = 1 } } // lldb-command:print b -// lldbg-check:(issue_57822::main::{coroutine_env#3}) $1 = +// lldbg-check:(issue_57822::main::{coroutine_env#3}) #![feature(omit_gdb_pretty_printer_section, coroutines, coroutine_trait)] #![omit_gdb_pretty_printer_section] diff --git a/tests/debuginfo/lexical-scope-in-for-loop.rs b/tests/debuginfo/lexical-scope-in-for-loop.rs index 93be5288a640..6d8ff2970ef1 100644 --- a/tests/debuginfo/lexical-scope-in-for-loop.rs +++ b/tests/debuginfo/lexical-scope-in-for-loop.rs @@ -45,40 +45,40 @@ // FIRST ITERATION // lldb-command:print x -// lldbg-check:[...]$0 = 1 +// lldbg-check:[...] 1 // lldbr-check:(i32) x = 1 // lldb-command:continue // lldb-command:print x -// lldbg-check:[...]$1 = -1 +// lldbg-check:[...] -1 // lldbr-check:(i32) x = -1 // lldb-command:continue // SECOND ITERATION // lldb-command:print x -// lldbg-check:[...]$2 = 2 +// lldbg-check:[...] 2 // lldbr-check:(i32) x = 2 // lldb-command:continue // lldb-command:print x -// lldbg-check:[...]$3 = -2 +// lldbg-check:[...] -2 // lldbr-check:(i32) x = -2 // lldb-command:continue // THIRD ITERATION // lldb-command:print x -// lldbg-check:[...]$4 = 3 +// lldbg-check:[...] 3 // lldbr-check:(i32) x = 3 // lldb-command:continue // lldb-command:print x -// lldbg-check:[...]$5 = -3 +// lldbg-check:[...] -3 // lldbr-check:(i32) x = -3 // lldb-command:continue // AFTER LOOP // lldb-command:print x -// lldbg-check:[...]$6 = 1000000 +// lldbg-check:[...] 1000000 // lldbr-check:(i32) x = 1000000 // lldb-command:continue diff --git a/tests/debuginfo/lexical-scope-in-if.rs b/tests/debuginfo/lexical-scope-in-if.rs index 88b4244a503e..3e473acbda25 100644 --- a/tests/debuginfo/lexical-scope-in-if.rs +++ b/tests/debuginfo/lexical-scope-in-if.rs @@ -69,73 +69,73 @@ // BEFORE if // lldb-command:print x -// lldbg-check:[...]$0 = 999 +// lldbg-check:[...] 999 // lldbr-check:(i32) x = 999 // lldb-command:print y -// lldbg-check:[...]$1 = -1 +// lldbg-check:[...] -1 // lldbr-check:(i32) y = -1 // lldb-command:continue // AT BEGINNING of 'then' block // lldb-command:print x -// lldbg-check:[...]$2 = 999 +// lldbg-check:[...] 999 // lldbr-check:(i32) x = 999 // lldb-command:print y -// lldbg-check:[...]$3 = -1 +// lldbg-check:[...] -1 // lldbr-check:(i32) y = -1 // lldb-command:continue // AFTER 1st redeclaration of 'x' // lldb-command:print x -// lldbg-check:[...]$4 = 1001 +// lldbg-check:[...] 1001 // lldbr-check:(i32) x = 1001 // lldb-command:print y -// lldbg-check:[...]$5 = -1 +// lldbg-check:[...] -1 // lldbr-check:(i32) y = -1 // lldb-command:continue // AFTER 2st redeclaration of 'x' // lldb-command:print x -// lldbg-check:[...]$6 = 1002 +// lldbg-check:[...] 1002 // lldbr-check:(i32) x = 1002 // lldb-command:print y -// lldbg-check:[...]$7 = 1003 +// lldbg-check:[...] 1003 // lldbr-check:(i32) y = 1003 // lldb-command:continue // AFTER 1st if expression // lldb-command:print x -// lldbg-check:[...]$8 = 999 +// lldbg-check:[...] 999 // lldbr-check:(i32) x = 999 // lldb-command:print y -// lldbg-check:[...]$9 = -1 +// lldbg-check:[...] -1 // lldbr-check:(i32) y = -1 // lldb-command:continue // BEGINNING of else branch // lldb-command:print x -// lldbg-check:[...]$10 = 999 +// lldbg-check:[...] 999 // lldbr-check:(i32) x = 999 // lldb-command:print y -// lldbg-check:[...]$11 = -1 +// lldbg-check:[...] -1 // lldbr-check:(i32) y = -1 // lldb-command:continue // BEGINNING of else branch // lldb-command:print x -// lldbg-check:[...]$12 = 1004 +// lldbg-check:[...] 1004 // lldbr-check:(i32) x = 1004 // lldb-command:print y -// lldbg-check:[...]$13 = 1005 +// lldbg-check:[...] 1005 // lldbr-check:(i32) y = 1005 // lldb-command:continue // BEGINNING of else branch // lldb-command:print x -// lldbg-check:[...]$14 = 999 +// lldbg-check:[...] 999 // lldbr-check:(i32) x = 999 // lldb-command:print y -// lldbg-check:[...]$15 = -1 +// lldbg-check:[...] -1 // lldbr-check:(i32) y = -1 // lldb-command:continue diff --git a/tests/debuginfo/lexical-scope-in-match.rs b/tests/debuginfo/lexical-scope-in-match.rs index 8a9ecfad249e..0959f020ca31 100644 --- a/tests/debuginfo/lexical-scope-in-match.rs +++ b/tests/debuginfo/lexical-scope-in-match.rs @@ -64,72 +64,72 @@ // lldb-command:run // lldb-command:print shadowed -// lldbg-check:[...]$0 = 231 +// lldbg-check:[...] 231 // lldbr-check:(i32) shadowed = 231 // lldb-command:print not_shadowed -// lldbg-check:[...]$1 = 232 +// lldbg-check:[...] 232 // lldbr-check:(i32) not_shadowed = 232 // lldb-command:continue // lldb-command:print shadowed -// lldbg-check:[...]$2 = 233 +// lldbg-check:[...] 233 // lldbr-check:(i32) shadowed = 233 // lldb-command:print not_shadowed -// lldbg-check:[...]$3 = 232 +// lldbg-check:[...] 232 // lldbr-check:(i32) not_shadowed = 232 // lldb-command:print local_to_arm -// lldbg-check:[...]$4 = 234 +// lldbg-check:[...] 234 // lldbr-check:(i32) local_to_arm = 234 // lldb-command:continue // lldb-command:print shadowed -// lldbg-check:[...]$5 = 236 +// lldbg-check:[...] 236 // lldbr-check:(i32) shadowed = 236 // lldb-command:print not_shadowed -// lldbg-check:[...]$6 = 232 +// lldbg-check:[...] 232 // lldbr-check:(i32) not_shadowed = 232 // lldb-command:continue // lldb-command:print shadowed -// lldbg-check:[...]$7 = 237 +// lldbg-check:[...] 237 // lldbr-check:(isize) shadowed = 237 // lldb-command:print not_shadowed -// lldbg-check:[...]$8 = 232 +// lldbg-check:[...] 232 // lldbr-check:(i32) not_shadowed = 232 // lldb-command:print local_to_arm -// lldbg-check:[...]$9 = 238 +// lldbg-check:[...] 238 // lldbr-check:(isize) local_to_arm = 238 // lldb-command:continue // lldb-command:print shadowed -// lldbg-check:[...]$10 = 239 +// lldbg-check:[...] 239 // lldbr-check:(isize) shadowed = 239 // lldb-command:print not_shadowed -// lldbg-check:[...]$11 = 232 +// lldbg-check:[...] 232 // lldbr-check:(i32) not_shadowed = 232 // lldb-command:continue // lldb-command:print shadowed -// lldbg-check:[...]$12 = 241 +// lldbg-check:[...] 241 // lldbr-check:(isize) shadowed = 241 // lldb-command:print not_shadowed -// lldbg-check:[...]$13 = 232 +// lldbg-check:[...] 232 // lldbr-check:(i32) not_shadowed = 232 // lldb-command:continue // lldb-command:print shadowed -// lldbg-check:[...]$14 = 243 +// lldbg-check:[...] 243 // lldbr-check:(i32) shadowed = 243 // lldb-command:print *local_to_arm -// lldbg-check:[...]$15 = 244 +// lldbg-check:[...] 244 // lldbr-check:(i32) *local_to_arm = 244 // lldb-command:continue // lldb-command:print shadowed -// lldbg-check:[...]$16 = 231 +// lldbg-check:[...] 231 // lldbr-check:(i32) shadowed = 231 // lldb-command:print not_shadowed -// lldbg-check:[...]$17 = 232 +// lldbg-check:[...] 232 // lldbr-check:(i32) not_shadowed = 232 // lldb-command:continue diff --git a/tests/debuginfo/lexical-scope-in-stack-closure.rs b/tests/debuginfo/lexical-scope-in-stack-closure.rs index eeafed9f4db1..4d26b2f5c9ab 100644 --- a/tests/debuginfo/lexical-scope-in-stack-closure.rs +++ b/tests/debuginfo/lexical-scope-in-stack-closure.rs @@ -36,32 +36,32 @@ // lldb-command:run // lldb-command:print x -// lldbg-check:[...]$0 = false +// lldbg-check:[...] false // lldbr-check:(bool) x = false // lldb-command:continue // lldb-command:print x -// lldbg-check:[...]$1 = false +// lldbg-check:[...] false // lldbr-check:(bool) x = false // lldb-command:continue // lldb-command:print x -// lldbg-check:[...]$2 = 1000 +// lldbg-check:[...] 1000 // lldbr-check:(isize) x = 1000 // lldb-command:continue // lldb-command:print x -// lldbg-check:[...]$3 = 2.5 +// lldbg-check:[...] 2.5 // lldbr-check:(f64) x = 2.5 // lldb-command:continue // lldb-command:print x -// lldbg-check:[...]$4 = true +// lldbg-check:[...] true // lldbr-check:(bool) x = true // lldb-command:continue // lldb-command:print x -// lldbg-check:[...]$5 = false +// lldbg-check:[...] false // lldbr-check:(bool) x = false // lldb-command:continue diff --git a/tests/debuginfo/lexical-scope-in-unconditional-loop.rs b/tests/debuginfo/lexical-scope-in-unconditional-loop.rs index ec998975bc7c..cf908b1a510a 100644 --- a/tests/debuginfo/lexical-scope-in-unconditional-loop.rs +++ b/tests/debuginfo/lexical-scope-in-unconditional-loop.rs @@ -68,69 +68,69 @@ // FIRST ITERATION // lldb-command:print x -// lldbg-check:[...]$0 = 0 +// lldbg-check:[...] 0 // lldbr-check:(i32) x = 0 // lldb-command:continue // lldb-command:print x -// lldbg-check:[...]$1 = 1 +// lldbg-check:[...] 1 // lldbr-check:(i32) x = 1 // lldb-command:continue // lldb-command:print x -// lldbg-check:[...]$2 = 101 +// lldbg-check:[...] 101 // lldbr-check:(i32) x = 101 // lldb-command:continue // lldb-command:print x -// lldbg-check:[...]$3 = 101 +// lldbg-check:[...] 101 // lldbr-check:(i32) x = 101 // lldb-command:continue // lldb-command:print x -// lldbg-check:[...]$4 = -987 +// lldbg-check:[...] -987 // lldbr-check:(i32) x = -987 // lldb-command:continue // lldb-command:print x -// lldbg-check:[...]$5 = 101 +// lldbg-check:[...] 101 // lldbr-check:(i32) x = 101 // lldb-command:continue // SECOND ITERATION // lldb-command:print x -// lldbg-check:[...]$6 = 1 +// lldbg-check:[...] 1 // lldbr-check:(i32) x = 1 // lldb-command:continue // lldb-command:print x -// lldbg-check:[...]$7 = 2 +// lldbg-check:[...] 2 // lldbr-check:(i32) x = 2 // lldb-command:continue // lldb-command:print x -// lldbg-check:[...]$8 = 102 +// lldbg-check:[...] 102 // lldbr-check:(i32) x = 102 // lldb-command:continue // lldb-command:print x -// lldbg-check:[...]$9 = 102 +// lldbg-check:[...] 102 // lldbr-check:(i32) x = 102 // lldb-command:continue // lldb-command:print x -// lldbg-check:[...]$10 = -987 +// lldbg-check:[...] -987 // lldbr-check:(i32) x = -987 // lldb-command:continue // lldb-command:print x -// lldbg-check:[...]$11 = 102 +// lldbg-check:[...] 102 // lldbr-check:(i32) x = 102 // lldb-command:continue // lldb-command:print x -// lldbg-check:[...]$12 = 2 +// lldbg-check:[...] 2 // lldbr-check:(i32) x = 2 // lldb-command:continue diff --git a/tests/debuginfo/lexical-scope-in-unique-closure.rs b/tests/debuginfo/lexical-scope-in-unique-closure.rs index 9376d0391875..df8c2598e384 100644 --- a/tests/debuginfo/lexical-scope-in-unique-closure.rs +++ b/tests/debuginfo/lexical-scope-in-unique-closure.rs @@ -36,32 +36,32 @@ // lldb-command:run // lldb-command:print x -// lldbg-check:[...]$0 = false +// lldbg-check:[...] false // lldbr-check:(bool) x = false // lldb-command:continue // lldb-command:print x -// lldbg-check:[...]$1 = false +// lldbg-check:[...] false // lldbr-check:(bool) x = false // lldb-command:continue // lldb-command:print x -// lldbg-check:[...]$2 = 1000 +// lldbg-check:[...] 1000 // lldbr-check:(isize) x = 1000 // lldb-command:continue // lldb-command:print x -// lldbg-check:[...]$3 = 2.5 +// lldbg-check:[...] 2.5 // lldbr-check:(f64) x = 2.5 // lldb-command:continue // lldb-command:print x -// lldbg-check:[...]$4 = true +// lldbg-check:[...] true // lldbr-check:(bool) x = true // lldb-command:continue // lldb-command:print x -// lldbg-check:[...]$5 = false +// lldbg-check:[...] false // lldbr-check:(bool) x = false // lldb-command:continue diff --git a/tests/debuginfo/lexical-scope-in-while.rs b/tests/debuginfo/lexical-scope-in-while.rs index f70ef9c2dd17..98c580e479c1 100644 --- a/tests/debuginfo/lexical-scope-in-while.rs +++ b/tests/debuginfo/lexical-scope-in-while.rs @@ -68,69 +68,69 @@ // FIRST ITERATION // lldb-command:print x -// lldbg-check:[...]$0 = 0 +// lldbg-check:[...] 0 // lldbr-check:(i32) x = 0 // lldb-command:continue // lldb-command:print x -// lldbg-check:[...]$1 = 1 +// lldbg-check:[...] 1 // lldbr-check:(i32) x = 1 // lldb-command:continue // lldb-command:print x -// lldbg-check:[...]$2 = 101 +// lldbg-check:[...] 101 // lldbr-check:(i32) x = 101 // lldb-command:continue // lldb-command:print x -// lldbg-check:[...]$3 = 101 +// lldbg-check:[...] 101 // lldbr-check:(i32) x = 101 // lldb-command:continue // lldb-command:print x -// lldbg-check:[...]$4 = -987 +// lldbg-check:[...] -987 // lldbr-check:(i32) x = -987 // lldb-command:continue // lldb-command:print x -// lldbg-check:[...]$5 = 101 +// lldbg-check:[...] 101 // lldbr-check:(i32) x = 101 // lldb-command:continue // SECOND ITERATION // lldb-command:print x -// lldbg-check:[...]$6 = 1 +// lldbg-check:[...] 1 // lldbr-check:(i32) x = 1 // lldb-command:continue // lldb-command:print x -// lldbg-check:[...]$7 = 2 +// lldbg-check:[...] 2 // lldbr-check:(i32) x = 2 // lldb-command:continue // lldb-command:print x -// lldbg-check:[...]$8 = 102 +// lldbg-check:[...] 102 // lldbr-check:(i32) x = 102 // lldb-command:continue // lldb-command:print x -// lldbg-check:[...]$9 = 102 +// lldbg-check:[...] 102 // lldbr-check:(i32) x = 102 // lldb-command:continue // lldb-command:print x -// lldbg-check:[...]$10 = -987 +// lldbg-check:[...] -987 // lldbr-check:(i32) x = -987 // lldb-command:continue // lldb-command:print x -// lldbg-check:[...]$11 = 102 +// lldbg-check:[...] 102 // lldbr-check:(i32) x = 102 // lldb-command:continue // lldb-command:print x -// lldbg-check:[...]$12 = 2 +// lldbg-check:[...] 2 // lldbr-check:(i32) x = 2 // lldb-command:continue diff --git a/tests/debuginfo/lexical-scope-with-macro.rs b/tests/debuginfo/lexical-scope-with-macro.rs index 400dde6af313..a38aba8b16ab 100644 --- a/tests/debuginfo/lexical-scope-with-macro.rs +++ b/tests/debuginfo/lexical-scope-with-macro.rs @@ -57,56 +57,56 @@ // lldb-command:run // lldb-command:print a -// lldbg-check:[...]$0 = 10 +// lldbg-check:[...] 10 // lldbr-check:(i32) a = 10 // lldb-command:print b -// lldbg-check:[...]$1 = 34 +// lldbg-check:[...] 34 // lldbr-check:(i32) b = 34 // lldb-command:continue // lldb-command:print a -// lldbg-check:[...]$2 = 890242 +// lldbg-check:[...] 890242 // lldbr-check:(i32) a = 10 // lldb-command:print b -// lldbg-check:[...]$3 = 34 +// lldbg-check:[...] 34 // lldbr-check:(i32) b = 34 // lldb-command:continue // lldb-command:print a -// lldbg-check:[...]$4 = 10 +// lldbg-check:[...] 10 // lldbr-check:(i32) a = 10 // lldb-command:print b -// lldbg-check:[...]$5 = 34 +// lldbg-check:[...] 34 // lldbr-check:(i32) b = 34 // lldb-command:continue // lldb-command:print a -// lldbg-check:[...]$6 = 102 +// lldbg-check:[...] 102 // lldbr-check:(i32) a = 10 // lldb-command:print b -// lldbg-check:[...]$7 = 34 +// lldbg-check:[...] 34 // lldbr-check:(i32) b = 34 // lldb-command:continue // Don't test this with rust-enabled lldb for now; see issue #48807 // lldbg-command:print a -// lldbg-check:[...]$8 = 110 +// lldbg-check:[...] 110 // lldbg-command:print b -// lldbg-check:[...]$9 = 34 +// lldbg-check:[...] 34 // lldbg-command:continue // lldbg-command:print a -// lldbg-check:[...]$10 = 10 +// lldbg-check:[...] 10 // lldbg-command:print b -// lldbg-check:[...]$11 = 34 +// lldbg-check:[...] 34 // lldbg-command:continue // lldbg-command:print a -// lldbg-check:[...]$12 = 10 +// lldbg-check:[...] 10 // lldbg-command:print b -// lldbg-check:[...]$13 = 34 +// lldbg-check:[...] 34 // lldbg-command:print c -// lldbg-check:[...]$14 = 400 +// lldbg-check:[...] 400 // lldbg-command:continue diff --git a/tests/debuginfo/lexical-scopes-in-block-expression.rs b/tests/debuginfo/lexical-scopes-in-block-expression.rs index 09cb81424747..5a82dc6e3f35 100644 --- a/tests/debuginfo/lexical-scopes-in-block-expression.rs +++ b/tests/debuginfo/lexical-scopes-in-block-expression.rs @@ -195,202 +195,202 @@ // STRUCT EXPRESSION // lldb-command:print val -// lldbg-check:[...]$0 = -1 +// lldbg-check:[...] -1 // lldbr-check:(i32) val = -1 // lldb-command:print ten -// lldbg-check:[...]$1 = 10 +// lldbg-check:[...] 10 // lldbr-check:(isize) ten = 10 // lldb-command:continue // lldb-command:print val -// lldbg-check:[...]$2 = 11 +// lldbg-check:[...] 11 // lldbr-check:(isize) val = 11 // lldb-command:print ten -// lldbg-check:[...]$3 = 10 +// lldbg-check:[...] 10 // lldbr-check:(isize) ten = 10 // lldb-command:continue // lldb-command:print val -// lldbg-check:[...]$4 = -1 +// lldbg-check:[...] -1 // lldbr-check:(i32) val = -1 // lldb-command:print ten -// lldbg-check:[...]$5 = 10 +// lldbg-check:[...] 10 // lldbr-check:(isize) ten = 10 // lldb-command:continue // FUNCTION CALL // lldb-command:print val -// lldbg-check:[...]$6 = -1 +// lldbg-check:[...] -1 // lldbr-check:(i32) val = -1 // lldb-command:print ten -// lldbg-check:[...]$7 = 10 +// lldbg-check:[...] 10 // lldbr-check:(isize) ten = 10 // lldb-command:continue // lldb-command:print val -// lldbg-check:[...]$8 = 12 +// lldbg-check:[...] 12 // lldbr-check:(isize) val = 12 // lldb-command:print ten -// lldbg-check:[...]$9 = 10 +// lldbg-check:[...] 10 // lldbr-check:(isize) ten = 10 // lldb-command:continue // lldb-command:print val -// lldbg-check:[...]$10 = -1 +// lldbg-check:[...] -1 // lldbr-check:(i32) val = -1 // lldb-command:print ten -// lldbg-check:[...]$11 = 10 +// lldbg-check:[...] 10 // lldbr-check:(isize) ten = 10 // lldb-command:continue // TUPLE EXPRESSION // lldb-command:print val -// lldbg-check:[...]$12 = -1 +// lldbg-check:[...] -1 // lldbr-check:(i32) val = -1 // lldb-command:print ten -// lldbg-check:[...]$13 = 10 +// lldbg-check:[...] 10 // lldbr-check:(isize) ten = 10 // lldb-command:continue // lldb-command:print val -// lldbg-check:[...]$14 = 13 +// lldbg-check:[...] 13 // lldbr-check:(isize) val = 13 // lldb-command:print ten -// lldbg-check:[...]$15 = 10 +// lldbg-check:[...] 10 // lldbr-check:(isize) ten = 10 // lldb-command:continue // lldb-command:print val -// lldbg-check:[...]$16 = -1 +// lldbg-check:[...] -1 // lldbr-check:(i32) val = -1 // lldb-command:print ten -// lldbg-check:[...]$17 = 10 +// lldbg-check:[...] 10 // lldbr-check:(isize) ten = 10 // lldb-command:continue // VEC EXPRESSION // lldb-command:print val -// lldbg-check:[...]$18 = -1 +// lldbg-check:[...] -1 // lldbr-check:(i32) val = -1 // lldb-command:print ten -// lldbg-check:[...]$19 = 10 +// lldbg-check:[...] 10 // lldbr-check:(isize) ten = 10 // lldb-command:continue // lldb-command:print val -// lldbg-check:[...]$20 = 14 +// lldbg-check:[...] 14 // lldbr-check:(isize) val = 14 // lldb-command:print ten -// lldbg-check:[...]$21 = 10 +// lldbg-check:[...] 10 // lldbr-check:(isize) ten = 10 // lldb-command:continue // lldb-command:print val -// lldbg-check:[...]$22 = -1 +// lldbg-check:[...] -1 // lldbr-check:(i32) val = -1 // lldb-command:print ten -// lldbg-check:[...]$23 = 10 +// lldbg-check:[...] 10 // lldbr-check:(isize) ten = 10 // lldb-command:continue // REPEAT VEC EXPRESSION // lldb-command:print val -// lldbg-check:[...]$24 = -1 +// lldbg-check:[...] -1 // lldbr-check:(i32) val = -1 // lldb-command:print ten -// lldbg-check:[...]$25 = 10 +// lldbg-check:[...] 10 // lldbr-check:(isize) ten = 10 // lldb-command:continue // lldb-command:print val -// lldbg-check:[...]$26 = 15 +// lldbg-check:[...] 15 // lldbr-check:(isize) val = 15 // lldb-command:print ten -// lldbg-check:[...]$27 = 10 +// lldbg-check:[...] 10 // lldbr-check:(isize) ten = 10 // lldb-command:continue // lldb-command:print val -// lldbg-check:[...]$28 = -1 +// lldbg-check:[...] -1 // lldbr-check:(i32) val = -1 // lldb-command:print ten -// lldbg-check:[...]$29 = 10 +// lldbg-check:[...] 10 // lldbr-check:(isize) ten = 10 // lldb-command:continue // ASSIGNMENT EXPRESSION // lldb-command:print val -// lldbg-check:[...]$30 = -1 +// lldbg-check:[...] -1 // lldbr-check:(i32) val = -1 // lldb-command:print ten -// lldbg-check:[...]$31 = 10 +// lldbg-check:[...] 10 // lldbr-check:(isize) ten = 10 // lldb-command:continue // lldb-command:print val -// lldbg-check:[...]$32 = 16 +// lldbg-check:[...] 16 // lldbr-check:(isize) val = 16 // lldb-command:print ten -// lldbg-check:[...]$33 = 10 +// lldbg-check:[...] 10 // lldbr-check:(isize) ten = 10 // lldb-command:continue // lldb-command:print val -// lldbg-check:[...]$34 = -1 +// lldbg-check:[...] -1 // lldbr-check:(i32) val = -1 // lldb-command:print ten -// lldbg-check:[...]$35 = 10 +// lldbg-check:[...] 10 // lldbr-check:(isize) ten = 10 // lldb-command:continue // ARITHMETIC EXPRESSION // lldb-command:print val -// lldbg-check:[...]$36 = -1 +// lldbg-check:[...] -1 // lldbr-check:(i32) val = -1 // lldb-command:print ten -// lldbg-check:[...]$37 = 10 +// lldbg-check:[...] 10 // lldbr-check:(isize) ten = 10 // lldb-command:continue // lldb-command:print val -// lldbg-check:[...]$38 = 17 +// lldbg-check:[...] 17 // lldbr-check:(isize) val = 17 // lldb-command:print ten -// lldbg-check:[...]$39 = 10 +// lldbg-check:[...] 10 // lldbr-check:(isize) ten = 10 // lldb-command:continue // lldb-command:print val -// lldbg-check:[...]$40 = -1 +// lldbg-check:[...] -1 // lldbr-check:(i32) val = -1 // lldb-command:print ten -// lldbg-check:[...]$41 = 10 +// lldbg-check:[...] 10 // lldbr-check:(isize) ten = 10 // lldb-command:continue // INDEX EXPRESSION // lldb-command:print val -// lldbg-check:[...]$42 = -1 +// lldbg-check:[...] -1 // lldbr-check:(i32) val = -1 // lldb-command:print ten -// lldbg-check:[...]$43 = 10 +// lldbg-check:[...] 10 // lldbr-check:(isize) ten = 10 // lldb-command:continue // lldb-command:print val -// lldbg-check:[...]$44 = 18 +// lldbg-check:[...] 18 // lldbr-check:(isize) val = 18 // lldb-command:print ten -// lldbg-check:[...]$45 = 10 +// lldbg-check:[...] 10 // lldbr-check:(isize) ten = 10 // lldb-command:continue // lldb-command:print val -// lldbg-check:[...]$46 = -1 +// lldbg-check:[...] -1 // lldbr-check:(i32) val = -1 // lldb-command:print ten -// lldbg-check:[...]$47 = 10 +// lldbg-check:[...] 10 // lldbr-check:(isize) ten = 10 // lldb-command:continue diff --git a/tests/debuginfo/macro-stepping.rs b/tests/debuginfo/macro-stepping.rs index 69cabd92298c..71ff9798079f 100644 --- a/tests/debuginfo/macro-stepping.rs +++ b/tests/debuginfo/macro-stepping.rs @@ -56,36 +56,36 @@ extern crate macro_stepping; // exports new_scope!() // lldb-command:run // lldb-command:next // lldb-command:frame select -// lldb-check:[...]#loc1[...] +// lldb-check:[...] #loc1 [...] // lldb-command:next // lldb-command:frame select -// lldb-check:[...]#loc2[...] +// lldb-check:[...] #loc2 [...] // lldb-command:next // lldb-command:frame select -// lldb-check:[...]#loc3[...] +// lldb-check:[...] #loc3 [...] // lldb-command:next // lldb-command:frame select -// lldb-check:[...]#loc4[...] +// lldb-check:[...] #loc4 [...] // lldb-command:next // lldb-command:frame select -// lldb-check:[...]#loc5[...] +// lldb-check:[...] #loc5 [...] // lldb-command:continue // lldb-command:step // lldb-command:frame select -// lldb-check:[...]#inc-loc1[...] +// lldb-check:[...] #inc-loc1 [...] // lldb-command:next // lldb-command:frame select -// lldb-check:[...]#inc-loc2[...] +// lldb-check:[...] #inc-loc2 [...] // lldb-command:next // lldb-command:frame select -// lldb-check:[...]#inc-loc1[...] +// lldb-check:[...] #inc-loc1 [...] // lldb-command:next // lldb-command:frame select -// lldb-check:[...]#inc-loc2[...] +// lldb-check:[...] #inc-loc2 [...] // lldb-command:next // lldb-command:frame select -// lldb-check:[...]#inc-loc3[...] +// lldb-check:[...] #inc-loc3 [...] macro_rules! foo { () => { diff --git a/tests/debuginfo/method-on-enum.rs b/tests/debuginfo/method-on-enum.rs index 454967c6cb71..f947ba350e7f 100644 --- a/tests/debuginfo/method-on-enum.rs +++ b/tests/debuginfo/method-on-enum.rs @@ -64,47 +64,47 @@ // STACK BY REF // lldb-command:print *self -// lldb-check:[...]$0 = Variant2(117901063) +// lldb-check:[...] Variant2(117901063) // lldb-command:print arg1 -// lldb-check:[...]$1 = -1 +// lldb-check:[...] -1 // lldb-command:print arg2 -// lldb-check:[...]$2 = -2 +// lldb-check:[...] -2 // lldb-command:continue // STACK BY VAL // lldb-command:print self -// lldb-check:[...]$3 = Variant2(117901063) +// lldb-check:[...] Variant2(117901063) // lldb-command:print arg1 -// lldb-check:[...]$4 = -3 +// lldb-check:[...] -3 // lldb-command:print arg2 -// lldb-check:[...]$5 = -4 +// lldb-check:[...] -4 // lldb-command:continue // OWNED BY REF // lldb-command:print *self -// lldb-check:[...]$6 = Variant1 { x: 1799, y: 1799 } +// lldb-check:[...] Variant1 { x: 1799, y: 1799 } // lldb-command:print arg1 -// lldb-check:[...]$7 = -5 +// lldb-check:[...] -5 // lldb-command:print arg2 -// lldb-check:[...]$8 = -6 +// lldb-check:[...] -6 // lldb-command:continue // OWNED BY VAL // lldb-command:print self -// lldb-check:[...]$9 = Variant1 { x: 1799, y: 1799 } +// lldb-check:[...] Variant1 { x: 1799, y: 1799 } // lldb-command:print arg1 -// lldb-check:[...]$10 = -7 +// lldb-check:[...] -7 // lldb-command:print arg2 -// lldb-check:[...]$11 = -8 +// lldb-check:[...] -8 // lldb-command:continue // OWNED MOVED // lldb-command:print *self -// lldb-check:[...]$12 = Variant1 { x: 1799, y: 1799 } +// lldb-check:[...] Variant1 { x: 1799, y: 1799 } // lldb-command:print arg1 -// lldb-check:[...]$13 = -9 +// lldb-check:[...] -9 // lldb-command:print arg2 -// lldb-check:[...]$14 = -10 +// lldb-check:[...] -10 // lldb-command:continue #![feature(omit_gdb_pretty_printer_section)] diff --git a/tests/debuginfo/method-on-generic-struct.rs b/tests/debuginfo/method-on-generic-struct.rs index 562798c27daa..16793fb9bc65 100644 --- a/tests/debuginfo/method-on-generic-struct.rs +++ b/tests/debuginfo/method-on-generic-struct.rs @@ -65,61 +65,61 @@ // STACK BY REF // lldb-command:print *self -// lldbg-check:[...]$0 = Struct<(u32, i32)> { x: (8888, -8888) } +// lldbg-check:[...] Struct<(u32, i32)> { x: (8888, -8888) } // lldbr-check:(method_on_generic_struct::Struct<(u32, i32)>) *self = { x = { = 8888 = -8888 } } // lldb-command:print arg1 -// lldbg-check:[...]$1 = -1 +// lldbg-check:[...] -1 // lldbr-check:(isize) arg1 = -1 // lldb-command:print arg2 -// lldbg-check:[...]$2 = -2 +// lldbg-check:[...] -2 // lldbr-check:(isize) arg2 = -2 // lldb-command:continue // STACK BY VAL // lldb-command:print self -// lldbg-check:[...]$3 = Struct<(u32, i32)> { x: (8888, -8888) } +// lldbg-check:[...] Struct<(u32, i32)> { x: (8888, -8888) } // lldbr-check:(method_on_generic_struct::Struct<(u32, i32)>) self = { x = { = 8888 = -8888 } } // lldb-command:print arg1 -// lldbg-check:[...]$4 = -3 +// lldbg-check:[...] -3 // lldbr-check:(isize) arg1 = -3 // lldb-command:print arg2 -// lldbg-check:[...]$5 = -4 +// lldbg-check:[...] -4 // lldbr-check:(isize) arg2 = -4 // lldb-command:continue // OWNED BY REF // lldb-command:print *self -// lldbg-check:[...]$6 = Struct { x: 1234.5 } +// lldbg-check:[...] Struct { x: 1234.5 } // lldbr-check:(method_on_generic_struct::Struct) *self = Struct { x: 1234.5 } // lldb-command:print arg1 -// lldbg-check:[...]$7 = -5 +// lldbg-check:[...] -5 // lldbr-check:(isize) arg1 = -5 // lldb-command:print arg2 -// lldbg-check:[...]$8 = -6 +// lldbg-check:[...] -6 // lldbr-check:(isize) arg2 = -6 // lldb-command:continue // OWNED BY VAL // lldb-command:print self -// lldbg-check:[...]$9 = Struct { x: 1234.5 } +// lldbg-check:[...] Struct { x: 1234.5 } // lldbr-check:(method_on_generic_struct::Struct) self = Struct { x: 1234.5 } // lldb-command:print arg1 -// lldbg-check:[...]$10 = -7 +// lldbg-check:[...] -7 // lldbr-check:(isize) arg1 = -7 // lldb-command:print arg2 -// lldbg-check:[...]$11 = -8 +// lldbg-check:[...] -8 // lldbr-check:(isize) arg2 = -8 // lldb-command:continue // OWNED MOVED // lldb-command:print *self -// lldbg-check:[...]$12 = Struct { x: 1234.5 } +// lldbg-check:[...] Struct { x: 1234.5 } // lldbr-check:(method_on_generic_struct::Struct) *self = Struct { x: 1234.5 } // lldb-command:print arg1 -// lldbg-check:[...]$13 = -9 +// lldbg-check:[...] -9 // lldbr-check:(isize) arg1 = -9 // lldb-command:print arg2 -// lldbg-check:[...]$14 = -10 +// lldbg-check:[...] -10 // lldbr-check:(isize) arg2 = -10 // lldb-command:continue diff --git a/tests/debuginfo/method-on-struct.rs b/tests/debuginfo/method-on-struct.rs index bb94ced305d6..56bcb462cb36 100644 --- a/tests/debuginfo/method-on-struct.rs +++ b/tests/debuginfo/method-on-struct.rs @@ -63,61 +63,61 @@ // STACK BY REF // lldb-command:print *self -// lldbg-check:[...]$0 = { x = 100 } +// lldbg-check:[...] { x = 100 } // lldbr-check:(method_on_struct::Struct) *self = Struct { x: 100 } // lldb-command:print arg1 -// lldbg-check:[...]$1 = -1 +// lldbg-check:[...] -1 // lldbr-check:(isize) arg1 = -1 // lldb-command:print arg2 -// lldbg-check:[...]$2 = -2 +// lldbg-check:[...] -2 // lldbr-check:(isize) arg2 = -2 // lldb-command:continue // STACK BY VAL // lldb-command:print self -// lldbg-check:[...]$3 = { x = 100 } +// lldbg-check:[...] { x = 100 } // lldbr-check:(method_on_struct::Struct) self = Struct { x: 100 } // lldb-command:print arg1 -// lldbg-check:[...]$4 = -3 +// lldbg-check:[...] -3 // lldbr-check:(isize) arg1 = -3 // lldb-command:print arg2 -// lldbg-check:[...]$5 = -4 +// lldbg-check:[...] -4 // lldbr-check:(isize) arg2 = -4 // lldb-command:continue // OWNED BY REF // lldb-command:print *self -// lldbg-check:[...]$6 = { x = 200 } +// lldbg-check:[...] { x = 200 } // lldbr-check:(method_on_struct::Struct) *self = Struct { x: 200 } // lldb-command:print arg1 -// lldbg-check:[...]$7 = -5 +// lldbg-check:[...] -5 // lldbr-check:(isize) arg1 = -5 // lldb-command:print arg2 -// lldbg-check:[...]$8 = -6 +// lldbg-check:[...] -6 // lldbr-check:(isize) arg2 = -6 // lldb-command:continue // OWNED BY VAL // lldb-command:print self -// lldbg-check:[...]$9 = { x = 200 } +// lldbg-check:[...] { x = 200 } // lldbr-check:(method_on_struct::Struct) self = Struct { x: 200 } // lldb-command:print arg1 -// lldbg-check:[...]$10 = -7 +// lldbg-check:[...] -7 // lldbr-check:(isize) arg1 = -7 // lldb-command:print arg2 -// lldbg-check:[...]$11 = -8 +// lldbg-check:[...] -8 // lldbr-check:(isize) arg2 = -8 // lldb-command:continue // OWNED MOVED // lldb-command:print *self -// lldbg-check:[...]$12 = { x = 200 } +// lldbg-check:[...] { x = 200 } // lldbr-check:(method_on_struct::Struct) *self = Struct { x: 200 } // lldb-command:print arg1 -// lldbg-check:[...]$13 = -9 +// lldbg-check:[...] -9 // lldbr-check:(isize) arg1 = -9 // lldb-command:print arg2 -// lldbg-check:[...]$14 = -10 +// lldbg-check:[...] -10 // lldbr-check:(isize) arg2 = -10 // lldb-command:continue diff --git a/tests/debuginfo/method-on-trait.rs b/tests/debuginfo/method-on-trait.rs index bc8def40105c..0264ff68d1b0 100644 --- a/tests/debuginfo/method-on-trait.rs +++ b/tests/debuginfo/method-on-trait.rs @@ -63,61 +63,61 @@ // STACK BY REF // lldb-command:print *self -// lldbg-check:[...]$0 = { x = 100 } +// lldbg-check:[...] { x = 100 } // lldbr-check:(method_on_trait::Struct) *self = { x = 100 } // lldb-command:print arg1 -// lldbg-check:[...]$1 = -1 +// lldbg-check:[...] -1 // lldbr-check:(isize) arg1 = -1 // lldb-command:print arg2 -// lldbg-check:[...]$2 = -2 +// lldbg-check:[...] -2 // lldbr-check:(isize) arg2 = -2 // lldb-command:continue // STACK BY VAL // lldb-command:print self -// lldbg-check:[...]$3 = { x = 100 } +// lldbg-check:[...] { x = 100 } // lldbr-check:(method_on_trait::Struct) self = { x = 100 } // lldb-command:print arg1 -// lldbg-check:[...]$4 = -3 +// lldbg-check:[...] -3 // lldbr-check:(isize) arg1 = -3 // lldb-command:print arg2 -// lldbg-check:[...]$5 = -4 +// lldbg-check:[...] -4 // lldbr-check:(isize) arg2 = -4 // lldb-command:continue // OWNED BY REF // lldb-command:print *self -// lldbg-check:[...]$6 = { x = 200 } +// lldbg-check:[...] { x = 200 } // lldbr-check:(method_on_trait::Struct) *self = { x = 200 } // lldb-command:print arg1 -// lldbg-check:[...]$7 = -5 +// lldbg-check:[...] -5 // lldbr-check:(isize) arg1 = -5 // lldb-command:print arg2 -// lldbg-check:[...]$8 = -6 +// lldbg-check:[...] -6 // lldbr-check:(isize) arg2 = -6 // lldb-command:continue // OWNED BY VAL // lldb-command:print self -// lldbg-check:[...]$9 = { x = 200 } +// lldbg-check:[...] { x = 200 } // lldbr-check:(method_on_trait::Struct) self = { x = 200 } // lldb-command:print arg1 -// lldbg-check:[...]$10 = -7 +// lldbg-check:[...] -7 // lldbr-check:(isize) arg1 = -7 // lldb-command:print arg2 -// lldbg-check:[...]$11 = -8 +// lldbg-check:[...] -8 // lldbr-check:(isize) arg2 = -8 // lldb-command:continue // OWNED MOVED // lldb-command:print *self -// lldbg-check:[...]$12 = { x = 200 } +// lldbg-check:[...] { x = 200 } // lldbr-check:(method_on_trait::Struct) *self = { x = 200 } // lldb-command:print arg1 -// lldbg-check:[...]$13 = -9 +// lldbg-check:[...] -9 // lldbr-check:(isize) arg1 = -9 // lldb-command:print arg2 -// lldbg-check:[...]$14 = -10 +// lldbg-check:[...] -10 // lldbr-check:(isize) arg2 = -10 // lldb-command:continue diff --git a/tests/debuginfo/method-on-tuple-struct.rs b/tests/debuginfo/method-on-tuple-struct.rs index 7ac0a2d85748..872f6ea57c21 100644 --- a/tests/debuginfo/method-on-tuple-struct.rs +++ b/tests/debuginfo/method-on-tuple-struct.rs @@ -63,61 +63,61 @@ // STACK BY REF // lldb-command:print *self -// lldbg-check:[...]$0 = { 0 = 100 1 = -100.5 } +// lldbg-check:[...] { 0 = 100 1 = -100.5 } // lldbr-check:(method_on_tuple_struct::TupleStruct) *self = { 0 = 100 1 = -100.5 } // lldb-command:print arg1 -// lldbg-check:[...]$1 = -1 +// lldbg-check:[...] -1 // lldbr-check:(isize) arg1 = -1 // lldb-command:print arg2 -// lldbg-check:[...]$2 = -2 +// lldbg-check:[...] -2 // lldbr-check:(isize) arg2 = -2 // lldb-command:continue // STACK BY VAL // lldb-command:print self -// lldbg-check:[...]$3 = { 0 = 100 1 = -100.5 } +// lldbg-check:[...] { 0 = 100 1 = -100.5 } // lldbr-check:(method_on_tuple_struct::TupleStruct) self = { 0 = 100 1 = -100.5 } // lldb-command:print arg1 -// lldbg-check:[...]$4 = -3 +// lldbg-check:[...] -3 // lldbr-check:(isize) arg1 = -3 // lldb-command:print arg2 -// lldbg-check:[...]$5 = -4 +// lldbg-check:[...] -4 // lldbr-check:(isize) arg2 = -4 // lldb-command:continue // OWNED BY REF // lldb-command:print *self -// lldbg-check:[...]$6 = { 0 = 200 1 = -200.5 } +// lldbg-check:[...] { 0 = 200 1 = -200.5 } // lldbr-check:(method_on_tuple_struct::TupleStruct) *self = { 0 = 200 1 = -200.5 } // lldb-command:print arg1 -// lldbg-check:[...]$7 = -5 +// lldbg-check:[...] -5 // lldbr-check:(isize) arg1 = -5 // lldb-command:print arg2 -// lldbg-check:[...]$8 = -6 +// lldbg-check:[...] -6 // lldbr-check:(isize) arg2 = -6 // lldb-command:continue // OWNED BY VAL // lldb-command:print self -// lldbg-check:[...]$9 = { 0 = 200 1 = -200.5 } +// lldbg-check:[...] { 0 = 200 1 = -200.5 } // lldbr-check:(method_on_tuple_struct::TupleStruct) self = { 0 = 200 1 = -200.5 } // lldb-command:print arg1 -// lldbg-check:[...]$10 = -7 +// lldbg-check:[...] -7 // lldbr-check:(isize) arg1 = -7 // lldb-command:print arg2 -// lldbg-check:[...]$11 = -8 +// lldbg-check:[...] -8 // lldbr-check:(isize) arg2 = -8 // lldb-command:continue // OWNED MOVED // lldb-command:print *self -// lldbg-check:[...]$12 = { 0 = 200 1 = -200.5 } +// lldbg-check:[...] { 0 = 200 1 = -200.5 } // lldbr-check:(method_on_tuple_struct::TupleStruct) *self = { 0 = 200 1 = -200.5 } // lldb-command:print arg1 -// lldbg-check:[...]$13 = -9 +// lldbg-check:[...] -9 // lldbr-check:(isize) arg1 = -9 // lldb-command:print arg2 -// lldbg-check:[...]$14 = -10 +// lldbg-check:[...] -10 // lldbr-check:(isize) arg2 = -10 // lldb-command:continue diff --git a/tests/debuginfo/multi-cgu.rs b/tests/debuginfo/multi-cgu.rs index b2ad1d3cd95c..42aa25c14212 100644 --- a/tests/debuginfo/multi-cgu.rs +++ b/tests/debuginfo/multi-cgu.rs @@ -24,12 +24,12 @@ // lldb-command:run // lldb-command:print xxx -// lldbg-check:[...]$0 = 12345 +// lldbg-check:[...] 12345 // lldbr-check:(u32) xxx = 12345 // lldb-command:continue // lldb-command:print yyy -// lldbg-check:[...]$1 = 67890 +// lldbg-check:[...] 67890 // lldbr-check:(u64) yyy = 67890 // lldb-command:continue diff --git a/tests/debuginfo/multiple-functions-equal-var-names.rs b/tests/debuginfo/multiple-functions-equal-var-names.rs index 08446997b424..113eac29256b 100644 --- a/tests/debuginfo/multiple-functions-equal-var-names.rs +++ b/tests/debuginfo/multiple-functions-equal-var-names.rs @@ -23,17 +23,17 @@ // lldb-command:run // lldb-command:print abc -// lldbg-check:[...]$0 = 10101 +// lldbg-check:[...] 10101 // lldbr-check:(i32) abc = 10101 // lldb-command:continue // lldb-command:print abc -// lldbg-check:[...]$1 = 20202 +// lldbg-check:[...] 20202 // lldbr-check:(i32) abc = 20202 // lldb-command:continue // lldb-command:print abc -// lldbg-check:[...]$2 = 30303 +// lldbg-check:[...] 30303 // lldbr-check:(i32) abc = 30303 #![allow(unused_variables)] diff --git a/tests/debuginfo/multiple-functions.rs b/tests/debuginfo/multiple-functions.rs index 2c4092fd5a33..81fdc4f3d403 100644 --- a/tests/debuginfo/multiple-functions.rs +++ b/tests/debuginfo/multiple-functions.rs @@ -23,17 +23,17 @@ // lldb-command:run // lldb-command:print a -// lldbg-check:[...]$0 = 10101 +// lldbg-check:[...] 10101 // lldbr-check:(i32) a = 10101 // lldb-command:continue // lldb-command:print b -// lldbg-check:[...]$1 = 20202 +// lldbg-check:[...] 20202 // lldbr-check:(i32) b = 20202 // lldb-command:continue // lldb-command:print c -// lldbg-check:[...]$2 = 30303 +// lldbg-check:[...] 30303 // lldbr-check:(i32) c = 30303 #![allow(unused_variables)] diff --git a/tests/debuginfo/name-shadowing-and-scope-nesting.rs b/tests/debuginfo/name-shadowing-and-scope-nesting.rs index e8860b2d1048..42df96668106 100644 --- a/tests/debuginfo/name-shadowing-and-scope-nesting.rs +++ b/tests/debuginfo/name-shadowing-and-scope-nesting.rs @@ -48,50 +48,50 @@ // lldb-command:run // lldb-command:print x -// lldbg-check:[...]$0 = false +// lldbg-check:[...] false // lldbr-check:(bool) x = false // lldb-command:print y -// lldbg-check:[...]$1 = true +// lldbg-check:[...] true // lldbr-check:(bool) y = true // lldb-command:continue // lldb-command:print x -// lldbg-check:[...]$2 = 10 +// lldbg-check:[...] 10 // lldbr-check:(i32) x = 10 // lldb-command:print y -// lldbg-check:[...]$3 = true +// lldbg-check:[...] true // lldbr-check:(bool) y = true // lldb-command:continue // lldb-command:print x -// lldbg-check:[...]$4 = 10.5 +// lldbg-check:[...] 10.5 // lldbr-check:(f64) x = 10.5 // lldb-command:print y -// lldbg-check:[...]$5 = 20 +// lldbg-check:[...] 20 // lldbr-check:(i32) y = 20 // lldb-command:continue // lldb-command:print x -// lldbg-check:[...]$6 = true +// lldbg-check:[...] true // lldbr-check:(bool) x = true // lldb-command:print y -// lldbg-check:[...]$7 = 2220 +// lldbg-check:[...] 2220 // lldbr-check:(i32) y = 2220 // lldb-command:continue // lldb-command:print x -// lldbg-check:[...]$8 = 203203.5 +// lldbg-check:[...] 203203.5 // lldbr-check:(f64) x = 203203.5 // lldb-command:print y -// lldbg-check:[...]$9 = 2220 +// lldbg-check:[...] 2220 // lldbr-check:(i32) y = 2220 // lldb-command:continue // lldb-command:print x -// lldbg-check:[...]$10 = 10.5 +// lldbg-check:[...] 10.5 // lldbr-check:(f64) x = 10.5 // lldb-command:print y -// lldbg-check:[...]$11 = 20 +// lldbg-check:[...] 20 // lldbr-check:(i32) y = 20 // lldb-command:continue diff --git a/tests/debuginfo/no_mangle-info.rs b/tests/debuginfo/no_mangle-info.rs index 15629d217ba7..9cb42656f2a4 100644 --- a/tests/debuginfo/no_mangle-info.rs +++ b/tests/debuginfo/no_mangle-info.rs @@ -11,9 +11,9 @@ // === LLDB TESTS ================================================================================== // lldb-command:run // lldb-command:p TEST -// lldb-check: (unsigned long) $0 = 3735928559 +// lldb-check: (unsigned long) 3735928559 // lldb-command:p OTHER_TEST -// lldb-check: (unsigned long) $1 = 42 +// lldb-check: (unsigned long) 42 // === CDB TESTS ================================================================================== // cdb-command: g diff --git a/tests/debuginfo/numeric-types.rs b/tests/debuginfo/numeric-types.rs index f662fa7ed549..615f365173f5 100644 --- a/tests/debuginfo/numeric-types.rs +++ b/tests/debuginfo/numeric-types.rs @@ -203,42 +203,40 @@ // lldb-command:run // lldb-command:print/d nz_i8 -// lldb-check:[...]$0 = 11 { __0 = { 0 = 11 } } +// lldb-check:[...] 11 { __0 = { 0 = 11 } } // lldb-command:print nz_i16 -// lldb-check:[...]$1 = 22 { __0 = { 0 = 22 } } +// lldb-check:[...] 22 { __0 = { 0 = 22 } } // lldb-command:print nz_i32 -// lldb-check:[...]$2 = 33 { __0 = { 0 = 33 } } +// lldb-check:[...] 33 { __0 = { 0 = 33 } } // lldb-command:print nz_i64 -// lldb-check:[...]$3 = 44 { __0 = { 0 = 44 } } +// lldb-check:[...] 44 { __0 = { 0 = 44 } } // lldb-command:print nz_i128 -// lldb-check:[...]$4 = 55 { __0 = { 0 = 55 } } +// lldb-check:[...] 55 { __0 = { 0 = 55 } } // lldb-command:print nz_isize -// FIXME: `lldb_lookup.summary_lookup` is never called for `NonZero` for some reason. -// // lldb-check:[...]$5 = 66 { __0 = { 0 = 66 } } +// lldb-check:[...] 66 { __0 = { 0 = 66 } } // lldb-command:print/d nz_u8 -// lldb-check:[...]$6 = 77 { __0 = { 0 = 77 } } +// lldb-check:[...] 77 { __0 = { 0 = 77 } } // lldb-command:print nz_u16 -// lldb-check:[...]$7 = 88 { __0 = { 0 = 88 } } +// lldb-check:[...] 88 { __0 = { 0 = 88 } } // lldb-command:print nz_u32 -// lldb-check:[...]$8 = 99 { __0 = { 0 = 99 } } +// lldb-check:[...] 99 { __0 = { 0 = 99 } } // lldb-command:print nz_u64 -// lldb-check:[...]$9 = 100 { __0 = { 0 = 100 } } +// lldb-check:[...] 100 { __0 = { 0 = 100 } } // lldb-command:print nz_u128 -// lldb-check:[...]$10 = 111 { __0 = { 0 = 111 } } +// lldb-check:[...] 111 { __0 = { 0 = 111 } } // lldb-command:print nz_usize -// FIXME: `lldb_lookup.summary_lookup` is never called for `NonZero` for some reason. -// // lldb-check:[...]$11 = 122 { __0 = { 0 = 122 } } +// lldb-check:[...] 122 { __0 = { 0 = 122 } } #![feature(generic_nonzero)] use std::num::*; diff --git a/tests/debuginfo/option-like-enum.rs b/tests/debuginfo/option-like-enum.rs index b2a8aa1c29a0..03646c99f648 100644 --- a/tests/debuginfo/option-like-enum.rs +++ b/tests/debuginfo/option-like-enum.rs @@ -48,34 +48,34 @@ // lldb-command:run // lldb-command:print some -// lldb-check:[...]$0 = Some(&0x12345678) +// lldb-check:[...] Some(&0x12345678) // lldb-command:print none -// lldb-check:[...]$1 = None +// lldb-check:[...] None // lldb-command:print full -// lldb-check:[...]$2 = Full(454545, &0x87654321, 9988) +// lldb-check:[...] Full(454545, &0x87654321, 9988) // lldb-command:print empty -// lldb-check:[...]$3 = Empty +// lldb-check:[...] Empty // lldb-command:print droid -// lldb-check:[...]$4 = Droid { id: 675675, range: 10000001, internals: &0x43218765 } +// lldb-check:[...] Droid { id: 675675, range: 10000001, internals: &0x43218765 } // lldb-command:print void_droid -// lldb-check:[...]$5 = Void +// lldb-check:[...] Void // lldb-command:print some_str -// lldb-check:[...]$6 = Some("abc") +// lldb-check:[...] Some("abc") // lldb-command:print none_str -// lldb-check:[...]$7 = None +// lldb-check:[...] None // lldb-command:print nested_non_zero_yep -// lldb-check:[...]$8 = Yep(10.5, NestedNonZeroField { a: 10, b: 20, c: &[...] }) +// lldb-check:[...] Yep(10.5, NestedNonZeroField { a: 10, b: 20, c: &[...] }) // lldb-command:print nested_non_zero_nope -// lldb-check:[...]$9 = Nope +// lldb-check:[...] Nope #![feature(omit_gdb_pretty_printer_section)] diff --git a/tests/debuginfo/packed-struct-with-destructor.rs b/tests/debuginfo/packed-struct-with-destructor.rs index 19788339efa9..b1f237db8148 100644 --- a/tests/debuginfo/packed-struct-with-destructor.rs +++ b/tests/debuginfo/packed-struct-with-destructor.rs @@ -45,35 +45,35 @@ // lldb-command:run // lldb-command:print packed -// lldbg-check:[...]$0 = { x = 123 y = 234 z = 345 } +// lldbg-check:[...] { x = 123 y = 234 z = 345 } // lldbr-check:(packed_struct_with_destructor::Packed) packed = { x = 123 y = 234 z = 345 } // lldb-command:print packedInPacked -// lldbg-check:[...]$1 = { a = 1111 b = { x = 2222 y = 3333 z = 4444 } c = 5555 d = { x = 6666 y = 7777 z = 8888 } } +// lldbg-check:[...] { a = 1111 b = { x = 2222 y = 3333 z = 4444 } c = 5555 d = { x = 6666 y = 7777 z = 8888 } } // lldbr-check:(packed_struct_with_destructor::PackedInPacked) packedInPacked = { a = 1111 b = { x = 2222 y = 3333 z = 4444 } c = 5555 d = { x = 6666 y = 7777 z = 8888 } } // lldb-command:print packedInUnpacked -// lldbg-check:[...]$2 = { a = -1111 b = { x = -2222 y = -3333 z = -4444 } c = -5555 d = { x = -6666 y = -7777 z = -8888 } } +// lldbg-check:[...] { a = -1111 b = { x = -2222 y = -3333 z = -4444 } c = -5555 d = { x = -6666 y = -7777 z = -8888 } } // lldbr-check:(packed_struct_with_destructor::PackedInUnpacked) packedInUnpacked = { a = -1111 b = { x = -2222 y = -3333 z = -4444 } c = -5555 d = { x = -6666 y = -7777 z = -8888 } } // lldb-command:print unpackedInPacked -// lldbg-check:[...]$3 = { a = 987 b = { x = 876 y = 765 z = 654 } c = { x = 543 y = 432 z = 321 } d = 210 } +// lldbg-check:[...] { a = 987 b = { x = 876 y = 765 z = 654 } c = { x = 543 y = 432 z = 321 } d = 210 } // lldbr-check:(packed_struct_with_destructor::UnpackedInPacked) unpackedInPacked = { a = 987 b = { x = 876 y = 765 z = 654 } c = { x = 543 y = 432 z = 321 } d = 210 } // lldb-command:print packedInPackedWithDrop -// lldbg-check:[...]$4 = { a = 11 b = { x = 22 y = 33 z = 44 } c = 55 d = { x = 66 y = 77 z = 88 } } +// lldbg-check:[...] { a = 11 b = { x = 22 y = 33 z = 44 } c = 55 d = { x = 66 y = 77 z = 88 } } // lldbr-check:(packed_struct_with_destructor::PackedInPackedWithDrop) packedInPackedWithDrop = { a = 11 b = { x = 22 y = 33 z = 44 } c = 55 d = { x = 66 y = 77 z = 88 } } // lldb-command:print packedInUnpackedWithDrop -// lldbg-check:[...]$5 = { a = -11 b = { x = -22 y = -33 z = -44 } c = -55 d = { x = -66 y = -77 z = -88 } } +// lldbg-check:[...] { a = -11 b = { x = -22 y = -33 z = -44 } c = -55 d = { x = -66 y = -77 z = -88 } } // lldbr-check:(packed_struct_with_destructor::PackedInUnpackedWithDrop) packedInUnpackedWithDrop = { a = -11 b = { x = -22 y = -33 z = -44 } c = -55 d = { x = -66 y = -77 z = -88 } } // lldb-command:print unpackedInPackedWithDrop -// lldbg-check:[...]$6 = { a = 98 b = { x = 87 y = 76 z = 65 } c = { x = 54 y = 43 z = 32 } d = 21 } +// lldbg-check:[...] { a = 98 b = { x = 87 y = 76 z = 65 } c = { x = 54 y = 43 z = 32 } d = 21 } // lldbr-check:(packed_struct_with_destructor::UnpackedInPackedWithDrop) unpackedInPackedWithDrop = { a = 98 b = { x = 87 y = 76 z = 65 } c = { x = 54 y = 43 z = 32 } d = 21 } // lldb-command:print deeplyNested -// lldbg-check:[...]$7 = { a = { a = 1 b = { x = 2 y = 3 z = 4 } c = 5 d = { x = 6 y = 7 z = 8 } } b = { a = 9 b = { x = 10 y = 11 z = 12 } c = { x = 13 y = 14 z = 15 } d = 16 } c = { a = 17 b = { x = 18 y = 19 z = 20 } c = 21 d = { x = 22 y = 23 z = 24 } } d = { a = 25 b = { x = 26 y = 27 z = 28 } c = 29 d = { x = 30 y = 31 z = 32 } } e = { a = 33 b = { x = 34 y = 35 z = 36 } c = { x = 37 y = 38 z = 39 } d = 40 } f = { a = 41 b = { x = 42 y = 43 z = 44 } c = 45 d = { x = 46 y = 47 z = 48 } } } +// lldbg-check:[...] { a = { a = 1 b = { x = 2 y = 3 z = 4 } c = 5 d = { x = 6 y = 7 z = 8 } } b = { a = 9 b = { x = 10 y = 11 z = 12 } c = { x = 13 y = 14 z = 15 } d = 16 } c = { a = 17 b = { x = 18 y = 19 z = 20 } c = 21 d = { x = 22 y = 23 z = 24 } } d = { a = 25 b = { x = 26 y = 27 z = 28 } c = 29 d = { x = 30 y = 31 z = 32 } } e = { a = 33 b = { x = 34 y = 35 z = 36 } c = { x = 37 y = 38 z = 39 } d = 40 } f = { a = 41 b = { x = 42 y = 43 z = 44 } c = 45 d = { x = 46 y = 47 z = 48 } } } // lldbr-check:(packed_struct_with_destructor::DeeplyNested) deeplyNested = { a = { a = 1 b = { x = 2 y = 3 z = 4 } c = 5 d = { x = 6 y = 7 z = 8 } } b = { a = 9 b = { x = 10 y = 11 z = 12 } c = { x = 13 y = 14 z = 15 } d = 16 } c = { a = 17 b = { x = 18 y = 19 z = 20 } c = 21 d = { x = 22 y = 23 z = 24 } } d = { a = 25 b = { x = 26 y = 27 z = 28 } c = 29 d = { x = 30 y = 31 z = 32 } } e = { a = 33 b = { x = 34 y = 35 z = 36 } c = { x = 37 y = 38 z = 39 } d = 40 } f = { a = 41 b = { x = 42 y = 43 z = 44 } c = 45 d = { x = 46 y = 47 z = 48 } } } diff --git a/tests/debuginfo/packed-struct.rs b/tests/debuginfo/packed-struct.rs index 0276a0ffb082..b61da0412436 100644 --- a/tests/debuginfo/packed-struct.rs +++ b/tests/debuginfo/packed-struct.rs @@ -35,27 +35,27 @@ // lldb-command:run // lldb-command:print packed -// lldbg-check:[...]$0 = { x = 123 y = 234 z = 345 } +// lldbg-check:[...] { x = 123 y = 234 z = 345 } // lldbr-check:(packed_struct::Packed) packed = { x = 123 y = 234 z = 345 } // lldb-command:print packedInPacked -// lldbg-check:[...]$1 = { a = 1111 b = { x = 2222 y = 3333 z = 4444 } c = 5555 d = { x = 6666 y = 7777 z = 8888 } } +// lldbg-check:[...] { a = 1111 b = { x = 2222 y = 3333 z = 4444 } c = 5555 d = { x = 6666 y = 7777 z = 8888 } } // lldbr-check:(packed_struct::PackedInPacked) packedInPacked = { a = 1111 b = { x = 2222 y = 3333 z = 4444 } c = 5555 d = { x = 6666 y = 7777 z = 8888 } } // lldb-command:print packedInUnpacked -// lldbg-check:[...]$2 = { a = -1111 b = { x = -2222 y = -3333 z = -4444 } c = -5555 d = { x = -6666 y = -7777 z = -8888 } } +// lldbg-check:[...] { a = -1111 b = { x = -2222 y = -3333 z = -4444 } c = -5555 d = { x = -6666 y = -7777 z = -8888 } } // lldbr-check:(packed_struct::PackedInUnpacked) packedInUnpacked = { a = -1111 b = { x = -2222 y = -3333 z = -4444 } c = -5555 d = { x = -6666 y = -7777 z = -8888 } } // lldb-command:print unpackedInPacked -// lldbg-check:[...]$3 = { a = 987 b = { x = 876 y = 765 z = 654 w = 543 } c = { x = 432 y = 321 z = 210 w = 109 } d = -98 } +// lldbg-check:[...] { a = 987 b = { x = 876 y = 765 z = 654 w = 543 } c = { x = 432 y = 321 z = 210 w = 109 } d = -98 } // lldbr-check:(packed_struct::UnpackedInPacked) unpackedInPacked = { a = 987 b = { x = 876 y = 765 z = 654 w = 543 } c = { x = 432 y = 321 z = 210 w = 109 } d = -98 } // lldb-command:print sizeof(packed) -// lldbg-check:[...]$4 = 14 +// lldbg-check:[...] 14 // lldbr-check:(usize) = 14 // lldb-command:print sizeof(packedInPacked) -// lldbg-check:[...]$5 = 40 +// lldbg-check:[...] 40 // lldbr-check:(usize) = 40 #![allow(unused_variables)] diff --git a/tests/debuginfo/pretty-slices.rs b/tests/debuginfo/pretty-slices.rs index 4faa317d6a19..4507453a1070 100644 --- a/tests/debuginfo/pretty-slices.rs +++ b/tests/debuginfo/pretty-slices.rs @@ -21,16 +21,16 @@ // lldb-command: run // lldb-command: print slice -// lldb-check: (&[i32]) $0 = size=3 { [0] = 0 [1] = 1 [2] = 2 } +// lldb-check: (&[i32]) size=3 { [0] = 0 [1] = 1 [2] = 2 } // lldb-command: print mut_slice -// lldb-check: (&mut [i32]) $1 = size=4 { [0] = 2 [1] = 3 [2] = 5 [3] = 7 } +// lldb-check: (&mut [i32]) size=4 { [0] = 2 [1] = 3 [2] = 5 [3] = 7 } // lldb-command: print str_slice -// lldb-check: (&str) $2 = "string slice" { data_ptr = [...] length = 12 } +// lldb-check: (&str) "string slice" { data_ptr = [...] length = 12 } // lldb-command: print mut_str_slice -// lldb-check: (&mut str) $3 = "mutable string slice" { data_ptr = [...] length = 20 } +// lldb-check: (&mut str) "mutable string slice" { data_ptr = [...] length = 20 } fn b() {} diff --git a/tests/debuginfo/pretty-std-collections.rs b/tests/debuginfo/pretty-std-collections.rs index 6e7c8dfbbe82..903a9f9a2727 100644 --- a/tests/debuginfo/pretty-std-collections.rs +++ b/tests/debuginfo/pretty-std-collections.rs @@ -59,19 +59,19 @@ // lldb-command:run // lldb-command:print vec_deque -// lldbg-check:[...]$0 = size=3 { [0] = 5 [1] = 3 [2] = 7 } +// lldbg-check:[...] size=3 { [0] = 5 [1] = 3 [2] = 7 } // lldbr-check:(alloc::collections::vec_deque::VecDeque) vec_deque = size=3 = { [0] = 5 [1] = 3 [2] = 7 } // lldb-command:print vec_deque2 -// lldbg-check:[...]$1 = size=7 { [0] = 2 [1] = 3 [2] = 4 [3] = 5 [4] = 6 [5] = 7 [6] = 8 } +// lldbg-check:[...] size=7 { [0] = 2 [1] = 3 [2] = 4 [3] = 5 [4] = 6 [5] = 7 [6] = 8 } // lldbr-check:(alloc::collections::vec_deque::VecDeque) vec_deque2 = size=7 = { [0] = 2 [1] = 3 [2] = 4 [3] = 5 [4] = 6 [5] = 7 [6] = 8 } // lldb-command:print hash_map -// lldbg-check:[...]$2 = size=4 { [0] = { 0 = 1 1 = 10 } [1] = { 0 = 2 1 = 20 } [2] = { 0 = 3 1 = 30 } [3] = { 0 = 4 1 = 40 } } +// lldbg-check:[...] size=4 { [0] = { 0 = 1 1 = 10 } [1] = { 0 = 2 1 = 20 } [2] = { 0 = 3 1 = 30 } [3] = { 0 = 4 1 = 40 } } // lldbr-check:(std::collections::hash::map::HashMap) hash_map = size=4 size=4 { [0] = { 0 = 1 1 = 10 } [1] = { 0 = 2 1 = 20 } [2] = { 0 = 3 1 = 30 } [3] = { 0 = 4 1 = 40 } } // lldb-command:print hash_set -// lldbg-check:[...]$3 = size=4 { [0] = 1 [1] = 2 [2] = 3 [3] = 4 } +// lldbg-check:[...] size=4 { [0] = 1 [1] = 2 [2] = 3 [3] = 4 } // lldbr-check:(std::collections::hash::set::HashSet) hash_set = size=4 { [0] = 1 [1] = 2 [2] = 3 [3] = 4 } #![allow(unused_variables)] diff --git a/tests/debuginfo/pretty-std.rs b/tests/debuginfo/pretty-std.rs index 2c2795379c93..74eba9af7861 100644 --- a/tests/debuginfo/pretty-std.rs +++ b/tests/debuginfo/pretty-std.rs @@ -45,25 +45,25 @@ // lldb-command: run // lldb-command: print slice -// lldb-check:[...]$0 = &[0, 1, 2, 3] +// lldb-check:[...] &[0, 1, 2, 3] // lldb-command: print vec -// lldb-check:[...]$1 = vec![4, 5, 6, 7] +// lldb-check:[...] vec![4, 5, 6, 7] // lldb-command: print str_slice -// lldb-check:[...]$2 = "IAMA string slice!" +// lldb-check:[...] "IAMA string slice!" // lldb-command: print string -// lldb-check:[...]$3 = "IAMA string!" +// lldb-check:[...] "IAMA string!" // lldb-command: print some -// lldb-check:[...]$4 = Some(8) +// lldb-check:[...] Some(8) // lldb-command: print none -// lldb-check:[...]$5 = None +// lldb-check:[...] None // lldb-command: print os_string -// lldb-check:[...]$6 = "IAMA OS string 😃"[...] +// lldb-check:[...] "IAMA OS string 😃"[...] // === CDB TESTS ================================================================================== diff --git a/tests/debuginfo/rc_arc.rs b/tests/debuginfo/rc_arc.rs index 3cf6635a173b..e340fe85e1d8 100644 --- a/tests/debuginfo/rc_arc.rs +++ b/tests/debuginfo/rc_arc.rs @@ -18,9 +18,9 @@ // lldb-command:run // lldb-command:print rc -// lldb-check:[...]$0 = strong=11, weak=1 { value = 111 } +// lldb-check:[...] strong=11, weak=1 { value = 111 } // lldb-command:print arc -// lldb-check:[...]$1 = strong=21, weak=1 { data = 222 } +// lldb-check:[...] strong=21, weak=1 { data = 222 } // === CDB TESTS ================================================================================== diff --git a/tests/debuginfo/reference-debuginfo.rs b/tests/debuginfo/reference-debuginfo.rs index 1051cc7113c4..b1a6aef50cb9 100644 --- a/tests/debuginfo/reference-debuginfo.rs +++ b/tests/debuginfo/reference-debuginfo.rs @@ -60,11 +60,11 @@ // lldb-command:run // lldb-command:print *bool_ref -// lldbg-check:[...]$0 = true +// lldbg-check:[...] true // lldbr-check:(bool) *bool_ref = true // lldb-command:print *int_ref -// lldbg-check:[...]$1 = -1 +// lldbg-check:[...] -1 // lldbr-check:(isize) *int_ref = -1 // NOTE: only rust-enabled lldb supports 32bit chars @@ -72,51 +72,51 @@ // lldbr-check:(char) *char_ref = 'a' // lldb-command:print *i8_ref -// lldbg-check:[...]$2 = 'D' +// lldbg-check:[...] 'D' // lldbr-check:(i8) *i8_ref = 68 // lldb-command:print *i16_ref -// lldbg-check:[...]$3 = -16 +// lldbg-check:[...] -16 // lldbr-check:(i16) *i16_ref = -16 // lldb-command:print *i32_ref -// lldbg-check:[...]$4 = -32 +// lldbg-check:[...] -32 // lldbr-check:(i32) *i32_ref = -32 // lldb-command:print *i64_ref -// lldbg-check:[...]$5 = -64 +// lldbg-check:[...] -64 // lldbr-check:(i64) *i64_ref = -64 // lldb-command:print *uint_ref -// lldbg-check:[...]$6 = 1 +// lldbg-check:[...] 1 // lldbr-check:(usize) *uint_ref = 1 // lldb-command:print *u8_ref -// lldbg-check:[...]$7 = 'd' +// lldbg-check:[...] 'd' // lldbr-check:(u8) *u8_ref = 100 // lldb-command:print *u16_ref -// lldbg-check:[...]$8 = 16 +// lldbg-check:[...] 16 // lldbr-check:(u16) *u16_ref = 16 // lldb-command:print *u32_ref -// lldbg-check:[...]$9 = 32 +// lldbg-check:[...] 32 // lldbr-check:(u32) *u32_ref = 32 // lldb-command:print *u64_ref -// lldbg-check:[...]$10 = 64 +// lldbg-check:[...] 64 // lldbr-check:(u64) *u64_ref = 64 // lldb-command:print *f32_ref -// lldbg-check:[...]$11 = 2.5 +// lldbg-check:[...] 2.5 // lldbr-check:(f32) *f32_ref = 2.5 // lldb-command:print *f64_ref -// lldbg-check:[...]$12 = 3.5 +// lldbg-check:[...] 3.5 // lldbr-check:(f64) *f64_ref = 3.5 // lldb-command:print *f64_double_ref -// lldbg-check:[...]$13 = 3.5 +// lldbg-check:[...] 3.5 // lldbr-check:(f64) **f64_double_ref = 3.5 #![allow(unused_variables)] diff --git a/tests/debuginfo/regression-bad-location-list-67992.rs b/tests/debuginfo/regression-bad-location-list-67992.rs index c397b403026d..df1e9fb26fce 100644 --- a/tests/debuginfo/regression-bad-location-list-67992.rs +++ b/tests/debuginfo/regression-bad-location-list-67992.rs @@ -11,7 +11,7 @@ // lldb-command:run // lldb-command:print a -// lldbg-check:(regression_bad_location_list_67992::Foo) $0 = [...] +// lldbg-check:(regression_bad_location_list_67992::Foo) [...] // lldbr-check:(regression_bad_location_list_67992::Foo) a = [...] const ARRAY_SIZE: usize = 1024; diff --git a/tests/debuginfo/self-in-default-method.rs b/tests/debuginfo/self-in-default-method.rs index eae1d58c1244..9a4ecee4bf6d 100644 --- a/tests/debuginfo/self-in-default-method.rs +++ b/tests/debuginfo/self-in-default-method.rs @@ -63,61 +63,61 @@ // STACK BY REF // lldb-command:print *self -// lldbg-check:[...]$0 = { x = 100 } +// lldbg-check:[...] { x = 100 } // lldbr-check:(self_in_default_method::Struct) *self = Struct { x: 100 } // lldb-command:print arg1 -// lldbg-check:[...]$1 = -1 +// lldbg-check:[...] -1 // lldbr-check:(isize) arg1 = -1 // lldb-command:print arg2 -// lldbg-check:[...]$2 = -2 +// lldbg-check:[...] -2 // lldbr-check:(isize) arg2 = -2 // lldb-command:continue // STACK BY VAL // lldb-command:print self -// lldbg-check:[...]$3 = { x = 100 } +// lldbg-check:[...] { x = 100 } // lldbr-check:(self_in_default_method::Struct) self = Struct { x: 100 } // lldb-command:print arg1 -// lldbg-check:[...]$4 = -3 +// lldbg-check:[...] -3 // lldbr-check:(isize) arg1 = -3 // lldb-command:print arg2 -// lldbg-check:[...]$5 = -4 +// lldbg-check:[...] -4 // lldbr-check:(isize) arg2 = -4 // lldb-command:continue // OWNED BY REF // lldb-command:print *self -// lldbg-check:[...]$6 = { x = 200 } +// lldbg-check:[...] { x = 200 } // lldbr-check:(self_in_default_method::Struct) *self = Struct { x: 200 } // lldb-command:print arg1 -// lldbg-check:[...]$7 = -5 +// lldbg-check:[...] -5 // lldbr-check:(isize) arg1 = -5 // lldb-command:print arg2 -// lldbg-check:[...]$8 = -6 +// lldbg-check:[...] -6 // lldbr-check:(isize) arg2 = -6 // lldb-command:continue // OWNED BY VAL // lldb-command:print self -// lldbg-check:[...]$9 = { x = 200 } +// lldbg-check:[...] { x = 200 } // lldbr-check:(self_in_default_method::Struct) self = Struct { x: 200 } // lldb-command:print arg1 -// lldbg-check:[...]$10 = -7 +// lldbg-check:[...] -7 // lldbr-check:(isize) arg1 = -7 // lldb-command:print arg2 -// lldbg-check:[...]$11 = -8 +// lldbg-check:[...] -8 // lldbr-check:(isize) arg2 = -8 // lldb-command:continue // OWNED MOVED // lldb-command:print *self -// lldbg-check:[...]$12 = { x = 200 } +// lldbg-check:[...] { x = 200 } // lldbr-check:(self_in_default_method::Struct) *self = Struct { x: 200 } // lldb-command:print arg1 -// lldbg-check:[...]$13 = -9 +// lldbg-check:[...] -9 // lldbr-check:(isize) arg1 = -9 // lldb-command:print arg2 -// lldbg-check:[...]$14 = -10 +// lldbg-check:[...] -10 // lldbr-check:(isize) arg2 = -10 // lldb-command:continue diff --git a/tests/debuginfo/self-in-generic-default-method.rs b/tests/debuginfo/self-in-generic-default-method.rs index 92be253e18ab..a21280620b5f 100644 --- a/tests/debuginfo/self-in-generic-default-method.rs +++ b/tests/debuginfo/self-in-generic-default-method.rs @@ -63,61 +63,61 @@ // STACK BY REF // lldb-command:print *self -// lldbg-check:[...]$0 = { x = 987 } +// lldbg-check:[...] { x = 987 } // lldbr-check:(self_in_generic_default_method::Struct) *self = Struct { x: 987 } // lldb-command:print arg1 -// lldbg-check:[...]$1 = -1 +// lldbg-check:[...] -1 // lldbr-check:(isize) arg1 = -1 // lldb-command:print arg2 -// lldbg-check:[...]$2 = 2 +// lldbg-check:[...] 2 // lldbr-check:(u16) arg2 = 2 // lldb-command:continue // STACK BY VAL // lldb-command:print self -// lldbg-check:[...]$3 = { x = 987 } +// lldbg-check:[...] { x = 987 } // lldbr-check:(self_in_generic_default_method::Struct) self = Struct { x: 987 } // lldb-command:print arg1 -// lldbg-check:[...]$4 = -3 +// lldbg-check:[...] -3 // lldbr-check:(isize) arg1 = -3 // lldb-command:print arg2 -// lldbg-check:[...]$5 = -4 +// lldbg-check:[...] -4 // lldbr-check:(i16) arg2 = -4 // lldb-command:continue // OWNED BY REF // lldb-command:print *self -// lldbg-check:[...]$6 = { x = 879 } +// lldbg-check:[...] { x = 879 } // lldbr-check:(self_in_generic_default_method::Struct) *self = Struct { x: 879 } // lldb-command:print arg1 -// lldbg-check:[...]$7 = -5 +// lldbg-check:[...] -5 // lldbr-check:(isize) arg1 = -5 // lldb-command:print arg2 -// lldbg-check:[...]$8 = -6 +// lldbg-check:[...] -6 // lldbr-check:(i32) arg2 = -6 // lldb-command:continue // OWNED BY VAL // lldb-command:print self -// lldbg-check:[...]$9 = { x = 879 } +// lldbg-check:[...] { x = 879 } // lldbr-check:(self_in_generic_default_method::Struct) self = Struct { x: 879 } // lldb-command:print arg1 -// lldbg-check:[...]$10 = -7 +// lldbg-check:[...] -7 // lldbr-check:(isize) arg1 = -7 // lldb-command:print arg2 -// lldbg-check:[...]$11 = -8 +// lldbg-check:[...] -8 // lldbr-check:(i64) arg2 = -8 // lldb-command:continue // OWNED MOVED // lldb-command:print *self -// lldbg-check:[...]$12 = { x = 879 } +// lldbg-check:[...] { x = 879 } // lldbr-check:(self_in_generic_default_method::Struct) *self = Struct { x: 879 } // lldb-command:print arg1 -// lldbg-check:[...]$13 = -9 +// lldbg-check:[...] -9 // lldbr-check:(isize) arg1 = -9 // lldb-command:print arg2 -// lldbg-check:[...]$14 = -10.5 +// lldbg-check:[...] -10.5 // lldbr-check:(f32) arg2 = -10.5 // lldb-command:continue diff --git a/tests/debuginfo/shadowed-argument.rs b/tests/debuginfo/shadowed-argument.rs index 33f73340a832..2be8cbbdfebe 100644 --- a/tests/debuginfo/shadowed-argument.rs +++ b/tests/debuginfo/shadowed-argument.rs @@ -30,26 +30,26 @@ // lldb-command:run // lldb-command:print x -// lldbg-check:[...]$0 = false +// lldbg-check:[...] false // lldbr-check:(bool) x = false // lldb-command:print y -// lldbg-check:[...]$1 = true +// lldbg-check:[...] true // lldbr-check:(bool) y = true // lldb-command:continue // lldb-command:print x -// lldbg-check:[...]$2 = 10 +// lldbg-check:[...] 10 // lldbr-check:(i32) x = 10 // lldb-command:print y -// lldbg-check:[...]$3 = true +// lldbg-check:[...] true // lldbr-check:(bool) y = true // lldb-command:continue // lldb-command:print x -// lldbg-check:[...]$4 = 10.5 +// lldbg-check:[...] 10.5 // lldbr-check:(f64) x = 10.5 // lldb-command:print y -// lldbg-check:[...]$5 = 20 +// lldbg-check:[...] 20 // lldbr-check:(i32) y = 20 // lldb-command:continue diff --git a/tests/debuginfo/shadowed-variable.rs b/tests/debuginfo/shadowed-variable.rs index 60c392b15cb0..66cadf2913bb 100644 --- a/tests/debuginfo/shadowed-variable.rs +++ b/tests/debuginfo/shadowed-variable.rs @@ -40,42 +40,42 @@ // lldb-command:run // lldb-command:print x -// lldbg-check:[...]$0 = false +// lldbg-check:[...] false // lldbr-check:(bool) x = false // lldb-command:print y -// lldbg-check:[...]$1 = true +// lldbg-check:[...] true // lldbr-check:(bool) y = true // lldb-command:continue // lldb-command:print x -// lldbg-check:[...]$2 = 10 +// lldbg-check:[...] 10 // lldbr-check:(i32) x = 10 // lldb-command:print y -// lldbg-check:[...]$3 = true +// lldbg-check:[...] true // lldbr-check:(bool) y = true // lldb-command:continue // lldb-command:print x -// lldbg-check:[...]$4 = 10.5 +// lldbg-check:[...] 10.5 // lldbr-check:(f64) x = 10.5 // lldb-command:print y -// lldbg-check:[...]$5 = 20 +// lldbg-check:[...] 20 // lldbr-check:(i32) y = 20 // lldb-command:continue // lldb-command:print x -// lldbg-check:[...]$6 = 10.5 +// lldbg-check:[...] 10.5 // lldbr-check:(f64) x = 10.5 // lldb-command:print y -// lldbg-check:[...]$7 = 20 +// lldbg-check:[...] 20 // lldbr-check:(i32) y = 20 // lldb-command:continue // lldb-command:print x -// lldbg-check:[...]$8 = 11.5 +// lldbg-check:[...] 11.5 // lldbr-check:(f64) x = 11.5 // lldb-command:print y -// lldbg-check:[...]$9 = 20 +// lldbg-check:[...] 20 // lldbr-check:(i32) y = 20 // lldb-command:continue diff --git a/tests/debuginfo/should-fail.rs b/tests/debuginfo/should-fail.rs index f3a8f52e0fa5..4211baeee22d 100644 --- a/tests/debuginfo/should-fail.rs +++ b/tests/debuginfo/should-fail.rs @@ -17,7 +17,7 @@ // lldb-command:run // lldb-command:print x -// lldb-check:[...]$0 = 5 +// lldb-check:[...] 5 // === CDB TESTS ================================================================================== diff --git a/tests/debuginfo/simple-lexical-scope.rs b/tests/debuginfo/simple-lexical-scope.rs index f4be2035d3cb..dfcd701017ec 100644 --- a/tests/debuginfo/simple-lexical-scope.rs +++ b/tests/debuginfo/simple-lexical-scope.rs @@ -40,37 +40,37 @@ // lldb-command:run // lldb-command:print x -// lldbg-check:[...]$0 = false +// lldbg-check:[...] false // lldbr-check:(bool) x = false // lldb-command:continue // lldb-command:print x -// lldbg-check:[...]$1 = false +// lldbg-check:[...] false // lldbr-check:(bool) x = false // lldb-command:continue // lldb-command:print x -// lldbg-check:[...]$2 = 10 +// lldbg-check:[...] 10 // lldbr-check:(i32) x = 10 // lldb-command:continue // lldb-command:print x -// lldbg-check:[...]$3 = 10 +// lldbg-check:[...] 10 // lldbr-check:(i32) x = 10 // lldb-command:continue // lldb-command:print x -// lldbg-check:[...]$4 = 10.5 +// lldbg-check:[...] 10.5 // lldbr-check:(f64) x = 10.5 // lldb-command:continue // lldb-command:print x -// lldbg-check:[...]$5 = 10 +// lldbg-check:[...] 10 // lldbr-check:(i32) x = 10 // lldb-command:continue // lldb-command:print x -// lldbg-check:[...]$6 = false +// lldbg-check:[...] false // lldbr-check:(bool) x = false // lldb-command:continue diff --git a/tests/debuginfo/simple-struct.rs b/tests/debuginfo/simple-struct.rs index 100763f60b6f..89c0cb491bfd 100644 --- a/tests/debuginfo/simple-struct.rs +++ b/tests/debuginfo/simple-struct.rs @@ -98,27 +98,27 @@ // lldb-command:run // lldb-command:print no_padding16 -// lldbg-check:[...]$0 = { x = 10000 y = -10001 } +// lldbg-check:[...] { x = 10000 y = -10001 } // lldbr-check:(simple_struct::NoPadding16) no_padding16 = { x = 10000 y = -10001 } // lldb-command:print no_padding32 -// lldbg-check:[...]$1 = { x = -10002 y = -10003.5 z = 10004 } +// lldbg-check:[...] { x = -10002 y = -10003.5 z = 10004 } // lldbr-check:(simple_struct::NoPadding32) no_padding32 = { x = -10002 y = -10003.5 z = 10004 } // lldb-command:print no_padding64 -// lldbg-check:[...]$2 = { x = -10005.5 y = 10006 z = 10007 } +// lldbg-check:[...] { x = -10005.5 y = 10006 z = 10007 } // lldbr-check:(simple_struct::NoPadding64) no_padding64 = { x = -10005.5 y = 10006 z = 10007 } // lldb-command:print no_padding163264 -// lldbg-check:[...]$3 = { a = -10008 b = 10009 c = 10010 d = 10011 } +// lldbg-check:[...] { a = -10008 b = 10009 c = 10010 d = 10011 } // lldbr-check:(simple_struct::NoPadding163264) no_padding163264 = { a = -10008 b = 10009 c = 10010 d = 10011 } // lldb-command:print internal_padding -// lldbg-check:[...]$4 = { x = 10012 y = -10013 } +// lldbg-check:[...] { x = 10012 y = -10013 } // lldbr-check:(simple_struct::InternalPadding) internal_padding = { x = 10012 y = -10013 } // lldb-command:print padding_at_end -// lldbg-check:[...]$5 = { x = -10014 y = 10015 } +// lldbg-check:[...] { x = -10014 y = 10015 } // lldbr-check:(simple_struct::PaddingAtEnd) padding_at_end = { x = -10014 y = 10015 } #![allow(unused_variables)] diff --git a/tests/debuginfo/simple-tuple.rs b/tests/debuginfo/simple-tuple.rs index 2d8905a77bf7..93f56d117ad8 100644 --- a/tests/debuginfo/simple-tuple.rs +++ b/tests/debuginfo/simple-tuple.rs @@ -100,27 +100,27 @@ // lldb-command:run // lldb-command:print/d noPadding8 -// lldbg-check:[...]$0 = { 0 = -100 1 = 100 } +// lldbg-check:[...] { 0 = -100 1 = 100 } // lldbr-check:((i8, u8)) noPadding8 = { 0 = -100 1 = 100 } // lldb-command:print noPadding16 -// lldbg-check:[...]$1 = { 0 = 0 1 = 1 2 = 2 } +// lldbg-check:[...] { 0 = 0 1 = 1 2 = 2 } // lldbr-check:((i16, i16, u16)) noPadding16 = { 0 = 0 1 = 1 2 = 2 } // lldb-command:print noPadding32 -// lldbg-check:[...]$2 = { 0 = 3 1 = 4.5 2 = 5 } +// lldbg-check:[...] { 0 = 3 1 = 4.5 2 = 5 } // lldbr-check:((i32, f32, u32)) noPadding32 = { 0 = 3 1 = 4.5 2 = 5 } // lldb-command:print noPadding64 -// lldbg-check:[...]$3 = { 0 = 6 1 = 7.5 2 = 8 } +// lldbg-check:[...] { 0 = 6 1 = 7.5 2 = 8 } // lldbr-check:((i64, f64, u64)) noPadding64 = { 0 = 6 1 = 7.5 2 = 8 } // lldb-command:print internalPadding1 -// lldbg-check:[...]$4 = { 0 = 9 1 = 10 } +// lldbg-check:[...] { 0 = 9 1 = 10 } // lldbr-check:((i16, i32)) internalPadding1 = { 0 = 9 1 = 10 } // lldb-command:print internalPadding2 -// lldbg-check:[...]$5 = { 0 = 11 1 = 12 2 = 13 3 = 14 } +// lldbg-check:[...] { 0 = 11 1 = 12 2 = 13 3 = 14 } // lldbr-check:((i16, i32, u32, u64)) internalPadding2 = { 0 = 11 1 = 12 2 = 13 3 = 14 } // lldb-command:print paddingAtEnd -// lldbg-check:[...]$6 = { 0 = 15 1 = 16 } +// lldbg-check:[...] { 0 = 15 1 = 16 } // lldbr-check:((i32, i16)) paddingAtEnd = { 0 = 15 1 = 16 } diff --git a/tests/debuginfo/static-method-on-struct-and-enum.rs b/tests/debuginfo/static-method-on-struct-and-enum.rs index ad078122ddeb..23384e0c33a7 100644 --- a/tests/debuginfo/static-method-on-struct-and-enum.rs +++ b/tests/debuginfo/static-method-on-struct-and-enum.rs @@ -29,22 +29,22 @@ // STRUCT // lldb-command:print arg1 -// lldbg-check:[...]$0 = 1 +// lldbg-check:[...] 1 // lldbr-check:(isize) arg1 = 1 // lldb-command:print arg2 -// lldbg-check:[...]$1 = 2 +// lldbg-check:[...] 2 // lldbr-check:(isize) arg2 = 2 // lldb-command:continue // ENUM // lldb-command:print arg1 -// lldbg-check:[...]$2 = -3 +// lldbg-check:[...] -3 // lldbr-check:(isize) arg1 = -3 // lldb-command:print arg2 -// lldbg-check:[...]$3 = 4.5 +// lldbg-check:[...] 4.5 // lldbr-check:(f64) arg2 = 4.5 // lldb-command:print arg3 -// lldbg-check:[...]$4 = 5 +// lldbg-check:[...] 5 // lldbr-check:(usize) arg3 = 5 // lldb-command:continue diff --git a/tests/debuginfo/struct-in-enum.rs b/tests/debuginfo/struct-in-enum.rs index c340f71a6cc4..a91f24a3f5c8 100644 --- a/tests/debuginfo/struct-in-enum.rs +++ b/tests/debuginfo/struct-in-enum.rs @@ -27,12 +27,12 @@ // lldb-command:run // lldb-command:print case1 -// lldb-check:[...]$0 = Case1(0, Struct { x: 2088533116, y: 2088533116, z: 31868 }) +// lldb-check:[...] Case1(0, Struct { x: 2088533116, y: 2088533116, z: 31868 }) // lldb-command:print case2 -// lldb-check:[...]$1 = Case2(0, 1229782938247303441, 4369) +// lldb-check:[...] Case2(0, 1229782938247303441, 4369) // lldb-command:print univariant -// lldb-check:[...]$2 = TheOnlyCase(Struct { x: 123, y: 456, z: 789 }) +// lldb-check:[...] TheOnlyCase(Struct { x: 123, y: 456, z: 789 }) #![allow(unused_variables)] #![feature(omit_gdb_pretty_printer_section)] diff --git a/tests/debuginfo/struct-in-struct.rs b/tests/debuginfo/struct-in-struct.rs index 287564a36cd3..e88d955b6e97 100644 --- a/tests/debuginfo/struct-in-struct.rs +++ b/tests/debuginfo/struct-in-struct.rs @@ -24,35 +24,35 @@ // lldb-command:run // lldb-command:print three_simple_structs -// lldbg-check:[...]$0 = { x = { x = 1 } y = { x = 2 } z = { x = 3 } } +// lldbg-check:[...] { x = { x = 1 } y = { x = 2 } z = { x = 3 } } // lldbr-check:(struct_in_struct::ThreeSimpleStructs) three_simple_structs = { x = { x = 1 } y = { x = 2 } z = { x = 3 } } // lldb-command:print internal_padding_parent -// lldbg-check:[...]$1 = { x = { x = 4 y = 5 } y = { x = 6 y = 7 } z = { x = 8 y = 9 } } +// lldbg-check:[...] { x = { x = 4 y = 5 } y = { x = 6 y = 7 } z = { x = 8 y = 9 } } // lldbr-check:(struct_in_struct::InternalPaddingParent) internal_padding_parent = { x = { x = 4 y = 5 } y = { x = 6 y = 7 } z = { x = 8 y = 9 } } // lldb-command:print padding_at_end_parent -// lldbg-check:[...]$2 = { x = { x = 10 y = 11 } y = { x = 12 y = 13 } z = { x = 14 y = 15 } } +// lldbg-check:[...] { x = { x = 10 y = 11 } y = { x = 12 y = 13 } z = { x = 14 y = 15 } } // lldbr-check:(struct_in_struct::PaddingAtEndParent) padding_at_end_parent = { x = { x = 10 y = 11 } y = { x = 12 y = 13 } z = { x = 14 y = 15 } } // lldb-command:print mixed -// lldbg-check:[...]$3 = { x = { x = 16 y = 17 } y = { x = 18 y = 19 } z = { x = 20 } w = 21 } +// lldbg-check:[...] { x = { x = 16 y = 17 } y = { x = 18 y = 19 } z = { x = 20 } w = 21 } // lldbr-check:(struct_in_struct::Mixed) mixed = { x = { x = 16 y = 17 } y = { x = 18 y = 19 } z = { x = 20 } w = 21 } // lldb-command:print bag -// lldbg-check:[...]$4 = { x = { x = 22 } } +// lldbg-check:[...] { x = { x = 22 } } // lldbr-check:(struct_in_struct::Bag) bag = { x = { x = 22 } } // lldb-command:print bag_in_bag -// lldbg-check:[...]$5 = { x = { x = { x = 23 } } } +// lldbg-check:[...] { x = { x = { x = 23 } } } // lldbr-check:(struct_in_struct::BagInBag) bag_in_bag = { x = { x = { x = 23 } } } // lldb-command:print tjo -// lldbg-check:[...]$6 = { x = { x = { x = { x = 24 } } } } +// lldbg-check:[...] { x = { x = { x = { x = 24 } } } } // lldbr-check:(struct_in_struct::ThatsJustOverkill) tjo = { x = { x = { x = { x = 24 } } } } // lldb-command:print tree -// lldbg-check:[...]$7 = { x = { x = 25 } y = { x = { x = 26 y = 27 } y = { x = 28 y = 29 } z = { x = 30 y = 31 } } z = { x = { x = { x = 32 } } } } +// lldbg-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 } } } } // lldbr-check:(struct_in_struct::Tree) tree = { 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)] diff --git a/tests/debuginfo/struct-namespace.rs b/tests/debuginfo/struct-namespace.rs index f9262a458d52..d641a788a6fa 100644 --- a/tests/debuginfo/struct-namespace.rs +++ b/tests/debuginfo/struct-namespace.rs @@ -6,17 +6,17 @@ // lldb-command:run // lldb-command:p struct1 -// lldbg-check:(struct_namespace::Struct1) $0 = [...] +// lldbg-check:(struct_namespace::Struct1)[...] // lldbr-check:(struct_namespace::Struct1) struct1 = Struct1 { a: 0, b: 1 } // lldb-command:p struct2 -// lldbg-check:(struct_namespace::Struct2) $1 = [...] +// lldbg-check:(struct_namespace::Struct2)[...] // lldbr-check:(struct_namespace::Struct2) struct2 = { = 2 } // lldb-command:p mod1_struct1 -// lldbg-check:(struct_namespace::mod1::Struct1) $2 = [...] +// lldbg-check:(struct_namespace::mod1::Struct1)[...] // lldbr-check:(struct_namespace::mod1::Struct1) mod1_struct1 = Struct1 { a: 3, b: 4 } // lldb-command:p mod1_struct2 -// lldbg-check:(struct_namespace::mod1::Struct2) $3 = [...] +// lldbg-check:(struct_namespace::mod1::Struct2)[...] // lldbr-check:(struct_namespace::mod1::Struct2) mod1_struct2 = { = 5 } #![allow(unused_variables)] diff --git a/tests/debuginfo/struct-with-destructor.rs b/tests/debuginfo/struct-with-destructor.rs index 9b81136e7a88..d6686be662cd 100644 --- a/tests/debuginfo/struct-with-destructor.rs +++ b/tests/debuginfo/struct-with-destructor.rs @@ -26,19 +26,19 @@ // lldb-command:run // lldb-command:print simple -// lldbg-check:[...]$0 = { x = 10 y = 20 } +// lldbg-check:[...] { x = 10 y = 20 } // lldbr-check:(struct_with_destructor::WithDestructor) simple = { x = 10 y = 20 } // lldb-command:print noDestructor -// lldbg-check:[...]$1 = { a = { x = 10 y = 20 } guard = -1 } +// lldbg-check:[...] { a = { x = 10 y = 20 } guard = -1 } // lldbr-check:(struct_with_destructor::NoDestructorGuarded) noDestructor = { a = { x = 10 y = 20 } guard = -1 } // lldb-command:print withDestructor -// lldbg-check:[...]$2 = { a = { x = 10 y = 20 } guard = -1 } +// lldbg-check:[...] { a = { x = 10 y = 20 } guard = -1 } // lldbr-check:(struct_with_destructor::WithDestructorGuarded) withDestructor = { a = { x = 10 y = 20 } guard = -1 } // lldb-command:print nested -// lldbg-check:[...]$3 = { a = { a = { x = 7890 y = 9870 } } } +// lldbg-check:[...] { a = { a = { x = 7890 y = 9870 } } } // lldbr-check:(struct_with_destructor::NestedOuter) nested = { a = { a = { x = 7890 y = 9870 } } } #![allow(unused_variables)] diff --git a/tests/debuginfo/tuple-in-tuple.rs b/tests/debuginfo/tuple-in-tuple.rs index c1cfe64a52e9..b6b20cea9b62 100644 --- a/tests/debuginfo/tuple-in-tuple.rs +++ b/tests/debuginfo/tuple-in-tuple.rs @@ -36,27 +36,27 @@ // lldb-command:run // lldb-command:print no_padding1 -// lldbg-check:[...]$0 = { 0 = { 0 = 0 1 = 1 } 1 = 2 2 = 3 } +// lldbg-check:[...] { 0 = { 0 = 0 1 = 1 } 1 = 2 2 = 3 } // lldbr-check:(((u32, u32), u32, u32)) no_padding1 = { 0 = { 0 = 0 1 = 1 } 1 = 2 2 = 3 } // lldb-command:print no_padding2 -// lldbg-check:[...]$1 = { 0 = 4 1 = { 0 = 5 1 = 6 } 2 = 7 } +// lldbg-check:[...] { 0 = 4 1 = { 0 = 5 1 = 6 } 2 = 7 } // lldbr-check:((u32, (u32, u32), u32)) no_padding2 = { 0 = 4 1 = { 0 = 5 1 = 6 } 2 = 7 } // lldb-command:print no_padding3 -// lldbg-check:[...]$2 = { 0 = 8 1 = 9 2 = { 0 = 10 1 = 11 } } +// lldbg-check:[...] { 0 = 8 1 = 9 2 = { 0 = 10 1 = 11 } } // lldbr-check:((u32, u32, (u32, u32))) no_padding3 = { 0 = 8 1 = 9 2 = { 0 = 10 1 = 11 } } // lldb-command:print internal_padding1 -// lldbg-check:[...]$3 = { 0 = 12 1 = { 0 = 13 1 = 14 } } +// lldbg-check:[...] { 0 = 12 1 = { 0 = 13 1 = 14 } } // lldbr-check:((i16, (i32, i32))) internal_padding1 = { 0 = 12 1 = { 0 = 13 1 = 14 } } // lldb-command:print internal_padding2 -// lldbg-check:[...]$4 = { 0 = 15 1 = { 0 = 16 1 = 17 } } +// lldbg-check:[...] { 0 = 15 1 = { 0 = 16 1 = 17 } } // lldbr-check:((i16, (i16, i32))) internal_padding2 = { 0 = 15 1 = { 0 = 16 1 = 17 } } // lldb-command:print padding_at_end1 -// lldbg-check:[...]$5 = { 0 = 18 1 = { 0 = 19 1 = 20 } } +// lldbg-check:[...] { 0 = 18 1 = { 0 = 19 1 = 20 } } // lldbr-check:((i32, (i32, i16))) padding_at_end1 = { 0 = 18 1 = { 0 = 19 1 = 20 } } // lldb-command:print padding_at_end2 -// lldbg-check:[...]$6 = { 0 = { 0 = 21 1 = 22 } 1 = 23 } +// lldbg-check:[...] { 0 = { 0 = 21 1 = 22 } 1 = 23 } // lldbr-check:(((i32, i16), i32)) padding_at_end2 = { 0 = { 0 = 21 1 = 22 } 1 = 23 } diff --git a/tests/debuginfo/tuple-struct.rs b/tests/debuginfo/tuple-struct.rs index 5eeb1a6eed4e..e912f63a8b2d 100644 --- a/tests/debuginfo/tuple-struct.rs +++ b/tests/debuginfo/tuple-struct.rs @@ -36,27 +36,27 @@ // lldb-command:run // lldb-command:print no_padding16 -// lldbg-check:[...]$0 = { 0 = 10000 1 = -10001 } +// lldbg-check:[...] { 0 = 10000 1 = -10001 } // lldbr-check:(tuple_struct::NoPadding16) no_padding16 = { 0 = 10000 1 = -10001 } // lldb-command:print no_padding32 -// lldbg-check:[...]$1 = { 0 = -10002 1 = -10003.5 2 = 10004 } +// lldbg-check:[...] { 0 = -10002 1 = -10003.5 2 = 10004 } // lldbr-check:(tuple_struct::NoPadding32) no_padding32 = { 0 = -10002 1 = -10003.5 2 = 10004 } // lldb-command:print no_padding64 -// lldbg-check:[...]$2 = { 0 = -10005.5 1 = 10006 2 = 10007 } +// lldbg-check:[...] { 0 = -10005.5 1 = 10006 2 = 10007 } // lldbr-check:(tuple_struct::NoPadding64) no_padding64 = { 0 = -10005.5 1 = 10006 2 = 10007 } // lldb-command:print no_padding163264 -// lldbg-check:[...]$3 = { 0 = -10008 1 = 10009 2 = 10010 3 = 10011 } +// lldbg-check:[...] { 0 = -10008 1 = 10009 2 = 10010 3 = 10011 } // lldbr-check:(tuple_struct::NoPadding163264) no_padding163264 = { 0 = -10008 1 = 10009 2 = 10010 3 = 10011 } // lldb-command:print internal_padding -// lldbg-check:[...]$4 = { 0 = 10012 1 = -10013 } +// lldbg-check:[...] { 0 = 10012 1 = -10013 } // lldbr-check:(tuple_struct::InternalPadding) internal_padding = { 0 = 10012 1 = -10013 } // lldb-command:print padding_at_end -// lldbg-check:[...]$5 = { 0 = -10014 1 = 10015 } +// lldbg-check:[...] { 0 = -10014 1 = 10015 } // lldbr-check:(tuple_struct::PaddingAtEnd) padding_at_end = { 0 = -10014 1 = 10015 } // This test case mainly makes sure that no field names are generated for tuple structs (as opposed diff --git a/tests/debuginfo/union-smoke.rs b/tests/debuginfo/union-smoke.rs index aa57ebdc844c..8df4c9dbf96a 100644 --- a/tests/debuginfo/union-smoke.rs +++ b/tests/debuginfo/union-smoke.rs @@ -19,13 +19,13 @@ // lldb-command:run // lldb-command:print u -// lldbg-check:[...]$0 = { a = { 0 = '\x02' 1 = '\x02' } b = 514 } +// lldbg-check:[...] { a = { 0 = '\x02' 1 = '\x02' } b = 514 } // lldbr-check:(union_smoke::U) u = { a = { 0 = '\x02' 1 = '\x02' } b = 514 } // Don't test this with rust-enabled lldb for now; see // https://github.com/rust-lang-nursery/lldb/issues/18 // lldbg-command:print union_smoke::SU -// lldbg-check:[...]$1 = { a = { 0 = '\x01' 1 = '\x01' } b = 257 } +// lldbg-check:[...] { a = { 0 = '\x01' 1 = '\x01' } b = 257 } #![allow(unused)] #![feature(omit_gdb_pretty_printer_section)] diff --git a/tests/debuginfo/var-captured-in-nested-closure.rs b/tests/debuginfo/var-captured-in-nested-closure.rs index 75ab245e13e0..62cb87e4f994 100644 --- a/tests/debuginfo/var-captured-in-nested-closure.rs +++ b/tests/debuginfo/var-captured-in-nested-closure.rs @@ -44,42 +44,42 @@ // lldb-command:run // lldb-command:print variable -// lldbg-check:[...]$0 = 1 +// lldbg-check:[...] 1 // lldbr-check:(isize) variable = 1 // lldb-command:print constant -// lldbg-check:[...]$1 = 2 +// lldbg-check:[...] 2 // lldbr-check:(isize) constant = 2 // lldb-command:print a_struct -// lldbg-check:[...]$2 = { a = -3 b = 4.5 c = 5 } +// lldbg-check:[...] { a = -3 b = 4.5 c = 5 } // lldbr-check:(var_captured_in_nested_closure::Struct) a_struct = { a = -3 b = 4.5 c = 5 } // lldb-command:print *struct_ref -// lldbg-check:[...]$3 = { a = -3 b = 4.5 c = 5 } +// lldbg-check:[...] { a = -3 b = 4.5 c = 5 } // lldbr-check:(var_captured_in_nested_closure::Struct) *struct_ref = { a = -3 b = 4.5 c = 5 } // lldb-command:print *owned -// lldbg-check:[...]$4 = 6 +// lldbg-check:[...] 6 // lldbr-check:(isize) *owned = 6 // lldb-command:print closure_local -// lldbg-check:[...]$5 = 8 +// lldbg-check:[...] 8 // lldbr-check:(isize) closure_local = 8 // lldb-command:continue // lldb-command:print variable -// lldbg-check:[...]$6 = 1 +// lldbg-check:[...] 1 // lldbr-check:(isize) variable = 1 // lldb-command:print constant -// lldbg-check:[...]$7 = 2 +// lldbg-check:[...] 2 // lldbr-check:(isize) constant = 2 // lldb-command:print a_struct -// lldbg-check:[...]$8 = { a = -3 b = 4.5 c = 5 } +// lldbg-check:[...] { a = -3 b = 4.5 c = 5 } // lldbr-check:(var_captured_in_nested_closure::Struct) a_struct = { a = -3 b = 4.5 c = 5 } // lldb-command:print *struct_ref -// lldbg-check:[...]$9 = { a = -3 b = 4.5 c = 5 } +// lldbg-check:[...] { a = -3 b = 4.5 c = 5 } // lldbr-check:(var_captured_in_nested_closure::Struct) *struct_ref = { a = -3 b = 4.5 c = 5 } // lldb-command:print *owned -// lldbg-check:[...]$10 = 6 +// lldbg-check:[...] 6 // lldbr-check:(isize) *owned = 6 // lldb-command:print closure_local -// lldbg-check:[...]$11 = 8 +// lldbg-check:[...] 8 // lldbr-check:(isize) closure_local = 8 // lldb-command:continue diff --git a/tests/debuginfo/var-captured-in-sendable-closure.rs b/tests/debuginfo/var-captured-in-sendable-closure.rs index b7992deef44c..e2e154e91cb4 100644 --- a/tests/debuginfo/var-captured-in-sendable-closure.rs +++ b/tests/debuginfo/var-captured-in-sendable-closure.rs @@ -24,13 +24,13 @@ // lldb-command:run // lldb-command:print constant -// lldbg-check:[...]$0 = 1 +// lldbg-check:[...] 1 // lldbr-check:(isize) constant = 1 // lldb-command:print a_struct -// lldbg-check:[...]$1 = { a = -2 b = 3.5 c = 4 } +// lldbg-check:[...] { a = -2 b = 3.5 c = 4 } // lldbr-check:(var_captured_in_sendable_closure::Struct) a_struct = { a = -2 b = 3.5 c = 4 } // lldb-command:print *owned -// lldbg-check:[...]$2 = 5 +// lldbg-check:[...] 5 // lldbr-check:(isize) *owned = 5 #![allow(unused_variables)] diff --git a/tests/debuginfo/var-captured-in-stack-closure.rs b/tests/debuginfo/var-captured-in-stack-closure.rs index eb68b081a6d8..c704b53ef853 100644 --- a/tests/debuginfo/var-captured-in-stack-closure.rs +++ b/tests/debuginfo/var-captured-in-stack-closure.rs @@ -40,37 +40,37 @@ // lldb-command:run // lldb-command:print variable -// lldbg-check:[...]$0 = 1 +// lldbg-check:[...] 1 // lldbr-check:(isize) variable = 1 // lldb-command:print constant -// lldbg-check:[...]$1 = 2 +// lldbg-check:[...] 2 // lldbr-check:(isize) constant = 2 // lldb-command:print a_struct -// lldbg-check:[...]$2 = { a = -3 b = 4.5 c = 5 } +// lldbg-check:[...] { a = -3 b = 4.5 c = 5 } // lldbr-check:(var_captured_in_stack_closure::Struct) a_struct = { a = -3 b = 4.5 c = 5 } // lldb-command:print *struct_ref -// lldbg-check:[...]$3 = { a = -3 b = 4.5 c = 5 } +// lldbg-check:[...] { a = -3 b = 4.5 c = 5 } // lldbr-check:(var_captured_in_stack_closure::Struct) *struct_ref = { a = -3 b = 4.5 c = 5 } // lldb-command:print *owned -// lldbg-check:[...]$4 = 6 +// lldbg-check:[...] 6 // lldbr-check:(isize) *owned = 6 // lldb-command:continue // lldb-command:print variable -// lldbg-check:[...]$5 = 2 +// lldbg-check:[...] 2 // lldbr-check:(isize) variable = 2 // lldb-command:print constant -// lldbg-check:[...]$6 = 2 +// lldbg-check:[...] 2 // lldbr-check:(isize) constant = 2 // lldb-command:print a_struct -// lldbg-check:[...]$7 = { a = -3 b = 4.5 c = 5 } +// lldbg-check:[...] { a = -3 b = 4.5 c = 5 } // lldbr-check:(var_captured_in_stack_closure::Struct) a_struct = { a = -3 b = 4.5 c = 5 } // lldb-command:print *struct_ref -// lldbg-check:[...]$8 = { a = -3 b = 4.5 c = 5 } +// lldbg-check:[...] { a = -3 b = 4.5 c = 5 } // lldbr-check:(var_captured_in_stack_closure::Struct) *struct_ref = { a = -3 b = 4.5 c = 5 } // lldb-command:print *owned -// lldbg-check:[...]$9 = 6 +// lldbg-check:[...] 6 // lldbr-check:(isize) *owned = 6 diff --git a/tests/debuginfo/vec-slices.rs b/tests/debuginfo/vec-slices.rs index b044110fc789..bf3cad30faf9 100644 --- a/tests/debuginfo/vec-slices.rs +++ b/tests/debuginfo/vec-slices.rs @@ -71,27 +71,27 @@ // lldb-command:run // lldb-command:print empty -// lldbg-check:[...]$0 = size=0 +// lldbg-check:[...] size=0 // lldbr-check:(&[i64]) empty = size=0 // lldb-command:print singleton -// lldbg-check:[...]$1 = size=1 { [0] = 1 } +// lldbg-check:[...] size=1 { [0] = 1 } // lldbr-check:(&[i64]) singleton = &[1] // lldb-command:print multiple -// lldbg-check:[...]$2 = size=4 { [0] = 2 [1] = 3 [2] = 4 [3] = 5 } +// lldbg-check:[...] size=4 { [0] = 2 [1] = 3 [2] = 4 [3] = 5 } // lldbr-check:(&[i64]) multiple = size=4 { [0] = 2 [1] = 3 [2] = 4 [3] = 5 } // lldb-command:print slice_of_slice -// lldbg-check:[...]$3 = size=2 { [0] = 3 [1] = 4 } +// lldbg-check:[...] size=2 { [0] = 3 [1] = 4 } // lldbr-check:(&[i64]) slice_of_slice = size=2 { [0] = 3 [1] = 4 } // lldb-command:print padded_tuple -// lldbg-check:[...]$4 = size=2 { [0] = { 0 = 6 1 = 7 } [1] = { 0 = 8 1 = 9 } } +// lldbg-check:[...] size=2 { [0] = { 0 = 6 1 = 7 } [1] = { 0 = 8 1 = 9 } } // lldbr-check:(&[(i32, i16)]) padded_tuple = size=2 { [0] = { 0 = 6 1 = 7 } [1] = { 0 = 8 1 = 9 } } // lldb-command:print padded_struct -// lldbg-check:[...]$5 = size=2 { [0] = { x = 10 y = 11 z = 12 } [1] = { x = 13 y = 14 z = 15 } } +// lldbg-check:[...] size=2 { [0] = { x = 10 y = 11 z = 12 } [1] = { x = 13 y = 14 z = 15 } } // lldbr-check:(&[vec_slices::AStruct]) padded_struct = size=2 { [0] = { x = 10 y = 11 z = 12 } [1] = { x = 13 y = 14 z = 15 } } #![allow(dead_code, unused_variables)] diff --git a/tests/debuginfo/vec.rs b/tests/debuginfo/vec.rs index 27d04094e3c6..0ac2f2acb596 100644 --- a/tests/debuginfo/vec.rs +++ b/tests/debuginfo/vec.rs @@ -18,7 +18,7 @@ // lldb-command:run // lldb-command:print a -// lldbg-check:[...]$0 = { [0] = 1 [1] = 2 [2] = 3 } +// lldbg-check:[...] { [0] = 1 [1] = 2 [2] = 3 } // lldbr-check:([i32; 3]) a = { [0] = 1 [1] = 2 [2] = 3 } #![allow(unused_variables)] From 42c5eb88456fd8bee46ec5748a8f83b1df82f0d1 Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Sun, 10 Mar 2024 15:21:35 +0100 Subject: [PATCH 056/103] Add comment about `NonZero` printing as character literal. --- src/etc/lldb_providers.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/etc/lldb_providers.py b/src/etc/lldb_providers.py index 319660f0ddc5..5d2b6fd525c1 100644 --- a/src/etc/lldb_providers.py +++ b/src/etc/lldb_providers.py @@ -746,6 +746,8 @@ def StdNonZeroNumberSummaryProvider(valobj, _dict): inner = valobj.GetChildAtIndex(0) inner_inner = inner.GetChildAtIndex(0) + # FIXME: Avoid printing as character literal, + # see https://github.com/llvm/llvm-project/issues/65076. if inner_inner.GetTypeName() in ['char', 'unsigned char']: return str(inner_inner.GetValueAsSigned()) else: From 2047e847d7234117bf96583be3dcc4fb0f42d0bf Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Sun, 10 Mar 2024 17:04:53 +0100 Subject: [PATCH 057/103] Fix `StdNonZeroNumberProvider` for `gdb`. --- src/etc/gdb_providers.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/etc/gdb_providers.py b/src/etc/gdb_providers.py index 7d7277d24087..227695cdadd5 100644 --- a/src/etc/gdb_providers.py +++ b/src/etc/gdb_providers.py @@ -245,7 +245,14 @@ class StdNonZeroNumberProvider(printer_base): fields = valobj.type.fields() assert len(fields) == 1 field = list(fields)[0] - self._value = str(valobj[field.name]) + + inner_valobj = valobj[field.name] + + inner_fields = inner_valobj.type.fields() + assert len(inner_fields) == 1 + inner_field = list(inner_fields)[0] + + self._value = str(inner_valobj[inner_field.name]) def to_string(self): return self._value From e782d27ec6456a6080a5bfe8b2f189fa9f1b1d0f Mon Sep 17 00:00:00 2001 From: Trevor Gross Date: Sat, 2 Mar 2024 21:45:23 -0500 Subject: [PATCH 058/103] Add feature gates for `f16` and `f128` Includes related tests and documentation pages. Michael Goulet: Don't issue feature error in resolver for f16/f128 unless finalize Co-authored-by: Michael Goulet --- compiler/rustc_ast_passes/src/feature_gate.rs | 13 ++++- compiler/rustc_feature/src/unstable.rs | 4 ++ compiler/rustc_resolve/src/ident.rs | 32 ++++++++++- compiler/rustc_resolve/src/late.rs | 20 +++++++ .../src/language-features/f128.md | 9 ++++ .../src/language-features/f16.md | 9 ++++ tests/ui/feature-gates/feature-gate-f128.rs | 15 ++++++ .../ui/feature-gates/feature-gate-f128.stderr | 53 +++++++++++++++++++ tests/ui/feature-gates/feature-gate-f16.rs | 15 ++++++ .../ui/feature-gates/feature-gate-f16.stderr | 53 +++++++++++++++++++ .../ui/resolve/primitive-f16-f128-shadowed.rs | 31 +++++++++++ 11 files changed, 252 insertions(+), 2 deletions(-) create mode 100644 src/doc/unstable-book/src/language-features/f128.md create mode 100644 src/doc/unstable-book/src/language-features/f16.md create mode 100644 tests/ui/feature-gates/feature-gate-f128.rs create mode 100644 tests/ui/feature-gates/feature-gate-f128.stderr create mode 100644 tests/ui/feature-gates/feature-gate-f16.rs create mode 100644 tests/ui/feature-gates/feature-gate-f16.stderr create mode 100644 tests/ui/resolve/primitive-f16-f128-shadowed.rs diff --git a/compiler/rustc_ast_passes/src/feature_gate.rs b/compiler/rustc_ast_passes/src/feature_gate.rs index 2e14238f950f..4db8ffd3e546 100644 --- a/compiler/rustc_ast_passes/src/feature_gate.rs +++ b/compiler/rustc_ast_passes/src/feature_gate.rs @@ -1,7 +1,7 @@ use rustc_ast as ast; use rustc_ast::visit::{self, AssocCtxt, FnCtxt, FnKind, Visitor}; use rustc_ast::{attr, AssocConstraint, AssocConstraintKind, NodeId}; -use rustc_ast::{PatKind, RangeEnd}; +use rustc_ast::{token, PatKind, RangeEnd}; use rustc_feature::{AttributeGate, BuiltinAttribute, Features, GateIssue, BUILTIN_ATTRIBUTE_MAP}; use rustc_session::parse::{feature_err, feature_err_issue, feature_warn}; use rustc_session::Session; @@ -378,6 +378,17 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> { ast::ExprKind::TryBlock(_) => { gate!(&self, try_blocks, e.span, "`try` expression is experimental"); } + ast::ExprKind::Lit(token::Lit { kind: token::LitKind::Float, suffix, .. }) => { + match suffix { + Some(sym::f16) => { + gate!(&self, f16, e.span, "the type `f16` is unstable") + } + Some(sym::f128) => { + gate!(&self, f128, e.span, "the type `f128` is unstable") + } + _ => (), + } + } _ => {} } visit::walk_expr(self, e) diff --git a/compiler/rustc_feature/src/unstable.rs b/compiler/rustc_feature/src/unstable.rs index 52421fce8673..c3f216936df7 100644 --- a/compiler/rustc_feature/src/unstable.rs +++ b/compiler/rustc_feature/src/unstable.rs @@ -463,6 +463,10 @@ declare_features! ( (unstable, extended_varargs_abi_support, "1.65.0", Some(100189)), /// Allows defining `extern type`s. (unstable, extern_types, "1.23.0", Some(43467)), + /// Allow using 128-bit (quad precision) floating point numbers. + (unstable, f128, "CURRENT_RUSTC_VERSION", Some(116909)), + /// Allow using 16-bit (half precision) floating point numbers. + (unstable, f16, "CURRENT_RUSTC_VERSION", Some(116909)), /// Allows the use of `#[ffi_const]` on foreign functions. (unstable, ffi_const, "1.45.0", Some(58328)), /// Allows the use of `#[ffi_pure]` on foreign functions. diff --git a/compiler/rustc_resolve/src/ident.rs b/compiler/rustc_resolve/src/ident.rs index 6518d9735ae5..b24ed573ff97 100644 --- a/compiler/rustc_resolve/src/ident.rs +++ b/compiler/rustc_resolve/src/ident.rs @@ -5,8 +5,10 @@ use rustc_middle::bug; use rustc_middle::ty; use rustc_session::lint::builtin::PROC_MACRO_DERIVE_RESOLUTION_FALLBACK; use rustc_session::lint::BuiltinLintDiag; +use rustc_session::parse::feature_err; use rustc_span::def_id::LocalDefId; use rustc_span::hygiene::{ExpnId, ExpnKind, LocalExpnId, MacroKind, SyntaxContext}; +use rustc_span::sym; use rustc_span::symbol::{kw, Ident}; use rustc_span::Span; @@ -598,7 +600,35 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { result } Scope::BuiltinTypes => match this.builtin_types_bindings.get(&ident.name) { - Some(binding) => Ok((*binding, Flags::empty())), + Some(binding) => { + if matches!(ident.name, sym::f16) + && !this.tcx.features().f16 + && !ident.span.allows_unstable(sym::f16) + && finalize.is_some() + { + feature_err( + this.tcx.sess, + sym::f16, + ident.span, + "the type `f16` is unstable", + ) + .emit(); + } + if matches!(ident.name, sym::f128) + && !this.tcx.features().f128 + && !ident.span.allows_unstable(sym::f128) + && finalize.is_some() + { + feature_err( + this.tcx.sess, + sym::f128, + ident.span, + "the type `f128` is unstable", + ) + .emit(); + } + Ok((*binding, Flags::empty())) + } None => Err(Determinacy::Determined), }, }; diff --git a/compiler/rustc_resolve/src/late.rs b/compiler/rustc_resolve/src/late.rs index a996188db022..6f9144e83a93 100644 --- a/compiler/rustc_resolve/src/late.rs +++ b/compiler/rustc_resolve/src/late.rs @@ -27,6 +27,7 @@ use rustc_middle::middle::resolve_bound_vars::Set1; use rustc_middle::{bug, span_bug}; use rustc_session::config::{CrateType, ResolveDocLinks}; use rustc_session::lint; +use rustc_session::parse::feature_err; use rustc_span::source_map::{respan, Spanned}; use rustc_span::symbol::{kw, sym, Ident, Symbol}; use rustc_span::{BytePos, Span, SyntaxContext}; @@ -4129,6 +4130,25 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> { && PrimTy::from_name(path[0].ident.name).is_some() => { let prim = PrimTy::from_name(path[0].ident.name).unwrap(); + let tcx = self.r.tcx(); + + let gate_err_sym_msg = match prim { + PrimTy::Float(FloatTy::F16) if !tcx.features().f16 => { + Some((sym::f16, "the type `f16` is unstable")) + } + PrimTy::Float(FloatTy::F128) if !tcx.features().f128 => { + Some((sym::f128, "the type `f128` is unstable")) + } + _ => None, + }; + + if let Some((sym, msg)) = gate_err_sym_msg { + let span = path[0].ident.span; + if !span.allows_unstable(sym) { + feature_err(tcx.sess, sym, span, msg).emit(); + } + }; + PartialRes::with_unresolved_segments(Res::PrimTy(prim), path.len() - 1) } PathResult::Module(ModuleOrUniformRoot::Module(module)) => { diff --git a/src/doc/unstable-book/src/language-features/f128.md b/src/doc/unstable-book/src/language-features/f128.md new file mode 100644 index 000000000000..0cc5f6772302 --- /dev/null +++ b/src/doc/unstable-book/src/language-features/f128.md @@ -0,0 +1,9 @@ +# `f128` + +The tracking issue for this feature is: [#116909] + +[#116909]: https://github.com/rust-lang/rust/issues/116909 + +--- + +Enable the `f128` type for IEEE 128-bit floating numbers (quad precision). diff --git a/src/doc/unstable-book/src/language-features/f16.md b/src/doc/unstable-book/src/language-features/f16.md new file mode 100644 index 000000000000..efb07a5146d4 --- /dev/null +++ b/src/doc/unstable-book/src/language-features/f16.md @@ -0,0 +1,9 @@ +# `f16` + +The tracking issue for this feature is: [#116909] + +[#116909]: https://github.com/rust-lang/rust/issues/116909 + +--- + +Enable the `f16` type for IEEE 16-bit floating numbers (half precision). diff --git a/tests/ui/feature-gates/feature-gate-f128.rs b/tests/ui/feature-gates/feature-gate-f128.rs new file mode 100644 index 000000000000..7f60fb6afa08 --- /dev/null +++ b/tests/ui/feature-gates/feature-gate-f128.rs @@ -0,0 +1,15 @@ +#![allow(unused)] + +const A: f128 = 10.0; //~ ERROR the type `f128` is unstable + +pub fn main() { + let a: f128 = 100.0; //~ ERROR the type `f128` is unstable + let b = 0.0f128; //~ ERROR the type `f128` is unstable + foo(1.23); +} + +fn foo(a: f128) {} //~ ERROR the type `f128` is unstable + +struct Bar { + a: f128, //~ ERROR the type `f128` is unstable +} diff --git a/tests/ui/feature-gates/feature-gate-f128.stderr b/tests/ui/feature-gates/feature-gate-f128.stderr new file mode 100644 index 000000000000..299375c9aed9 --- /dev/null +++ b/tests/ui/feature-gates/feature-gate-f128.stderr @@ -0,0 +1,53 @@ +error[E0658]: the type `f128` is unstable + --> $DIR/feature-gate-f128.rs:3:10 + | +LL | const A: f128 = 10.0; + | ^^^^ + | + = note: see issue #116909 for more information + = help: add `#![feature(f128)]` 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[E0658]: the type `f128` is unstable + --> $DIR/feature-gate-f128.rs:6:12 + | +LL | let a: f128 = 100.0; + | ^^^^ + | + = note: see issue #116909 for more information + = help: add `#![feature(f128)]` 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[E0658]: the type `f128` is unstable + --> $DIR/feature-gate-f128.rs:11:11 + | +LL | fn foo(a: f128) {} + | ^^^^ + | + = note: see issue #116909 for more information + = help: add `#![feature(f128)]` 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[E0658]: the type `f128` is unstable + --> $DIR/feature-gate-f128.rs:14:8 + | +LL | a: f128, + | ^^^^ + | + = note: see issue #116909 for more information + = help: add `#![feature(f128)]` 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[E0658]: the type `f128` is unstable + --> $DIR/feature-gate-f128.rs:7:13 + | +LL | let b = 0.0f128; + | ^^^^^^^ + | + = note: see issue #116909 for more information + = help: add `#![feature(f128)]` 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 5 previous errors + +For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/feature-gates/feature-gate-f16.rs b/tests/ui/feature-gates/feature-gate-f16.rs new file mode 100644 index 000000000000..31d8f87f3ba6 --- /dev/null +++ b/tests/ui/feature-gates/feature-gate-f16.rs @@ -0,0 +1,15 @@ +#![allow(unused)] + +const A: f16 = 10.0; //~ ERROR the type `f16` is unstable + +pub fn main() { + let a: f16 = 100.0; //~ ERROR the type `f16` is unstable + let b = 0.0f16; //~ ERROR the type `f16` is unstable + foo(1.23); +} + +fn foo(a: f16) {} //~ ERROR the type `f16` is unstable + +struct Bar { + a: f16, //~ ERROR the type `f16` is unstable +} diff --git a/tests/ui/feature-gates/feature-gate-f16.stderr b/tests/ui/feature-gates/feature-gate-f16.stderr new file mode 100644 index 000000000000..e54b54a47bde --- /dev/null +++ b/tests/ui/feature-gates/feature-gate-f16.stderr @@ -0,0 +1,53 @@ +error[E0658]: the type `f16` is unstable + --> $DIR/feature-gate-f16.rs:3:10 + | +LL | const A: f16 = 10.0; + | ^^^ + | + = note: see issue #116909 for more information + = help: add `#![feature(f16)]` 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[E0658]: the type `f16` is unstable + --> $DIR/feature-gate-f16.rs:6:12 + | +LL | let a: f16 = 100.0; + | ^^^ + | + = note: see issue #116909 for more information + = help: add `#![feature(f16)]` 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[E0658]: the type `f16` is unstable + --> $DIR/feature-gate-f16.rs:11:11 + | +LL | fn foo(a: f16) {} + | ^^^ + | + = note: see issue #116909 for more information + = help: add `#![feature(f16)]` 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[E0658]: the type `f16` is unstable + --> $DIR/feature-gate-f16.rs:14:8 + | +LL | a: f16, + | ^^^ + | + = note: see issue #116909 for more information + = help: add `#![feature(f16)]` 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[E0658]: the type `f16` is unstable + --> $DIR/feature-gate-f16.rs:7:13 + | +LL | let b = 0.0f16; + | ^^^^^^ + | + = note: see issue #116909 for more information + = help: add `#![feature(f16)]` 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 5 previous errors + +For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/resolve/primitive-f16-f128-shadowed.rs b/tests/ui/resolve/primitive-f16-f128-shadowed.rs new file mode 100644 index 000000000000..ed3fb44b256d --- /dev/null +++ b/tests/ui/resolve/primitive-f16-f128-shadowed.rs @@ -0,0 +1,31 @@ +//@ compile-flags: --crate-type=lib +//@ check-pass + +// Verify that gates for the `f16` and `f128` features do not apply to user types + +mod binary16 { + #[allow(non_camel_case_types)] + pub struct f16(u16); +} + +mod binary128 { + #[allow(non_camel_case_types)] + pub struct f128(u128); +} + +pub use binary128::f128; +pub use binary16::f16; + +mod private16 { + use crate::f16; + + pub trait SealedHalf {} + impl SealedHalf for f16 {} +} + +mod private128 { + use crate::f128; + + pub trait SealedQuad {} + impl SealedQuad for f128 {} +} From 2529bf2650ee548eb170822816aadacaa1ca05d2 Mon Sep 17 00:00:00 2001 From: Trevor Gross Date: Sat, 2 Mar 2024 21:46:50 -0500 Subject: [PATCH 059/103] Remove unneeded `f16` and `f128` parser tests Superceded by feature gate tests. --- tests/ui/parser/f16-f128.rs | 37 ------------------ tests/ui/parser/f16-f128.stderr | 67 --------------------------------- 2 files changed, 104 deletions(-) delete mode 100644 tests/ui/parser/f16-f128.rs delete mode 100644 tests/ui/parser/f16-f128.stderr diff --git a/tests/ui/parser/f16-f128.rs b/tests/ui/parser/f16-f128.rs deleted file mode 100644 index 4f31dccce3c1..000000000000 --- a/tests/ui/parser/f16-f128.rs +++ /dev/null @@ -1,37 +0,0 @@ -// Make sure we don't ICE while incrementally adding f16 and f128 support - -mod f16_checks { - const A: f16 = 10.0; //~ ERROR cannot find type `f16` in this scope - - pub fn main() { - let a: f16 = 100.0; //~ ERROR cannot find type `f16` in this scope - let b = 0.0f16; //~ ERROR invalid width `16` for float literal - - foo(1.23); - } - - fn foo(a: f16) {} //~ ERROR cannot find type `f16` in this scope - - struct Bar { - a: f16, //~ ERROR cannot find type `f16` in this scope - } -} - -mod f128_checks { - const A: f128 = 10.0; //~ ERROR cannot find type `f128` in this scope - - pub fn main() { - let a: f128 = 100.0; //~ ERROR cannot find type `f128` in this scope - let b = 0.0f128; //~ ERROR invalid width `128` for float literal - - foo(1.23); - } - - fn foo(a: f128) {} //~ ERROR cannot find type `f128` in this scope - - struct Bar { - a: f128, //~ ERROR cannot find type `f128` in this scope - } -} - -fn main() {} diff --git a/tests/ui/parser/f16-f128.stderr b/tests/ui/parser/f16-f128.stderr deleted file mode 100644 index d3f2227acd72..000000000000 --- a/tests/ui/parser/f16-f128.stderr +++ /dev/null @@ -1,67 +0,0 @@ -error[E0412]: cannot find type `f16` in this scope - --> $DIR/f16-f128.rs:4:14 - | -LL | const A: f16 = 10.0; - | ^^^ help: a builtin type with a similar name exists: `i16` - -error[E0412]: cannot find type `f16` in this scope - --> $DIR/f16-f128.rs:7:16 - | -LL | let a: f16 = 100.0; - | ^^^ help: a builtin type with a similar name exists: `i16` - -error[E0412]: cannot find type `f16` in this scope - --> $DIR/f16-f128.rs:13:15 - | -LL | fn foo(a: f16) {} - | ^^^ help: a builtin type with a similar name exists: `i16` - -error[E0412]: cannot find type `f16` in this scope - --> $DIR/f16-f128.rs:16:12 - | -LL | a: f16, - | ^^^ help: a builtin type with a similar name exists: `i16` - -error[E0412]: cannot find type `f128` in this scope - --> $DIR/f16-f128.rs:21:14 - | -LL | const A: f128 = 10.0; - | ^^^^ help: a builtin type with a similar name exists: `i128` - -error[E0412]: cannot find type `f128` in this scope - --> $DIR/f16-f128.rs:24:16 - | -LL | let a: f128 = 100.0; - | ^^^^ help: a builtin type with a similar name exists: `i128` - -error[E0412]: cannot find type `f128` in this scope - --> $DIR/f16-f128.rs:30:15 - | -LL | fn foo(a: f128) {} - | ^^^^ help: a builtin type with a similar name exists: `i128` - -error[E0412]: cannot find type `f128` in this scope - --> $DIR/f16-f128.rs:33:12 - | -LL | a: f128, - | ^^^^ help: a builtin type with a similar name exists: `i128` - -error: invalid width `16` for float literal - --> $DIR/f16-f128.rs:8:17 - | -LL | let b = 0.0f16; - | ^^^^^^ - | - = help: valid widths are 32 and 64 - -error: invalid width `128` for float literal - --> $DIR/f16-f128.rs:25:17 - | -LL | let b = 0.0f128; - | ^^^^^^^ - | - = help: valid widths are 32 and 64 - -error: aborting due to 10 previous errors - -For more information about this error, try `rustc --explain E0412`. From 2098fec0809521ea8dd489f6cd5f09337a31764f Mon Sep 17 00:00:00 2001 From: Trevor Gross Date: Sun, 3 Mar 2024 23:59:44 -0500 Subject: [PATCH 060/103] Add UI tests related to feature-gated primitives Add a test that `f16` and `f128` are usable with the feature gate enabled, as well as a test that user types with the same name as primitives are not improperly gated. --- .../ui/resolve/conflicting-primitive-names.rs | 30 +++++++++++++ tests/ui/resolve/primitive-usage.rs | 42 +++++++++++++++++++ 2 files changed, 72 insertions(+) create mode 100644 tests/ui/resolve/conflicting-primitive-names.rs create mode 100644 tests/ui/resolve/primitive-usage.rs diff --git a/tests/ui/resolve/conflicting-primitive-names.rs b/tests/ui/resolve/conflicting-primitive-names.rs new file mode 100644 index 000000000000..79b6990681d9 --- /dev/null +++ b/tests/ui/resolve/conflicting-primitive-names.rs @@ -0,0 +1,30 @@ +//@ check-pass +#![allow(non_camel_case_types)] +#![allow(unused)] + +// Ensure that primitives do not interfere with user types of similar names + +macro_rules! make_ty_mod { + ($modname:ident, $ty:tt) => { + mod $modname { + struct $ty { + a: i32, + } + + fn assignment() { + let $ty = (); + } + + fn access(a: $ty) -> i32 { + a.a + } + } + }; +} + +make_ty_mod!(check_f16, f16); +make_ty_mod!(check_f32, f32); +make_ty_mod!(check_f64, f64); +make_ty_mod!(check_f128, f128); + +fn main() {} diff --git a/tests/ui/resolve/primitive-usage.rs b/tests/ui/resolve/primitive-usage.rs new file mode 100644 index 000000000000..b00d18a4e1e8 --- /dev/null +++ b/tests/ui/resolve/primitive-usage.rs @@ -0,0 +1,42 @@ +//@ run-pass +#![allow(unused)] +#![feature(f128)] +#![feature(f16)] + +// Same as the feature gate tests but ensure we can use the types +mod check_f128 { + const A: f128 = 10.0; + + pub fn foo() { + let a: f128 = 100.0; + let b = 0.0f128; + bar(1.23); + } + + fn bar(a: f128) {} + + struct Bar { + a: f128, + } +} + +mod check_f16 { + const A: f16 = 10.0; + + pub fn foo() { + let a: f16 = 100.0; + let b = 0.0f16; + bar(1.23); + } + + fn bar(a: f16) {} + + struct Bar { + a: f16, + } +} + +fn main() { + check_f128::foo(); + check_f16::foo(); +} From f46aceaaf75e6072e4e7227d71bcbf0119201212 Mon Sep 17 00:00:00 2001 From: Chris Wailes Date: Thu, 14 Mar 2024 11:06:39 -0700 Subject: [PATCH 061/103] Restore correct version of comment and fix logic bug --- compiler/rustc_codegen_ssa/src/back/link.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/compiler/rustc_codegen_ssa/src/back/link.rs b/compiler/rustc_codegen_ssa/src/back/link.rs index 0491b3a26953..8d01832c678d 100644 --- a/compiler/rustc_codegen_ssa/src/back/link.rs +++ b/compiler/rustc_codegen_ssa/src/back/link.rs @@ -1213,16 +1213,16 @@ fn add_sanitizer_libraries( return; } - // On macOS the runtimes are distributed as dylibs which should be linked to - // both executables and dynamic shared objects. On most other platforms the - // runtimes are currently distributed as static libraries which should be - // linked to executables only. if matches!(crate_type, CrateType::Rlib | CrateType::Staticlib) { return; } + // On macOS and Windows using MSVC the runtimes are distributed as dylibs + // which should be linked to both executables and dynamic libraries. + // Everywhere else the runtimes are currently distributed as static + // libraries which should be linked to executables only. if matches!(crate_type, CrateType::Dylib | CrateType::Cdylib | CrateType::ProcMacro) - && (sess.target.is_like_osx || sess.target.is_like_msvc) + && !(sess.target.is_like_osx || sess.target.is_like_msvc) { return; } From 07e0182fd3276bb09081a67dbd6cb69910f14413 Mon Sep 17 00:00:00 2001 From: baitcode Date: Thu, 14 Mar 2024 18:58:23 +0000 Subject: [PATCH 062/103] Fix minor documentation issue. Code outside the test would fail. Seek documentation clearly states that negative indexes will cause error. Just making the code in the example to return Result::Ok, instead of Result::Error. --- library/std/src/io/cursor.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/library/std/src/io/cursor.rs b/library/std/src/io/cursor.rs index 25c64240e748..4ef1f1b695e6 100644 --- a/library/std/src/io/cursor.rs +++ b/library/std/src/io/cursor.rs @@ -51,6 +51,8 @@ use crate::io::{self, BorrowedCursor, ErrorKind, IoSlice, IoSliceMut, SeekFrom}; /// // We might want to use a BufReader here for efficiency, but let's /// // keep this example focused. /// let mut file = File::create("foo.txt")?; +/// // First, we need to allocate 10 bytes to be able to write into. +/// file.set_len(10)?; /// /// write_ten_bytes_at_end(&mut file)?; /// # Ok(()) From 89b536dbc85e23275f08feaf73a7abce691bf72c Mon Sep 17 00:00:00 2001 From: Vadim Petrochenkov Date: Thu, 14 Mar 2024 21:05:06 +0300 Subject: [PATCH 063/103] hir: Remove `opt_local_def_id_to_hir_id` and `opt_hir_node_by_def_id` Also replace a few `hir_node()` calls with `hir_node_by_def_id()` --- .../src/diagnostics/conflict_errors.rs | 3 +- .../src/diagnostics/mutability_errors.rs | 11 +-- .../rustc_hir_analysis/src/check/entry.rs | 9 +-- compiler/rustc_hir_analysis/src/check/mod.rs | 2 +- .../rustc_hir_analysis/src/check/wfcheck.rs | 7 +- .../src/collect/predicates_of.rs | 6 +- .../src/collect/type_of/opaque.rs | 5 +- compiler/rustc_hir_typeck/src/_match.rs | 7 +- compiler/rustc_hir_typeck/src/expr.rs | 16 ++--- .../rustc_hir_typeck/src/fn_ctxt/checks.rs | 15 ++-- .../src/infer/error_reporting/mod.rs | 23 +++--- .../nice_region_error/static_impl_trait.rs | 2 +- .../infer/error_reporting/note_and_explain.rs | 15 ++-- compiler/rustc_metadata/src/rmeta/encoder.rs | 4 +- compiler/rustc_middle/src/hir/map/mod.rs | 11 +-- compiler/rustc_middle/src/ty/context.rs | 12 +--- compiler/rustc_passes/src/dead.rs | 70 +++++++++---------- compiler/rustc_passes/src/entry.rs | 2 +- compiler/rustc_passes/src/reachable.rs | 15 ++-- .../error_reporting/on_unimplemented.rs | 2 +- .../src/traits/error_reporting/suggestions.rs | 19 +++-- .../error_reporting/type_err_ctxt_ext.rs | 4 +- compiler/rustc_ty_utils/src/assoc.rs | 6 +- src/librustdoc/clean/mod.rs | 6 +- src/librustdoc/clean/utils.rs | 7 +- .../passes/check_doc_test_visibility.rs | 3 +- src/tools/clippy/clippy_lints/src/escape.rs | 3 +- src/tools/clippy/clippy_lints/src/exit.rs | 2 +- .../clippy_lints/src/functions/result.rs | 2 +- src/tools/clippy/clippy_lints/src/misc.rs | 3 +- .../src/missing_fields_in_debug.rs | 2 +- .../src/needless_pass_by_ref_mut.rs | 5 +- .../src/self_named_constructors.rs | 3 +- .../clippy/clippy_lints/src/single_call_fn.rs | 2 +- .../clippy/clippy_lints/src/types/mod.rs | 6 +- .../clippy_lints/src/zero_sized_map_values.rs | 2 +- src/tools/clippy/clippy_utils/src/lib.rs | 22 +++--- 37 files changed, 135 insertions(+), 199 deletions(-) diff --git a/compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs b/compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs index 0776f455efd9..27159af81e16 100644 --- a/compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs +++ b/compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs @@ -422,8 +422,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> { (None, &[][..], 0) }; if let Some(def_id) = def_id - && let node = - self.infcx.tcx.hir_node(self.infcx.tcx.local_def_id_to_hir_id(def_id)) + && let node = self.infcx.tcx.hir_node_by_def_id(def_id) && let Some(fn_sig) = node.fn_sig() && let Some(ident) = node.ident() && let Some(pos) = args.iter().position(|arg| arg.hir_id == expr.hir_id) diff --git a/compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs b/compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs index ebc9f1d109ee..68d492bbf3a8 100644 --- a/compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs +++ b/compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs @@ -672,11 +672,8 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> { }; ( true, - td.as_local().and_then(|tld| match self.infcx.tcx.opt_hir_node_by_def_id(tld) { - Some(Node::Item(hir::Item { - kind: hir::ItemKind::Trait(_, _, _, _, items), - .. - })) => { + td.as_local().and_then(|tld| match self.infcx.tcx.hir_node_by_def_id(tld) { + Node::Item(hir::Item { kind: hir::ItemKind::Trait(_, _, _, _, items), .. }) => { let mut f_in_trait_opt = None; for hir::TraitItemRef { id: fi, kind: k, .. } in *items { let hi = fi.hir_id(); @@ -1475,11 +1472,9 @@ fn get_mut_span_in_struct_field<'tcx>( if let ty::Ref(_, ty, _) = ty.kind() && let ty::Adt(def, _) = ty.kind() && let field = def.all_fields().nth(field.index())? - // Use the HIR types to construct the diagnostic message. - && let node = tcx.opt_hir_node_by_def_id(field.did.as_local()?)? // Now we're dealing with the actual struct that we're going to suggest a change to, // we can expect a field that is an immutable reference to a type. - && let hir::Node::Field(field) = node + && let hir::Node::Field(field) = tcx.hir_node_by_def_id(field.did.as_local()?) && let hir::TyKind::Ref(lt, hir::MutTy { mutbl: hir::Mutability::Not, ty }) = field.ty.kind { return Some(lt.ident.span.between(ty.span)); diff --git a/compiler/rustc_hir_analysis/src/check/entry.rs b/compiler/rustc_hir_analysis/src/check/entry.rs index 3d803258c8e5..d5908cf28511 100644 --- a/compiler/rustc_hir_analysis/src/check/entry.rs +++ b/compiler/rustc_hir_analysis/src/check/entry.rs @@ -42,8 +42,7 @@ fn check_main_fn_ty(tcx: TyCtxt<'_>, main_def_id: DefId) { if !def_id.is_local() { return None; } - let hir_id = tcx.local_def_id_to_hir_id(def_id.expect_local()); - match tcx.hir_node(hir_id) { + match tcx.hir_node_by_def_id(def_id.expect_local()) { Node::Item(hir::Item { kind: hir::ItemKind::Fn(_, generics, _), .. }) => { generics.params.is_empty().not().then_some(generics.span) } @@ -57,8 +56,7 @@ fn check_main_fn_ty(tcx: TyCtxt<'_>, main_def_id: DefId) { if !def_id.is_local() { return None; } - let hir_id = tcx.local_def_id_to_hir_id(def_id.expect_local()); - match tcx.hir_node(hir_id) { + match tcx.hir_node_by_def_id(def_id.expect_local()) { Node::Item(hir::Item { kind: hir::ItemKind::Fn(_, generics, _), .. }) => { Some(generics.where_clause_span) } @@ -79,8 +77,7 @@ fn check_main_fn_ty(tcx: TyCtxt<'_>, main_def_id: DefId) { if !def_id.is_local() { return None; } - let hir_id = tcx.local_def_id_to_hir_id(def_id.expect_local()); - match tcx.hir_node(hir_id) { + match tcx.hir_node_by_def_id(def_id.expect_local()) { Node::Item(hir::Item { kind: hir::ItemKind::Fn(fn_sig, _, _), .. }) => { Some(fn_sig.decl.output.span()) } diff --git a/compiler/rustc_hir_analysis/src/check/mod.rs b/compiler/rustc_hir_analysis/src/check/mod.rs index f5bfc6b1b869..22afddad6336 100644 --- a/compiler/rustc_hir_analysis/src/check/mod.rs +++ b/compiler/rustc_hir_analysis/src/check/mod.rs @@ -130,7 +130,7 @@ fn get_owner_return_paths( ) -> Option<(LocalDefId, ReturnsVisitor<'_>)> { let hir_id = tcx.local_def_id_to_hir_id(def_id); let parent_id = tcx.hir().get_parent_item(hir_id).def_id; - tcx.opt_hir_node_by_def_id(parent_id).and_then(|node| node.body_id()).map(|body_id| { + tcx.hir_node_by_def_id(parent_id).body_id().map(|body_id| { let body = tcx.hir().body(body_id); let mut visitor = ReturnsVisitor::default(); visitor.visit_body(body); diff --git a/compiler/rustc_hir_analysis/src/check/wfcheck.rs b/compiler/rustc_hir_analysis/src/check/wfcheck.rs index ae15efc0764b..f52500453440 100644 --- a/compiler/rustc_hir_analysis/src/check/wfcheck.rs +++ b/compiler/rustc_hir_analysis/src/check/wfcheck.rs @@ -1969,13 +1969,10 @@ impl<'tcx> WfCheckingCtxt<'_, 'tcx> { // Match the existing behavior. if pred.is_global() && !pred.has_type_flags(TypeFlags::HAS_BINDER_VARS) { let pred = self.normalize(span, None, pred); - let hir_node = tcx.opt_hir_node_by_def_id(self.body_def_id); // only use the span of the predicate clause (#90869) - - if let Some(hir::Generics { predicates, .. }) = - hir_node.and_then(|node| node.generics()) - { + let hir_node = tcx.hir_node_by_def_id(self.body_def_id); + if let Some(hir::Generics { predicates, .. }) = hir_node.generics() { span = predicates .iter() // There seems to be no better way to find out which predicate we are in diff --git a/compiler/rustc_hir_analysis/src/collect/predicates_of.rs b/compiler/rustc_hir_analysis/src/collect/predicates_of.rs index 2675eacc06e1..6aae4aa21b87 100644 --- a/compiler/rustc_hir_analysis/src/collect/predicates_of.rs +++ b/compiler/rustc_hir_analysis/src/collect/predicates_of.rs @@ -609,10 +609,8 @@ pub(super) fn implied_predicates_with_filter( return tcx.super_predicates_of(trait_def_id); }; - let trait_hir_id = tcx.local_def_id_to_hir_id(trait_def_id); - - let Node::Item(item) = tcx.hir_node(trait_hir_id) else { - bug!("trait_node_id {} is not an item", trait_hir_id); + let Node::Item(item) = tcx.hir_node_by_def_id(trait_def_id) else { + bug!("trait_def_id {trait_def_id:?} is not an item"); }; let (generics, bounds) = match item.kind { diff --git a/compiler/rustc_hir_analysis/src/collect/type_of/opaque.rs b/compiler/rustc_hir_analysis/src/collect/type_of/opaque.rs index dcb01a117b04..b5765913cb85 100644 --- a/compiler/rustc_hir_analysis/src/collect/type_of/opaque.rs +++ b/compiler/rustc_hir_analysis/src/collect/type_of/opaque.rs @@ -371,11 +371,10 @@ pub(super) fn find_opaque_ty_constraints_for_rpit<'tcx>( return mir_opaque_ty.ty; } - let scope = tcx.local_def_id_to_hir_id(owner_def_id); - debug!(?scope); + debug!(?owner_def_id); let mut locator = RpitConstraintChecker { def_id, tcx, found: mir_opaque_ty }; - match tcx.hir_node(scope) { + match tcx.hir_node_by_def_id(owner_def_id) { Node::Item(it) => intravisit::walk_item(&mut locator, it), Node::ImplItem(it) => intravisit::walk_impl_item(&mut locator, it), Node::TraitItem(it) => intravisit::walk_trait_item(&mut locator, it), diff --git a/compiler/rustc_hir_typeck/src/_match.rs b/compiler/rustc_hir_typeck/src/_match.rs index c7343387dafc..4b3359858f15 100644 --- a/compiler/rustc_hir_typeck/src/_match.rs +++ b/compiler/rustc_hir_typeck/src/_match.rs @@ -234,11 +234,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { } // Next, make sure that we have no type expectation. - let Some(ret) = self - .tcx - .opt_hir_node_by_def_id(self.body_id) - .and_then(|owner| owner.fn_decl()) - .map(|decl| decl.output.span()) + let Some(ret) = + self.tcx.hir_node_by_def_id(self.body_id).fn_decl().map(|decl| decl.output.span()) else { return; }; diff --git a/compiler/rustc_hir_typeck/src/expr.rs b/compiler/rustc_hir_typeck/src/expr.rs index 7e19e577d7d0..1a142f27809e 100644 --- a/compiler/rustc_hir_typeck/src/expr.rs +++ b/compiler/rustc_hir_typeck/src/expr.rs @@ -890,21 +890,19 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { let encl_item_id = self.tcx.hir().get_parent_item(expr.hir_id); - if let Some(hir::Node::Item(hir::Item { - kind: hir::ItemKind::Fn(..), - span: encl_fn_span, - .. - })) - | Some(hir::Node::TraitItem(hir::TraitItem { + if let hir::Node::Item(hir::Item { + kind: hir::ItemKind::Fn(..), span: encl_fn_span, .. + }) + | hir::Node::TraitItem(hir::TraitItem { kind: hir::TraitItemKind::Fn(_, hir::TraitFn::Provided(_)), span: encl_fn_span, .. - })) - | Some(hir::Node::ImplItem(hir::ImplItem { + }) + | hir::Node::ImplItem(hir::ImplItem { kind: hir::ImplItemKind::Fn(..), span: encl_fn_span, .. - })) = self.tcx.opt_hir_node_by_def_id(encl_item_id.def_id) + }) = self.tcx.hir_node_by_def_id(encl_item_id.def_id) { // We are inside a function body, so reporting "return statement // outside of function body" needs an explanation. diff --git a/compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs b/compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs index 2747700f3c13..7a25bf44340c 100644 --- a/compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs +++ b/compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs @@ -2172,16 +2172,11 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { // Try to find earlier invocations of this closure to find if the type mismatch // is because of inference. If we find one, point at them. let mut call_finder = FindClosureArg { tcx: self.tcx, calls: vec![] }; - let node = self - .tcx - .opt_local_def_id_to_hir_id( - self.tcx.hir().get_parent_item(call_expr.hir_id).def_id, - ) - .map(|hir_id| self.tcx.hir_node(hir_id)); - match node { - Some(hir::Node::Item(item)) => call_finder.visit_item(item), - Some(hir::Node::TraitItem(item)) => call_finder.visit_trait_item(item), - Some(hir::Node::ImplItem(item)) => call_finder.visit_impl_item(item), + let parent_def_id = self.tcx.hir().get_parent_item(call_expr.hir_id).def_id; + match self.tcx.hir_node_by_def_id(parent_def_id) { + hir::Node::Item(item) => call_finder.visit_item(item), + hir::Node::TraitItem(item) => call_finder.visit_trait_item(item), + hir::Node::ImplItem(item) => call_finder.visit_impl_item(item), _ => {} } let typeck = self.typeck_results.borrow(); diff --git a/compiler/rustc_infer/src/infer/error_reporting/mod.rs b/compiler/rustc_infer/src/infer/error_reporting/mod.rs index edd7f733ec96..71df1ffc6ddf 100644 --- a/compiler/rustc_infer/src/infer/error_reporting/mod.rs +++ b/compiler/rustc_infer/src/infer/error_reporting/mod.rs @@ -2126,8 +2126,8 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> { let TypeError::FixedArraySize(sz) = terr else { return None; }; - let tykind = match self.tcx.opt_hir_node_by_def_id(trace.cause.body_id) { - Some(hir::Node::Item(hir::Item { kind: hir::ItemKind::Fn(_, _, body_id), .. })) => { + let tykind = match self.tcx.hir_node_by_def_id(trace.cause.body_id) { + hir::Node::Item(hir::Item { kind: hir::ItemKind::Fn(_, _, body_id), .. }) => { let body = hir.body(*body_id); struct LetVisitor { span: Span, @@ -2156,7 +2156,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> { } LetVisitor { span }.visit_body(body).break_value() } - Some(hir::Node::Item(hir::Item { kind: hir::ItemKind::Const(ty, _, _), .. })) => { + hir::Node::Item(hir::Item { kind: hir::ItemKind::Const(ty, _, _), .. }) => { Some(&ty.peel_refs().kind) } _ => None, @@ -2527,15 +2527,14 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> { .filter(|p| matches!(p.kind, ty::GenericParamDefKind::Lifetime)) .map(|p| p.name) .collect::>(); - if let Some(hir_id) = self.tcx.opt_local_def_id_to_hir_id(lifetime_scope) { - // consider late-bound lifetimes ... - used_names.extend(self.tcx.late_bound_vars(hir_id).into_iter().filter_map(|p| { - match p { - ty::BoundVariableKind::Region(lt) => lt.get_name(), - _ => None, - } - })) - } + let hir_id = self.tcx.local_def_id_to_hir_id(lifetime_scope); + // consider late-bound lifetimes ... + used_names.extend(self.tcx.late_bound_vars(hir_id).into_iter().filter_map( + |p| match p { + ty::BoundVariableKind::Region(lt) => lt.get_name(), + _ => None, + }, + )); (b'a'..=b'z') .map(|c| format!("'{}", c as char)) .find(|candidate| !used_names.iter().any(|e| e.as_str() == candidate)) diff --git a/compiler/rustc_infer/src/infer/error_reporting/nice_region_error/static_impl_trait.rs b/compiler/rustc_infer/src/infer/error_reporting/nice_region_error/static_impl_trait.rs index afcb4a182fa4..503645191aac 100644 --- a/compiler/rustc_infer/src/infer/error_reporting/nice_region_error/static_impl_trait.rs +++ b/compiler/rustc_infer/src/infer/error_reporting/nice_region_error/static_impl_trait.rs @@ -459,7 +459,7 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> { tcx.hir().trait_impls(trait_did).iter().find_map(|&impl_did| { if let Node::Item(Item { kind: ItemKind::Impl(hir::Impl { self_ty, .. }), .. - }) = tcx.opt_hir_node_by_def_id(impl_did)? + }) = tcx.hir_node_by_def_id(impl_did) && trait_objects.iter().all(|did| { // FIXME: we should check `self_ty` against the receiver // type in the `UnifyReceiver` context, but for now, use diff --git a/compiler/rustc_infer/src/infer/error_reporting/note_and_explain.rs b/compiler/rustc_infer/src/infer/error_reporting/note_and_explain.rs index d14cabfc429b..24eaff08220d 100644 --- a/compiler/rustc_infer/src/infer/error_reporting/note_and_explain.rs +++ b/compiler/rustc_infer/src/infer/error_reporting/note_and_explain.rs @@ -804,23 +804,22 @@ fn foo(&self) -> Self::T { String::new() } ) -> bool { let tcx = self.tcx; - let Some(hir_id) = body_owner_def_id.as_local() else { - return false; - }; - let Some(hir_id) = tcx.opt_local_def_id_to_hir_id(hir_id) else { + let Some(def_id) = body_owner_def_id.as_local() else { return false; }; + // When `body_owner` is an `impl` or `trait` item, look in its associated types for // `expected` and point at it. + let hir_id = tcx.local_def_id_to_hir_id(def_id); let parent_id = tcx.hir().get_parent_item(hir_id); - let item = tcx.opt_hir_node_by_def_id(parent_id.def_id); + let item = tcx.hir_node_by_def_id(parent_id.def_id); debug!("expected_projection parent item {:?}", item); let param_env = tcx.param_env(body_owner_def_id); match item { - Some(hir::Node::Item(hir::Item { kind: hir::ItemKind::Trait(.., items), .. })) => { + hir::Node::Item(hir::Item { kind: hir::ItemKind::Trait(.., items), .. }) => { // FIXME: account for `#![feature(specialization)]` for item in &items[..] { match item.kind { @@ -845,10 +844,10 @@ fn foo(&self) -> Self::T { String::new() } } } } - Some(hir::Node::Item(hir::Item { + hir::Node::Item(hir::Item { kind: hir::ItemKind::Impl(hir::Impl { items, .. }), .. - })) => { + }) => { for item in &items[..] { if let hir::AssocItemKind::Type = item.kind { let assoc_ty = tcx.type_of(item.id.owner_id).instantiate_identity(); diff --git a/compiler/rustc_metadata/src/rmeta/encoder.rs b/compiler/rustc_metadata/src/rmeta/encoder.rs index 26226386ef72..d8cfceab460a 100644 --- a/compiler/rustc_metadata/src/rmeta/encoder.rs +++ b/compiler/rustc_metadata/src/rmeta/encoder.rs @@ -1339,8 +1339,8 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> { is_doc_hidden: false, }; let attr_iter = tcx - .opt_local_def_id_to_hir_id(def_id) - .map_or(Default::default(), |hir_id| tcx.hir().attrs(hir_id)) + .hir() + .attrs(tcx.local_def_id_to_hir_id(def_id)) .iter() .filter(|attr| analyze_attr(attr, &mut state)); diff --git a/compiler/rustc_middle/src/hir/map/mod.rs b/compiler/rustc_middle/src/hir/map/mod.rs index a64fa74762c0..d0002694fd0d 100644 --- a/compiler/rustc_middle/src/hir/map/mod.rs +++ b/compiler/rustc_middle/src/hir/map/mod.rs @@ -158,12 +158,6 @@ impl<'tcx> TyCtxt<'tcx> { self.hir_owner_nodes(owner_id).node() } - /// Retrieves the `hir::Node` corresponding to `id`, returning `None` if cannot be found. - #[inline] - pub fn opt_hir_node_by_def_id(self, id: LocalDefId) -> Option> { - Some(self.hir_node_by_def_id(id)) - } - /// Retrieves the `hir::Node` corresponding to `id`. pub fn hir_node(self, id: HirId) -> Node<'tcx> { self.hir_owner_nodes(id.owner).nodes[id.local_id].node @@ -239,8 +233,7 @@ impl<'hir> Map<'hir> { } pub fn get_if_local(self, id: DefId) -> Option> { - id.as_local() - .and_then(|id| Some(self.tcx.hir_node(self.tcx.opt_local_def_id_to_hir_id(id)?))) + id.as_local().map(|id| self.tcx.hir_node_by_def_id(id)) } pub fn get_generics(self, id: LocalDefId) -> Option<&'hir Generics<'hir>> { @@ -304,7 +297,7 @@ impl<'hir> Map<'hir> { /// Given a `LocalDefId`, returns the `BodyId` associated with it, /// if the node is a body owner, otherwise returns `None`. pub fn maybe_body_owned_by(self, id: LocalDefId) -> Option { - let node = self.tcx.opt_hir_node_by_def_id(id)?; + let node = self.tcx.hir_node_by_def_id(id); let (_, body_id) = associated_body(node)?; Some(body_id) } diff --git a/compiler/rustc_middle/src/ty/context.rs b/compiler/rustc_middle/src/ty/context.rs index 5362b6d8b24c..17ba97c5fd3a 100644 --- a/compiler/rustc_middle/src/ty/context.rs +++ b/compiler/rustc_middle/src/ty/context.rs @@ -1265,11 +1265,9 @@ impl<'tcx> TyCtxt<'tcx> { break (scope, ty::BrNamed(def_id.into(), self.item_name(def_id.into()))); }; - let is_impl_item = match self.opt_hir_node_by_def_id(suitable_region_binding_scope) { - Some(Node::Item(..) | Node::TraitItem(..)) => false, - Some(Node::ImplItem(..)) => { - self.is_bound_region_in_impl_item(suitable_region_binding_scope) - } + let is_impl_item = match self.hir_node_by_def_id(suitable_region_binding_scope) { + Node::Item(..) | Node::TraitItem(..) => false, + Node::ImplItem(..) => self.is_bound_region_in_impl_item(suitable_region_binding_scope), _ => false, }; @@ -2355,10 +2353,6 @@ impl<'tcx> TyCtxt<'tcx> { self.intrinsic_raw(def_id) } - pub fn opt_local_def_id_to_hir_id(self, local_def_id: LocalDefId) -> Option { - Some(self.local_def_id_to_hir_id(local_def_id)) - } - pub fn next_trait_solver_globally(self) -> bool { self.sess.opts.unstable_opts.next_solver.map_or(false, |c| c.globally) } diff --git a/compiler/rustc_passes/src/dead.rs b/compiler/rustc_passes/src/dead.rs index 0371bab83c04..350f7e166bf9 100644 --- a/compiler/rustc_passes/src/dead.rs +++ b/compiler/rustc_passes/src/dead.rs @@ -33,15 +33,13 @@ use crate::errors::{ // may need to be marked as live. fn should_explore(tcx: TyCtxt<'_>, def_id: LocalDefId) -> bool { matches!( - tcx.opt_hir_node_by_def_id(def_id), - Some( - Node::Item(..) - | Node::ImplItem(..) - | Node::ForeignItem(..) - | Node::TraitItem(..) - | Node::Variant(..) - | Node::AnonConst(..) - ) + tcx.hir_node_by_def_id(def_id), + Node::Item(..) + | Node::ImplItem(..) + | Node::ForeignItem(..) + | Node::TraitItem(..) + | Node::Variant(..) + | Node::AnonConst(..) ) } @@ -316,33 +314,31 @@ impl<'tcx> MarkSymbolVisitor<'tcx> { // tuple struct constructor function let id = self.struct_constructors.get(&id).copied().unwrap_or(id); - if let Some(node) = self.tcx.opt_hir_node_by_def_id(id) { - // When using `#[allow]` or `#[expect]` of `dead_code`, we do a QOL improvement - // by declaring fn calls, statics, ... within said items as live, as well as - // the item itself, although technically this is not the case. - // - // This means that the lint for said items will never be fired. - // - // This doesn't make any difference for the item declared with `#[allow]`, as - // the lint firing will be a nop, as it will be silenced by the `#[allow]` of - // the item. - // - // However, for `#[expect]`, the presence or absence of the lint is relevant, - // so we don't add it to the list of live symbols when it comes from a - // `#[expect]`. This means that we will correctly report an item as live or not - // for the `#[expect]` case. - // - // Note that an item can and will be duplicated on the worklist with different - // `ComesFromAllowExpect`, particularly if it was added from the - // `effective_visibilities` query or from the `#[allow]`/`#[expect]` checks, - // this "duplication" is essential as otherwise a function with `#[expect]` - // called from a `pub fn` may be falsely reported as not live, falsely - // triggering the `unfulfilled_lint_expectations` lint. - if comes_from_allow_expect != ComesFromAllowExpect::Yes { - self.live_symbols.insert(id); - } - self.visit_node(node); + // When using `#[allow]` or `#[expect]` of `dead_code`, we do a QOL improvement + // by declaring fn calls, statics, ... within said items as live, as well as + // the item itself, although technically this is not the case. + // + // This means that the lint for said items will never be fired. + // + // This doesn't make any difference for the item declared with `#[allow]`, as + // the lint firing will be a nop, as it will be silenced by the `#[allow]` of + // the item. + // + // However, for `#[expect]`, the presence or absence of the lint is relevant, + // so we don't add it to the list of live symbols when it comes from a + // `#[expect]`. This means that we will correctly report an item as live or not + // for the `#[expect]` case. + // + // Note that an item can and will be duplicated on the worklist with different + // `ComesFromAllowExpect`, particularly if it was added from the + // `effective_visibilities` query or from the `#[allow]`/`#[expect]` checks, + // this "duplication" is essential as otherwise a function with `#[expect]` + // called from a `pub fn` may be falsely reported as not live, falsely + // triggering the `unfulfilled_lint_expectations` lint. + if comes_from_allow_expect != ComesFromAllowExpect::Yes { + self.live_symbols.insert(id); } + self.visit_node(self.tcx.hir_node_by_def_id(id)); } } @@ -739,8 +735,8 @@ fn check_item<'tcx>( for local_def_id in local_def_ids { // check the function may construct Self let mut may_construct_self = true; - if let Some(hir_id) = tcx.opt_local_def_id_to_hir_id(local_def_id) - && let Some(fn_sig) = tcx.hir().fn_sig_by_hir_id(hir_id) + if let Some(fn_sig) = + tcx.hir().fn_sig_by_hir_id(tcx.local_def_id_to_hir_id(local_def_id)) { may_construct_self = matches!(fn_sig.decl.implicit_self, hir::ImplicitSelfKind::None); diff --git a/compiler/rustc_passes/src/entry.rs b/compiler/rustc_passes/src/entry.rs index 0bab13037e4a..2af5a54a0cac 100644 --- a/compiler/rustc_passes/src/entry.rs +++ b/compiler/rustc_passes/src/entry.rs @@ -127,7 +127,7 @@ fn configure_main(tcx: TyCtxt<'_>, visitor: &EntryContext<'_>) -> Option<(DefId, { // non-local main imports are handled below if let Some(def_id) = def_id.as_local() - && matches!(tcx.opt_hir_node_by_def_id(def_id), Some(Node::ForeignItem(_))) + && matches!(tcx.hir_node_by_def_id(def_id), Node::ForeignItem(_)) { tcx.dcx().emit_err(ExternMain { span: tcx.def_span(def_id) }); return None; diff --git a/compiler/rustc_passes/src/reachable.rs b/compiler/rustc_passes/src/reachable.rs index 2a78f47c34f6..9fbae8f84b4a 100644 --- a/compiler/rustc_passes/src/reachable.rs +++ b/compiler/rustc_passes/src/reachable.rs @@ -116,26 +116,25 @@ impl<'tcx> ReachableContext<'tcx> { return false; }; - match self.tcx.opt_hir_node_by_def_id(def_id) { - Some(Node::Item(item)) => match item.kind { + match self.tcx.hir_node_by_def_id(def_id) { + Node::Item(item) => match item.kind { hir::ItemKind::Fn(..) => item_might_be_inlined(self.tcx, def_id.into()), _ => false, }, - Some(Node::TraitItem(trait_method)) => match trait_method.kind { + Node::TraitItem(trait_method) => match trait_method.kind { hir::TraitItemKind::Const(_, ref default) => default.is_some(), hir::TraitItemKind::Fn(_, hir::TraitFn::Provided(_)) => true, hir::TraitItemKind::Fn(_, hir::TraitFn::Required(_)) | hir::TraitItemKind::Type(..) => false, }, - Some(Node::ImplItem(impl_item)) => match impl_item.kind { + Node::ImplItem(impl_item) => match impl_item.kind { hir::ImplItemKind::Const(..) => true, hir::ImplItemKind::Fn(..) => { item_might_be_inlined(self.tcx, impl_item.hir_id().owner.to_def_id()) } hir::ImplItemKind::Type(_) => false, }, - Some(_) => false, - None => false, // This will happen for default methods. + _ => false, } } @@ -147,9 +146,7 @@ impl<'tcx> ReachableContext<'tcx> { continue; } - if let Some(ref item) = self.tcx.opt_hir_node_by_def_id(search_item) { - self.propagate_node(item, search_item); - } + self.propagate_node(&self.tcx.hir_node_by_def_id(search_item), search_item); } } diff --git a/compiler/rustc_trait_selection/src/traits/error_reporting/on_unimplemented.rs b/compiler/rustc_trait_selection/src/traits/error_reporting/on_unimplemented.rs index 126bc0c9ec0f..745ddfc08af4 100644 --- a/compiler/rustc_trait_selection/src/traits/error_reporting/on_unimplemented.rs +++ b/compiler/rustc_trait_selection/src/traits/error_reporting/on_unimplemented.rs @@ -91,7 +91,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> { /// Used to set on_unimplemented's `ItemContext` /// to be the enclosing (async) block/function/closure fn describe_enclosure(&self, def_id: LocalDefId) -> Option<&'static str> { - match self.tcx.opt_hir_node_by_def_id(def_id)? { + match self.tcx.hir_node_by_def_id(def_id) { hir::Node::Item(hir::Item { kind: hir::ItemKind::Fn(..), .. }) => Some("a function"), hir::Node::TraitItem(hir::TraitItem { kind: hir::TraitItemKind::Fn(..), .. }) => { Some("a trait method") diff --git a/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs b/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs index 1241227a5af3..cca004312bf5 100644 --- a/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs +++ b/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs @@ -261,7 +261,8 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> { // FIXME: Add check for trait bound that is already present, particularly `?Sized` so we // don't suggest `T: Sized + ?Sized`. - while let Some(node) = self.tcx.opt_hir_node_by_def_id(body_id) { + loop { + let node = self.tcx.hir_node_by_def_id(body_id); match node { hir::Node::Item(hir::Item { ident, @@ -1685,8 +1686,8 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> { trait_pred: ty::PolyTraitPredicate<'tcx>, ) -> bool { let hir = self.tcx.hir(); - let node = self.tcx.opt_hir_node_by_def_id(obligation.cause.body_id); - if let Some(hir::Node::Item(hir::Item { kind: hir::ItemKind::Fn(sig, _, body_id), .. })) = node + let node = self.tcx.hir_node_by_def_id(obligation.cause.body_id); + if let hir::Node::Item(hir::Item { kind: hir::ItemKind::Fn(sig, _, body_id), .. }) = node && let hir::ExprKind::Block(blk, _) = &hir.body(*body_id).value.kind && sig.decl.output.span().overlaps(span) && blk.expr.is_none() @@ -1720,8 +1721,8 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> { } fn return_type_span(&self, obligation: &PredicateObligation<'tcx>) -> Option { - let Some(hir::Node::Item(hir::Item { kind: hir::ItemKind::Fn(sig, ..), .. })) = - self.tcx.opt_hir_node_by_def_id(obligation.cause.body_id) + let hir::Node::Item(hir::Item { kind: hir::ItemKind::Fn(sig, ..), .. }) = + self.tcx.hir_node_by_def_id(obligation.cause.body_id) else { return None; }; @@ -1813,10 +1814,8 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> { } let hir = self.tcx.hir(); - let node = self.tcx.opt_hir_node_by_def_id(obligation.cause.body_id); - if let Some(hir::Node::Item(hir::Item { kind: hir::ItemKind::Fn(_, _, body_id), .. })) = - node - { + let node = self.tcx.hir_node_by_def_id(obligation.cause.body_id); + if let hir::Node::Item(hir::Item { kind: hir::ItemKind::Fn(_, _, body_id), .. }) = node { let body = hir.body(*body_id); // Point at all the `return`s in the function as they have failed trait bounds. let mut visitor = ReturnsVisitor::default(); @@ -4450,7 +4449,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> { } return; }; - let Some(hir::Node::TraitItem(item)) = self.tcx.opt_hir_node_by_def_id(fn_def_id) else { + let hir::Node::TraitItem(item) = self.tcx.hir_node_by_def_id(fn_def_id) else { return; }; diff --git a/compiler/rustc_trait_selection/src/traits/error_reporting/type_err_ctxt_ext.rs b/compiler/rustc_trait_selection/src/traits/error_reporting/type_err_ctxt_ext.rs index d18acb8c864b..1cbc94800c59 100644 --- a/compiler/rustc_trait_selection/src/traits/error_reporting/type_err_ctxt_ext.rs +++ b/compiler/rustc_trait_selection/src/traits/error_reporting/type_err_ctxt_ext.rs @@ -2497,11 +2497,11 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> { err.code(E0790); if let Some(local_def_id) = data.trait_ref.def_id.as_local() - && let Some(hir::Node::Item(hir::Item { + && let hir::Node::Item(hir::Item { ident: trait_name, kind: hir::ItemKind::Trait(_, _, _, _, trait_item_refs), .. - })) = self.tcx.opt_hir_node_by_def_id(local_def_id) + }) = self.tcx.hir_node_by_def_id(local_def_id) && let Some(method_ref) = trait_item_refs .iter() .find(|item_ref| item_ref.ident == *assoc_item_name) diff --git a/compiler/rustc_ty_utils/src/assoc.rs b/compiler/rustc_ty_utils/src/assoc.rs index 3f628092190b..32ba1e194813 100644 --- a/compiler/rustc_ty_utils/src/assoc.rs +++ b/compiler/rustc_ty_utils/src/assoc.rs @@ -319,11 +319,7 @@ fn associated_type_for_impl_trait_in_impl( ) -> LocalDefId { let impl_local_def_id = tcx.local_parent(impl_fn_def_id); - let decl = tcx - .opt_hir_node_by_def_id(impl_fn_def_id) - .expect("expected item") - .fn_decl() - .expect("expected decl"); + let decl = tcx.hir_node_by_def_id(impl_fn_def_id).fn_decl().expect("expected decl"); let span = match decl.output { hir::FnRetTy::DefaultReturn(_) => tcx.def_span(impl_fn_def_id), hir::FnRetTy::Return(ty) => ty.span, diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index b32d3ad562d0..b28e57a93591 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -149,8 +149,7 @@ pub(crate) fn clean_doc_module<'tcx>(doc: &DocModule<'tcx>, cx: &mut DocContext< } fn is_glob_import(tcx: TyCtxt<'_>, import_id: LocalDefId) -> bool { - if let Some(node) = tcx.opt_hir_node_by_def_id(import_id) - && let hir::Node::Item(item) = node + if let hir::Node::Item(item) = tcx.hir_node_by_def_id(import_id) && let hir::ItemKind::Use(_, use_kind) = item.kind { use_kind == hir::UseKind::Glob @@ -1612,8 +1611,7 @@ fn first_non_private<'tcx>( 'reexps: for reexp in child.reexport_chain.iter() { if let Some(use_def_id) = reexp.id() && let Some(local_use_def_id) = use_def_id.as_local() - && let Some(hir::Node::Item(item)) = - cx.tcx.opt_hir_node_by_def_id(local_use_def_id) + && let hir::Node::Item(item) = cx.tcx.hir_node_by_def_id(local_use_def_id) && !item.ident.name.is_empty() && let hir::ItemKind::Use(path, _) = item.kind { diff --git a/src/librustdoc/clean/utils.rs b/src/librustdoc/clean/utils.rs index 57916ff0ff78..aed1d9c5a833 100644 --- a/src/librustdoc/clean/utils.rs +++ b/src/librustdoc/clean/utils.rs @@ -664,9 +664,10 @@ pub(crate) fn inherits_doc_hidden( def_id = id; if tcx.is_doc_hidden(def_id.to_def_id()) { return true; - } else if let Some(node) = tcx.opt_hir_node_by_def_id(def_id) - && matches!(node, hir::Node::Item(hir::Item { kind: hir::ItemKind::Impl(_), .. }),) - { + } else if matches!( + tcx.hir_node_by_def_id(def_id), + hir::Node::Item(hir::Item { kind: hir::ItemKind::Impl(_), .. }) + ) { // `impl` blocks stand a bit on their own: unless they have `#[doc(hidden)]` directly // on them, they don't inherit it from the parent context. return false; diff --git a/src/librustdoc/passes/check_doc_test_visibility.rs b/src/librustdoc/passes/check_doc_test_visibility.rs index 0603aae55360..e85b998bfbe1 100644 --- a/src/librustdoc/passes/check_doc_test_visibility.rs +++ b/src/librustdoc/passes/check_doc_test_visibility.rs @@ -80,9 +80,8 @@ pub(crate) fn should_have_doc_example(cx: &DocContext<'_>, item: &clean::Item) - // check if parent is trait impl if let Some(parent_def_id) = cx.tcx.opt_local_parent(def_id) - && let Some(parent_node) = cx.tcx.opt_hir_node_by_def_id(parent_def_id) && matches!( - parent_node, + cx.tcx.hir_node_by_def_id(parent_def_id), hir::Node::Item(hir::Item { kind: hir::ItemKind::Impl(hir::Impl { of_trait: Some(_), .. }), .. diff --git a/src/tools/clippy/clippy_lints/src/escape.rs b/src/tools/clippy/clippy_lints/src/escape.rs index 8857cb8e3827..ad589dad350b 100644 --- a/src/tools/clippy/clippy_lints/src/escape.rs +++ b/src/tools/clippy/clippy_lints/src/escape.rs @@ -76,10 +76,9 @@ impl<'tcx> LateLintPass<'tcx> for BoxedLocal { .hir() .get_parent_item(cx.tcx.local_def_id_to_hir_id(fn_def_id)) .def_id; - let parent_node = cx.tcx.opt_hir_node_by_def_id(parent_id); let mut trait_self_ty = None; - if let Some(Node::Item(item)) = parent_node { + if let Node::Item(item) = cx.tcx.hir_node_by_def_id(parent_id) { // If the method is an impl for a trait, don't warn. if let ItemKind::Impl(Impl { of_trait: Some(_), .. }) = item.kind { return; diff --git a/src/tools/clippy/clippy_lints/src/exit.rs b/src/tools/clippy/clippy_lints/src/exit.rs index 6603512c73cd..106844dd4348 100644 --- a/src/tools/clippy/clippy_lints/src/exit.rs +++ b/src/tools/clippy/clippy_lints/src/exit.rs @@ -46,7 +46,7 @@ impl<'tcx> LateLintPass<'tcx> for Exit { && let Some(def_id) = cx.qpath_res(path, path_expr.hir_id).opt_def_id() && cx.tcx.is_diagnostic_item(sym::process_exit, def_id) && let parent = cx.tcx.hir().get_parent_item(e.hir_id).def_id - && let Some(Node::Item(Item{kind: ItemKind::Fn(..), ..})) = cx.tcx.opt_hir_node_by_def_id(parent) + && let Node::Item(Item{kind: ItemKind::Fn(..), ..}) = cx.tcx.hir_node_by_def_id(parent) // If the next item up is a function we check if it is an entry point // and only then emit a linter warning && !is_entrypoint_fn(cx, parent.to_def_id()) diff --git a/src/tools/clippy/clippy_lints/src/functions/result.rs b/src/tools/clippy/clippy_lints/src/functions/result.rs index 7f36f33fe708..37fbf2c7d596 100644 --- a/src/tools/clippy/clippy_lints/src/functions/result.rs +++ b/src/tools/clippy/clippy_lints/src/functions/result.rs @@ -92,7 +92,7 @@ fn check_result_large_err<'tcx>(cx: &LateContext<'tcx>, err_ty: Ty<'tcx>, hir_ty .expect("already checked this is adt") .did() .as_local() - && let Some(hir::Node::Item(item)) = cx.tcx.opt_hir_node_by_def_id(local_def_id) + && let hir::Node::Item(item) = cx.tcx.hir_node_by_def_id(local_def_id) && let hir::ItemKind::Enum(ref def, _) = item.kind { let variants_size = AdtVariantInfo::new(cx, *adt, subst); diff --git a/src/tools/clippy/clippy_lints/src/misc.rs b/src/tools/clippy/clippy_lints/src/misc.rs index b9784a58596c..ac9df8bfca3e 100644 --- a/src/tools/clippy/clippy_lints/src/misc.rs +++ b/src/tools/clippy/clippy_lints/src/misc.rs @@ -225,10 +225,9 @@ impl<'tcx> LateLintPass<'tcx> for LintPass { if let Some(adt_def) = cx.typeck_results().expr_ty_adjusted(recv).ty_adt_def() && let Some(field) = adt_def.all_fields().find(|field| field.name == ident.name) && let Some(local_did) = field.did.as_local() - && let Some(hir_id) = cx.tcx.opt_local_def_id_to_hir_id(local_did) && !cx.tcx.type_of(field.did).skip_binder().is_phantom_data() { - (hir_id, ident) + (cx.tcx.local_def_id_to_hir_id(local_did), ident) } else { return; } diff --git a/src/tools/clippy/clippy_lints/src/missing_fields_in_debug.rs b/src/tools/clippy/clippy_lints/src/missing_fields_in_debug.rs index 88b331ddefdb..3bf9f75e2261 100644 --- a/src/tools/clippy/clippy_lints/src/missing_fields_in_debug.rs +++ b/src/tools/clippy/clippy_lints/src/missing_fields_in_debug.rs @@ -220,7 +220,7 @@ impl<'tcx> LateLintPass<'tcx> for MissingFieldsInDebug { && let self_ty = cx.tcx.type_of(self_path_did).skip_binder().peel_refs() && let Some(self_adt) = self_ty.ty_adt_def() && let Some(self_def_id) = self_adt.did().as_local() - && let Some(Node::Item(self_item)) = cx.tcx.opt_hir_node_by_def_id(self_def_id) + && let Node::Item(self_item) = cx.tcx.hir_node_by_def_id(self_def_id) // NB: can't call cx.typeck_results() as we are not in a body && let typeck_results = cx.tcx.typeck_body(*body_id) && should_lint(cx, typeck_results, block) diff --git a/src/tools/clippy/clippy_lints/src/needless_pass_by_ref_mut.rs b/src/tools/clippy/clippy_lints/src/needless_pass_by_ref_mut.rs index a5b58f9910ad..a450dee30500 100644 --- a/src/tools/clippy/clippy_lints/src/needless_pass_by_ref_mut.rs +++ b/src/tools/clippy/clippy_lints/src/needless_pass_by_ref_mut.rs @@ -112,10 +112,7 @@ fn check_closures<'tcx>( } ctx.prev_bind = None; ctx.prev_move_to_closure.clear(); - if let Some(body) = cx - .tcx - .opt_hir_node_by_def_id(closure) - .and_then(associated_body) + if let Some(body) = associated_body(cx.tcx.hir_node_by_def_id(closure)) .map(|(_, body_id)| hir.body(body_id)) { euv::ExprUseVisitor::new(ctx, infcx, closure, cx.param_env, cx.typeck_results()).consume_body(body); diff --git a/src/tools/clippy/clippy_lints/src/self_named_constructors.rs b/src/tools/clippy/clippy_lints/src/self_named_constructors.rs index fc5a45dd56d6..85a2b1a67352 100644 --- a/src/tools/clippy/clippy_lints/src/self_named_constructors.rs +++ b/src/tools/clippy/clippy_lints/src/self_named_constructors.rs @@ -72,8 +72,7 @@ impl<'tcx> LateLintPass<'tcx> for SelfNamedConstructors { if let Some(self_def) = self_ty.ty_adt_def() && let Some(self_local_did) = self_def.did().as_local() - && let self_id = cx.tcx.local_def_id_to_hir_id(self_local_did) - && let Node::Item(x) = cx.tcx.hir_node(self_id) + && let Node::Item(x) = cx.tcx.hir_node_by_def_id(self_local_did) && let type_name = x.ident.name.as_str().to_lowercase() && (impl_item.ident.name.as_str() == type_name || impl_item.ident.name.as_str().replace('_', "") == type_name) diff --git a/src/tools/clippy/clippy_lints/src/single_call_fn.rs b/src/tools/clippy/clippy_lints/src/single_call_fn.rs index 223cbb3fae10..2ce7e714c642 100644 --- a/src/tools/clippy/clippy_lints/src/single_call_fn.rs +++ b/src/tools/clippy/clippy_lints/src/single_call_fn.rs @@ -95,7 +95,7 @@ impl SingleCallFn { /// to be considered. fn is_valid_item_kind(cx: &LateContext<'_>, def_id: LocalDefId) -> bool { matches!( - cx.tcx.hir_node(cx.tcx.local_def_id_to_hir_id(def_id)), + cx.tcx.hir_node_by_def_id(def_id), Node::Item(_) | Node::ImplItem(_) | Node::TraitItem(_) ) } diff --git a/src/tools/clippy/clippy_lints/src/types/mod.rs b/src/tools/clippy/clippy_lints/src/types/mod.rs index 7882bfdd09fa..bdef82e9c5ee 100644 --- a/src/tools/clippy/clippy_lints/src/types/mod.rs +++ b/src/tools/clippy/clippy_lints/src/types/mod.rs @@ -321,7 +321,7 @@ impl<'tcx> LateLintPass<'tcx> for Types { _: Span, def_id: LocalDefId, ) { - let is_in_trait_impl = if let Some(hir::Node::Item(item)) = cx.tcx.opt_hir_node_by_def_id( + let is_in_trait_impl = if let hir::Node::Item(item) = cx.tcx.hir_node_by_def_id( cx.tcx .hir() .get_parent_item(cx.tcx.local_def_id_to_hir_id(def_id)) @@ -366,9 +366,9 @@ impl<'tcx> LateLintPass<'tcx> for Types { fn check_impl_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx ImplItem<'tcx>) { match item.kind { ImplItemKind::Const(ty, _) => { - let is_in_trait_impl = if let Some(hir::Node::Item(item)) = cx + let is_in_trait_impl = if let hir::Node::Item(item) = cx .tcx - .opt_hir_node_by_def_id(cx.tcx.hir().get_parent_item(item.hir_id()).def_id) + .hir_node_by_def_id(cx.tcx.hir().get_parent_item(item.hir_id()).def_id) { matches!(item.kind, ItemKind::Impl(hir::Impl { of_trait: Some(_), .. })) } else { diff --git a/src/tools/clippy/clippy_lints/src/zero_sized_map_values.rs b/src/tools/clippy/clippy_lints/src/zero_sized_map_values.rs index 81d4a26e9da4..4aaf3b0a0b67 100644 --- a/src/tools/clippy/clippy_lints/src/zero_sized_map_values.rs +++ b/src/tools/clippy/clippy_lints/src/zero_sized_map_values.rs @@ -74,7 +74,7 @@ impl LateLintPass<'_> for ZeroSizedMapValues { fn in_trait_impl(cx: &LateContext<'_>, hir_id: HirId) -> bool { let parent_id = cx.tcx.hir().get_parent_item(hir_id); let second_parent_id = cx.tcx.hir().get_parent_item(parent_id.into()).def_id; - if let Some(Node::Item(item)) = cx.tcx.opt_hir_node_by_def_id(second_parent_id) { + if let Node::Item(item) = cx.tcx.hir_node_by_def_id(second_parent_id) { if let ItemKind::Impl(hir::Impl { of_trait: Some(_), .. }) = item.kind { return true; } diff --git a/src/tools/clippy/clippy_utils/src/lib.rs b/src/tools/clippy/clippy_utils/src/lib.rs index 708037a46555..1cf896d74345 100644 --- a/src/tools/clippy/clippy_utils/src/lib.rs +++ b/src/tools/clippy/clippy_utils/src/lib.rs @@ -330,8 +330,7 @@ pub fn is_trait_method(cx: &LateContext<'_>, expr: &Expr<'_>, diag_item: Symbol) /// Checks if the `def_id` belongs to a function that is part of a trait impl. pub fn is_def_id_trait_method(cx: &LateContext<'_>, def_id: LocalDefId) -> bool { - if let Some(hir_id) = cx.tcx.opt_local_def_id_to_hir_id(def_id) - && let Node::Item(item) = cx.tcx.parent_hir_node(hir_id) + if let Node::Item(item) = cx.tcx.parent_hir_node(cx.tcx.local_def_id_to_hir_id(def_id)) && let ItemKind::Impl(imp) = item.kind { imp.of_trait.is_some() @@ -574,12 +573,12 @@ fn local_item_children_by_name(tcx: TyCtxt<'_>, local_id: LocalDefId, name: Symb let hir = tcx.hir(); let root_mod; - let item_kind = match tcx.opt_hir_node_by_def_id(local_id) { - Some(Node::Crate(r#mod)) => { + let item_kind = match tcx.hir_node_by_def_id(local_id) { + Node::Crate(r#mod) => { root_mod = ItemKind::Mod(r#mod); &root_mod }, - Some(Node::Item(item)) => &item.kind, + Node::Item(item) => &item.kind, _ => return Vec::new(), }; @@ -1254,12 +1253,10 @@ pub fn is_in_panic_handler(cx: &LateContext<'_>, e: &Expr<'_>) -> bool { /// Gets the name of the item the expression is in, if available. pub fn get_item_name(cx: &LateContext<'_>, expr: &Expr<'_>) -> Option { let parent_id = cx.tcx.hir().get_parent_item(expr.hir_id).def_id; - match cx.tcx.opt_hir_node_by_def_id(parent_id) { - Some( - Node::Item(Item { ident, .. }) - | Node::TraitItem(TraitItem { ident, .. }) - | Node::ImplItem(ImplItem { ident, .. }), - ) => Some(ident.name), + match cx.tcx.hir_node_by_def_id(parent_id) { + Node::Item(Item { ident, .. }) + | Node::TraitItem(TraitItem { ident, .. }) + | Node::ImplItem(ImplItem { ident, .. }) => Some(ident.name), _ => None, } } @@ -2667,11 +2664,10 @@ impl<'tcx> ExprUseNode<'tcx> { .and(Binder::dummy(cx.tcx.type_of(id).instantiate_identity())), )), Self::Return(id) => { - let hir_id = cx.tcx.local_def_id_to_hir_id(id.def_id); if let Node::Expr(Expr { kind: ExprKind::Closure(c), .. - }) = cx.tcx.hir_node(hir_id) + }) = cx.tcx.hir_node_by_def_id(id.def_id) { match c.fn_decl.output { FnRetTy::DefaultReturn(_) => None, From 87ced1561ff66f7e19c8e564f9d85383543c8999 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=AE=B8=E6=9D=B0=E5=8F=8B=20Jieyou=20Xu=20=28Joe=29?= Date: Thu, 14 Mar 2024 19:37:41 +0000 Subject: [PATCH 064/103] Pass the correct DefId when suggesting writing the aliased Self type out --- compiler/rustc_hir_typeck/src/demand.rs | 2 +- .../ice-self-mismatch-const-generics.rs | 25 +++++++++++++ .../ice-self-mismatch-const-generics.stderr | 37 +++++++++++++++++++ 3 files changed, 63 insertions(+), 1 deletion(-) create mode 100644 tests/ui/typeck/ice-self-mismatch-const-generics.rs create mode 100644 tests/ui/typeck/ice-self-mismatch-const-generics.stderr diff --git a/compiler/rustc_hir_typeck/src/demand.rs b/compiler/rustc_hir_typeck/src/demand.rs index 71da65543403..67ff412651c2 100644 --- a/compiler/rustc_hir_typeck/src/demand.rs +++ b/compiler/rustc_hir_typeck/src/demand.rs @@ -1071,7 +1071,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { err.span_suggestion_verbose( *span, "use the type name directly", - self.tcx.value_path_str_with_args(*alias_to, e_args), + self.tcx.value_path_str_with_args(e_def.did(), e_args), Applicability::MaybeIncorrect, ); } diff --git a/tests/ui/typeck/ice-self-mismatch-const-generics.rs b/tests/ui/typeck/ice-self-mismatch-const-generics.rs new file mode 100644 index 000000000000..43f435ba4cf1 --- /dev/null +++ b/tests/ui/typeck/ice-self-mismatch-const-generics.rs @@ -0,0 +1,25 @@ +// Checks that the following does not ICE when constructing type mismatch diagnostic involving +// `Self` and const generics. +// Issue: + +pub struct GenericStruct { + thing: T, +} + +impl GenericStruct<0, T> { + pub fn new(thing: T) -> GenericStruct<1, T> { + Self { thing } + //~^ ERROR mismatched types + } +} + +pub struct GenericStruct2(T); + +impl GenericStruct2<0, T> { + pub fn new(thing: T) -> GenericStruct2<1, T> { + Self { 0: thing } + //~^ ERROR mismatched types + } +} + +fn main() {} diff --git a/tests/ui/typeck/ice-self-mismatch-const-generics.stderr b/tests/ui/typeck/ice-self-mismatch-const-generics.stderr new file mode 100644 index 000000000000..c502ea4565f6 --- /dev/null +++ b/tests/ui/typeck/ice-self-mismatch-const-generics.stderr @@ -0,0 +1,37 @@ +error[E0308]: mismatched types + --> $DIR/ice-self-mismatch-const-generics.rs:11:9 + | +LL | impl GenericStruct<0, T> { + | ------------------- this is the type of the `Self` literal +LL | pub fn new(thing: T) -> GenericStruct<1, T> { + | ------------------- expected `GenericStruct<1, T>` because of return type +LL | Self { thing } + | ^^^^^^^^^^^^^^ expected `1`, found `0` + | + = note: expected struct `GenericStruct<_, 1>` + found struct `GenericStruct<_, 0>` +help: use the type name directly + | +LL | GenericStruct::<1, T> { thing } + | ~~~~~~~~~~~~~~~~~~~~~ + +error[E0308]: mismatched types + --> $DIR/ice-self-mismatch-const-generics.rs:20:9 + | +LL | impl GenericStruct2<0, T> { + | -------------------- this is the type of the `Self` literal +LL | pub fn new(thing: T) -> GenericStruct2<1, T> { + | -------------------- expected `GenericStruct2<1, T>` because of return type +LL | Self { 0: thing } + | ^^^^^^^^^^^^^^^^^ expected `1`, found `0` + | + = note: expected struct `GenericStruct2<_, 1>` + found struct `GenericStruct2<_, 0>` +help: use the type name directly + | +LL | GenericStruct2::<1, T> { 0: thing } + | ~~~~~~~~~~~~~~~~~~~~~~ + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0308`. From 48f2f0d725e6d484af24e4666992cc66b6a31ebd Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Thu, 14 Mar 2024 08:09:21 +0100 Subject: [PATCH 065/103] preserve span when evaluating mir::ConstOperand --- .../src/dataflow_const_prop.rs | 4 +- .../rustc_mir_transform/src/jump_threading.rs | 3 +- compiler/rustc_monomorphize/src/collector.rs | 7 ++- compiler/rustc_smir/src/rustc_smir/builder.rs | 2 +- .../ui/consts/assoc_const_generic_impl.stderr | 6 +++ .../index-out-of-bounds-never-type.stderr | 6 +++ .../const-eval/issue-50814-2.mir-opt.stderr | 46 +++++++++++++++++++ .../const-eval/issue-50814-2.normal.stderr | 14 ++++++ tests/ui/consts/const-eval/issue-50814.stderr | 14 ++++++ tests/ui/consts/const-eval/issue-85155.stderr | 8 ++++ .../collect-in-called-fn.noopt.stderr | 6 +++ .../collect-in-called-fn.opt.stderr | 6 +++ .../collect-in-dead-drop.noopt.stderr | 6 +++ .../collect-in-dead-fn.noopt.stderr | 6 +++ .../collect-in-dead-move.noopt.stderr | 6 +++ .../collect-in-dead-vtable.noopt.stderr | 6 +++ .../post_monomorphization_error_backtrace.rs | 3 ++ ...st_monomorphization_error_backtrace.stderr | 18 +++++++- .../const-expr-generic-err.stderr | 20 ++++++++ tests/ui/inline-const/required-const.stderr | 6 +++ .../ui/simd/const-err-trumps-simd-err.stderr | 6 +++ 21 files changed, 192 insertions(+), 7 deletions(-) diff --git a/compiler/rustc_mir_transform/src/dataflow_const_prop.rs b/compiler/rustc_mir_transform/src/dataflow_const_prop.rs index c3e932fe1872..f456196b2822 100644 --- a/compiler/rustc_mir_transform/src/dataflow_const_prop.rs +++ b/compiler/rustc_mir_transform/src/dataflow_const_prop.rs @@ -393,7 +393,9 @@ impl<'a, 'tcx> ConstAnalysis<'a, 'tcx> { } } Operand::Constant(box constant) => { - if let Ok(constant) = self.ecx.eval_mir_constant(&constant.const_, None, None) { + if let Ok(constant) = + self.ecx.eval_mir_constant(&constant.const_, Some(constant.span), None) + { self.assign_constant(state, place, constant, &[]); } } diff --git a/compiler/rustc_mir_transform/src/jump_threading.rs b/compiler/rustc_mir_transform/src/jump_threading.rs index ad8f21ffbdaa..6629face9404 100644 --- a/compiler/rustc_mir_transform/src/jump_threading.rs +++ b/compiler/rustc_mir_transform/src/jump_threading.rs @@ -416,7 +416,8 @@ impl<'tcx, 'a> TOFinder<'tcx, 'a> { match rhs { // If we expect `lhs ?= A`, we have an opportunity if we assume `constant == A`. Operand::Constant(constant) => { - let constant = self.ecx.eval_mir_constant(&constant.const_, None, None).ok()?; + let constant = + self.ecx.eval_mir_constant(&constant.const_, Some(constant.span), None).ok()?; self.process_constant(bb, lhs, constant, state); } // Transfer the conditions on the copied rhs. diff --git a/compiler/rustc_monomorphize/src/collector.rs b/compiler/rustc_monomorphize/src/collector.rs index 2465f9fbfa8b..cd9eb4916ce5 100644 --- a/compiler/rustc_monomorphize/src/collector.rs +++ b/compiler/rustc_monomorphize/src/collector.rs @@ -828,14 +828,17 @@ impl<'a, 'tcx> MirVisitor<'tcx> for MirUsedCollector<'a, 'tcx> { // a codegen-time error). rustc stops after collection if there was an error, so this // ensures codegen never has to worry about failing consts. // (codegen relies on this and ICEs will happen if this is violated.) - let val = match const_.eval(self.tcx, param_env, None) { + let val = match const_.eval(self.tcx, param_env, Some(constant.span)) { Ok(v) => v, - Err(ErrorHandled::Reported(..)) => return, Err(ErrorHandled::TooGeneric(..)) => span_bug!( self.body.source_info(location).span, "collection encountered polymorphic constant: {:?}", const_ ), + Err(err @ ErrorHandled::Reported(..)) => { + err.emit_note(self.tcx); + return; + } }; collect_const_value(self.tcx, val, self.output); MirVisitor::visit_ty(self, const_.ty(), TyContext::Location(location)); diff --git a/compiler/rustc_smir/src/rustc_smir/builder.rs b/compiler/rustc_smir/src/rustc_smir/builder.rs index 039bdec4c78a..a13262cdcc49 100644 --- a/compiler/rustc_smir/src/rustc_smir/builder.rs +++ b/compiler/rustc_smir/src/rustc_smir/builder.rs @@ -56,7 +56,7 @@ impl<'tcx> MutVisitor<'tcx> for BodyBuilder<'tcx> { fn visit_constant(&mut self, constant: &mut mir::ConstOperand<'tcx>, location: mir::Location) { let const_ = self.monomorphize(constant.const_); - let val = match const_.eval(self.tcx, ty::ParamEnv::reveal_all(), None) { + let val = match const_.eval(self.tcx, ty::ParamEnv::reveal_all(), Some(constant.span)) { Ok(v) => v, Err(mir::interpret::ErrorHandled::Reported(..)) => return, Err(mir::interpret::ErrorHandled::TooGeneric(..)) => { diff --git a/tests/ui/consts/assoc_const_generic_impl.stderr b/tests/ui/consts/assoc_const_generic_impl.stderr index d826972ce9f5..452195083967 100644 --- a/tests/ui/consts/assoc_const_generic_impl.stderr +++ b/tests/ui/consts/assoc_const_generic_impl.stderr @@ -4,6 +4,12 @@ error[E0080]: evaluation of `::I_AM_ZERO_SIZED` failed LL | const I_AM_ZERO_SIZED: () = [()][std::mem::size_of::()]; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ index out of bounds: the length is 1 but the index is 4 +note: erroneous constant encountered + --> $DIR/assoc_const_generic_impl.rs:11:9 + | +LL | Self::I_AM_ZERO_SIZED; + | ^^^^^^^^^^^^^^^^^^^^^ + note: the above error was encountered while instantiating `fn ::requires_zero_size` --> $DIR/assoc_const_generic_impl.rs:18:5 | diff --git a/tests/ui/consts/const-eval/index-out-of-bounds-never-type.stderr b/tests/ui/consts/const-eval/index-out-of-bounds-never-type.stderr index 4e7ef52f674a..7facb2d1a5ca 100644 --- a/tests/ui/consts/const-eval/index-out-of-bounds-never-type.stderr +++ b/tests/ui/consts/const-eval/index-out-of-bounds-never-type.stderr @@ -4,6 +4,12 @@ error[E0080]: evaluation of `PrintName::<()>::VOID` failed LL | const VOID: ! = { let x = 0 * std::mem::size_of::(); [][x] }; | ^^^^^ index out of bounds: the length is 0 but the index is 0 +note: erroneous constant encountered + --> $DIR/index-out-of-bounds-never-type.rs:16:13 + | +LL | let _ = PrintName::::VOID; + | ^^^^^^^^^^^^^^^^^^^^ + note: the above error was encountered while instantiating `fn f::<()>` --> $DIR/index-out-of-bounds-never-type.rs:20:5 | diff --git a/tests/ui/consts/const-eval/issue-50814-2.mir-opt.stderr b/tests/ui/consts/const-eval/issue-50814-2.mir-opt.stderr index 7e764ca72390..2de68d3fee9e 100644 --- a/tests/ui/consts/const-eval/issue-50814-2.mir-opt.stderr +++ b/tests/ui/consts/const-eval/issue-50814-2.mir-opt.stderr @@ -10,6 +10,52 @@ note: erroneous constant encountered LL | & as Foo>::BAR | ^^^^^^^^^^^^^^^^^^^^^ +note: erroneous constant encountered + --> $DIR/issue-50814-2.rs:20:5 + | +LL | & as Foo>::BAR + | ^^^^^^^^^^^^^^^^^^^^^^ + +note: erroneous constant encountered + --> $DIR/issue-50814-2.rs:20:5 + | +LL | & as Foo>::BAR + | ^^^^^^^^^^^^^^^^^^^^^^ + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +note: erroneous constant encountered + --> $DIR/issue-50814-2.rs:20:5 + | +LL | & as Foo>::BAR + | ^^^^^^^^^^^^^^^^^^^^^^ + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +note: erroneous constant encountered + --> $DIR/issue-50814-2.rs:20:5 + | +LL | & as Foo>::BAR + | ^^^^^^^^^^^^^^^^^^^^^^ + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +note: erroneous constant encountered + --> $DIR/issue-50814-2.rs:20:6 + | +LL | & as Foo>::BAR + | ^^^^^^^^^^^^^^^^^^^^^ + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +note: erroneous constant encountered + --> $DIR/issue-50814-2.rs:20:6 + | +LL | & as Foo>::BAR + | ^^^^^^^^^^^^^^^^^^^^^ + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0080`. diff --git a/tests/ui/consts/const-eval/issue-50814-2.normal.stderr b/tests/ui/consts/const-eval/issue-50814-2.normal.stderr index f552c8fde5bc..4a7dfb193044 100644 --- a/tests/ui/consts/const-eval/issue-50814-2.normal.stderr +++ b/tests/ui/consts/const-eval/issue-50814-2.normal.stderr @@ -10,6 +10,20 @@ note: erroneous constant encountered LL | & as Foo>::BAR | ^^^^^^^^^^^^^^^^^^^^^ +note: erroneous constant encountered + --> $DIR/issue-50814-2.rs:20:5 + | +LL | & as Foo>::BAR + | ^^^^^^^^^^^^^^^^^^^^^^ + +note: erroneous constant encountered + --> $DIR/issue-50814-2.rs:20:6 + | +LL | & as Foo>::BAR + | ^^^^^^^^^^^^^^^^^^^^^ + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + note: the above error was encountered while instantiating `fn foo::<()>` --> $DIR/issue-50814-2.rs:32:22 | diff --git a/tests/ui/consts/const-eval/issue-50814.stderr b/tests/ui/consts/const-eval/issue-50814.stderr index 8d0181614015..fe0e25b820f5 100644 --- a/tests/ui/consts/const-eval/issue-50814.stderr +++ b/tests/ui/consts/const-eval/issue-50814.stderr @@ -26,6 +26,20 @@ LL | &Sum::::MAX | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +note: erroneous constant encountered + --> $DIR/issue-50814.rs:21:5 + | +LL | &Sum::::MAX + | ^^^^^^^^^^^^^^^^^^^ + +note: erroneous constant encountered + --> $DIR/issue-50814.rs:21:6 + | +LL | &Sum::::MAX + | ^^^^^^^^^^^^^^^^^^ + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + note: the above error was encountered while instantiating `fn foo::` --> $DIR/issue-50814.rs:26:5 | diff --git a/tests/ui/consts/const-eval/issue-85155.stderr b/tests/ui/consts/const-eval/issue-85155.stderr index a88e959a8a65..99836a3fac6d 100644 --- a/tests/ui/consts/const-eval/issue-85155.stderr +++ b/tests/ui/consts/const-eval/issue-85155.stderr @@ -4,6 +4,14 @@ error[E0080]: evaluation of `post_monomorphization_error::ValidateConstImm::<2, LL | let _ = 1 / ((IMM >= MIN && IMM <= MAX) as usize); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attempt to divide `1_usize` by zero +note: erroneous constant encountered + --> $DIR/auxiliary/post_monomorphization_error.rs:19:5 + | +LL | static_assert_imm1!(IMM1); + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: this note originates in the macro `static_assert_imm1` (in Nightly builds, run with -Z macro-backtrace for more info) + note: the above error was encountered while instantiating `fn post_monomorphization_error::stdarch_intrinsic::<2>` --> $DIR/issue-85155.rs:19:5 | diff --git a/tests/ui/consts/required-consts/collect-in-called-fn.noopt.stderr b/tests/ui/consts/required-consts/collect-in-called-fn.noopt.stderr index c7ff1328917f..14a4cb0217f9 100644 --- a/tests/ui/consts/required-consts/collect-in-called-fn.noopt.stderr +++ b/tests/ui/consts/required-consts/collect-in-called-fn.noopt.stderr @@ -6,6 +6,12 @@ LL | const C: () = panic!(); | = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) +note: erroneous constant encountered + --> $DIR/collect-in-called-fn.rs:18:17 + | +LL | let _ = Fail::::C; + | ^^^^^^^^^^^^ + note: the above error was encountered while instantiating `fn called::` --> $DIR/collect-in-called-fn.rs:23:5 | diff --git a/tests/ui/consts/required-consts/collect-in-called-fn.opt.stderr b/tests/ui/consts/required-consts/collect-in-called-fn.opt.stderr index c7ff1328917f..14a4cb0217f9 100644 --- a/tests/ui/consts/required-consts/collect-in-called-fn.opt.stderr +++ b/tests/ui/consts/required-consts/collect-in-called-fn.opt.stderr @@ -6,6 +6,12 @@ LL | const C: () = panic!(); | = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) +note: erroneous constant encountered + --> $DIR/collect-in-called-fn.rs:18:17 + | +LL | let _ = Fail::::C; + | ^^^^^^^^^^^^ + note: the above error was encountered while instantiating `fn called::` --> $DIR/collect-in-called-fn.rs:23:5 | diff --git a/tests/ui/consts/required-consts/collect-in-dead-drop.noopt.stderr b/tests/ui/consts/required-consts/collect-in-dead-drop.noopt.stderr index b7010e787633..0bf231d09f17 100644 --- a/tests/ui/consts/required-consts/collect-in-dead-drop.noopt.stderr +++ b/tests/ui/consts/required-consts/collect-in-dead-drop.noopt.stderr @@ -6,6 +6,12 @@ LL | const C: () = panic!(); | = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) +note: erroneous constant encountered + --> $DIR/collect-in-dead-drop.rs:19:17 + | +LL | let _ = Fail::::C; + | ^^^^^^^^^^^^ + note: the above error was encountered while instantiating `fn as std::ops::Drop>::drop` --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL diff --git a/tests/ui/consts/required-consts/collect-in-dead-fn.noopt.stderr b/tests/ui/consts/required-consts/collect-in-dead-fn.noopt.stderr index 2162c35c8370..8bb99efe8e48 100644 --- a/tests/ui/consts/required-consts/collect-in-dead-fn.noopt.stderr +++ b/tests/ui/consts/required-consts/collect-in-dead-fn.noopt.stderr @@ -6,6 +6,12 @@ LL | const C: () = panic!(); | = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) +note: erroneous constant encountered + --> $DIR/collect-in-dead-fn.rs:22:17 + | +LL | let _ = Fail::::C; + | ^^^^^^^^^^^^ + note: the above error was encountered while instantiating `fn not_called::` --> $DIR/collect-in-dead-fn.rs:29:9 | diff --git a/tests/ui/consts/required-consts/collect-in-dead-move.noopt.stderr b/tests/ui/consts/required-consts/collect-in-dead-move.noopt.stderr index 8c853127e044..5b1df78b2326 100644 --- a/tests/ui/consts/required-consts/collect-in-dead-move.noopt.stderr +++ b/tests/ui/consts/required-consts/collect-in-dead-move.noopt.stderr @@ -6,6 +6,12 @@ LL | const C: () = panic!(); | = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) +note: erroneous constant encountered + --> $DIR/collect-in-dead-move.rs:19:17 + | +LL | let _ = Fail::::C; + | ^^^^^^^^^^^^ + note: the above error was encountered while instantiating `fn as std::ops::Drop>::drop` --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL diff --git a/tests/ui/consts/required-consts/collect-in-dead-vtable.noopt.stderr b/tests/ui/consts/required-consts/collect-in-dead-vtable.noopt.stderr index 6fd82777bd36..56b6989b441e 100644 --- a/tests/ui/consts/required-consts/collect-in-dead-vtable.noopt.stderr +++ b/tests/ui/consts/required-consts/collect-in-dead-vtable.noopt.stderr @@ -6,6 +6,12 @@ LL | const C: () = panic!(); | = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) +note: erroneous constant encountered + --> $DIR/collect-in-dead-vtable.rs:26:21 + | +LL | let _ = Fail::::C; + | ^^^^^^^^^^^^ + note: the above error was encountered while instantiating `fn as MyTrait>::not_called` --> $DIR/collect-in-dead-vtable.rs:35:40 | diff --git a/tests/ui/generics/post_monomorphization_error_backtrace.rs b/tests/ui/generics/post_monomorphization_error_backtrace.rs index 56155ae2bd5f..2c18f2b233ad 100644 --- a/tests/ui/generics/post_monomorphization_error_backtrace.rs +++ b/tests/ui/generics/post_monomorphization_error_backtrace.rs @@ -12,6 +12,9 @@ fn assert_zst() { //~| NOTE: the evaluated program panicked } F::::V; + //~^NOTE: erroneous constant + //~|NOTE: erroneous constant + //~|NOTE: duplicate } fn foo() { diff --git a/tests/ui/generics/post_monomorphization_error_backtrace.stderr b/tests/ui/generics/post_monomorphization_error_backtrace.stderr index 0d707d83d266..8a57979bca7d 100644 --- a/tests/ui/generics/post_monomorphization_error_backtrace.stderr +++ b/tests/ui/generics/post_monomorphization_error_backtrace.stderr @@ -6,8 +6,14 @@ LL | const V: () = assert!(std::mem::size_of::() == 0); | = note: this error originates in the macro `assert` (in Nightly builds, run with -Z macro-backtrace for more info) +note: erroneous constant encountered + --> $DIR/post_monomorphization_error_backtrace.rs:14:5 + | +LL | F::::V; + | ^^^^^^^^^ + note: the above error was encountered while instantiating `fn assert_zst::` - --> $DIR/post_monomorphization_error_backtrace.rs:18:5 + --> $DIR/post_monomorphization_error_backtrace.rs:21:5 | LL | assert_zst::() | ^^^^^^^^^^^^^^^^^ @@ -20,8 +26,16 @@ LL | const V: () = assert!(std::mem::size_of::() == 0); | = note: this error originates in the macro `assert` (in Nightly builds, run with -Z macro-backtrace for more info) +note: erroneous constant encountered + --> $DIR/post_monomorphization_error_backtrace.rs:14:5 + | +LL | F::::V; + | ^^^^^^^^^ + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + note: the above error was encountered while instantiating `fn assert_zst::` - --> $DIR/post_monomorphization_error_backtrace.rs:18:5 + --> $DIR/post_monomorphization_error_backtrace.rs:21:5 | LL | assert_zst::() | ^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/inline-const/const-expr-generic-err.stderr b/tests/ui/inline-const/const-expr-generic-err.stderr index fc0b6cc44516..7331c7f18e97 100644 --- a/tests/ui/inline-const/const-expr-generic-err.stderr +++ b/tests/ui/inline-const/const-expr-generic-err.stderr @@ -6,6 +6,12 @@ LL | const { assert!(std::mem::size_of::() == 0); } | = note: this error originates in the macro `assert` (in Nightly builds, run with -Z macro-backtrace for more info) +note: erroneous constant encountered + --> $DIR/const-expr-generic-err.rs:5:5 + | +LL | const { assert!(std::mem::size_of::() == 0); } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + note: the above error was encountered while instantiating `fn foo::` --> $DIR/const-expr-generic-err.rs:13:5 | @@ -18,6 +24,20 @@ error[E0080]: evaluation of `bar::<0>::{constant#0}` failed LL | const { N - 1 } | ^^^^^ attempt to compute `0_usize - 1_usize`, which would overflow +note: erroneous constant encountered + --> $DIR/const-expr-generic-err.rs:9:5 + | +LL | const { N - 1 } + | ^^^^^^^^^^^^^^^ + +note: erroneous constant encountered + --> $DIR/const-expr-generic-err.rs:9:5 + | +LL | const { N - 1 } + | ^^^^^^^^^^^^^^^ + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + note: the above error was encountered while instantiating `fn bar::<0>` --> $DIR/const-expr-generic-err.rs:14:5 | diff --git a/tests/ui/inline-const/required-const.stderr b/tests/ui/inline-const/required-const.stderr index cd86020184dd..2a13d18547c5 100644 --- a/tests/ui/inline-const/required-const.stderr +++ b/tests/ui/inline-const/required-const.stderr @@ -6,6 +6,12 @@ LL | const { panic!() } | = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) +note: erroneous constant encountered + --> $DIR/required-const.rs:7:9 + | +LL | const { panic!() } + | ^^^^^^^^^^^^^^^^^^ + error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0080`. diff --git a/tests/ui/simd/const-err-trumps-simd-err.stderr b/tests/ui/simd/const-err-trumps-simd-err.stderr index 6e6aba8b6f18..1e46667cf4e2 100644 --- a/tests/ui/simd/const-err-trumps-simd-err.stderr +++ b/tests/ui/simd/const-err-trumps-simd-err.stderr @@ -6,6 +6,12 @@ LL | const { assert!(LANE < 4); } // the error should be here... | = note: this error originates in the macro `assert` (in Nightly builds, run with -Z macro-backtrace for more info) +note: erroneous constant encountered + --> $DIR/const-err-trumps-simd-err.rs:16:5 + | +LL | const { assert!(LANE < 4); } // the error should be here... + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + note: the above error was encountered while instantiating `fn get_elem::<4>` --> $DIR/const-err-trumps-simd-err.rs:23:5 | From 571f945713468f24e4f937d48828d1d8155911f2 Mon Sep 17 00:00:00 2001 From: Michael Goulet Date: Thu, 14 Mar 2024 20:30:57 -0400 Subject: [PATCH 066/103] Ensure RPITITs are created before def-id freezing --- compiler/rustc_hir_analysis/src/collect.rs | 2 ++ .../ensure-rpitits-are-created-before-freezing.rs | 13 +++++++++++++ ...nsure-rpitits-are-created-before-freezing.stderr | 9 +++++++++ 3 files changed, 24 insertions(+) create mode 100644 tests/ui/impl-trait/in-trait/ensure-rpitits-are-created-before-freezing.rs create mode 100644 tests/ui/impl-trait/in-trait/ensure-rpitits-are-created-before-freezing.stderr diff --git a/compiler/rustc_hir_analysis/src/collect.rs b/compiler/rustc_hir_analysis/src/collect.rs index 10922d534792..5cd6862786b4 100644 --- a/compiler/rustc_hir_analysis/src/collect.rs +++ b/compiler/rustc_hir_analysis/src/collect.rs @@ -595,12 +595,14 @@ fn convert_item(tcx: TyCtxt<'_>, item_id: hir::ItemId) { tcx.ensure().type_of(def_id); tcx.ensure().impl_trait_header(def_id); tcx.ensure().predicates_of(def_id); + tcx.ensure().associated_items(def_id); } hir::ItemKind::Trait(..) => { tcx.ensure().generics_of(def_id); tcx.ensure().trait_def(def_id); tcx.at(it.span).super_predicates_of(def_id); tcx.ensure().predicates_of(def_id); + tcx.ensure().associated_items(def_id); } hir::ItemKind::TraitAlias(..) => { tcx.ensure().generics_of(def_id); diff --git a/tests/ui/impl-trait/in-trait/ensure-rpitits-are-created-before-freezing.rs b/tests/ui/impl-trait/in-trait/ensure-rpitits-are-created-before-freezing.rs new file mode 100644 index 000000000000..35a6acca52c7 --- /dev/null +++ b/tests/ui/impl-trait/in-trait/ensure-rpitits-are-created-before-freezing.rs @@ -0,0 +1,13 @@ +trait Iterable { + type Item; + fn iter(&self) -> impl Sized; +} + +// `ty::Error` in a trait ref will silence any missing item errors, but will also +// prevent the `associated_items` query from being called before def ids are frozen. +impl Iterable for Missing { +//~^ ERROR cannot find type `Missing` in this scope + fn iter(&self) -> Self::Item {} +} + +fn main() {} diff --git a/tests/ui/impl-trait/in-trait/ensure-rpitits-are-created-before-freezing.stderr b/tests/ui/impl-trait/in-trait/ensure-rpitits-are-created-before-freezing.stderr new file mode 100644 index 000000000000..c172787e6ef2 --- /dev/null +++ b/tests/ui/impl-trait/in-trait/ensure-rpitits-are-created-before-freezing.stderr @@ -0,0 +1,9 @@ +error[E0412]: cannot find type `Missing` in this scope + --> $DIR/ensure-rpitits-are-created-before-freezing.rs:8:19 + | +LL | impl Iterable for Missing { + | ^^^^^^^ not found in this scope + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0412`. From cac0b121b6ab5a3a2f34cd458d755bda503e619b Mon Sep 17 00:00:00 2001 From: Zalathar Date: Fri, 15 Mar 2024 12:33:32 +1100 Subject: [PATCH 067/103] Docs for `thir::ExprKind::Use` and `thir::ExprKind::Let` --- compiler/rustc_middle/src/thir.rs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/compiler/rustc_middle/src/thir.rs b/compiler/rustc_middle/src/thir.rs index 74b47d8b04e6..96a61883cc14 100644 --- a/compiler/rustc_middle/src/thir.rs +++ b/compiler/rustc_middle/src/thir.rs @@ -321,9 +321,13 @@ pub enum ExprKind<'tcx> { Cast { source: ExprId, }, + /// Forces its contents to be treated as a value expression, not a place + /// expression. This is inserted in some places where an operation would + /// otherwise be erased completely (e.g. some no-op casts), but we still + /// need to ensure that its operand is treated as a value and not a place. Use { source: ExprId, - }, // Use a lexpr to get a vexpr. + }, /// A coercion from `!` to any type. NeverToAny { source: ExprId, @@ -338,6 +342,13 @@ pub enum ExprKind<'tcx> { Loop { body: ExprId, }, + /// Special expression representing the `let` part of an `if let` or similar construct + /// (including `if let` guards in match arms, and let-chains formed by `&&`). + /// + /// This isn't considered a real expression in surface Rust syntax, so it can + /// only appear in specific situations, such as within the condition of an `if`. + /// + /// (Not to be confused with [`StmtKind::Let`], which is a normal `let` statement.) Let { expr: ExprId, pat: Box>, From 5beda81b71509175f1661361a56eb8306b730639 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Le=C3=B3n=20Orell=20Valerian=20Liehr?= Date: Fri, 15 Mar 2024 02:19:29 +0100 Subject: [PATCH 068/103] Clean up AstConv --- .../rustc_hir_analysis/src/astconv/errors.rs | 114 +++++++++++- .../src/astconv/generics.rs | 12 +- .../rustc_hir_analysis/src/astconv/lint.rs | 2 +- .../rustc_hir_analysis/src/astconv/mod.rs | 176 ++---------------- .../src/astconv/object_safety.rs | 2 +- .../rustc_hir_analysis/src/collect/type_of.rs | 3 +- compiler/rustc_hir_analysis/src/lib.rs | 37 +--- compiler/rustc_hir_typeck/src/closure.rs | 4 +- 8 files changed, 142 insertions(+), 208 deletions(-) diff --git a/compiler/rustc_hir_analysis/src/astconv/errors.rs b/compiler/rustc_hir_analysis/src/astconv/errors.rs index 6caba6ff23e5..37fbf45235a8 100644 --- a/compiler/rustc_hir_analysis/src/astconv/errors.rs +++ b/compiler/rustc_hir_analysis/src/astconv/errors.rs @@ -22,7 +22,7 @@ use rustc_span::symbol::{sym, Ident}; use rustc_span::{Span, Symbol, DUMMY_SP}; use rustc_trait_selection::traits::object_safety_violations_for_assoc_item; -impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { +impl<'tcx> dyn AstConv<'tcx> + '_ { /// On missing type parameters, emit an E0393 error and provide a structured suggestion using /// the type parameter's name as a placeholder. pub(crate) fn complain_about_missing_type_params( @@ -349,6 +349,118 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { }) } + pub(super) fn report_ambiguous_associated_type( + &self, + span: Span, + types: &[String], + traits: &[String], + name: Symbol, + ) -> ErrorGuaranteed { + let mut err = + struct_span_code_err!(self.tcx().dcx(), span, E0223, "ambiguous associated type"); + if self + .tcx() + .resolutions(()) + .confused_type_with_std_module + .keys() + .any(|full_span| full_span.contains(span)) + { + err.span_suggestion_verbose( + span.shrink_to_lo(), + "you are looking for the module in `std`, not the primitive type", + "std::", + Applicability::MachineApplicable, + ); + } else { + let mut types = types.to_vec(); + types.sort(); + let mut traits = traits.to_vec(); + traits.sort(); + match (&types[..], &traits[..]) { + ([], []) => { + err.span_suggestion_verbose( + span, + format!( + "if there were a type named `Type` that implements a trait named \ + `Trait` with associated type `{name}`, you could use the \ + fully-qualified path", + ), + format!("::{name}"), + Applicability::HasPlaceholders, + ); + } + ([], [trait_str]) => { + err.span_suggestion_verbose( + span, + format!( + "if there were a type named `Example` that implemented `{trait_str}`, \ + you could use the fully-qualified path", + ), + format!("::{name}"), + Applicability::HasPlaceholders, + ); + } + ([], traits) => { + err.span_suggestions( + span, + format!( + "if there were a type named `Example` that implemented one of the \ + traits with associated type `{name}`, you could use the \ + fully-qualified path", + ), + traits + .iter() + .map(|trait_str| format!("::{name}")) + .collect::>(), + Applicability::HasPlaceholders, + ); + } + ([type_str], []) => { + err.span_suggestion_verbose( + span, + format!( + "if there were a trait named `Example` with associated type `{name}` \ + implemented for `{type_str}`, you could use the fully-qualified path", + ), + format!("<{type_str} as Example>::{name}"), + Applicability::HasPlaceholders, + ); + } + (types, []) => { + err.span_suggestions( + span, + format!( + "if there were a trait named `Example` with associated type `{name}` \ + implemented for one of the types, you could use the fully-qualified \ + path", + ), + types + .into_iter() + .map(|type_str| format!("<{type_str} as Example>::{name}")), + Applicability::HasPlaceholders, + ); + } + (types, traits) => { + let mut suggestions = vec![]; + for type_str in types { + for trait_str in traits { + suggestions.push(format!("<{type_str} as {trait_str}>::{name}")); + } + } + err.span_suggestions( + span, + "use fully-qualified syntax", + suggestions, + Applicability::MachineApplicable, + ); + } + } + } + let reported = err.emit(); + self.set_tainted_by_errors(reported); + reported + } + pub(crate) fn complain_about_ambiguous_inherent_assoc_type( &self, name: Ident, diff --git a/compiler/rustc_hir_analysis/src/astconv/generics.rs b/compiler/rustc_hir_analysis/src/astconv/generics.rs index 63afa4f7e82d..428eea2f686e 100644 --- a/compiler/rustc_hir_analysis/src/astconv/generics.rs +++ b/compiler/rustc_hir_analysis/src/astconv/generics.rs @@ -409,15 +409,12 @@ pub fn check_generic_arg_count_for_call( seg: &hir::PathSegment<'_>, is_method_call: IsMethodCall, ) -> GenericArgCountResult { - let empty_args = hir::GenericArgs::none(); - let gen_args = seg.args.unwrap_or(&empty_args); let gen_pos = match is_method_call { IsMethodCall::Yes => GenericArgPosition::MethodCall, IsMethodCall::No => GenericArgPosition::Value, }; let has_self = generics.parent.is_none() && generics.has_self; - - check_generic_arg_count(tcx, def_id, seg, generics, gen_args, gen_pos, has_self, seg.infer_args) + check_generic_arg_count(tcx, def_id, seg, generics, gen_pos, has_self) } /// Checks that the correct number of generic arguments have been provided. @@ -428,11 +425,10 @@ pub(crate) fn check_generic_arg_count( def_id: DefId, seg: &hir::PathSegment<'_>, gen_params: &ty::Generics, - gen_args: &hir::GenericArgs<'_>, gen_pos: GenericArgPosition, has_self: bool, - infer_args: bool, ) -> GenericArgCountResult { + let gen_args = seg.args(); let default_counts = gen_params.own_defaults(); let param_counts = gen_params.own_counts(); @@ -453,7 +449,7 @@ pub(crate) fn check_generic_arg_count( .count(); let named_const_param_count = param_counts.consts - synth_const_param_count; let infer_lifetimes = - (gen_pos != GenericArgPosition::Type || infer_args) && !gen_args.has_lifetime_params(); + (gen_pos != GenericArgPosition::Type || seg.infer_args) && !gen_args.has_lifetime_params(); if gen_pos != GenericArgPosition::Type && let Some(b) = gen_args.bindings.first() @@ -586,7 +582,7 @@ pub(crate) fn check_generic_arg_count( }; let args_correct = { - let expected_min = if infer_args { + let expected_min = if seg.infer_args { 0 } else { param_counts.consts + named_type_param_count diff --git a/compiler/rustc_hir_analysis/src/astconv/lint.rs b/compiler/rustc_hir_analysis/src/astconv/lint.rs index fb5f3426cea6..b421a33ba294 100644 --- a/compiler/rustc_hir_analysis/src/astconv/lint.rs +++ b/compiler/rustc_hir_analysis/src/astconv/lint.rs @@ -8,7 +8,7 @@ use rustc_trait_selection::traits::error_reporting::suggestions::NextTypeParamNa use super::AstConv; -impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { +impl<'tcx> dyn AstConv<'tcx> + '_ { /// Make sure that we are in the condition to suggest the blanket implementation. pub(super) fn maybe_lint_blanket_trait_impl( &self, diff --git a/compiler/rustc_hir_analysis/src/astconv/mod.rs b/compiler/rustc_hir_analysis/src/astconv/mod.rs index 25df76359a88..401dd76a9f91 100644 --- a/compiler/rustc_hir_analysis/src/astconv/mod.rs +++ b/compiler/rustc_hir_analysis/src/astconv/mod.rs @@ -214,7 +214,7 @@ pub trait CreateInstantiationsForGenericArgsCtxt<'a, 'tcx> { ) -> ty::GenericArg<'tcx>; } -impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { +impl<'tcx> dyn AstConv<'tcx> + '_ { #[instrument(level = "debug", skip(self), ret)] pub fn ast_region_to_region( &self, @@ -284,8 +284,6 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { def_id, &[], item_segment, - item_segment.args(), - item_segment.infer_args, None, ty::BoundConstness::NotConst, ); @@ -330,14 +328,12 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { /// type itself: `['a]`. The returned `GenericArgsRef` concatenates these two /// lists: `[Vec, u8, 'a]`. #[instrument(level = "debug", skip(self, span), ret)] - fn create_args_for_ast_path<'a>( + fn create_args_for_ast_path( &self, span: Span, def_id: DefId, parent_args: &[ty::GenericArg<'tcx>], - seg: &hir::PathSegment<'_>, - generic_args: &'a hir::GenericArgs<'tcx>, - infer_args: bool, + segment: &hir::PathSegment<'tcx>, self_ty: Option>, constness: ty::BoundConstness, ) -> (GenericArgsRef<'tcx>, GenericArgCountResult) { @@ -365,12 +361,10 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { let mut arg_count = check_generic_arg_count( tcx, def_id, - seg, + segment, generics, - generic_args, GenericArgPosition::Type, self_ty.is_some(), - infer_args, ); if let Err(err) = &arg_count.correct @@ -388,7 +382,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { } struct InstantiationsForAstPathCtxt<'a, 'tcx> { - astconv: &'a (dyn AstConv<'tcx> + 'a), + astconv: &'a dyn AstConv<'tcx>, def_id: DefId, generic_args: &'a GenericArgs<'tcx>, span: Span, @@ -547,9 +541,9 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { astconv: self, def_id, span, - generic_args, + generic_args: segment.args(), inferred_params: vec![], - infer_args, + infer_args: segment.infer_args, }; if let ty::BoundConstness::Const | ty::BoundConstness::ConstIfConst = constness && generics.has_self @@ -592,8 +586,6 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { item_def_id, parent_args, item_segment, - item_segment.args(), - item_segment.infer_args, None, ty::BoundConstness::NotConst, ); @@ -661,7 +653,6 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { ) -> GenericArgCountResult { let trait_def_id = trait_ref.trait_def_id().unwrap_or_else(|| FatalError.raise()); let trait_segment = trait_ref.path.segments.last().unwrap(); - let args = trait_segment.args(); self.prohibit_generics(trait_ref.path.segments.split_last().unwrap().1.iter(), |_| {}); self.complain_about_internal_fn_trait(span, trait_def_id, trait_segment, false); @@ -671,8 +662,6 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { trait_def_id, &[], trait_segment, - args, - trait_segment.infer_args, Some(self_ty), constness, ); @@ -690,7 +679,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { bounds.push_trait_bound(tcx, poly_trait_ref, span, polarity); let mut dup_bindings = FxIndexMap::default(); - for binding in args.bindings { + for binding in trait_segment.args().bindings { // Don't register additional associated type bounds for negative bounds, // since we should have emitten an error for them earlier, and they will // not be well-formed! @@ -729,12 +718,14 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { // FIXME(effects) move all host param things in astconv to hir lowering constness: ty::BoundConstness, ) -> ty::TraitRef<'tcx> { - let (generic_args, _) = self.create_args_for_ast_trait_ref( + self.complain_about_internal_fn_trait(span, trait_def_id, trait_segment, is_impl); + + let (generic_args, _) = self.create_args_for_ast_path( span, trait_def_id, - self_ty, + &[], trait_segment, - is_impl, + Some(self_ty), constness, ); if let Some(b) = trait_segment.args().bindings.first() { @@ -743,30 +734,6 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { ty::TraitRef::new(self.tcx(), trait_def_id, generic_args) } - #[instrument(level = "debug", skip(self, span))] - fn create_args_for_ast_trait_ref<'a>( - &self, - span: Span, - trait_def_id: DefId, - self_ty: Ty<'tcx>, - trait_segment: &'a hir::PathSegment<'tcx>, - is_impl: bool, - constness: ty::BoundConstness, - ) -> (GenericArgsRef<'tcx>, GenericArgCountResult) { - self.complain_about_internal_fn_trait(span, trait_def_id, trait_segment, is_impl); - - self.create_args_for_ast_path( - span, - trait_def_id, - &[], - trait_segment, - trait_segment.args(), - trait_segment.infer_args, - Some(self_ty), - constness, - ) - } - fn trait_defines_associated_item_named( &self, trait_def_id: DefId, @@ -801,115 +768,6 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { } } - fn report_ambiguous_associated_type( - &self, - span: Span, - types: &[String], - traits: &[String], - name: Symbol, - ) -> ErrorGuaranteed { - let mut err = - struct_span_code_err!(self.tcx().dcx(), span, E0223, "ambiguous associated type"); - if self - .tcx() - .resolutions(()) - .confused_type_with_std_module - .keys() - .any(|full_span| full_span.contains(span)) - { - err.span_suggestion_verbose( - span.shrink_to_lo(), - "you are looking for the module in `std`, not the primitive type", - "std::", - Applicability::MachineApplicable, - ); - } else { - let mut types = types.to_vec(); - types.sort(); - let mut traits = traits.to_vec(); - traits.sort(); - match (&types[..], &traits[..]) { - ([], []) => { - err.span_suggestion_verbose( - span, - format!( - "if there were a type named `Type` that implements a trait named \ - `Trait` with associated type `{name}`, you could use the \ - fully-qualified path", - ), - format!("::{name}"), - Applicability::HasPlaceholders, - ); - } - ([], [trait_str]) => { - err.span_suggestion_verbose( - span, - format!( - "if there were a type named `Example` that implemented `{trait_str}`, \ - you could use the fully-qualified path", - ), - format!("::{name}"), - Applicability::HasPlaceholders, - ); - } - ([], traits) => { - err.span_suggestions( - span, - format!( - "if there were a type named `Example` that implemented one of the \ - traits with associated type `{name}`, you could use the \ - fully-qualified path", - ), - traits.iter().map(|trait_str| format!("::{name}")), - Applicability::HasPlaceholders, - ); - } - ([type_str], []) => { - err.span_suggestion_verbose( - span, - format!( - "if there were a trait named `Example` with associated type `{name}` \ - implemented for `{type_str}`, you could use the fully-qualified path", - ), - format!("<{type_str} as Example>::{name}"), - Applicability::HasPlaceholders, - ); - } - (types, []) => { - err.span_suggestions( - span, - format!( - "if there were a trait named `Example` with associated type `{name}` \ - implemented for one of the types, you could use the fully-qualified \ - path", - ), - types - .into_iter() - .map(|type_str| format!("<{type_str} as Example>::{name}")), - Applicability::HasPlaceholders, - ); - } - (types, traits) => { - let mut suggestions = vec![]; - for type_str in types { - for trait_str in traits { - suggestions.push(format!("<{type_str} as {trait_str}>::{name}")); - } - } - err.span_suggestions( - span, - "use fully-qualified syntax", - suggestions, - Applicability::MachineApplicable, - ); - } - } - } - let reported = err.emit(); - self.set_tainted_by_errors(reported); - reported - } - // Search for a bound on a type parameter which includes the associated item // given by `assoc_name`. `ty_param_def_id` is the `DefId` of the type parameter // This function will fail if there are no suitable bounds or there is @@ -2471,8 +2329,6 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { def_id, &[], &hir::PathSegment::invalid(), - &GenericArgs::none(), - true, None, ty::BoundConstness::NotConst, ); @@ -2552,9 +2408,9 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { pub fn ty_of_arg(&self, ty: &hir::Ty<'tcx>, expected_ty: Option>) -> Ty<'tcx> { match ty.kind { - hir::TyKind::Infer if expected_ty.is_some() => { - self.record_ty(ty.hir_id, expected_ty.unwrap(), ty.span); - expected_ty.unwrap() + hir::TyKind::Infer if let Some(expected_ty) = expected_ty => { + self.record_ty(ty.hir_id, expected_ty, ty.span); + expected_ty } _ => self.ast_ty_to_ty(ty), } diff --git a/compiler/rustc_hir_analysis/src/astconv/object_safety.rs b/compiler/rustc_hir_analysis/src/astconv/object_safety.rs index b9543c7a29b2..d97728c33035 100644 --- a/compiler/rustc_hir_analysis/src/astconv/object_safety.rs +++ b/compiler/rustc_hir_analysis/src/astconv/object_safety.rs @@ -17,7 +17,7 @@ use smallvec::{smallvec, SmallVec}; use super::AstConv; -impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { +impl<'tcx> dyn AstConv<'tcx> + '_ { pub(super) fn conv_object_ty_poly_trait_ref( &self, span: Span, diff --git a/compiler/rustc_hir_analysis/src/collect/type_of.rs b/compiler/rustc_hir_analysis/src/collect/type_of.rs index 598dba922d0c..fd86f2dd1b16 100644 --- a/compiler/rustc_hir_analysis/src/collect/type_of.rs +++ b/compiler/rustc_hir_analysis/src/collect/type_of.rs @@ -108,8 +108,7 @@ fn anon_const_type_of<'tcx>(tcx: TyCtxt<'tcx>, def_id: LocalDefId) -> Ty<'tcx> { .unwrap() .0 .def_id; - let item_ctxt = &ItemCtxt::new(tcx, item_def_id) as &dyn crate::astconv::AstConv<'_>; - let ty = item_ctxt.ast_ty_to_ty(hir_ty); + let ty = ItemCtxt::new(tcx, item_def_id).to_ty(hir_ty); // Iterate through the generics of the projection to find the one that corresponds to // the def_id that this query was called with. We filter to only type and const args here diff --git a/compiler/rustc_hir_analysis/src/lib.rs b/compiler/rustc_hir_analysis/src/lib.rs index b1b36ade5080..e5307f57a2f4 100644 --- a/compiler/rustc_hir_analysis/src/lib.rs +++ b/compiler/rustc_hir_analysis/src/lib.rs @@ -99,19 +99,16 @@ pub mod structured_errors; mod variance; use rustc_hir as hir; +use rustc_hir::def::DefKind; use rustc_middle::middle; use rustc_middle::query::Providers; -use rustc_middle::ty::{self, Ty, TyCtxt}; +use rustc_middle::ty::{Ty, TyCtxt}; use rustc_middle::util; use rustc_session::parse::feature_err; -use rustc_span::{symbol::sym, Span, DUMMY_SP}; +use rustc_span::{symbol::sym, Span}; use rustc_target::spec::abi::Abi; use rustc_trait_selection::traits; -use astconv::{AstConv, OnlySelfBounds}; -use bounds::Bounds; -use rustc_hir::def::DefKind; - rustc_fluent_macro::fluent_messages! { "../messages.ftl" } fn require_c_abi_if_c_variadic(tcx: TyCtxt<'_>, decl: &hir::FnDecl<'_>, abi: Abi, span: Span) { @@ -200,31 +197,5 @@ pub fn hir_ty_to_ty<'tcx>(tcx: TyCtxt<'tcx>, hir_ty: &hir::Ty<'tcx>) -> Ty<'tcx> // def-ID that will be used to determine the traits/predicates in // scope. This is derived from the enclosing item-like thing. let env_def_id = tcx.hir().get_parent_item(hir_ty.hir_id); - let item_cx = self::collect::ItemCtxt::new(tcx, env_def_id.def_id); - item_cx.astconv().ast_ty_to_ty(hir_ty) -} - -pub fn hir_trait_to_predicates<'tcx>( - tcx: TyCtxt<'tcx>, - hir_trait: &hir::TraitRef<'tcx>, - self_ty: Ty<'tcx>, -) -> Bounds<'tcx> { - // In case there are any projections, etc., find the "environment" - // def-ID that will be used to determine the traits/predicates in - // scope. This is derived from the enclosing item-like thing. - let env_def_id = tcx.hir().get_parent_item(hir_trait.hir_ref_id); - let item_cx = self::collect::ItemCtxt::new(tcx, env_def_id.def_id); - let mut bounds = Bounds::default(); - let _ = &item_cx.astconv().instantiate_poly_trait_ref( - hir_trait, - DUMMY_SP, - ty::BoundConstness::NotConst, - ty::ImplPolarity::Positive, - self_ty, - &mut bounds, - true, - OnlySelfBounds(false), - ); - - bounds + collect::ItemCtxt::new(tcx, env_def_id.def_id).to_ty(hir_ty) } diff --git a/compiler/rustc_hir_typeck/src/closure.rs b/compiler/rustc_hir_typeck/src/closure.rs index c17af666eb9f..4bea4bb3e826 100644 --- a/compiler/rustc_hir_typeck/src/closure.rs +++ b/compiler/rustc_hir_typeck/src/closure.rs @@ -780,7 +780,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { decl: &hir::FnDecl<'tcx>, closure_kind: hir::ClosureKind, ) -> ty::PolyFnSig<'tcx> { - let astconv: &dyn AstConv<'_> = self; + let astconv = self.astconv(); trace!("decl = {:#?}", decl); debug!(?closure_kind); @@ -985,7 +985,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { decl: &hir::FnDecl<'tcx>, guar: ErrorGuaranteed, ) -> ty::PolyFnSig<'tcx> { - let astconv: &dyn AstConv<'_> = self; + let astconv = self.astconv(); let err_ty = Ty::new_error(self.tcx, guar); let supplied_arguments = decl.inputs.iter().map(|a| { From 7ea4f3576675617c68e70014c955a49127c78fe0 Mon Sep 17 00:00:00 2001 From: klensy Date: Fri, 15 Mar 2024 10:54:40 +0300 Subject: [PATCH 069/103] less symbols interner locks --- compiler/rustc_resolve/src/rustdoc.rs | 7 ++++--- src/librustdoc/html/render/mod.rs | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/compiler/rustc_resolve/src/rustdoc.rs b/compiler/rustc_resolve/src/rustdoc.rs index 4ff4ccf5e984..0ebcad3cdb80 100644 --- a/compiler/rustc_resolve/src/rustdoc.rs +++ b/compiler/rustc_resolve/src/rustdoc.rs @@ -167,12 +167,13 @@ pub fn unindent_doc_fragments(docs: &mut [DocFragment]) { /// /// Note: remove the trailing newline where appropriate pub fn add_doc_fragment(out: &mut String, frag: &DocFragment) { - let s = frag.doc.as_str(); - let mut iter = s.lines(); - if s.is_empty() { + if frag.doc == kw::Empty { out.push('\n'); return; } + let s = frag.doc.as_str(); + let mut iter = s.lines(); + while let Some(line) = iter.next() { if line.chars().any(|c| !c.is_whitespace()) { assert!(line.len() >= frag.indent); diff --git a/src/librustdoc/html/render/mod.rs b/src/librustdoc/html/render/mod.rs index fe83095f944a..bfd67ccbd3f9 100644 --- a/src/librustdoc/html/render/mod.rs +++ b/src/librustdoc/html/render/mod.rs @@ -1698,9 +1698,10 @@ fn render_impl( let id = cx.derive_id(format!("{item_type}.{name}")); let source_id = trait_ .and_then(|trait_| { - trait_.items.iter().find(|item| { - item.name.map(|n| n.as_str().eq(name.as_str())).unwrap_or(false) - }) + trait_ + .items + .iter() + .find(|item| item.name.map(|n| n == *name).unwrap_or(false)) }) .map(|item| format!("{}.{name}", item.type_())); write!(w, "
"); From 58dee7d7817f8edcd32d7eb259e22d49a4e1abbe Mon Sep 17 00:00:00 2001 From: Travis Finkenauer Date: Sat, 19 Aug 2023 15:40:24 -0700 Subject: [PATCH 070/103] rustdoc: add `--test-builder-wrapper` argument Instead of executing the test builder directly, the test builder wrapper will be called with test builder as the first argument and subsequent arguments. This is similar to cargo's RUSTC_WRAPPER argument. The `--test-builder-wrapper` argument can be passed multiple times to allow "nesting" of wrappers. --- src/librustdoc/config.rs | 7 +++++++ src/librustdoc/doctest.rs | 14 ++++++++++++-- src/librustdoc/lib.rs | 8 ++++++++ 3 files changed, 27 insertions(+), 2 deletions(-) diff --git a/src/librustdoc/config.rs b/src/librustdoc/config.rs index 4b1a417b2112..be7e319bc79f 100644 --- a/src/librustdoc/config.rs +++ b/src/librustdoc/config.rs @@ -130,6 +130,9 @@ pub(crate) struct Options { /// default to loading from `$sysroot/bin/rustc`. pub(crate) test_builder: Option, + /// Run these wrapper instead of rustc directly + pub(crate) test_builder_wrappers: Vec, + // Options that affect the documentation process /// Whether to run the `calculate-doc-coverage` pass, which counts the number of public items /// with and without documentation. @@ -204,6 +207,7 @@ impl fmt::Debug for Options { .field("enable-per-target-ignores", &self.enable_per_target_ignores) .field("run_check", &self.run_check) .field("no_run", &self.no_run) + .field("test_builder_wrappers", &self.test_builder_wrappers) .field("nocapture", &self.nocapture) .field("scrape_examples_options", &self.scrape_examples_options) .field("unstable_features", &self.unstable_features) @@ -521,6 +525,8 @@ impl Options { dcx.fatal("the `--test` flag must be passed to enable `--no-run`"); } + let test_builder_wrappers = + matches.opt_strs("test-builder-wrapper").iter().map(PathBuf::from).collect(); let out_dir = matches.opt_str("out-dir").map(|s| PathBuf::from(&s)); let output = matches.opt_str("output").map(|s| PathBuf::from(&s)); let output = match (out_dir, output) { @@ -727,6 +733,7 @@ impl Options { test_builder, run_check, no_run, + test_builder_wrappers, nocapture, crate_name, output_format, diff --git a/src/librustdoc/doctest.rs b/src/librustdoc/doctest.rs index d446b781bf13..96ad83e78676 100644 --- a/src/librustdoc/doctest.rs +++ b/src/librustdoc/doctest.rs @@ -25,7 +25,7 @@ use tempfile::Builder as TempFileBuilder; use std::env; use std::io::{self, Write}; use std::panic; -use std::path::PathBuf; +use std::path::{Path, PathBuf}; use std::process::{self, Command, Stdio}; use std::str; use std::sync::atomic::{AtomicUsize, Ordering}; @@ -306,6 +306,16 @@ fn add_exe_suffix(input: String, target: &TargetTriple) -> String { input + &exe_suffix } +fn wrapped_rustc_command(rustc_wrappers: &[PathBuf], rustc_binary: &Path) -> Command { + let args: Vec<&Path> = + rustc_wrappers.iter().map(PathBuf::as_path).chain([rustc_binary].into_iter()).collect(); + let (exe, args) = args.split_first().expect("unable to create rustc command"); + + let mut command = Command::new(exe); + command.args(args); + command +} + fn run_test( test: &str, crate_name: &str, @@ -334,7 +344,7 @@ fn run_test( .test_builder .as_deref() .unwrap_or_else(|| rustc_interface::util::rustc_path().expect("found rustc")); - let mut compiler = Command::new(&rustc_binary); + let mut compiler = wrapped_rustc_command(&rustdoc_options.test_builder_wrappers, rustc_binary); compiler.arg("--crate-type").arg("bin"); for cfg in &rustdoc_options.cfgs { compiler.arg("--cfg").arg(&cfg); diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs index 39d27b104cdd..9618690575a2 100644 --- a/src/librustdoc/lib.rs +++ b/src/librustdoc/lib.rs @@ -530,6 +530,14 @@ fn opts() -> Vec { unstable("test-builder", |o| { o.optopt("", "test-builder", "The rustc-like binary to use as the test builder", "PATH") }), + unstable("test-builder-wrapper", |o| { + o.optmulti( + "", + "test-builder-wrapper", + "The wrapper program for running rustc", + "WRAPPER", + ) + }), unstable("check", |o| o.optflagmulti("", "check", "Run rustdoc checks")), unstable("generate-redirect-map", |o| { o.optflagmulti( From 3d53242e53bcf4f43f7d361cb7e2a4a28f30db9c Mon Sep 17 00:00:00 2001 From: Travis Finkenauer Date: Sun, 20 Aug 2023 01:02:13 -0700 Subject: [PATCH 071/103] rustdoc: fix test's saved stdout Also reword "test-builder-wrapper" argument help. --- src/librustdoc/lib.rs | 4 ++-- .../run-make/issue-88756-default-output/output-default.stdout | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs index 9618690575a2..18651875130f 100644 --- a/src/librustdoc/lib.rs +++ b/src/librustdoc/lib.rs @@ -534,8 +534,8 @@ fn opts() -> Vec { o.optmulti( "", "test-builder-wrapper", - "The wrapper program for running rustc", - "WRAPPER", + "Wrapper program to pass test-builder and arguments", + "PATH", ) }), unstable("check", |o| o.optflagmulti("", "check", "Run rustdoc checks")), diff --git a/tests/run-make/issue-88756-default-output/output-default.stdout b/tests/run-make/issue-88756-default-output/output-default.stdout index 38a3965f0c53..12c1b389fb34 100644 --- a/tests/run-make/issue-88756-default-output/output-default.stdout +++ b/tests/run-make/issue-88756-default-output/output-default.stdout @@ -147,6 +147,8 @@ Options: --test-builder PATH The rustc-like binary to use as the test builder + --test-builder-wrapper PATH + Wrapper program to pass test-builder and arguments --check Run rustdoc checks --generate-redirect-map Generate JSON file at the top level instead of From 713043ef226332216ed75c1bd5ec1f6068a8439c Mon Sep 17 00:00:00 2001 From: Travis Finkenauer Date: Sun, 20 Aug 2023 20:25:30 -0700 Subject: [PATCH 072/103] rustdoc: create rustc command with an iterator This avoids unnecessary allocation with a temporary Vec. --- src/librustdoc/doctest.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/librustdoc/doctest.rs b/src/librustdoc/doctest.rs index 96ad83e78676..c6eb7be08cd8 100644 --- a/src/librustdoc/doctest.rs +++ b/src/librustdoc/doctest.rs @@ -307,12 +307,14 @@ fn add_exe_suffix(input: String, target: &TargetTriple) -> String { } fn wrapped_rustc_command(rustc_wrappers: &[PathBuf], rustc_binary: &Path) -> Command { - let args: Vec<&Path> = - rustc_wrappers.iter().map(PathBuf::as_path).chain([rustc_binary].into_iter()).collect(); - let (exe, args) = args.split_first().expect("unable to create rustc command"); + let mut args = rustc_wrappers.iter().map(PathBuf::as_path).chain([rustc_binary].into_iter()); + let exe = args.next().expect("unable to create rustc command"); let mut command = Command::new(exe); - command.args(args); + for arg in args { + command.arg(arg); + } + command } From d02e66ddf0f1b0d436b3a8374479ec8efbe4b1db Mon Sep 17 00:00:00 2001 From: Travis Finkenauer Date: Fri, 15 Mar 2024 03:19:29 -0700 Subject: [PATCH 073/103] doc: add --test-builder/--test-builder-wrapper --- src/doc/rustdoc/src/command-line-arguments.md | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/src/doc/rustdoc/src/command-line-arguments.md b/src/doc/rustdoc/src/command-line-arguments.md index b46d80eb362e..fe5cb529c263 100644 --- a/src/doc/rustdoc/src/command-line-arguments.md +++ b/src/doc/rustdoc/src/command-line-arguments.md @@ -427,3 +427,32 @@ This flag is **deprecated** and **has no effect**. Rustdoc only supports Rust source code and Markdown input formats. If the file ends in `.md` or `.markdown`, `rustdoc` treats it as a Markdown file. Otherwise, it assumes that the input file is Rust. + +## `--test-builder`: `rustc`-like program to build tests + +Using this flag looks like this: + +```bash +$ rustdoc --test-builder /path/to/rustc src/lib.rs +``` + +Rustdoc will use the provided program to compile tests instead of the default `rustc` program from +the sysroot. + +## `--test-builder-wrapper`: wrap calls to the test builder + +Using this flag looks like this: + +```bash +$ rustdoc --test-builder-wrapper /path/to/rustc-wrapper src/lib.rs +$ rustdoc \ + --test-builder-wrapper rustc-wrapper1 \ + --test-builder-wrapper rustc-wrapper2 \ + --test-builder rustc \ + src/lib.rs +``` + +Similar to cargo `build.rustc-wrapper` option, this flag takes a `rustc` wrapper program. +The first argument to the program will be the test builder program. + +This flag can be passed multiple times to nest wrappers. From 96431e4b822ff82268bf3f2bbbb7aacf2abc5761 Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Fri, 15 Mar 2024 15:05:57 +0100 Subject: [PATCH 074/103] Use explicit LLDB commands instead of `print`/`p` aliases. --- tests/debuginfo/associated-types.rs | 18 ++-- tests/debuginfo/basic-types.rs | 26 ++--- tests/debuginfo/borrowed-basic.rs | 26 ++--- tests/debuginfo/borrowed-c-style-enum.rs | 6 +- tests/debuginfo/borrowed-enum.rs | 6 +- tests/debuginfo/borrowed-struct.rs | 14 +-- tests/debuginfo/borrowed-tuple.rs | 6 +- tests/debuginfo/borrowed-unique-basic.rs | 26 ++--- tests/debuginfo/box.rs | 4 +- tests/debuginfo/boxed-struct.rs | 4 +- .../by-value-non-immediate-argument.rs | 14 +-- .../by-value-self-argument-in-trait-impl.rs | 6 +- tests/debuginfo/c-style-enum-in-composite.rs | 14 +-- tests/debuginfo/c-style-enum.rs | 14 +-- tests/debuginfo/captured-fields-1.rs | 24 ++--- tests/debuginfo/captured-fields-2.rs | 8 +- .../debuginfo/closure-in-generic-function.rs | 8 +- tests/debuginfo/coroutine-locals.rs | 40 +++----- tests/debuginfo/coroutine-objects.rs | 16 +-- tests/debuginfo/cross-crate-spans.rs | 12 +-- tests/debuginfo/destructured-fn-argument.rs | 98 +++++++++---------- .../destructured-for-loop-variable.rs | 48 ++++----- tests/debuginfo/destructured-local.rs | 86 ++++++++-------- tests/debuginfo/enum-thinlto.rs | 4 +- tests/debuginfo/evec-in-struct.rs | 10 +- tests/debuginfo/extern-c-fn.rs | 8 +- .../debuginfo/function-arg-initialization.rs | 64 ++++++------ tests/debuginfo/function-arguments.rs | 8 +- .../function-prologue-stepping-regular.rs | 64 ++++++------ .../generic-enum-with-different-disr-sizes.rs | 16 +-- tests/debuginfo/generic-function.rs | 12 +-- tests/debuginfo/generic-functions-nested.rs | 16 +-- .../generic-method-on-generic-struct.rs | 30 +++--- tests/debuginfo/generic-struct.rs | 8 +- tests/debuginfo/generic-tuple-style-enum.rs | 8 +- tests/debuginfo/include_string.rs | 6 +- tests/debuginfo/issue-22656.rs | 4 +- tests/debuginfo/issue-57822.rs | 8 +- tests/debuginfo/lexical-scope-in-for-loop.rs | 14 +-- tests/debuginfo/lexical-scope-in-if.rs | 32 +++--- tests/debuginfo/lexical-scope-in-match.rs | 36 +++---- .../lexical-scope-in-stack-closure.rs | 12 +-- .../lexical-scope-in-unconditional-loop.rs | 26 ++--- .../lexical-scope-in-unique-closure.rs | 12 +-- tests/debuginfo/lexical-scope-in-while.rs | 26 ++--- tests/debuginfo/lexical-scope-with-macro.rs | 16 +-- .../lexical-scopes-in-block-expression.rs | 96 +++++++++--------- tests/debuginfo/method-on-enum.rs | 30 +++--- tests/debuginfo/method-on-generic-struct.rs | 30 +++--- tests/debuginfo/method-on-struct.rs | 30 +++--- tests/debuginfo/method-on-trait.rs | 30 +++--- tests/debuginfo/method-on-tuple-struct.rs | 30 +++--- tests/debuginfo/multi-cgu.rs | 4 +- .../multiple-functions-equal-var-names.rs | 6 +- tests/debuginfo/multiple-functions.rs | 6 +- .../name-shadowing-and-scope-nesting.rs | 24 ++--- tests/debuginfo/no_mangle-info.rs | 8 +- tests/debuginfo/numeric-types.rs | 24 ++--- tests/debuginfo/option-like-enum.rs | 20 ++-- .../packed-struct-with-destructor.rs | 16 +-- tests/debuginfo/packed-struct.rs | 12 +-- tests/debuginfo/pretty-std-collections.rs | 8 +- tests/debuginfo/rc_arc.rs | 4 +- tests/debuginfo/reference-debuginfo.rs | 28 +++--- .../regression-bad-location-list-67992.rs | 2 +- tests/debuginfo/self-in-default-method.rs | 30 +++--- .../self-in-generic-default-method.rs | 30 +++--- tests/debuginfo/shadowed-argument.rs | 12 +-- tests/debuginfo/shadowed-variable.rs | 20 ++-- tests/debuginfo/should-fail.rs | 2 +- tests/debuginfo/simple-lexical-scope.rs | 14 +-- tests/debuginfo/simple-struct.rs | 12 +-- tests/debuginfo/simple-tuple.rs | 14 +-- .../static-method-on-struct-and-enum.rs | 10 +- tests/debuginfo/struct-in-enum.rs | 6 +- tests/debuginfo/struct-in-struct.rs | 16 +-- tests/debuginfo/struct-namespace.rs | 8 +- tests/debuginfo/struct-style-enum.rs | 8 +- tests/debuginfo/struct-with-destructor.rs | 8 +- tests/debuginfo/tuple-in-tuple.rs | 14 +-- tests/debuginfo/tuple-struct.rs | 12 +-- tests/debuginfo/tuple-style-enum.rs | 8 +- tests/debuginfo/union-smoke.rs | 2 +- tests/debuginfo/unique-enum.rs | 6 +- .../var-captured-in-nested-closure.rs | 24 ++--- .../var-captured-in-sendable-closure.rs | 6 +- .../var-captured-in-stack-closure.rs | 20 ++-- tests/debuginfo/vec-slices.rs | 12 +-- tests/debuginfo/vec.rs | 2 +- 89 files changed, 830 insertions(+), 838 deletions(-) diff --git a/tests/debuginfo/associated-types.rs b/tests/debuginfo/associated-types.rs index 182541b038a0..d1d4e320b05d 100644 --- a/tests/debuginfo/associated-types.rs +++ b/tests/debuginfo/associated-types.rs @@ -42,41 +42,41 @@ // === LLDB TESTS ================================================================================== // lldb-command:run -// lldb-command:print arg +// lldb-command:v arg // lldbg-check:[...] { b = -1, b1 = 0 } // lldbr-check:(associated_types::Struct) arg = { b = -1, b1 = 0 } // lldb-command:continue -// lldb-command:print inferred +// lldb-command:v inferred // lldbg-check:[...] 1 // lldbr-check:(i64) inferred = 1 -// lldb-command:print explicitly +// lldb-command:v explicitly // lldbg-check:[...] 1 // lldbr-check:(i64) explicitly = 1 // lldb-command:continue -// lldb-command:print arg +// lldb-command:v arg // lldbg-check:[...] 2 // lldbr-check:(i64) arg = 2 // lldb-command:continue -// lldb-command:print arg +// lldb-command:v arg // lldbg-check:[...] (4, 5) // lldbr-check:((i32, i64)) arg = { = 4 = 5 } // lldb-command:continue -// lldb-command:print a +// lldb-command:v a // lldbg-check:[...] 6 // lldbr-check:(i32) a = 6 -// lldb-command:print b +// lldb-command:v b // lldbg-check:[...] 7 // lldbr-check:(i64) b = 7 // lldb-command:continue -// lldb-command:print a +// lldb-command:v a // lldbg-check:[...] 8 // lldbr-check:(i64) a = 8 -// lldb-command:print b +// lldb-command:v b // lldbg-check:[...] 9 // lldbr-check:(i32) b = 9 // lldb-command:continue diff --git a/tests/debuginfo/basic-types.rs b/tests/debuginfo/basic-types.rs index 3a023a890f37..13d85d326ee3 100644 --- a/tests/debuginfo/basic-types.rs +++ b/tests/debuginfo/basic-types.rs @@ -50,10 +50,10 @@ // === LLDB TESTS ================================================================================== // lldb-command:run -// lldb-command:print b +// lldb-command:v b // lldbg-check:[...] false // lldbr-check:(bool) b = false -// lldb-command:print i +// lldb-command:v i // lldbg-check:[...] -1 // lldbr-check:(isize) i = -1 @@ -61,37 +61,37 @@ // lldbr-command:print c // lldbr-check:(char) c = 'a' -// lldb-command:print i8 +// lldb-command:v i8 // lldbg-check:[...] 'D' // lldbr-check:(i8) i8 = 68 -// lldb-command:print i16 +// lldb-command:v i16 // lldbg-check:[...] -16 // lldbr-check:(i16) i16 = -16 -// lldb-command:print i32 +// lldb-command:v i32 // lldbg-check:[...] -32 // lldbr-check:(i32) i32 = -32 -// lldb-command:print i64 +// lldb-command:v i64 // lldbg-check:[...] -64 // lldbr-check:(i64) i64 = -64 -// lldb-command:print u +// lldb-command:v u // lldbg-check:[...] 1 // lldbr-check:(usize) u = 1 -// lldb-command:print u8 +// lldb-command:v u8 // lldbg-check:[...] 'd' // lldbr-check:(u8) u8 = 100 -// lldb-command:print u16 +// lldb-command:v u16 // lldbg-check:[...] 16 // lldbr-check:(u16) u16 = 16 -// lldb-command:print u32 +// lldb-command:v u32 // lldbg-check:[...] 32 // lldbr-check:(u32) u32 = 32 -// lldb-command:print u64 +// lldb-command:v u64 // lldbg-check:[...] 64 // lldbr-check:(u64) u64 = 64 -// lldb-command:print f32 +// lldb-command:v f32 // lldbg-check:[...] 2.5 // lldbr-check:(f32) f32 = 2.5 -// lldb-command:print f64 +// lldb-command:v f64 // lldbg-check:[...] 3.5 // lldbr-check:(f64) f64 = 3.5 diff --git a/tests/debuginfo/borrowed-basic.rs b/tests/debuginfo/borrowed-basic.rs index e30131190af5..e48e3dd055e4 100644 --- a/tests/debuginfo/borrowed-basic.rs +++ b/tests/debuginfo/borrowed-basic.rs @@ -52,11 +52,11 @@ // === LLDB TESTS ================================================================================== // lldb-command:run -// lldb-command:print *bool_ref +// lldb-command:v *bool_ref // lldbg-check:[...] true // lldbr-check:(bool) *bool_ref = true -// lldb-command:print *int_ref +// lldb-command:v *int_ref // lldbg-check:[...] -1 // lldbr-check:(isize) *int_ref = -1 @@ -64,47 +64,47 @@ // lldbr-command:print *char_ref // lldbr-check:(char) *char_ref = 'a' -// lldb-command:print *i8_ref +// lldb-command:v *i8_ref // lldbg-check:[...] 'D' // lldbr-check:(i8) *i8_ref = 68 -// lldb-command:print *i16_ref +// lldb-command:v *i16_ref // lldbg-check:[...] -16 // lldbr-check:(i16) *i16_ref = -16 -// lldb-command:print *i32_ref +// lldb-command:v *i32_ref // lldbg-check:[...] -32 // lldbr-check:(i32) *i32_ref = -32 -// lldb-command:print *i64_ref +// lldb-command:v *i64_ref // lldbg-check:[...] -64 // lldbr-check:(i64) *i64_ref = -64 -// lldb-command:print *uint_ref +// lldb-command:v *uint_ref // lldbg-check:[...] 1 // lldbr-check:(usize) *uint_ref = 1 -// lldb-command:print *u8_ref +// lldb-command:v *u8_ref // lldbg-check:[...] 'd' // lldbr-check:(u8) *u8_ref = 100 -// lldb-command:print *u16_ref +// lldb-command:v *u16_ref // lldbg-check:[...] 16 // lldbr-check:(u16) *u16_ref = 16 -// lldb-command:print *u32_ref +// lldb-command:v *u32_ref // lldbg-check:[...] 32 // lldbr-check:(u32) *u32_ref = 32 -// lldb-command:print *u64_ref +// lldb-command:v *u64_ref // lldbg-check:[...] 64 // lldbr-check:(u64) *u64_ref = 64 -// lldb-command:print *f32_ref +// lldb-command:v *f32_ref // lldbg-check:[...] 2.5 // lldbr-check:(f32) *f32_ref = 2.5 -// lldb-command:print *f64_ref +// lldb-command:v *f64_ref // lldbg-check:[...] 3.5 // lldbr-check:(f64) *f64_ref = 3.5 diff --git a/tests/debuginfo/borrowed-c-style-enum.rs b/tests/debuginfo/borrowed-c-style-enum.rs index c6a8bf953866..1a582e8a6d9a 100644 --- a/tests/debuginfo/borrowed-c-style-enum.rs +++ b/tests/debuginfo/borrowed-c-style-enum.rs @@ -22,15 +22,15 @@ // lldb-command:run -// lldb-command:print *the_a_ref +// lldb-command:v *the_a_ref // lldbg-check:[...] TheA // lldbr-check:(borrowed_c_style_enum::ABC) *the_a_ref = borrowed_c_style_enum::ABC::TheA -// lldb-command:print *the_b_ref +// lldb-command:v *the_b_ref // lldbg-check:[...] TheB // lldbr-check:(borrowed_c_style_enum::ABC) *the_b_ref = borrowed_c_style_enum::ABC::TheB -// lldb-command:print *the_c_ref +// lldb-command:v *the_c_ref // lldbg-check:[...] TheC // lldbr-check:(borrowed_c_style_enum::ABC) *the_c_ref = borrowed_c_style_enum::ABC::TheC diff --git a/tests/debuginfo/borrowed-enum.rs b/tests/debuginfo/borrowed-enum.rs index aee4631a8b3d..39883ffd0b6a 100644 --- a/tests/debuginfo/borrowed-enum.rs +++ b/tests/debuginfo/borrowed-enum.rs @@ -22,11 +22,11 @@ // lldb-command:run -// lldb-command:print *the_a_ref +// lldb-command:v *the_a_ref // lldbr-check:(borrowed_enum::ABC::TheA) *the_a_ref = TheA { TheA: 0, TheB: 8970181431921507452 } -// lldb-command:print *the_b_ref +// lldb-command:v *the_b_ref // lldbr-check:(borrowed_enum::ABC::TheB) *the_b_ref = { = 0 = 286331153 = 286331153 } -// lldb-command:print *univariant_ref +// lldb-command:v *univariant_ref // lldbr-check:(borrowed_enum::Univariant) *univariant_ref = { TheOnlyCase = { = 4820353753753434 } } #![allow(unused_variables)] diff --git a/tests/debuginfo/borrowed-struct.rs b/tests/debuginfo/borrowed-struct.rs index 96ceec42ab55..d108a29592bc 100644 --- a/tests/debuginfo/borrowed-struct.rs +++ b/tests/debuginfo/borrowed-struct.rs @@ -34,31 +34,31 @@ // lldb-command:run -// lldb-command:print *stack_val_ref +// lldb-command:v *stack_val_ref // lldbg-check:[...] { x = 10 y = 23.5 } // lldbr-check:(borrowed_struct::SomeStruct) *stack_val_ref = (x = 10, y = 23.5) -// lldb-command:print *stack_val_interior_ref_1 +// lldb-command:v *stack_val_interior_ref_1 // lldbg-check:[...] 10 // lldbr-check:(isize) *stack_val_interior_ref_1 = 10 -// lldb-command:print *stack_val_interior_ref_2 +// lldb-command:v *stack_val_interior_ref_2 // lldbg-check:[...] 23.5 // lldbr-check:(f64) *stack_val_interior_ref_2 = 23.5 -// lldb-command:print *ref_to_unnamed +// lldb-command:v *ref_to_unnamed // lldbg-check:[...] { x = 11 y = 24.5 } // lldbr-check:(borrowed_struct::SomeStruct) *ref_to_unnamed = (x = 11, y = 24.5) -// lldb-command:print *unique_val_ref +// lldb-command:v *unique_val_ref // lldbg-check:[...] { x = 13 y = 26.5 } // lldbr-check:(borrowed_struct::SomeStruct) *unique_val_ref = (x = 13, y = 26.5) -// lldb-command:print *unique_val_interior_ref_1 +// lldb-command:v *unique_val_interior_ref_1 // lldbg-check:[...] 13 // lldbr-check:(isize) *unique_val_interior_ref_1 = 13 -// lldb-command:print *unique_val_interior_ref_2 +// lldb-command:v *unique_val_interior_ref_2 // lldbg-check:[...] 26.5 // lldbr-check:(f64) *unique_val_interior_ref_2 = 26.5 diff --git a/tests/debuginfo/borrowed-tuple.rs b/tests/debuginfo/borrowed-tuple.rs index 8d9c5e9fd2d4..4c5643deb9d0 100644 --- a/tests/debuginfo/borrowed-tuple.rs +++ b/tests/debuginfo/borrowed-tuple.rs @@ -23,15 +23,15 @@ // lldb-command:run -// lldb-command:print *stack_val_ref +// lldb-command:v *stack_val_ref // lldbg-check:[...] { 0 = -14 1 = -19 } // lldbr-check:((i16, f32)) *stack_val_ref = { 0 = -14 1 = -19 } -// lldb-command:print *ref_to_unnamed +// lldb-command:v *ref_to_unnamed // lldbg-check:[...] { 0 = -15 1 = -20 } // lldbr-check:((i16, f32)) *ref_to_unnamed = { 0 = -15 1 = -20 } -// lldb-command:print *unique_val_ref +// lldb-command:v *unique_val_ref // lldbg-check:[...] { 0 = -17 1 = -22 } // lldbr-check:((i16, f32)) *unique_val_ref = { 0 = -17 1 = -22 } diff --git a/tests/debuginfo/borrowed-unique-basic.rs b/tests/debuginfo/borrowed-unique-basic.rs index 38e6ce0a6ae5..d6948a12851a 100644 --- a/tests/debuginfo/borrowed-unique-basic.rs +++ b/tests/debuginfo/borrowed-unique-basic.rs @@ -55,11 +55,11 @@ // lldb-command:type format add -f decimal 'unsigned char' // lldb-command:run -// lldb-command:print *bool_ref +// lldb-command:v *bool_ref // lldbg-check:[...] true // lldbr-check:(bool) *bool_ref = true -// lldb-command:print *int_ref +// lldb-command:v *int_ref // lldbg-check:[...] -1 // lldbr-check:(isize) *int_ref = -1 @@ -67,47 +67,47 @@ // lldbr-command:print *char_ref // lldbr-check:(char) *char_ref = 97 -// lldb-command:print *i8_ref +// lldb-command:v *i8_ref // lldbg-check:[...] 68 // lldbr-check:(i8) *i8_ref = 68 -// lldb-command:print *i16_ref +// lldb-command:v *i16_ref // lldbg-check:[...] -16 // lldbr-check:(i16) *i16_ref = -16 -// lldb-command:print *i32_ref +// lldb-command:v *i32_ref // lldbg-check:[...] -32 // lldbr-check:(i32) *i32_ref = -32 -// lldb-command:print *i64_ref +// lldb-command:v *i64_ref // lldbg-check:[...] -64 // lldbr-check:(i64) *i64_ref = -64 -// lldb-command:print *uint_ref +// lldb-command:v *uint_ref // lldbg-check:[...] 1 // lldbr-check:(usize) *uint_ref = 1 -// lldb-command:print *u8_ref +// lldb-command:v *u8_ref // lldbg-check:[...] 100 // lldbr-check:(u8) *u8_ref = 100 -// lldb-command:print *u16_ref +// lldb-command:v *u16_ref // lldbg-check:[...] 16 // lldbr-check:(u16) *u16_ref = 16 -// lldb-command:print *u32_ref +// lldb-command:v *u32_ref // lldbg-check:[...] 32 // lldbr-check:(u32) *u32_ref = 32 -// lldb-command:print *u64_ref +// lldb-command:v *u64_ref // lldbg-check:[...] 64 // lldbr-check:(u64) *u64_ref = 64 -// lldb-command:print *f32_ref +// lldb-command:v *f32_ref // lldbg-check:[...] 2.5 // lldbr-check:(f32) *f32_ref = 2.5 -// lldb-command:print *f64_ref +// lldb-command:v *f64_ref // lldbg-check:[...] 3.5 // lldbr-check:(f64) *f64_ref = 3.5 diff --git a/tests/debuginfo/box.rs b/tests/debuginfo/box.rs index 2c309a4eb287..46019bcb1a76 100644 --- a/tests/debuginfo/box.rs +++ b/tests/debuginfo/box.rs @@ -16,10 +16,10 @@ // === LLDB TESTS ================================================================================== // lldb-command:run -// lldb-command:print *a +// lldb-command:v *a // lldbg-check:[...] 1 // lldbr-check:(i32) *a = 1 -// lldb-command:print *b +// lldb-command:v *b // lldbg-check:[...] { 0 = 2 1 = 3.5 } // lldbr-check:((i32, f64)) *b = { 0 = 2 1 = 3.5 } diff --git a/tests/debuginfo/boxed-struct.rs b/tests/debuginfo/boxed-struct.rs index be2f1a7a8677..1ee639690eab 100644 --- a/tests/debuginfo/boxed-struct.rs +++ b/tests/debuginfo/boxed-struct.rs @@ -19,11 +19,11 @@ // lldb-command:run -// lldb-command:print *boxed_with_padding +// lldb-command:v *boxed_with_padding // lldbg-check:[...] { x = 99 y = 999 z = 9999 w = 99999 } // lldbr-check:(boxed_struct::StructWithSomePadding) *boxed_with_padding = { x = 99 y = 999 z = 9999 w = 99999 } -// lldb-command:print *boxed_with_dtor +// lldb-command:v *boxed_with_dtor // lldbg-check:[...] { x = 77 y = 777 z = 7777 w = 77777 } // lldbr-check:(boxed_struct::StructWithDestructor) *boxed_with_dtor = { x = 77 y = 777 z = 7777 w = 77777 } diff --git a/tests/debuginfo/by-value-non-immediate-argument.rs b/tests/debuginfo/by-value-non-immediate-argument.rs index 413eefa3f2de..e0ae4458d03e 100644 --- a/tests/debuginfo/by-value-non-immediate-argument.rs +++ b/tests/debuginfo/by-value-non-immediate-argument.rs @@ -41,27 +41,27 @@ // lldb-command:run -// lldb-command:print s +// lldb-command:v s // lldb-check:[...] Struct { a: 1, b: 2.5 } // lldb-command:continue -// lldb-command:print x +// lldb-command:v x // lldb-check:[...] Struct { a: 3, b: 4.5 } -// lldb-command:print y +// lldb-command:v y // lldb-check:[...] 5 -// lldb-command:print z +// lldb-command:v z // lldb-check:[...] 6.5 // lldb-command:continue -// lldb-command:print a +// lldb-command:v a // lldb-check:[...] (7, 8, 9.5, 10.5) // lldb-command:continue -// lldb-command:print a +// lldb-command:v a // lldb-check:[...] Newtype(11.5, 12.5, 13, 14) // lldb-command:continue -// lldb-command:print x +// lldb-command:v x // lldb-check:[...] Case1 { x: 0, y: 8970181431921507452 } // lldb-command:continue 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 7b52d054b321..5276ec827333 100644 --- a/tests/debuginfo/by-value-self-argument-in-trait-impl.rs +++ b/tests/debuginfo/by-value-self-argument-in-trait-impl.rs @@ -25,17 +25,17 @@ // lldb-command:run -// lldb-command:print self +// lldb-command:v self // lldbg-check:[...] 1111 // lldbr-check:(isize) self = 1111 // lldb-command:continue -// lldb-command:print self +// lldb-command:v self // lldbg-check:[...] { x = 2222 y = 3333 } // lldbr-check:(by_value_self_argument_in_trait_impl::Struct) self = { x = 2222 y = 3333 } // lldb-command:continue -// lldb-command:print self +// lldb-command:v self // lldbg-check:[...] { 0 = 4444.5 1 = 5555 2 = 6666 3 = 7777.5 } // lldbr-check:((f64, isize, isize, f64)) self = { 0 = 4444.5 1 = 5555 2 = 6666 3 = 7777.5 } // lldb-command:continue diff --git a/tests/debuginfo/c-style-enum-in-composite.rs b/tests/debuginfo/c-style-enum-in-composite.rs index 82d38038eafa..ec11d5f46555 100644 --- a/tests/debuginfo/c-style-enum-in-composite.rs +++ b/tests/debuginfo/c-style-enum-in-composite.rs @@ -38,31 +38,31 @@ // lldb-command:run -// lldb-command:print tuple_interior_padding +// lldb-command:v tuple_interior_padding // lldbg-check:[...] { 0 = 0 1 = OneHundred } // lldbr-check:((i16, c_style_enum_in_composite::AnEnum)) tuple_interior_padding = { 0 = 0 1 = OneHundred } -// lldb-command:print tuple_padding_at_end +// lldb-command:v tuple_padding_at_end // lldbg-check:[...] { 0 = { 0 = 1 1 = OneThousand } 1 = 2 } // lldbr-check:(((u64, c_style_enum_in_composite::AnEnum), u64)) tuple_padding_at_end = { 0 = { 0 = 1 1 = OneThousand } 1 = 2 } -// lldb-command:print tuple_different_enums +// lldb-command:v tuple_different_enums // lldbg-check:[...] { 0 = OneThousand 1 = MountainView 2 = OneMillion 3 = Vienna } // lldbr-check:((c_style_enum_in_composite::AnEnum, c_style_enum_in_composite::AnotherEnum, c_style_enum_in_composite::AnEnum, c_style_enum_in_composite::AnotherEnum)) tuple_different_enums = { 0 = c_style_enum_in_composite::AnEnum::OneThousand 1 = c_style_enum_in_composite::AnotherEnum::MountainView 2 = c_style_enum_in_composite::AnEnum::OneMillion 3 = c_style_enum_in_composite::AnotherEnum::Vienna } -// lldb-command:print padded_struct +// lldb-command:v padded_struct // lldbg-check:[...] { a = 3 b = OneMillion c = 4 d = Toronto e = 5 } // lldbr-check:(c_style_enum_in_composite::PaddedStruct) padded_struct = { a = 3 b = c_style_enum_in_composite::AnEnum::OneMillion c = 4 d = Toronto e = 5 } -// lldb-command:print packed_struct +// lldb-command:v packed_struct // lldbg-check:[...] { a = 6 b = OneHundred c = 7 d = Vienna e = 8 } // lldbr-check:(c_style_enum_in_composite::PackedStruct) packed_struct = { a = 6 b = c_style_enum_in_composite::AnEnum::OneHundred c = 7 d = Vienna e = 8 } -// lldb-command:print non_padded_struct +// lldb-command:v non_padded_struct // lldbg-check:[...] { a = OneMillion b = MountainView c = OneThousand d = Toronto } // lldbr-check:(c_style_enum_in_composite::NonPaddedStruct) non_padded_struct = { a = c_style_enum_in_composite::AnEnum::OneMillion, b = c_style_enum_in_composite::AnotherEnum::MountainView, c = c_style_enum_in_composite::AnEnum::OneThousand, d = c_style_enum_in_composite::AnotherEnum::Toronto } -// lldb-command:print struct_with_drop +// lldb-command:v struct_with_drop // lldbg-check:[...] { 0 = { a = OneHundred b = Vienna } 1 = 9 } // lldbr-check:((c_style_enum_in_composite::StructWithDrop, i64)) struct_with_drop = { 0 = { a = c_style_enum_in_composite::AnEnum::OneHundred b = c_style_enum_in_composite::AnotherEnum::Vienna } 1 = 9 } diff --git a/tests/debuginfo/c-style-enum.rs b/tests/debuginfo/c-style-enum.rs index 4d84324df2cf..395b94c59a44 100644 --- a/tests/debuginfo/c-style-enum.rs +++ b/tests/debuginfo/c-style-enum.rs @@ -96,31 +96,31 @@ // lldb-command:run -// lldb-command:print auto_one +// lldb-command:v auto_one // lldbg-check:[...] One // lldbr-check:(c_style_enum::AutoDiscriminant) auto_one = c_style_enum::AutoDiscriminant::One -// lldb-command:print auto_two +// lldb-command:v auto_two // lldbg-check:[...] Two // lldbr-check:(c_style_enum::AutoDiscriminant) auto_two = c_style_enum::AutoDiscriminant::Two -// lldb-command:print auto_three +// lldb-command:v auto_three // lldbg-check:[...] Three // lldbr-check:(c_style_enum::AutoDiscriminant) auto_three = c_style_enum::AutoDiscriminant::Three -// lldb-command:print manual_one_hundred +// lldb-command:v manual_one_hundred // lldbg-check:[...] OneHundred // lldbr-check:(c_style_enum::ManualDiscriminant) manual_one_hundred = c_style_enum::ManualDiscriminant::OneHundred -// lldb-command:print manual_one_thousand +// lldb-command:v manual_one_thousand // lldbg-check:[...] OneThousand // lldbr-check:(c_style_enum::ManualDiscriminant) manual_one_thousand = c_style_enum::ManualDiscriminant::OneThousand -// lldb-command:print manual_one_million +// lldb-command:v manual_one_million // lldbg-check:[...] OneMillion // lldbr-check:(c_style_enum::ManualDiscriminant) manual_one_million = c_style_enum::ManualDiscriminant::OneMillion -// lldb-command:print single_variant +// lldb-command:v single_variant // lldbg-check:[...] TheOnlyVariant // lldbr-check:(c_style_enum::SingleVariant) single_variant = c_style_enum::SingleVariant::TheOnlyVariant diff --git a/tests/debuginfo/captured-fields-1.rs b/tests/debuginfo/captured-fields-1.rs index bcc5a1796876..d96f2590570b 100644 --- a/tests/debuginfo/captured-fields-1.rs +++ b/tests/debuginfo/captured-fields-1.rs @@ -25,23 +25,23 @@ // === LLDB TESTS ================================================================================== // lldb-command:run -// lldb-command:print test -// lldbg-check:(captured_fields_1::main::{closure_env#0}) { _ref__my_ref__my_field1 = 0x[...] } +// lldb-command:v test +// lldbg-check:(captured_fields_1::main::{closure_env#0}) test = { _ref__my_ref__my_field1 = 0x[...] } // lldb-command:continue -// lldb-command:print test -// lldbg-check:(captured_fields_1::main::{closure_env#1}) { _ref__my_ref__my_field2 = 0x[...] } +// lldb-command:v test +// lldbg-check:(captured_fields_1::main::{closure_env#1}) test = { _ref__my_ref__my_field2 = 0x[...] } // lldb-command:continue -// lldb-command:print test -// lldbg-check:(captured_fields_1::main::{closure_env#2}) { _ref__my_ref = 0x[...] } +// lldb-command:v test +// lldbg-check:(captured_fields_1::main::{closure_env#2}) test = { _ref__my_ref = 0x[...] } // lldb-command:continue -// lldb-command:print test -// lldbg-check:(captured_fields_1::main::{closure_env#3}) { my_ref = 0x[...] } +// lldb-command:v test +// lldbg-check:(captured_fields_1::main::{closure_env#3}) test = { my_ref = 0x[...] } // lldb-command:continue -// lldb-command:print test -// lldbg-check:(captured_fields_1::main::{closure_env#4}) { my_var__my_field2 = 22 } +// lldb-command:v test +// lldbg-check:(captured_fields_1::main::{closure_env#4}) test = { my_var__my_field2 = 22 } // lldb-command:continue -// lldb-command:print test -// lldbg-check:(captured_fields_1::main::{closure_env#5}) { my_var = { my_field1 = 11 my_field2 = 22 } } +// lldb-command:v test +// lldbg-check:(captured_fields_1::main::{closure_env#5}) test = { my_var = { my_field1 = 11 my_field2 = 22 } } // lldb-command:continue #![allow(unused)] diff --git a/tests/debuginfo/captured-fields-2.rs b/tests/debuginfo/captured-fields-2.rs index 7191d3f84d2a..446c5c70fefb 100644 --- a/tests/debuginfo/captured-fields-2.rs +++ b/tests/debuginfo/captured-fields-2.rs @@ -13,11 +13,11 @@ // === LLDB TESTS ================================================================================== // lldb-command:run -// lldb-command:print my_ref__my_field1 -// lldbg-check:(unsigned int) 11 +// lldb-command:v my_ref__my_field1 +// lldbg-check:(unsigned int) my_ref__my_field1 = 11 // lldb-command:continue -// lldb-command:print my_var__my_field2 -// lldbg-check:(unsigned int) 22 +// lldb-command:v my_var__my_field2 +// lldbg-check:(unsigned int) my_var__my_field2 = 22 // lldb-command:continue #![allow(unused)] diff --git a/tests/debuginfo/closure-in-generic-function.rs b/tests/debuginfo/closure-in-generic-function.rs index c48858e4a0a5..ef0f2b0b464b 100644 --- a/tests/debuginfo/closure-in-generic-function.rs +++ b/tests/debuginfo/closure-in-generic-function.rs @@ -23,18 +23,18 @@ // lldb-command:run -// lldb-command:print x +// lldb-command:v x // lldbg-check:[...] 0.5 // lldbr-check:(f64) x = 0.5 -// lldb-command:print y +// lldb-command:v y // lldbg-check:[...] 10 // lldbr-check:(i32) y = 10 // lldb-command:continue -// lldb-command:print *x +// lldb-command:v *x // lldbg-check:[...] 29 // lldbr-check:(i32) *x = 29 -// lldb-command:print *y +// lldb-command:v *y // lldbg-check:[...] 110 // lldbr-check:(i32) *y = 110 // lldb-command:continue diff --git a/tests/debuginfo/coroutine-locals.rs b/tests/debuginfo/coroutine-locals.rs index 80a68434dab5..54b5cd577c8b 100644 --- a/tests/debuginfo/coroutine-locals.rs +++ b/tests/debuginfo/coroutine-locals.rs @@ -27,32 +27,24 @@ // === LLDB TESTS ================================================================================== // lldb-command:run -// lldb-command:print a -// lldbg-check:(int) 5 -// lldbr-check:(int) a = 5 -// lldb-command:print c -// lldbg-check:(int) 6 -// lldbr-check:(int) c = 6 -// lldb-command:print d -// lldbg-check:(int) 7 -// lldbr-check:(int) d = 7 +// lldb-command:v a +// lldb-check:(int) a = 5 +// lldb-command:v c +// lldb-check:(int) c = 6 +// lldb-command:v d +// lldb-check:(int) d = 7 // lldb-command:continue -// lldb-command:print a -// lldbg-check:(int) 7 -// lldbr-check:(int) a = 7 -// lldb-command:print c -// lldbg-check:(int) 6 -// lldbr-check:(int) c = 6 -// lldb-command:print e -// lldbg-check:(int) 8 -// lldbr-check:(int) e = 8 +// lldb-command:v a +// lldb-check:(int) a = 7 +// lldb-command:v c +// lldb-check:(int) c = 6 +// lldb-command:v e +// lldb-check:(int) e = 8 // lldb-command:continue -// lldb-command:print a -// lldbg-check:(int) 8 -// lldbr-check:(int) a = 8 -// lldb-command:print c -// lldbg-check:(int) 6 -// lldbr-check:(int) c = 6 +// lldb-command:v a +// lldb-check:(int) a = 8 +// lldb-command:v c +// lldb-check:(int) c = 6 #![feature(omit_gdb_pretty_printer_section, coroutines, coroutine_trait)] #![omit_gdb_pretty_printer_section] diff --git a/tests/debuginfo/coroutine-objects.rs b/tests/debuginfo/coroutine-objects.rs index 9f14cb3f8ec4..9e1bd5d62e7a 100644 --- a/tests/debuginfo/coroutine-objects.rs +++ b/tests/debuginfo/coroutine-objects.rs @@ -25,17 +25,17 @@ // === LLDB TESTS ================================================================================== // lldb-command:run -// lldb-command:print b -// lldbg-check:(coroutine_objects::main::{coroutine_env#0}) +// lldb-command:v b +// lldbg-check:(coroutine_objects::main::{coroutine_env#0}) b = // lldb-command:continue -// lldb-command:print b -// lldbg-check:(coroutine_objects::main::{coroutine_env#0}) +// lldb-command:v b +// lldbg-check:(coroutine_objects::main::{coroutine_env#0}) b = // lldb-command:continue -// lldb-command:print b -// lldbg-check:(coroutine_objects::main::{coroutine_env#0}) +// lldb-command:v b +// lldbg-check:(coroutine_objects::main::{coroutine_env#0}) b = // lldb-command:continue -// lldb-command:print b -// lldbg-check:(coroutine_objects::main::{coroutine_env#0}) +// lldb-command:v b +// lldbg-check:(coroutine_objects::main::{coroutine_env#0}) b = // === CDB TESTS =================================================================================== diff --git a/tests/debuginfo/cross-crate-spans.rs b/tests/debuginfo/cross-crate-spans.rs index 9f3538c4e1d4..cf3f8e1eadf4 100644 --- a/tests/debuginfo/cross-crate-spans.rs +++ b/tests/debuginfo/cross-crate-spans.rs @@ -43,24 +43,24 @@ extern crate cross_crate_spans; // lldb-command:b cross_crate_spans.rs:14 // lldb-command:run -// lldb-command:print result +// lldb-command:v result // lldbg-check:[...] { 0 = 17 1 = 17 } // lldbr-check:((u32, u32)) result = { 0 = 17 1 = 17 } -// lldb-command:print a_variable +// lldb-command:v a_variable // lldbg-check:[...] 123456789 // lldbr-check:(u32) a_variable = 123456789 -// lldb-command:print another_variable +// lldb-command:v another_variable // lldbg-check:[...] 123456789.5 // lldbr-check:(f64) another_variable = 123456789.5 // lldb-command:continue -// lldb-command:print result +// lldb-command:v result // lldbg-check:[...] { 0 = 1212 1 = 1212 } // lldbr-check:((i16, i16)) result = { 0 = 1212 1 = 1212 } -// lldb-command:print a_variable +// lldb-command:v a_variable // lldbg-check:[...] 123456789 // lldbr-check:(u32) a_variable = 123456789 -// lldb-command:print another_variable +// lldb-command:v another_variable // lldbg-check:[...] 123456789.5 // lldbr-check:(f64) another_variable = 123456789.5 // lldb-command:continue diff --git a/tests/debuginfo/destructured-fn-argument.rs b/tests/debuginfo/destructured-fn-argument.rs index 2748bdb08b96..74e18a594d78 100644 --- a/tests/debuginfo/destructured-fn-argument.rs +++ b/tests/debuginfo/destructured-fn-argument.rs @@ -163,195 +163,195 @@ // lldb-command:run -// lldb-command:print a +// lldb-command:v a // lldbg-check:[...] 1 // lldbr-check:(isize) a = 1 -// lldb-command:print b +// lldb-command:v b // lldbg-check:[...] false // lldbr-check:(bool) b = false // lldb-command:continue -// lldb-command:print a +// lldb-command:v a // lldbg-check:[...] 2 // lldbr-check:(isize) a = 2 -// lldb-command:print b +// lldb-command:v b // lldbg-check:[...] 3 // lldbr-check:(u16) b = 3 -// lldb-command:print c +// lldb-command:v c // lldbg-check:[...] 4 // lldbr-check:(u16) c = 4 // lldb-command:continue -// lldb-command:print a +// lldb-command:v a // lldbg-check:[...] 5 // lldbr-check:(isize) a = 5 -// lldb-command:print b +// lldb-command:v b // lldbg-check:[...] { 0 = 6 1 = 7 } // lldbr-check:((u32, u32)) b = { 0 = 6 1 = 7 } // lldb-command:continue -// lldb-command:print h +// lldb-command:v h // lldbg-check:[...] 8 // lldbr-check:(i16) h = 8 -// lldb-command:print i +// lldb-command:v i // lldbg-check:[...] { a = 9 b = 10 } // lldbr-check:(destructured_fn_argument::Struct) i = { a = 9 b = 10 } -// lldb-command:print j +// lldb-command:v j // lldbg-check:[...] 11 // lldbr-check:(i16) j = 11 // lldb-command:continue -// lldb-command:print k +// lldb-command:v k // lldbg-check:[...] 12 // lldbr-check:(i64) k = 12 -// lldb-command:print l +// lldb-command:v l // lldbg-check:[...] 13 // lldbr-check:(i32) l = 13 // lldb-command:continue -// lldb-command:print m +// lldb-command:v m // lldbg-check:[...] 14 // lldbr-check:(isize) m = 14 -// lldb-command:print n +// lldb-command:v n // lldbg-check:[...] 16 // lldbr-check:(i32) n = 16 // lldb-command:continue -// lldb-command:print o +// lldb-command:v o // lldbg-check:[...] 18 // lldbr-check:(i32) o = 18 // lldb-command:continue -// lldb-command:print p +// lldb-command:v p // lldbg-check:[...] 19 // lldbr-check:(i64) p = 19 -// lldb-command:print q +// lldb-command:v q // lldbg-check:[...] 20 // lldbr-check:(i32) q = 20 -// lldb-command:print r +// lldb-command:v r // lldbg-check:[...] { a = 21 b = 22 } // lldbr-check:(destructured_fn_argument::Struct) r = { a = 21, b = 22 } // lldb-command:continue -// lldb-command:print s +// lldb-command:v s // lldbg-check:[...] 24 // lldbr-check:(i32) s = 24 -// lldb-command:print t +// lldb-command:v t // lldbg-check:[...] 23 // lldbr-check:(i64) t = 23 // lldb-command:continue -// lldb-command:print u +// lldb-command:v u // lldbg-check:[...] 25 // lldbr-check:(i16) u = 25 -// lldb-command:print v +// lldb-command:v v // lldbg-check:[...] 26 // lldbr-check:(i32) v = 26 -// lldb-command:print w +// lldb-command:v w // lldbg-check:[...] 27 // lldbr-check:(i64) w = 27 -// lldb-command:print x +// lldb-command:v x // lldbg-check:[...] 28 // lldbr-check:(i32) x = 28 -// lldb-command:print y +// lldb-command:v y // lldbg-check:[...] 29 // lldbr-check:(i64) y = 29 -// lldb-command:print z +// lldb-command:v z // lldbg-check:[...] 30 // lldbr-check:(i32) z = 30 -// lldb-command:print ae +// lldb-command:v ae // lldbg-check:[...] 31 // lldbr-check:(i64) ae = 31 -// lldb-command:print oe +// lldb-command:v oe // lldbg-check:[...] 32 // lldbr-check:(i32) oe = 32 -// lldb-command:print ue +// lldb-command:v ue // lldbg-check:[...] 33 // lldbr-check:(u16) ue = 33 // lldb-command:continue -// lldb-command:print aa +// lldb-command:v aa // lldbg-check:[...] { 0 = 34 1 = 35 } // lldbr-check:((isize, isize)) aa = { 0 = 34 1 = 35 } // lldb-command:continue -// lldb-command:print bb +// lldb-command:v bb // lldbg-check:[...] { 0 = 36 1 = 37 } // lldbr-check:((isize, isize)) bb = { 0 = 36 1 = 37 } // lldb-command:continue -// lldb-command:print cc +// lldb-command:v cc // lldbg-check:[...] 38 // lldbr-check:(isize) cc = 38 // lldb-command:continue -// lldb-command:print dd +// lldb-command:v dd // lldbg-check:[...] { 0 = 40 1 = 41 2 = 42 } // lldbr-check:((isize, isize, isize)) dd = { 0 = 40 1 = 41 2 = 42 } // lldb-command:continue -// lldb-command:print *ee +// lldb-command:v *ee // lldbg-check:[...] { 0 = 43 1 = 44 2 = 45 } // lldbr-check:((isize, isize, isize)) *ee = { 0 = 43 1 = 44 2 = 45 } // lldb-command:continue -// lldb-command:print *ff +// lldb-command:v *ff // lldbg-check:[...] 46 // lldbr-check:(isize) *ff = 46 -// lldb-command:print gg +// lldb-command:v gg // lldbg-check:[...] { 0 = 47 1 = 48 } // lldbr-check:((isize, isize)) gg = { 0 = 47 1 = 48 } // lldb-command:continue -// lldb-command:print *hh +// lldb-command:v *hh // lldbg-check:[...] 50 // lldbr-check:(i32) *hh = 50 // lldb-command:continue -// lldb-command:print ii +// lldb-command:v ii // lldbg-check:[...] 51 // lldbr-check:(i32) ii = 51 // lldb-command:continue -// lldb-command:print *jj +// lldb-command:v *jj // lldbg-check:[...] 52 // lldbr-check:(i32) *jj = 52 // lldb-command:continue -// lldb-command:print kk +// lldb-command:v kk // lldbg-check:[...] 53 // lldbr-check:(f64) kk = 53 -// lldb-command:print ll +// lldb-command:v ll // lldbg-check:[...] 54 // lldbr-check:(isize) ll = 54 // lldb-command:continue -// lldb-command:print mm +// lldb-command:v mm // lldbg-check:[...] 55 // lldbr-check:(f64) mm = 55 -// lldb-command:print *nn +// lldb-command:v *nn // lldbg-check:[...] 56 // lldbr-check:(isize) *nn = 56 // lldb-command:continue -// lldb-command:print oo +// lldb-command:v oo // lldbg-check:[...] 57 // lldbr-check:(isize) oo = 57 -// lldb-command:print pp +// lldb-command:v pp // lldbg-check:[...] 58 // lldbr-check:(isize) pp = 58 -// lldb-command:print qq +// lldb-command:v qq // lldbg-check:[...] 59 // lldbr-check:(isize) qq = 59 // lldb-command:continue -// lldb-command:print rr +// lldb-command:v rr // lldbg-check:[...] 60 // lldbr-check:(isize) rr = 60 -// lldb-command:print ss +// lldb-command:v ss // lldbg-check:[...] 61 // lldbr-check:(isize) ss = 61 -// lldb-command:print tt +// lldb-command:v tt // lldbg-check:[...] 62 // lldbr-check:(isize) tt = 62 // lldb-command:continue diff --git a/tests/debuginfo/destructured-for-loop-variable.rs b/tests/debuginfo/destructured-for-loop-variable.rs index e583804cb1e9..1cad8bcfacbe 100644 --- a/tests/debuginfo/destructured-for-loop-variable.rs +++ b/tests/debuginfo/destructured-for-loop-variable.rs @@ -84,89 +84,89 @@ // lldb-command:run // DESTRUCTURED STRUCT -// lldb-command:print x +// lldb-command:v x // lldbg-check:[...] 400 // lldbr-check:(i16) x = 400 -// lldb-command:print y +// lldb-command:v y // lldbg-check:[...] 401.5 // lldbr-check:(f32) y = 401.5 -// lldb-command:print z +// lldb-command:v z // lldbg-check:[...] true // lldbr-check:(bool) z = true // lldb-command:continue // DESTRUCTURED TUPLE -// lldb-command:print _i8 +// lldb-command:v _i8 // lldbg-check:[...] 0x6f // lldbr-check:(i8) _i8 = 111 -// lldb-command:print _u8 +// lldb-command:v _u8 // lldbg-check:[...] 0x70 // lldbr-check:(u8) _u8 = 112 -// lldb-command:print _i16 +// lldb-command:v _i16 // lldbg-check:[...] -113 // lldbr-check:(i16) _i16 = -113 -// lldb-command:print _u16 +// lldb-command:v _u16 // lldbg-check:[...] 114 // lldbr-check:(u16) _u16 = 114 -// lldb-command:print _i32 +// lldb-command:v _i32 // lldbg-check:[...] -115 // lldbr-check:(i32) _i32 = -115 -// lldb-command:print _u32 +// lldb-command:v _u32 // lldbg-check:[...] 116 // lldbr-check:(u32) _u32 = 116 -// lldb-command:print _i64 +// lldb-command:v _i64 // lldbg-check:[...] -117 // lldbr-check:(i64) _i64 = -117 -// lldb-command:print _u64 +// lldb-command:v _u64 // lldbg-check:[...] 118 // lldbr-check:(u64) _u64 = 118 -// lldb-command:print _f32 +// lldb-command:v _f32 // lldbg-check:[...] 119.5 // lldbr-check:(f32) _f32 = 119.5 -// lldb-command:print _f64 +// lldb-command:v _f64 // lldbg-check:[...] 120.5 // lldbr-check:(f64) _f64 = 120.5 // lldb-command:continue // MORE COMPLEX CASE -// lldb-command:print v1 +// lldb-command:v v1 // lldbg-check:[...] 80000 // lldbr-check:(i32) v1 = 80000 -// lldb-command:print x1 +// lldb-command:v x1 // lldbg-check:[...] 8000 // lldbr-check:(i16) x1 = 8000 -// lldb-command:print *y1 +// lldb-command:v *y1 // lldbg-check:[...] 80001.5 // lldbr-check:(f32) *y1 = 80001.5 -// lldb-command:print z1 +// lldb-command:v z1 // lldbg-check:[...] false // lldbr-check:(bool) z1 = false -// lldb-command:print *x2 +// lldb-command:v *x2 // lldbg-check:[...] -30000 // lldbr-check:(i16) *x2 = -30000 -// lldb-command:print y2 +// lldb-command:v y2 // lldbg-check:[...] -300001.5 // lldbr-check:(f32) y2 = -300001.5 -// lldb-command:print *z2 +// lldb-command:v *z2 // lldbg-check:[...] true // lldbr-check:(bool) *z2 = true -// lldb-command:print v2 +// lldb-command:v v2 // lldbg-check:[...] 854237.5 // lldbr-check:(f64) v2 = 854237.5 // lldb-command:continue // SIMPLE IDENTIFIER -// lldb-command:print i +// lldb-command:v i // lldbg-check:[...] 1234 // lldbr-check:(i32) i = 1234 // lldb-command:continue -// lldb-command:print simple_struct_ident +// lldb-command:v simple_struct_ident // lldbg-check:[...] { x = 3537 y = 35437.5 z = true } // lldbr-check:(destructured_for_loop_variable::Struct) simple_struct_ident = { x = 3537 y = 35437.5 z = true } // lldb-command:continue -// lldb-command:print simple_tuple_ident +// lldb-command:v simple_tuple_ident // lldbg-check:[...] { 0 = 34903493 1 = 232323 } // lldbr-check:((u32, i64)) simple_tuple_ident = { 0 = 34903493 1 = 232323 } // lldb-command:continue diff --git a/tests/debuginfo/destructured-local.rs b/tests/debuginfo/destructured-local.rs index 9993407815e0..8d62fe5db031 100644 --- a/tests/debuginfo/destructured-local.rs +++ b/tests/debuginfo/destructured-local.rs @@ -129,156 +129,156 @@ // lldb-command:run -// lldb-command:print a +// lldb-command:v a // lldbg-check:[...] 1 // lldbr-check:(isize) a = 1 -// lldb-command:print b +// lldb-command:v b // lldbg-check:[...] false // lldbr-check:(bool) b = false -// lldb-command:print c +// lldb-command:v c // lldbg-check:[...] 2 // lldbr-check:(isize) c = 2 -// lldb-command:print d +// lldb-command:v d // lldbg-check:[...] 3 // lldbr-check:(u16) d = 3 -// lldb-command:print e +// lldb-command:v e // lldbg-check:[...] 4 // lldbr-check:(u16) e = 4 -// lldb-command:print f +// lldb-command:v f // lldbg-check:[...] 5 // lldbr-check:(isize) f = 5 -// lldb-command:print g +// lldb-command:v g // lldbg-check:[...] { 0 = 6 1 = 7 } // lldbr-check:((u32, u32)) g = { 0 = 6 1 = 7 } -// lldb-command:print h +// lldb-command:v h // lldbg-check:[...] 8 // lldbr-check:(i16) h = 8 -// lldb-command:print i +// lldb-command:v i // lldbg-check:[...] { a = 9 b = 10 } // lldbr-check:(destructured_local::Struct) i = { a = 9 b = 10 } -// lldb-command:print j +// lldb-command:v j // lldbg-check:[...] 11 // lldbr-check:(i16) j = 11 -// lldb-command:print k +// lldb-command:v k // lldbg-check:[...] 12 // lldbr-check:(i64) k = 12 -// lldb-command:print l +// lldb-command:v l // lldbg-check:[...] 13 // lldbr-check:(i32) l = 13 -// lldb-command:print m +// lldb-command:v m // lldbg-check:[...] 14 // lldbr-check:(i32) m = 14 -// lldb-command:print n +// lldb-command:v n // lldbg-check:[...] 16 // lldbr-check:(i32) n = 16 -// lldb-command:print o +// lldb-command:v o // lldbg-check:[...] 18 // lldbr-check:(i32) o = 18 -// lldb-command:print p +// lldb-command:v p // lldbg-check:[...] 19 // lldbr-check:(i64) p = 19 -// lldb-command:print q +// lldb-command:v q // lldbg-check:[...] 20 // lldbr-check:(i32) q = 20 -// lldb-command:print r +// lldb-command:v r // lldbg-check:[...] { a = 21 b = 22 } // lldbr-check:(destructured_local::Struct) r = { a = 21 b = 22 } -// lldb-command:print s +// lldb-command:v s // lldbg-check:[...] 24 // lldbr-check:(i32) s = 24 -// lldb-command:print t +// lldb-command:v t // lldbg-check:[...] 23 // lldbr-check:(i64) t = 23 -// lldb-command:print u +// lldb-command:v u // lldbg-check:[...] 25 // lldbr-check:(i32) u = 25 -// lldb-command:print v +// lldb-command:v v // lldbg-check:[...] 26 // lldbr-check:(i32) v = 26 -// lldb-command:print w +// lldb-command:v w // lldbg-check:[...] 27 // lldbr-check:(i32) w = 27 -// lldb-command:print x +// lldb-command:v x // lldbg-check:[...] 28 // lldbr-check:(i32) x = 28 -// lldb-command:print y +// lldb-command:v y // lldbg-check:[...] 29 // lldbr-check:(i64) y = 29 -// lldb-command:print z +// lldb-command:v z // lldbg-check:[...] 30 // lldbr-check:(i32) z = 30 -// lldb-command:print ae +// lldb-command:v ae // lldbg-check:[...] 31 // lldbr-check:(i64) ae = 31 -// lldb-command:print oe +// lldb-command:v oe // lldbg-check:[...] 32 // lldbr-check:(i32) oe = 32 -// lldb-command:print ue +// lldb-command:v ue // lldbg-check:[...] 33 // lldbr-check:(i32) ue = 33 -// lldb-command:print aa +// lldb-command:v aa // lldbg-check:[...] { 0 = 34 1 = 35 } // lldbr-check:((i32, i32)) aa = { 0 = 34 1 = 35 } -// lldb-command:print bb +// lldb-command:v bb // lldbg-check:[...] { 0 = 36 1 = 37 } // lldbr-check:((i32, i32)) bb = { 0 = 36 1 = 37 } -// lldb-command:print cc +// lldb-command:v cc // lldbg-check:[...] 38 // lldbr-check:(i32) cc = 38 -// lldb-command:print dd +// lldb-command:v dd // lldbg-check:[...] { 0 = 40 1 = 41 2 = 42 } // lldbr-check:((i32, i32, i32)) dd = { 0 = 40 1 = 41 2 = 42} -// lldb-command:print *ee +// lldb-command:v *ee // lldbg-check:[...] { 0 = 43 1 = 44 2 = 45 } // lldbr-check:((i32, i32, i32)) *ee = { 0 = 43 1 = 44 2 = 45} -// lldb-command:print *ff +// lldb-command:v *ff // lldbg-check:[...] 46 // lldbr-check:(i32) *ff = 46 -// lldb-command:print gg +// lldb-command:v gg // lldbg-check:[...] { 0 = 47 1 = 48 } // lldbr-check:((i32, i32)) gg = { 0 = 47 1 = 48 } -// lldb-command:print *hh +// lldb-command:v *hh // lldbg-check:[...] 50 // lldbr-check:(i32) *hh = 50 -// lldb-command:print ii +// lldb-command:v ii // lldbg-check:[...] 51 // lldbr-check:(i32) ii = 51 -// lldb-command:print *jj +// lldb-command:v *jj // lldbg-check:[...] 52 // lldbr-check:(i32) *jj = 52 -// lldb-command:print kk +// lldb-command:v kk // lldbg-check:[...] 53 // lldbr-check:(f64) kk = 53 -// lldb-command:print ll +// lldb-command:v ll // lldbg-check:[...] 54 // lldbr-check:(isize) ll = 54 -// lldb-command:print mm +// lldb-command:v mm // lldbg-check:[...] 55 // lldbr-check:(f64) mm = 55 -// lldb-command:print *nn +// lldb-command:v *nn // lldbg-check:[...] 56 // lldbr-check:(isize) *nn = 56 diff --git a/tests/debuginfo/enum-thinlto.rs b/tests/debuginfo/enum-thinlto.rs index 2e541663147f..f3f177589318 100644 --- a/tests/debuginfo/enum-thinlto.rs +++ b/tests/debuginfo/enum-thinlto.rs @@ -14,8 +14,8 @@ // lldb-command:run -// lldb-command:print *abc -// lldbg-check:(enum_thinlto::ABC) +// lldb-command:v *abc +// lldbg-check:(enum_thinlto::ABC) *abc = // lldbr-check:(enum_thinlto::ABC) *abc = (x = 0, y = 8970181431921507452) #![allow(unused_variables)] diff --git a/tests/debuginfo/evec-in-struct.rs b/tests/debuginfo/evec-in-struct.rs index 0e6565830a9b..2283e96c0ad6 100644 --- a/tests/debuginfo/evec-in-struct.rs +++ b/tests/debuginfo/evec-in-struct.rs @@ -30,22 +30,22 @@ // lldb-command:run -// lldb-command:print no_padding1 +// lldb-command:v no_padding1 // lldbg-check:[...] { x = { [0] = 0 [1] = 1 [2] = 2 } y = -3 z = { [0] = 4.5 [1] = 5.5 } } // lldbr-check:(evec_in_struct::NoPadding1) no_padding1 = { x = { [0] = 0 [1] = 1 [2] = 2 } y = -3 z = { [0] = 4.5 [1] = 5.5 } } -// lldb-command:print no_padding2 +// lldb-command:v no_padding2 // lldbg-check:[...] { x = { [0] = 6 [1] = 7 [2] = 8 } y = { [0] = { [0] = 9 [1] = 10 } [1] = { [0] = 11 [1] = 12 } } } // lldbr-check:(evec_in_struct::NoPadding2) no_padding2 = { x = { [0] = 6 [1] = 7 [2] = 8 } y = { [0] = { [0] = 9 [1] = 10 } [1] = { [0] = 11 [1] = 12 } } } -// lldb-command:print struct_internal_padding +// lldb-command:v struct_internal_padding // lldbg-check:[...] { x = { [0] = 13 [1] = 14 } y = { [0] = 15 [1] = 16 } } // lldbr-check:(evec_in_struct::StructInternalPadding) struct_internal_padding = { x = { [0] = 13 [1] = 14 } y = { [0] = 15 [1] = 16 } } -// lldb-command:print single_vec +// lldb-command:v single_vec // lldbg-check:[...] { x = { [0] = 17 [1] = 18 [2] = 19 [3] = 20 [4] = 21 } } // lldbr-check:(evec_in_struct::SingleVec) single_vec = { x = { [0] = 17 [1] = 18 [2] = 19 [3] = 20 [4] = 21 } } -// lldb-command:print struct_padded_at_end +// lldb-command:v struct_padded_at_end // lldbg-check:[...] { x = { [0] = 22 [1] = 23 } y = { [0] = 24 [1] = 25 } } // lldbr-check:(evec_in_struct::StructPaddedAtEnd) struct_padded_at_end = { x = { [0] = 22 [1] = 23 } y = { [0] = 24 [1] = 25 } } diff --git a/tests/debuginfo/extern-c-fn.rs b/tests/debuginfo/extern-c-fn.rs index 0d2eb9e6daf0..b45a073ed050 100644 --- a/tests/debuginfo/extern-c-fn.rs +++ b/tests/debuginfo/extern-c-fn.rs @@ -21,16 +21,16 @@ // === LLDB TESTS ================================================================================== // lldb-command:run -// lldb-command:print len +// lldb-command:v len // lldbg-check:[...] 20 // lldbr-check:(i32) len = 20 -// lldb-command:print local0 +// lldb-command:v local0 // lldbg-check:[...] 19 // lldbr-check:(i32) local0 = 19 -// lldb-command:print local1 +// lldb-command:v local1 // lldbg-check:[...] true // lldbr-check:(bool) local1 = true -// lldb-command:print local2 +// lldb-command:v local2 // lldbg-check:[...] 20.5 // lldbr-check:(f64) local2 = 20.5 diff --git a/tests/debuginfo/function-arg-initialization.rs b/tests/debuginfo/function-arg-initialization.rs index 5288aa2e6f16..05935c30bea5 100644 --- a/tests/debuginfo/function-arg-initialization.rs +++ b/tests/debuginfo/function-arg-initialization.rs @@ -119,99 +119,99 @@ // lldb-command:run // IMMEDIATE ARGS -// lldb-command:print a +// lldb-command:v a // lldb-check:[...] 1 -// lldb-command:print b +// lldb-command:v b // lldb-check:[...] true -// lldb-command:print c +// lldb-command:v c // lldb-check:[...] 2.5 // lldb-command:continue // NON IMMEDIATE ARGS -// lldb-command:print a +// lldb-command:v a // lldb-check:[...] BigStruct { a: 3, b: 4, c: 5, d: 6, e: 7, f: 8, g: 9, h: 10 } -// lldb-command:print b +// lldb-command:v b // lldb-check:[...] BigStruct { a: 11, b: 12, c: 13, d: 14, e: 15, f: 16, g: 17, h: 18 } // lldb-command:continue // BINDING -// lldb-command:print a +// lldb-command:v a // lldb-check:[...] 19 -// lldb-command:print b +// lldb-command:v b // lldb-check:[...] 20 -// lldb-command:print c +// lldb-command:v c // lldb-check:[...] 21.5 // lldb-command:continue // ASSIGNMENT -// lldb-command:print a +// lldb-command:v a // lldb-check:[...] 22 -// lldb-command:print b +// lldb-command:v b // lldb-check:[...] 23 -// lldb-command:print c +// lldb-command:v c // lldb-check:[...] 24.5 // lldb-command:continue // FUNCTION CALL -// lldb-command:print x +// lldb-command:v x // lldb-check:[...] 25 -// lldb-command:print y +// lldb-command:v y // lldb-check:[...] 26 -// lldb-command:print z +// lldb-command:v z // lldb-check:[...] 27.5 // lldb-command:continue // EXPR -// lldb-command:print x +// lldb-command:v x // lldb-check:[...] 28 -// lldb-command:print y +// lldb-command:v y // lldb-check:[...] 29 -// lldb-command:print z +// lldb-command:v z // lldb-check:[...] 30.5 // lldb-command:continue // RETURN EXPR -// lldb-command:print x +// lldb-command:v x // lldb-check:[...] 31 -// lldb-command:print y +// lldb-command:v y // lldb-check:[...] 32 -// lldb-command:print z +// lldb-command:v z // lldb-check:[...] 33.5 // lldb-command:continue // ARITHMETIC EXPR -// lldb-command:print x +// lldb-command:v x // lldb-check:[...] 34 -// lldb-command:print y +// lldb-command:v y // lldb-check:[...] 35 -// lldb-command:print z +// lldb-command:v z // lldb-check:[...] 36.5 // lldb-command:continue // IF EXPR -// lldb-command:print x +// lldb-command:v x // lldb-check:[...] 37 -// lldb-command:print y +// lldb-command:v y // lldb-check:[...] 38 -// lldb-command:print z +// lldb-command:v z // lldb-check:[...] 39.5 // lldb-command:continue // WHILE EXPR -// lldb-command:print x +// lldb-command:v x // lldb-check:[...] 40 -// lldb-command:print y +// lldb-command:v y // lldb-check:[...] 41 -// lldb-command:print z +// lldb-command:v z // lldb-check:[...] 42 // lldb-command:continue // LOOP EXPR -// lldb-command:print x +// lldb-command:v x // lldb-check:[...] 43 -// lldb-command:print y +// lldb-command:v y // lldb-check:[...] 44 -// lldb-command:print z +// lldb-command:v z // lldb-check:[...] 45 // lldb-command:continue diff --git a/tests/debuginfo/function-arguments.rs b/tests/debuginfo/function-arguments.rs index 84271d07b389..b0afa1d07720 100644 --- a/tests/debuginfo/function-arguments.rs +++ b/tests/debuginfo/function-arguments.rs @@ -22,18 +22,18 @@ // lldb-command:run -// lldb-command:print x +// lldb-command:v x // lldbg-check:[...] 111102 // lldbr-check:(isize) x = 111102 -// lldb-command:print y +// lldb-command:v y // lldbg-check:[...] true // lldbr-check:(bool) y = true // lldb-command:continue -// lldb-command:print a +// lldb-command:v a // lldbg-check:[...] 2000 // lldbr-check:(i32) a = 2000 -// lldb-command:print b +// lldb-command:v b // lldbg-check:[...] 3000 // lldbr-check:(i64) b = 3000 // lldb-command:continue diff --git a/tests/debuginfo/function-prologue-stepping-regular.rs b/tests/debuginfo/function-prologue-stepping-regular.rs index 02567fd013e5..a1f44105bb94 100644 --- a/tests/debuginfo/function-prologue-stepping-regular.rs +++ b/tests/debuginfo/function-prologue-stepping-regular.rs @@ -20,99 +20,99 @@ // lldb-command:run // IMMEDIATE ARGS -// lldb-command:print a +// lldb-command:v a // lldb-check:[...] 1 -// lldb-command:print b +// lldb-command:v b // lldb-check:[...] true -// lldb-command:print c +// lldb-command:v c // lldb-check:[...] 2.5 // lldb-command:continue // NON IMMEDIATE ARGS -// lldb-command:print a +// lldb-command:v a // lldb-check:[...] { a = 3, b = 4, c = 5, d = 6, e = 7, f = 8, g = 9, h = 10 } -// lldb-command:print b +// lldb-command:v b // lldb-check:[...] { a = 11, b = 12, c = 13, d = 14, e = 15, f = 16, g = 17, h = 18 } // lldb-command:continue // BINDING -// lldb-command:print a +// lldb-command:v a // lldb-check:[...] 19 -// lldb-command:print b +// lldb-command:v b // lldb-check:[...] 20 -// lldb-command:print c +// lldb-command:v c // lldb-check:[...] 21.5 // lldb-command:continue // ASSIGNMENT -// lldb-command:print a +// lldb-command:v a // lldb-check:[...] 22 -// lldb-command:print b +// lldb-command:v b // lldb-check:[...] 23 -// lldb-command:print c +// lldb-command:v c // lldb-check:[...] 24.5 // lldb-command:continue // FUNCTION CALL -// lldb-command:print x +// lldb-command:v x // lldb-check:[...] 25 -// lldb-command:print y +// lldb-command:v y // lldb-check:[...] 26 -// lldb-command:print z +// lldb-command:v z // lldb-check:[...] 27.5 // lldb-command:continue // EXPR -// lldb-command:print x +// lldb-command:v x // lldb-check:[...] 28 -// lldb-command:print y +// lldb-command:v y // lldb-check:[...] 29 -// lldb-command:print z +// lldb-command:v z // lldb-check:[...] 30.5 // lldb-command:continue // RETURN EXPR -// lldb-command:print x +// lldb-command:v x // lldb-check:[...] 31 -// lldb-command:print y +// lldb-command:v y // lldb-check:[...] 32 -// lldb-command:print z +// lldb-command:v z // lldb-check:[...] 33.5 // lldb-command:continue // ARITHMETIC EXPR -// lldb-command:print x +// lldb-command:v x // lldb-check:[...] 34 -// lldb-command:print y +// lldb-command:v y // lldb-check:[...] 35 -// lldb-command:print z +// lldb-command:v z // lldb-check:[...] 36.5 // lldb-command:continue // IF EXPR -// lldb-command:print x +// lldb-command:v x // lldb-check:[...] 37 -// lldb-command:print y +// lldb-command:v y // lldb-check:[...] 38 -// lldb-command:print z +// lldb-command:v z // lldb-check:[...] 39.5 // lldb-command:continue // WHILE EXPR -// lldb-command:print x +// lldb-command:v x // lldb-check:[...] 40 -// lldb-command:print y +// lldb-command:v y // lldb-check:[...] 41 -// lldb-command:print z +// lldb-command:v z // lldb-check:[...] 42 // lldb-command:continue // LOOP EXPR -// lldb-command:print x +// lldb-command:v x // lldb-check:[...] 43 -// lldb-command:print y +// lldb-command:v y // lldb-check:[...] 44 -// lldb-command:print z +// lldb-command:v z // lldb-check:[...] 45 // lldb-command:continue diff --git a/tests/debuginfo/generic-enum-with-different-disr-sizes.rs b/tests/debuginfo/generic-enum-with-different-disr-sizes.rs index a7e97194e5df..7b23221213a5 100644 --- a/tests/debuginfo/generic-enum-with-different-disr-sizes.rs +++ b/tests/debuginfo/generic-enum-with-different-disr-sizes.rs @@ -39,22 +39,22 @@ // === LLDB TESTS ================================================================================== // lldb-command:run -// lldb-command:print eight_bytes1 +// lldb-command:v eight_bytes1 // lldb-check:[...] Variant1(100) -// lldb-command:print four_bytes1 +// lldb-command:v four_bytes1 // lldb-check:[...] Variant1(101) -// lldb-command:print two_bytes1 +// lldb-command:v two_bytes1 // lldb-check:[...] Variant1(102) -// lldb-command:print one_byte1 +// lldb-command:v one_byte1 // lldb-check:[...] Variant1('A') -// lldb-command:print eight_bytes2 +// lldb-command:v eight_bytes2 // lldb-check:[...] Variant2(100) -// lldb-command:print four_bytes2 +// lldb-command:v four_bytes2 // lldb-check:[...] Variant2(101) -// lldb-command:print two_bytes2 +// lldb-command:v two_bytes2 // lldb-check:[...] Variant2(102) -// lldb-command:print one_byte2 +// lldb-command:v one_byte2 // lldb-check:[...] Variant2('A') // lldb-command:continue diff --git a/tests/debuginfo/generic-function.rs b/tests/debuginfo/generic-function.rs index 5c33d0d8520b..e131ebfa306e 100644 --- a/tests/debuginfo/generic-function.rs +++ b/tests/debuginfo/generic-function.rs @@ -29,26 +29,26 @@ // lldb-command:run -// lldb-command:print *t0 +// lldb-command:v *t0 // lldbg-check:[...] 1 // lldbr-check:(i32) *t0 = 1 -// lldb-command:print *t1 +// lldb-command:v *t1 // lldbg-check:[...] 2.5 // lldbr-check:(f64) *t1 = 2.5 // lldb-command:continue -// lldb-command:print *t0 +// lldb-command:v *t0 // lldbg-check:[...] 3.5 // lldbr-check:(f64) *t0 = 3.5 -// lldb-command:print *t1 +// lldb-command:v *t1 // lldbg-check:[...] 4 // lldbr-check:(u16) *t1 = 4 // lldb-command:continue -// lldb-command:print *t0 +// lldb-command:v *t0 // lldbg-check:[...] 5 // lldbr-check:(i32) *t0 = 5 -// lldb-command:print *t1 +// lldb-command:v *t1 // lldbg-check:[...] { a = 6 b = 7.5 } // lldbr-check:(generic_function::Struct) *t1 = { a = 6 b = 7.5 } // lldb-command:continue diff --git a/tests/debuginfo/generic-functions-nested.rs b/tests/debuginfo/generic-functions-nested.rs index 4be0ab80f650..eee0c1511822 100644 --- a/tests/debuginfo/generic-functions-nested.rs +++ b/tests/debuginfo/generic-functions-nested.rs @@ -35,34 +35,34 @@ // lldb-command:run -// lldb-command:print x +// lldb-command:v x // lldbg-check:[...] -1 // lldbr-check:(i32) x = -1 -// lldb-command:print y +// lldb-command:v y // lldbg-check:[...] 1 // lldbr-check:(i32) y = 1 // lldb-command:continue -// lldb-command:print x +// lldb-command:v x // lldbg-check:[...] -1 // lldbr-check:(i32) x = -1 -// lldb-command:print y +// lldb-command:v y // lldbg-check:[...] 2.5 // lldbr-check:(f64) y = 2.5 // lldb-command:continue -// lldb-command:print x +// lldb-command:v x // lldbg-check:[...] -2.5 // lldbr-check:(f64) x = -2.5 -// lldb-command:print y +// lldb-command:v y // lldbg-check:[...] 1 // lldbr-check:(i32) y = 1 // lldb-command:continue -// lldb-command:print x +// lldb-command:v x // lldbg-check:[...] -2.5 // lldbr-check:(f64) x = -2.5 -// lldb-command:print y +// lldb-command:v y // lldbg-check:[...] 2.5 // lldbr-check:(f64) y = 2.5 // lldb-command:continue diff --git a/tests/debuginfo/generic-method-on-generic-struct.rs b/tests/debuginfo/generic-method-on-generic-struct.rs index dea1c17ad416..0f7067404103 100644 --- a/tests/debuginfo/generic-method-on-generic-struct.rs +++ b/tests/debuginfo/generic-method-on-generic-struct.rs @@ -64,61 +64,61 @@ // lldb-command:run // STACK BY REF -// lldb-command:print *self +// lldb-command:v *self // lldbg-check:[...] { x = { 0 = 8888, 1 = -8888 } } // lldbr-check:(generic_method_on_generic_struct::Struct<(u32, i32)>) *self = { x = { 0 = 8888 1 = -8888 } } -// lldb-command:print arg1 +// lldb-command:v arg1 // lldbg-check:[...] -1 // lldbr-check:(isize) arg1 = -1 -// lldb-command:print arg2 +// lldb-command:v arg2 // lldbg-check:[...] 2 // lldbr-check:(u16) arg2 = 2 // lldb-command:continue // STACK BY VAL -// lldb-command:print self +// lldb-command:v self // lldbg-check:[...] { x = { 0 = 8888, 1 = -8888 } } // lldbr-check:(generic_method_on_generic_struct::Struct<(u32, i32)>) self = { x = { 0 = 8888, 1 = -8888 } } -// lldb-command:print arg1 +// lldb-command:v arg1 // lldbg-check:[...] -3 // lldbr-check:(isize) arg1 = -3 -// lldb-command:print arg2 +// lldb-command:v arg2 // lldbg-check:[...] -4 // lldbr-check:(i16) arg2 = -4 // lldb-command:continue // OWNED BY REF -// lldb-command:print *self +// lldb-command:v *self // lldbg-check:[...] { x = 1234.5 } // lldbr-check:(generic_method_on_generic_struct::Struct) *self = { x = 1234.5 } -// lldb-command:print arg1 +// lldb-command:v arg1 // lldbg-check:[...] -5 // lldbr-check:(isize) arg1 = -5 -// lldb-command:print arg2 +// lldb-command:v arg2 // lldbg-check:[...] -6 // lldbr-check:(i32) arg2 = -6 // lldb-command:continue // OWNED BY VAL -// lldb-command:print self +// lldb-command:v self // lldbg-check:[...] { x = 1234.5 } // lldbr-check:(generic_method_on_generic_struct::Struct) self = { x = 1234.5 } -// lldb-command:print arg1 +// lldb-command:v arg1 // lldbg-check:[...] -7 // lldbr-check:(isize) arg1 = -7 -// lldb-command:print arg2 +// lldb-command:v arg2 // lldbg-check:[...] -8 // lldbr-check:(i64) arg2 = -8 // lldb-command:continue // OWNED MOVED -// lldb-command:print *self +// lldb-command:v *self // lldbg-check:[...] { x = 1234.5 } // lldbr-check:(generic_method_on_generic_struct::Struct) *self = { x = 1234.5 } -// lldb-command:print arg1 +// lldb-command:v arg1 // lldbg-check:[...] -9 // lldbr-check:(isize) arg1 = -9 -// lldb-command:print arg2 +// lldb-command:v arg2 // lldbg-check:[...] -10.5 // lldbr-check:(f32) arg2 = -10.5 // lldb-command:continue diff --git a/tests/debuginfo/generic-struct.rs b/tests/debuginfo/generic-struct.rs index 4c442feec6ac..8c74aa42d2ca 100644 --- a/tests/debuginfo/generic-struct.rs +++ b/tests/debuginfo/generic-struct.rs @@ -25,17 +25,17 @@ // lldb-command:run -// lldb-command:print int_int +// lldb-command:v int_int // lldbg-check:[...] AGenericStruct { key: 0, value: 1 } // lldbr-check:(generic_struct::AGenericStruct) int_int = AGenericStruct { key: 0, value: 1 } -// lldb-command:print int_float +// lldb-command:v int_float // lldbg-check:[...] AGenericStruct { key: 2, value: 3.5 } // lldbr-check:(generic_struct::AGenericStruct) int_float = AGenericStruct { key: 2, value: 3.5 } -// lldb-command:print float_int +// lldb-command:v float_int // lldbg-check:[...] AGenericStruct { key: 4.5, value: 5 } // lldbr-check:(generic_struct::AGenericStruct) float_int = AGenericStruct { key: 4.5, value: 5 } -// lldb-command:print float_int_float +// lldb-command:v float_int_float // lldbg-check:[...] AGenericStruct> { key: 6.5, value: AGenericStruct { key: 7, value: 8.5 } } // lldbr-check:(generic_struct::AGenericStruct>) float_int_float = AGenericStruct> { key: 6.5, value: AGenericStruct { key: 7, value: 8.5 } } diff --git a/tests/debuginfo/generic-tuple-style-enum.rs b/tests/debuginfo/generic-tuple-style-enum.rs index fb5deb9b1982..af90c6ce30ea 100644 --- a/tests/debuginfo/generic-tuple-style-enum.rs +++ b/tests/debuginfo/generic-tuple-style-enum.rs @@ -26,16 +26,16 @@ // lldb-command:run -// lldb-command:print case1 +// lldb-command:v case1 // lldbr-check:(generic_tuple_style_enum::Regular::Case1) case1 = { __0 = 0 __1 = 31868 __2 = 31868 __3 = 31868 __4 = 31868 } -// lldb-command:print case2 +// lldb-command:v case2 // lldbr-check:(generic_tuple_style_enum::Regular::Case2) case2 = Regular::Case2 { Case1: 0, Case2: 286331153, Case3: 286331153 } -// lldb-command:print case3 +// lldb-command:v case3 // lldbr-check:(generic_tuple_style_enum::Regular::Case3) case3 = Regular::Case3 { Case1: 0, Case2: 6438275382588823897 } -// lldb-command:print univariant +// lldb-command:v univariant // lldbr-check:(generic_tuple_style_enum::Univariant) univariant = Univariant { TheOnlyCase: Univariant::TheOnlyCase(-1) } #![feature(omit_gdb_pretty_printer_section)] diff --git a/tests/debuginfo/include_string.rs b/tests/debuginfo/include_string.rs index 77b2d7dec5f9..75013ab5274e 100644 --- a/tests/debuginfo/include_string.rs +++ b/tests/debuginfo/include_string.rs @@ -15,13 +15,13 @@ // lldb-command:run -// lldb-command:print string1.length +// lldb-command:v string1.length // lldbg-check:[...] 48 // lldbr-check:(usize) length = 48 -// lldb-command:print string2.length +// lldb-command:v string2.length // lldbg-check:[...] 49 // lldbr-check:(usize) length = 49 -// lldb-command:print string3.length +// lldb-command:v string3.length // lldbg-check:[...] 50 // lldbr-check:(usize) length = 50 diff --git a/tests/debuginfo/issue-22656.rs b/tests/debuginfo/issue-22656.rs index 375967f2072a..5a5442acd95f 100644 --- a/tests/debuginfo/issue-22656.rs +++ b/tests/debuginfo/issue-22656.rs @@ -10,10 +10,10 @@ // === LLDB TESTS ================================================================================== // lldb-command:run -// lldb-command:print v +// lldb-command:v v // lldbg-check:[...] size=3 { [0] = 1 [1] = 2 [2] = 3 } // lldbr-check:(alloc::vec::Vec) v = size=3 { [0] = 1 [1] = 2 [2] = 3 } -// lldb-command:print zs +// lldb-command:v zs // lldbg-check:[...] { x = y = 123 z = w = 456 } // lldbr-check:(issue_22656::StructWithZeroSizedField) zs = { x = y = 123 z = w = 456 } // lldbr-command:continue diff --git a/tests/debuginfo/issue-57822.rs b/tests/debuginfo/issue-57822.rs index 5d0973c1d6b3..93e1a2558f69 100644 --- a/tests/debuginfo/issue-57822.rs +++ b/tests/debuginfo/issue-57822.rs @@ -20,11 +20,11 @@ // lldb-command:run -// lldb-command:print g -// lldbg-check:(issue_57822::main::{closure_env#1}) { f = { x = 1 } } +// lldb-command:v g +// lldbg-check:(issue_57822::main::{closure_env#1}) g = { f = { x = 1 } } -// lldb-command:print b -// lldbg-check:(issue_57822::main::{coroutine_env#3}) +// lldb-command:v b +// lldbg-check:(issue_57822::main::{coroutine_env#3}) b = #![feature(omit_gdb_pretty_printer_section, coroutines, coroutine_trait)] #![omit_gdb_pretty_printer_section] diff --git a/tests/debuginfo/lexical-scope-in-for-loop.rs b/tests/debuginfo/lexical-scope-in-for-loop.rs index 6d8ff2970ef1..1b1f106fecec 100644 --- a/tests/debuginfo/lexical-scope-in-for-loop.rs +++ b/tests/debuginfo/lexical-scope-in-for-loop.rs @@ -44,40 +44,40 @@ // lldb-command:run // FIRST ITERATION -// lldb-command:print x +// lldb-command:v x // lldbg-check:[...] 1 // lldbr-check:(i32) x = 1 // lldb-command:continue -// lldb-command:print x +// lldb-command:v x // lldbg-check:[...] -1 // lldbr-check:(i32) x = -1 // lldb-command:continue // SECOND ITERATION -// lldb-command:print x +// lldb-command:v x // lldbg-check:[...] 2 // lldbr-check:(i32) x = 2 // lldb-command:continue -// lldb-command:print x +// lldb-command:v x // lldbg-check:[...] -2 // lldbr-check:(i32) x = -2 // lldb-command:continue // THIRD ITERATION -// lldb-command:print x +// lldb-command:v x // lldbg-check:[...] 3 // lldbr-check:(i32) x = 3 // lldb-command:continue -// lldb-command:print x +// lldb-command:v x // lldbg-check:[...] -3 // lldbr-check:(i32) x = -3 // lldb-command:continue // AFTER LOOP -// lldb-command:print x +// lldb-command:v x // lldbg-check:[...] 1000000 // lldbr-check:(i32) x = 1000000 // lldb-command:continue diff --git a/tests/debuginfo/lexical-scope-in-if.rs b/tests/debuginfo/lexical-scope-in-if.rs index 3e473acbda25..d472a50f6977 100644 --- a/tests/debuginfo/lexical-scope-in-if.rs +++ b/tests/debuginfo/lexical-scope-in-if.rs @@ -68,73 +68,73 @@ // lldb-command:run // BEFORE if -// lldb-command:print x +// lldb-command:v x // lldbg-check:[...] 999 // lldbr-check:(i32) x = 999 -// lldb-command:print y +// lldb-command:v y // lldbg-check:[...] -1 // lldbr-check:(i32) y = -1 // lldb-command:continue // AT BEGINNING of 'then' block -// lldb-command:print x +// lldb-command:v x // lldbg-check:[...] 999 // lldbr-check:(i32) x = 999 -// lldb-command:print y +// lldb-command:v y // lldbg-check:[...] -1 // lldbr-check:(i32) y = -1 // lldb-command:continue // AFTER 1st redeclaration of 'x' -// lldb-command:print x +// lldb-command:v x // lldbg-check:[...] 1001 // lldbr-check:(i32) x = 1001 -// lldb-command:print y +// lldb-command:v y // lldbg-check:[...] -1 // lldbr-check:(i32) y = -1 // lldb-command:continue // AFTER 2st redeclaration of 'x' -// lldb-command:print x +// lldb-command:v x // lldbg-check:[...] 1002 // lldbr-check:(i32) x = 1002 -// lldb-command:print y +// lldb-command:v y // lldbg-check:[...] 1003 // lldbr-check:(i32) y = 1003 // lldb-command:continue // AFTER 1st if expression -// lldb-command:print x +// lldb-command:v x // lldbg-check:[...] 999 // lldbr-check:(i32) x = 999 -// lldb-command:print y +// lldb-command:v y // lldbg-check:[...] -1 // lldbr-check:(i32) y = -1 // lldb-command:continue // BEGINNING of else branch -// lldb-command:print x +// lldb-command:v x // lldbg-check:[...] 999 // lldbr-check:(i32) x = 999 -// lldb-command:print y +// lldb-command:v y // lldbg-check:[...] -1 // lldbr-check:(i32) y = -1 // lldb-command:continue // BEGINNING of else branch -// lldb-command:print x +// lldb-command:v x // lldbg-check:[...] 1004 // lldbr-check:(i32) x = 1004 -// lldb-command:print y +// lldb-command:v y // lldbg-check:[...] 1005 // lldbr-check:(i32) y = 1005 // lldb-command:continue // BEGINNING of else branch -// lldb-command:print x +// lldb-command:v x // lldbg-check:[...] 999 // lldbr-check:(i32) x = 999 -// lldb-command:print y +// lldb-command:v y // lldbg-check:[...] -1 // lldbr-check:(i32) y = -1 // lldb-command:continue diff --git a/tests/debuginfo/lexical-scope-in-match.rs b/tests/debuginfo/lexical-scope-in-match.rs index 0959f020ca31..d5f0fcbe8927 100644 --- a/tests/debuginfo/lexical-scope-in-match.rs +++ b/tests/debuginfo/lexical-scope-in-match.rs @@ -63,72 +63,72 @@ // lldb-command:run -// lldb-command:print shadowed +// lldb-command:v shadowed // lldbg-check:[...] 231 // lldbr-check:(i32) shadowed = 231 -// lldb-command:print not_shadowed +// lldb-command:v not_shadowed // lldbg-check:[...] 232 // lldbr-check:(i32) not_shadowed = 232 // lldb-command:continue -// lldb-command:print shadowed +// lldb-command:v shadowed // lldbg-check:[...] 233 // lldbr-check:(i32) shadowed = 233 -// lldb-command:print not_shadowed +// lldb-command:v not_shadowed // lldbg-check:[...] 232 // lldbr-check:(i32) not_shadowed = 232 -// lldb-command:print local_to_arm +// lldb-command:v local_to_arm // lldbg-check:[...] 234 // lldbr-check:(i32) local_to_arm = 234 // lldb-command:continue -// lldb-command:print shadowed +// lldb-command:v shadowed // lldbg-check:[...] 236 // lldbr-check:(i32) shadowed = 236 -// lldb-command:print not_shadowed +// lldb-command:v not_shadowed // lldbg-check:[...] 232 // lldbr-check:(i32) not_shadowed = 232 // lldb-command:continue -// lldb-command:print shadowed +// lldb-command:v shadowed // lldbg-check:[...] 237 // lldbr-check:(isize) shadowed = 237 -// lldb-command:print not_shadowed +// lldb-command:v not_shadowed // lldbg-check:[...] 232 // lldbr-check:(i32) not_shadowed = 232 -// lldb-command:print local_to_arm +// lldb-command:v local_to_arm // lldbg-check:[...] 238 // lldbr-check:(isize) local_to_arm = 238 // lldb-command:continue -// lldb-command:print shadowed +// lldb-command:v shadowed // lldbg-check:[...] 239 // lldbr-check:(isize) shadowed = 239 -// lldb-command:print not_shadowed +// lldb-command:v not_shadowed // lldbg-check:[...] 232 // lldbr-check:(i32) not_shadowed = 232 // lldb-command:continue -// lldb-command:print shadowed +// lldb-command:v shadowed // lldbg-check:[...] 241 // lldbr-check:(isize) shadowed = 241 -// lldb-command:print not_shadowed +// lldb-command:v not_shadowed // lldbg-check:[...] 232 // lldbr-check:(i32) not_shadowed = 232 // lldb-command:continue -// lldb-command:print shadowed +// lldb-command:v shadowed // lldbg-check:[...] 243 // lldbr-check:(i32) shadowed = 243 -// lldb-command:print *local_to_arm +// lldb-command:v *local_to_arm // lldbg-check:[...] 244 // lldbr-check:(i32) *local_to_arm = 244 // lldb-command:continue -// lldb-command:print shadowed +// lldb-command:v shadowed // lldbg-check:[...] 231 // lldbr-check:(i32) shadowed = 231 -// lldb-command:print not_shadowed +// lldb-command:v not_shadowed // lldbg-check:[...] 232 // lldbr-check:(i32) not_shadowed = 232 // lldb-command:continue diff --git a/tests/debuginfo/lexical-scope-in-stack-closure.rs b/tests/debuginfo/lexical-scope-in-stack-closure.rs index 4d26b2f5c9ab..92582e10c42d 100644 --- a/tests/debuginfo/lexical-scope-in-stack-closure.rs +++ b/tests/debuginfo/lexical-scope-in-stack-closure.rs @@ -35,32 +35,32 @@ // lldb-command:run -// lldb-command:print x +// lldb-command:v x // lldbg-check:[...] false // lldbr-check:(bool) x = false // lldb-command:continue -// lldb-command:print x +// lldb-command:v x // lldbg-check:[...] false // lldbr-check:(bool) x = false // lldb-command:continue -// lldb-command:print x +// lldb-command:v x // lldbg-check:[...] 1000 // lldbr-check:(isize) x = 1000 // lldb-command:continue -// lldb-command:print x +// lldb-command:v x // lldbg-check:[...] 2.5 // lldbr-check:(f64) x = 2.5 // lldb-command:continue -// lldb-command:print x +// lldb-command:v x // lldbg-check:[...] true // lldbr-check:(bool) x = true // lldb-command:continue -// lldb-command:print x +// lldb-command:v x // lldbg-check:[...] false // lldbr-check:(bool) x = false // lldb-command:continue diff --git a/tests/debuginfo/lexical-scope-in-unconditional-loop.rs b/tests/debuginfo/lexical-scope-in-unconditional-loop.rs index cf908b1a510a..b1af018f3eb0 100644 --- a/tests/debuginfo/lexical-scope-in-unconditional-loop.rs +++ b/tests/debuginfo/lexical-scope-in-unconditional-loop.rs @@ -67,69 +67,69 @@ // lldb-command:run // FIRST ITERATION -// lldb-command:print x +// lldb-command:v x // lldbg-check:[...] 0 // lldbr-check:(i32) x = 0 // lldb-command:continue -// lldb-command:print x +// lldb-command:v x // lldbg-check:[...] 1 // lldbr-check:(i32) x = 1 // lldb-command:continue -// lldb-command:print x +// lldb-command:v x // lldbg-check:[...] 101 // lldbr-check:(i32) x = 101 // lldb-command:continue -// lldb-command:print x +// lldb-command:v x // lldbg-check:[...] 101 // lldbr-check:(i32) x = 101 // lldb-command:continue -// lldb-command:print x +// lldb-command:v x // lldbg-check:[...] -987 // lldbr-check:(i32) x = -987 // lldb-command:continue -// lldb-command:print x +// lldb-command:v x // lldbg-check:[...] 101 // lldbr-check:(i32) x = 101 // lldb-command:continue // SECOND ITERATION -// lldb-command:print x +// lldb-command:v x // lldbg-check:[...] 1 // lldbr-check:(i32) x = 1 // lldb-command:continue -// lldb-command:print x +// lldb-command:v x // lldbg-check:[...] 2 // lldbr-check:(i32) x = 2 // lldb-command:continue -// lldb-command:print x +// lldb-command:v x // lldbg-check:[...] 102 // lldbr-check:(i32) x = 102 // lldb-command:continue -// lldb-command:print x +// lldb-command:v x // lldbg-check:[...] 102 // lldbr-check:(i32) x = 102 // lldb-command:continue -// lldb-command:print x +// lldb-command:v x // lldbg-check:[...] -987 // lldbr-check:(i32) x = -987 // lldb-command:continue -// lldb-command:print x +// lldb-command:v x // lldbg-check:[...] 102 // lldbr-check:(i32) x = 102 // lldb-command:continue -// lldb-command:print x +// lldb-command:v x // lldbg-check:[...] 2 // lldbr-check:(i32) x = 2 // lldb-command:continue diff --git a/tests/debuginfo/lexical-scope-in-unique-closure.rs b/tests/debuginfo/lexical-scope-in-unique-closure.rs index df8c2598e384..a08c2af05ccb 100644 --- a/tests/debuginfo/lexical-scope-in-unique-closure.rs +++ b/tests/debuginfo/lexical-scope-in-unique-closure.rs @@ -35,32 +35,32 @@ // lldb-command:run -// lldb-command:print x +// lldb-command:v x // lldbg-check:[...] false // lldbr-check:(bool) x = false // lldb-command:continue -// lldb-command:print x +// lldb-command:v x // lldbg-check:[...] false // lldbr-check:(bool) x = false // lldb-command:continue -// lldb-command:print x +// lldb-command:v x // lldbg-check:[...] 1000 // lldbr-check:(isize) x = 1000 // lldb-command:continue -// lldb-command:print x +// lldb-command:v x // lldbg-check:[...] 2.5 // lldbr-check:(f64) x = 2.5 // lldb-command:continue -// lldb-command:print x +// lldb-command:v x // lldbg-check:[...] true // lldbr-check:(bool) x = true // lldb-command:continue -// lldb-command:print x +// lldb-command:v x // lldbg-check:[...] false // lldbr-check:(bool) x = false // lldb-command:continue diff --git a/tests/debuginfo/lexical-scope-in-while.rs b/tests/debuginfo/lexical-scope-in-while.rs index 98c580e479c1..bd885b5b10c1 100644 --- a/tests/debuginfo/lexical-scope-in-while.rs +++ b/tests/debuginfo/lexical-scope-in-while.rs @@ -67,69 +67,69 @@ // lldb-command:run // FIRST ITERATION -// lldb-command:print x +// lldb-command:v x // lldbg-check:[...] 0 // lldbr-check:(i32) x = 0 // lldb-command:continue -// lldb-command:print x +// lldb-command:v x // lldbg-check:[...] 1 // lldbr-check:(i32) x = 1 // lldb-command:continue -// lldb-command:print x +// lldb-command:v x // lldbg-check:[...] 101 // lldbr-check:(i32) x = 101 // lldb-command:continue -// lldb-command:print x +// lldb-command:v x // lldbg-check:[...] 101 // lldbr-check:(i32) x = 101 // lldb-command:continue -// lldb-command:print x +// lldb-command:v x // lldbg-check:[...] -987 // lldbr-check:(i32) x = -987 // lldb-command:continue -// lldb-command:print x +// lldb-command:v x // lldbg-check:[...] 101 // lldbr-check:(i32) x = 101 // lldb-command:continue // SECOND ITERATION -// lldb-command:print x +// lldb-command:v x // lldbg-check:[...] 1 // lldbr-check:(i32) x = 1 // lldb-command:continue -// lldb-command:print x +// lldb-command:v x // lldbg-check:[...] 2 // lldbr-check:(i32) x = 2 // lldb-command:continue -// lldb-command:print x +// lldb-command:v x // lldbg-check:[...] 102 // lldbr-check:(i32) x = 102 // lldb-command:continue -// lldb-command:print x +// lldb-command:v x // lldbg-check:[...] 102 // lldbr-check:(i32) x = 102 // lldb-command:continue -// lldb-command:print x +// lldb-command:v x // lldbg-check:[...] -987 // lldbr-check:(i32) x = -987 // lldb-command:continue -// lldb-command:print x +// lldb-command:v x // lldbg-check:[...] 102 // lldbr-check:(i32) x = 102 // lldb-command:continue -// lldb-command:print x +// lldb-command:v x // lldbg-check:[...] 2 // lldbr-check:(i32) x = 2 // lldb-command:continue diff --git a/tests/debuginfo/lexical-scope-with-macro.rs b/tests/debuginfo/lexical-scope-with-macro.rs index a38aba8b16ab..76c923524fb5 100644 --- a/tests/debuginfo/lexical-scope-with-macro.rs +++ b/tests/debuginfo/lexical-scope-with-macro.rs @@ -56,34 +56,34 @@ // lldb-command:run -// lldb-command:print a +// lldb-command:v a // lldbg-check:[...] 10 // lldbr-check:(i32) a = 10 -// lldb-command:print b +// lldb-command:v b // lldbg-check:[...] 34 // lldbr-check:(i32) b = 34 // lldb-command:continue -// lldb-command:print a +// lldb-command:v a // lldbg-check:[...] 890242 // lldbr-check:(i32) a = 10 -// lldb-command:print b +// lldb-command:v b // lldbg-check:[...] 34 // lldbr-check:(i32) b = 34 // lldb-command:continue -// lldb-command:print a +// lldb-command:v a // lldbg-check:[...] 10 // lldbr-check:(i32) a = 10 -// lldb-command:print b +// lldb-command:v b // lldbg-check:[...] 34 // lldbr-check:(i32) b = 34 // lldb-command:continue -// lldb-command:print a +// lldb-command:v a // lldbg-check:[...] 102 // lldbr-check:(i32) a = 10 -// lldb-command:print b +// lldb-command:v b // lldbg-check:[...] 34 // lldbr-check:(i32) b = 34 // lldb-command:continue diff --git a/tests/debuginfo/lexical-scopes-in-block-expression.rs b/tests/debuginfo/lexical-scopes-in-block-expression.rs index 5a82dc6e3f35..5ff70270ea62 100644 --- a/tests/debuginfo/lexical-scopes-in-block-expression.rs +++ b/tests/debuginfo/lexical-scopes-in-block-expression.rs @@ -194,202 +194,202 @@ // lldb-command:run // STRUCT EXPRESSION -// lldb-command:print val +// lldb-command:v val // lldbg-check:[...] -1 // lldbr-check:(i32) val = -1 -// lldb-command:print ten +// lldb-command:v ten // lldbg-check:[...] 10 // lldbr-check:(isize) ten = 10 // lldb-command:continue -// lldb-command:print val +// lldb-command:v val // lldbg-check:[...] 11 // lldbr-check:(isize) val = 11 -// lldb-command:print ten +// lldb-command:v ten // lldbg-check:[...] 10 // lldbr-check:(isize) ten = 10 // lldb-command:continue -// lldb-command:print val +// lldb-command:v val // lldbg-check:[...] -1 // lldbr-check:(i32) val = -1 -// lldb-command:print ten +// lldb-command:v ten // lldbg-check:[...] 10 // lldbr-check:(isize) ten = 10 // lldb-command:continue // FUNCTION CALL -// lldb-command:print val +// lldb-command:v val // lldbg-check:[...] -1 // lldbr-check:(i32) val = -1 -// lldb-command:print ten +// lldb-command:v ten // lldbg-check:[...] 10 // lldbr-check:(isize) ten = 10 // lldb-command:continue -// lldb-command:print val +// lldb-command:v val // lldbg-check:[...] 12 // lldbr-check:(isize) val = 12 -// lldb-command:print ten +// lldb-command:v ten // lldbg-check:[...] 10 // lldbr-check:(isize) ten = 10 // lldb-command:continue -// lldb-command:print val +// lldb-command:v val // lldbg-check:[...] -1 // lldbr-check:(i32) val = -1 -// lldb-command:print ten +// lldb-command:v ten // lldbg-check:[...] 10 // lldbr-check:(isize) ten = 10 // lldb-command:continue // TUPLE EXPRESSION -// lldb-command:print val +// lldb-command:v val // lldbg-check:[...] -1 // lldbr-check:(i32) val = -1 -// lldb-command:print ten +// lldb-command:v ten // lldbg-check:[...] 10 // lldbr-check:(isize) ten = 10 // lldb-command:continue -// lldb-command:print val +// lldb-command:v val // lldbg-check:[...] 13 // lldbr-check:(isize) val = 13 -// lldb-command:print ten +// lldb-command:v ten // lldbg-check:[...] 10 // lldbr-check:(isize) ten = 10 // lldb-command:continue -// lldb-command:print val +// lldb-command:v val // lldbg-check:[...] -1 // lldbr-check:(i32) val = -1 -// lldb-command:print ten +// lldb-command:v ten // lldbg-check:[...] 10 // lldbr-check:(isize) ten = 10 // lldb-command:continue // VEC EXPRESSION -// lldb-command:print val +// lldb-command:v val // lldbg-check:[...] -1 // lldbr-check:(i32) val = -1 -// lldb-command:print ten +// lldb-command:v ten // lldbg-check:[...] 10 // lldbr-check:(isize) ten = 10 // lldb-command:continue -// lldb-command:print val +// lldb-command:v val // lldbg-check:[...] 14 // lldbr-check:(isize) val = 14 -// lldb-command:print ten +// lldb-command:v ten // lldbg-check:[...] 10 // lldbr-check:(isize) ten = 10 // lldb-command:continue -// lldb-command:print val +// lldb-command:v val // lldbg-check:[...] -1 // lldbr-check:(i32) val = -1 -// lldb-command:print ten +// lldb-command:v ten // lldbg-check:[...] 10 // lldbr-check:(isize) ten = 10 // lldb-command:continue // REPEAT VEC EXPRESSION -// lldb-command:print val +// lldb-command:v val // lldbg-check:[...] -1 // lldbr-check:(i32) val = -1 -// lldb-command:print ten +// lldb-command:v ten // lldbg-check:[...] 10 // lldbr-check:(isize) ten = 10 // lldb-command:continue -// lldb-command:print val +// lldb-command:v val // lldbg-check:[...] 15 // lldbr-check:(isize) val = 15 -// lldb-command:print ten +// lldb-command:v ten // lldbg-check:[...] 10 // lldbr-check:(isize) ten = 10 // lldb-command:continue -// lldb-command:print val +// lldb-command:v val // lldbg-check:[...] -1 // lldbr-check:(i32) val = -1 -// lldb-command:print ten +// lldb-command:v ten // lldbg-check:[...] 10 // lldbr-check:(isize) ten = 10 // lldb-command:continue // ASSIGNMENT EXPRESSION -// lldb-command:print val +// lldb-command:v val // lldbg-check:[...] -1 // lldbr-check:(i32) val = -1 -// lldb-command:print ten +// lldb-command:v ten // lldbg-check:[...] 10 // lldbr-check:(isize) ten = 10 // lldb-command:continue -// lldb-command:print val +// lldb-command:v val // lldbg-check:[...] 16 // lldbr-check:(isize) val = 16 -// lldb-command:print ten +// lldb-command:v ten // lldbg-check:[...] 10 // lldbr-check:(isize) ten = 10 // lldb-command:continue -// lldb-command:print val +// lldb-command:v val // lldbg-check:[...] -1 // lldbr-check:(i32) val = -1 -// lldb-command:print ten +// lldb-command:v ten // lldbg-check:[...] 10 // lldbr-check:(isize) ten = 10 // lldb-command:continue // ARITHMETIC EXPRESSION -// lldb-command:print val +// lldb-command:v val // lldbg-check:[...] -1 // lldbr-check:(i32) val = -1 -// lldb-command:print ten +// lldb-command:v ten // lldbg-check:[...] 10 // lldbr-check:(isize) ten = 10 // lldb-command:continue -// lldb-command:print val +// lldb-command:v val // lldbg-check:[...] 17 // lldbr-check:(isize) val = 17 -// lldb-command:print ten +// lldb-command:v ten // lldbg-check:[...] 10 // lldbr-check:(isize) ten = 10 // lldb-command:continue -// lldb-command:print val +// lldb-command:v val // lldbg-check:[...] -1 // lldbr-check:(i32) val = -1 -// lldb-command:print ten +// lldb-command:v ten // lldbg-check:[...] 10 // lldbr-check:(isize) ten = 10 // lldb-command:continue // INDEX EXPRESSION -// lldb-command:print val +// lldb-command:v val // lldbg-check:[...] -1 // lldbr-check:(i32) val = -1 -// lldb-command:print ten +// lldb-command:v ten // lldbg-check:[...] 10 // lldbr-check:(isize) ten = 10 // lldb-command:continue -// lldb-command:print val +// lldb-command:v val // lldbg-check:[...] 18 // lldbr-check:(isize) val = 18 -// lldb-command:print ten +// lldb-command:v ten // lldbg-check:[...] 10 // lldbr-check:(isize) ten = 10 // lldb-command:continue -// lldb-command:print val +// lldb-command:v val // lldbg-check:[...] -1 // lldbr-check:(i32) val = -1 -// lldb-command:print ten +// lldb-command:v ten // lldbg-check:[...] 10 // lldbr-check:(isize) ten = 10 // lldb-command:continue diff --git a/tests/debuginfo/method-on-enum.rs b/tests/debuginfo/method-on-enum.rs index f947ba350e7f..8a57060717e4 100644 --- a/tests/debuginfo/method-on-enum.rs +++ b/tests/debuginfo/method-on-enum.rs @@ -63,47 +63,47 @@ // lldb-command:run // STACK BY REF -// lldb-command:print *self +// lldb-command:v *self // lldb-check:[...] Variant2(117901063) -// lldb-command:print arg1 +// lldb-command:v arg1 // lldb-check:[...] -1 -// lldb-command:print arg2 +// lldb-command:v arg2 // lldb-check:[...] -2 // lldb-command:continue // STACK BY VAL -// lldb-command:print self +// lldb-command:v self // lldb-check:[...] Variant2(117901063) -// lldb-command:print arg1 +// lldb-command:v arg1 // lldb-check:[...] -3 -// lldb-command:print arg2 +// lldb-command:v arg2 // lldb-check:[...] -4 // lldb-command:continue // OWNED BY REF -// lldb-command:print *self +// lldb-command:v *self // lldb-check:[...] Variant1 { x: 1799, y: 1799 } -// lldb-command:print arg1 +// lldb-command:v arg1 // lldb-check:[...] -5 -// lldb-command:print arg2 +// lldb-command:v arg2 // lldb-check:[...] -6 // lldb-command:continue // OWNED BY VAL -// lldb-command:print self +// lldb-command:v self // lldb-check:[...] Variant1 { x: 1799, y: 1799 } -// lldb-command:print arg1 +// lldb-command:v arg1 // lldb-check:[...] -7 -// lldb-command:print arg2 +// lldb-command:v arg2 // lldb-check:[...] -8 // lldb-command:continue // OWNED MOVED -// lldb-command:print *self +// lldb-command:v *self // lldb-check:[...] Variant1 { x: 1799, y: 1799 } -// lldb-command:print arg1 +// lldb-command:v arg1 // lldb-check:[...] -9 -// lldb-command:print arg2 +// lldb-command:v arg2 // lldb-check:[...] -10 // lldb-command:continue diff --git a/tests/debuginfo/method-on-generic-struct.rs b/tests/debuginfo/method-on-generic-struct.rs index 16793fb9bc65..64ef0e6bb0c3 100644 --- a/tests/debuginfo/method-on-generic-struct.rs +++ b/tests/debuginfo/method-on-generic-struct.rs @@ -64,61 +64,61 @@ // lldb-command:run // STACK BY REF -// lldb-command:print *self +// lldb-command:v *self // lldbg-check:[...] Struct<(u32, i32)> { x: (8888, -8888) } // lldbr-check:(method_on_generic_struct::Struct<(u32, i32)>) *self = { x = { = 8888 = -8888 } } -// lldb-command:print arg1 +// lldb-command:v arg1 // lldbg-check:[...] -1 // lldbr-check:(isize) arg1 = -1 -// lldb-command:print arg2 +// lldb-command:v arg2 // lldbg-check:[...] -2 // lldbr-check:(isize) arg2 = -2 // lldb-command:continue // STACK BY VAL -// lldb-command:print self +// lldb-command:v self // lldbg-check:[...] Struct<(u32, i32)> { x: (8888, -8888) } // lldbr-check:(method_on_generic_struct::Struct<(u32, i32)>) self = { x = { = 8888 = -8888 } } -// lldb-command:print arg1 +// lldb-command:v arg1 // lldbg-check:[...] -3 // lldbr-check:(isize) arg1 = -3 -// lldb-command:print arg2 +// lldb-command:v arg2 // lldbg-check:[...] -4 // lldbr-check:(isize) arg2 = -4 // lldb-command:continue // OWNED BY REF -// lldb-command:print *self +// lldb-command:v *self // lldbg-check:[...] Struct { x: 1234.5 } // lldbr-check:(method_on_generic_struct::Struct) *self = Struct { x: 1234.5 } -// lldb-command:print arg1 +// lldb-command:v arg1 // lldbg-check:[...] -5 // lldbr-check:(isize) arg1 = -5 -// lldb-command:print arg2 +// lldb-command:v arg2 // lldbg-check:[...] -6 // lldbr-check:(isize) arg2 = -6 // lldb-command:continue // OWNED BY VAL -// lldb-command:print self +// lldb-command:v self // lldbg-check:[...] Struct { x: 1234.5 } // lldbr-check:(method_on_generic_struct::Struct) self = Struct { x: 1234.5 } -// lldb-command:print arg1 +// lldb-command:v arg1 // lldbg-check:[...] -7 // lldbr-check:(isize) arg1 = -7 -// lldb-command:print arg2 +// lldb-command:v arg2 // lldbg-check:[...] -8 // lldbr-check:(isize) arg2 = -8 // lldb-command:continue // OWNED MOVED -// lldb-command:print *self +// lldb-command:v *self // lldbg-check:[...] Struct { x: 1234.5 } // lldbr-check:(method_on_generic_struct::Struct) *self = Struct { x: 1234.5 } -// lldb-command:print arg1 +// lldb-command:v arg1 // lldbg-check:[...] -9 // lldbr-check:(isize) arg1 = -9 -// lldb-command:print arg2 +// lldb-command:v arg2 // lldbg-check:[...] -10 // lldbr-check:(isize) arg2 = -10 // lldb-command:continue diff --git a/tests/debuginfo/method-on-struct.rs b/tests/debuginfo/method-on-struct.rs index 56bcb462cb36..a4129af54290 100644 --- a/tests/debuginfo/method-on-struct.rs +++ b/tests/debuginfo/method-on-struct.rs @@ -62,61 +62,61 @@ // lldb-command:run // STACK BY REF -// lldb-command:print *self +// lldb-command:v *self // lldbg-check:[...] { x = 100 } // lldbr-check:(method_on_struct::Struct) *self = Struct { x: 100 } -// lldb-command:print arg1 +// lldb-command:v arg1 // lldbg-check:[...] -1 // lldbr-check:(isize) arg1 = -1 -// lldb-command:print arg2 +// lldb-command:v arg2 // lldbg-check:[...] -2 // lldbr-check:(isize) arg2 = -2 // lldb-command:continue // STACK BY VAL -// lldb-command:print self +// lldb-command:v self // lldbg-check:[...] { x = 100 } // lldbr-check:(method_on_struct::Struct) self = Struct { x: 100 } -// lldb-command:print arg1 +// lldb-command:v arg1 // lldbg-check:[...] -3 // lldbr-check:(isize) arg1 = -3 -// lldb-command:print arg2 +// lldb-command:v arg2 // lldbg-check:[...] -4 // lldbr-check:(isize) arg2 = -4 // lldb-command:continue // OWNED BY REF -// lldb-command:print *self +// lldb-command:v *self // lldbg-check:[...] { x = 200 } // lldbr-check:(method_on_struct::Struct) *self = Struct { x: 200 } -// lldb-command:print arg1 +// lldb-command:v arg1 // lldbg-check:[...] -5 // lldbr-check:(isize) arg1 = -5 -// lldb-command:print arg2 +// lldb-command:v arg2 // lldbg-check:[...] -6 // lldbr-check:(isize) arg2 = -6 // lldb-command:continue // OWNED BY VAL -// lldb-command:print self +// lldb-command:v self // lldbg-check:[...] { x = 200 } // lldbr-check:(method_on_struct::Struct) self = Struct { x: 200 } -// lldb-command:print arg1 +// lldb-command:v arg1 // lldbg-check:[...] -7 // lldbr-check:(isize) arg1 = -7 -// lldb-command:print arg2 +// lldb-command:v arg2 // lldbg-check:[...] -8 // lldbr-check:(isize) arg2 = -8 // lldb-command:continue // OWNED MOVED -// lldb-command:print *self +// lldb-command:v *self // lldbg-check:[...] { x = 200 } // lldbr-check:(method_on_struct::Struct) *self = Struct { x: 200 } -// lldb-command:print arg1 +// lldb-command:v arg1 // lldbg-check:[...] -9 // lldbr-check:(isize) arg1 = -9 -// lldb-command:print arg2 +// lldb-command:v arg2 // lldbg-check:[...] -10 // lldbr-check:(isize) arg2 = -10 // lldb-command:continue diff --git a/tests/debuginfo/method-on-trait.rs b/tests/debuginfo/method-on-trait.rs index 0264ff68d1b0..0934c267ab13 100644 --- a/tests/debuginfo/method-on-trait.rs +++ b/tests/debuginfo/method-on-trait.rs @@ -62,61 +62,61 @@ // lldb-command:run // STACK BY REF -// lldb-command:print *self +// lldb-command:v *self // lldbg-check:[...] { x = 100 } // lldbr-check:(method_on_trait::Struct) *self = { x = 100 } -// lldb-command:print arg1 +// lldb-command:v arg1 // lldbg-check:[...] -1 // lldbr-check:(isize) arg1 = -1 -// lldb-command:print arg2 +// lldb-command:v arg2 // lldbg-check:[...] -2 // lldbr-check:(isize) arg2 = -2 // lldb-command:continue // STACK BY VAL -// lldb-command:print self +// lldb-command:v self // lldbg-check:[...] { x = 100 } // lldbr-check:(method_on_trait::Struct) self = { x = 100 } -// lldb-command:print arg1 +// lldb-command:v arg1 // lldbg-check:[...] -3 // lldbr-check:(isize) arg1 = -3 -// lldb-command:print arg2 +// lldb-command:v arg2 // lldbg-check:[...] -4 // lldbr-check:(isize) arg2 = -4 // lldb-command:continue // OWNED BY REF -// lldb-command:print *self +// lldb-command:v *self // lldbg-check:[...] { x = 200 } // lldbr-check:(method_on_trait::Struct) *self = { x = 200 } -// lldb-command:print arg1 +// lldb-command:v arg1 // lldbg-check:[...] -5 // lldbr-check:(isize) arg1 = -5 -// lldb-command:print arg2 +// lldb-command:v arg2 // lldbg-check:[...] -6 // lldbr-check:(isize) arg2 = -6 // lldb-command:continue // OWNED BY VAL -// lldb-command:print self +// lldb-command:v self // lldbg-check:[...] { x = 200 } // lldbr-check:(method_on_trait::Struct) self = { x = 200 } -// lldb-command:print arg1 +// lldb-command:v arg1 // lldbg-check:[...] -7 // lldbr-check:(isize) arg1 = -7 -// lldb-command:print arg2 +// lldb-command:v arg2 // lldbg-check:[...] -8 // lldbr-check:(isize) arg2 = -8 // lldb-command:continue // OWNED MOVED -// lldb-command:print *self +// lldb-command:v *self // lldbg-check:[...] { x = 200 } // lldbr-check:(method_on_trait::Struct) *self = { x = 200 } -// lldb-command:print arg1 +// lldb-command:v arg1 // lldbg-check:[...] -9 // lldbr-check:(isize) arg1 = -9 -// lldb-command:print arg2 +// lldb-command:v arg2 // lldbg-check:[...] -10 // lldbr-check:(isize) arg2 = -10 // lldb-command:continue diff --git a/tests/debuginfo/method-on-tuple-struct.rs b/tests/debuginfo/method-on-tuple-struct.rs index 872f6ea57c21..9cf9c6d7fbae 100644 --- a/tests/debuginfo/method-on-tuple-struct.rs +++ b/tests/debuginfo/method-on-tuple-struct.rs @@ -62,61 +62,61 @@ // lldb-command:run // STACK BY REF -// lldb-command:print *self +// lldb-command:v *self // lldbg-check:[...] { 0 = 100 1 = -100.5 } // lldbr-check:(method_on_tuple_struct::TupleStruct) *self = { 0 = 100 1 = -100.5 } -// lldb-command:print arg1 +// lldb-command:v arg1 // lldbg-check:[...] -1 // lldbr-check:(isize) arg1 = -1 -// lldb-command:print arg2 +// lldb-command:v arg2 // lldbg-check:[...] -2 // lldbr-check:(isize) arg2 = -2 // lldb-command:continue // STACK BY VAL -// lldb-command:print self +// lldb-command:v self // lldbg-check:[...] { 0 = 100 1 = -100.5 } // lldbr-check:(method_on_tuple_struct::TupleStruct) self = { 0 = 100 1 = -100.5 } -// lldb-command:print arg1 +// lldb-command:v arg1 // lldbg-check:[...] -3 // lldbr-check:(isize) arg1 = -3 -// lldb-command:print arg2 +// lldb-command:v arg2 // lldbg-check:[...] -4 // lldbr-check:(isize) arg2 = -4 // lldb-command:continue // OWNED BY REF -// lldb-command:print *self +// lldb-command:v *self // lldbg-check:[...] { 0 = 200 1 = -200.5 } // lldbr-check:(method_on_tuple_struct::TupleStruct) *self = { 0 = 200 1 = -200.5 } -// lldb-command:print arg1 +// lldb-command:v arg1 // lldbg-check:[...] -5 // lldbr-check:(isize) arg1 = -5 -// lldb-command:print arg2 +// lldb-command:v arg2 // lldbg-check:[...] -6 // lldbr-check:(isize) arg2 = -6 // lldb-command:continue // OWNED BY VAL -// lldb-command:print self +// lldb-command:v self // lldbg-check:[...] { 0 = 200 1 = -200.5 } // lldbr-check:(method_on_tuple_struct::TupleStruct) self = { 0 = 200 1 = -200.5 } -// lldb-command:print arg1 +// lldb-command:v arg1 // lldbg-check:[...] -7 // lldbr-check:(isize) arg1 = -7 -// lldb-command:print arg2 +// lldb-command:v arg2 // lldbg-check:[...] -8 // lldbr-check:(isize) arg2 = -8 // lldb-command:continue // OWNED MOVED -// lldb-command:print *self +// lldb-command:v *self // lldbg-check:[...] { 0 = 200 1 = -200.5 } // lldbr-check:(method_on_tuple_struct::TupleStruct) *self = { 0 = 200 1 = -200.5 } -// lldb-command:print arg1 +// lldb-command:v arg1 // lldbg-check:[...] -9 // lldbr-check:(isize) arg1 = -9 -// lldb-command:print arg2 +// lldb-command:v arg2 // lldbg-check:[...] -10 // lldbr-check:(isize) arg2 = -10 // lldb-command:continue diff --git a/tests/debuginfo/multi-cgu.rs b/tests/debuginfo/multi-cgu.rs index 42aa25c14212..32fd68958773 100644 --- a/tests/debuginfo/multi-cgu.rs +++ b/tests/debuginfo/multi-cgu.rs @@ -23,12 +23,12 @@ // lldb-command:run -// lldb-command:print xxx +// lldb-command:v xxx // lldbg-check:[...] 12345 // lldbr-check:(u32) xxx = 12345 // lldb-command:continue -// lldb-command:print yyy +// lldb-command:v yyy // lldbg-check:[...] 67890 // lldbr-check:(u64) yyy = 67890 // lldb-command:continue diff --git a/tests/debuginfo/multiple-functions-equal-var-names.rs b/tests/debuginfo/multiple-functions-equal-var-names.rs index 113eac29256b..2d9caf75290a 100644 --- a/tests/debuginfo/multiple-functions-equal-var-names.rs +++ b/tests/debuginfo/multiple-functions-equal-var-names.rs @@ -22,17 +22,17 @@ // lldb-command:run -// lldb-command:print abc +// lldb-command:v abc // lldbg-check:[...] 10101 // lldbr-check:(i32) abc = 10101 // lldb-command:continue -// lldb-command:print abc +// lldb-command:v abc // lldbg-check:[...] 20202 // lldbr-check:(i32) abc = 20202 // lldb-command:continue -// lldb-command:print abc +// lldb-command:v abc // lldbg-check:[...] 30303 // lldbr-check:(i32) abc = 30303 diff --git a/tests/debuginfo/multiple-functions.rs b/tests/debuginfo/multiple-functions.rs index 81fdc4f3d403..5c01a4270511 100644 --- a/tests/debuginfo/multiple-functions.rs +++ b/tests/debuginfo/multiple-functions.rs @@ -22,17 +22,17 @@ // lldb-command:run -// lldb-command:print a +// lldb-command:v a // lldbg-check:[...] 10101 // lldbr-check:(i32) a = 10101 // lldb-command:continue -// lldb-command:print b +// lldb-command:v b // lldbg-check:[...] 20202 // lldbr-check:(i32) b = 20202 // lldb-command:continue -// lldb-command:print c +// lldb-command:v c // lldbg-check:[...] 30303 // lldbr-check:(i32) c = 30303 diff --git a/tests/debuginfo/name-shadowing-and-scope-nesting.rs b/tests/debuginfo/name-shadowing-and-scope-nesting.rs index 42df96668106..8813793e59e4 100644 --- a/tests/debuginfo/name-shadowing-and-scope-nesting.rs +++ b/tests/debuginfo/name-shadowing-and-scope-nesting.rs @@ -47,50 +47,50 @@ // lldb-command:run -// lldb-command:print x +// lldb-command:v x // lldbg-check:[...] false // lldbr-check:(bool) x = false -// lldb-command:print y +// lldb-command:v y // lldbg-check:[...] true // lldbr-check:(bool) y = true // lldb-command:continue -// lldb-command:print x +// lldb-command:v x // lldbg-check:[...] 10 // lldbr-check:(i32) x = 10 -// lldb-command:print y +// lldb-command:v y // lldbg-check:[...] true // lldbr-check:(bool) y = true // lldb-command:continue -// lldb-command:print x +// lldb-command:v x // lldbg-check:[...] 10.5 // lldbr-check:(f64) x = 10.5 -// lldb-command:print y +// lldb-command:v y // lldbg-check:[...] 20 // lldbr-check:(i32) y = 20 // lldb-command:continue -// lldb-command:print x +// lldb-command:v x // lldbg-check:[...] true // lldbr-check:(bool) x = true -// lldb-command:print y +// lldb-command:v y // lldbg-check:[...] 2220 // lldbr-check:(i32) y = 2220 // lldb-command:continue -// lldb-command:print x +// lldb-command:v x // lldbg-check:[...] 203203.5 // lldbr-check:(f64) x = 203203.5 -// lldb-command:print y +// lldb-command:v y // lldbg-check:[...] 2220 // lldbr-check:(i32) y = 2220 // lldb-command:continue -// lldb-command:print x +// lldb-command:v x // lldbg-check:[...] 10.5 // lldbr-check:(f64) x = 10.5 -// lldb-command:print y +// lldb-command:v y // lldbg-check:[...] 20 // lldbr-check:(i32) y = 20 // lldb-command:continue diff --git a/tests/debuginfo/no_mangle-info.rs b/tests/debuginfo/no_mangle-info.rs index 9cb42656f2a4..11b490295283 100644 --- a/tests/debuginfo/no_mangle-info.rs +++ b/tests/debuginfo/no_mangle-info.rs @@ -10,10 +10,10 @@ // === LLDB TESTS ================================================================================== // lldb-command:run -// lldb-command:p TEST -// lldb-check: (unsigned long) 3735928559 -// lldb-command:p OTHER_TEST -// lldb-check: (unsigned long) 42 +// lldb-command:v TEST +// lldb-check: (unsigned long) TEST = 3735928559 +// lldb-command:v OTHER_TEST +// lldb-check: (unsigned long) no_mangle_info::namespace::OTHER_TEST::[...] = 42 // === CDB TESTS ================================================================================== // cdb-command: g diff --git a/tests/debuginfo/numeric-types.rs b/tests/debuginfo/numeric-types.rs index 615f365173f5..1ff72d34fbdf 100644 --- a/tests/debuginfo/numeric-types.rs +++ b/tests/debuginfo/numeric-types.rs @@ -202,40 +202,40 @@ // lldb-command:run -// lldb-command:print/d nz_i8 +// lldb-command:v/d nz_i8 // lldb-check:[...] 11 { __0 = { 0 = 11 } } -// lldb-command:print nz_i16 +// lldb-command:v nz_i16 // lldb-check:[...] 22 { __0 = { 0 = 22 } } -// lldb-command:print nz_i32 +// lldb-command:v nz_i32 // lldb-check:[...] 33 { __0 = { 0 = 33 } } -// lldb-command:print nz_i64 +// lldb-command:v nz_i64 // lldb-check:[...] 44 { __0 = { 0 = 44 } } -// lldb-command:print nz_i128 +// lldb-command:v nz_i128 // lldb-check:[...] 55 { __0 = { 0 = 55 } } -// lldb-command:print nz_isize +// lldb-command:v nz_isize // lldb-check:[...] 66 { __0 = { 0 = 66 } } -// lldb-command:print/d nz_u8 +// lldb-command:v/d nz_u8 // lldb-check:[...] 77 { __0 = { 0 = 77 } } -// lldb-command:print nz_u16 +// lldb-command:v nz_u16 // lldb-check:[...] 88 { __0 = { 0 = 88 } } -// lldb-command:print nz_u32 +// lldb-command:v nz_u32 // lldb-check:[...] 99 { __0 = { 0 = 99 } } -// lldb-command:print nz_u64 +// lldb-command:v nz_u64 // lldb-check:[...] 100 { __0 = { 0 = 100 } } -// lldb-command:print nz_u128 +// lldb-command:v nz_u128 // lldb-check:[...] 111 { __0 = { 0 = 111 } } -// lldb-command:print nz_usize +// lldb-command:v nz_usize // lldb-check:[...] 122 { __0 = { 0 = 122 } } #![feature(generic_nonzero)] diff --git a/tests/debuginfo/option-like-enum.rs b/tests/debuginfo/option-like-enum.rs index 03646c99f648..c782796f4731 100644 --- a/tests/debuginfo/option-like-enum.rs +++ b/tests/debuginfo/option-like-enum.rs @@ -47,34 +47,34 @@ // lldb-command:run -// lldb-command:print some +// lldb-command:v some // lldb-check:[...] Some(&0x12345678) -// lldb-command:print none +// lldb-command:v none // lldb-check:[...] None -// lldb-command:print full +// lldb-command:v full // lldb-check:[...] Full(454545, &0x87654321, 9988) -// lldb-command:print empty +// lldb-command:v empty // lldb-check:[...] Empty -// lldb-command:print droid +// lldb-command:v droid // lldb-check:[...] Droid { id: 675675, range: 10000001, internals: &0x43218765 } -// lldb-command:print void_droid +// lldb-command:v void_droid // lldb-check:[...] Void -// lldb-command:print some_str +// lldb-command:v some_str // lldb-check:[...] Some("abc") -// lldb-command:print none_str +// lldb-command:v none_str // lldb-check:[...] None -// lldb-command:print nested_non_zero_yep +// lldb-command:v nested_non_zero_yep // lldb-check:[...] Yep(10.5, NestedNonZeroField { a: 10, b: 20, c: &[...] }) -// lldb-command:print nested_non_zero_nope +// lldb-command:v nested_non_zero_nope // lldb-check:[...] Nope diff --git a/tests/debuginfo/packed-struct-with-destructor.rs b/tests/debuginfo/packed-struct-with-destructor.rs index b1f237db8148..f9bac8443762 100644 --- a/tests/debuginfo/packed-struct-with-destructor.rs +++ b/tests/debuginfo/packed-struct-with-destructor.rs @@ -44,35 +44,35 @@ // lldb-command:run -// lldb-command:print packed +// lldb-command:v packed // lldbg-check:[...] { x = 123 y = 234 z = 345 } // lldbr-check:(packed_struct_with_destructor::Packed) packed = { x = 123 y = 234 z = 345 } -// lldb-command:print packedInPacked +// lldb-command:v packedInPacked // lldbg-check:[...] { a = 1111 b = { x = 2222 y = 3333 z = 4444 } c = 5555 d = { x = 6666 y = 7777 z = 8888 } } // lldbr-check:(packed_struct_with_destructor::PackedInPacked) packedInPacked = { a = 1111 b = { x = 2222 y = 3333 z = 4444 } c = 5555 d = { x = 6666 y = 7777 z = 8888 } } -// lldb-command:print packedInUnpacked +// lldb-command:v packedInUnpacked // lldbg-check:[...] { a = -1111 b = { x = -2222 y = -3333 z = -4444 } c = -5555 d = { x = -6666 y = -7777 z = -8888 } } // lldbr-check:(packed_struct_with_destructor::PackedInUnpacked) packedInUnpacked = { a = -1111 b = { x = -2222 y = -3333 z = -4444 } c = -5555 d = { x = -6666 y = -7777 z = -8888 } } -// lldb-command:print unpackedInPacked +// lldb-command:v unpackedInPacked // lldbg-check:[...] { a = 987 b = { x = 876 y = 765 z = 654 } c = { x = 543 y = 432 z = 321 } d = 210 } // lldbr-check:(packed_struct_with_destructor::UnpackedInPacked) unpackedInPacked = { a = 987 b = { x = 876 y = 765 z = 654 } c = { x = 543 y = 432 z = 321 } d = 210 } -// lldb-command:print packedInPackedWithDrop +// lldb-command:v packedInPackedWithDrop // lldbg-check:[...] { a = 11 b = { x = 22 y = 33 z = 44 } c = 55 d = { x = 66 y = 77 z = 88 } } // lldbr-check:(packed_struct_with_destructor::PackedInPackedWithDrop) packedInPackedWithDrop = { a = 11 b = { x = 22 y = 33 z = 44 } c = 55 d = { x = 66 y = 77 z = 88 } } -// lldb-command:print packedInUnpackedWithDrop +// lldb-command:v packedInUnpackedWithDrop // lldbg-check:[...] { a = -11 b = { x = -22 y = -33 z = -44 } c = -55 d = { x = -66 y = -77 z = -88 } } // lldbr-check:(packed_struct_with_destructor::PackedInUnpackedWithDrop) packedInUnpackedWithDrop = { a = -11 b = { x = -22 y = -33 z = -44 } c = -55 d = { x = -66 y = -77 z = -88 } } -// lldb-command:print unpackedInPackedWithDrop +// lldb-command:v unpackedInPackedWithDrop // lldbg-check:[...] { a = 98 b = { x = 87 y = 76 z = 65 } c = { x = 54 y = 43 z = 32 } d = 21 } // lldbr-check:(packed_struct_with_destructor::UnpackedInPackedWithDrop) unpackedInPackedWithDrop = { a = 98 b = { x = 87 y = 76 z = 65 } c = { x = 54 y = 43 z = 32 } d = 21 } -// lldb-command:print deeplyNested +// lldb-command:v deeplyNested // lldbg-check:[...] { a = { a = 1 b = { x = 2 y = 3 z = 4 } c = 5 d = { x = 6 y = 7 z = 8 } } b = { a = 9 b = { x = 10 y = 11 z = 12 } c = { x = 13 y = 14 z = 15 } d = 16 } c = { a = 17 b = { x = 18 y = 19 z = 20 } c = 21 d = { x = 22 y = 23 z = 24 } } d = { a = 25 b = { x = 26 y = 27 z = 28 } c = 29 d = { x = 30 y = 31 z = 32 } } e = { a = 33 b = { x = 34 y = 35 z = 36 } c = { x = 37 y = 38 z = 39 } d = 40 } f = { a = 41 b = { x = 42 y = 43 z = 44 } c = 45 d = { x = 46 y = 47 z = 48 } } } // lldbr-check:(packed_struct_with_destructor::DeeplyNested) deeplyNested = { a = { a = 1 b = { x = 2 y = 3 z = 4 } c = 5 d = { x = 6 y = 7 z = 8 } } b = { a = 9 b = { x = 10 y = 11 z = 12 } c = { x = 13 y = 14 z = 15 } d = 16 } c = { a = 17 b = { x = 18 y = 19 z = 20 } c = 21 d = { x = 22 y = 23 z = 24 } } d = { a = 25 b = { x = 26 y = 27 z = 28 } c = 29 d = { x = 30 y = 31 z = 32 } } e = { a = 33 b = { x = 34 y = 35 z = 36 } c = { x = 37 y = 38 z = 39 } d = 40 } f = { a = 41 b = { x = 42 y = 43 z = 44 } c = 45 d = { x = 46 y = 47 z = 48 } } } diff --git a/tests/debuginfo/packed-struct.rs b/tests/debuginfo/packed-struct.rs index b61da0412436..2eb5be875bc5 100644 --- a/tests/debuginfo/packed-struct.rs +++ b/tests/debuginfo/packed-struct.rs @@ -34,27 +34,27 @@ // lldb-command:run -// lldb-command:print packed +// lldb-command:v packed // lldbg-check:[...] { x = 123 y = 234 z = 345 } // lldbr-check:(packed_struct::Packed) packed = { x = 123 y = 234 z = 345 } -// lldb-command:print packedInPacked +// lldb-command:v packedInPacked // lldbg-check:[...] { a = 1111 b = { x = 2222 y = 3333 z = 4444 } c = 5555 d = { x = 6666 y = 7777 z = 8888 } } // lldbr-check:(packed_struct::PackedInPacked) packedInPacked = { a = 1111 b = { x = 2222 y = 3333 z = 4444 } c = 5555 d = { x = 6666 y = 7777 z = 8888 } } -// lldb-command:print packedInUnpacked +// lldb-command:v packedInUnpacked // lldbg-check:[...] { a = -1111 b = { x = -2222 y = -3333 z = -4444 } c = -5555 d = { x = -6666 y = -7777 z = -8888 } } // lldbr-check:(packed_struct::PackedInUnpacked) packedInUnpacked = { a = -1111 b = { x = -2222 y = -3333 z = -4444 } c = -5555 d = { x = -6666 y = -7777 z = -8888 } } -// lldb-command:print unpackedInPacked +// lldb-command:v unpackedInPacked // lldbg-check:[...] { a = 987 b = { x = 876 y = 765 z = 654 w = 543 } c = { x = 432 y = 321 z = 210 w = 109 } d = -98 } // lldbr-check:(packed_struct::UnpackedInPacked) unpackedInPacked = { a = 987 b = { x = 876 y = 765 z = 654 w = 543 } c = { x = 432 y = 321 z = 210 w = 109 } d = -98 } -// lldb-command:print sizeof(packed) +// lldb-command:dwim-print sizeof(packed) // lldbg-check:[...] 14 // lldbr-check:(usize) = 14 -// lldb-command:print sizeof(packedInPacked) +// lldb-command:dwim-print sizeof(packedInPacked) // lldbg-check:[...] 40 // lldbr-check:(usize) = 40 diff --git a/tests/debuginfo/pretty-std-collections.rs b/tests/debuginfo/pretty-std-collections.rs index 903a9f9a2727..e9c2c4f2a1da 100644 --- a/tests/debuginfo/pretty-std-collections.rs +++ b/tests/debuginfo/pretty-std-collections.rs @@ -58,19 +58,19 @@ // lldb-command:run -// lldb-command:print vec_deque +// lldb-command:v vec_deque // lldbg-check:[...] size=3 { [0] = 5 [1] = 3 [2] = 7 } // lldbr-check:(alloc::collections::vec_deque::VecDeque) vec_deque = size=3 = { [0] = 5 [1] = 3 [2] = 7 } -// lldb-command:print vec_deque2 +// lldb-command:v vec_deque2 // lldbg-check:[...] size=7 { [0] = 2 [1] = 3 [2] = 4 [3] = 5 [4] = 6 [5] = 7 [6] = 8 } // lldbr-check:(alloc::collections::vec_deque::VecDeque) vec_deque2 = size=7 = { [0] = 2 [1] = 3 [2] = 4 [3] = 5 [4] = 6 [5] = 7 [6] = 8 } -// lldb-command:print hash_map +// lldb-command:v hash_map // lldbg-check:[...] size=4 { [0] = { 0 = 1 1 = 10 } [1] = { 0 = 2 1 = 20 } [2] = { 0 = 3 1 = 30 } [3] = { 0 = 4 1 = 40 } } // lldbr-check:(std::collections::hash::map::HashMap) hash_map = size=4 size=4 { [0] = { 0 = 1 1 = 10 } [1] = { 0 = 2 1 = 20 } [2] = { 0 = 3 1 = 30 } [3] = { 0 = 4 1 = 40 } } -// lldb-command:print hash_set +// lldb-command:v hash_set // lldbg-check:[...] size=4 { [0] = 1 [1] = 2 [2] = 3 [3] = 4 } // lldbr-check:(std::collections::hash::set::HashSet) hash_set = size=4 { [0] = 1 [1] = 2 [2] = 3 [3] = 4 } diff --git a/tests/debuginfo/rc_arc.rs b/tests/debuginfo/rc_arc.rs index e340fe85e1d8..ca0feb1f465b 100644 --- a/tests/debuginfo/rc_arc.rs +++ b/tests/debuginfo/rc_arc.rs @@ -17,9 +17,9 @@ // lldb-command:run -// lldb-command:print rc +// lldb-command:v rc // lldb-check:[...] strong=11, weak=1 { value = 111 } -// lldb-command:print arc +// lldb-command:v arc // lldb-check:[...] strong=21, weak=1 { data = 222 } // === CDB TESTS ================================================================================== diff --git a/tests/debuginfo/reference-debuginfo.rs b/tests/debuginfo/reference-debuginfo.rs index b1a6aef50cb9..339839f07cca 100644 --- a/tests/debuginfo/reference-debuginfo.rs +++ b/tests/debuginfo/reference-debuginfo.rs @@ -59,11 +59,11 @@ // === LLDB TESTS ================================================================================== // lldb-command:run -// lldb-command:print *bool_ref +// lldb-command:v *bool_ref // lldbg-check:[...] true // lldbr-check:(bool) *bool_ref = true -// lldb-command:print *int_ref +// lldb-command:v *int_ref // lldbg-check:[...] -1 // lldbr-check:(isize) *int_ref = -1 @@ -71,51 +71,51 @@ // lldbr-command:print *char_ref // lldbr-check:(char) *char_ref = 'a' -// lldb-command:print *i8_ref +// lldb-command:v *i8_ref // lldbg-check:[...] 'D' // lldbr-check:(i8) *i8_ref = 68 -// lldb-command:print *i16_ref +// lldb-command:v *i16_ref // lldbg-check:[...] -16 // lldbr-check:(i16) *i16_ref = -16 -// lldb-command:print *i32_ref +// lldb-command:v *i32_ref // lldbg-check:[...] -32 // lldbr-check:(i32) *i32_ref = -32 -// lldb-command:print *i64_ref +// lldb-command:v *i64_ref // lldbg-check:[...] -64 // lldbr-check:(i64) *i64_ref = -64 -// lldb-command:print *uint_ref +// lldb-command:v *uint_ref // lldbg-check:[...] 1 // lldbr-check:(usize) *uint_ref = 1 -// lldb-command:print *u8_ref +// lldb-command:v *u8_ref // lldbg-check:[...] 'd' // lldbr-check:(u8) *u8_ref = 100 -// lldb-command:print *u16_ref +// lldb-command:v *u16_ref // lldbg-check:[...] 16 // lldbr-check:(u16) *u16_ref = 16 -// lldb-command:print *u32_ref +// lldb-command:v *u32_ref // lldbg-check:[...] 32 // lldbr-check:(u32) *u32_ref = 32 -// lldb-command:print *u64_ref +// lldb-command:v *u64_ref // lldbg-check:[...] 64 // lldbr-check:(u64) *u64_ref = 64 -// lldb-command:print *f32_ref +// lldb-command:v *f32_ref // lldbg-check:[...] 2.5 // lldbr-check:(f32) *f32_ref = 2.5 -// lldb-command:print *f64_ref +// lldb-command:v *f64_ref // lldbg-check:[...] 3.5 // lldbr-check:(f64) *f64_ref = 3.5 -// lldb-command:print *f64_double_ref +// lldb-command:v *f64_double_ref // lldbg-check:[...] 3.5 // lldbr-check:(f64) **f64_double_ref = 3.5 diff --git a/tests/debuginfo/regression-bad-location-list-67992.rs b/tests/debuginfo/regression-bad-location-list-67992.rs index df1e9fb26fce..fe410942d51e 100644 --- a/tests/debuginfo/regression-bad-location-list-67992.rs +++ b/tests/debuginfo/regression-bad-location-list-67992.rs @@ -10,7 +10,7 @@ // === LLDB TESTS ================================================================================== // lldb-command:run -// lldb-command:print a +// lldb-command:v a // lldbg-check:(regression_bad_location_list_67992::Foo) [...] // lldbr-check:(regression_bad_location_list_67992::Foo) a = [...] diff --git a/tests/debuginfo/self-in-default-method.rs b/tests/debuginfo/self-in-default-method.rs index 9a4ecee4bf6d..374951475fc0 100644 --- a/tests/debuginfo/self-in-default-method.rs +++ b/tests/debuginfo/self-in-default-method.rs @@ -62,61 +62,61 @@ // lldb-command:run // STACK BY REF -// lldb-command:print *self +// lldb-command:v *self // lldbg-check:[...] { x = 100 } // lldbr-check:(self_in_default_method::Struct) *self = Struct { x: 100 } -// lldb-command:print arg1 +// lldb-command:v arg1 // lldbg-check:[...] -1 // lldbr-check:(isize) arg1 = -1 -// lldb-command:print arg2 +// lldb-command:v arg2 // lldbg-check:[...] -2 // lldbr-check:(isize) arg2 = -2 // lldb-command:continue // STACK BY VAL -// lldb-command:print self +// lldb-command:v self // lldbg-check:[...] { x = 100 } // lldbr-check:(self_in_default_method::Struct) self = Struct { x: 100 } -// lldb-command:print arg1 +// lldb-command:v arg1 // lldbg-check:[...] -3 // lldbr-check:(isize) arg1 = -3 -// lldb-command:print arg2 +// lldb-command:v arg2 // lldbg-check:[...] -4 // lldbr-check:(isize) arg2 = -4 // lldb-command:continue // OWNED BY REF -// lldb-command:print *self +// lldb-command:v *self // lldbg-check:[...] { x = 200 } // lldbr-check:(self_in_default_method::Struct) *self = Struct { x: 200 } -// lldb-command:print arg1 +// lldb-command:v arg1 // lldbg-check:[...] -5 // lldbr-check:(isize) arg1 = -5 -// lldb-command:print arg2 +// lldb-command:v arg2 // lldbg-check:[...] -6 // lldbr-check:(isize) arg2 = -6 // lldb-command:continue // OWNED BY VAL -// lldb-command:print self +// lldb-command:v self // lldbg-check:[...] { x = 200 } // lldbr-check:(self_in_default_method::Struct) self = Struct { x: 200 } -// lldb-command:print arg1 +// lldb-command:v arg1 // lldbg-check:[...] -7 // lldbr-check:(isize) arg1 = -7 -// lldb-command:print arg2 +// lldb-command:v arg2 // lldbg-check:[...] -8 // lldbr-check:(isize) arg2 = -8 // lldb-command:continue // OWNED MOVED -// lldb-command:print *self +// lldb-command:v *self // lldbg-check:[...] { x = 200 } // lldbr-check:(self_in_default_method::Struct) *self = Struct { x: 200 } -// lldb-command:print arg1 +// lldb-command:v arg1 // lldbg-check:[...] -9 // lldbr-check:(isize) arg1 = -9 -// lldb-command:print arg2 +// lldb-command:v arg2 // lldbg-check:[...] -10 // lldbr-check:(isize) arg2 = -10 // lldb-command:continue diff --git a/tests/debuginfo/self-in-generic-default-method.rs b/tests/debuginfo/self-in-generic-default-method.rs index a21280620b5f..4759ca3ecdc0 100644 --- a/tests/debuginfo/self-in-generic-default-method.rs +++ b/tests/debuginfo/self-in-generic-default-method.rs @@ -62,61 +62,61 @@ // lldb-command:run // STACK BY REF -// lldb-command:print *self +// lldb-command:v *self // lldbg-check:[...] { x = 987 } // lldbr-check:(self_in_generic_default_method::Struct) *self = Struct { x: 987 } -// lldb-command:print arg1 +// lldb-command:v arg1 // lldbg-check:[...] -1 // lldbr-check:(isize) arg1 = -1 -// lldb-command:print arg2 +// lldb-command:v arg2 // lldbg-check:[...] 2 // lldbr-check:(u16) arg2 = 2 // lldb-command:continue // STACK BY VAL -// lldb-command:print self +// lldb-command:v self // lldbg-check:[...] { x = 987 } // lldbr-check:(self_in_generic_default_method::Struct) self = Struct { x: 987 } -// lldb-command:print arg1 +// lldb-command:v arg1 // lldbg-check:[...] -3 // lldbr-check:(isize) arg1 = -3 -// lldb-command:print arg2 +// lldb-command:v arg2 // lldbg-check:[...] -4 // lldbr-check:(i16) arg2 = -4 // lldb-command:continue // OWNED BY REF -// lldb-command:print *self +// lldb-command:v *self // lldbg-check:[...] { x = 879 } // lldbr-check:(self_in_generic_default_method::Struct) *self = Struct { x: 879 } -// lldb-command:print arg1 +// lldb-command:v arg1 // lldbg-check:[...] -5 // lldbr-check:(isize) arg1 = -5 -// lldb-command:print arg2 +// lldb-command:v arg2 // lldbg-check:[...] -6 // lldbr-check:(i32) arg2 = -6 // lldb-command:continue // OWNED BY VAL -// lldb-command:print self +// lldb-command:v self // lldbg-check:[...] { x = 879 } // lldbr-check:(self_in_generic_default_method::Struct) self = Struct { x: 879 } -// lldb-command:print arg1 +// lldb-command:v arg1 // lldbg-check:[...] -7 // lldbr-check:(isize) arg1 = -7 -// lldb-command:print arg2 +// lldb-command:v arg2 // lldbg-check:[...] -8 // lldbr-check:(i64) arg2 = -8 // lldb-command:continue // OWNED MOVED -// lldb-command:print *self +// lldb-command:v *self // lldbg-check:[...] { x = 879 } // lldbr-check:(self_in_generic_default_method::Struct) *self = Struct { x: 879 } -// lldb-command:print arg1 +// lldb-command:v arg1 // lldbg-check:[...] -9 // lldbr-check:(isize) arg1 = -9 -// lldb-command:print arg2 +// lldb-command:v arg2 // lldbg-check:[...] -10.5 // lldbr-check:(f32) arg2 = -10.5 // lldb-command:continue diff --git a/tests/debuginfo/shadowed-argument.rs b/tests/debuginfo/shadowed-argument.rs index 2be8cbbdfebe..e7bc731336e5 100644 --- a/tests/debuginfo/shadowed-argument.rs +++ b/tests/debuginfo/shadowed-argument.rs @@ -29,26 +29,26 @@ // lldb-command:run -// lldb-command:print x +// lldb-command:v x // lldbg-check:[...] false // lldbr-check:(bool) x = false -// lldb-command:print y +// lldb-command:v y // lldbg-check:[...] true // lldbr-check:(bool) y = true // lldb-command:continue -// lldb-command:print x +// lldb-command:v x // lldbg-check:[...] 10 // lldbr-check:(i32) x = 10 -// lldb-command:print y +// lldb-command:v y // lldbg-check:[...] true // lldbr-check:(bool) y = true // lldb-command:continue -// lldb-command:print x +// lldb-command:v x // lldbg-check:[...] 10.5 // lldbr-check:(f64) x = 10.5 -// lldb-command:print y +// lldb-command:v y // lldbg-check:[...] 20 // lldbr-check:(i32) y = 20 // lldb-command:continue diff --git a/tests/debuginfo/shadowed-variable.rs b/tests/debuginfo/shadowed-variable.rs index 66cadf2913bb..3cc5fe14cb2b 100644 --- a/tests/debuginfo/shadowed-variable.rs +++ b/tests/debuginfo/shadowed-variable.rs @@ -39,42 +39,42 @@ // lldb-command:run -// lldb-command:print x +// lldb-command:v x // lldbg-check:[...] false // lldbr-check:(bool) x = false -// lldb-command:print y +// lldb-command:v y // lldbg-check:[...] true // lldbr-check:(bool) y = true // lldb-command:continue -// lldb-command:print x +// lldb-command:v x // lldbg-check:[...] 10 // lldbr-check:(i32) x = 10 -// lldb-command:print y +// lldb-command:v y // lldbg-check:[...] true // lldbr-check:(bool) y = true // lldb-command:continue -// lldb-command:print x +// lldb-command:v x // lldbg-check:[...] 10.5 // lldbr-check:(f64) x = 10.5 -// lldb-command:print y +// lldb-command:v y // lldbg-check:[...] 20 // lldbr-check:(i32) y = 20 // lldb-command:continue -// lldb-command:print x +// lldb-command:v x // lldbg-check:[...] 10.5 // lldbr-check:(f64) x = 10.5 -// lldb-command:print y +// lldb-command:v y // lldbg-check:[...] 20 // lldbr-check:(i32) y = 20 // lldb-command:continue -// lldb-command:print x +// lldb-command:v x // lldbg-check:[...] 11.5 // lldbr-check:(f64) x = 11.5 -// lldb-command:print y +// lldb-command:v y // lldbg-check:[...] 20 // lldbr-check:(i32) y = 20 // lldb-command:continue diff --git a/tests/debuginfo/should-fail.rs b/tests/debuginfo/should-fail.rs index 4211baeee22d..0f153394a442 100644 --- a/tests/debuginfo/should-fail.rs +++ b/tests/debuginfo/should-fail.rs @@ -16,7 +16,7 @@ // lldb-command:run -// lldb-command:print x +// lldb-command:v x // lldb-check:[...] 5 // === CDB TESTS ================================================================================== diff --git a/tests/debuginfo/simple-lexical-scope.rs b/tests/debuginfo/simple-lexical-scope.rs index dfcd701017ec..4156e68f8b13 100644 --- a/tests/debuginfo/simple-lexical-scope.rs +++ b/tests/debuginfo/simple-lexical-scope.rs @@ -39,37 +39,37 @@ // lldb-command:run -// lldb-command:print x +// lldb-command:v x // lldbg-check:[...] false // lldbr-check:(bool) x = false // lldb-command:continue -// lldb-command:print x +// lldb-command:v x // lldbg-check:[...] false // lldbr-check:(bool) x = false // lldb-command:continue -// lldb-command:print x +// lldb-command:v x // lldbg-check:[...] 10 // lldbr-check:(i32) x = 10 // lldb-command:continue -// lldb-command:print x +// lldb-command:v x // lldbg-check:[...] 10 // lldbr-check:(i32) x = 10 // lldb-command:continue -// lldb-command:print x +// lldb-command:v x // lldbg-check:[...] 10.5 // lldbr-check:(f64) x = 10.5 // lldb-command:continue -// lldb-command:print x +// lldb-command:v x // lldbg-check:[...] 10 // lldbr-check:(i32) x = 10 // lldb-command:continue -// lldb-command:print x +// lldb-command:v x // lldbg-check:[...] false // lldbr-check:(bool) x = false // lldb-command:continue diff --git a/tests/debuginfo/simple-struct.rs b/tests/debuginfo/simple-struct.rs index 89c0cb491bfd..968a5c63e89a 100644 --- a/tests/debuginfo/simple-struct.rs +++ b/tests/debuginfo/simple-struct.rs @@ -97,27 +97,27 @@ // lldb-command:run -// lldb-command:print no_padding16 +// lldb-command:v no_padding16 // lldbg-check:[...] { x = 10000 y = -10001 } // lldbr-check:(simple_struct::NoPadding16) no_padding16 = { x = 10000 y = -10001 } -// lldb-command:print no_padding32 +// lldb-command:v no_padding32 // lldbg-check:[...] { x = -10002 y = -10003.5 z = 10004 } // lldbr-check:(simple_struct::NoPadding32) no_padding32 = { x = -10002 y = -10003.5 z = 10004 } -// lldb-command:print no_padding64 +// lldb-command:v no_padding64 // lldbg-check:[...] { x = -10005.5 y = 10006 z = 10007 } // lldbr-check:(simple_struct::NoPadding64) no_padding64 = { x = -10005.5 y = 10006 z = 10007 } -// lldb-command:print no_padding163264 +// lldb-command:v no_padding163264 // lldbg-check:[...] { a = -10008 b = 10009 c = 10010 d = 10011 } // lldbr-check:(simple_struct::NoPadding163264) no_padding163264 = { a = -10008 b = 10009 c = 10010 d = 10011 } -// lldb-command:print internal_padding +// lldb-command:v internal_padding // lldbg-check:[...] { x = 10012 y = -10013 } // lldbr-check:(simple_struct::InternalPadding) internal_padding = { x = 10012 y = -10013 } -// lldb-command:print padding_at_end +// lldb-command:v padding_at_end // lldbg-check:[...] { x = -10014 y = 10015 } // lldbr-check:(simple_struct::PaddingAtEnd) padding_at_end = { x = -10014 y = 10015 } diff --git a/tests/debuginfo/simple-tuple.rs b/tests/debuginfo/simple-tuple.rs index 93f56d117ad8..86003105f360 100644 --- a/tests/debuginfo/simple-tuple.rs +++ b/tests/debuginfo/simple-tuple.rs @@ -99,27 +99,27 @@ // lldb-command:run -// lldb-command:print/d noPadding8 +// lldb-command:v/d noPadding8 // lldbg-check:[...] { 0 = -100 1 = 100 } // lldbr-check:((i8, u8)) noPadding8 = { 0 = -100 1 = 100 } -// lldb-command:print noPadding16 +// lldb-command:v noPadding16 // lldbg-check:[...] { 0 = 0 1 = 1 2 = 2 } // lldbr-check:((i16, i16, u16)) noPadding16 = { 0 = 0 1 = 1 2 = 2 } -// lldb-command:print noPadding32 +// lldb-command:v noPadding32 // lldbg-check:[...] { 0 = 3 1 = 4.5 2 = 5 } // lldbr-check:((i32, f32, u32)) noPadding32 = { 0 = 3 1 = 4.5 2 = 5 } -// lldb-command:print noPadding64 +// lldb-command:v noPadding64 // lldbg-check:[...] { 0 = 6 1 = 7.5 2 = 8 } // lldbr-check:((i64, f64, u64)) noPadding64 = { 0 = 6 1 = 7.5 2 = 8 } -// lldb-command:print internalPadding1 +// lldb-command:v internalPadding1 // lldbg-check:[...] { 0 = 9 1 = 10 } // lldbr-check:((i16, i32)) internalPadding1 = { 0 = 9 1 = 10 } -// lldb-command:print internalPadding2 +// lldb-command:v internalPadding2 // lldbg-check:[...] { 0 = 11 1 = 12 2 = 13 3 = 14 } // lldbr-check:((i16, i32, u32, u64)) internalPadding2 = { 0 = 11 1 = 12 2 = 13 3 = 14 } -// lldb-command:print paddingAtEnd +// lldb-command:v paddingAtEnd // lldbg-check:[...] { 0 = 15 1 = 16 } // lldbr-check:((i32, i16)) paddingAtEnd = { 0 = 15 1 = 16 } diff --git a/tests/debuginfo/static-method-on-struct-and-enum.rs b/tests/debuginfo/static-method-on-struct-and-enum.rs index 23384e0c33a7..b4ec45435726 100644 --- a/tests/debuginfo/static-method-on-struct-and-enum.rs +++ b/tests/debuginfo/static-method-on-struct-and-enum.rs @@ -28,22 +28,22 @@ // lldb-command:run // STRUCT -// lldb-command:print arg1 +// lldb-command:v arg1 // lldbg-check:[...] 1 // lldbr-check:(isize) arg1 = 1 -// lldb-command:print arg2 +// lldb-command:v arg2 // lldbg-check:[...] 2 // lldbr-check:(isize) arg2 = 2 // lldb-command:continue // ENUM -// lldb-command:print arg1 +// lldb-command:v arg1 // lldbg-check:[...] -3 // lldbr-check:(isize) arg1 = -3 -// lldb-command:print arg2 +// lldb-command:v arg2 // lldbg-check:[...] 4.5 // lldbr-check:(f64) arg2 = 4.5 -// lldb-command:print arg3 +// lldb-command:v arg3 // lldbg-check:[...] 5 // lldbr-check:(usize) arg3 = 5 // lldb-command:continue diff --git a/tests/debuginfo/struct-in-enum.rs b/tests/debuginfo/struct-in-enum.rs index a91f24a3f5c8..52e419e6b474 100644 --- a/tests/debuginfo/struct-in-enum.rs +++ b/tests/debuginfo/struct-in-enum.rs @@ -26,12 +26,12 @@ // lldb-command:run -// lldb-command:print case1 +// lldb-command:v case1 // lldb-check:[...] Case1(0, Struct { x: 2088533116, y: 2088533116, z: 31868 }) -// lldb-command:print case2 +// lldb-command:v case2 // lldb-check:[...] Case2(0, 1229782938247303441, 4369) -// lldb-command:print univariant +// lldb-command:v univariant // lldb-check:[...] TheOnlyCase(Struct { x: 123, y: 456, z: 789 }) #![allow(unused_variables)] diff --git a/tests/debuginfo/struct-in-struct.rs b/tests/debuginfo/struct-in-struct.rs index e88d955b6e97..7ca0e3a5ef63 100644 --- a/tests/debuginfo/struct-in-struct.rs +++ b/tests/debuginfo/struct-in-struct.rs @@ -23,35 +23,35 @@ // lldb-command:run -// lldb-command:print three_simple_structs +// lldb-command:v three_simple_structs // lldbg-check:[...] { x = { x = 1 } y = { x = 2 } z = { x = 3 } } // lldbr-check:(struct_in_struct::ThreeSimpleStructs) three_simple_structs = { x = { x = 1 } y = { x = 2 } z = { x = 3 } } -// lldb-command:print internal_padding_parent +// lldb-command:v internal_padding_parent // lldbg-check:[...] { x = { x = 4 y = 5 } y = { x = 6 y = 7 } z = { x = 8 y = 9 } } // lldbr-check:(struct_in_struct::InternalPaddingParent) internal_padding_parent = { x = { x = 4 y = 5 } y = { x = 6 y = 7 } z = { x = 8 y = 9 } } -// lldb-command:print padding_at_end_parent +// lldb-command:v padding_at_end_parent // lldbg-check:[...] { x = { x = 10 y = 11 } y = { x = 12 y = 13 } z = { x = 14 y = 15 } } // lldbr-check:(struct_in_struct::PaddingAtEndParent) padding_at_end_parent = { x = { x = 10 y = 11 } y = { x = 12 y = 13 } z = { x = 14 y = 15 } } -// lldb-command:print mixed +// lldb-command:v mixed // lldbg-check:[...] { x = { x = 16 y = 17 } y = { x = 18 y = 19 } z = { x = 20 } w = 21 } // lldbr-check:(struct_in_struct::Mixed) mixed = { x = { x = 16 y = 17 } y = { x = 18 y = 19 } z = { x = 20 } w = 21 } -// lldb-command:print bag +// lldb-command:v bag // lldbg-check:[...] { x = { x = 22 } } // lldbr-check:(struct_in_struct::Bag) bag = { x = { x = 22 } } -// lldb-command:print bag_in_bag +// lldb-command:v bag_in_bag // lldbg-check:[...] { x = { x = { x = 23 } } } // lldbr-check:(struct_in_struct::BagInBag) bag_in_bag = { x = { x = { x = 23 } } } -// lldb-command:print tjo +// lldb-command:v tjo // lldbg-check:[...] { x = { x = { x = { x = 24 } } } } // lldbr-check:(struct_in_struct::ThatsJustOverkill) tjo = { x = { x = { x = { x = 24 } } } } -// lldb-command:print tree +// lldb-command:v tree // lldbg-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 } } } } // lldbr-check:(struct_in_struct::Tree) tree = { x = { x = 25 } y = { x = { x = 26 y = 27 } y = { x = 28 y = 29 } z = { x = 30 y = 31 } } z = { x = { x = { x = 32 } } } } diff --git a/tests/debuginfo/struct-namespace.rs b/tests/debuginfo/struct-namespace.rs index d641a788a6fa..3cae51e83ddb 100644 --- a/tests/debuginfo/struct-namespace.rs +++ b/tests/debuginfo/struct-namespace.rs @@ -5,17 +5,17 @@ // Check that structs get placed in the correct namespace // lldb-command:run -// lldb-command:p struct1 +// lldb-command:v struct1 // lldbg-check:(struct_namespace::Struct1)[...] // lldbr-check:(struct_namespace::Struct1) struct1 = Struct1 { a: 0, b: 1 } -// lldb-command:p struct2 +// lldb-command:v struct2 // lldbg-check:(struct_namespace::Struct2)[...] // lldbr-check:(struct_namespace::Struct2) struct2 = { = 2 } -// lldb-command:p mod1_struct1 +// lldb-command:v mod1_struct1 // lldbg-check:(struct_namespace::mod1::Struct1)[...] // lldbr-check:(struct_namespace::mod1::Struct1) mod1_struct1 = Struct1 { a: 3, b: 4 } -// lldb-command:p mod1_struct2 +// lldb-command:v mod1_struct2 // lldbg-check:(struct_namespace::mod1::Struct2)[...] // lldbr-check:(struct_namespace::mod1::Struct2) mod1_struct2 = { = 5 } diff --git a/tests/debuginfo/struct-style-enum.rs b/tests/debuginfo/struct-style-enum.rs index 2f155d2b83ee..517b76c14120 100644 --- a/tests/debuginfo/struct-style-enum.rs +++ b/tests/debuginfo/struct-style-enum.rs @@ -26,16 +26,16 @@ // lldb-command:run -// lldb-command:print case1 +// lldb-command:v case1 // lldbr-check:(struct_style_enum::Regular::Case1) case1 = { a = 0 b = 31868 c = 31868 d = 31868 e = 31868 } -// lldb-command:print case2 +// lldb-command:v case2 // lldbr-check:(struct_style_enum::Regular::Case2) case2 = Case2 { Case1: 0, Case2: 286331153, Case3: 286331153 } -// lldb-command:print case3 +// lldb-command:v case3 // lldbr-check:(struct_style_enum::Regular::Case3) case3 = Case3 { Case1: 0, Case2: 6438275382588823897 } -// lldb-command:print univariant +// lldb-command:v univariant // lldbr-check:(struct_style_enum::Univariant) univariant = Univariant { TheOnlyCase: TheOnlyCase { a: -1 } } #![allow(unused_variables)] diff --git a/tests/debuginfo/struct-with-destructor.rs b/tests/debuginfo/struct-with-destructor.rs index d6686be662cd..12e2ac4225c0 100644 --- a/tests/debuginfo/struct-with-destructor.rs +++ b/tests/debuginfo/struct-with-destructor.rs @@ -25,19 +25,19 @@ // === LLDB TESTS ================================================================================== // lldb-command:run -// lldb-command:print simple +// lldb-command:v simple // lldbg-check:[...] { x = 10 y = 20 } // lldbr-check:(struct_with_destructor::WithDestructor) simple = { x = 10 y = 20 } -// lldb-command:print noDestructor +// lldb-command:v noDestructor // lldbg-check:[...] { a = { x = 10 y = 20 } guard = -1 } // lldbr-check:(struct_with_destructor::NoDestructorGuarded) noDestructor = { a = { x = 10 y = 20 } guard = -1 } -// lldb-command:print withDestructor +// lldb-command:v withDestructor // lldbg-check:[...] { a = { x = 10 y = 20 } guard = -1 } // lldbr-check:(struct_with_destructor::WithDestructorGuarded) withDestructor = { a = { x = 10 y = 20 } guard = -1 } -// lldb-command:print nested +// lldb-command:v nested // lldbg-check:[...] { a = { a = { x = 7890 y = 9870 } } } // lldbr-check:(struct_with_destructor::NestedOuter) nested = { a = { a = { x = 7890 y = 9870 } } } diff --git a/tests/debuginfo/tuple-in-tuple.rs b/tests/debuginfo/tuple-in-tuple.rs index b6b20cea9b62..8ed0e1f9c13b 100644 --- a/tests/debuginfo/tuple-in-tuple.rs +++ b/tests/debuginfo/tuple-in-tuple.rs @@ -35,27 +35,27 @@ // lldb-command:run -// lldb-command:print no_padding1 +// lldb-command:v no_padding1 // lldbg-check:[...] { 0 = { 0 = 0 1 = 1 } 1 = 2 2 = 3 } // lldbr-check:(((u32, u32), u32, u32)) no_padding1 = { 0 = { 0 = 0 1 = 1 } 1 = 2 2 = 3 } -// lldb-command:print no_padding2 +// lldb-command:v no_padding2 // lldbg-check:[...] { 0 = 4 1 = { 0 = 5 1 = 6 } 2 = 7 } // lldbr-check:((u32, (u32, u32), u32)) no_padding2 = { 0 = 4 1 = { 0 = 5 1 = 6 } 2 = 7 } -// lldb-command:print no_padding3 +// lldb-command:v no_padding3 // lldbg-check:[...] { 0 = 8 1 = 9 2 = { 0 = 10 1 = 11 } } // lldbr-check:((u32, u32, (u32, u32))) no_padding3 = { 0 = 8 1 = 9 2 = { 0 = 10 1 = 11 } } -// lldb-command:print internal_padding1 +// lldb-command:v internal_padding1 // lldbg-check:[...] { 0 = 12 1 = { 0 = 13 1 = 14 } } // lldbr-check:((i16, (i32, i32))) internal_padding1 = { 0 = 12 1 = { 0 = 13 1 = 14 } } -// lldb-command:print internal_padding2 +// lldb-command:v internal_padding2 // lldbg-check:[...] { 0 = 15 1 = { 0 = 16 1 = 17 } } // lldbr-check:((i16, (i16, i32))) internal_padding2 = { 0 = 15 1 = { 0 = 16 1 = 17 } } -// lldb-command:print padding_at_end1 +// lldb-command:v padding_at_end1 // lldbg-check:[...] { 0 = 18 1 = { 0 = 19 1 = 20 } } // lldbr-check:((i32, (i32, i16))) padding_at_end1 = { 0 = 18 1 = { 0 = 19 1 = 20 } } -// lldb-command:print padding_at_end2 +// lldb-command:v padding_at_end2 // lldbg-check:[...] { 0 = { 0 = 21 1 = 22 } 1 = 23 } // lldbr-check:(((i32, i16), i32)) padding_at_end2 = { 0 = { 0 = 21 1 = 22 } 1 = 23 } diff --git a/tests/debuginfo/tuple-struct.rs b/tests/debuginfo/tuple-struct.rs index e912f63a8b2d..88b1ae19e295 100644 --- a/tests/debuginfo/tuple-struct.rs +++ b/tests/debuginfo/tuple-struct.rs @@ -35,27 +35,27 @@ // lldb-command:run -// lldb-command:print no_padding16 +// lldb-command:v no_padding16 // lldbg-check:[...] { 0 = 10000 1 = -10001 } // lldbr-check:(tuple_struct::NoPadding16) no_padding16 = { 0 = 10000 1 = -10001 } -// lldb-command:print no_padding32 +// lldb-command:v no_padding32 // lldbg-check:[...] { 0 = -10002 1 = -10003.5 2 = 10004 } // lldbr-check:(tuple_struct::NoPadding32) no_padding32 = { 0 = -10002 1 = -10003.5 2 = 10004 } -// lldb-command:print no_padding64 +// lldb-command:v no_padding64 // lldbg-check:[...] { 0 = -10005.5 1 = 10006 2 = 10007 } // lldbr-check:(tuple_struct::NoPadding64) no_padding64 = { 0 = -10005.5 1 = 10006 2 = 10007 } -// lldb-command:print no_padding163264 +// lldb-command:v no_padding163264 // lldbg-check:[...] { 0 = -10008 1 = 10009 2 = 10010 3 = 10011 } // lldbr-check:(tuple_struct::NoPadding163264) no_padding163264 = { 0 = -10008 1 = 10009 2 = 10010 3 = 10011 } -// lldb-command:print internal_padding +// lldb-command:v internal_padding // lldbg-check:[...] { 0 = 10012 1 = -10013 } // lldbr-check:(tuple_struct::InternalPadding) internal_padding = { 0 = 10012 1 = -10013 } -// lldb-command:print padding_at_end +// lldb-command:v padding_at_end // lldbg-check:[...] { 0 = -10014 1 = 10015 } // lldbr-check:(tuple_struct::PaddingAtEnd) padding_at_end = { 0 = -10014 1 = 10015 } diff --git a/tests/debuginfo/tuple-style-enum.rs b/tests/debuginfo/tuple-style-enum.rs index e3e1684cc28a..883aa658eb2c 100644 --- a/tests/debuginfo/tuple-style-enum.rs +++ b/tests/debuginfo/tuple-style-enum.rs @@ -26,16 +26,16 @@ // lldb-command:run -// lldb-command:print case1 +// lldb-command:v case1 // lldbr-check:(tuple_style_enum::Regular::Case1) case1 = { = 0 = 31868 = 31868 = 31868 = 31868 } -// lldb-command:print case2 +// lldb-command:v case2 // lldbr-check:(tuple_style_enum::Regular::Case2) case2 = Case2 { Case1: 0, Case2: 286331153, Case3: 286331153 } -// lldb-command:print case3 +// lldb-command:v case3 // lldbr-check:(tuple_style_enum::Regular::Case3) case3 = Case3 { Case1: 0, Case2: 6438275382588823897 } -// lldb-command:print univariant +// lldb-command:v univariant // lldbr-check:(tuple_style_enum::Univariant) univariant = { TheOnlyCase = { = -1 } } #![allow(unused_variables)] diff --git a/tests/debuginfo/union-smoke.rs b/tests/debuginfo/union-smoke.rs index 8df4c9dbf96a..9b1cf6e1e95c 100644 --- a/tests/debuginfo/union-smoke.rs +++ b/tests/debuginfo/union-smoke.rs @@ -18,7 +18,7 @@ // === LLDB TESTS ================================================================================== // lldb-command:run -// lldb-command:print u +// lldb-command:v u // lldbg-check:[...] { a = { 0 = '\x02' 1 = '\x02' } b = 514 } // lldbr-check:(union_smoke::U) u = { a = { 0 = '\x02' 1 = '\x02' } b = 514 } diff --git a/tests/debuginfo/unique-enum.rs b/tests/debuginfo/unique-enum.rs index db2b4403ec66..b3879468e0a9 100644 --- a/tests/debuginfo/unique-enum.rs +++ b/tests/debuginfo/unique-enum.rs @@ -22,13 +22,13 @@ // lldb-command:run -// lldb-command:print *the_a +// lldb-command:v *the_a // lldbr-check:(unique_enum::ABC::TheA) *the_a = TheA { TheA: 0, TheB: 8970181431921507452 } -// lldb-command:print *the_b +// lldb-command:v *the_b // lldbr-check:(unique_enum::ABC::TheB) *the_b = { = 0 = 286331153 = 286331153 } -// lldb-command:print *univariant +// lldb-command:v *univariant // lldbr-check:(unique_enum::Univariant) *univariant = { TheOnlyCase = { = 123234 } } #![allow(unused_variables)] diff --git a/tests/debuginfo/var-captured-in-nested-closure.rs b/tests/debuginfo/var-captured-in-nested-closure.rs index 62cb87e4f994..7772ec003378 100644 --- a/tests/debuginfo/var-captured-in-nested-closure.rs +++ b/tests/debuginfo/var-captured-in-nested-closure.rs @@ -43,42 +43,42 @@ // lldb-command:run -// lldb-command:print variable +// lldb-command:v variable // lldbg-check:[...] 1 // lldbr-check:(isize) variable = 1 -// lldb-command:print constant +// lldb-command:v constant // lldbg-check:[...] 2 // lldbr-check:(isize) constant = 2 -// lldb-command:print a_struct +// lldb-command:v a_struct // lldbg-check:[...] { a = -3 b = 4.5 c = 5 } // lldbr-check:(var_captured_in_nested_closure::Struct) a_struct = { a = -3 b = 4.5 c = 5 } -// lldb-command:print *struct_ref +// lldb-command:v *struct_ref // lldbg-check:[...] { a = -3 b = 4.5 c = 5 } // lldbr-check:(var_captured_in_nested_closure::Struct) *struct_ref = { a = -3 b = 4.5 c = 5 } -// lldb-command:print *owned +// lldb-command:v *owned // lldbg-check:[...] 6 // lldbr-check:(isize) *owned = 6 -// lldb-command:print closure_local +// lldb-command:v closure_local // lldbg-check:[...] 8 // lldbr-check:(isize) closure_local = 8 // lldb-command:continue -// lldb-command:print variable +// lldb-command:v variable // lldbg-check:[...] 1 // lldbr-check:(isize) variable = 1 -// lldb-command:print constant +// lldb-command:v constant // lldbg-check:[...] 2 // lldbr-check:(isize) constant = 2 -// lldb-command:print a_struct +// lldb-command:v a_struct // lldbg-check:[...] { a = -3 b = 4.5 c = 5 } // lldbr-check:(var_captured_in_nested_closure::Struct) a_struct = { a = -3 b = 4.5 c = 5 } -// lldb-command:print *struct_ref +// lldb-command:v *struct_ref // lldbg-check:[...] { a = -3 b = 4.5 c = 5 } // lldbr-check:(var_captured_in_nested_closure::Struct) *struct_ref = { a = -3 b = 4.5 c = 5 } -// lldb-command:print *owned +// lldb-command:v *owned // lldbg-check:[...] 6 // lldbr-check:(isize) *owned = 6 -// lldb-command:print closure_local +// lldb-command:v closure_local // lldbg-check:[...] 8 // lldbr-check:(isize) closure_local = 8 // lldb-command:continue diff --git a/tests/debuginfo/var-captured-in-sendable-closure.rs b/tests/debuginfo/var-captured-in-sendable-closure.rs index e2e154e91cb4..782a7d113738 100644 --- a/tests/debuginfo/var-captured-in-sendable-closure.rs +++ b/tests/debuginfo/var-captured-in-sendable-closure.rs @@ -23,13 +23,13 @@ // lldb-command:run -// lldb-command:print constant +// lldb-command:v constant // lldbg-check:[...] 1 // lldbr-check:(isize) constant = 1 -// lldb-command:print a_struct +// lldb-command:v a_struct // lldbg-check:[...] { a = -2 b = 3.5 c = 4 } // lldbr-check:(var_captured_in_sendable_closure::Struct) a_struct = { a = -2 b = 3.5 c = 4 } -// lldb-command:print *owned +// lldb-command:v *owned // lldbg-check:[...] 5 // lldbr-check:(isize) *owned = 5 diff --git a/tests/debuginfo/var-captured-in-stack-closure.rs b/tests/debuginfo/var-captured-in-stack-closure.rs index c704b53ef853..c9a93cd7b7f9 100644 --- a/tests/debuginfo/var-captured-in-stack-closure.rs +++ b/tests/debuginfo/var-captured-in-stack-closure.rs @@ -39,37 +39,37 @@ // lldb-command:run -// lldb-command:print variable +// lldb-command:v variable // lldbg-check:[...] 1 // lldbr-check:(isize) variable = 1 -// lldb-command:print constant +// lldb-command:v constant // lldbg-check:[...] 2 // lldbr-check:(isize) constant = 2 -// lldb-command:print a_struct +// lldb-command:v a_struct // lldbg-check:[...] { a = -3 b = 4.5 c = 5 } // lldbr-check:(var_captured_in_stack_closure::Struct) a_struct = { a = -3 b = 4.5 c = 5 } -// lldb-command:print *struct_ref +// lldb-command:v *struct_ref // lldbg-check:[...] { a = -3 b = 4.5 c = 5 } // lldbr-check:(var_captured_in_stack_closure::Struct) *struct_ref = { a = -3 b = 4.5 c = 5 } -// lldb-command:print *owned +// lldb-command:v *owned // lldbg-check:[...] 6 // lldbr-check:(isize) *owned = 6 // lldb-command:continue -// lldb-command:print variable +// lldb-command:v variable // lldbg-check:[...] 2 // lldbr-check:(isize) variable = 2 -// lldb-command:print constant +// lldb-command:v constant // lldbg-check:[...] 2 // lldbr-check:(isize) constant = 2 -// lldb-command:print a_struct +// lldb-command:v a_struct // lldbg-check:[...] { a = -3 b = 4.5 c = 5 } // lldbr-check:(var_captured_in_stack_closure::Struct) a_struct = { a = -3 b = 4.5 c = 5 } -// lldb-command:print *struct_ref +// lldb-command:v *struct_ref // lldbg-check:[...] { a = -3 b = 4.5 c = 5 } // lldbr-check:(var_captured_in_stack_closure::Struct) *struct_ref = { a = -3 b = 4.5 c = 5 } -// lldb-command:print *owned +// lldb-command:v *owned // lldbg-check:[...] 6 // lldbr-check:(isize) *owned = 6 diff --git a/tests/debuginfo/vec-slices.rs b/tests/debuginfo/vec-slices.rs index bf3cad30faf9..5a8481699b2e 100644 --- a/tests/debuginfo/vec-slices.rs +++ b/tests/debuginfo/vec-slices.rs @@ -70,27 +70,27 @@ // lldb-command:run -// lldb-command:print empty +// lldb-command:v empty // lldbg-check:[...] size=0 // lldbr-check:(&[i64]) empty = size=0 -// lldb-command:print singleton +// lldb-command:v singleton // lldbg-check:[...] size=1 { [0] = 1 } // lldbr-check:(&[i64]) singleton = &[1] -// lldb-command:print multiple +// lldb-command:v multiple // lldbg-check:[...] size=4 { [0] = 2 [1] = 3 [2] = 4 [3] = 5 } // lldbr-check:(&[i64]) multiple = size=4 { [0] = 2 [1] = 3 [2] = 4 [3] = 5 } -// lldb-command:print slice_of_slice +// lldb-command:v slice_of_slice // lldbg-check:[...] size=2 { [0] = 3 [1] = 4 } // lldbr-check:(&[i64]) slice_of_slice = size=2 { [0] = 3 [1] = 4 } -// lldb-command:print padded_tuple +// lldb-command:v padded_tuple // lldbg-check:[...] size=2 { [0] = { 0 = 6 1 = 7 } [1] = { 0 = 8 1 = 9 } } // lldbr-check:(&[(i32, i16)]) padded_tuple = size=2 { [0] = { 0 = 6 1 = 7 } [1] = { 0 = 8 1 = 9 } } -// lldb-command:print padded_struct +// lldb-command:v padded_struct // lldbg-check:[...] size=2 { [0] = { x = 10 y = 11 z = 12 } [1] = { x = 13 y = 14 z = 15 } } // lldbr-check:(&[vec_slices::AStruct]) padded_struct = size=2 { [0] = { x = 10 y = 11 z = 12 } [1] = { x = 13 y = 14 z = 15 } } diff --git a/tests/debuginfo/vec.rs b/tests/debuginfo/vec.rs index 0ac2f2acb596..cf7de0b9b551 100644 --- a/tests/debuginfo/vec.rs +++ b/tests/debuginfo/vec.rs @@ -17,7 +17,7 @@ // === LLDB TESTS ================================================================================== // lldb-command:run -// lldb-command:print a +// lldb-command:v a // lldbg-check:[...] { [0] = 1 [1] = 2 [2] = 3 } // lldbr-check:([i32; 3]) a = { [0] = 1 [1] = 2 [2] = 3 } From e126ceb46d5f24015f0644df5d360fa9209d48be Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Thu, 14 Mar 2024 15:26:49 +0100 Subject: [PATCH 075/103] Greatly reduce GCC build logs --- .../host-x86_64/dist-x86_64-linux/build-gccjit.sh | 12 ++++++++---- .../docker/host-x86_64/x86_64-gnu-llvm-16/Dockerfile | 3 ++- .../docker/host-x86_64/x86_64-gnu-llvm-17/Dockerfile | 3 ++- .../docker/host-x86_64/x86_64-gnu-tools/Dockerfile | 3 ++- 4 files changed, 14 insertions(+), 7 deletions(-) mode change 100644 => 100755 src/ci/docker/host-x86_64/dist-x86_64-linux/build-gccjit.sh diff --git a/src/ci/docker/host-x86_64/dist-x86_64-linux/build-gccjit.sh b/src/ci/docker/host-x86_64/dist-x86_64-linux/build-gccjit.sh old mode 100644 new mode 100755 index 324dd5fac161..2c65522cc1e9 --- a/src/ci/docker/host-x86_64/dist-x86_64-linux/build-gccjit.sh +++ b/src/ci/docker/host-x86_64/dist-x86_64-linux/build-gccjit.sh @@ -1,9 +1,11 @@ -#!/bin/sh +#!/usr/bin/env bash set -ex cd $1 +source shared.sh + # Setting up folders for GCC git clone https://github.com/antoyo/gcc gcc-src cd gcc-src @@ -20,9 +22,11 @@ cd ../gcc-build --enable-checking=release \ --disable-bootstrap \ --disable-multilib \ - --prefix=$(pwd)/../gcc-install -make -make install + --prefix=$(pwd)/../gcc-install \ + --quiet + +hide_output make +hide_output make install rm -rf ../gcc-src ln -s /scripts/gcc-install/lib/libgccjit.so /usr/lib/x86_64-linux-gnu/libgccjit.so diff --git a/src/ci/docker/host-x86_64/x86_64-gnu-llvm-16/Dockerfile b/src/ci/docker/host-x86_64/x86_64-gnu-llvm-16/Dockerfile index 6540a500d3a5..4fc2b2e507e0 100644 --- a/src/ci/docker/host-x86_64/x86_64-gnu-llvm-16/Dockerfile +++ b/src/ci/docker/host-x86_64/x86_64-gnu-llvm-16/Dockerfile @@ -59,8 +59,9 @@ ENV RUST_CONFIGURE_ARGS \ COPY host-x86_64/x86_64-gnu-llvm-16/script.sh /tmp/ +COPY host-x86_64/dist-x86_64-linux/shared.sh /scripts/ COPY host-x86_64/dist-x86_64-linux/build-gccjit.sh /scripts/ -RUN sh /scripts/build-gccjit.sh /scripts +RUN /scripts/build-gccjit.sh /scripts ENV SCRIPT /tmp/script.sh diff --git a/src/ci/docker/host-x86_64/x86_64-gnu-llvm-17/Dockerfile b/src/ci/docker/host-x86_64/x86_64-gnu-llvm-17/Dockerfile index ed4e1978c5d4..7c2ecd198e23 100644 --- a/src/ci/docker/host-x86_64/x86_64-gnu-llvm-17/Dockerfile +++ b/src/ci/docker/host-x86_64/x86_64-gnu-llvm-17/Dockerfile @@ -58,8 +58,9 @@ ENV RUST_CONFIGURE_ARGS \ COPY host-x86_64/x86_64-gnu-llvm-16/script.sh /tmp/ +COPY host-x86_64/dist-x86_64-linux/shared.sh /scripts/ COPY host-x86_64/dist-x86_64-linux/build-gccjit.sh /scripts/ -RUN sh /scripts/build-gccjit.sh /scripts +RUN /scripts/build-gccjit.sh /scripts ENV SCRIPT /tmp/script.sh diff --git a/src/ci/docker/host-x86_64/x86_64-gnu-tools/Dockerfile b/src/ci/docker/host-x86_64/x86_64-gnu-tools/Dockerfile index a03577b45112..6f7205698981 100644 --- a/src/ci/docker/host-x86_64/x86_64-gnu-tools/Dockerfile +++ b/src/ci/docker/host-x86_64/x86_64-gnu-tools/Dockerfile @@ -95,9 +95,10 @@ ENV RUST_CONFIGURE_ARGS \ ENV HOST_TARGET x86_64-unknown-linux-gnu +COPY host-x86_64/dist-x86_64-linux/shared.sh /scripts/ COPY host-x86_64/dist-x86_64-linux/build-gccjit.sh /scripts/ -RUN sh /scripts/build-gccjit.sh /scripts +RUN /scripts/build-gccjit.sh /scripts ENV SCRIPT /tmp/checktools.sh ../x.py && \ NODE_PATH=`npm root -g` python3 ../x.py test tests/rustdoc-gui --stage 2 \ From c4ece1f4c8862724fe195bf5bf0d4dcaa76b7686 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Fri, 15 Mar 2024 11:33:14 +0100 Subject: [PATCH 076/103] Build GCC with as many threads as available --- src/ci/docker/host-x86_64/dist-x86_64-linux/build-gccjit.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ci/docker/host-x86_64/dist-x86_64-linux/build-gccjit.sh b/src/ci/docker/host-x86_64/dist-x86_64-linux/build-gccjit.sh index 2c65522cc1e9..b22d60f2b1d1 100755 --- a/src/ci/docker/host-x86_64/dist-x86_64-linux/build-gccjit.sh +++ b/src/ci/docker/host-x86_64/dist-x86_64-linux/build-gccjit.sh @@ -16,16 +16,16 @@ mkdir ../gcc-build ../gcc-install cd ../gcc-build # Building GCC. -../gcc-src/configure \ +hide_output \ + ../gcc-src/configure \ --enable-host-shared \ --enable-languages=jit \ --enable-checking=release \ --disable-bootstrap \ --disable-multilib \ --prefix=$(pwd)/../gcc-install \ - --quiet -hide_output make +hide_output make -j$(nproc) hide_output make install rm -rf ../gcc-src From f858f8727dcc538040304ba654fd40feaf580697 Mon Sep 17 00:00:00 2001 From: hrmny <8845940+ForsakenHarmony@users.noreply.github.com> Date: Fri, 15 Mar 2024 17:49:50 +0100 Subject: [PATCH 077/103] Update LLVM submodule --- src/llvm-project | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/llvm-project b/src/llvm-project index 7973f3560287..84f190a4abf5 160000 --- a/src/llvm-project +++ b/src/llvm-project @@ -1 +1 @@ -Subproject commit 7973f3560287d750500718314a0fd4025bd8ac0e +Subproject commit 84f190a4abf58bbd5301c0fc831f7a96acea246f From dc35339514f79f4816f5a36121c25abcfa5723e3 Mon Sep 17 00:00:00 2001 From: Jack Wrenn Date: Fri, 15 Mar 2024 17:11:11 +0000 Subject: [PATCH 078/103] Safe Transmute: Use 'not yet supported', not 'unspecified' in errors We can (and will) support analyzing the transmutability of types whose layouts aren't completely specified by its repr. This change ensures that the error messages remain sensible after this support lands. --- .../error_reporting/type_err_ctxt_ext.rs | 8 +++---- compiler/rustc_transmute/src/layout/tree.rs | 14 +++++------ compiler/rustc_transmute/src/lib.rs | 8 +++---- .../src/maybe_transmutable/mod.rs | 4 ++-- .../should_require_well_defined_layout.stderr | 12 +++++----- .../should_require_well_defined_layout.stderr | 12 +++++----- .../should_require_well_defined_layout.stderr | 24 +++++++++---------- .../should_require_well_defined_layout.stderr | 4 ++-- 8 files changed, 43 insertions(+), 43 deletions(-) diff --git a/compiler/rustc_trait_selection/src/traits/error_reporting/type_err_ctxt_ext.rs b/compiler/rustc_trait_selection/src/traits/error_reporting/type_err_ctxt_ext.rs index b85a05c774fa..e060803c1cb7 100644 --- a/compiler/rustc_trait_selection/src/traits/error_reporting/type_err_ctxt_ext.rs +++ b/compiler/rustc_trait_selection/src/traits/error_reporting/type_err_ctxt_ext.rs @@ -3073,12 +3073,12 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> { let src = trait_ref.args.type_at(1); let err_msg = format!("`{src}` cannot be safely transmuted into `{dst}`"); let safe_transmute_explanation = match reason { - rustc_transmute::Reason::SrcIsUnspecified => { - format!("`{src}` does not have a well-specified layout") + rustc_transmute::Reason::SrcIsNotYetSupported => { + format!("analyzing the transmutability of `{src}` is not yet supported.") } - rustc_transmute::Reason::DstIsUnspecified => { - format!("`{dst}` does not have a well-specified layout") + rustc_transmute::Reason::DstIsNotYetSupported => { + format!("analyzing the transmutability of `{dst}` is not yet supported.") } rustc_transmute::Reason::DstIsBitIncompatible => { diff --git a/compiler/rustc_transmute/src/layout/tree.rs b/compiler/rustc_transmute/src/layout/tree.rs index c2fc55542ffb..9a43d67d4351 100644 --- a/compiler/rustc_transmute/src/layout/tree.rs +++ b/compiler/rustc_transmute/src/layout/tree.rs @@ -186,8 +186,8 @@ pub(crate) mod rustc { #[derive(Debug, Copy, Clone)] pub(crate) enum Err { - /// The layout of the type is unspecified. - Unspecified, + /// The layout of the type is not yet supported. + NotYetSupported, /// This error will be surfaced elsewhere by rustc, so don't surface it. UnknownLayout, /// Overflow size @@ -288,14 +288,14 @@ pub(crate) mod rustc { if members.len() == 0 { Ok(Tree::unit()) } else { - Err(Err::Unspecified) + Err(Err::NotYetSupported) } } ty::Array(ty, len) => { let len = len .try_eval_target_usize(tcx, ParamEnv::reveal_all()) - .ok_or(Err::Unspecified)?; + .ok_or(Err::NotYetSupported)?; let elt = Tree::from_ty(*ty, tcx)?; Ok(std::iter::repeat(elt) .take(len as usize) @@ -307,7 +307,7 @@ pub(crate) mod rustc { // If the layout is ill-specified, halt. if !(adt_def.repr().c() || adt_def.repr().int.is_some()) { - return Err(Err::Unspecified); + return Err(Err::NotYetSupported); } // Compute a summary of the type's layout. @@ -348,7 +348,7 @@ pub(crate) mod rustc { AdtKind::Union => { // is the layout well-defined? if !adt_def.repr().c() { - return Err(Err::Unspecified); + return Err(Err::NotYetSupported); } let ty_layout = layout_of(tcx, ty)?; @@ -384,7 +384,7 @@ pub(crate) mod rustc { })) } - _ => Err(Err::Unspecified), + _ => Err(Err::NotYetSupported), } } diff --git a/compiler/rustc_transmute/src/lib.rs b/compiler/rustc_transmute/src/lib.rs index 8f3af491453e..e871c4659b4b 100644 --- a/compiler/rustc_transmute/src/lib.rs +++ b/compiler/rustc_transmute/src/lib.rs @@ -43,10 +43,10 @@ pub enum Condition { /// Answers "why wasn't the source type transmutable into the destination type?" #[derive(Debug, Hash, Eq, PartialEq, PartialOrd, Ord, Clone)] pub enum Reason { - /// The layout of the source type is unspecified. - SrcIsUnspecified, - /// The layout of the destination type is unspecified. - DstIsUnspecified, + /// The layout of the source type is not yet supported. + SrcIsNotYetSupported, + /// The layout of the destination type is not yet supported. + DstIsNotYetSupported, /// The layout of the destination type is bit-incompatible with the source type. DstIsBitIncompatible, /// The destination type may carry safety invariants. diff --git a/compiler/rustc_transmute/src/maybe_transmutable/mod.rs b/compiler/rustc_transmute/src/maybe_transmutable/mod.rs index e9f425686c4c..16d15580a05b 100644 --- a/compiler/rustc_transmute/src/maybe_transmutable/mod.rs +++ b/compiler/rustc_transmute/src/maybe_transmutable/mod.rs @@ -56,8 +56,8 @@ mod rustc { } (Err(Err::UnknownLayout), _) => Answer::No(Reason::SrcLayoutUnknown), (_, Err(Err::UnknownLayout)) => Answer::No(Reason::DstLayoutUnknown), - (Err(Err::Unspecified), _) => Answer::No(Reason::SrcIsUnspecified), - (_, Err(Err::Unspecified)) => Answer::No(Reason::DstIsUnspecified), + (Err(Err::NotYetSupported), _) => Answer::No(Reason::SrcIsNotYetSupported), + (_, Err(Err::NotYetSupported)) => Answer::No(Reason::DstIsNotYetSupported), (Err(Err::SizeOverflow), _) => Answer::No(Reason::SrcSizeOverflow), (_, Err(Err::SizeOverflow)) => Answer::No(Reason::DstSizeOverflow), (Ok(src), Ok(dst)) => MaybeTransmutableQuery { src, dst, assume, context }.answer(), diff --git a/tests/ui/transmutability/arrays/should_require_well_defined_layout.stderr b/tests/ui/transmutability/arrays/should_require_well_defined_layout.stderr index fd21ac34183f..e486928a4452 100644 --- a/tests/ui/transmutability/arrays/should_require_well_defined_layout.stderr +++ b/tests/ui/transmutability/arrays/should_require_well_defined_layout.stderr @@ -2,7 +2,7 @@ error[E0277]: `[String; 0]` cannot be safely transmuted into `()` --> $DIR/should_require_well_defined_layout.rs:25:52 | LL | assert::is_maybe_transmutable::(); - | ^^ `[String; 0]` does not have a well-specified layout + | ^^ analyzing the transmutability of `[String; 0]` is not yet supported. | note: required by a bound in `is_maybe_transmutable` --> $DIR/should_require_well_defined_layout.rs:12:14 @@ -23,7 +23,7 @@ error[E0277]: `u128` cannot be safely transmuted into `[String; 0]` --> $DIR/should_require_well_defined_layout.rs:26:47 | LL | assert::is_maybe_transmutable::(); - | ^^^^^^^^^ `[String; 0]` does not have a well-specified layout + | ^^^^^^^^^ analyzing the transmutability of `[String; 0]` is not yet supported. | note: required by a bound in `is_maybe_transmutable` --> $DIR/should_require_well_defined_layout.rs:12:14 @@ -44,7 +44,7 @@ error[E0277]: `[String; 1]` cannot be safely transmuted into `()` --> $DIR/should_require_well_defined_layout.rs:31:52 | LL | assert::is_maybe_transmutable::(); - | ^^ `[String; 1]` does not have a well-specified layout + | ^^ analyzing the transmutability of `[String; 1]` is not yet supported. | note: required by a bound in `is_maybe_transmutable` --> $DIR/should_require_well_defined_layout.rs:12:14 @@ -65,7 +65,7 @@ error[E0277]: `u128` cannot be safely transmuted into `[String; 1]` --> $DIR/should_require_well_defined_layout.rs:32:47 | LL | assert::is_maybe_transmutable::(); - | ^^^^^^^^^ `[String; 1]` does not have a well-specified layout + | ^^^^^^^^^ analyzing the transmutability of `[String; 1]` is not yet supported. | note: required by a bound in `is_maybe_transmutable` --> $DIR/should_require_well_defined_layout.rs:12:14 @@ -86,7 +86,7 @@ error[E0277]: `[String; 2]` cannot be safely transmuted into `()` --> $DIR/should_require_well_defined_layout.rs:37:52 | LL | assert::is_maybe_transmutable::(); - | ^^ `[String; 2]` does not have a well-specified layout + | ^^ analyzing the transmutability of `[String; 2]` is not yet supported. | note: required by a bound in `is_maybe_transmutable` --> $DIR/should_require_well_defined_layout.rs:12:14 @@ -107,7 +107,7 @@ error[E0277]: `u128` cannot be safely transmuted into `[String; 2]` --> $DIR/should_require_well_defined_layout.rs:38:47 | LL | assert::is_maybe_transmutable::(); - | ^^^^^^^^^ `[String; 2]` does not have a well-specified layout + | ^^^^^^^^^ analyzing the transmutability of `[String; 2]` is not yet supported. | note: required by a bound in `is_maybe_transmutable` --> $DIR/should_require_well_defined_layout.rs:12:14 diff --git a/tests/ui/transmutability/enums/repr/should_require_well_defined_layout.stderr b/tests/ui/transmutability/enums/repr/should_require_well_defined_layout.stderr index 24730935047b..2a683de6a65c 100644 --- a/tests/ui/transmutability/enums/repr/should_require_well_defined_layout.stderr +++ b/tests/ui/transmutability/enums/repr/should_require_well_defined_layout.stderr @@ -2,7 +2,7 @@ error[E0277]: `void::repr_rust` cannot be safely transmuted into `()` --> $DIR/should_require_well_defined_layout.rs:27:52 | LL | assert::is_maybe_transmutable::(); - | ^^ `void::repr_rust` does not have a well-specified layout + | ^^ analyzing the transmutability of `void::repr_rust` is not yet supported. | note: required by a bound in `is_maybe_transmutable` --> $DIR/should_require_well_defined_layout.rs:13:14 @@ -24,7 +24,7 @@ error[E0277]: `u128` cannot be safely transmuted into `void::repr_rust` --> $DIR/should_require_well_defined_layout.rs:28:47 | LL | assert::is_maybe_transmutable::(); - | ^^^^^^^^^ `void::repr_rust` does not have a well-specified layout + | ^^^^^^^^^ analyzing the transmutability of `void::repr_rust` is not yet supported. | note: required by a bound in `is_maybe_transmutable` --> $DIR/should_require_well_defined_layout.rs:13:14 @@ -46,7 +46,7 @@ error[E0277]: `singleton::repr_rust` cannot be safely transmuted into `()` --> $DIR/should_require_well_defined_layout.rs:33:52 | LL | assert::is_maybe_transmutable::(); - | ^^ `singleton::repr_rust` does not have a well-specified layout + | ^^ analyzing the transmutability of `singleton::repr_rust` is not yet supported. | note: required by a bound in `is_maybe_transmutable` --> $DIR/should_require_well_defined_layout.rs:13:14 @@ -68,7 +68,7 @@ error[E0277]: `u128` cannot be safely transmuted into `singleton::repr_rust` --> $DIR/should_require_well_defined_layout.rs:34:47 | LL | assert::is_maybe_transmutable::(); - | ^^^^^^^^^ `singleton::repr_rust` does not have a well-specified layout + | ^^^^^^^^^ analyzing the transmutability of `singleton::repr_rust` is not yet supported. | note: required by a bound in `is_maybe_transmutable` --> $DIR/should_require_well_defined_layout.rs:13:14 @@ -90,7 +90,7 @@ error[E0277]: `duplex::repr_rust` cannot be safely transmuted into `()` --> $DIR/should_require_well_defined_layout.rs:39:52 | LL | assert::is_maybe_transmutable::(); - | ^^ `duplex::repr_rust` does not have a well-specified layout + | ^^ analyzing the transmutability of `duplex::repr_rust` is not yet supported. | note: required by a bound in `is_maybe_transmutable` --> $DIR/should_require_well_defined_layout.rs:13:14 @@ -112,7 +112,7 @@ error[E0277]: `u128` cannot be safely transmuted into `duplex::repr_rust` --> $DIR/should_require_well_defined_layout.rs:40:47 | LL | assert::is_maybe_transmutable::(); - | ^^^^^^^^^ `duplex::repr_rust` does not have a well-specified layout + | ^^^^^^^^^ analyzing the transmutability of `duplex::repr_rust` is not yet supported. | note: required by a bound in `is_maybe_transmutable` --> $DIR/should_require_well_defined_layout.rs:13:14 diff --git a/tests/ui/transmutability/structs/repr/should_require_well_defined_layout.stderr b/tests/ui/transmutability/structs/repr/should_require_well_defined_layout.stderr index 924422de5382..77788f72c216 100644 --- a/tests/ui/transmutability/structs/repr/should_require_well_defined_layout.stderr +++ b/tests/ui/transmutability/structs/repr/should_require_well_defined_layout.stderr @@ -2,7 +2,7 @@ error[E0277]: `should_reject_repr_rust::unit::repr_rust` cannot be safely transm --> $DIR/should_require_well_defined_layout.rs:27:52 | LL | assert::is_maybe_transmutable::(); - | ^^ `should_reject_repr_rust::unit::repr_rust` does not have a well-specified layout + | ^^ analyzing the transmutability of `should_reject_repr_rust::unit::repr_rust` is not yet supported. | note: required by a bound in `is_maybe_transmutable` --> $DIR/should_require_well_defined_layout.rs:12:14 @@ -24,7 +24,7 @@ error[E0277]: `u128` cannot be safely transmuted into `should_reject_repr_rust:: --> $DIR/should_require_well_defined_layout.rs:28:47 | LL | assert::is_maybe_transmutable::(); - | ^^^^^^^^^ `should_reject_repr_rust::unit::repr_rust` does not have a well-specified layout + | ^^^^^^^^^ analyzing the transmutability of `should_reject_repr_rust::unit::repr_rust` is not yet supported. | note: required by a bound in `is_maybe_transmutable` --> $DIR/should_require_well_defined_layout.rs:12:14 @@ -46,7 +46,7 @@ error[E0277]: `should_reject_repr_rust::tuple::repr_rust` cannot be safely trans --> $DIR/should_require_well_defined_layout.rs:33:52 | LL | assert::is_maybe_transmutable::(); - | ^^ `should_reject_repr_rust::tuple::repr_rust` does not have a well-specified layout + | ^^ analyzing the transmutability of `should_reject_repr_rust::tuple::repr_rust` is not yet supported. | note: required by a bound in `is_maybe_transmutable` --> $DIR/should_require_well_defined_layout.rs:12:14 @@ -68,7 +68,7 @@ error[E0277]: `u128` cannot be safely transmuted into `should_reject_repr_rust:: --> $DIR/should_require_well_defined_layout.rs:34:47 | LL | assert::is_maybe_transmutable::(); - | ^^^^^^^^^ `should_reject_repr_rust::tuple::repr_rust` does not have a well-specified layout + | ^^^^^^^^^ analyzing the transmutability of `should_reject_repr_rust::tuple::repr_rust` is not yet supported. | note: required by a bound in `is_maybe_transmutable` --> $DIR/should_require_well_defined_layout.rs:12:14 @@ -90,7 +90,7 @@ error[E0277]: `should_reject_repr_rust::braces::repr_rust` cannot be safely tran --> $DIR/should_require_well_defined_layout.rs:39:52 | LL | assert::is_maybe_transmutable::(); - | ^^ `should_reject_repr_rust::braces::repr_rust` does not have a well-specified layout + | ^^ analyzing the transmutability of `should_reject_repr_rust::braces::repr_rust` is not yet supported. | note: required by a bound in `is_maybe_transmutable` --> $DIR/should_require_well_defined_layout.rs:12:14 @@ -112,7 +112,7 @@ error[E0277]: `u128` cannot be safely transmuted into `should_reject_repr_rust:: --> $DIR/should_require_well_defined_layout.rs:40:47 | LL | assert::is_maybe_transmutable::(); - | ^^^^^^^^^ `should_reject_repr_rust::braces::repr_rust` does not have a well-specified layout + | ^^^^^^^^^ analyzing the transmutability of `should_reject_repr_rust::braces::repr_rust` is not yet supported. | note: required by a bound in `is_maybe_transmutable` --> $DIR/should_require_well_defined_layout.rs:12:14 @@ -134,7 +134,7 @@ error[E0277]: `aligned::repr_rust` cannot be safely transmuted into `()` --> $DIR/should_require_well_defined_layout.rs:45:52 | LL | assert::is_maybe_transmutable::(); - | ^^ `aligned::repr_rust` does not have a well-specified layout + | ^^ analyzing the transmutability of `aligned::repr_rust` is not yet supported. | note: required by a bound in `is_maybe_transmutable` --> $DIR/should_require_well_defined_layout.rs:12:14 @@ -156,7 +156,7 @@ error[E0277]: `u128` cannot be safely transmuted into `aligned::repr_rust` --> $DIR/should_require_well_defined_layout.rs:46:47 | LL | assert::is_maybe_transmutable::(); - | ^^^^^^^^^ `aligned::repr_rust` does not have a well-specified layout + | ^^^^^^^^^ analyzing the transmutability of `aligned::repr_rust` is not yet supported. | note: required by a bound in `is_maybe_transmutable` --> $DIR/should_require_well_defined_layout.rs:12:14 @@ -178,7 +178,7 @@ error[E0277]: `packed::repr_rust` cannot be safely transmuted into `()` --> $DIR/should_require_well_defined_layout.rs:51:52 | LL | assert::is_maybe_transmutable::(); - | ^^ `packed::repr_rust` does not have a well-specified layout + | ^^ analyzing the transmutability of `packed::repr_rust` is not yet supported. | note: required by a bound in `is_maybe_transmutable` --> $DIR/should_require_well_defined_layout.rs:12:14 @@ -200,7 +200,7 @@ error[E0277]: `u128` cannot be safely transmuted into `packed::repr_rust` --> $DIR/should_require_well_defined_layout.rs:52:47 | LL | assert::is_maybe_transmutable::(); - | ^^^^^^^^^ `packed::repr_rust` does not have a well-specified layout + | ^^^^^^^^^ analyzing the transmutability of `packed::repr_rust` is not yet supported. | note: required by a bound in `is_maybe_transmutable` --> $DIR/should_require_well_defined_layout.rs:12:14 @@ -222,7 +222,7 @@ error[E0277]: `nested::repr_c` cannot be safely transmuted into `()` --> $DIR/should_require_well_defined_layout.rs:58:49 | LL | assert::is_maybe_transmutable::(); - | ^^ `nested::repr_c` does not have a well-specified layout + | ^^ analyzing the transmutability of `nested::repr_c` is not yet supported. | note: required by a bound in `is_maybe_transmutable` --> $DIR/should_require_well_defined_layout.rs:12:14 @@ -244,7 +244,7 @@ error[E0277]: `u128` cannot be safely transmuted into `nested::repr_c` --> $DIR/should_require_well_defined_layout.rs:59:47 | LL | assert::is_maybe_transmutable::(); - | ^^^^^^ `nested::repr_c` does not have a well-specified layout + | ^^^^^^ analyzing the transmutability of `nested::repr_c` is not yet supported. | note: required by a bound in `is_maybe_transmutable` --> $DIR/should_require_well_defined_layout.rs:12:14 diff --git a/tests/ui/transmutability/unions/repr/should_require_well_defined_layout.stderr b/tests/ui/transmutability/unions/repr/should_require_well_defined_layout.stderr index ee0e8a664341..bec07f131039 100644 --- a/tests/ui/transmutability/unions/repr/should_require_well_defined_layout.stderr +++ b/tests/ui/transmutability/unions/repr/should_require_well_defined_layout.stderr @@ -2,7 +2,7 @@ error[E0277]: `should_reject_repr_rust::repr_rust` cannot be safely transmuted i --> $DIR/should_require_well_defined_layout.rs:29:48 | LL | assert::is_maybe_transmutable::(); - | ^^ `should_reject_repr_rust::repr_rust` does not have a well-specified layout + | ^^ analyzing the transmutability of `should_reject_repr_rust::repr_rust` is not yet supported. | note: required by a bound in `is_maybe_transmutable` --> $DIR/should_require_well_defined_layout.rs:12:14 @@ -24,7 +24,7 @@ error[E0277]: `u128` cannot be safely transmuted into `should_reject_repr_rust:: --> $DIR/should_require_well_defined_layout.rs:30:43 | LL | assert::is_maybe_transmutable::(); - | ^^^^^^^^^ `should_reject_repr_rust::repr_rust` does not have a well-specified layout + | ^^^^^^^^^ analyzing the transmutability of `should_reject_repr_rust::repr_rust` is not yet supported. | note: required by a bound in `is_maybe_transmutable` --> $DIR/should_require_well_defined_layout.rs:12:14 From 19bc3370632c4f26be1cb16b90f72375c55879a3 Mon Sep 17 00:00:00 2001 From: Maybe Waffle Date: Fri, 15 Mar 2024 12:27:54 +0000 Subject: [PATCH 079/103] Add `rustc_never_type_mode` crate-level attribute to allow experimenting --- compiler/rustc_feature/src/builtin_attrs.rs | 7 ++ compiler/rustc_hir_typeck/src/fallback.rs | 119 ++++++++++++++------ compiler/rustc_span/src/symbol.rs | 4 + 3 files changed, 96 insertions(+), 34 deletions(-) diff --git a/compiler/rustc_feature/src/builtin_attrs.rs b/compiler/rustc_feature/src/builtin_attrs.rs index 1f77484d65ce..a5f8b0b270fc 100644 --- a/compiler/rustc_feature/src/builtin_attrs.rs +++ b/compiler/rustc_feature/src/builtin_attrs.rs @@ -580,6 +580,13 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[ "`may_dangle` has unstable semantics and may be removed in the future", ), + rustc_attr!( + rustc_never_type_mode, Normal, template!(NameValueStr: "fallback_to_unit|fallback_to_niko|no_fallback"), ErrorFollowing, + @only_local: true, + "`rustc_never_type_fallback` is used to experiment with never type fallback and work on \ + never type stabilization, and will never be stable" + ), + // ========================================================================== // Internal attributes: Runtime related: // ========================================================================== diff --git a/compiler/rustc_hir_typeck/src/fallback.rs b/compiler/rustc_hir_typeck/src/fallback.rs index aa8bbad1d124..5206e79177bb 100644 --- a/compiler/rustc_hir_typeck/src/fallback.rs +++ b/compiler/rustc_hir_typeck/src/fallback.rs @@ -4,8 +4,19 @@ use rustc_data_structures::{ graph::{iterate::DepthFirstSearch, vec_graph::VecGraph}, unord::{UnordBag, UnordMap, UnordSet}, }; +use rustc_hir::def_id::CRATE_DEF_ID; use rustc_infer::infer::{DefineOpaqueTypes, InferOk}; use rustc_middle::ty::{self, Ty}; +use rustc_span::sym; + +enum DivergingFallbackBehavior { + /// Always fallback to `()` (aka "always spontaneous decay") + FallbackToUnit, + /// Sometimes fallback to `!`, but mainly fallback to `()` so that most of the crates are not broken. + FallbackToNiko, + /// Don't fallback at all + NoFallback, +} impl<'tcx> FnCtxt<'_, 'tcx> { /// Performs type inference fallback, setting `FnCtxt::fallback_has_occurred` @@ -64,7 +75,9 @@ impl<'tcx> FnCtxt<'_, 'tcx> { return false; } - let diverging_fallback = self.calculate_diverging_fallback(&unresolved_variables); + let diverging_behavior = self.diverging_fallback_behavior(); + let diverging_fallback = + self.calculate_diverging_fallback(&unresolved_variables, diverging_behavior); // We do fallback in two passes, to try to generate // better error messages. @@ -78,6 +91,31 @@ impl<'tcx> FnCtxt<'_, 'tcx> { fallback_occurred } + fn diverging_fallback_behavior(&self) -> DivergingFallbackBehavior { + let Some((mode, span)) = self + .tcx + .get_attr(CRATE_DEF_ID, sym::rustc_never_type_mode) + .map(|attr| (attr.value_str().unwrap(), attr.span)) + else { + if self.tcx.features().never_type_fallback { + return DivergingFallbackBehavior::FallbackToNiko; + } + + return DivergingFallbackBehavior::FallbackToUnit; + }; + + match mode { + sym::fallback_to_unit => DivergingFallbackBehavior::FallbackToUnit, + sym::fallback_to_niko => DivergingFallbackBehavior::FallbackToNiko, + sym::no_fallback => DivergingFallbackBehavior::NoFallback, + _ => { + self.tcx.dcx().span_err(span, format!("unknown never type mode: `{mode}` (supported: `fallback_to_unit`, `fallback_to_niko`, and `no_fallback`)")); + + DivergingFallbackBehavior::FallbackToUnit + } + } + } + fn fallback_effects(&self) -> bool { let unsolved_effects = self.unsolved_effects(); @@ -232,6 +270,7 @@ impl<'tcx> FnCtxt<'_, 'tcx> { fn calculate_diverging_fallback( &self, unresolved_variables: &[Ty<'tcx>], + behavior: DivergingFallbackBehavior, ) -> UnordMap, Ty<'tcx>> { debug!("calculate_diverging_fallback({:?})", unresolved_variables); @@ -345,39 +384,51 @@ impl<'tcx> FnCtxt<'_, 'tcx> { output: infer_var_infos.items().any(|info| info.output), }; - if found_infer_var_info.self_in_trait && found_infer_var_info.output { - // This case falls back to () to ensure that the code pattern in - // tests/ui/never_type/fallback-closure-ret.rs continues to - // compile when never_type_fallback is enabled. - // - // This rule is not readily explainable from first principles, - // but is rather intended as a patchwork fix to ensure code - // which compiles before the stabilization of never type - // fallback continues to work. - // - // Typically this pattern is encountered in a function taking a - // closure as a parameter, where the return type of that closure - // (checked by `relationship.output`) is expected to implement - // some trait (checked by `relationship.self_in_trait`). This - // can come up in non-closure cases too, so we do not limit this - // rule to specifically `FnOnce`. - // - // When the closure's body is something like `panic!()`, the - // return type would normally be inferred to `!`. However, it - // needs to fall back to `()` in order to still compile, as the - // trait is specifically implemented for `()` but not `!`. - // - // For details on the requirements for these relationships to be - // set, see the relationship finding module in - // compiler/rustc_trait_selection/src/traits/relationships.rs. - debug!("fallback to () - found trait and projection: {:?}", diverging_vid); - diverging_fallback.insert(diverging_ty, self.tcx.types.unit); - } else if can_reach_non_diverging { - debug!("fallback to () - reached non-diverging: {:?}", diverging_vid); - diverging_fallback.insert(diverging_ty, self.tcx.types.unit); - } else { - debug!("fallback to ! - all diverging: {:?}", diverging_vid); - diverging_fallback.insert(diverging_ty, Ty::new_diverging_default(self.tcx)); + use DivergingFallbackBehavior::*; + match behavior { + FallbackToUnit => { + debug!("fallback to () - legacy: {:?}", diverging_vid); + diverging_fallback.insert(diverging_ty, self.tcx.types.unit); + } + FallbackToNiko => { + if found_infer_var_info.self_in_trait && found_infer_var_info.output { + // This case falls back to () to ensure that the code pattern in + // tests/ui/never_type/fallback-closure-ret.rs continues to + // compile when never_type_fallback is enabled. + // + // This rule is not readily explainable from first principles, + // but is rather intended as a patchwork fix to ensure code + // which compiles before the stabilization of never type + // fallback continues to work. + // + // Typically this pattern is encountered in a function taking a + // closure as a parameter, where the return type of that closure + // (checked by `relationship.output`) is expected to implement + // some trait (checked by `relationship.self_in_trait`). This + // can come up in non-closure cases too, so we do not limit this + // rule to specifically `FnOnce`. + // + // When the closure's body is something like `panic!()`, the + // return type would normally be inferred to `!`. However, it + // needs to fall back to `()` in order to still compile, as the + // trait is specifically implemented for `()` but not `!`. + // + // For details on the requirements for these relationships to be + // set, see the relationship finding module in + // compiler/rustc_trait_selection/src/traits/relationships.rs. + debug!("fallback to () - found trait and projection: {:?}", diverging_vid); + diverging_fallback.insert(diverging_ty, self.tcx.types.unit); + } else if can_reach_non_diverging { + debug!("fallback to () - reached non-diverging: {:?}", diverging_vid); + diverging_fallback.insert(diverging_ty, self.tcx.types.unit); + } else { + debug!("fallback to ! - all diverging: {:?}", diverging_vid); + diverging_fallback.insert(diverging_ty, self.tcx.types.never); + } + } + NoFallback => { + debug!("no fallback - `rustc_never_type_mode = "no_fallback"`: {:?}", diverging_vid); + } } } diff --git a/compiler/rustc_span/src/symbol.rs b/compiler/rustc_span/src/symbol.rs index 7de0555bb220..0df5e7873c26 100644 --- a/compiler/rustc_span/src/symbol.rs +++ b/compiler/rustc_span/src/symbol.rs @@ -815,6 +815,8 @@ symbols! { fadd_algebraic, fadd_fast, fake_variadic, + fallback_to_niko, + fallback_to_unit, fdiv_algebraic, fdiv_fast, feature, @@ -1233,6 +1235,7 @@ symbols! { no_crate_inject, no_debug, no_default_passes, + no_fallback, no_implicit_prelude, no_inline, no_link, @@ -1551,6 +1554,7 @@ symbols! { rustc_mir, rustc_must_implement_one_of, rustc_never_returns_null_ptr, + rustc_never_type_mode, rustc_no_mir_inline, rustc_nonnull_optimization_guaranteed, rustc_nounwind, From adfdd273ae2bf79aa3bb1f7b453e4df9c188a781 Mon Sep 17 00:00:00 2001 From: Maybe Waffle Date: Fri, 15 Mar 2024 14:50:45 +0000 Subject: [PATCH 080/103] Add `rustc_never_type_mode = "no_fallback"` --- compiler/rustc_feature/src/builtin_attrs.rs | 2 +- compiler/rustc_hir_typeck/src/fallback.rs | 18 ++++++++++++++++-- compiler/rustc_span/src/symbol.rs | 1 + 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/compiler/rustc_feature/src/builtin_attrs.rs b/compiler/rustc_feature/src/builtin_attrs.rs index a5f8b0b270fc..e5a29f3a8462 100644 --- a/compiler/rustc_feature/src/builtin_attrs.rs +++ b/compiler/rustc_feature/src/builtin_attrs.rs @@ -581,7 +581,7 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[ ), rustc_attr!( - rustc_never_type_mode, Normal, template!(NameValueStr: "fallback_to_unit|fallback_to_niko|no_fallback"), ErrorFollowing, + rustc_never_type_mode, Normal, template!(NameValueStr: "fallback_to_unit|fallback_to_niko|fallback_to_never|no_fallback"), ErrorFollowing, @only_local: true, "`rustc_never_type_fallback` is used to experiment with never type fallback and work on \ never type stabilization, and will never be stable" diff --git a/compiler/rustc_hir_typeck/src/fallback.rs b/compiler/rustc_hir_typeck/src/fallback.rs index 5206e79177bb..c16e941d4c5b 100644 --- a/compiler/rustc_hir_typeck/src/fallback.rs +++ b/compiler/rustc_hir_typeck/src/fallback.rs @@ -14,6 +14,9 @@ enum DivergingFallbackBehavior { FallbackToUnit, /// Sometimes fallback to `!`, but mainly fallback to `()` so that most of the crates are not broken. FallbackToNiko, + /// Always fallback to `!` (which should be equivalent to never falling back + not making + /// never-to-any coercions unless necessary) + FallbackToNever, /// Don't fallback at all NoFallback, } @@ -107,9 +110,10 @@ impl<'tcx> FnCtxt<'_, 'tcx> { match mode { sym::fallback_to_unit => DivergingFallbackBehavior::FallbackToUnit, sym::fallback_to_niko => DivergingFallbackBehavior::FallbackToNiko, + sym::fallback_to_never => DivergingFallbackBehavior::FallbackToNever, sym::no_fallback => DivergingFallbackBehavior::NoFallback, _ => { - self.tcx.dcx().span_err(span, format!("unknown never type mode: `{mode}` (supported: `fallback_to_unit`, `fallback_to_niko`, and `no_fallback`)")); + self.tcx.dcx().span_err(span, format!("unknown never type mode: `{mode}` (supported: `fallback_to_unit`, `fallback_to_niko`, `fallback_to_never` and `no_fallback`)")); DivergingFallbackBehavior::FallbackToUnit } @@ -426,8 +430,18 @@ impl<'tcx> FnCtxt<'_, 'tcx> { diverging_fallback.insert(diverging_ty, self.tcx.types.never); } } + FallbackToNever => { + debug!( + "fallback to ! - `rustc_never_type_mode = \"fallback_to_never\")`: {:?}", + diverging_vid + ); + diverging_fallback.insert(diverging_ty, self.tcx.types.never); + } NoFallback => { - debug!("no fallback - `rustc_never_type_mode = "no_fallback"`: {:?}", diverging_vid); + debug!( + "no fallback - `rustc_never_type_mode = \"no_fallback\"`: {:?}", + diverging_vid + ); } } } diff --git a/compiler/rustc_span/src/symbol.rs b/compiler/rustc_span/src/symbol.rs index 0df5e7873c26..e43c9533382e 100644 --- a/compiler/rustc_span/src/symbol.rs +++ b/compiler/rustc_span/src/symbol.rs @@ -815,6 +815,7 @@ symbols! { fadd_algebraic, fadd_fast, fake_variadic, + fallback_to_never, fallback_to_niko, fallback_to_unit, fdiv_algebraic, From e1e719e1a1916dee9365c390dcb640390433d078 Mon Sep 17 00:00:00 2001 From: Wilfred Hughes Date: Fri, 15 Mar 2024 10:51:41 -0700 Subject: [PATCH 081/103] Mention labelled blocks in `break` docs `break` doesn't require a loop, so note this in the docs. This is covered in the linked sections of the rust reference, but this page implied that `break` is only for loops. --- library/std/src/keyword_docs.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/std/src/keyword_docs.rs b/library/std/src/keyword_docs.rs index 873bfb6218b6..8415f36eba25 100644 --- a/library/std/src/keyword_docs.rs +++ b/library/std/src/keyword_docs.rs @@ -48,7 +48,7 @@ mod as_keyword {} #[doc(keyword = "break")] // -/// Exit early from a loop. +/// Exit early from a loop or labelled block. /// /// When `break` is encountered, execution of the associated loop body is /// immediately terminated. From 107807d3932c2765580725604802f76935239723 Mon Sep 17 00:00:00 2001 From: Jack Wrenn Date: Fri, 15 Mar 2024 17:55:49 +0000 Subject: [PATCH 082/103] Safe Transmute: lowercase diagnostics --- .../error_reporting/type_err_ctxt_ext.rs | 8 +- .../alignment/align-fail.stderr | 2 +- ...ve_reprs_should_have_correct_length.stderr | 40 +++--- .../enums/should_pad_variants.stderr | 2 +- .../enums/should_respect_endianness.stderr | 2 +- .../primitives/bool-mut.stderr | 2 +- .../primitives/bool.current.stderr | 2 +- .../primitives/bool.next.stderr | 2 +- .../primitives/numbers.current.stderr | 114 +++++++++--------- .../primitives/numbers.next.stderr | 114 +++++++++--------- .../primitives/unit.current.stderr | 2 +- .../primitives/unit.next.stderr | 2 +- ...sive-wrapper-types-bit-incompatible.stderr | 2 +- .../references/reject_extension.stderr | 2 +- .../references/unit-to-u8.stderr | 2 +- tests/ui/transmutability/region-infer.stderr | 2 +- .../transmute-padding-ice.stderr | 2 +- .../unions/should_pad_variants.stderr | 2 +- .../unions/should_reject_contraction.stderr | 2 +- .../unions/should_reject_disjoint.stderr | 4 +- .../unions/should_reject_intersecting.stderr | 4 +- 21 files changed, 157 insertions(+), 157 deletions(-) diff --git a/compiler/rustc_trait_selection/src/traits/error_reporting/type_err_ctxt_ext.rs b/compiler/rustc_trait_selection/src/traits/error_reporting/type_err_ctxt_ext.rs index e060803c1cb7..8011d725420b 100644 --- a/compiler/rustc_trait_selection/src/traits/error_reporting/type_err_ctxt_ext.rs +++ b/compiler/rustc_trait_selection/src/traits/error_reporting/type_err_ctxt_ext.rs @@ -3082,20 +3082,20 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> { } rustc_transmute::Reason::DstIsBitIncompatible => { - format!("At least one value of `{src}` isn't a bit-valid value of `{dst}`") + format!("at least one value of `{src}` isn't a bit-valid value of `{dst}`") } rustc_transmute::Reason::DstMayHaveSafetyInvariants => { format!("`{dst}` may carry safety invariants") } rustc_transmute::Reason::DstIsTooBig => { - format!("The size of `{src}` is smaller than the size of `{dst}`") + format!("the size of `{src}` is smaller than the size of `{dst}`") } rustc_transmute::Reason::DstRefIsTooBig { src, dst } => { let src_size = src.size; let dst_size = dst.size; format!( - "The referent size of `{src}` ({src_size} bytes) is smaller than that of `{dst}` ({dst_size} bytes)" + "the referent size of `{src}` ({src_size} bytes) is smaller than that of `{dst}` ({dst_size} bytes)" ) } rustc_transmute::Reason::SrcSizeOverflow => { @@ -3113,7 +3113,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> { dst_min_align, } => { format!( - "The minimum alignment of `{src}` ({src_min_align}) should be greater than that of `{dst}` ({dst_min_align})" + "the minimum alignment of `{src}` ({src_min_align}) should be greater than that of `{dst}` ({dst_min_align})" ) } rustc_transmute::Reason::DstIsMoreUnique => { diff --git a/tests/ui/transmutability/alignment/align-fail.stderr b/tests/ui/transmutability/alignment/align-fail.stderr index c92c3d841f29..f05e55fb024d 100644 --- a/tests/ui/transmutability/alignment/align-fail.stderr +++ b/tests/ui/transmutability/alignment/align-fail.stderr @@ -2,7 +2,7 @@ error[E0277]: `&[u8; 0]` cannot be safely transmuted into `&[u16; 0]` --> $DIR/align-fail.rs:21:55 | LL | ...tatic [u8; 0], &'static [u16; 0]>(); - | ^^^^^^^^^^^^^^^^^ The minimum alignment of `&[u8; 0]` (1) should be greater than that of `&[u16; 0]` (2) + | ^^^^^^^^^^^^^^^^^ the minimum alignment of `&[u8; 0]` (1) should be greater than that of `&[u16; 0]` (2) | note: required by a bound in `is_maybe_transmutable` --> $DIR/align-fail.rs:9:14 diff --git a/tests/ui/transmutability/enums/repr/primitive_reprs_should_have_correct_length.stderr b/tests/ui/transmutability/enums/repr/primitive_reprs_should_have_correct_length.stderr index b2ff04eeed9e..6c88bf4ff968 100644 --- a/tests/ui/transmutability/enums/repr/primitive_reprs_should_have_correct_length.stderr +++ b/tests/ui/transmutability/enums/repr/primitive_reprs_should_have_correct_length.stderr @@ -2,7 +2,7 @@ error[E0277]: `Zst` cannot be safely transmuted into `V0i8` --> $DIR/primitive_reprs_should_have_correct_length.rs:46:44 | LL | assert::is_transmutable::(); - | ^^^^^^^ The size of `Zst` is smaller than the size of `V0i8` + | ^^^^^^^ the size of `Zst` is smaller than the size of `V0i8` | note: required by a bound in `is_transmutable` --> $DIR/primitive_reprs_should_have_correct_length.rs:12:14 @@ -24,7 +24,7 @@ error[E0277]: `V0i8` cannot be safely transmuted into `u16` --> $DIR/primitive_reprs_should_have_correct_length.rs:48:44 | LL | assert::is_transmutable::(); - | ^^^^^^ The size of `V0i8` is smaller than the size of `u16` + | ^^^^^^ the size of `V0i8` is smaller than the size of `u16` | note: required by a bound in `is_transmutable` --> $DIR/primitive_reprs_should_have_correct_length.rs:12:14 @@ -46,7 +46,7 @@ error[E0277]: `Zst` cannot be safely transmuted into `V0u8` --> $DIR/primitive_reprs_should_have_correct_length.rs:54:44 | LL | assert::is_transmutable::(); - | ^^^^^^^ The size of `Zst` is smaller than the size of `V0u8` + | ^^^^^^^ the size of `Zst` is smaller than the size of `V0u8` | note: required by a bound in `is_transmutable` --> $DIR/primitive_reprs_should_have_correct_length.rs:12:14 @@ -68,7 +68,7 @@ error[E0277]: `V0u8` cannot be safely transmuted into `u16` --> $DIR/primitive_reprs_should_have_correct_length.rs:56:44 | LL | assert::is_transmutable::(); - | ^^^^^^ The size of `V0u8` is smaller than the size of `u16` + | ^^^^^^ the size of `V0u8` is smaller than the size of `u16` | note: required by a bound in `is_transmutable` --> $DIR/primitive_reprs_should_have_correct_length.rs:12:14 @@ -90,7 +90,7 @@ error[E0277]: `u8` cannot be safely transmuted into `V0i16` --> $DIR/primitive_reprs_should_have_correct_length.rs:68:44 | LL | assert::is_transmutable::(); - | ^^^^^^^ The size of `u8` is smaller than the size of `V0i16` + | ^^^^^^^ the size of `u8` is smaller than the size of `V0i16` | note: required by a bound in `is_transmutable` --> $DIR/primitive_reprs_should_have_correct_length.rs:12:14 @@ -112,7 +112,7 @@ error[E0277]: `V0i16` cannot be safely transmuted into `u32` --> $DIR/primitive_reprs_should_have_correct_length.rs:70:44 | LL | assert::is_transmutable::(); - | ^^^^^^ The size of `V0i16` is smaller than the size of `u32` + | ^^^^^^ the size of `V0i16` is smaller than the size of `u32` | note: required by a bound in `is_transmutable` --> $DIR/primitive_reprs_should_have_correct_length.rs:12:14 @@ -134,7 +134,7 @@ error[E0277]: `u8` cannot be safely transmuted into `V0u16` --> $DIR/primitive_reprs_should_have_correct_length.rs:76:44 | LL | assert::is_transmutable::(); - | ^^^^^^^ The size of `u8` is smaller than the size of `V0u16` + | ^^^^^^^ the size of `u8` is smaller than the size of `V0u16` | note: required by a bound in `is_transmutable` --> $DIR/primitive_reprs_should_have_correct_length.rs:12:14 @@ -156,7 +156,7 @@ error[E0277]: `V0u16` cannot be safely transmuted into `u32` --> $DIR/primitive_reprs_should_have_correct_length.rs:78:44 | LL | assert::is_transmutable::(); - | ^^^^^^ The size of `V0u16` is smaller than the size of `u32` + | ^^^^^^ the size of `V0u16` is smaller than the size of `u32` | note: required by a bound in `is_transmutable` --> $DIR/primitive_reprs_should_have_correct_length.rs:12:14 @@ -178,7 +178,7 @@ error[E0277]: `u16` cannot be safely transmuted into `V0i32` --> $DIR/primitive_reprs_should_have_correct_length.rs:90:44 | LL | assert::is_transmutable::(); - | ^^^^^^^ The size of `u16` is smaller than the size of `V0i32` + | ^^^^^^^ the size of `u16` is smaller than the size of `V0i32` | note: required by a bound in `is_transmutable` --> $DIR/primitive_reprs_should_have_correct_length.rs:12:14 @@ -200,7 +200,7 @@ error[E0277]: `V0i32` cannot be safely transmuted into `u64` --> $DIR/primitive_reprs_should_have_correct_length.rs:92:44 | LL | assert::is_transmutable::(); - | ^^^^^^ The size of `V0i32` is smaller than the size of `u64` + | ^^^^^^ the size of `V0i32` is smaller than the size of `u64` | note: required by a bound in `is_transmutable` --> $DIR/primitive_reprs_should_have_correct_length.rs:12:14 @@ -222,7 +222,7 @@ error[E0277]: `u16` cannot be safely transmuted into `V0u32` --> $DIR/primitive_reprs_should_have_correct_length.rs:98:44 | LL | assert::is_transmutable::(); - | ^^^^^^^ The size of `u16` is smaller than the size of `V0u32` + | ^^^^^^^ the size of `u16` is smaller than the size of `V0u32` | note: required by a bound in `is_transmutable` --> $DIR/primitive_reprs_should_have_correct_length.rs:12:14 @@ -244,7 +244,7 @@ error[E0277]: `V0u32` cannot be safely transmuted into `u64` --> $DIR/primitive_reprs_should_have_correct_length.rs:100:44 | LL | assert::is_transmutable::(); - | ^^^^^^ The size of `V0u32` is smaller than the size of `u64` + | ^^^^^^ the size of `V0u32` is smaller than the size of `u64` | note: required by a bound in `is_transmutable` --> $DIR/primitive_reprs_should_have_correct_length.rs:12:14 @@ -266,7 +266,7 @@ error[E0277]: `u32` cannot be safely transmuted into `V0i64` --> $DIR/primitive_reprs_should_have_correct_length.rs:112:44 | LL | assert::is_transmutable::(); - | ^^^^^^^ The size of `u32` is smaller than the size of `V0i64` + | ^^^^^^^ the size of `u32` is smaller than the size of `V0i64` | note: required by a bound in `is_transmutable` --> $DIR/primitive_reprs_should_have_correct_length.rs:12:14 @@ -288,7 +288,7 @@ error[E0277]: `V0i64` cannot be safely transmuted into `u128` --> $DIR/primitive_reprs_should_have_correct_length.rs:114:44 | LL | assert::is_transmutable::(); - | ^^^^^^ The size of `V0i64` is smaller than the size of `u128` + | ^^^^^^ the size of `V0i64` is smaller than the size of `u128` | note: required by a bound in `is_transmutable` --> $DIR/primitive_reprs_should_have_correct_length.rs:12:14 @@ -310,7 +310,7 @@ error[E0277]: `u32` cannot be safely transmuted into `V0u64` --> $DIR/primitive_reprs_should_have_correct_length.rs:120:44 | LL | assert::is_transmutable::(); - | ^^^^^^^ The size of `u32` is smaller than the size of `V0u64` + | ^^^^^^^ the size of `u32` is smaller than the size of `V0u64` | note: required by a bound in `is_transmutable` --> $DIR/primitive_reprs_should_have_correct_length.rs:12:14 @@ -332,7 +332,7 @@ error[E0277]: `V0u64` cannot be safely transmuted into `u128` --> $DIR/primitive_reprs_should_have_correct_length.rs:122:44 | LL | assert::is_transmutable::(); - | ^^^^^^ The size of `V0u64` is smaller than the size of `u128` + | ^^^^^^ the size of `V0u64` is smaller than the size of `u128` | note: required by a bound in `is_transmutable` --> $DIR/primitive_reprs_should_have_correct_length.rs:12:14 @@ -354,7 +354,7 @@ error[E0277]: `u8` cannot be safely transmuted into `V0isize` --> $DIR/primitive_reprs_should_have_correct_length.rs:134:44 | LL | assert::is_transmutable::(); - | ^^^^^^^ The size of `u8` is smaller than the size of `V0isize` + | ^^^^^^^ the size of `u8` is smaller than the size of `V0isize` | note: required by a bound in `is_transmutable` --> $DIR/primitive_reprs_should_have_correct_length.rs:12:14 @@ -376,7 +376,7 @@ error[E0277]: `V0isize` cannot be safely transmuted into `[usize; 2]` --> $DIR/primitive_reprs_should_have_correct_length.rs:136:44 | LL | assert::is_transmutable::(); - | ^^^^^^ The size of `V0isize` is smaller than the size of `[usize; 2]` + | ^^^^^^ the size of `V0isize` is smaller than the size of `[usize; 2]` | note: required by a bound in `is_transmutable` --> $DIR/primitive_reprs_should_have_correct_length.rs:12:14 @@ -398,7 +398,7 @@ error[E0277]: `u8` cannot be safely transmuted into `V0usize` --> $DIR/primitive_reprs_should_have_correct_length.rs:142:44 | LL | assert::is_transmutable::(); - | ^^^^^^^ The size of `u8` is smaller than the size of `V0usize` + | ^^^^^^^ the size of `u8` is smaller than the size of `V0usize` | note: required by a bound in `is_transmutable` --> $DIR/primitive_reprs_should_have_correct_length.rs:12:14 @@ -420,7 +420,7 @@ error[E0277]: `V0usize` cannot be safely transmuted into `[usize; 2]` --> $DIR/primitive_reprs_should_have_correct_length.rs:144:44 | LL | assert::is_transmutable::(); - | ^^^^^^ The size of `V0usize` is smaller than the size of `[usize; 2]` + | ^^^^^^ the size of `V0usize` is smaller than the size of `[usize; 2]` | note: required by a bound in `is_transmutable` --> $DIR/primitive_reprs_should_have_correct_length.rs:12:14 diff --git a/tests/ui/transmutability/enums/should_pad_variants.stderr b/tests/ui/transmutability/enums/should_pad_variants.stderr index 13b4c8053adb..da4294bdbce8 100644 --- a/tests/ui/transmutability/enums/should_pad_variants.stderr +++ b/tests/ui/transmutability/enums/should_pad_variants.stderr @@ -2,7 +2,7 @@ error[E0277]: `Src` cannot be safely transmuted into `Dst` --> $DIR/should_pad_variants.rs:43:36 | LL | assert::is_transmutable::(); - | ^^^ The size of `Src` is smaller than the size of `Dst` + | ^^^ the size of `Src` is smaller than the size of `Dst` | note: required by a bound in `is_transmutable` --> $DIR/should_pad_variants.rs:13:14 diff --git a/tests/ui/transmutability/enums/should_respect_endianness.stderr b/tests/ui/transmutability/enums/should_respect_endianness.stderr index c2a2eb53458e..9f88bb068134 100644 --- a/tests/ui/transmutability/enums/should_respect_endianness.stderr +++ b/tests/ui/transmutability/enums/should_respect_endianness.stderr @@ -2,7 +2,7 @@ error[E0277]: `Src` cannot be safely transmuted into `Unexpected` --> $DIR/should_respect_endianness.rs:35:36 | LL | assert::is_transmutable::(); - | ^^^^^^^^^^ At least one value of `Src` isn't a bit-valid value of `Unexpected` + | ^^^^^^^^^^ at least one value of `Src` isn't a bit-valid value of `Unexpected` | note: required by a bound in `is_transmutable` --> $DIR/should_respect_endianness.rs:13:14 diff --git a/tests/ui/transmutability/primitives/bool-mut.stderr b/tests/ui/transmutability/primitives/bool-mut.stderr index c4f295fc70a2..464c2755e11b 100644 --- a/tests/ui/transmutability/primitives/bool-mut.stderr +++ b/tests/ui/transmutability/primitives/bool-mut.stderr @@ -2,7 +2,7 @@ error[E0277]: `u8` cannot be safely transmuted into `bool` --> $DIR/bool-mut.rs:15:50 | LL | assert::is_transmutable::<&'static mut bool, &'static mut u8>() - | ^^^^^^^^^^^^^^^ At least one value of `u8` isn't a bit-valid value of `bool` + | ^^^^^^^^^^^^^^^ at least one value of `u8` isn't a bit-valid value of `bool` | note: required by a bound in `is_transmutable` --> $DIR/bool-mut.rs:10:14 diff --git a/tests/ui/transmutability/primitives/bool.current.stderr b/tests/ui/transmutability/primitives/bool.current.stderr index 98e4a1029c90..da6a4a44e95e 100644 --- a/tests/ui/transmutability/primitives/bool.current.stderr +++ b/tests/ui/transmutability/primitives/bool.current.stderr @@ -2,7 +2,7 @@ error[E0277]: `u8` cannot be safely transmuted into `bool` --> $DIR/bool.rs:21:35 | LL | assert::is_transmutable::(); - | ^^^^ At least one value of `u8` isn't a bit-valid value of `bool` + | ^^^^ at least one value of `u8` isn't a bit-valid value of `bool` | note: required by a bound in `is_transmutable` --> $DIR/bool.rs:11:14 diff --git a/tests/ui/transmutability/primitives/bool.next.stderr b/tests/ui/transmutability/primitives/bool.next.stderr index 98e4a1029c90..da6a4a44e95e 100644 --- a/tests/ui/transmutability/primitives/bool.next.stderr +++ b/tests/ui/transmutability/primitives/bool.next.stderr @@ -2,7 +2,7 @@ error[E0277]: `u8` cannot be safely transmuted into `bool` --> $DIR/bool.rs:21:35 | LL | assert::is_transmutable::(); - | ^^^^ At least one value of `u8` isn't a bit-valid value of `bool` + | ^^^^ at least one value of `u8` isn't a bit-valid value of `bool` | note: required by a bound in `is_transmutable` --> $DIR/bool.rs:11:14 diff --git a/tests/ui/transmutability/primitives/numbers.current.stderr b/tests/ui/transmutability/primitives/numbers.current.stderr index 7a80e444149d..0a9b9d182f85 100644 --- a/tests/ui/transmutability/primitives/numbers.current.stderr +++ b/tests/ui/transmutability/primitives/numbers.current.stderr @@ -2,7 +2,7 @@ error[E0277]: `i8` cannot be safely transmuted into `i16` --> $DIR/numbers.rs:64:40 | LL | assert::is_transmutable::< i8, i16>(); - | ^^^ The size of `i8` is smaller than the size of `i16` + | ^^^ the size of `i8` is smaller than the size of `i16` | note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:14:14 @@ -17,7 +17,7 @@ error[E0277]: `i8` cannot be safely transmuted into `u16` --> $DIR/numbers.rs:65:40 | LL | assert::is_transmutable::< i8, u16>(); - | ^^^ The size of `i8` is smaller than the size of `u16` + | ^^^ the size of `i8` is smaller than the size of `u16` | note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:14:14 @@ -32,7 +32,7 @@ error[E0277]: `i8` cannot be safely transmuted into `i32` --> $DIR/numbers.rs:66:40 | LL | assert::is_transmutable::< i8, i32>(); - | ^^^ The size of `i8` is smaller than the size of `i32` + | ^^^ the size of `i8` is smaller than the size of `i32` | note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:14:14 @@ -47,7 +47,7 @@ error[E0277]: `i8` cannot be safely transmuted into `f32` --> $DIR/numbers.rs:67:40 | LL | assert::is_transmutable::< i8, f32>(); - | ^^^ The size of `i8` is smaller than the size of `f32` + | ^^^ the size of `i8` is smaller than the size of `f32` | note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:14:14 @@ -62,7 +62,7 @@ error[E0277]: `i8` cannot be safely transmuted into `u32` --> $DIR/numbers.rs:68:40 | LL | assert::is_transmutable::< i8, u32>(); - | ^^^ The size of `i8` is smaller than the size of `u32` + | ^^^ the size of `i8` is smaller than the size of `u32` | note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:14:14 @@ -77,7 +77,7 @@ error[E0277]: `i8` cannot be safely transmuted into `u64` --> $DIR/numbers.rs:69:40 | LL | assert::is_transmutable::< i8, u64>(); - | ^^^ The size of `i8` is smaller than the size of `u64` + | ^^^ the size of `i8` is smaller than the size of `u64` | note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:14:14 @@ -92,7 +92,7 @@ error[E0277]: `i8` cannot be safely transmuted into `i64` --> $DIR/numbers.rs:70:40 | LL | assert::is_transmutable::< i8, i64>(); - | ^^^ The size of `i8` is smaller than the size of `i64` + | ^^^ the size of `i8` is smaller than the size of `i64` | note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:14:14 @@ -107,7 +107,7 @@ error[E0277]: `i8` cannot be safely transmuted into `f64` --> $DIR/numbers.rs:71:40 | LL | assert::is_transmutable::< i8, f64>(); - | ^^^ The size of `i8` is smaller than the size of `f64` + | ^^^ the size of `i8` is smaller than the size of `f64` | note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:14:14 @@ -122,7 +122,7 @@ error[E0277]: `i8` cannot be safely transmuted into `u128` --> $DIR/numbers.rs:72:39 | LL | assert::is_transmutable::< i8, u128>(); - | ^^^^ The size of `i8` is smaller than the size of `u128` + | ^^^^ the size of `i8` is smaller than the size of `u128` | note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:14:14 @@ -137,7 +137,7 @@ error[E0277]: `i8` cannot be safely transmuted into `i128` --> $DIR/numbers.rs:73:39 | LL | assert::is_transmutable::< i8, i128>(); - | ^^^^ The size of `i8` is smaller than the size of `i128` + | ^^^^ the size of `i8` is smaller than the size of `i128` | note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:14:14 @@ -152,7 +152,7 @@ error[E0277]: `u8` cannot be safely transmuted into `i16` --> $DIR/numbers.rs:75:40 | LL | assert::is_transmutable::< u8, i16>(); - | ^^^ The size of `u8` is smaller than the size of `i16` + | ^^^ the size of `u8` is smaller than the size of `i16` | note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:14:14 @@ -167,7 +167,7 @@ error[E0277]: `u8` cannot be safely transmuted into `u16` --> $DIR/numbers.rs:76:40 | LL | assert::is_transmutable::< u8, u16>(); - | ^^^ The size of `u8` is smaller than the size of `u16` + | ^^^ the size of `u8` is smaller than the size of `u16` | note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:14:14 @@ -182,7 +182,7 @@ error[E0277]: `u8` cannot be safely transmuted into `i32` --> $DIR/numbers.rs:77:40 | LL | assert::is_transmutable::< u8, i32>(); - | ^^^ The size of `u8` is smaller than the size of `i32` + | ^^^ the size of `u8` is smaller than the size of `i32` | note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:14:14 @@ -197,7 +197,7 @@ error[E0277]: `u8` cannot be safely transmuted into `f32` --> $DIR/numbers.rs:78:40 | LL | assert::is_transmutable::< u8, f32>(); - | ^^^ The size of `u8` is smaller than the size of `f32` + | ^^^ the size of `u8` is smaller than the size of `f32` | note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:14:14 @@ -212,7 +212,7 @@ error[E0277]: `u8` cannot be safely transmuted into `u32` --> $DIR/numbers.rs:79:40 | LL | assert::is_transmutable::< u8, u32>(); - | ^^^ The size of `u8` is smaller than the size of `u32` + | ^^^ the size of `u8` is smaller than the size of `u32` | note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:14:14 @@ -227,7 +227,7 @@ error[E0277]: `u8` cannot be safely transmuted into `u64` --> $DIR/numbers.rs:80:40 | LL | assert::is_transmutable::< u8, u64>(); - | ^^^ The size of `u8` is smaller than the size of `u64` + | ^^^ the size of `u8` is smaller than the size of `u64` | note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:14:14 @@ -242,7 +242,7 @@ error[E0277]: `u8` cannot be safely transmuted into `i64` --> $DIR/numbers.rs:81:40 | LL | assert::is_transmutable::< u8, i64>(); - | ^^^ The size of `u8` is smaller than the size of `i64` + | ^^^ the size of `u8` is smaller than the size of `i64` | note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:14:14 @@ -257,7 +257,7 @@ error[E0277]: `u8` cannot be safely transmuted into `f64` --> $DIR/numbers.rs:82:40 | LL | assert::is_transmutable::< u8, f64>(); - | ^^^ The size of `u8` is smaller than the size of `f64` + | ^^^ the size of `u8` is smaller than the size of `f64` | note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:14:14 @@ -272,7 +272,7 @@ error[E0277]: `u8` cannot be safely transmuted into `u128` --> $DIR/numbers.rs:83:39 | LL | assert::is_transmutable::< u8, u128>(); - | ^^^^ The size of `u8` is smaller than the size of `u128` + | ^^^^ the size of `u8` is smaller than the size of `u128` | note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:14:14 @@ -287,7 +287,7 @@ error[E0277]: `u8` cannot be safely transmuted into `i128` --> $DIR/numbers.rs:84:39 | LL | assert::is_transmutable::< u8, i128>(); - | ^^^^ The size of `u8` is smaller than the size of `i128` + | ^^^^ the size of `u8` is smaller than the size of `i128` | note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:14:14 @@ -302,7 +302,7 @@ error[E0277]: `i16` cannot be safely transmuted into `i32` --> $DIR/numbers.rs:86:40 | LL | assert::is_transmutable::< i16, i32>(); - | ^^^ The size of `i16` is smaller than the size of `i32` + | ^^^ the size of `i16` is smaller than the size of `i32` | note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:14:14 @@ -317,7 +317,7 @@ error[E0277]: `i16` cannot be safely transmuted into `f32` --> $DIR/numbers.rs:87:40 | LL | assert::is_transmutable::< i16, f32>(); - | ^^^ The size of `i16` is smaller than the size of `f32` + | ^^^ the size of `i16` is smaller than the size of `f32` | note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:14:14 @@ -332,7 +332,7 @@ error[E0277]: `i16` cannot be safely transmuted into `u32` --> $DIR/numbers.rs:88:40 | LL | assert::is_transmutable::< i16, u32>(); - | ^^^ The size of `i16` is smaller than the size of `u32` + | ^^^ the size of `i16` is smaller than the size of `u32` | note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:14:14 @@ -347,7 +347,7 @@ error[E0277]: `i16` cannot be safely transmuted into `u64` --> $DIR/numbers.rs:89:40 | LL | assert::is_transmutable::< i16, u64>(); - | ^^^ The size of `i16` is smaller than the size of `u64` + | ^^^ the size of `i16` is smaller than the size of `u64` | note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:14:14 @@ -362,7 +362,7 @@ error[E0277]: `i16` cannot be safely transmuted into `i64` --> $DIR/numbers.rs:90:40 | LL | assert::is_transmutable::< i16, i64>(); - | ^^^ The size of `i16` is smaller than the size of `i64` + | ^^^ the size of `i16` is smaller than the size of `i64` | note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:14:14 @@ -377,7 +377,7 @@ error[E0277]: `i16` cannot be safely transmuted into `f64` --> $DIR/numbers.rs:91:40 | LL | assert::is_transmutable::< i16, f64>(); - | ^^^ The size of `i16` is smaller than the size of `f64` + | ^^^ the size of `i16` is smaller than the size of `f64` | note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:14:14 @@ -392,7 +392,7 @@ error[E0277]: `i16` cannot be safely transmuted into `u128` --> $DIR/numbers.rs:92:39 | LL | assert::is_transmutable::< i16, u128>(); - | ^^^^ The size of `i16` is smaller than the size of `u128` + | ^^^^ the size of `i16` is smaller than the size of `u128` | note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:14:14 @@ -407,7 +407,7 @@ error[E0277]: `i16` cannot be safely transmuted into `i128` --> $DIR/numbers.rs:93:39 | LL | assert::is_transmutable::< i16, i128>(); - | ^^^^ The size of `i16` is smaller than the size of `i128` + | ^^^^ the size of `i16` is smaller than the size of `i128` | note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:14:14 @@ -422,7 +422,7 @@ error[E0277]: `u16` cannot be safely transmuted into `i32` --> $DIR/numbers.rs:95:40 | LL | assert::is_transmutable::< u16, i32>(); - | ^^^ The size of `u16` is smaller than the size of `i32` + | ^^^ the size of `u16` is smaller than the size of `i32` | note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:14:14 @@ -437,7 +437,7 @@ error[E0277]: `u16` cannot be safely transmuted into `f32` --> $DIR/numbers.rs:96:40 | LL | assert::is_transmutable::< u16, f32>(); - | ^^^ The size of `u16` is smaller than the size of `f32` + | ^^^ the size of `u16` is smaller than the size of `f32` | note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:14:14 @@ -452,7 +452,7 @@ error[E0277]: `u16` cannot be safely transmuted into `u32` --> $DIR/numbers.rs:97:40 | LL | assert::is_transmutable::< u16, u32>(); - | ^^^ The size of `u16` is smaller than the size of `u32` + | ^^^ the size of `u16` is smaller than the size of `u32` | note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:14:14 @@ -467,7 +467,7 @@ error[E0277]: `u16` cannot be safely transmuted into `u64` --> $DIR/numbers.rs:98:40 | LL | assert::is_transmutable::< u16, u64>(); - | ^^^ The size of `u16` is smaller than the size of `u64` + | ^^^ the size of `u16` is smaller than the size of `u64` | note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:14:14 @@ -482,7 +482,7 @@ error[E0277]: `u16` cannot be safely transmuted into `i64` --> $DIR/numbers.rs:99:40 | LL | assert::is_transmutable::< u16, i64>(); - | ^^^ The size of `u16` is smaller than the size of `i64` + | ^^^ the size of `u16` is smaller than the size of `i64` | note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:14:14 @@ -497,7 +497,7 @@ error[E0277]: `u16` cannot be safely transmuted into `f64` --> $DIR/numbers.rs:100:40 | LL | assert::is_transmutable::< u16, f64>(); - | ^^^ The size of `u16` is smaller than the size of `f64` + | ^^^ the size of `u16` is smaller than the size of `f64` | note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:14:14 @@ -512,7 +512,7 @@ error[E0277]: `u16` cannot be safely transmuted into `u128` --> $DIR/numbers.rs:101:39 | LL | assert::is_transmutable::< u16, u128>(); - | ^^^^ The size of `u16` is smaller than the size of `u128` + | ^^^^ the size of `u16` is smaller than the size of `u128` | note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:14:14 @@ -527,7 +527,7 @@ error[E0277]: `u16` cannot be safely transmuted into `i128` --> $DIR/numbers.rs:102:39 | LL | assert::is_transmutable::< u16, i128>(); - | ^^^^ The size of `u16` is smaller than the size of `i128` + | ^^^^ the size of `u16` is smaller than the size of `i128` | note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:14:14 @@ -542,7 +542,7 @@ error[E0277]: `i32` cannot be safely transmuted into `u64` --> $DIR/numbers.rs:104:40 | LL | assert::is_transmutable::< i32, u64>(); - | ^^^ The size of `i32` is smaller than the size of `u64` + | ^^^ the size of `i32` is smaller than the size of `u64` | note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:14:14 @@ -557,7 +557,7 @@ error[E0277]: `i32` cannot be safely transmuted into `i64` --> $DIR/numbers.rs:105:40 | LL | assert::is_transmutable::< i32, i64>(); - | ^^^ The size of `i32` is smaller than the size of `i64` + | ^^^ the size of `i32` is smaller than the size of `i64` | note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:14:14 @@ -572,7 +572,7 @@ error[E0277]: `i32` cannot be safely transmuted into `f64` --> $DIR/numbers.rs:106:40 | LL | assert::is_transmutable::< i32, f64>(); - | ^^^ The size of `i32` is smaller than the size of `f64` + | ^^^ the size of `i32` is smaller than the size of `f64` | note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:14:14 @@ -587,7 +587,7 @@ error[E0277]: `i32` cannot be safely transmuted into `u128` --> $DIR/numbers.rs:107:39 | LL | assert::is_transmutable::< i32, u128>(); - | ^^^^ The size of `i32` is smaller than the size of `u128` + | ^^^^ the size of `i32` is smaller than the size of `u128` | note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:14:14 @@ -602,7 +602,7 @@ error[E0277]: `i32` cannot be safely transmuted into `i128` --> $DIR/numbers.rs:108:39 | LL | assert::is_transmutable::< i32, i128>(); - | ^^^^ The size of `i32` is smaller than the size of `i128` + | ^^^^ the size of `i32` is smaller than the size of `i128` | note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:14:14 @@ -617,7 +617,7 @@ error[E0277]: `f32` cannot be safely transmuted into `u64` --> $DIR/numbers.rs:110:40 | LL | assert::is_transmutable::< f32, u64>(); - | ^^^ The size of `f32` is smaller than the size of `u64` + | ^^^ the size of `f32` is smaller than the size of `u64` | note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:14:14 @@ -632,7 +632,7 @@ error[E0277]: `f32` cannot be safely transmuted into `i64` --> $DIR/numbers.rs:111:40 | LL | assert::is_transmutable::< f32, i64>(); - | ^^^ The size of `f32` is smaller than the size of `i64` + | ^^^ the size of `f32` is smaller than the size of `i64` | note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:14:14 @@ -647,7 +647,7 @@ error[E0277]: `f32` cannot be safely transmuted into `f64` --> $DIR/numbers.rs:112:40 | LL | assert::is_transmutable::< f32, f64>(); - | ^^^ The size of `f32` is smaller than the size of `f64` + | ^^^ the size of `f32` is smaller than the size of `f64` | note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:14:14 @@ -662,7 +662,7 @@ error[E0277]: `f32` cannot be safely transmuted into `u128` --> $DIR/numbers.rs:113:39 | LL | assert::is_transmutable::< f32, u128>(); - | ^^^^ The size of `f32` is smaller than the size of `u128` + | ^^^^ the size of `f32` is smaller than the size of `u128` | note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:14:14 @@ -677,7 +677,7 @@ error[E0277]: `f32` cannot be safely transmuted into `i128` --> $DIR/numbers.rs:114:39 | LL | assert::is_transmutable::< f32, i128>(); - | ^^^^ The size of `f32` is smaller than the size of `i128` + | ^^^^ the size of `f32` is smaller than the size of `i128` | note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:14:14 @@ -692,7 +692,7 @@ error[E0277]: `u32` cannot be safely transmuted into `u64` --> $DIR/numbers.rs:116:40 | LL | assert::is_transmutable::< u32, u64>(); - | ^^^ The size of `u32` is smaller than the size of `u64` + | ^^^ the size of `u32` is smaller than the size of `u64` | note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:14:14 @@ -707,7 +707,7 @@ error[E0277]: `u32` cannot be safely transmuted into `i64` --> $DIR/numbers.rs:117:40 | LL | assert::is_transmutable::< u32, i64>(); - | ^^^ The size of `u32` is smaller than the size of `i64` + | ^^^ the size of `u32` is smaller than the size of `i64` | note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:14:14 @@ -722,7 +722,7 @@ error[E0277]: `u32` cannot be safely transmuted into `f64` --> $DIR/numbers.rs:118:40 | LL | assert::is_transmutable::< u32, f64>(); - | ^^^ The size of `u32` is smaller than the size of `f64` + | ^^^ the size of `u32` is smaller than the size of `f64` | note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:14:14 @@ -737,7 +737,7 @@ error[E0277]: `u32` cannot be safely transmuted into `u128` --> $DIR/numbers.rs:119:39 | LL | assert::is_transmutable::< u32, u128>(); - | ^^^^ The size of `u32` is smaller than the size of `u128` + | ^^^^ the size of `u32` is smaller than the size of `u128` | note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:14:14 @@ -752,7 +752,7 @@ error[E0277]: `u32` cannot be safely transmuted into `i128` --> $DIR/numbers.rs:120:39 | LL | assert::is_transmutable::< u32, i128>(); - | ^^^^ The size of `u32` is smaller than the size of `i128` + | ^^^^ the size of `u32` is smaller than the size of `i128` | note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:14:14 @@ -767,7 +767,7 @@ error[E0277]: `u64` cannot be safely transmuted into `u128` --> $DIR/numbers.rs:122:39 | LL | assert::is_transmutable::< u64, u128>(); - | ^^^^ The size of `u64` is smaller than the size of `u128` + | ^^^^ the size of `u64` is smaller than the size of `u128` | note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:14:14 @@ -782,7 +782,7 @@ error[E0277]: `u64` cannot be safely transmuted into `i128` --> $DIR/numbers.rs:123:39 | LL | assert::is_transmutable::< u64, i128>(); - | ^^^^ The size of `u64` is smaller than the size of `i128` + | ^^^^ the size of `u64` is smaller than the size of `i128` | note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:14:14 @@ -797,7 +797,7 @@ error[E0277]: `i64` cannot be safely transmuted into `u128` --> $DIR/numbers.rs:125:39 | LL | assert::is_transmutable::< i64, u128>(); - | ^^^^ The size of `i64` is smaller than the size of `u128` + | ^^^^ the size of `i64` is smaller than the size of `u128` | note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:14:14 @@ -812,7 +812,7 @@ error[E0277]: `i64` cannot be safely transmuted into `i128` --> $DIR/numbers.rs:126:39 | LL | assert::is_transmutable::< i64, i128>(); - | ^^^^ The size of `i64` is smaller than the size of `i128` + | ^^^^ the size of `i64` is smaller than the size of `i128` | note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:14:14 @@ -827,7 +827,7 @@ error[E0277]: `f64` cannot be safely transmuted into `u128` --> $DIR/numbers.rs:128:39 | LL | assert::is_transmutable::< f64, u128>(); - | ^^^^ The size of `f64` is smaller than the size of `u128` + | ^^^^ the size of `f64` is smaller than the size of `u128` | note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:14:14 @@ -842,7 +842,7 @@ error[E0277]: `f64` cannot be safely transmuted into `i128` --> $DIR/numbers.rs:129:39 | LL | assert::is_transmutable::< f64, i128>(); - | ^^^^ The size of `f64` is smaller than the size of `i128` + | ^^^^ the size of `f64` is smaller than the size of `i128` | note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:14:14 diff --git a/tests/ui/transmutability/primitives/numbers.next.stderr b/tests/ui/transmutability/primitives/numbers.next.stderr index 7a80e444149d..0a9b9d182f85 100644 --- a/tests/ui/transmutability/primitives/numbers.next.stderr +++ b/tests/ui/transmutability/primitives/numbers.next.stderr @@ -2,7 +2,7 @@ error[E0277]: `i8` cannot be safely transmuted into `i16` --> $DIR/numbers.rs:64:40 | LL | assert::is_transmutable::< i8, i16>(); - | ^^^ The size of `i8` is smaller than the size of `i16` + | ^^^ the size of `i8` is smaller than the size of `i16` | note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:14:14 @@ -17,7 +17,7 @@ error[E0277]: `i8` cannot be safely transmuted into `u16` --> $DIR/numbers.rs:65:40 | LL | assert::is_transmutable::< i8, u16>(); - | ^^^ The size of `i8` is smaller than the size of `u16` + | ^^^ the size of `i8` is smaller than the size of `u16` | note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:14:14 @@ -32,7 +32,7 @@ error[E0277]: `i8` cannot be safely transmuted into `i32` --> $DIR/numbers.rs:66:40 | LL | assert::is_transmutable::< i8, i32>(); - | ^^^ The size of `i8` is smaller than the size of `i32` + | ^^^ the size of `i8` is smaller than the size of `i32` | note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:14:14 @@ -47,7 +47,7 @@ error[E0277]: `i8` cannot be safely transmuted into `f32` --> $DIR/numbers.rs:67:40 | LL | assert::is_transmutable::< i8, f32>(); - | ^^^ The size of `i8` is smaller than the size of `f32` + | ^^^ the size of `i8` is smaller than the size of `f32` | note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:14:14 @@ -62,7 +62,7 @@ error[E0277]: `i8` cannot be safely transmuted into `u32` --> $DIR/numbers.rs:68:40 | LL | assert::is_transmutable::< i8, u32>(); - | ^^^ The size of `i8` is smaller than the size of `u32` + | ^^^ the size of `i8` is smaller than the size of `u32` | note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:14:14 @@ -77,7 +77,7 @@ error[E0277]: `i8` cannot be safely transmuted into `u64` --> $DIR/numbers.rs:69:40 | LL | assert::is_transmutable::< i8, u64>(); - | ^^^ The size of `i8` is smaller than the size of `u64` + | ^^^ the size of `i8` is smaller than the size of `u64` | note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:14:14 @@ -92,7 +92,7 @@ error[E0277]: `i8` cannot be safely transmuted into `i64` --> $DIR/numbers.rs:70:40 | LL | assert::is_transmutable::< i8, i64>(); - | ^^^ The size of `i8` is smaller than the size of `i64` + | ^^^ the size of `i8` is smaller than the size of `i64` | note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:14:14 @@ -107,7 +107,7 @@ error[E0277]: `i8` cannot be safely transmuted into `f64` --> $DIR/numbers.rs:71:40 | LL | assert::is_transmutable::< i8, f64>(); - | ^^^ The size of `i8` is smaller than the size of `f64` + | ^^^ the size of `i8` is smaller than the size of `f64` | note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:14:14 @@ -122,7 +122,7 @@ error[E0277]: `i8` cannot be safely transmuted into `u128` --> $DIR/numbers.rs:72:39 | LL | assert::is_transmutable::< i8, u128>(); - | ^^^^ The size of `i8` is smaller than the size of `u128` + | ^^^^ the size of `i8` is smaller than the size of `u128` | note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:14:14 @@ -137,7 +137,7 @@ error[E0277]: `i8` cannot be safely transmuted into `i128` --> $DIR/numbers.rs:73:39 | LL | assert::is_transmutable::< i8, i128>(); - | ^^^^ The size of `i8` is smaller than the size of `i128` + | ^^^^ the size of `i8` is smaller than the size of `i128` | note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:14:14 @@ -152,7 +152,7 @@ error[E0277]: `u8` cannot be safely transmuted into `i16` --> $DIR/numbers.rs:75:40 | LL | assert::is_transmutable::< u8, i16>(); - | ^^^ The size of `u8` is smaller than the size of `i16` + | ^^^ the size of `u8` is smaller than the size of `i16` | note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:14:14 @@ -167,7 +167,7 @@ error[E0277]: `u8` cannot be safely transmuted into `u16` --> $DIR/numbers.rs:76:40 | LL | assert::is_transmutable::< u8, u16>(); - | ^^^ The size of `u8` is smaller than the size of `u16` + | ^^^ the size of `u8` is smaller than the size of `u16` | note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:14:14 @@ -182,7 +182,7 @@ error[E0277]: `u8` cannot be safely transmuted into `i32` --> $DIR/numbers.rs:77:40 | LL | assert::is_transmutable::< u8, i32>(); - | ^^^ The size of `u8` is smaller than the size of `i32` + | ^^^ the size of `u8` is smaller than the size of `i32` | note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:14:14 @@ -197,7 +197,7 @@ error[E0277]: `u8` cannot be safely transmuted into `f32` --> $DIR/numbers.rs:78:40 | LL | assert::is_transmutable::< u8, f32>(); - | ^^^ The size of `u8` is smaller than the size of `f32` + | ^^^ the size of `u8` is smaller than the size of `f32` | note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:14:14 @@ -212,7 +212,7 @@ error[E0277]: `u8` cannot be safely transmuted into `u32` --> $DIR/numbers.rs:79:40 | LL | assert::is_transmutable::< u8, u32>(); - | ^^^ The size of `u8` is smaller than the size of `u32` + | ^^^ the size of `u8` is smaller than the size of `u32` | note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:14:14 @@ -227,7 +227,7 @@ error[E0277]: `u8` cannot be safely transmuted into `u64` --> $DIR/numbers.rs:80:40 | LL | assert::is_transmutable::< u8, u64>(); - | ^^^ The size of `u8` is smaller than the size of `u64` + | ^^^ the size of `u8` is smaller than the size of `u64` | note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:14:14 @@ -242,7 +242,7 @@ error[E0277]: `u8` cannot be safely transmuted into `i64` --> $DIR/numbers.rs:81:40 | LL | assert::is_transmutable::< u8, i64>(); - | ^^^ The size of `u8` is smaller than the size of `i64` + | ^^^ the size of `u8` is smaller than the size of `i64` | note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:14:14 @@ -257,7 +257,7 @@ error[E0277]: `u8` cannot be safely transmuted into `f64` --> $DIR/numbers.rs:82:40 | LL | assert::is_transmutable::< u8, f64>(); - | ^^^ The size of `u8` is smaller than the size of `f64` + | ^^^ the size of `u8` is smaller than the size of `f64` | note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:14:14 @@ -272,7 +272,7 @@ error[E0277]: `u8` cannot be safely transmuted into `u128` --> $DIR/numbers.rs:83:39 | LL | assert::is_transmutable::< u8, u128>(); - | ^^^^ The size of `u8` is smaller than the size of `u128` + | ^^^^ the size of `u8` is smaller than the size of `u128` | note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:14:14 @@ -287,7 +287,7 @@ error[E0277]: `u8` cannot be safely transmuted into `i128` --> $DIR/numbers.rs:84:39 | LL | assert::is_transmutable::< u8, i128>(); - | ^^^^ The size of `u8` is smaller than the size of `i128` + | ^^^^ the size of `u8` is smaller than the size of `i128` | note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:14:14 @@ -302,7 +302,7 @@ error[E0277]: `i16` cannot be safely transmuted into `i32` --> $DIR/numbers.rs:86:40 | LL | assert::is_transmutable::< i16, i32>(); - | ^^^ The size of `i16` is smaller than the size of `i32` + | ^^^ the size of `i16` is smaller than the size of `i32` | note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:14:14 @@ -317,7 +317,7 @@ error[E0277]: `i16` cannot be safely transmuted into `f32` --> $DIR/numbers.rs:87:40 | LL | assert::is_transmutable::< i16, f32>(); - | ^^^ The size of `i16` is smaller than the size of `f32` + | ^^^ the size of `i16` is smaller than the size of `f32` | note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:14:14 @@ -332,7 +332,7 @@ error[E0277]: `i16` cannot be safely transmuted into `u32` --> $DIR/numbers.rs:88:40 | LL | assert::is_transmutable::< i16, u32>(); - | ^^^ The size of `i16` is smaller than the size of `u32` + | ^^^ the size of `i16` is smaller than the size of `u32` | note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:14:14 @@ -347,7 +347,7 @@ error[E0277]: `i16` cannot be safely transmuted into `u64` --> $DIR/numbers.rs:89:40 | LL | assert::is_transmutable::< i16, u64>(); - | ^^^ The size of `i16` is smaller than the size of `u64` + | ^^^ the size of `i16` is smaller than the size of `u64` | note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:14:14 @@ -362,7 +362,7 @@ error[E0277]: `i16` cannot be safely transmuted into `i64` --> $DIR/numbers.rs:90:40 | LL | assert::is_transmutable::< i16, i64>(); - | ^^^ The size of `i16` is smaller than the size of `i64` + | ^^^ the size of `i16` is smaller than the size of `i64` | note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:14:14 @@ -377,7 +377,7 @@ error[E0277]: `i16` cannot be safely transmuted into `f64` --> $DIR/numbers.rs:91:40 | LL | assert::is_transmutable::< i16, f64>(); - | ^^^ The size of `i16` is smaller than the size of `f64` + | ^^^ the size of `i16` is smaller than the size of `f64` | note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:14:14 @@ -392,7 +392,7 @@ error[E0277]: `i16` cannot be safely transmuted into `u128` --> $DIR/numbers.rs:92:39 | LL | assert::is_transmutable::< i16, u128>(); - | ^^^^ The size of `i16` is smaller than the size of `u128` + | ^^^^ the size of `i16` is smaller than the size of `u128` | note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:14:14 @@ -407,7 +407,7 @@ error[E0277]: `i16` cannot be safely transmuted into `i128` --> $DIR/numbers.rs:93:39 | LL | assert::is_transmutable::< i16, i128>(); - | ^^^^ The size of `i16` is smaller than the size of `i128` + | ^^^^ the size of `i16` is smaller than the size of `i128` | note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:14:14 @@ -422,7 +422,7 @@ error[E0277]: `u16` cannot be safely transmuted into `i32` --> $DIR/numbers.rs:95:40 | LL | assert::is_transmutable::< u16, i32>(); - | ^^^ The size of `u16` is smaller than the size of `i32` + | ^^^ the size of `u16` is smaller than the size of `i32` | note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:14:14 @@ -437,7 +437,7 @@ error[E0277]: `u16` cannot be safely transmuted into `f32` --> $DIR/numbers.rs:96:40 | LL | assert::is_transmutable::< u16, f32>(); - | ^^^ The size of `u16` is smaller than the size of `f32` + | ^^^ the size of `u16` is smaller than the size of `f32` | note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:14:14 @@ -452,7 +452,7 @@ error[E0277]: `u16` cannot be safely transmuted into `u32` --> $DIR/numbers.rs:97:40 | LL | assert::is_transmutable::< u16, u32>(); - | ^^^ The size of `u16` is smaller than the size of `u32` + | ^^^ the size of `u16` is smaller than the size of `u32` | note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:14:14 @@ -467,7 +467,7 @@ error[E0277]: `u16` cannot be safely transmuted into `u64` --> $DIR/numbers.rs:98:40 | LL | assert::is_transmutable::< u16, u64>(); - | ^^^ The size of `u16` is smaller than the size of `u64` + | ^^^ the size of `u16` is smaller than the size of `u64` | note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:14:14 @@ -482,7 +482,7 @@ error[E0277]: `u16` cannot be safely transmuted into `i64` --> $DIR/numbers.rs:99:40 | LL | assert::is_transmutable::< u16, i64>(); - | ^^^ The size of `u16` is smaller than the size of `i64` + | ^^^ the size of `u16` is smaller than the size of `i64` | note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:14:14 @@ -497,7 +497,7 @@ error[E0277]: `u16` cannot be safely transmuted into `f64` --> $DIR/numbers.rs:100:40 | LL | assert::is_transmutable::< u16, f64>(); - | ^^^ The size of `u16` is smaller than the size of `f64` + | ^^^ the size of `u16` is smaller than the size of `f64` | note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:14:14 @@ -512,7 +512,7 @@ error[E0277]: `u16` cannot be safely transmuted into `u128` --> $DIR/numbers.rs:101:39 | LL | assert::is_transmutable::< u16, u128>(); - | ^^^^ The size of `u16` is smaller than the size of `u128` + | ^^^^ the size of `u16` is smaller than the size of `u128` | note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:14:14 @@ -527,7 +527,7 @@ error[E0277]: `u16` cannot be safely transmuted into `i128` --> $DIR/numbers.rs:102:39 | LL | assert::is_transmutable::< u16, i128>(); - | ^^^^ The size of `u16` is smaller than the size of `i128` + | ^^^^ the size of `u16` is smaller than the size of `i128` | note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:14:14 @@ -542,7 +542,7 @@ error[E0277]: `i32` cannot be safely transmuted into `u64` --> $DIR/numbers.rs:104:40 | LL | assert::is_transmutable::< i32, u64>(); - | ^^^ The size of `i32` is smaller than the size of `u64` + | ^^^ the size of `i32` is smaller than the size of `u64` | note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:14:14 @@ -557,7 +557,7 @@ error[E0277]: `i32` cannot be safely transmuted into `i64` --> $DIR/numbers.rs:105:40 | LL | assert::is_transmutable::< i32, i64>(); - | ^^^ The size of `i32` is smaller than the size of `i64` + | ^^^ the size of `i32` is smaller than the size of `i64` | note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:14:14 @@ -572,7 +572,7 @@ error[E0277]: `i32` cannot be safely transmuted into `f64` --> $DIR/numbers.rs:106:40 | LL | assert::is_transmutable::< i32, f64>(); - | ^^^ The size of `i32` is smaller than the size of `f64` + | ^^^ the size of `i32` is smaller than the size of `f64` | note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:14:14 @@ -587,7 +587,7 @@ error[E0277]: `i32` cannot be safely transmuted into `u128` --> $DIR/numbers.rs:107:39 | LL | assert::is_transmutable::< i32, u128>(); - | ^^^^ The size of `i32` is smaller than the size of `u128` + | ^^^^ the size of `i32` is smaller than the size of `u128` | note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:14:14 @@ -602,7 +602,7 @@ error[E0277]: `i32` cannot be safely transmuted into `i128` --> $DIR/numbers.rs:108:39 | LL | assert::is_transmutable::< i32, i128>(); - | ^^^^ The size of `i32` is smaller than the size of `i128` + | ^^^^ the size of `i32` is smaller than the size of `i128` | note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:14:14 @@ -617,7 +617,7 @@ error[E0277]: `f32` cannot be safely transmuted into `u64` --> $DIR/numbers.rs:110:40 | LL | assert::is_transmutable::< f32, u64>(); - | ^^^ The size of `f32` is smaller than the size of `u64` + | ^^^ the size of `f32` is smaller than the size of `u64` | note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:14:14 @@ -632,7 +632,7 @@ error[E0277]: `f32` cannot be safely transmuted into `i64` --> $DIR/numbers.rs:111:40 | LL | assert::is_transmutable::< f32, i64>(); - | ^^^ The size of `f32` is smaller than the size of `i64` + | ^^^ the size of `f32` is smaller than the size of `i64` | note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:14:14 @@ -647,7 +647,7 @@ error[E0277]: `f32` cannot be safely transmuted into `f64` --> $DIR/numbers.rs:112:40 | LL | assert::is_transmutable::< f32, f64>(); - | ^^^ The size of `f32` is smaller than the size of `f64` + | ^^^ the size of `f32` is smaller than the size of `f64` | note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:14:14 @@ -662,7 +662,7 @@ error[E0277]: `f32` cannot be safely transmuted into `u128` --> $DIR/numbers.rs:113:39 | LL | assert::is_transmutable::< f32, u128>(); - | ^^^^ The size of `f32` is smaller than the size of `u128` + | ^^^^ the size of `f32` is smaller than the size of `u128` | note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:14:14 @@ -677,7 +677,7 @@ error[E0277]: `f32` cannot be safely transmuted into `i128` --> $DIR/numbers.rs:114:39 | LL | assert::is_transmutable::< f32, i128>(); - | ^^^^ The size of `f32` is smaller than the size of `i128` + | ^^^^ the size of `f32` is smaller than the size of `i128` | note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:14:14 @@ -692,7 +692,7 @@ error[E0277]: `u32` cannot be safely transmuted into `u64` --> $DIR/numbers.rs:116:40 | LL | assert::is_transmutable::< u32, u64>(); - | ^^^ The size of `u32` is smaller than the size of `u64` + | ^^^ the size of `u32` is smaller than the size of `u64` | note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:14:14 @@ -707,7 +707,7 @@ error[E0277]: `u32` cannot be safely transmuted into `i64` --> $DIR/numbers.rs:117:40 | LL | assert::is_transmutable::< u32, i64>(); - | ^^^ The size of `u32` is smaller than the size of `i64` + | ^^^ the size of `u32` is smaller than the size of `i64` | note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:14:14 @@ -722,7 +722,7 @@ error[E0277]: `u32` cannot be safely transmuted into `f64` --> $DIR/numbers.rs:118:40 | LL | assert::is_transmutable::< u32, f64>(); - | ^^^ The size of `u32` is smaller than the size of `f64` + | ^^^ the size of `u32` is smaller than the size of `f64` | note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:14:14 @@ -737,7 +737,7 @@ error[E0277]: `u32` cannot be safely transmuted into `u128` --> $DIR/numbers.rs:119:39 | LL | assert::is_transmutable::< u32, u128>(); - | ^^^^ The size of `u32` is smaller than the size of `u128` + | ^^^^ the size of `u32` is smaller than the size of `u128` | note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:14:14 @@ -752,7 +752,7 @@ error[E0277]: `u32` cannot be safely transmuted into `i128` --> $DIR/numbers.rs:120:39 | LL | assert::is_transmutable::< u32, i128>(); - | ^^^^ The size of `u32` is smaller than the size of `i128` + | ^^^^ the size of `u32` is smaller than the size of `i128` | note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:14:14 @@ -767,7 +767,7 @@ error[E0277]: `u64` cannot be safely transmuted into `u128` --> $DIR/numbers.rs:122:39 | LL | assert::is_transmutable::< u64, u128>(); - | ^^^^ The size of `u64` is smaller than the size of `u128` + | ^^^^ the size of `u64` is smaller than the size of `u128` | note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:14:14 @@ -782,7 +782,7 @@ error[E0277]: `u64` cannot be safely transmuted into `i128` --> $DIR/numbers.rs:123:39 | LL | assert::is_transmutable::< u64, i128>(); - | ^^^^ The size of `u64` is smaller than the size of `i128` + | ^^^^ the size of `u64` is smaller than the size of `i128` | note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:14:14 @@ -797,7 +797,7 @@ error[E0277]: `i64` cannot be safely transmuted into `u128` --> $DIR/numbers.rs:125:39 | LL | assert::is_transmutable::< i64, u128>(); - | ^^^^ The size of `i64` is smaller than the size of `u128` + | ^^^^ the size of `i64` is smaller than the size of `u128` | note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:14:14 @@ -812,7 +812,7 @@ error[E0277]: `i64` cannot be safely transmuted into `i128` --> $DIR/numbers.rs:126:39 | LL | assert::is_transmutable::< i64, i128>(); - | ^^^^ The size of `i64` is smaller than the size of `i128` + | ^^^^ the size of `i64` is smaller than the size of `i128` | note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:14:14 @@ -827,7 +827,7 @@ error[E0277]: `f64` cannot be safely transmuted into `u128` --> $DIR/numbers.rs:128:39 | LL | assert::is_transmutable::< f64, u128>(); - | ^^^^ The size of `f64` is smaller than the size of `u128` + | ^^^^ the size of `f64` is smaller than the size of `u128` | note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:14:14 @@ -842,7 +842,7 @@ error[E0277]: `f64` cannot be safely transmuted into `i128` --> $DIR/numbers.rs:129:39 | LL | assert::is_transmutable::< f64, i128>(); - | ^^^^ The size of `f64` is smaller than the size of `i128` + | ^^^^ the size of `f64` is smaller than the size of `i128` | note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:14:14 diff --git a/tests/ui/transmutability/primitives/unit.current.stderr b/tests/ui/transmutability/primitives/unit.current.stderr index b2831dbf8425..52b708d680e8 100644 --- a/tests/ui/transmutability/primitives/unit.current.stderr +++ b/tests/ui/transmutability/primitives/unit.current.stderr @@ -2,7 +2,7 @@ error[E0277]: `()` cannot be safely transmuted into `u8` --> $DIR/unit.rs:31:35 | LL | assert::is_transmutable::<(), u8>(); - | ^^ The size of `()` is smaller than the size of `u8` + | ^^ the size of `()` is smaller than the size of `u8` | note: required by a bound in `is_transmutable` --> $DIR/unit.rs:16:14 diff --git a/tests/ui/transmutability/primitives/unit.next.stderr b/tests/ui/transmutability/primitives/unit.next.stderr index b2831dbf8425..52b708d680e8 100644 --- a/tests/ui/transmutability/primitives/unit.next.stderr +++ b/tests/ui/transmutability/primitives/unit.next.stderr @@ -2,7 +2,7 @@ error[E0277]: `()` cannot be safely transmuted into `u8` --> $DIR/unit.rs:31:35 | LL | assert::is_transmutable::<(), u8>(); - | ^^ The size of `()` is smaller than the size of `u8` + | ^^ the size of `()` is smaller than the size of `u8` | note: required by a bound in `is_transmutable` --> $DIR/unit.rs:16:14 diff --git a/tests/ui/transmutability/references/recursive-wrapper-types-bit-incompatible.stderr b/tests/ui/transmutability/references/recursive-wrapper-types-bit-incompatible.stderr index 305fca30939c..2b7cab1660d1 100644 --- a/tests/ui/transmutability/references/recursive-wrapper-types-bit-incompatible.stderr +++ b/tests/ui/transmutability/references/recursive-wrapper-types-bit-incompatible.stderr @@ -2,7 +2,7 @@ error[E0277]: `B` cannot be safely transmuted into `A` --> $DIR/recursive-wrapper-types-bit-incompatible.rs:23:49 | LL | assert::is_maybe_transmutable::<&'static B, &'static A>(); - | ^^^^^^^^^^ At least one value of `B` isn't a bit-valid value of `A` + | ^^^^^^^^^^ at least one value of `B` isn't a bit-valid value of `A` | note: required by a bound in `is_maybe_transmutable` --> $DIR/recursive-wrapper-types-bit-incompatible.rs:9:14 diff --git a/tests/ui/transmutability/references/reject_extension.stderr b/tests/ui/transmutability/references/reject_extension.stderr index e02ef89c4a03..88dd0313e3c8 100644 --- a/tests/ui/transmutability/references/reject_extension.stderr +++ b/tests/ui/transmutability/references/reject_extension.stderr @@ -2,7 +2,7 @@ error[E0277]: `&Packed` cannot be safely transmuted into `&Packed` --> $DIR/reject_extension.rs:48:37 | LL | assert::is_transmutable::<&Src, &Dst>(); - | ^^^^ The referent size of `&Packed` (2 bytes) is smaller than that of `&Packed` (4 bytes) + | ^^^^ the referent size of `&Packed` (2 bytes) is smaller than that of `&Packed` (4 bytes) | note: required by a bound in `is_transmutable` --> $DIR/reject_extension.rs:13:14 diff --git a/tests/ui/transmutability/references/unit-to-u8.stderr b/tests/ui/transmutability/references/unit-to-u8.stderr index 7cb45e24e0a4..5d73dfdc8eb7 100644 --- a/tests/ui/transmutability/references/unit-to-u8.stderr +++ b/tests/ui/transmutability/references/unit-to-u8.stderr @@ -2,7 +2,7 @@ error[E0277]: `&Unit` cannot be safely transmuted into `&u8` --> $DIR/unit-to-u8.rs:22:52 | LL | assert::is_maybe_transmutable::<&'static Unit, &'static u8>(); - | ^^^^^^^^^^^ The referent size of `&Unit` (0 bytes) is smaller than that of `&u8` (1 bytes) + | ^^^^^^^^^^^ the referent size of `&Unit` (0 bytes) is smaller than that of `&u8` (1 bytes) | note: required by a bound in `is_maybe_transmutable` --> $DIR/unit-to-u8.rs:9:14 diff --git a/tests/ui/transmutability/region-infer.stderr b/tests/ui/transmutability/region-infer.stderr index 5497af2429e5..03c46823838d 100644 --- a/tests/ui/transmutability/region-infer.stderr +++ b/tests/ui/transmutability/region-infer.stderr @@ -2,7 +2,7 @@ error[E0277]: `()` cannot be safely transmuted into `W<'_>` --> $DIR/region-infer.rs:18:5 | LL | test(); - | ^^^^^^ The size of `()` is smaller than the size of `W<'_>` + | ^^^^^^ the size of `()` is smaller than the size of `W<'_>` | note: required by a bound in `test` --> $DIR/region-infer.rs:10:12 diff --git a/tests/ui/transmutability/transmute-padding-ice.stderr b/tests/ui/transmutability/transmute-padding-ice.stderr index c48a5cd80ce7..4c121d463c60 100644 --- a/tests/ui/transmutability/transmute-padding-ice.stderr +++ b/tests/ui/transmutability/transmute-padding-ice.stderr @@ -2,7 +2,7 @@ error[E0277]: `B` cannot be safely transmuted into `A` --> $DIR/transmute-padding-ice.rs:25:40 | LL | assert::is_maybe_transmutable::(); - | ^ The size of `B` is smaller than the size of `A` + | ^ the size of `B` is smaller than the size of `A` | note: required by a bound in `is_maybe_transmutable` --> $DIR/transmute-padding-ice.rs:10:14 diff --git a/tests/ui/transmutability/unions/should_pad_variants.stderr b/tests/ui/transmutability/unions/should_pad_variants.stderr index 13b4c8053adb..da4294bdbce8 100644 --- a/tests/ui/transmutability/unions/should_pad_variants.stderr +++ b/tests/ui/transmutability/unions/should_pad_variants.stderr @@ -2,7 +2,7 @@ error[E0277]: `Src` cannot be safely transmuted into `Dst` --> $DIR/should_pad_variants.rs:43:36 | LL | assert::is_transmutable::(); - | ^^^ The size of `Src` is smaller than the size of `Dst` + | ^^^ the size of `Src` is smaller than the size of `Dst` | note: required by a bound in `is_transmutable` --> $DIR/should_pad_variants.rs:13:14 diff --git a/tests/ui/transmutability/unions/should_reject_contraction.stderr b/tests/ui/transmutability/unions/should_reject_contraction.stderr index a3e387a0f846..20eaa3a6b095 100644 --- a/tests/ui/transmutability/unions/should_reject_contraction.stderr +++ b/tests/ui/transmutability/unions/should_reject_contraction.stderr @@ -2,7 +2,7 @@ error[E0277]: `Superset` cannot be safely transmuted into `Subset` --> $DIR/should_reject_contraction.rs:34:41 | LL | assert::is_transmutable::(); - | ^^^^^^ At least one value of `Superset` isn't a bit-valid value of `Subset` + | ^^^^^^ at least one value of `Superset` isn't a bit-valid value of `Subset` | note: required by a bound in `is_transmutable` --> $DIR/should_reject_contraction.rs:12:14 diff --git a/tests/ui/transmutability/unions/should_reject_disjoint.stderr b/tests/ui/transmutability/unions/should_reject_disjoint.stderr index 447ab6d9de7a..ea47797c9705 100644 --- a/tests/ui/transmutability/unions/should_reject_disjoint.stderr +++ b/tests/ui/transmutability/unions/should_reject_disjoint.stderr @@ -2,7 +2,7 @@ error[E0277]: `A` cannot be safely transmuted into `B` --> $DIR/should_reject_disjoint.rs:32:40 | LL | assert::is_maybe_transmutable::(); - | ^ At least one value of `A` isn't a bit-valid value of `B` + | ^ at least one value of `A` isn't a bit-valid value of `B` | note: required by a bound in `is_maybe_transmutable` --> $DIR/should_reject_disjoint.rs:12:14 @@ -17,7 +17,7 @@ error[E0277]: `B` cannot be safely transmuted into `A` --> $DIR/should_reject_disjoint.rs:33:40 | LL | assert::is_maybe_transmutable::(); - | ^ At least one value of `B` isn't a bit-valid value of `A` + | ^ at least one value of `B` isn't a bit-valid value of `A` | note: required by a bound in `is_maybe_transmutable` --> $DIR/should_reject_disjoint.rs:12:14 diff --git a/tests/ui/transmutability/unions/should_reject_intersecting.stderr b/tests/ui/transmutability/unions/should_reject_intersecting.stderr index f0763bc8be78..79dec659d9db 100644 --- a/tests/ui/transmutability/unions/should_reject_intersecting.stderr +++ b/tests/ui/transmutability/unions/should_reject_intersecting.stderr @@ -2,7 +2,7 @@ error[E0277]: `A` cannot be safely transmuted into `B` --> $DIR/should_reject_intersecting.rs:35:34 | LL | assert::is_transmutable::(); - | ^ At least one value of `A` isn't a bit-valid value of `B` + | ^ at least one value of `A` isn't a bit-valid value of `B` | note: required by a bound in `is_transmutable` --> $DIR/should_reject_intersecting.rs:13:14 @@ -17,7 +17,7 @@ error[E0277]: `B` cannot be safely transmuted into `A` --> $DIR/should_reject_intersecting.rs:36:34 | LL | assert::is_transmutable::(); - | ^ At least one value of `B` isn't a bit-valid value of `A` + | ^ at least one value of `B` isn't a bit-valid value of `A` | note: required by a bound in `is_transmutable` --> $DIR/should_reject_intersecting.rs:13:14 From 07545959c5cf2557ed0a6045c2e85a9c8b4a080c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Ber=C3=A1nek?= Date: Fri, 15 Mar 2024 19:03:28 +0100 Subject: [PATCH 083/103] CI: cache PR CI Docker builds --- src/ci/docker/run.sh | 41 +++++++++++++++++++++++++++++------------ 1 file changed, 29 insertions(+), 12 deletions(-) diff --git a/src/ci/docker/run.sh b/src/ci/docker/run.sh index bd5447ac835d..740eb7504f87 100755 --- a/src/ci/docker/run.sh +++ b/src/ci/docker/run.sh @@ -92,21 +92,38 @@ if [ -f "$docker_dir/$image/Dockerfile" ]; then # Print docker version docker --version - # On non-CI or PR jobs, we don't have permissions to write to the registry cache, so we should - # not use `docker login` nor caching. - if [[ "$CI" == "" ]] || [[ "$PR_CI_JOB" == "1" ]]; + REGISTRY=ghcr.io + # PR CI runs on rust-lang, but we want to use the cache from rust-lang-ci + REGISTRY_USERNAME=rust-lang-ci + # Tag used to push the final Docker image, so that it can be pulled by e.g. rustup + IMAGE_TAG=${REGISTRY}/${REGISTRY_USERNAME}/rust-ci:${cksum} + # Tag used to cache the Docker build + # It seems that it cannot be the same as $IMAGE_TAG, otherwise it overwrites the cache + CACHE_IMAGE_TAG=${REGISTRY}/${REGISTRY_USERNAME}/rust-ci-cache:${cksum} + + # On non-CI jobs, we don't do any caching. + if [[ "$CI" == "" ]]; then retry docker build --rm -t rust-ci -f "$dockerfile" "$context" - else - REGISTRY=ghcr.io - # Most probably rust-lang-ci, but in general the owner of the repository where CI runs - REGISTRY_USERNAME=${GITHUB_REPOSITORY_OWNER} - # Tag used to push the final Docker image, so that it can be pulled by e.g. rustup - IMAGE_TAG=${REGISTRY}/${REGISTRY_USERNAME}/rust-ci:${cksum} - # Tag used to cache the Docker build - # It seems that it cannot be the same as $IMAGE_TAG, otherwise it overwrites the cache - CACHE_IMAGE_TAG=${REGISTRY}/${REGISTRY_USERNAME}/rust-ci-cache:${cksum} + # On PR CI jobs, we don't have permissions to write to the registry cache, + # but we can still read from it. + elif [[ "$PR_CI_JOB" == "1" ]]; + then + # Enable a new Docker driver so that --cache-from works with a registry backend + docker buildx create --use --driver docker-container + # Build the image using registry caching backend + retry docker \ + buildx \ + build \ + --rm \ + -t rust-ci \ + -f "$dockerfile" \ + --cache-from type=registry,ref=${CACHE_IMAGE_TAG} \ + --output=type=docker \ + "$context" + # On auto/try builds, we can also write to the cache. + else # Log into the Docker registry, so that we can read/write cache and the final image echo ${DOCKER_TOKEN} | docker login ${REGISTRY} \ --username ${REGISTRY_USERNAME} \ From 3ee1219088a17c911f91dabb8167e8f0de63f246 Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Fri, 15 Mar 2024 20:30:45 +0100 Subject: [PATCH 084/103] Fix remaining LLDB commands. --- tests/debuginfo/empty-string.rs | 6 +++--- tests/debuginfo/no_mangle-info.rs | 4 ++-- tests/debuginfo/pretty-slices.rs | 18 +++++++++--------- tests/debuginfo/pretty-std.rs | 30 +++++++++++++++--------------- 4 files changed, 29 insertions(+), 29 deletions(-) diff --git a/tests/debuginfo/empty-string.rs b/tests/debuginfo/empty-string.rs index 2afdfc8ad04b..36240730e198 100644 --- a/tests/debuginfo/empty-string.rs +++ b/tests/debuginfo/empty-string.rs @@ -17,12 +17,12 @@ // === LLDB TESTS ================================================================================== -// lldb-command: run +// lldb-command:run -// lldb-command: fr v empty_string +// lldb-command:fr v empty_string // lldb-check:[...] empty_string = "" { vec = size=0 } -// lldb-command: fr v empty_str +// lldb-command:fr v empty_str // lldb-check:[...] empty_str = "" { data_ptr = [...] length = 0 } fn main() { diff --git a/tests/debuginfo/no_mangle-info.rs b/tests/debuginfo/no_mangle-info.rs index 11b490295283..06c65a71b2e9 100644 --- a/tests/debuginfo/no_mangle-info.rs +++ b/tests/debuginfo/no_mangle-info.rs @@ -11,9 +11,9 @@ // === LLDB TESTS ================================================================================== // lldb-command:run // lldb-command:v TEST -// lldb-check: (unsigned long) TEST = 3735928559 +// lldb-check:(unsigned long) TEST = 3735928559 // lldb-command:v OTHER_TEST -// lldb-check: (unsigned long) no_mangle_info::namespace::OTHER_TEST::[...] = 42 +// lldb-check:(unsigned long) no_mangle_info::namespace::OTHER_TEST::[...] = 42 // === CDB TESTS ================================================================================== // cdb-command: g diff --git a/tests/debuginfo/pretty-slices.rs b/tests/debuginfo/pretty-slices.rs index 4507453a1070..5d2086fa478a 100644 --- a/tests/debuginfo/pretty-slices.rs +++ b/tests/debuginfo/pretty-slices.rs @@ -18,19 +18,19 @@ // gdb-command: print mut_str_slice // gdb-check: $4 = "mutable string slice" -// lldb-command: run +// lldb-command:run -// lldb-command: print slice -// lldb-check: (&[i32]) size=3 { [0] = 0 [1] = 1 [2] = 2 } +// lldb-command:v slice +// lldb-check:(&[i32]) slice = size=3 { [0] = 0 [1] = 1 [2] = 2 } -// lldb-command: print mut_slice -// lldb-check: (&mut [i32]) size=4 { [0] = 2 [1] = 3 [2] = 5 [3] = 7 } +// lldb-command:v mut_slice +// lldb-check:(&mut [i32]) mut_slice = size=4 { [0] = 2 [1] = 3 [2] = 5 [3] = 7 } -// lldb-command: print str_slice -// lldb-check: (&str) "string slice" { data_ptr = [...] length = 12 } +// lldb-command:v str_slice +// lldb-check:(&str) str_slice = "string slice" { data_ptr = [...] length = 12 } -// lldb-command: print mut_str_slice -// lldb-check: (&mut str) "mutable string slice" { data_ptr = [...] length = 20 } +// lldb-command:v mut_str_slice +// lldb-check:(&mut str) mut_str_slice = "mutable string slice" { data_ptr = [...] length = 20 } fn b() {} diff --git a/tests/debuginfo/pretty-std.rs b/tests/debuginfo/pretty-std.rs index 74eba9af7861..70827d551ca3 100644 --- a/tests/debuginfo/pretty-std.rs +++ b/tests/debuginfo/pretty-std.rs @@ -42,28 +42,28 @@ // === LLDB TESTS ================================================================================== -// lldb-command: run +// lldb-command:run -// lldb-command: print slice -// lldb-check:[...] &[0, 1, 2, 3] +// lldb-command:v slice +// lldb-check:[...] slice = &[0, 1, 2, 3] -// lldb-command: print vec -// lldb-check:[...] vec![4, 5, 6, 7] +// lldb-command:v vec +// lldb-check:[...] vec = vec![4, 5, 6, 7] -// lldb-command: print str_slice -// lldb-check:[...] "IAMA string slice!" +// lldb-command:v str_slice +// lldb-check:[...] str_slice = "IAMA string slice!" -// lldb-command: print string -// lldb-check:[...] "IAMA string!" +// lldb-command:v string +// lldb-check:[...] string = "IAMA string!" -// lldb-command: print some -// lldb-check:[...] Some(8) +// lldb-command:v some +// lldb-check:[...] some = Some(8) -// lldb-command: print none -// lldb-check:[...] None +// lldb-command:v none +// lldb-check:[...] none = None -// lldb-command: print os_string -// lldb-check:[...] "IAMA OS string 😃"[...] +// lldb-command:v os_string +// lldb-check:[...] os_string = "IAMA OS string 😃"[...] // === CDB TESTS ================================================================================== From e4b27a2a5b16641f08176f0697ed9373ccaf9c21 Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Fri, 15 Mar 2024 21:08:06 +0100 Subject: [PATCH 085/103] Fix unknown `dwim-print` command. --- tests/debuginfo/packed-struct.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/debuginfo/packed-struct.rs b/tests/debuginfo/packed-struct.rs index 2eb5be875bc5..ea9aa22ba550 100644 --- a/tests/debuginfo/packed-struct.rs +++ b/tests/debuginfo/packed-struct.rs @@ -50,13 +50,13 @@ // lldbg-check:[...] { a = 987 b = { x = 876 y = 765 z = 654 w = 543 } c = { x = 432 y = 321 z = 210 w = 109 } d = -98 } // lldbr-check:(packed_struct::UnpackedInPacked) unpackedInPacked = { a = 987 b = { x = 876 y = 765 z = 654 w = 543 } c = { x = 432 y = 321 z = 210 w = 109 } d = -98 } -// lldb-command:dwim-print sizeof(packed) +// lldb-command:expr sizeof(packed) // lldbg-check:[...] 14 -// lldbr-check:(usize) = 14 +// lldbr-check:(usize) [...] 14 -// lldb-command:dwim-print sizeof(packedInPacked) +// lldb-command:expr sizeof(packedInPacked) // lldbg-check:[...] 40 -// lldbr-check:(usize) = 40 +// lldbr-check:(usize) [...] 40 #![allow(unused_variables)] #![feature(omit_gdb_pretty_printer_section)] From 3fc5ed8067f98e2cae8c259a2e367024c59a3ad3 Mon Sep 17 00:00:00 2001 From: Guillaume Yziquel Date: Sun, 10 Mar 2024 20:00:42 +0000 Subject: [PATCH 086/103] Issue 122262: MAP_PRIVATE for more reliability on virtualised filesystems. Adding support of quirky filesystems occuring in virtualised settings not having full POSIX support for memory mapped files. Example: current virtiofs with cache disabled, occuring in Incus/LXD or Kata Containers. Has been hitting various virtualised filesystems since 2016, depending on their levels of maturity at the time. The situation will perhaps improve when virtiofs DAX support patches will have made it into the qemu mainline. On a reliability level, using the MAP_PRIVATE sycall flag instead of the MAP_SHARED syscall flag for the mmap() system call does have some undefined behaviour when the caller update the memory mapping of the mmap()ed file, but MAP_SHARED does allow not only the calling process but other processes to modify the memory mapping. Thus, in the current context, using MAP_PRIVATE copy-on-write is marginally more reliable than MAP_SHARED. This discussion of reliability is orthogonal to the type system enforced safety policy of rust, which does not claim to handle memory modification of memory mapped files triggered through the operating system and not the running rust process. --- compiler/rustc_data_structures/src/memmap.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/compiler/rustc_data_structures/src/memmap.rs b/compiler/rustc_data_structures/src/memmap.rs index 30403a614426..c7f66b2fee80 100644 --- a/compiler/rustc_data_structures/src/memmap.rs +++ b/compiler/rustc_data_structures/src/memmap.rs @@ -18,8 +18,14 @@ impl Mmap { /// However in practice most callers do not ensure this, so uses of this function are likely unsound. #[inline] pub unsafe fn map(file: File) -> io::Result { - // Safety: the caller must ensure that this is safe. - unsafe { memmap2::Mmap::map(&file).map(Mmap) } + // By default, memmap2 creates shared mappings, implying that we could see updates to the + // file through the mapping. That would violate our precondition; so by requesting a + // map_copy_read_only we do not lose anything. + // This mapping mode also improves our support for filesystems such as cacheless virtiofs. + // For more details see https://github.com/rust-lang/rust/issues/122262 + // + // SAFETY: The caller must ensure that this is safe. + unsafe { memmap2::MmapOptions::new().map_copy_read_only(&file).map(Mmap) } } } From 20b4b19369785eea1e39596e7294e3c9f79020c2 Mon Sep 17 00:00:00 2001 From: Weihang Lo Date: Fri, 15 Mar 2024 19:26:58 -0400 Subject: [PATCH 087/103] Update cargo --- src/tools/cargo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tools/cargo b/src/tools/cargo index 7065f0ef4aa2..2fe739fcf16c 160000 --- a/src/tools/cargo +++ b/src/tools/cargo @@ -1 +1 @@ -Subproject commit 7065f0ef4aa267a7455e1c478b5ccacb7baea59c +Subproject commit 2fe739fcf16c5bf8c2064ab9d357f4a0e6c8539b From a37fe00ea16a48652c22af3afa7dd04611a82700 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Le=C3=B3n=20Orell=20Valerian=20Liehr?= Date: Sat, 16 Mar 2024 02:33:21 +0100 Subject: [PATCH 088/103] Remove obsolete parameter `speculative` from `instantiate_poly_trait_ref` --- .../rustc_hir_analysis/src/astconv/bounds.rs | 101 ++++++++---------- .../rustc_hir_analysis/src/astconv/mod.rs | 4 +- .../src/astconv/object_safety.rs | 1 - 3 files changed, 48 insertions(+), 58 deletions(-) diff --git a/compiler/rustc_hir_analysis/src/astconv/bounds.rs b/compiler/rustc_hir_analysis/src/astconv/bounds.rs index 17e0aeb044cf..c6942b0f4567 100644 --- a/compiler/rustc_hir_analysis/src/astconv/bounds.rs +++ b/compiler/rustc_hir_analysis/src/astconv/bounds.rs @@ -149,7 +149,6 @@ impl<'tcx> dyn AstConv<'tcx> + '_ { polarity, param_ty, bounds, - false, only_self_bounds, ); } @@ -231,14 +230,13 @@ impl<'tcx> dyn AstConv<'tcx> + '_ { /// **A note on binders:** given something like `T: for<'a> Iterator`, the /// `trait_ref` here will be `for<'a> T: Iterator`. The `binding` data however is from *inside* /// the binder (e.g., `&'a u32`) and hence may reference bound regions. - #[instrument(level = "debug", skip(self, bounds, speculative, dup_bindings, path_span))] + #[instrument(level = "debug", skip(self, bounds, dup_bindings, path_span))] pub(super) fn add_predicates_for_ast_type_binding( &self, hir_ref_id: hir::HirId, trait_ref: ty::PolyTraitRef<'tcx>, binding: &hir::TypeBinding<'tcx>, bounds: &mut Bounds<'tcx>, - speculative: bool, dup_bindings: &mut FxIndexMap, path_span: Span, only_self_bounds: OnlySelfBounds, @@ -317,19 +315,17 @@ impl<'tcx> dyn AstConv<'tcx> + '_ { } tcx.check_stability(assoc_item.def_id, Some(hir_ref_id), binding.span, None); - if !speculative { - dup_bindings - .entry(assoc_item.def_id) - .and_modify(|prev_span| { - tcx.dcx().emit_err(errors::ValueOfAssociatedStructAlreadySpecified { - span: binding.span, - prev_span: *prev_span, - item_name: binding.ident, - def_path: tcx.def_path_str(assoc_item.container_id(tcx)), - }); - }) - .or_insert(binding.span); - } + dup_bindings + .entry(assoc_item.def_id) + .and_modify(|prev_span| { + tcx.dcx().emit_err(errors::ValueOfAssociatedStructAlreadySpecified { + span: binding.span, + prev_span: *prev_span, + item_name: binding.ident, + def_path: tcx.def_path_str(assoc_item.container_id(tcx)), + }); + }) + .or_insert(binding.span); let projection_ty = if let ty::AssocKind::Fn = assoc_kind { let mut emitted_bad_param_err = None; @@ -433,9 +429,8 @@ impl<'tcx> dyn AstConv<'tcx> + '_ { }); // Provide the resolved type of the associated constant to `type_of(AnonConst)`. - if !speculative - && let hir::TypeBindingKind::Equality { term: hir::Term::Const(anon_const) } = - binding.kind + if let hir::TypeBindingKind::Equality { term: hir::Term::Const(anon_const) } = + binding.kind { let ty = alias_ty.map_bound(|ty| tcx.type_of(ty.def_id).instantiate(tcx, ty.args)); // Since the arguments passed to the alias type above may contain early-bound @@ -463,42 +458,40 @@ impl<'tcx> dyn AstConv<'tcx> + '_ { hir::Term::Const(ct) => ty::Const::from_anon_const(tcx, ct.def_id).into(), }; - if !speculative { - // Find any late-bound regions declared in `ty` that are not - // declared in the trait-ref or assoc_item. These are not well-formed. - // - // Example: - // - // for<'a> ::Item = &'a str // <-- 'a is bad - // for<'a> >::Output = &'a str // <-- 'a is ok - let late_bound_in_projection_ty = - tcx.collect_constrained_late_bound_regions(projection_ty); - let late_bound_in_term = - tcx.collect_referenced_late_bound_regions(trait_ref.rebind(term)); - debug!(?late_bound_in_projection_ty); - debug!(?late_bound_in_term); + // Find any late-bound regions declared in `ty` that are not + // declared in the trait-ref or assoc_item. These are not well-formed. + // + // Example: + // + // for<'a> ::Item = &'a str // <-- 'a is bad + // for<'a> >::Output = &'a str // <-- 'a is ok + let late_bound_in_projection_ty = + tcx.collect_constrained_late_bound_regions(projection_ty); + let late_bound_in_term = + tcx.collect_referenced_late_bound_regions(trait_ref.rebind(term)); + debug!(?late_bound_in_projection_ty); + debug!(?late_bound_in_term); - // FIXME: point at the type params that don't have appropriate lifetimes: - // struct S1 Fn(&i32, &i32) -> &'a i32>(F); - // ---- ---- ^^^^^^^ - // NOTE(associated_const_equality): This error should be impossible to trigger - // with associated const equality bounds. - self.validate_late_bound_regions( - late_bound_in_projection_ty, - late_bound_in_term, - |br_name| { - struct_span_code_err!( - tcx.dcx(), - binding.span, - E0582, - "binding for associated type `{}` references {}, \ - which does not appear in the trait input types", - binding.ident, - br_name - ) - }, - ); - } + // FIXME: point at the type params that don't have appropriate lifetimes: + // struct S1 Fn(&i32, &i32) -> &'a i32>(F); + // ---- ---- ^^^^^^^ + // NOTE(associated_const_equality): This error should be impossible to trigger + // with associated const equality bounds. + self.validate_late_bound_regions( + late_bound_in_projection_ty, + late_bound_in_term, + |br_name| { + struct_span_code_err!( + tcx.dcx(), + binding.span, + E0582, + "binding for associated type `{}` references {}, \ + which does not appear in the trait input types", + binding.ident, + br_name + ) + }, + ); // "Desugar" a constraint like `T: Iterator` this to // the "projection predicate" for: diff --git a/compiler/rustc_hir_analysis/src/astconv/mod.rs b/compiler/rustc_hir_analysis/src/astconv/mod.rs index 401dd76a9f91..a912d7f578dd 100644 --- a/compiler/rustc_hir_analysis/src/astconv/mod.rs +++ b/compiler/rustc_hir_analysis/src/astconv/mod.rs @@ -639,7 +639,7 @@ impl<'tcx> dyn AstConv<'tcx> + '_ { /// where `'a` is a bound region at depth 0. Similarly, the `poly_trait_ref` would be /// `Bar<'a>`. The returned poly-trait-ref will have this binder instantiated explicitly, /// however. - #[instrument(level = "debug", skip(self, span, constness, bounds, speculative))] + #[instrument(level = "debug", skip(self, span, constness, bounds))] pub(crate) fn instantiate_poly_trait_ref( &self, trait_ref: &hir::TraitRef<'tcx>, @@ -648,7 +648,6 @@ impl<'tcx> dyn AstConv<'tcx> + '_ { polarity: ty::ImplPolarity, self_ty: Ty<'tcx>, bounds: &mut Bounds<'tcx>, - speculative: bool, only_self_bounds: OnlySelfBounds, ) -> GenericArgCountResult { let trait_def_id = trait_ref.trait_def_id().unwrap_or_else(|| FatalError.raise()); @@ -697,7 +696,6 @@ impl<'tcx> dyn AstConv<'tcx> + '_ { poly_trait_ref, binding, bounds, - speculative, &mut dup_bindings, binding.span, only_self_bounds, diff --git a/compiler/rustc_hir_analysis/src/astconv/object_safety.rs b/compiler/rustc_hir_analysis/src/astconv/object_safety.rs index d97728c33035..70c60e399418 100644 --- a/compiler/rustc_hir_analysis/src/astconv/object_safety.rs +++ b/compiler/rustc_hir_analysis/src/astconv/object_safety.rs @@ -44,7 +44,6 @@ impl<'tcx> dyn AstConv<'tcx> + '_ { ty::ImplPolarity::Positive, dummy_self, &mut bounds, - false, // True so we don't populate `bounds` with associated type bounds, even // though they're disallowed from object types. OnlySelfBounds(true), From 873a0f264e15f92af37f57d3bd3edf3d82faf34e Mon Sep 17 00:00:00 2001 From: daxpedda Date: Tue, 14 Nov 2023 23:04:22 +0100 Subject: [PATCH 089/103] Add `wasm_c_abi` `future-incompat` lint --- compiler/rustc_lint_defs/src/builtin.rs | 39 +++++++++++++++++++++++ compiler/rustc_metadata/messages.ftl | 2 ++ compiler/rustc_metadata/src/creader.rs | 42 ++++++++++++++++++++++++- 3 files changed, 82 insertions(+), 1 deletion(-) diff --git a/compiler/rustc_lint_defs/src/builtin.rs b/compiler/rustc_lint_defs/src/builtin.rs index 6506aa334310..3391cd8e40a0 100644 --- a/compiler/rustc_lint_defs/src/builtin.rs +++ b/compiler/rustc_lint_defs/src/builtin.rs @@ -130,6 +130,7 @@ declare_lint_pass! { UNUSED_VARIABLES, USELESS_DEPRECATED, WARNINGS, + WASM_C_ABI, WHERE_CLAUSES_OBJECT_SAFETY, WRITES_THROUGH_IMMUTABLE_POINTER, // tidy-alphabetical-end @@ -4564,3 +4565,41 @@ declare_lint! { reference: "issue #120192 ", }; } + +declare_lint! { + /// The `wasm_c_abi` lint detects crate dependencies that are incompatible + /// with future versions of Rust that will emit spec-compliant C ABI. + /// + /// ### Example + /// + /// ```rust,ignore (needs extern crate) + /// #![deny(wasm_c_abi)] + /// ``` + /// + /// This will produce: + /// + /// ```text + /// error: the following packages contain code that will be rejected by a future version of Rust: wasm-bindgen v0.2.87 + /// | + /// note: the lint level is defined here + /// --> src/lib.rs:1:9 + /// | + /// 1 | #![deny(wasm_c_abi)] + /// | ^^^^^^^^^^ + /// ``` + /// + /// ### Explanation + /// + /// Rust has historically emitted non-spec-compliant C ABI. This has caused + /// incompatibilities between other compilers and Wasm targets. In a future + /// version of Rust this will be fixed and therefore dependencies relying + /// on the non-spec-compliant C ABI will stop functioning. + pub WASM_C_ABI, + Warn, + "detects dependencies that are incompatible with the Wasm C ABI", + @future_incompatible = FutureIncompatibleInfo { + reason: FutureIncompatibilityReason::FutureReleaseErrorReportInDeps, + reference: "issue #71871 ", + }; + crate_level_only +} diff --git a/compiler/rustc_metadata/messages.ftl b/compiler/rustc_metadata/messages.ftl index a1c6fba4d435..f456dd09dea5 100644 --- a/compiler/rustc_metadata/messages.ftl +++ b/compiler/rustc_metadata/messages.ftl @@ -281,6 +281,8 @@ metadata_unsupported_abi = metadata_unsupported_abi_i686 = ABI not supported by `#[link(kind = "raw-dylib")]` on i686 +metadata_wasm_c_abi = + older versions of the `wasm-bindgen` crate will be incompatible with future versions of Rust; please update to `wasm-bindgen` v0.2.88 metadata_wasm_import_form = wasm import module must be of the form `wasm_import_module = "string"` diff --git a/compiler/rustc_metadata/src/creader.rs b/compiler/rustc_metadata/src/creader.rs index 72757d90e423..faa3bb7caeca 100644 --- a/compiler/rustc_metadata/src/creader.rs +++ b/compiler/rustc_metadata/src/creader.rs @@ -31,8 +31,9 @@ use proc_macro::bridge::client::ProcMacro; use std::error::Error; use std::ops::Fn; use std::path::Path; +use std::str::FromStr; use std::time::Duration; -use std::{cmp, iter}; +use std::{cmp, env, iter}; /// The backend's way to give the crate store access to the metadata in a library. /// Note that it returns the raw metadata bytes stored in the library file, whether @@ -985,6 +986,44 @@ impl<'a, 'tcx> CrateLoader<'a, 'tcx> { } } + fn report_future_incompatible_deps(&self, krate: &ast::Crate) { + let name = self.tcx.crate_name(LOCAL_CRATE); + + if name.as_str() == "wasm_bindgen" { + let major = env::var("CARGO_PKG_VERSION_MAJOR") + .ok() + .and_then(|major| u64::from_str(&major).ok()); + let minor = env::var("CARGO_PKG_VERSION_MINOR") + .ok() + .and_then(|minor| u64::from_str(&minor).ok()); + let patch = env::var("CARGO_PKG_VERSION_PATCH") + .ok() + .and_then(|patch| u64::from_str(&patch).ok()); + + match (major, minor, patch) { + // v1 or bigger is valid. + (Some(1..), _, _) => return, + // v0.3 or bigger is valid. + (Some(0), Some(3..), _) => return, + // v0.2.88 or bigger is valid. + (Some(0), Some(2), Some(88..)) => return, + // Not using Cargo. + (None, None, None) => return, + _ => (), + } + + // Make a point span rather than covering the whole file + let span = krate.spans.inner_span.shrink_to_lo(); + + self.sess.psess.buffer_lint( + lint::builtin::WASM_C_ABI, + span, + ast::CRATE_NODE_ID, + crate::fluent_generated::metadata_wasm_c_abi, + ); + } + } + pub fn postprocess(&mut self, krate: &ast::Crate) { self.inject_forced_externs(); self.inject_profiler_runtime(krate); @@ -992,6 +1031,7 @@ impl<'a, 'tcx> CrateLoader<'a, 'tcx> { self.inject_panic_runtime(krate); self.report_unused_deps(krate); + self.report_future_incompatible_deps(krate); info!("{:?}", CrateDump(self.cstore)); } From b0b249399a97e7f3ac97996f26993bf67fc9bfba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20K=C3=A5re=20Alsaker?= Date: Sat, 16 Mar 2024 06:00:05 +0100 Subject: [PATCH 090/103] Use `UnsafeCell` for fast constant thread locals --- library/std/src/sys/thread_local/fast_local.rs | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/library/std/src/sys/thread_local/fast_local.rs b/library/std/src/sys/thread_local/fast_local.rs index 646dcd7f3a3e..69ee70de30c0 100644 --- a/library/std/src/sys/thread_local/fast_local.rs +++ b/library/std/src/sys/thread_local/fast_local.rs @@ -13,22 +13,21 @@ pub macro thread_local_inner { (@key $t:ty, const $init:expr) => {{ #[inline] #[deny(unsafe_op_in_unsafe_fn)] - // FIXME: Use `SyncUnsafeCell` instead of allowing `static_mut_refs` lint - #[cfg_attr(bootstrap, allow(static_mut_ref))] - #[cfg_attr(not(bootstrap), allow(static_mut_refs))] unsafe fn __getit( _init: $crate::option::Option<&mut $crate::option::Option<$t>>, ) -> $crate::option::Option<&'static $t> { const INIT_EXPR: $t = $init; // If the platform has support for `#[thread_local]`, use it. #[thread_local] - static mut VAL: $t = INIT_EXPR; + // We use `UnsafeCell` here instead of `static mut` to ensure any generated TLS shims + // have a nonnull attribute on their return value. + static VAL: $crate::cell::UnsafeCell<$t> = $crate::cell::UnsafeCell::new(INIT_EXPR); // If a dtor isn't needed we can do something "very raw" and // just get going. if !$crate::mem::needs_drop::<$t>() { unsafe { - return $crate::option::Option::Some(&VAL) + return $crate::option::Option::Some(&*VAL.get()) } } @@ -55,15 +54,15 @@ pub macro thread_local_inner { // so now. 0 => { $crate::thread::local_impl::Key::<$t>::register_dtor( - $crate::ptr::addr_of_mut!(VAL) as *mut $crate::primitive::u8, + VAL.get() as *mut $crate::primitive::u8, destroy, ); STATE.set(1); - $crate::option::Option::Some(&VAL) + $crate::option::Option::Some(&*VAL.get()) } // 1 == the destructor is registered and the value // is valid, so return the pointer. - 1 => $crate::option::Option::Some(&VAL), + 1 => $crate::option::Option::Some(&*VAL.get()), // otherwise the destructor has already run, so we // can't give access. _ => $crate::option::Option::None, From 0ec5d374fe901488c9bd73cd2162bd62daca8261 Mon Sep 17 00:00:00 2001 From: Nilstrieb <48135649+Nilstrieb@users.noreply.github.com> Date: Sat, 16 Mar 2024 12:24:49 +0100 Subject: [PATCH 091/103] bootstrap: Don't name things copy that are not copies The bootstrap copy methods don't actually copy, they just hard link. Simply lying about it being "copying" can be very confusing! (ask me how I know!). --- src/bootstrap/src/core/build_steps/compile.rs | 41 ++++++++-------- src/bootstrap/src/core/build_steps/dist.rs | 29 +++++------ src/bootstrap/src/core/build_steps/doc.rs | 9 ++-- src/bootstrap/src/core/build_steps/test.rs | 2 +- src/bootstrap/src/core/build_steps/tool.rs | 8 ++-- src/bootstrap/src/lib.rs | 48 ++++++++++++------- src/bootstrap/src/utils/tarball.rs | 4 +- 7 files changed, 79 insertions(+), 62 deletions(-) diff --git a/src/bootstrap/src/core/build_steps/compile.rs b/src/bootstrap/src/core/build_steps/compile.rs index 94ea2a01a405..e927b491c71e 100644 --- a/src/bootstrap/src/core/build_steps/compile.rs +++ b/src/bootstrap/src/core/build_steps/compile.rs @@ -231,7 +231,7 @@ impl Step for Std { let target_sysroot_bin = builder.sysroot_libdir(compiler, target).parent().unwrap().join("bin"); t!(fs::create_dir_all(&target_sysroot_bin)); - builder.cp_r(&src_sysroot_bin, &target_sysroot_bin); + builder.cp_link_r(&src_sysroot_bin, &target_sysroot_bin); } } @@ -307,7 +307,7 @@ fn copy_and_stamp( dependency_type: DependencyType, ) { let target = libdir.join(name); - builder.copy(&sourcedir.join(name), &target); + builder.copy_link(&sourcedir.join(name), &target); target_deps.push((target, dependency_type)); } @@ -316,7 +316,7 @@ fn copy_llvm_libunwind(builder: &Builder<'_>, target: TargetSelection, libdir: & let libunwind_path = builder.ensure(llvm::Libunwind { target }); let libunwind_source = libunwind_path.join("libunwind.a"); let libunwind_target = libdir.join("libunwind.a"); - builder.copy(&libunwind_source, &libunwind_target); + builder.copy_link(&libunwind_source, &libunwind_target); libunwind_target } @@ -385,7 +385,7 @@ fn copy_self_contained_objects( for &obj in &["crtbegin.o", "crtbeginS.o", "crtend.o", "crtendS.o"] { let src = crt_path.join(obj); let target = libdir_self_contained.join(obj); - builder.copy(&src, &target); + builder.copy_link(&src, &target); target_deps.push((target, DependencyType::TargetSelfContained)); } @@ -418,7 +418,7 @@ fn copy_self_contained_objects( for obj in ["crt2.o", "dllcrt2.o"].iter() { let src = compiler_file(builder, &builder.cc(target), target, CLang::C, obj); let target = libdir_self_contained.join(obj); - builder.copy(&src, &target); + builder.copy_link(&src, &target); target_deps.push((target, DependencyType::TargetSelfContained)); } } @@ -637,7 +637,7 @@ impl Step for StdLink { let stage0_bin_dir = builder.out.join(host).join("stage0/bin"); let sysroot_bin_dir = sysroot.join("bin"); t!(fs::create_dir_all(&sysroot_bin_dir)); - builder.cp_r(&stage0_bin_dir, &sysroot_bin_dir); + builder.cp_link_r(&stage0_bin_dir, &sysroot_bin_dir); // Copy all *.so files from stage0/lib to stage0-sysroot/lib let stage0_lib_dir = builder.out.join(host).join("stage0/lib"); @@ -646,7 +646,8 @@ impl Step for StdLink { let file = t!(file); let path = file.path(); if path.is_file() && is_dylib(&file.file_name().into_string().unwrap()) { - builder.copy(&path, &sysroot.join("lib").join(path.file_name().unwrap())); + builder + .copy_link(&path, &sysroot.join("lib").join(path.file_name().unwrap())); } } } @@ -661,7 +662,7 @@ impl Step for StdLink { .join(host) .join("codegen-backends"); if stage0_codegen_backends.exists() { - builder.cp_r(&stage0_codegen_backends, &sysroot_codegen_backends); + builder.cp_link_r(&stage0_codegen_backends, &sysroot_codegen_backends); } } } @@ -684,7 +685,7 @@ fn copy_sanitizers( for runtime in &runtimes { let dst = libdir.join(&runtime.name); - builder.copy(&runtime.path, &dst); + builder.copy_link(&runtime.path, &dst); // The `aarch64-apple-ios-macabi` and `x86_64-apple-ios-macabi` are also supported for // sanitizers, but they share a sanitizer runtime with `${arch}-apple-darwin`, so we do @@ -790,7 +791,7 @@ impl Step for StartupObjects { } let target = sysroot_dir.join((*file).to_string() + ".o"); - builder.copy(dst_file, &target); + builder.copy_link(dst_file, &target); target_deps.push((target, DependencyType::Target)); } @@ -812,7 +813,7 @@ fn cp_rustc_component_to_ci_sysroot( if src.is_dir() { t!(fs::create_dir_all(dst)); } else { - builder.copy(&src, &dst); + builder.copy_link(&src, &dst); } } } @@ -1443,7 +1444,7 @@ fn copy_codegen_backends_to_sysroot( let dot = filename.find('.').unwrap(); format!("{}-{}{}", &filename[..dash], builder.rust_release(), &filename[dot..]) }; - builder.copy(file, &dst.join(target_filename)); + builder.copy_link(file, &dst.join(target_filename)); } } @@ -1599,7 +1600,7 @@ impl Step for Sysroot { OsStr::new(std::env::consts::DLL_EXTENSION), ]; let ci_rustc_dir = builder.config.ci_rustc_dir(); - builder.cp_filtered(&ci_rustc_dir, &sysroot, &|path| { + builder.cp_link_filtered(&ci_rustc_dir, &sysroot, &|path| { if path.extension().map_or(true, |ext| !filtered_extensions.contains(&ext)) { return true; } @@ -1791,7 +1792,7 @@ impl Step for Assemble { let filename = f.file_name().into_string().unwrap(); if (is_dylib(&filename) || is_debug_info(&filename)) && !proc_macros.contains(&filename) { - builder.copy(&f.path(), &rustc_libdir.join(&filename)); + builder.copy_link(&f.path(), &rustc_libdir.join(&filename)); } } @@ -1805,7 +1806,7 @@ impl Step for Assemble { if let Some(lld_install) = lld_install { let src_exe = exe("lld", target_compiler.host); let dst_exe = exe("rust-lld", target_compiler.host); - builder.copy(&lld_install.join("bin").join(src_exe), &libdir_bin.join(dst_exe)); + builder.copy_link(&lld_install.join("bin").join(src_exe), &libdir_bin.join(dst_exe)); let self_contained_lld_dir = libdir_bin.join("gcc-ld"); t!(fs::create_dir_all(&self_contained_lld_dir)); let lld_wrapper_exe = builder.ensure(crate::core::build_steps::tool::LldWrapper { @@ -1813,7 +1814,7 @@ impl Step for Assemble { target: target_compiler.host, }); for name in crate::LLD_FILE_NAMES { - builder.copy( + builder.copy_link( &lld_wrapper_exe, &self_contained_lld_dir.join(exe(name, target_compiler.host)), ); @@ -1838,7 +1839,7 @@ impl Step for Assemble { // When using `download-ci-llvm`, some of the tools // may not exist, so skip trying to copy them. if src_path.exists() { - builder.copy(&src_path, &libdir_bin.join(&tool_exe)); + builder.copy_link(&src_path, &libdir_bin.join(&tool_exe)); } } } @@ -1851,7 +1852,7 @@ impl Step for Assemble { extra_features: vec![], }); let tool_exe = exe("llvm-bitcode-linker", target_compiler.host); - builder.copy(&src_path, &libdir_bin.join(&tool_exe)); + builder.copy_link(&src_path, &libdir_bin.join(&tool_exe)); } // Ensure that `libLLVM.so` ends up in the newly build compiler directory, @@ -1865,7 +1866,7 @@ impl Step for Assemble { let bindir = sysroot.join("bin"); t!(fs::create_dir_all(bindir)); let compiler = builder.rustc(target_compiler); - builder.copy(&rustc, &compiler); + builder.copy_link(&rustc, &compiler); target_compiler } @@ -1891,7 +1892,7 @@ pub fn add_to_sysroot( DependencyType::Target => sysroot_dst, DependencyType::TargetSelfContained => self_contained_dst, }; - builder.copy(&path, &dst.join(path.file_name().unwrap())); + builder.copy_link(&path, &dst.join(path.file_name().unwrap())); } } diff --git a/src/bootstrap/src/core/build_steps/dist.rs b/src/bootstrap/src/core/build_steps/dist.rs index 3efdfc324b86..012d64e53443 100644 --- a/src/bootstrap/src/core/build_steps/dist.rs +++ b/src/bootstrap/src/core/build_steps/dist.rs @@ -272,7 +272,7 @@ fn make_win_dist( let dist_bin_dir = rust_root.join("bin/"); fs::create_dir_all(&dist_bin_dir).expect("creating dist_bin_dir failed"); for src in rustc_dlls { - builder.copy_to_folder(&src, &dist_bin_dir); + builder.copy_link_to_folder(&src, &dist_bin_dir); } //Copy platform tools to platform-specific bin directory @@ -284,7 +284,7 @@ fn make_win_dist( .join("self-contained"); fs::create_dir_all(&target_bin_dir).expect("creating target_bin_dir failed"); for src in target_tools { - builder.copy_to_folder(&src, &target_bin_dir); + builder.copy_link_to_folder(&src, &target_bin_dir); } // Warn windows-gnu users that the bundled GCC cannot compile C files @@ -304,7 +304,7 @@ fn make_win_dist( .join("self-contained"); fs::create_dir_all(&target_lib_dir).expect("creating target_lib_dir failed"); for src in target_libs { - builder.copy_to_folder(&src, &target_lib_dir); + builder.copy_link_to_folder(&src, &target_lib_dir); } } @@ -400,7 +400,7 @@ impl Step for Rustc { // Copy rustc binary t!(fs::create_dir_all(image.join("bin"))); - builder.cp_r(&src.join("bin"), &image.join("bin")); + builder.cp_link_r(&src.join("bin"), &image.join("bin")); // If enabled, copy rustdoc binary if builder @@ -458,13 +458,13 @@ impl Step for Rustc { if builder.config.lld_enabled { let src_dir = builder.sysroot_libdir(compiler, host).parent().unwrap().join("bin"); let rust_lld = exe("rust-lld", compiler.host); - builder.copy(&src_dir.join(&rust_lld), &dst_dir.join(&rust_lld)); + builder.copy_link(&src_dir.join(&rust_lld), &dst_dir.join(&rust_lld)); let self_contained_lld_src_dir = src_dir.join("gcc-ld"); let self_contained_lld_dst_dir = dst_dir.join("gcc-ld"); t!(fs::create_dir(&self_contained_lld_dst_dir)); for name in crate::LLD_FILE_NAMES { let exe_name = exe(name, compiler.host); - builder.copy( + builder.copy_link( &self_contained_lld_src_dir.join(&exe_name), &self_contained_lld_dst_dir.join(&exe_name), ); @@ -609,9 +609,9 @@ fn copy_target_libs(builder: &Builder<'_>, target: TargetSelection, image: &Path t!(fs::create_dir_all(&self_contained_dst)); for (path, dependency_type) in builder.read_stamp_file(stamp) { if dependency_type == DependencyType::TargetSelfContained { - builder.copy(&path, &self_contained_dst.join(path.file_name().unwrap())); + builder.copy_link(&path, &self_contained_dst.join(path.file_name().unwrap())); } else if dependency_type == DependencyType::Target || builder.config.build == target { - builder.copy(&path, &dst.join(path.file_name().unwrap())); + builder.copy_link(&path, &dst.join(path.file_name().unwrap())); } } } @@ -865,7 +865,8 @@ fn copy_src_dirs( for item in src_dirs { let dst = &dst_dir.join(item); t!(fs::create_dir_all(dst)); - builder.cp_filtered(&base.join(item), dst, &|path| filter_fn(exclude_dirs, item, path)); + builder + .cp_link_filtered(&base.join(item), dst, &|path| filter_fn(exclude_dirs, item, path)); } } @@ -923,7 +924,7 @@ impl Step for Src { &dst_src, ); for file in src_files.iter() { - builder.copy(&builder.src.join(file), &dst_src.join(file)); + builder.copy_link(&builder.src.join(file), &dst_src.join(file)); } tarball.generate() @@ -979,7 +980,7 @@ impl Step for PlainSourceTarball { // Copy the files normally for item in &src_files { - builder.copy(&builder.src.join(item), &plain_dst_src.join(item)); + builder.copy_link(&builder.src.join(item), &plain_dst_src.join(item)); } // Create the version file @@ -1608,7 +1609,7 @@ impl Step for Extended { let prepare = |name: &str| { builder.create_dir(&pkg.join(name)); - builder.cp_r( + builder.cp_link_r( &work.join(format!("{}-{}", pkgname(builder, name), target.triple)), &pkg.join(name), ); @@ -1672,7 +1673,7 @@ impl Step for Extended { } else { name.to_string() }; - builder.cp_r( + builder.cp_link_r( &work.join(format!("{}-{}", pkgname(builder, name), target.triple)).join(dir), &exe.join(name), ); @@ -2040,7 +2041,7 @@ fn install_llvm_file( if install_symlink { // For download-ci-llvm, also install the symlink, to match what LLVM does. Using a // symlink is fine here, as this is not a rustup component. - builder.copy(&source, &full_dest); + builder.copy_link(&source, &full_dest); } else { // Otherwise, replace the symlink with an equivalent linker script. This is used when // projects like miri link against librustc_driver.so. We don't use a symlink, as diff --git a/src/bootstrap/src/core/build_steps/doc.rs b/src/bootstrap/src/core/build_steps/doc.rs index 1d4d9d4c2e1b..51b5cdc05657 100644 --- a/src/bootstrap/src/core/build_steps/doc.rs +++ b/src/bootstrap/src/core/build_steps/doc.rs @@ -520,7 +520,10 @@ impl Step for SharedAssets { t!(fs::write(&version_info, info)); } - builder.copy(&builder.src.join("src").join("doc").join("rust.css"), &out.join("rust.css")); + builder.copy_link( + &builder.src.join("src").join("doc").join("rust.css"), + &out.join("rust.css"), + ); SharedAssetsPaths { version_info } } @@ -718,7 +721,7 @@ fn doc_std( let _guard = builder.msg_doc(compiler, description, target); builder.run(&mut cargo.into()); - builder.cp_r(&out_dir, out); + builder.cp_link_r(&out_dir, out); } #[derive(Debug, Clone, Hash, PartialEq, Eq)] @@ -1151,7 +1154,7 @@ impl Step for RustcBook { let out_base = builder.md_doc_out(self.target).join("rustc"); t!(fs::create_dir_all(&out_base)); let out_listing = out_base.join("src/lints"); - builder.cp_r(&builder.src.join("src/doc/rustc"), &out_base); + builder.cp_link_r(&builder.src.join("src/doc/rustc"), &out_base); builder.info(&format!("Generating lint docs ({})", self.target)); let rustc = builder.rustc(self.compiler); diff --git a/src/bootstrap/src/core/build_steps/test.rs b/src/bootstrap/src/core/build_steps/test.rs index e9e2a881d111..690e20fb6b97 100644 --- a/src/bootstrap/src/core/build_steps/test.rs +++ b/src/bootstrap/src/core/build_steps/test.rs @@ -1367,7 +1367,7 @@ impl Step for RunMakeSupport { let cargo_out = builder.cargo_out(self.compiler, Mode::ToolStd, self.target).join(&lib_name); - builder.copy(&cargo_out, &lib); + builder.copy_link(&cargo_out, &lib); lib } } diff --git a/src/bootstrap/src/core/build_steps/tool.rs b/src/bootstrap/src/core/build_steps/tool.rs index 53dc1cff0aeb..3c2001121037 100644 --- a/src/bootstrap/src/core/build_steps/tool.rs +++ b/src/bootstrap/src/core/build_steps/tool.rs @@ -127,7 +127,7 @@ impl Step for ToolBuild { } let cargo_out = builder.cargo_out(compiler, self.mode, target).join(exe(tool, target)); let bin = builder.tools_dir(compiler).join(exe(tool, target)); - builder.copy(&cargo_out, &bin); + builder.copy_link(&cargo_out, &bin); bin } } @@ -507,7 +507,7 @@ impl Step for Rustdoc { t!(fs::create_dir_all(&bindir)); let bin_rustdoc = bindir.join(exe("rustdoc", target_compiler.host)); let _ = fs::remove_file(&bin_rustdoc); - builder.copy(&tool_rustdoc, &bin_rustdoc); + builder.copy_link(&tool_rustdoc, &bin_rustdoc); bin_rustdoc } else { tool_rustdoc @@ -686,7 +686,7 @@ impl Step for RustAnalyzerProcMacroSrv { // so that r-a can use it. let libexec_path = builder.sysroot(self.compiler).join("libexec"); t!(fs::create_dir_all(&libexec_path)); - builder.copy(&path, &libexec_path.join("rust-analyzer-proc-macro-srv")); + builder.copy_link(&path, &libexec_path.join("rust-analyzer-proc-macro-srv")); Some(path) } @@ -765,7 +765,7 @@ macro_rules! tool_extended { $(for add_bin in $add_bins_to_sysroot { let bin_source = tools_out.join(exe(add_bin, $sel.target)); let bin_destination = bindir.join(exe(add_bin, $sel.compiler.host)); - $builder.copy(&bin_source, &bin_destination); + $builder.copy_link(&bin_source, &bin_destination); })? let tool = bindir.join(exe($tool_name, $sel.compiler.host)); diff --git a/src/bootstrap/src/lib.rs b/src/bootstrap/src/lib.rs index 85211aabb74c..ea25015ba271 100644 --- a/src/bootstrap/src/lib.rs +++ b/src/bootstrap/src/lib.rs @@ -1646,16 +1646,19 @@ impl Build { paths } - /// Copies a file from `src` to `dst` - pub fn copy(&self, src: &Path, dst: &Path) { - self.copy_internal(src, dst, false); + /// Links a file from `src` to `dst`. + /// Attempts to use hard links if possible, falling back to copying. + /// You can neither rely on this being a copy nor it being a link, + /// so do not write to dst. + pub fn copy_link(&self, src: &Path, dst: &Path) { + self.copy_link_internal(src, dst, false); } - fn copy_internal(&self, src: &Path, dst: &Path, dereference_symlinks: bool) { + fn copy_link_internal(&self, src: &Path, dst: &Path, dereference_symlinks: bool) { if self.config.dry_run() { return; } - self.verbose_than(1, || println!("Copy {src:?} to {dst:?}")); + self.verbose_than(1, || println!("Copy/Link {src:?} to {dst:?}")); if src == dst { return; } @@ -1686,9 +1689,10 @@ impl Build { } } - /// Copies the `src` directory recursively to `dst`. Both are assumed to exist + /// Links the `src` directory recursively to `dst`. Both are assumed to exist /// when this function is called. - pub fn cp_r(&self, src: &Path, dst: &Path) { + /// Will attempt to use hard links if possible and fall back to copying. + pub fn cp_link_r(&self, src: &Path, dst: &Path) { if self.config.dry_run() { return; } @@ -1698,24 +1702,32 @@ impl Build { let dst = dst.join(name); if t!(f.file_type()).is_dir() { t!(fs::create_dir_all(&dst)); - self.cp_r(&path, &dst); + self.cp_link_r(&path, &dst); } else { let _ = fs::remove_file(&dst); - self.copy(&path, &dst); + self.copy_link(&path, &dst); } } } /// Copies the `src` directory recursively to `dst`. Both are assumed to exist - /// when this function is called. Unwanted files or directories can be skipped + /// when this function is called. + /// Will attempt to use hard links if possible and fall back to copying. + /// Unwanted files or directories can be skipped /// by returning `false` from the filter function. - pub fn cp_filtered(&self, src: &Path, dst: &Path, filter: &dyn Fn(&Path) -> bool) { + pub fn cp_link_filtered(&self, src: &Path, dst: &Path, filter: &dyn Fn(&Path) -> bool) { // Immediately recurse with an empty relative path - self.recurse_(src, dst, Path::new(""), filter) + self.cp_link_filtered_recurse(src, dst, Path::new(""), filter) } // Inner function does the actual work - fn recurse_(&self, src: &Path, dst: &Path, relative: &Path, filter: &dyn Fn(&Path) -> bool) { + fn cp_link_filtered_recurse( + &self, + src: &Path, + dst: &Path, + relative: &Path, + filter: &dyn Fn(&Path) -> bool, + ) { for f in self.read_dir(src) { let path = f.path(); let name = path.file_name().unwrap(); @@ -1726,19 +1738,19 @@ impl Build { if t!(f.file_type()).is_dir() { let _ = fs::remove_dir_all(&dst); self.create_dir(&dst); - self.recurse_(&path, &dst, &relative, filter); + self.cp_link_filtered_recurse(&path, &dst, &relative, filter); } else { let _ = fs::remove_file(&dst); - self.copy(&path, &dst); + self.copy_link(&path, &dst); } } } } - fn copy_to_folder(&self, src: &Path, dest_folder: &Path) { + fn copy_link_to_folder(&self, src: &Path, dest_folder: &Path) { let file_name = src.file_name().unwrap(); let dest = dest_folder.join(file_name); - self.copy(src, &dest); + self.copy_link(src, &dest); } fn install(&self, src: &Path, dstdir: &Path, perms: u32) { @@ -1751,7 +1763,7 @@ impl Build { if !src.exists() { panic!("ERROR: File \"{}\" not found!", src.display()); } - self.copy_internal(src, &dst, true); + self.copy_link_internal(src, &dst, true); chmod(&dst, perms); } diff --git a/src/bootstrap/src/utils/tarball.rs b/src/bootstrap/src/utils/tarball.rs index 03f56cba29d8..4f99079a57f3 100644 --- a/src/bootstrap/src/utils/tarball.rs +++ b/src/bootstrap/src/utils/tarball.rs @@ -197,7 +197,7 @@ impl<'a> Tarball<'a> { ) { let destdir = self.image_dir.join(destdir.as_ref()); t!(std::fs::create_dir_all(&destdir)); - self.builder.copy(src.as_ref(), &destdir.join(new_name)); + self.builder.copy_link(src.as_ref(), &destdir.join(new_name)); } pub(crate) fn add_legal_and_readme_to(&self, destdir: impl AsRef) { @@ -210,7 +210,7 @@ impl<'a> Tarball<'a> { let dest = self.image_dir.join(dest.as_ref()); t!(std::fs::create_dir_all(&dest)); - self.builder.cp_r(src.as_ref(), &dest); + self.builder.cp_link_r(src.as_ref(), &dest); } pub(crate) fn add_bulk_dir(&mut self, src: impl AsRef, dest: impl AsRef) { From 52f84fa7c2a1c096bda71475e4e3007110a60887 Mon Sep 17 00:00:00 2001 From: Nilstrieb <48135649+Nilstrieb@users.noreply.github.com> Date: Sat, 16 Mar 2024 12:57:36 +0100 Subject: [PATCH 092/103] Remove double remove_file --- src/bootstrap/src/lib.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/bootstrap/src/lib.rs b/src/bootstrap/src/lib.rs index ea25015ba271..f0fe994d155d 100644 --- a/src/bootstrap/src/lib.rs +++ b/src/bootstrap/src/lib.rs @@ -1704,7 +1704,6 @@ impl Build { t!(fs::create_dir_all(&dst)); self.cp_link_r(&path, &dst); } else { - let _ = fs::remove_file(&dst); self.copy_link(&path, &dst); } } From d5f92fc585b247be225950ca3345834d747e7750 Mon Sep 17 00:00:00 2001 From: Chris Denton Date: Sat, 16 Mar 2024 12:54:32 +0000 Subject: [PATCH 093/103] Remove Windows support note --- src/doc/rustc/src/platform-support.md | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/doc/rustc/src/platform-support.md b/src/doc/rustc/src/platform-support.md index 285c773afa2d..2ebbf5e15e66 100644 --- a/src/doc/rustc/src/platform-support.md +++ b/src/doc/rustc/src/platform-support.md @@ -33,16 +33,14 @@ All tier 1 targets with host tools support the full standard library. target | notes -------|------- `aarch64-unknown-linux-gnu` | ARM64 Linux (kernel 4.1, glibc 2.17+) -`i686-pc-windows-gnu` | 32-bit MinGW (Windows 10+) [^windows-support] [^x86_32-floats-return-ABI] -`i686-pc-windows-msvc` | 32-bit MSVC (Windows 10+) [^windows-support] [^x86_32-floats-return-ABI] +`i686-pc-windows-gnu` | 32-bit MinGW (Windows 10+) [^x86_32-floats-return-ABI] +`i686-pc-windows-msvc` | 32-bit MSVC (Windows 10+) [^x86_32-floats-return-ABI] `i686-unknown-linux-gnu` | 32-bit Linux (kernel 3.2+, glibc 2.17+) [^x86_32-floats-return-ABI] `x86_64-apple-darwin` | 64-bit macOS (10.12+, Sierra+) -`x86_64-pc-windows-gnu` | 64-bit MinGW (Windows 10+) [^windows-support] -`x86_64-pc-windows-msvc` | 64-bit MSVC (Windows 10+) [^windows-support] +`x86_64-pc-windows-gnu` | 64-bit MinGW (Windows 10+) +`x86_64-pc-windows-msvc` | 64-bit MSVC (Windows 10+) `x86_64-unknown-linux-gnu` | 64-bit Linux (kernel 3.2+, glibc 2.17+) -[^windows-support]: Only Windows 10 currently undergoes automated testing. Earlier versions of Windows rely on testing and support from the community. - [^x86_32-floats-return-ABI]: Due to limitations of the C ABI, floating-point support on `i686` targets is non-compliant: floating-point return values are passed via an x87 register, so NaN payload bits can be lost. See [issue #114479][x86-32-float-issue]. [77071]: https://github.com/rust-lang/rust/issues/77071 From 157289665241d564b714f3d375bc7bfa150e16d5 Mon Sep 17 00:00:00 2001 From: Mark Rousskov Date: Sat, 16 Mar 2024 09:56:09 -0400 Subject: [PATCH 094/103] Bump to 1.79.0 --- src/version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/version b/src/version index 54227249d1ff..b3a8c61e6a86 100644 --- a/src/version +++ b/src/version @@ -1 +1 @@ -1.78.0 +1.79.0 From 9f162c49cbc029dd5165da9293f41b812fc6b1b5 Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Sat, 16 Mar 2024 13:36:51 +0000 Subject: [PATCH 095/103] Rustup to rustc 1.78.0-nightly (c67326b06 2024-03-15) --- patches/stdlib-lock.toml | 7 ++----- rust-toolchain | 2 +- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/patches/stdlib-lock.toml b/patches/stdlib-lock.toml index 369f9c88be11..a72fa2c62a96 100644 --- a/patches/stdlib-lock.toml +++ b/patches/stdlib-lock.toml @@ -42,12 +42,9 @@ checksum = "0942ffc6dcaadf03badf6e6a2d0228460359d5e34b57ccdc720b7382dfbd5ec5" [[package]] name = "cc" -version = "1.0.83" +version = "1.0.90" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" -dependencies = [ - "libc", -] +checksum = "8cd6604a82acf3039f1144f54b8eb34e91ffba622051189e71b781822d5ee1f5" [[package]] name = "cfg-if" diff --git a/rust-toolchain b/rust-toolchain index 47b565ce0d04..f3cd4cbe4935 100644 --- a/rust-toolchain +++ b/rust-toolchain @@ -1,3 +1,3 @@ [toolchain] -channel = "nightly-2024-03-09" +channel = "nightly-2024-03-16" components = ["rust-src", "rustc-dev", "llvm-tools"] From e775fdc9e92939111255c7e228a211cff6e03485 Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Sat, 16 Mar 2024 16:17:58 +0000 Subject: [PATCH 096/103] Don't try to get a ty for a nested allocation Fixes rust-lang/rustc_codegen_cranelift#1464 --- example/std_example.rs | 8 ++++++++ src/constant.rs | 42 +++++++++++++++++++++++++++++------------- 2 files changed, 37 insertions(+), 13 deletions(-) diff --git a/example/std_example.rs b/example/std_example.rs index 9bd2ab5c638c..2fee912e52cc 100644 --- a/example/std_example.rs +++ b/example/std_example.rs @@ -167,6 +167,14 @@ fn main() { transmute_fat_pointer(); rust_call_abi(); + + const fn no_str() -> Option> { + None + } + + static STATIC_WITH_MAYBE_NESTED_BOX: &Option> = &no_str(); + + println!("{:?}", STATIC_WITH_MAYBE_NESTED_BOX); } fn panic(_: u128) { diff --git a/src/constant.rs b/src/constant.rs index cec479218b71..39fa277fedc5 100644 --- a/src/constant.rs +++ b/src/constant.rs @@ -53,7 +53,11 @@ pub(crate) fn codegen_tls_ref<'tcx>( let call = fx.bcx.ins().call(func_ref, &[]); fx.bcx.func.dfg.first_result(call) } else { - let data_id = data_id_for_static(fx.tcx, fx.module, def_id, false); + let data_id = data_id_for_static( + fx.tcx, fx.module, def_id, false, + // For a declaration the stated mutability doesn't matter. + false, + ); let local_data_id = fx.module.declare_data_in_func(data_id, &mut fx.bcx.func); if fx.clif_comments.enabled() { fx.add_comment(local_data_id, format!("tls {:?}", def_id)); @@ -164,7 +168,11 @@ pub(crate) fn codegen_const_value<'tcx>( } GlobalAlloc::Static(def_id) => { assert!(fx.tcx.is_static(def_id)); - let data_id = data_id_for_static(fx.tcx, fx.module, def_id, false); + let data_id = data_id_for_static( + fx.tcx, fx.module, def_id, false, + // For a declaration the stated mutability doesn't matter. + false, + ); let local_data_id = fx.module.declare_data_in_func(data_id, &mut fx.bcx.func); if fx.clif_comments.enabled() { @@ -232,21 +240,19 @@ fn data_id_for_static( module: &mut dyn Module, def_id: DefId, definition: bool, + definition_writable: bool, ) -> DataId { let attrs = tcx.codegen_fn_attrs(def_id); let instance = Instance::mono(tcx, def_id).polymorphize(tcx); let symbol_name = tcx.symbol_name(instance).name; - let ty = instance.ty(tcx, ParamEnv::reveal_all()); - let is_mutable = if tcx.is_mutable_static(def_id) { - true - } else { - !ty.is_freeze(tcx, ParamEnv::reveal_all()) - }; - let align = tcx.layout_of(ParamEnv::reveal_all().and(ty)).unwrap().align.pref.bytes(); if let Some(import_linkage) = attrs.import_linkage { assert!(!definition); + assert!(!tcx.is_mutable_static(def_id)); + + let ty = instance.ty(tcx, ParamEnv::reveal_all()); + let align = tcx.layout_of(ParamEnv::reveal_all().and(ty)).unwrap().align.pref.bytes(); let linkage = if import_linkage == rustc_middle::mir::mono::Linkage::ExternalWeak || import_linkage == rustc_middle::mir::mono::Linkage::WeakAny @@ -259,7 +265,7 @@ fn data_id_for_static( let data_id = match module.declare_data( symbol_name, linkage, - is_mutable, + false, attrs.flags.contains(CodegenFnAttrFlags::THREAD_LOCAL), ) { Ok(data_id) => data_id, @@ -307,7 +313,7 @@ fn data_id_for_static( let data_id = match module.declare_data( symbol_name, linkage, - is_mutable, + definition_writable, attrs.flags.contains(CodegenFnAttrFlags::THREAD_LOCAL), ) { Ok(data_id) => data_id, @@ -341,7 +347,13 @@ fn define_all_allocs(tcx: TyCtxt<'_>, module: &mut dyn Module, cx: &mut Constant let alloc = tcx.eval_static_initializer(def_id).unwrap(); - let data_id = data_id_for_static(tcx, module, def_id, true); + let data_id = data_id_for_static( + tcx, + module, + def_id, + true, + alloc.inner().mutability == Mutability::Mut, + ); (data_id, alloc, section_name) } }; @@ -421,7 +433,11 @@ fn define_all_allocs(tcx: TyCtxt<'_>, module: &mut dyn Module, cx: &mut Constant // Don't push a `TodoItem::Static` here, as it will cause statics used by // multiple crates to be duplicated between them. It isn't necessary anyway, // as it will get pushed by `codegen_static` when necessary. - data_id_for_static(tcx, module, def_id, false) + data_id_for_static( + tcx, module, def_id, false, + // For a declaration the stated mutability doesn't matter. + false, + ) } }; From 4cf4ffc6ba514f171b3f52d1c731063e4fc45be3 Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Sat, 16 Mar 2024 16:30:08 +0000 Subject: [PATCH 097/103] Fix rustc test suite --- scripts/test_rustc_tests.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/test_rustc_tests.sh b/scripts/test_rustc_tests.sh index f39487913c12..9b360fb30362 100755 --- a/scripts/test_rustc_tests.sh +++ b/scripts/test_rustc_tests.sh @@ -122,6 +122,7 @@ rm -r tests/run-make/optimization-remarks-dir # remarks are LLVM specific rm tests/ui/mir/mir_misc_casts.rs # depends on deduplication of constants rm tests/ui/mir/mir_raw_fat_ptr.rs # same rm tests/ui/consts/issue-33537.rs # same +rm tests/ui/consts/const-mut-refs-crate.rs # same # rustdoc-clif passes extra args, suppressing the help message when no args are passed rm -r tests/run-make/issue-88756-default-output From f2721338f624657da58e21a1e2cf827b3e54301a Mon Sep 17 00:00:00 2001 From: joboet Date: Sat, 16 Mar 2024 17:51:00 +0100 Subject: [PATCH 098/103] core: optimize `ptr::replace` --- library/core/src/ptr/mod.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/library/core/src/ptr/mod.rs b/library/core/src/ptr/mod.rs index 30af75223684..1f0204daf723 100644 --- a/library/core/src/ptr/mod.rs +++ b/library/core/src/ptr/mod.rs @@ -1114,7 +1114,7 @@ const unsafe fn swap_nonoverlapping_simple_untyped(x: *mut T, y: *mut T, coun #[stable(feature = "rust1", since = "1.0.0")] #[rustc_const_unstable(feature = "const_replace", issue = "83164")] #[rustc_diagnostic_item = "ptr_replace"] -pub const unsafe fn replace(dst: *mut T, mut src: T) -> T { +pub const unsafe fn replace(dst: *mut T, src: T) -> T { // SAFETY: the caller must guarantee that `dst` is valid to be // cast to a mutable reference (valid for writes, aligned, initialized), // and cannot overlap `src` since `dst` must point to a distinct @@ -1128,9 +1128,8 @@ pub const unsafe fn replace(dst: *mut T, mut src: T) -> T { align: usize = align_of::(), ) => is_aligned_and_not_null(addr, align) ); - mem::swap(&mut *dst, &mut src); // cannot overlap + mem::replace(&mut *dst, src) } - src } /// Reads the value from `src` without moving it. This leaves the From b2ed9d0911d010cd6aef2d038a47cb6294f0a443 Mon Sep 17 00:00:00 2001 From: Bryanskiy Date: Sat, 16 Mar 2024 21:03:36 +0300 Subject: [PATCH 099/103] Delegation: fix ICE on duplicated associative items --- compiler/rustc_ast_lowering/src/item.rs | 14 +++++------ .../duplicate-definition-inside-trait-impl.rs | 23 +++++++++++++++++++ ...licate-definition-inside-trait-impl.stderr | 23 +++++++++++++++++++ 3 files changed, 52 insertions(+), 8 deletions(-) create mode 100644 tests/ui/delegation/duplicate-definition-inside-trait-impl.rs create mode 100644 tests/ui/delegation/duplicate-definition-inside-trait-impl.stderr diff --git a/compiler/rustc_ast_lowering/src/item.rs b/compiler/rustc_ast_lowering/src/item.rs index 523001381864..2d03c854bd08 100644 --- a/compiler/rustc_ast_lowering/src/item.rs +++ b/compiler/rustc_ast_lowering/src/item.rs @@ -373,6 +373,7 @@ impl<'hir> LoweringContext<'_, 'hir> { (trait_ref, lowered_ty) }); + self.is_in_trait_impl = trait_ref.is_some(); let new_impl_items = self .arena .alloc_from_iter(impl_items.iter().map(|item| self.lower_impl_item_ref(item))); @@ -978,13 +979,6 @@ impl<'hir> LoweringContext<'_, 'hir> { } fn lower_impl_item_ref(&mut self, i: &AssocItem) -> hir::ImplItemRef { - let trait_item_def_id = self - .resolver - .get_partial_res(i.id) - .map(|r| r.expect_full_res().opt_def_id()) - .unwrap_or(None); - self.is_in_trait_impl = trait_item_def_id.is_some(); - hir::ImplItemRef { id: hir::ImplItemId { owner_id: hir::OwnerId { def_id: self.local_def_id(i.id) } }, ident: self.lower_ident(i.ident), @@ -1000,7 +994,11 @@ impl<'hir> LoweringContext<'_, 'hir> { }, AssocItemKind::MacCall(..) => unimplemented!(), }, - trait_item_def_id, + trait_item_def_id: self + .resolver + .get_partial_res(i.id) + .map(|r| r.expect_full_res().opt_def_id()) + .unwrap_or(None), } } diff --git a/tests/ui/delegation/duplicate-definition-inside-trait-impl.rs b/tests/ui/delegation/duplicate-definition-inside-trait-impl.rs new file mode 100644 index 000000000000..bd685b40b2ff --- /dev/null +++ b/tests/ui/delegation/duplicate-definition-inside-trait-impl.rs @@ -0,0 +1,23 @@ +#![feature(fn_delegation)] +//~^ WARN the feature `fn_delegation` is incomplete + +trait Trait { + fn foo(&self) -> u32 { 0 } +} + +struct F; +struct S; + +mod to_reuse { + use crate::S; + + pub fn foo(_: &S) -> u32 { 0 } +} + +impl Trait for S { + reuse to_reuse::foo { self } + reuse Trait::foo; + //~^ ERROR duplicate definitions with name `foo` +} + +fn main() {} diff --git a/tests/ui/delegation/duplicate-definition-inside-trait-impl.stderr b/tests/ui/delegation/duplicate-definition-inside-trait-impl.stderr new file mode 100644 index 000000000000..a5f9e6ad0bf4 --- /dev/null +++ b/tests/ui/delegation/duplicate-definition-inside-trait-impl.stderr @@ -0,0 +1,23 @@ +error[E0201]: duplicate definitions with name `foo`: + --> $DIR/duplicate-definition-inside-trait-impl.rs:19:5 + | +LL | fn foo(&self) -> u32 { 0 } + | -------------------------- item in trait +... +LL | reuse to_reuse::foo { self } + | ---------------------------- previous definition here +LL | reuse Trait::foo; + | ^^^^^^^^^^^^^^^^^ duplicate definition + +warning: the feature `fn_delegation` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/duplicate-definition-inside-trait-impl.rs:1:12 + | +LL | #![feature(fn_delegation)] + | ^^^^^^^^^^^^^ + | + = note: see issue #118212 for more information + = note: `#[warn(incomplete_features)]` on by default + +error: aborting due to 1 previous error; 1 warning emitted + +For more information about this error, try `rustc --explain E0201`. From fc42f3bfe38c1653b1de76118d4801bdc5732a37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=AE=B8=E6=9D=B0=E5=8F=8B=20Jieyou=20Xu=20=28Joe=29?= Date: Sat, 16 Mar 2024 19:15:45 +0000 Subject: [PATCH 100/103] Mention @jieyouxu for changes to compiletest, run-make tests and the run-make-support library --- triagebot.toml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/triagebot.toml b/triagebot.toml index c972dce1a022..89ffb2f41bb6 100644 --- a/triagebot.toml +++ b/triagebot.toml @@ -548,6 +548,10 @@ cc = ["@GuillaumeGomez"] message = "Some changes occurred in GUI tests." cc = ["@GuillaumeGomez"] +[mentions."tests/run-make/"] +message = "Some changes occurred in run-make tests." +cc = ["@jieyouxu"] + [mentions."src/librustdoc/html/static/css/themes/ayu.css"] message = "A change occurred in the Ayu theme." cc = ["@Cldfire"] @@ -571,10 +575,17 @@ cc = ["@ehuss"] [mentions."src/tools/clippy"] cc = ["@rust-lang/clippy"] +[mentions."src/tools/compiletest"] +cc = ["@jieyouxu"] + [mentions."src/tools/miri"] message = "The Miri subtree was changed" cc = ["@rust-lang/miri"] +[mentions."src/tools/run-make-support"] +message = "The run-make-support library was changed" +cc = ["@jieyouxu"] + [mentions."src/tools/rust-analyzer"] message = """ rust-analyzer is developed in its own repository. If possible, consider making \ From ad84934e6f87fbacb38ec9ec8068c870a1cb9c48 Mon Sep 17 00:00:00 2001 From: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com> Date: Sat, 16 Mar 2024 21:35:10 +0100 Subject: [PATCH 101/103] rustc-metadata: Store crate name in self-profile of metadata_register_crate When profiling a build of Zed, I found myself in need of names of crates that take the longest to register in downstream crates. --- compiler/rustc_metadata/src/creader.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/compiler/rustc_metadata/src/creader.rs b/compiler/rustc_metadata/src/creader.rs index 72757d90e423..20c992ef0c42 100644 --- a/compiler/rustc_metadata/src/creader.rs +++ b/compiler/rustc_metadata/src/creader.rs @@ -397,7 +397,8 @@ impl<'a, 'tcx> CrateLoader<'a, 'tcx> { name: Symbol, private_dep: Option, ) -> Result { - let _prof_timer = self.sess.prof.generic_activity("metadata_register_crate"); + let _prof_timer = + self.sess.prof.generic_activity_with_arg("metadata_register_crate", name.as_str()); let Library { source, metadata } = lib; let crate_root = metadata.get_root(); From 96674fce4ce73a231bae472d4e214f034eb2c4c9 Mon Sep 17 00:00:00 2001 From: The Miri Cronjob Bot Date: Sun, 17 Mar 2024 05:15:04 +0000 Subject: [PATCH 102/103] Preparing for merge from rustc --- src/tools/miri/rust-version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tools/miri/rust-version b/src/tools/miri/rust-version index e32968d8178e..f04e6e374799 100644 --- a/src/tools/miri/rust-version +++ b/src/tools/miri/rust-version @@ -1 +1 @@ -ee03c286cfdca26fa5b2a4ee40957625d2c826ff +a615cea3339046c7ab2d75cd253727d1fd42dd0b From 872781b22697882051481a4ed7c764551a8b2cf2 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Sun, 17 Mar 2024 19:32:03 +0100 Subject: [PATCH 103/103] interpret/memory: explain why we use == on bool --- compiler/rustc_const_eval/src/interpret/memory.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/compiler/rustc_const_eval/src/interpret/memory.rs b/compiler/rustc_const_eval/src/interpret/memory.rs index 86aad2e1642d..a6ca4b2e0de4 100644 --- a/compiler/rustc_const_eval/src/interpret/memory.rs +++ b/compiler/rustc_const_eval/src/interpret/memory.rs @@ -949,6 +949,8 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { /// Runs the close in "validation" mode, which means the machine's memory read hooks will be /// suppressed. Needless to say, this must only be set with great care! Cannot be nested. pub(super) fn run_for_validation(&self, f: impl FnOnce() -> R) -> R { + // This deliberately uses `==` on `bool` to follow the pattern + // `assert!(val.replace(new) == old)`. assert!( self.memory.validation_in_progress.replace(true) == false, "`validation_in_progress` was already set"
\ {name}\ {visibility_emoji}\ + {hidden_emoji}\ {unsafety_flag}\ {stab_tags}\