From 586a25aad9be17194913631f285dd2b8b9d8fbfa Mon Sep 17 00:00:00 2001 From: Boxy Date: Thu, 19 Jan 2023 19:53:33 +0000 Subject: [PATCH 1/8] make `Ty: Debug` be useful for debugging --- .../src/interpret/validity.rs | 6 +- .../rustc_middle/src/ty/structural_impls.rs | 2 +- .../src/traits/error_reporting/suggestions.rs | 2 +- .../ui/async-await/async-is-unwindsafe.stderr | 2 +- tests/ui/chalkify/bugs/async.stderr | 2 +- .../binder/nested-closures-regions.stderr | 38 ++++- ...re-print-generic-trim-off-verbose-2.stderr | 2 +- .../closure-print-generic-verbose-2.stderr | 2 +- .../print/closure-print-verbose.stderr | 2 +- .../print/generator-print-verbose-1.stderr | 62 ++++++++ .../impl-trait/normalize-tait-in-const.stderr | 2 +- tests/ui/layout/debug.stderr | 10 +- tests/ui/layout/hexagon-enum.stderr | 10 +- ...-scalarpair-payload-might-be-uninit.stderr | 10 +- .../issue-96185-overaligned-enum.stderr | 4 +- tests/ui/layout/thumb-enum.stderr | 10 +- .../layout/zero-sized-array-enum-niche.stderr | 8 +- .../escape-argument-callee.stderr | 25 +++- .../escape-argument.stderr | 22 ++- .../escape-upvar-nested.stderr | 68 ++++++++- .../escape-upvar-ref.stderr | 34 ++++- ...pagate-approximated-fail-no-postdom.stderr | 22 ++- .../propagate-approximated-ref.stderr | 34 ++++- ...er-to-static-comparing-against-free.stderr | 38 ++++- ...oximated-shorter-to-static-no-bound.stderr | 31 +++- ...mated-shorter-to-static-wrong-bound.stderr | 34 ++++- .../propagate-approximated-val.stderr | 22 ++- .../propagate-despite-same-free-region.stderr | 22 ++- ...ail-to-approximate-longer-no-bounds.stderr | 31 +++- ...-to-approximate-longer-wrong-bounds.stderr | 34 ++++- .../propagate-from-trait-match.stderr | 17 ++- .../return-wrong-bound-region.stderr | 22 ++- .../ty-outlives/impl-trait-captures.stderr | 4 +- .../projection-no-regions-closure.stderr | 68 ++++++--- .../projection-one-region-closure.stderr | 68 ++++++--- ...tion-one-region-trait-bound-closure.stderr | 77 +++++++--- ...e-region-trait-bound-static-closure.stderr | 75 ++++++++-- ...tion-two-region-trait-bound-closure.stderr | 136 +++++++++++++----- ...ram-closure-approximate-lower-bound.stderr | 48 +++++-- ...m-closure-outlives-from-return-type.stderr | 17 ++- ...-closure-outlives-from-where-clause.stderr | 68 ++++++--- .../user-annotations/dump-adt-brace-struct.rs | 6 +- .../dump-adt-brace-struct.stderr | 4 +- .../ui/nll/user-annotations/dump-fn-method.rs | 15 +- .../user-annotations/dump-fn-method.stderr | 16 +-- tests/ui/print_type_sizes/async.stdout | 22 +-- tests/ui/print_type_sizes/generator.stdout | 2 +- .../generator_discr_placement.stdout | 2 +- tests/ui/print_type_sizes/generics.stdout | 12 +- .../ui/print_type_sizes/multiple_types.stdout | 6 +- .../ui/print_type_sizes/niche-filling.stdout | 46 +++--- .../ui/print_type_sizes/no_duplicates.stdout | 2 +- tests/ui/print_type_sizes/packed.stdout | 8 +- tests/ui/print_type_sizes/padding.stdout | 6 +- tests/ui/print_type_sizes/repr-align.stdout | 6 +- tests/ui/print_type_sizes/repr_int_c.stdout | 4 +- tests/ui/print_type_sizes/uninhabited.stdout | 6 +- tests/ui/print_type_sizes/variants.stdout | 6 +- .../print_type_sizes/zero-sized-fields.stdout | 8 +- tests/ui/thir-print/thir-flat.stdout | 12 +- 60 files changed, 1069 insertions(+), 311 deletions(-) create mode 100644 tests/ui/generator/print/generator-print-verbose-1.stderr diff --git a/compiler/rustc_const_eval/src/interpret/validity.rs b/compiler/rustc_const_eval/src/interpret/validity.rs index aa539516d5e50..c4d130e19dd50 100644 --- a/compiler/rustc_const_eval/src/interpret/validity.rs +++ b/compiler/rustc_const_eval/src/interpret/validity.rs @@ -772,9 +772,9 @@ impl<'rt, 'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> ValueVisitor<'mir, 'tcx, M> // MyNewtype and then the scalar in there). match op.layout.abi { Abi::Uninhabited => { - throw_validation_failure!(self.path, - { "a value of uninhabited type {:?}", op.layout.ty } - ); + ty::print::with_no_trimmed_paths!(throw_validation_failure!(self.path, + { "a value of uninhabited type {}", op.layout.ty } + )); } Abi::Scalar(scalar_layout) => { if !scalar_layout.is_uninit_valid() { diff --git a/compiler/rustc_middle/src/ty/structural_impls.rs b/compiler/rustc_middle/src/ty/structural_impls.rs index 034aab0c38ea3..f3b0d6e095cdf 100644 --- a/compiler/rustc_middle/src/ty/structural_impls.rs +++ b/compiler/rustc_middle/src/ty/structural_impls.rs @@ -108,7 +108,7 @@ impl<'tcx> fmt::Debug for ty::TraitRef<'tcx> { impl<'tcx> fmt::Debug for Ty<'tcx> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - with_no_trimmed_paths!(fmt::Display::fmt(self, f)) + with_no_trimmed_paths!(fmt::Debug::fmt(self.kind(), f)) } } 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 b35b9d62759c7..46e02517afc50 100644 --- a/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs +++ b/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs @@ -1652,7 +1652,7 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> { ); } else { err.note(&format!( - "`{}` is implemented for `{:?}`, but not for `{:?}`", + "`{}` is implemented for `{}`, but not for `{}`", trait_pred.print_modifiers_and_trait_path(), suggested_ty, trait_pred.skip_binder().self_ty(), diff --git a/tests/ui/async-await/async-is-unwindsafe.stderr b/tests/ui/async-await/async-is-unwindsafe.stderr index d6404b30e74f1..9c487da8e1262 100644 --- a/tests/ui/async-await/async-is-unwindsafe.stderr +++ b/tests/ui/async-await/async-is-unwindsafe.stderr @@ -15,7 +15,7 @@ LL | | }); | within this `[async block@$DIR/async-is-unwindsafe.rs:12:19: 29:6]` | = help: within `[async block@$DIR/async-is-unwindsafe.rs:12:19: 29:6]`, the trait `UnwindSafe` is not implemented for `&mut Context<'_>` - = note: `UnwindSafe` is implemented for `&std::task::Context<'_>`, but not for `&mut std::task::Context<'_>` + = note: `UnwindSafe` is implemented for `&Context<'_>`, but not for `&mut Context<'_>` note: future does not implement `UnwindSafe` as this value is used across an await --> $DIR/async-is-unwindsafe.rs:25:17 | diff --git a/tests/ui/chalkify/bugs/async.stderr b/tests/ui/chalkify/bugs/async.stderr index 8043f1e5a0582..ae32e891b19af 100644 --- a/tests/ui/chalkify/bugs/async.stderr +++ b/tests/ui/chalkify/bugs/async.stderr @@ -37,7 +37,7 @@ LL | async fn foo(x: u32) -> u32 { = help: the trait `Future` is not implemented for `[async fn body@$DIR/async.rs:23:29: 25:2]` = note: [async fn body@$DIR/async.rs:23:29: 25:2] must be a future or must implement `IntoFuture` to be awaited -error: internal compiler error: projection clauses should be implied from elsewhere. obligation: `Obligation(predicate=Binder(ProjectionPredicate(AliasTy { substs: [[async fn body@$DIR/async.rs:23:29: 25:2]], def_id: ...) }, Term::Ty(u32)), []), depth=0)` +error: internal compiler error: projection clauses should be implied from elsewhere. obligation: `Obligation(predicate=Binder(ProjectionPredicate(AliasTy { substs: [Generator(...), [Adt(std::future::ResumeTy, []), Tuple([]), Uint(U32), Infer(_#7t), Infer(_#8t)], Static)], def_id: ...) }, Term::Ty(Uint(U32))), []), depth=0)` --> $DIR/async.rs:23:25 | LL | async fn foo(x: u32) -> u32 { diff --git a/tests/ui/closures/binder/nested-closures-regions.stderr b/tests/ui/closures/binder/nested-closures-regions.stderr index b385e0ed6e0a5..c883f0518c1ed 100644 --- a/tests/ui/closures/binder/nested-closures-regions.stderr +++ b/tests/ui/closures/binder/nested-closures-regions.stderr @@ -5,9 +5,22 @@ LL | for<'a> || -> () { for<'c> |_: &'a ()| -> () {}; }; | ^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: defining type: main::{closure#0}::{closure#0} with closure substs [ - i8, - extern "rust-call" fn((&(),)), - (), + Int( + I8, + ), + FnPtr( + Binder( + ([Tuple([Ref('_#1r, Tuple([]), Not)])]; c_variadic: false)->Tuple([]), + [ + Region( + BrNamed(DefId(0:7 ~ nested_closures_regions[ac46]::main::{closure#0}::{closure#0}::'c), 'c), + ), + ], + ), + ), + Tuple( + [], + ), ] = note: late-bound region is '_#4r = note: late-bound region is '_#2r @@ -22,9 +35,22 @@ LL | for<'a> || -> () { for<'c> |_: &'a ()| -> () {}; }; | ^^^^^^^^^^^^^^^^ | = note: defining type: main::{closure#0} with closure substs [ - i8, - extern "rust-call" fn(()), - (), + Int( + I8, + ), + FnPtr( + Binder( + ([Tuple([])]; c_variadic: false)->Tuple([]), + [ + Region( + BrNamed(DefId(0:5 ~ nested_closures_regions[ac46]::main::{closure#0}::'a), 'a), + ), + ], + ), + ), + Tuple( + [], + ), ] = note: late-bound region is '_#2r diff --git a/tests/ui/closures/print/closure-print-generic-trim-off-verbose-2.stderr b/tests/ui/closures/print/closure-print-generic-trim-off-verbose-2.stderr index ff89dd340349b..0f80b38aa5932 100644 --- a/tests/ui/closures/print/closure-print-generic-trim-off-verbose-2.stderr +++ b/tests/ui/closures/print/closure-print-generic-trim-off-verbose-2.stderr @@ -9,7 +9,7 @@ LL | let c1 : () = c; | expected due to this | = note: expected unit type `()` - found closure `[mod1::f::{closure#0} closure_substs=(unavailable) substs=[T, _#16t, extern "rust-call" fn(()), _#15t]]` + found closure `[mod1::f::{closure#0} closure_substs=(unavailable) substs=[Param(T/#0), Infer(_#16t), FnPtr(Binder(([Tuple([])]; c_variadic: false)->Tuple([]), [])), Infer(_#15t)]]` help: use parentheses to call this closure | LL | let c1 : () = c(); diff --git a/tests/ui/closures/print/closure-print-generic-verbose-2.stderr b/tests/ui/closures/print/closure-print-generic-verbose-2.stderr index 5bbf84f963d7e..634c5697fa71d 100644 --- a/tests/ui/closures/print/closure-print-generic-verbose-2.stderr +++ b/tests/ui/closures/print/closure-print-generic-verbose-2.stderr @@ -9,7 +9,7 @@ LL | let c1 : () = c; | expected due to this | = note: expected unit type `()` - found closure `[f::{closure#0} closure_substs=(unavailable) substs=[T, _#16t, extern "rust-call" fn(()), _#15t]]` + found closure `[f::{closure#0} closure_substs=(unavailable) substs=[Param(T/#0), Infer(_#16t), FnPtr(Binder(([Tuple([])]; c_variadic: false)->Tuple([]), [])), Infer(_#15t)]]` help: use parentheses to call this closure | LL | let c1 : () = c(); diff --git a/tests/ui/closures/print/closure-print-verbose.stderr b/tests/ui/closures/print/closure-print-verbose.stderr index 083717b333408..4a1ead9f787ec 100644 --- a/tests/ui/closures/print/closure-print-verbose.stderr +++ b/tests/ui/closures/print/closure-print-verbose.stderr @@ -7,7 +7,7 @@ LL | let foo: fn(u8) -> u8 = |v: u8| { a += v; a }; | expected due to this | = note: expected fn pointer `fn(u8) -> u8` - found closure `[main::{closure#0} closure_substs=(unavailable) substs=[i8, extern "rust-call" fn((u8,)) -> u8, _#6t]]` + found closure `[main::{closure#0} closure_substs=(unavailable) substs=[Int(I8), FnPtr(Binder(([Tuple([Uint(U8)])]; c_variadic: false)->Uint(U8), [])), Infer(_#6t)]]` note: closures can only be coerced to `fn` types if they do not capture any variables --> $DIR/closure-print-verbose.rs:10:39 | diff --git a/tests/ui/generator/print/generator-print-verbose-1.stderr b/tests/ui/generator/print/generator-print-verbose-1.stderr new file mode 100644 index 0000000000000..ac27ba49a1f4f --- /dev/null +++ b/tests/ui/generator/print/generator-print-verbose-1.stderr @@ -0,0 +1,62 @@ +error: generator cannot be sent between threads safely + --> $DIR/generator-print-verbose-1.rs:37:18 + | +LL | require_send(send_gen); + | ^^^^^^^^ generator is not `Send` + | + = help: the trait `Sync` is not implemented for `RefCell` +note: generator is not `Send` as this value is used across a yield + --> $DIR/generator-print-verbose-1.rs:35:9 + | +LL | let _non_send_gen = make_non_send_generator(); + | ------------- has type `Opaque(DefId(0:34 ~ generator_print_verbose_1[749a]::make_non_send_generator::{opaque#0}), [])` which is not `Send` +LL | yield; + | ^^^^^ yield occurs here, with `_non_send_gen` maybe used later +LL | }; + | - `_non_send_gen` is later dropped here +note: required by a bound in `require_send` + --> $DIR/generator-print-verbose-1.rs:26:25 + | +LL | fn require_send(_: impl Send) {} + | ^^^^ required by this bound in `require_send` + +error[E0277]: `RefCell` cannot be shared between threads safely + --> $DIR/generator-print-verbose-1.rs:56:18 + | +LL | require_send(send_gen); + | ------------ ^^^^^^^^ `RefCell` cannot be shared between threads safely + | | + | required by a bound introduced by this call + | + = help: the trait `Sync` is not implemented for `RefCell` + = note: required for `Arc>` to implement `Send` +note: required because it's used within this generator + --> $DIR/generator-print-verbose-1.rs:42:5 + | +LL | || { + | ^^ +note: required because it appears within the type `Opaque(DefId(0:35 ~ generator_print_verbose_1[749a]::make_gen2::{opaque#0}), [Adt(Arc, [Adt(RefCell, [Int(I32)])])])` + --> $DIR/generator-print-verbose-1.rs:41:30 + | +LL | pub fn make_gen2(t: T) -> impl Generator { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ +note: required because it appears within the type `Opaque(DefId(0:36 ~ generator_print_verbose_1[749a]::make_non_send_generator2::{opaque#0}), [])` + --> $DIR/generator-print-verbose-1.rs:47:34 + | +LL | fn make_non_send_generator2() -> impl Generator>> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: required because it captures the following types: `Opaque(DefId(0:36 ~ generator_print_verbose_1[749a]::make_non_send_generator2::{opaque#0}), [])`, `()` +note: required because it's used within this generator + --> $DIR/generator-print-verbose-1.rs:52:20 + | +LL | let send_gen = || { + | ^^ +note: required by a bound in `require_send` + --> $DIR/generator-print-verbose-1.rs:26:25 + | +LL | fn require_send(_: impl Send) {} + | ^^^^ required by this bound in `require_send` + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/impl-trait/normalize-tait-in-const.stderr b/tests/ui/impl-trait/normalize-tait-in-const.stderr index b9fc8726ffc0b..dc09a53a05792 100644 --- a/tests/ui/impl-trait/normalize-tait-in-const.stderr +++ b/tests/ui/impl-trait/normalize-tait-in-const.stderr @@ -1,4 +1,4 @@ -error: internal compiler error: compiler/rustc_middle/src/ty/normalize_erasing_regions.rs:198:90: Failed to normalize fn(&'a Alias<'b>) {foo} as std::ops::FnOnce<(&&S,)>>::Output, maybe try to call `try_normalize_erasing_regions` instead +error: internal compiler error: compiler/rustc_middle/src/ty/normalize_erasing_regions.rs:198:90: Failed to normalize Alias(Projection, AliasTy { substs: [FnDef(DefId(0:18 ~ normalize_tait_in_const[1c07]::foo), []), Tuple([Ref(ReErased, Ref(ReErased, Adt(S, []), Not), Not)])], def_id: DefId(2:2940 ~ core[a28e]::ops::function::FnOnce::Output) }), maybe try to call `try_normalize_erasing_regions` instead query stack during panic: #0 [eval_to_allocation_raw] const-evaluating + checking `BAR` diff --git a/tests/ui/layout/debug.stderr b/tests/ui/layout/debug.stderr index c5e1c41d1304c..3d08c9c11dd0a 100644 --- a/tests/ui/layout/debug.stderr +++ b/tests/ui/layout/debug.stderr @@ -1,4 +1,4 @@ -error: layout_of(E) = Layout { +error: layout_of(Adt(E, [])) = Layout { size: Size(12 bytes), align: AbiAndPrefAlign { abi: Align(4 bytes), @@ -86,7 +86,7 @@ error: layout_of(E) = Layout { LL | enum E { Foo, Bar(!, i32, i32) } | ^^^^^^ -error: layout_of(S) = Layout { +error: layout_of(Adt(S, [])) = Layout { size: Size(8 bytes), align: AbiAndPrefAlign { abi: Align(4 bytes), @@ -130,7 +130,7 @@ error: layout_of(S) = Layout { LL | struct S { f1: i32, f2: (), f3: i32 } | ^^^^^^^^ -error: layout_of(U) = Layout { +error: layout_of(Adt(U, [])) = Layout { size: Size(8 bytes), align: AbiAndPrefAlign { abi: Align(4 bytes), @@ -152,7 +152,7 @@ error: layout_of(U) = Layout { LL | union U { f1: (i32, i32), f3: i32 } | ^^^^^^^ -error: layout_of(std::result::Result) = Layout { +error: layout_of(Adt(std::result::Result, [Int(I32), Int(I32)])) = Layout { size: Size(8 bytes), align: AbiAndPrefAlign { abi: Align(4 bytes), @@ -281,7 +281,7 @@ error: layout_of(std::result::Result) = Layout { LL | type Test = Result; | ^^^^^^^^^ -error: layout_of(i32) = Layout { +error: layout_of(Int(I32)) = Layout { size: Size(4 bytes), align: AbiAndPrefAlign { abi: Align(4 bytes), diff --git a/tests/ui/layout/hexagon-enum.stderr b/tests/ui/layout/hexagon-enum.stderr index d850dd69c96e3..94509450e4679 100644 --- a/tests/ui/layout/hexagon-enum.stderr +++ b/tests/ui/layout/hexagon-enum.stderr @@ -1,4 +1,4 @@ -error: layout_of(A) = Layout { +error: layout_of(Adt(A, [])) = Layout { size: Size(1 bytes), align: AbiAndPrefAlign { abi: Align(1 bytes), @@ -68,7 +68,7 @@ error: layout_of(A) = Layout { LL | enum A { Apple } | ^^^^^^ -error: layout_of(B) = Layout { +error: layout_of(Adt(B, [])) = Layout { size: Size(1 bytes), align: AbiAndPrefAlign { abi: Align(1 bytes), @@ -138,7 +138,7 @@ error: layout_of(B) = Layout { LL | enum B { Banana = 255, } | ^^^^^^ -error: layout_of(C) = Layout { +error: layout_of(Adt(C, [])) = Layout { size: Size(2 bytes), align: AbiAndPrefAlign { abi: Align(2 bytes), @@ -208,7 +208,7 @@ error: layout_of(C) = Layout { LL | enum C { Chaenomeles = 256, } | ^^^^^^ -error: layout_of(P) = Layout { +error: layout_of(Adt(P, [])) = Layout { size: Size(4 bytes), align: AbiAndPrefAlign { abi: Align(4 bytes), @@ -278,7 +278,7 @@ error: layout_of(P) = Layout { LL | enum P { Peach = 0x1000_0000isize, } | ^^^^^^ -error: layout_of(T) = Layout { +error: layout_of(Adt(T, [])) = Layout { size: Size(4 bytes), align: AbiAndPrefAlign { abi: Align(4 bytes), diff --git a/tests/ui/layout/issue-96158-scalarpair-payload-might-be-uninit.stderr b/tests/ui/layout/issue-96158-scalarpair-payload-might-be-uninit.stderr index 20d4c418e879c..d50caa41db428 100644 --- a/tests/ui/layout/issue-96158-scalarpair-payload-might-be-uninit.stderr +++ b/tests/ui/layout/issue-96158-scalarpair-payload-might-be-uninit.stderr @@ -1,4 +1,4 @@ -error: layout_of(MissingPayloadField) = Layout { +error: layout_of(Adt(MissingPayloadField, [])) = Layout { size: Size(2 bytes), align: AbiAndPrefAlign { abi: Align(1 bytes), @@ -108,7 +108,7 @@ error: layout_of(MissingPayloadField) = Layout { LL | pub enum MissingPayloadField { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: layout_of(CommonPayloadField) = Layout { +error: layout_of(Adt(CommonPayloadField, [])) = Layout { size: Size(2 bytes), align: AbiAndPrefAlign { abi: Align(1 bytes), @@ -237,7 +237,7 @@ error: layout_of(CommonPayloadField) = Layout { LL | pub enum CommonPayloadField { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: layout_of(CommonPayloadFieldIsMaybeUninit) = Layout { +error: layout_of(Adt(CommonPayloadFieldIsMaybeUninit, [])) = Layout { size: Size(2 bytes), align: AbiAndPrefAlign { abi: Align(1 bytes), @@ -363,7 +363,7 @@ error: layout_of(CommonPayloadFieldIsMaybeUninit) = Layout { LL | pub enum CommonPayloadFieldIsMaybeUninit { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: layout_of(NicheFirst) = Layout { +error: layout_of(Adt(NicheFirst, [])) = Layout { size: Size(2 bytes), align: AbiAndPrefAlign { abi: Align(1 bytes), @@ -507,7 +507,7 @@ error: layout_of(NicheFirst) = Layout { LL | pub enum NicheFirst { | ^^^^^^^^^^^^^^^^^^^ -error: layout_of(NicheSecond) = Layout { +error: layout_of(Adt(NicheSecond, [])) = Layout { size: Size(2 bytes), align: AbiAndPrefAlign { abi: Align(1 bytes), diff --git a/tests/ui/layout/issue-96185-overaligned-enum.stderr b/tests/ui/layout/issue-96185-overaligned-enum.stderr index de6177c8dfc4d..4057ad19b8b49 100644 --- a/tests/ui/layout/issue-96185-overaligned-enum.stderr +++ b/tests/ui/layout/issue-96185-overaligned-enum.stderr @@ -1,4 +1,4 @@ -error: layout_of(Aligned1) = Layout { +error: layout_of(Adt(Aligned1, [])) = Layout { size: Size(8 bytes), align: AbiAndPrefAlign { abi: Align(8 bytes), @@ -80,7 +80,7 @@ error: layout_of(Aligned1) = Layout { LL | pub enum Aligned1 { | ^^^^^^^^^^^^^^^^^ -error: layout_of(Aligned2) = Layout { +error: layout_of(Adt(Aligned2, [])) = Layout { size: Size(1 bytes), align: AbiAndPrefAlign { abi: Align(1 bytes), diff --git a/tests/ui/layout/thumb-enum.stderr b/tests/ui/layout/thumb-enum.stderr index 227bd950b6666..b12d8528b6e45 100644 --- a/tests/ui/layout/thumb-enum.stderr +++ b/tests/ui/layout/thumb-enum.stderr @@ -1,4 +1,4 @@ -error: layout_of(A) = Layout { +error: layout_of(Adt(A, [])) = Layout { size: Size(1 bytes), align: AbiAndPrefAlign { abi: Align(1 bytes), @@ -68,7 +68,7 @@ error: layout_of(A) = Layout { LL | enum A { Apple } | ^^^^^^ -error: layout_of(B) = Layout { +error: layout_of(Adt(B, [])) = Layout { size: Size(1 bytes), align: AbiAndPrefAlign { abi: Align(1 bytes), @@ -138,7 +138,7 @@ error: layout_of(B) = Layout { LL | enum B { Banana = 255, } | ^^^^^^ -error: layout_of(C) = Layout { +error: layout_of(Adt(C, [])) = Layout { size: Size(2 bytes), align: AbiAndPrefAlign { abi: Align(2 bytes), @@ -208,7 +208,7 @@ error: layout_of(C) = Layout { LL | enum C { Chaenomeles = 256, } | ^^^^^^ -error: layout_of(P) = Layout { +error: layout_of(Adt(P, [])) = Layout { size: Size(4 bytes), align: AbiAndPrefAlign { abi: Align(4 bytes), @@ -278,7 +278,7 @@ error: layout_of(P) = Layout { LL | enum P { Peach = 0x1000_0000isize, } | ^^^^^^ -error: layout_of(T) = Layout { +error: layout_of(Adt(T, [])) = Layout { size: Size(4 bytes), align: AbiAndPrefAlign { abi: Align(4 bytes), diff --git a/tests/ui/layout/zero-sized-array-enum-niche.stderr b/tests/ui/layout/zero-sized-array-enum-niche.stderr index a3e82070e0f52..bae956d947b86 100644 --- a/tests/ui/layout/zero-sized-array-enum-niche.stderr +++ b/tests/ui/layout/zero-sized-array-enum-niche.stderr @@ -1,4 +1,4 @@ -error: layout_of(std::result::Result<[u32; 0], bool>) = Layout { +error: layout_of(Adt(std::result::Result, [Array(Uint(U32), Const { ty: Uint(Usize), kind: Value(Leaf(0x0000000000000000)) }), Bool])) = Layout { size: Size(4 bytes), align: AbiAndPrefAlign { abi: Align(4 bytes), @@ -97,7 +97,7 @@ error: layout_of(std::result::Result<[u32; 0], bool>) = Layout { LL | type AlignedResult = Result<[u32; 0], bool>; | ^^^^^^^^^^^^^^^^^^ -error: layout_of(MultipleAlignments) = Layout { +error: layout_of(Adt(MultipleAlignments, [])) = Layout { size: Size(4 bytes), align: AbiAndPrefAlign { abi: Align(4 bytes), @@ -218,7 +218,7 @@ error: layout_of(MultipleAlignments) = Layout { LL | enum MultipleAlignments { | ^^^^^^^^^^^^^^^^^^^^^^^ -error: layout_of(std::result::Result<[u32; 0], Packed>) = Layout { +error: layout_of(Adt(std::result::Result, [Array(Uint(U32), Const { ty: Uint(Usize), kind: Value(Leaf(0x0000000000000000)) }), Adt(Packed, [Adt(std::num::NonZeroU16, [])])])) = Layout { size: Size(4 bytes), align: AbiAndPrefAlign { abi: Align(4 bytes), @@ -317,7 +317,7 @@ error: layout_of(std::result::Result<[u32; 0], Packed>) = LL | type NicheLosesToTagged = Result<[u32; 0], Packed>; | ^^^^^^^^^^^^^^^^^^^^^^^ -error: layout_of(std::result::Result<[u32; 0], Packed>) = Layout { +error: layout_of(Adt(std::result::Result, [Array(Uint(U32), Const { ty: Uint(Usize), kind: Value(Leaf(0x0000000000000000)) }), Adt(Packed, [Adt(U16IsZero, [])])])) = Layout { size: Size(4 bytes), align: AbiAndPrefAlign { abi: Align(4 bytes), diff --git a/tests/ui/nll/closure-requirements/escape-argument-callee.stderr b/tests/ui/nll/closure-requirements/escape-argument-callee.stderr index 363ddfaffe06e..d92144a9c327e 100644 --- a/tests/ui/nll/closure-requirements/escape-argument-callee.stderr +++ b/tests/ui/nll/closure-requirements/escape-argument-callee.stderr @@ -5,9 +5,28 @@ LL | let mut closure = expect_sig(|p, y| *p = y); | ^^^^^^ | = note: defining type: test::{closure#0} with closure substs [ - i16, - for extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(0, None) }) mut &ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(1, None) }) i32, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 2, kind: BrAnon(2, None) }) i32)), - (), + Int( + I16, + ), + FnPtr( + Binder( + ([Tuple([Ref(ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(0, None) }), Ref(ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(1, None) }), Int(I32), Not), Mut), Ref(ReLateBound(DebruijnIndex(0), BoundRegion { var: 2, kind: BrAnon(2, None) }), Int(I32), Not)])]; c_variadic: false)->Tuple([]), + [ + Region( + BrAnon(0, None), + ), + Region( + BrAnon(1, None), + ), + Region( + BrAnon(2, None), + ), + ], + ), + ), + Tuple( + [], + ), ] error: lifetime may not live long enough diff --git a/tests/ui/nll/closure-requirements/escape-argument.stderr b/tests/ui/nll/closure-requirements/escape-argument.stderr index 5a8462d4dc56e..ef01374ebdf9c 100644 --- a/tests/ui/nll/closure-requirements/escape-argument.stderr +++ b/tests/ui/nll/closure-requirements/escape-argument.stderr @@ -5,9 +5,25 @@ LL | let mut closure = expect_sig(|p, y| *p = y); | ^^^^^^ | = note: defining type: test::{closure#0} with closure substs [ - i16, - for extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(0, None) }) mut &ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(1, None) }) i32, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(1, None) }) i32)), - (), + Int( + I16, + ), + FnPtr( + Binder( + ([Tuple([Ref(ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(0, None) }), Ref(ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(1, None) }), Int(I32), Not), Mut), Ref(ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(1, None) }), Int(I32), Not)])]; c_variadic: false)->Tuple([]), + [ + Region( + BrAnon(0, None), + ), + Region( + BrAnon(1, None), + ), + ], + ), + ), + Tuple( + [], + ), ] note: no external requirements diff --git a/tests/ui/nll/closure-requirements/escape-upvar-nested.stderr b/tests/ui/nll/closure-requirements/escape-upvar-nested.stderr index 4fbd5eb19a56c..7f47c42410d00 100644 --- a/tests/ui/nll/closure-requirements/escape-upvar-nested.stderr +++ b/tests/ui/nll/closure-requirements/escape-upvar-nested.stderr @@ -5,9 +5,37 @@ LL | let mut closure1 = || p = &y; | ^^ | = note: defining type: test::{closure#0}::{closure#0} with closure substs [ - i16, - extern "rust-call" fn(()), - (&'_#1r mut &'_#2r i32, &'_#3r i32), + Int( + I16, + ), + FnPtr( + Binder( + ([Tuple([])]; c_variadic: false)->Tuple([]), + [], + ), + ), + Tuple( + [ + Ref( + '_#1r, + Ref( + '_#2r, + Int( + I32, + ), + Not, + ), + Mut, + ), + Ref( + '_#3r, + Int( + I32, + ), + Not, + ), + ], + ), ] = note: number of external vids: 4 = note: where '_#3r: '_#2r @@ -19,9 +47,37 @@ LL | let mut closure = || { | ^^ | = note: defining type: test::{closure#0} with closure substs [ - i16, - extern "rust-call" fn(()), - (&'_#1r mut &'_#2r i32, &'_#3r i32), + Int( + I16, + ), + FnPtr( + Binder( + ([Tuple([])]; c_variadic: false)->Tuple([]), + [], + ), + ), + Tuple( + [ + Ref( + '_#1r, + Ref( + '_#2r, + Int( + I32, + ), + Not, + ), + Mut, + ), + Ref( + '_#3r, + Int( + I32, + ), + Not, + ), + ], + ), ] = note: number of external vids: 4 = note: where '_#3r: '_#2r diff --git a/tests/ui/nll/closure-requirements/escape-upvar-ref.stderr b/tests/ui/nll/closure-requirements/escape-upvar-ref.stderr index bc1ceac5bf01e..0398b3cfed403 100644 --- a/tests/ui/nll/closure-requirements/escape-upvar-ref.stderr +++ b/tests/ui/nll/closure-requirements/escape-upvar-ref.stderr @@ -5,9 +5,37 @@ LL | let mut closure = || p = &y; | ^^ | = note: defining type: test::{closure#0} with closure substs [ - i16, - extern "rust-call" fn(()), - (&'_#1r mut &'_#2r i32, &'_#3r i32), + Int( + I16, + ), + FnPtr( + Binder( + ([Tuple([])]; c_variadic: false)->Tuple([]), + [], + ), + ), + Tuple( + [ + Ref( + '_#1r, + Ref( + '_#2r, + Int( + I32, + ), + Not, + ), + Mut, + ), + Ref( + '_#3r, + Int( + I32, + ), + Not, + ), + ], + ), ] = note: number of external vids: 4 = note: where '_#3r: '_#2r diff --git a/tests/ui/nll/closure-requirements/propagate-approximated-fail-no-postdom.stderr b/tests/ui/nll/closure-requirements/propagate-approximated-fail-no-postdom.stderr index 7da6ce58bf7fc..72309d478c8d9 100644 --- a/tests/ui/nll/closure-requirements/propagate-approximated-fail-no-postdom.stderr +++ b/tests/ui/nll/closure-requirements/propagate-approximated-fail-no-postdom.stderr @@ -5,9 +5,25 @@ LL | |_outlives1, _outlives2, _outlives3, x, y| { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: defining type: supply::{closure#0} with closure substs [ - i16, - for extern "rust-call" fn((std::cell::Cell<&'_#1r &ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(0, None) }) u32>, std::cell::Cell<&'_#2r &ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(0, None) }) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(1, None) }) &'_#3r u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(0, None) }) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(1, None) }) u32>)), - (), + Int( + I16, + ), + FnPtr( + Binder( + ([Tuple([Adt(std::cell::Cell, [Ref('_#1r, Ref(ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(0, None) }), Uint(U32), Not), Not)]), Adt(std::cell::Cell, [Ref('_#2r, Ref(ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(0, None) }), Uint(U32), Not), Not)]), Adt(std::cell::Cell, [Ref(ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(1, None) }), Ref('_#3r, Uint(U32), Not), Not)]), Adt(std::cell::Cell, [Ref(ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(0, None) }), Uint(U32), Not)]), Adt(std::cell::Cell, [Ref(ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(1, None) }), Uint(U32), Not)])])]; c_variadic: false)->Tuple([]), + [ + Region( + BrAnon(0, None), + ), + Region( + BrAnon(1, None), + ), + ], + ), + ), + Tuple( + [], + ), ] = note: late-bound region is '_#4r = note: late-bound region is '_#5r diff --git a/tests/ui/nll/closure-requirements/propagate-approximated-ref.stderr b/tests/ui/nll/closure-requirements/propagate-approximated-ref.stderr index 993687605c4af..f6bf7df7bcf52 100644 --- a/tests/ui/nll/closure-requirements/propagate-approximated-ref.stderr +++ b/tests/ui/nll/closure-requirements/propagate-approximated-ref.stderr @@ -5,9 +5,37 @@ LL | establish_relationships(&cell_a, &cell_b, |_outlives1, _outlives2, x, y | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: defining type: supply::{closure#0} with closure substs [ - i16, - for extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(0, None) }) std::cell::Cell<&'_#1r &ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(1, None) }) u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 2, kind: BrAnon(2, None) }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 3, kind: BrAnon(3, None) }) &'_#2r u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 4, kind: BrAnon(4, None) }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(1, None) }) u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 5, kind: BrAnon(5, None) }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 3, kind: BrAnon(3, None) }) u32>)), - (), + Int( + I16, + ), + FnPtr( + Binder( + ([Tuple([Ref(ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(0, None) }), Adt(std::cell::Cell, [Ref('_#1r, Ref(ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(1, None) }), Uint(U32), Not), Not)]), Not), Ref(ReLateBound(DebruijnIndex(0), BoundRegion { var: 2, kind: BrAnon(2, None) }), Adt(std::cell::Cell, [Ref(ReLateBound(DebruijnIndex(0), BoundRegion { var: 3, kind: BrAnon(3, None) }), Ref('_#2r, Uint(U32), Not), Not)]), Not), Ref(ReLateBound(DebruijnIndex(0), BoundRegion { var: 4, kind: BrAnon(4, None) }), Adt(std::cell::Cell, [Ref(ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(1, None) }), Uint(U32), Not)]), Not), Ref(ReLateBound(DebruijnIndex(0), BoundRegion { var: 5, kind: BrAnon(5, None) }), Adt(std::cell::Cell, [Ref(ReLateBound(DebruijnIndex(0), BoundRegion { var: 3, kind: BrAnon(3, None) }), Uint(U32), Not)]), Not)])]; c_variadic: false)->Tuple([]), + [ + Region( + BrAnon(0, None), + ), + Region( + BrAnon(1, None), + ), + Region( + BrAnon(2, None), + ), + Region( + BrAnon(3, None), + ), + Region( + BrAnon(4, None), + ), + Region( + BrAnon(5, None), + ), + ], + ), + ), + Tuple( + [], + ), ] = note: late-bound region is '_#3r = note: late-bound region is '_#4r diff --git a/tests/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-comparing-against-free.stderr b/tests/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-comparing-against-free.stderr index 721cd45ded98e..94402cfb5cab8 100644 --- a/tests/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-comparing-against-free.stderr +++ b/tests/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-comparing-against-free.stderr @@ -5,9 +5,22 @@ LL | foo(cell, |cell_a, cell_x| { | ^^^^^^^^^^^^^^^^ | = note: defining type: case1::{closure#0} with closure substs [ - i32, - for extern "rust-call" fn((std::cell::Cell<&'_#1r u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(0, None) }) u32>)), - (), + Int( + I32, + ), + FnPtr( + Binder( + ([Tuple([Adt(std::cell::Cell, [Ref('_#1r, Uint(U32), Not)]), Adt(std::cell::Cell, [Ref(ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(0, None) }), Uint(U32), Not)])])]; c_variadic: false)->Tuple([]), + [ + Region( + BrAnon(0, None), + ), + ], + ), + ), + Tuple( + [], + ), ] error[E0521]: borrowed data escapes outside of closure @@ -35,9 +48,22 @@ LL | foo(cell, |cell_a, cell_x| { | ^^^^^^^^^^^^^^^^ | = note: defining type: case2::{closure#0} with closure substs [ - i32, - for extern "rust-call" fn((std::cell::Cell<&'_#1r u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(0, None) }) u32>)), - (), + Int( + I32, + ), + FnPtr( + Binder( + ([Tuple([Adt(std::cell::Cell, [Ref('_#1r, Uint(U32), Not)]), Adt(std::cell::Cell, [Ref(ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(0, None) }), Uint(U32), Not)])])]; c_variadic: false)->Tuple([]), + [ + Region( + BrAnon(0, None), + ), + ], + ), + ), + Tuple( + [], + ), ] = note: number of external vids: 2 = note: where '_#1r: '_#0r diff --git a/tests/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-no-bound.stderr b/tests/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-no-bound.stderr index 43dfc3bb9f835..c2384638ca2d3 100644 --- a/tests/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-no-bound.stderr +++ b/tests/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-no-bound.stderr @@ -5,9 +5,34 @@ LL | establish_relationships(&cell_a, &cell_b, |_outlives, x, y| { | ^^^^^^^^^^^^^^^^^ | = note: defining type: supply::{closure#0} with closure substs [ - i16, - for extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(0, None) }) std::cell::Cell<&'_#1r &ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(1, None) }) u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 2, kind: BrAnon(2, None) }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(1, None) }) u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 3, kind: BrAnon(3, None) }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 4, kind: BrAnon(4, None) }) u32>)), - (), + Int( + I16, + ), + FnPtr( + Binder( + ([Tuple([Ref(ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(0, None) }), Adt(std::cell::Cell, [Ref('_#1r, Ref(ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(1, None) }), Uint(U32), Not), Not)]), Not), Ref(ReLateBound(DebruijnIndex(0), BoundRegion { var: 2, kind: BrAnon(2, None) }), Adt(std::cell::Cell, [Ref(ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(1, None) }), Uint(U32), Not)]), Not), Ref(ReLateBound(DebruijnIndex(0), BoundRegion { var: 3, kind: BrAnon(3, None) }), Adt(std::cell::Cell, [Ref(ReLateBound(DebruijnIndex(0), BoundRegion { var: 4, kind: BrAnon(4, None) }), Uint(U32), Not)]), Not)])]; c_variadic: false)->Tuple([]), + [ + Region( + BrAnon(0, None), + ), + Region( + BrAnon(1, None), + ), + Region( + BrAnon(2, None), + ), + Region( + BrAnon(3, None), + ), + Region( + BrAnon(4, None), + ), + ], + ), + ), + Tuple( + [], + ), ] = note: late-bound region is '_#2r = note: late-bound region is '_#3r diff --git a/tests/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-wrong-bound.stderr b/tests/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-wrong-bound.stderr index 96c734226eff9..589fcdadd35c2 100644 --- a/tests/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-wrong-bound.stderr +++ b/tests/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-wrong-bound.stderr @@ -5,9 +5,37 @@ LL | establish_relationships(&cell_a, &cell_b, |_outlives1, _outlives2, x, y | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: defining type: supply::{closure#0} with closure substs [ - i16, - for extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(0, None) }) std::cell::Cell<&'_#1r &ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(1, None) }) u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 2, kind: BrAnon(2, None) }) std::cell::Cell<&'_#2r &ReLateBound(DebruijnIndex(0), BoundRegion { var: 3, kind: BrAnon(3, None) }) u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 4, kind: BrAnon(4, None) }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(1, None) }) u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 5, kind: BrAnon(5, None) }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 3, kind: BrAnon(3, None) }) u32>)), - (), + Int( + I16, + ), + FnPtr( + Binder( + ([Tuple([Ref(ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(0, None) }), Adt(std::cell::Cell, [Ref('_#1r, Ref(ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(1, None) }), Uint(U32), Not), Not)]), Not), Ref(ReLateBound(DebruijnIndex(0), BoundRegion { var: 2, kind: BrAnon(2, None) }), Adt(std::cell::Cell, [Ref('_#2r, Ref(ReLateBound(DebruijnIndex(0), BoundRegion { var: 3, kind: BrAnon(3, None) }), Uint(U32), Not), Not)]), Not), Ref(ReLateBound(DebruijnIndex(0), BoundRegion { var: 4, kind: BrAnon(4, None) }), Adt(std::cell::Cell, [Ref(ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(1, None) }), Uint(U32), Not)]), Not), Ref(ReLateBound(DebruijnIndex(0), BoundRegion { var: 5, kind: BrAnon(5, None) }), Adt(std::cell::Cell, [Ref(ReLateBound(DebruijnIndex(0), BoundRegion { var: 3, kind: BrAnon(3, None) }), Uint(U32), Not)]), Not)])]; c_variadic: false)->Tuple([]), + [ + Region( + BrAnon(0, None), + ), + Region( + BrAnon(1, None), + ), + Region( + BrAnon(2, None), + ), + Region( + BrAnon(3, None), + ), + Region( + BrAnon(4, None), + ), + Region( + BrAnon(5, None), + ), + ], + ), + ), + Tuple( + [], + ), ] = note: late-bound region is '_#3r = note: late-bound region is '_#4r diff --git a/tests/ui/nll/closure-requirements/propagate-approximated-val.stderr b/tests/ui/nll/closure-requirements/propagate-approximated-val.stderr index 03dbd686e4976..8c5ae41177b08 100644 --- a/tests/ui/nll/closure-requirements/propagate-approximated-val.stderr +++ b/tests/ui/nll/closure-requirements/propagate-approximated-val.stderr @@ -5,9 +5,25 @@ LL | establish_relationships(cell_a, cell_b, |outlives1, outlives2, x, y| { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: defining type: test::{closure#0} with closure substs [ - i16, - for extern "rust-call" fn((std::cell::Cell<&'_#1r &ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(0, None) }) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(1, None) }) &'_#2r u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(0, None) }) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(1, None) }) u32>)), - (), + Int( + I16, + ), + FnPtr( + Binder( + ([Tuple([Adt(std::cell::Cell, [Ref('_#1r, Ref(ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(0, None) }), Uint(U32), Not), Not)]), Adt(std::cell::Cell, [Ref(ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(1, None) }), Ref('_#2r, Uint(U32), Not), Not)]), Adt(std::cell::Cell, [Ref(ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(0, None) }), Uint(U32), Not)]), Adt(std::cell::Cell, [Ref(ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(1, None) }), Uint(U32), Not)])])]; c_variadic: false)->Tuple([]), + [ + Region( + BrAnon(0, None), + ), + Region( + BrAnon(1, None), + ), + ], + ), + ), + Tuple( + [], + ), ] = note: late-bound region is '_#3r = note: late-bound region is '_#4r diff --git a/tests/ui/nll/closure-requirements/propagate-despite-same-free-region.stderr b/tests/ui/nll/closure-requirements/propagate-despite-same-free-region.stderr index d716d3de2a115..a2fd0e5306d83 100644 --- a/tests/ui/nll/closure-requirements/propagate-despite-same-free-region.stderr +++ b/tests/ui/nll/closure-requirements/propagate-despite-same-free-region.stderr @@ -5,9 +5,25 @@ LL | |_outlives1, _outlives2, x, y| { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: defining type: supply::{closure#0} with closure substs [ - i16, - for extern "rust-call" fn((std::cell::Cell<&'_#1r &ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(0, None) }) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(1, None) }) &'_#2r u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(0, None) }) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(1, None) }) u32>)), - (), + Int( + I16, + ), + FnPtr( + Binder( + ([Tuple([Adt(std::cell::Cell, [Ref('_#1r, Ref(ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(0, None) }), Uint(U32), Not), Not)]), Adt(std::cell::Cell, [Ref(ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(1, None) }), Ref('_#2r, Uint(U32), Not), Not)]), Adt(std::cell::Cell, [Ref(ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(0, None) }), Uint(U32), Not)]), Adt(std::cell::Cell, [Ref(ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(1, None) }), Uint(U32), Not)])])]; c_variadic: false)->Tuple([]), + [ + Region( + BrAnon(0, None), + ), + Region( + BrAnon(1, None), + ), + ], + ), + ), + Tuple( + [], + ), ] = note: late-bound region is '_#3r = note: number of external vids: 4 diff --git a/tests/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-no-bounds.stderr b/tests/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-no-bounds.stderr index b924873fca6f0..0d32404ab650c 100644 --- a/tests/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-no-bounds.stderr +++ b/tests/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-no-bounds.stderr @@ -5,9 +5,34 @@ LL | establish_relationships(&cell_a, &cell_b, |_outlives, x, y| { | ^^^^^^^^^^^^^^^^^ | = note: defining type: supply::{closure#0} with closure substs [ - i16, - for extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(0, None) }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(1, None) }) &'_#1r u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 2, kind: BrAnon(2, None) }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 3, kind: BrAnon(3, None) }) u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 4, kind: BrAnon(4, None) }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(1, None) }) u32>)), - (), + Int( + I16, + ), + FnPtr( + Binder( + ([Tuple([Ref(ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(0, None) }), Adt(std::cell::Cell, [Ref(ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(1, None) }), Ref('_#1r, Uint(U32), Not), Not)]), Not), Ref(ReLateBound(DebruijnIndex(0), BoundRegion { var: 2, kind: BrAnon(2, None) }), Adt(std::cell::Cell, [Ref(ReLateBound(DebruijnIndex(0), BoundRegion { var: 3, kind: BrAnon(3, None) }), Uint(U32), Not)]), Not), Ref(ReLateBound(DebruijnIndex(0), BoundRegion { var: 4, kind: BrAnon(4, None) }), Adt(std::cell::Cell, [Ref(ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(1, None) }), Uint(U32), Not)]), Not)])]; c_variadic: false)->Tuple([]), + [ + Region( + BrAnon(0, None), + ), + Region( + BrAnon(1, None), + ), + Region( + BrAnon(2, None), + ), + Region( + BrAnon(3, None), + ), + Region( + BrAnon(4, None), + ), + ], + ), + ), + Tuple( + [], + ), ] = note: late-bound region is '_#2r = note: late-bound region is '_#3r diff --git a/tests/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-wrong-bounds.stderr b/tests/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-wrong-bounds.stderr index 9b25efd0b66b1..c3c340eef251d 100644 --- a/tests/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-wrong-bounds.stderr +++ b/tests/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-wrong-bounds.stderr @@ -5,9 +5,37 @@ LL | establish_relationships(&cell_a, &cell_b, |_outlives1, _outlives2, x, y | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: defining type: supply::{closure#0} with closure substs [ - i16, - for extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(0, None) }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(1, None) }) &'_#1r u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 2, kind: BrAnon(2, None) }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 3, kind: BrAnon(3, None) }) &'_#2r u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 4, kind: BrAnon(4, None) }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(1, None) }) u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 5, kind: BrAnon(5, None) }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 3, kind: BrAnon(3, None) }) u32>)), - (), + Int( + I16, + ), + FnPtr( + Binder( + ([Tuple([Ref(ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(0, None) }), Adt(std::cell::Cell, [Ref(ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(1, None) }), Ref('_#1r, Uint(U32), Not), Not)]), Not), Ref(ReLateBound(DebruijnIndex(0), BoundRegion { var: 2, kind: BrAnon(2, None) }), Adt(std::cell::Cell, [Ref(ReLateBound(DebruijnIndex(0), BoundRegion { var: 3, kind: BrAnon(3, None) }), Ref('_#2r, Uint(U32), Not), Not)]), Not), Ref(ReLateBound(DebruijnIndex(0), BoundRegion { var: 4, kind: BrAnon(4, None) }), Adt(std::cell::Cell, [Ref(ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(1, None) }), Uint(U32), Not)]), Not), Ref(ReLateBound(DebruijnIndex(0), BoundRegion { var: 5, kind: BrAnon(5, None) }), Adt(std::cell::Cell, [Ref(ReLateBound(DebruijnIndex(0), BoundRegion { var: 3, kind: BrAnon(3, None) }), Uint(U32), Not)]), Not)])]; c_variadic: false)->Tuple([]), + [ + Region( + BrAnon(0, None), + ), + Region( + BrAnon(1, None), + ), + Region( + BrAnon(2, None), + ), + Region( + BrAnon(3, None), + ), + Region( + BrAnon(4, None), + ), + Region( + BrAnon(5, None), + ), + ], + ), + ), + Tuple( + [], + ), ] = note: late-bound region is '_#3r = note: late-bound region is '_#4r diff --git a/tests/ui/nll/closure-requirements/propagate-from-trait-match.stderr b/tests/ui/nll/closure-requirements/propagate-from-trait-match.stderr index 038a5e11f88ce..3b3a3955fb610 100644 --- a/tests/ui/nll/closure-requirements/propagate-from-trait-match.stderr +++ b/tests/ui/nll/closure-requirements/propagate-from-trait-match.stderr @@ -5,12 +5,21 @@ LL | establish_relationships(value, |value| { | ^^^^^^^ | = note: defining type: supply::<'_#1r, T>::{closure#0} with closure substs [ - i32, - extern "rust-call" fn((T,)), - (), + Int( + I32, + ), + FnPtr( + Binder( + ([Tuple([Param(T/#1)])]; c_variadic: false)->Tuple([]), + [], + ), + ), + Tuple( + [], + ), ] = note: number of external vids: 2 - = note: where T: '_#1r + = note: where Param(T/#1): '_#1r note: no external requirements --> $DIR/propagate-from-trait-match.rs:28:1 diff --git a/tests/ui/nll/closure-requirements/return-wrong-bound-region.stderr b/tests/ui/nll/closure-requirements/return-wrong-bound-region.stderr index 6db72b8863258..178b3d525c451 100644 --- a/tests/ui/nll/closure-requirements/return-wrong-bound-region.stderr +++ b/tests/ui/nll/closure-requirements/return-wrong-bound-region.stderr @@ -5,9 +5,25 @@ LL | expect_sig(|a, b| b); // ought to return `a` | ^^^^^^ | = note: defining type: test::{closure#0} with closure substs [ - i16, - for extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(0, None) }) i32, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(1, None) }) i32)) -> &ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(0, None) }) i32, - (), + Int( + I16, + ), + FnPtr( + Binder( + ([Tuple([Ref(ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(0, None) }), Int(I32), Not), Ref(ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(1, None) }), Int(I32), Not)])]; c_variadic: false)->Ref(ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(0, None) }), Int(I32), Not), + [ + Region( + BrAnon(0, None), + ), + Region( + BrAnon(1, None), + ), + ], + ), + ), + Tuple( + [], + ), ] error: lifetime may not live long enough diff --git a/tests/ui/nll/ty-outlives/impl-trait-captures.stderr b/tests/ui/nll/ty-outlives/impl-trait-captures.stderr index 7b9ed171d2dbf..64c5d5ced23e7 100644 --- a/tests/ui/nll/ty-outlives/impl-trait-captures.stderr +++ b/tests/ui/nll/ty-outlives/impl-trait-captures.stderr @@ -1,4 +1,4 @@ -error[E0700]: hidden type for `Opaque(DefId(0:13 ~ impl_trait_captures[1afc]::foo::{opaque#0}), [ReEarlyBound(0, 'a), T, ReEarlyBound(0, 'a)])` captures lifetime that does not appear in bounds +error[E0700]: hidden type for `Opaque(DefId(0:13 ~ impl_trait_captures[1afc]::foo::{opaque#0}), [ReEarlyBound(0, 'a), Param(T/#1), ReEarlyBound(0, 'a)])` captures lifetime that does not appear in bounds --> $DIR/impl-trait-captures.rs:11:5 | LL | fn foo<'a, T>(x: &T) -> impl Foo<'a> { @@ -6,7 +6,7 @@ LL | fn foo<'a, T>(x: &T) -> impl Foo<'a> { LL | x | ^ | -help: to declare that `Opaque(DefId(0:13 ~ impl_trait_captures[1afc]::foo::{opaque#0}), [ReEarlyBound(0, 'a), T, ReEarlyBound(2, 'a)])` captures `ReFree(DefId(0:8 ~ impl_trait_captures[1afc]::foo), BrNamed(DefId(0:12 ~ impl_trait_captures[1afc]::foo::'_), '_))`, you can add an explicit `ReFree(DefId(0:8 ~ impl_trait_captures[1afc]::foo), BrNamed(DefId(0:12 ~ impl_trait_captures[1afc]::foo::'_), '_))` lifetime bound +help: to declare that `Opaque(DefId(0:13 ~ impl_trait_captures[1afc]::foo::{opaque#0}), [ReEarlyBound(0, 'a), Param(T/#1), ReEarlyBound(2, 'a)])` captures `ReFree(DefId(0:8 ~ impl_trait_captures[1afc]::foo), BrNamed(DefId(0:12 ~ impl_trait_captures[1afc]::foo::'_), '_))`, you can add an explicit `ReFree(DefId(0:8 ~ impl_trait_captures[1afc]::foo), BrNamed(DefId(0:12 ~ impl_trait_captures[1afc]::foo::'_), '_))` lifetime bound | LL | fn foo<'a, T>(x: &T) -> impl Foo<'a> + ReFree(DefId(0:8 ~ impl_trait_captures[1afc]::foo), BrNamed(DefId(0:12 ~ impl_trait_captures[1afc]::foo::'_), '_)) { | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ diff --git a/tests/ui/nll/ty-outlives/projection-no-regions-closure.stderr b/tests/ui/nll/ty-outlives/projection-no-regions-closure.stderr index 4933b93486831..b77e50e53d424 100644 --- a/tests/ui/nll/ty-outlives/projection-no-regions-closure.stderr +++ b/tests/ui/nll/ty-outlives/projection-no-regions-closure.stderr @@ -5,12 +5,21 @@ LL | with_signature(x, |mut y| Box::new(y.next())) | ^^^^^^^ | = note: defining type: no_region::<'_#1r, T>::{closure#0} with closure substs [ - i32, - extern "rust-call" fn((std::boxed::Box,)) -> std::boxed::Box<(dyn Anything + '_#2r)>, - (), + Int( + I32, + ), + FnPtr( + Binder( + ([Tuple([Adt(std::boxed::Box, [Param(T/#1), Adt(std::alloc::Global, [])])])]; c_variadic: false)->Adt(std::boxed::Box, [Dynamic([Binder(Trait(Anything), [])], '_#2r, Dyn), Adt(std::alloc::Global, [])]), + [], + ), + ), + Tuple( + [], + ), ] = note: number of external vids: 3 - = note: where ::Item: '_#2r + = note: where Alias(Projection, AliasTy { substs: [Param(T/#1)], def_id: DefId(2:7157 ~ core[a28e]::iter::traits::iterator::Iterator::Item) }): '_#2r note: no external requirements --> $DIR/projection-no-regions-closure.rs:21:1 @@ -38,12 +47,21 @@ LL | with_signature(x, |mut y| Box::new(y.next())) | ^^^^^^^ | = note: defining type: correct_region::<'_#1r, T>::{closure#0} with closure substs [ - i32, - extern "rust-call" fn((std::boxed::Box,)) -> std::boxed::Box<(dyn Anything + '_#2r)>, - (), + Int( + I32, + ), + FnPtr( + Binder( + ([Tuple([Adt(std::boxed::Box, [Param(T/#1), Adt(std::alloc::Global, [])])])]; c_variadic: false)->Adt(std::boxed::Box, [Dynamic([Binder(Trait(Anything), [])], '_#2r, Dyn), Adt(std::alloc::Global, [])]), + [], + ), + ), + Tuple( + [], + ), ] = note: number of external vids: 3 - = note: where ::Item: '_#2r + = note: where Alias(Projection, AliasTy { substs: [Param(T/#1)], def_id: DefId(2:7157 ~ core[a28e]::iter::traits::iterator::Iterator::Item) }): '_#2r note: no external requirements --> $DIR/projection-no-regions-closure.rs:30:1 @@ -62,12 +80,21 @@ LL | with_signature(x, |mut y| Box::new(y.next())) | ^^^^^^^ | = note: defining type: wrong_region::<'_#1r, '_#2r, T>::{closure#0} with closure substs [ - i32, - extern "rust-call" fn((std::boxed::Box,)) -> std::boxed::Box<(dyn Anything + '_#3r)>, - (), + Int( + I32, + ), + FnPtr( + Binder( + ([Tuple([Adt(std::boxed::Box, [Param(T/#2), Adt(std::alloc::Global, [])])])]; c_variadic: false)->Adt(std::boxed::Box, [Dynamic([Binder(Trait(Anything), [])], '_#3r, Dyn), Adt(std::alloc::Global, [])]), + [], + ), + ), + Tuple( + [], + ), ] = note: number of external vids: 4 - = note: where ::Item: '_#3r + = note: where Alias(Projection, AliasTy { substs: [Param(T/#2)], def_id: DefId(2:7157 ~ core[a28e]::iter::traits::iterator::Iterator::Item) }): '_#3r note: no external requirements --> $DIR/projection-no-regions-closure.rs:38:1 @@ -95,12 +122,21 @@ LL | with_signature(x, |mut y| Box::new(y.next())) | ^^^^^^^ | = note: defining type: outlives_region::<'_#1r, '_#2r, T>::{closure#0} with closure substs [ - i32, - extern "rust-call" fn((std::boxed::Box,)) -> std::boxed::Box<(dyn Anything + '_#3r)>, - (), + Int( + I32, + ), + FnPtr( + Binder( + ([Tuple([Adt(std::boxed::Box, [Param(T/#2), Adt(std::alloc::Global, [])])])]; c_variadic: false)->Adt(std::boxed::Box, [Dynamic([Binder(Trait(Anything), [])], '_#3r, Dyn), Adt(std::alloc::Global, [])]), + [], + ), + ), + Tuple( + [], + ), ] = note: number of external vids: 4 - = note: where ::Item: '_#3r + = note: where Alias(Projection, AliasTy { substs: [Param(T/#2)], def_id: DefId(2:7157 ~ core[a28e]::iter::traits::iterator::Iterator::Item) }): '_#3r note: no external requirements --> $DIR/projection-no-regions-closure.rs:47:1 diff --git a/tests/ui/nll/ty-outlives/projection-one-region-closure.stderr b/tests/ui/nll/ty-outlives/projection-one-region-closure.stderr index dbda04c42c5c7..6b8c5d06959b3 100644 --- a/tests/ui/nll/ty-outlives/projection-one-region-closure.stderr +++ b/tests/ui/nll/ty-outlives/projection-one-region-closure.stderr @@ -5,13 +5,22 @@ LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^ | = note: defining type: no_relationships_late::<'_#1r, T>::{closure#0} with closure substs [ - i32, - extern "rust-call" fn((std::cell::Cell<&'_#2r ()>, T)), - (), + Int( + I32, + ), + FnPtr( + Binder( + ([Tuple([Adt(std::cell::Cell, [Ref('_#2r, Tuple([]), Not)]), Param(T/#1)])]; c_variadic: false)->Tuple([]), + [], + ), + ), + Tuple( + [], + ), ] = note: late-bound region is '_#3r = note: number of external vids: 4 - = note: where T: '_#2r + = note: where Param(T/#1): '_#2r = note: where '_#1r: '_#2r note: no external requirements @@ -55,12 +64,21 @@ LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^ | = note: defining type: no_relationships_early::<'_#1r, '_#2r, T>::{closure#0} with closure substs [ - i32, - extern "rust-call" fn((std::cell::Cell<&'_#3r ()>, T)), - (), + Int( + I32, + ), + FnPtr( + Binder( + ([Tuple([Adt(std::cell::Cell, [Ref('_#3r, Tuple([]), Not)]), Param(T/#2)])]; c_variadic: false)->Tuple([]), + [], + ), + ), + Tuple( + [], + ), ] = note: number of external vids: 4 - = note: where T: '_#3r + = note: where Param(T/#2): '_#3r = note: where '_#2r: '_#3r note: no external requirements @@ -105,12 +123,21 @@ LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^ | = note: defining type: projection_outlives::<'_#1r, '_#2r, T>::{closure#0} with closure substs [ - i32, - extern "rust-call" fn((std::cell::Cell<&'_#3r ()>, T)), - (), + Int( + I32, + ), + FnPtr( + Binder( + ([Tuple([Adt(std::cell::Cell, [Ref('_#3r, Tuple([]), Not)]), Param(T/#2)])]; c_variadic: false)->Tuple([]), + [], + ), + ), + Tuple( + [], + ), ] = note: number of external vids: 4 - = note: where >::AssocType: '_#3r + = note: where Alias(Projection, AliasTy { substs: [Param(T/#2), ReEarlyBound(1, 'b)], def_id: DefId(0:6 ~ projection_one_region_closure[015d]::Anything::AssocType) }): '_#3r note: no external requirements --> $DIR/projection-one-region-closure.rs:62:1 @@ -130,12 +157,21 @@ LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^ | = note: defining type: elements_outlive::<'_#1r, '_#2r, T>::{closure#0} with closure substs [ - i32, - extern "rust-call" fn((std::cell::Cell<&'_#3r ()>, T)), - (), + Int( + I32, + ), + FnPtr( + Binder( + ([Tuple([Adt(std::cell::Cell, [Ref('_#3r, Tuple([]), Not)]), Param(T/#2)])]; c_variadic: false)->Tuple([]), + [], + ), + ), + Tuple( + [], + ), ] = note: number of external vids: 4 - = note: where T: '_#3r + = note: where Param(T/#2): '_#3r = note: where '_#2r: '_#3r note: no external requirements diff --git a/tests/ui/nll/ty-outlives/projection-one-region-trait-bound-closure.stderr b/tests/ui/nll/ty-outlives/projection-one-region-trait-bound-closure.stderr index 250c796e2c71e..a909877569c35 100644 --- a/tests/ui/nll/ty-outlives/projection-one-region-trait-bound-closure.stderr +++ b/tests/ui/nll/ty-outlives/projection-one-region-trait-bound-closure.stderr @@ -5,9 +5,18 @@ LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^ | = note: defining type: no_relationships_late::<'_#1r, T>::{closure#0} with closure substs [ - i32, - extern "rust-call" fn((std::cell::Cell<&'_#2r ()>, T)), - (), + Int( + I32, + ), + FnPtr( + Binder( + ([Tuple([Adt(std::cell::Cell, [Ref('_#2r, Tuple([]), Not)]), Param(T/#1)])]; c_variadic: false)->Tuple([]), + [], + ), + ), + Tuple( + [], + ), ] = note: late-bound region is '_#3r = note: number of external vids: 4 @@ -43,9 +52,18 @@ LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^ | = note: defining type: no_relationships_early::<'_#1r, '_#2r, T>::{closure#0} with closure substs [ - i32, - extern "rust-call" fn((std::cell::Cell<&'_#3r ()>, T)), - (), + Int( + I32, + ), + FnPtr( + Binder( + ([Tuple([Adt(std::cell::Cell, [Ref('_#3r, Tuple([]), Not)]), Param(T/#2)])]; c_variadic: false)->Tuple([]), + [], + ), + ), + Tuple( + [], + ), ] = note: number of external vids: 4 = note: where '_#2r: '_#3r @@ -81,12 +99,21 @@ LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^ | = note: defining type: projection_outlives::<'_#1r, '_#2r, T>::{closure#0} with closure substs [ - i32, - extern "rust-call" fn((std::cell::Cell<&'_#3r ()>, T)), - (), + Int( + I32, + ), + FnPtr( + Binder( + ([Tuple([Adt(std::cell::Cell, [Ref('_#3r, Tuple([]), Not)]), Param(T/#2)])]; c_variadic: false)->Tuple([]), + [], + ), + ), + Tuple( + [], + ), ] = note: number of external vids: 4 - = note: where >::AssocType: '_#3r + = note: where Alias(Projection, AliasTy { substs: [Param(T/#2), ReEarlyBound(1, 'b)], def_id: DefId(0:6 ~ projection_one_region_trait_bound_closure[550b]::Anything::AssocType) }): '_#3r note: no external requirements --> $DIR/projection-one-region-trait-bound-closure.rs:52:1 @@ -106,9 +133,18 @@ LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^ | = note: defining type: elements_outlive::<'_#1r, '_#2r, T>::{closure#0} with closure substs [ - i32, - extern "rust-call" fn((std::cell::Cell<&'_#3r ()>, T)), - (), + Int( + I32, + ), + FnPtr( + Binder( + ([Tuple([Adt(std::cell::Cell, [Ref('_#3r, Tuple([]), Not)]), Param(T/#2)])]; c_variadic: false)->Tuple([]), + [], + ), + ), + Tuple( + [], + ), ] = note: number of external vids: 4 = note: where '_#2r: '_#3r @@ -131,9 +167,18 @@ LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^ | = note: defining type: one_region::<'_#1r, T>::{closure#0} with closure substs [ - i32, - extern "rust-call" fn((std::cell::Cell<&'_#2r ()>, T)), - (), + Int( + I32, + ), + FnPtr( + Binder( + ([Tuple([Adt(std::cell::Cell, [Ref('_#2r, Tuple([]), Not)]), Param(T/#1)])]; c_variadic: false)->Tuple([]), + [], + ), + ), + Tuple( + [], + ), ] = note: number of external vids: 3 = note: where '_#1r: '_#2r diff --git a/tests/ui/nll/ty-outlives/projection-one-region-trait-bound-static-closure.stderr b/tests/ui/nll/ty-outlives/projection-one-region-trait-bound-static-closure.stderr index b27186b053735..69a49c6f34d28 100644 --- a/tests/ui/nll/ty-outlives/projection-one-region-trait-bound-static-closure.stderr +++ b/tests/ui/nll/ty-outlives/projection-one-region-trait-bound-static-closure.stderr @@ -5,9 +5,18 @@ LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^ | = note: defining type: no_relationships_late::<'_#1r, T>::{closure#0} with closure substs [ - i32, - extern "rust-call" fn((std::cell::Cell<&'_#2r ()>, T)), - (), + Int( + I32, + ), + FnPtr( + Binder( + ([Tuple([Adt(std::cell::Cell, [Ref('_#2r, Tuple([]), Not)]), Param(T/#1)])]; c_variadic: false)->Tuple([]), + [], + ), + ), + Tuple( + [], + ), ] = note: late-bound region is '_#3r @@ -28,9 +37,18 @@ LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^ | = note: defining type: no_relationships_early::<'_#1r, '_#2r, T>::{closure#0} with closure substs [ - i32, - extern "rust-call" fn((std::cell::Cell<&'_#3r ()>, T)), - (), + Int( + I32, + ), + FnPtr( + Binder( + ([Tuple([Adt(std::cell::Cell, [Ref('_#3r, Tuple([]), Not)]), Param(T/#2)])]; c_variadic: false)->Tuple([]), + [], + ), + ), + Tuple( + [], + ), ] note: no external requirements @@ -51,9 +69,18 @@ LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^ | = note: defining type: projection_outlives::<'_#1r, '_#2r, T>::{closure#0} with closure substs [ - i32, - extern "rust-call" fn((std::cell::Cell<&'_#3r ()>, T)), - (), + Int( + I32, + ), + FnPtr( + Binder( + ([Tuple([Adt(std::cell::Cell, [Ref('_#3r, Tuple([]), Not)]), Param(T/#2)])]; c_variadic: false)->Tuple([]), + [], + ), + ), + Tuple( + [], + ), ] note: no external requirements @@ -74,9 +101,18 @@ LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^ | = note: defining type: elements_outlive::<'_#1r, '_#2r, T>::{closure#0} with closure substs [ - i32, - extern "rust-call" fn((std::cell::Cell<&'_#3r ()>, T)), - (), + Int( + I32, + ), + FnPtr( + Binder( + ([Tuple([Adt(std::cell::Cell, [Ref('_#3r, Tuple([]), Not)]), Param(T/#2)])]; c_variadic: false)->Tuple([]), + [], + ), + ), + Tuple( + [], + ), ] note: no external requirements @@ -97,9 +133,18 @@ LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^ | = note: defining type: one_region::<'_#1r, T>::{closure#0} with closure substs [ - i32, - extern "rust-call" fn((std::cell::Cell<&'_#2r ()>, T)), - (), + Int( + I32, + ), + FnPtr( + Binder( + ([Tuple([Adt(std::cell::Cell, [Ref('_#2r, Tuple([]), Not)]), Param(T/#1)])]; c_variadic: false)->Tuple([]), + [], + ), + ), + Tuple( + [], + ), ] note: no external requirements diff --git a/tests/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.stderr b/tests/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.stderr index 90f04914286c1..c29871d9f383d 100644 --- a/tests/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.stderr +++ b/tests/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.stderr @@ -5,13 +5,22 @@ LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^ | = note: defining type: no_relationships_late::<'_#1r, '_#2r, T>::{closure#0} with closure substs [ - i32, - extern "rust-call" fn((std::cell::Cell<&'_#3r ()>, T)), - (), + Int( + I32, + ), + FnPtr( + Binder( + ([Tuple([Adt(std::cell::Cell, [Ref('_#3r, Tuple([]), Not)]), Param(T/#2)])]; c_variadic: false)->Tuple([]), + [], + ), + ), + Tuple( + [], + ), ] = note: late-bound region is '_#4r = note: number of external vids: 5 - = note: where >::AssocType: '_#3r + = note: where Alias(Projection, AliasTy { substs: [Param(T/#2), ReEarlyBound(0, 'b), ReEarlyBound(1, 'c)], def_id: DefId(0:7 ~ projection_two_region_trait_bound_closure[f373]::Anything::AssocType) }): '_#3r note: no external requirements --> $DIR/projection-two-region-trait-bound-closure.rs:34:1 @@ -39,12 +48,21 @@ LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^ | = note: defining type: no_relationships_early::<'_#1r, '_#2r, '_#3r, T>::{closure#0} with closure substs [ - i32, - extern "rust-call" fn((std::cell::Cell<&'_#4r ()>, T)), - (), + Int( + I32, + ), + FnPtr( + Binder( + ([Tuple([Adt(std::cell::Cell, [Ref('_#4r, Tuple([]), Not)]), Param(T/#3)])]; c_variadic: false)->Tuple([]), + [], + ), + ), + Tuple( + [], + ), ] = note: number of external vids: 5 - = note: where >::AssocType: '_#4r + = note: where Alias(Projection, AliasTy { substs: [Param(T/#3), ReEarlyBound(1, 'b), ReEarlyBound(2, 'c)], def_id: DefId(0:7 ~ projection_two_region_trait_bound_closure[f373]::Anything::AssocType) }): '_#4r note: no external requirements --> $DIR/projection-two-region-trait-bound-closure.rs:43:1 @@ -73,12 +91,21 @@ LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^ | = note: defining type: projection_outlives::<'_#1r, '_#2r, '_#3r, T>::{closure#0} with closure substs [ - i32, - extern "rust-call" fn((std::cell::Cell<&'_#4r ()>, T)), - (), + Int( + I32, + ), + FnPtr( + Binder( + ([Tuple([Adt(std::cell::Cell, [Ref('_#4r, Tuple([]), Not)]), Param(T/#3)])]; c_variadic: false)->Tuple([]), + [], + ), + ), + Tuple( + [], + ), ] = note: number of external vids: 5 - = note: where >::AssocType: '_#4r + = note: where Alias(Projection, AliasTy { substs: [Param(T/#3), ReEarlyBound(1, 'b), ReEarlyBound(2, 'c)], def_id: DefId(0:7 ~ projection_two_region_trait_bound_closure[f373]::Anything::AssocType) }): '_#4r note: no external requirements --> $DIR/projection-two-region-trait-bound-closure.rs:53:1 @@ -98,12 +125,21 @@ LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^ | = note: defining type: elements_outlive1::<'_#1r, '_#2r, '_#3r, T>::{closure#0} with closure substs [ - i32, - extern "rust-call" fn((std::cell::Cell<&'_#4r ()>, T)), - (), + Int( + I32, + ), + FnPtr( + Binder( + ([Tuple([Adt(std::cell::Cell, [Ref('_#4r, Tuple([]), Not)]), Param(T/#3)])]; c_variadic: false)->Tuple([]), + [], + ), + ), + Tuple( + [], + ), ] = note: number of external vids: 5 - = note: where >::AssocType: '_#4r + = note: where Alias(Projection, AliasTy { substs: [Param(T/#3), ReEarlyBound(1, 'b), ReEarlyBound(2, 'c)], def_id: DefId(0:7 ~ projection_two_region_trait_bound_closure[f373]::Anything::AssocType) }): '_#4r note: no external requirements --> $DIR/projection-two-region-trait-bound-closure.rs:65:1 @@ -123,12 +159,21 @@ LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^ | = note: defining type: elements_outlive2::<'_#1r, '_#2r, '_#3r, T>::{closure#0} with closure substs [ - i32, - extern "rust-call" fn((std::cell::Cell<&'_#4r ()>, T)), - (), + Int( + I32, + ), + FnPtr( + Binder( + ([Tuple([Adt(std::cell::Cell, [Ref('_#4r, Tuple([]), Not)]), Param(T/#3)])]; c_variadic: false)->Tuple([]), + [], + ), + ), + Tuple( + [], + ), ] = note: number of external vids: 5 - = note: where >::AssocType: '_#4r + = note: where Alias(Projection, AliasTy { substs: [Param(T/#3), ReEarlyBound(1, 'b), ReEarlyBound(2, 'c)], def_id: DefId(0:7 ~ projection_two_region_trait_bound_closure[f373]::Anything::AssocType) }): '_#4r note: no external requirements --> $DIR/projection-two-region-trait-bound-closure.rs:74:1 @@ -148,13 +193,22 @@ LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^ | = note: defining type: two_regions::<'_#1r, T>::{closure#0} with closure substs [ - i32, - extern "rust-call" fn((std::cell::Cell<&'_#2r ()>, T)), - (), + Int( + I32, + ), + FnPtr( + Binder( + ([Tuple([Adt(std::cell::Cell, [Ref('_#2r, Tuple([]), Not)]), Param(T/#1)])]; c_variadic: false)->Tuple([]), + [], + ), + ), + Tuple( + [], + ), ] = note: late-bound region is '_#3r = note: number of external vids: 4 - = note: where >::AssocType: '_#2r + = note: where Alias(Projection, AliasTy { substs: [Param(T/#1), ReEarlyBound(0, 'b), ReEarlyBound(0, 'b)], def_id: DefId(0:7 ~ projection_two_region_trait_bound_closure[f373]::Anything::AssocType) }): '_#2r note: no external requirements --> $DIR/projection-two-region-trait-bound-closure.rs:83:1 @@ -189,12 +243,21 @@ LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^ | = note: defining type: two_regions_outlive::<'_#1r, '_#2r, T>::{closure#0} with closure substs [ - i32, - extern "rust-call" fn((std::cell::Cell<&'_#3r ()>, T)), - (), + Int( + I32, + ), + FnPtr( + Binder( + ([Tuple([Adt(std::cell::Cell, [Ref('_#3r, Tuple([]), Not)]), Param(T/#2)])]; c_variadic: false)->Tuple([]), + [], + ), + ), + Tuple( + [], + ), ] = note: number of external vids: 4 - = note: where >::AssocType: '_#3r + = note: where Alias(Projection, AliasTy { substs: [Param(T/#2), ReEarlyBound(1, 'b), ReEarlyBound(1, 'b)], def_id: DefId(0:7 ~ projection_two_region_trait_bound_closure[f373]::Anything::AssocType) }): '_#3r note: no external requirements --> $DIR/projection-two-region-trait-bound-closure.rs:92:1 @@ -214,12 +277,21 @@ LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^ | = note: defining type: one_region::<'_#1r, T>::{closure#0} with closure substs [ - i32, - extern "rust-call" fn((std::cell::Cell<&'_#2r ()>, T)), - (), + Int( + I32, + ), + FnPtr( + Binder( + ([Tuple([Adt(std::cell::Cell, [Ref('_#2r, Tuple([]), Not)]), Param(T/#1)])]; c_variadic: false)->Tuple([]), + [], + ), + ), + Tuple( + [], + ), ] = note: number of external vids: 3 - = note: where >::AssocType: '_#2r + = note: where Alias(Projection, AliasTy { substs: [Param(T/#1), ReEarlyBound(0, 'a), ReEarlyBound(0, 'a)], def_id: DefId(0:7 ~ projection_two_region_trait_bound_closure[f373]::Anything::AssocType) }): '_#2r note: no external requirements --> $DIR/projection-two-region-trait-bound-closure.rs:101:1 diff --git a/tests/ui/nll/ty-outlives/ty-param-closure-approximate-lower-bound.stderr b/tests/ui/nll/ty-outlives/ty-param-closure-approximate-lower-bound.stderr index a442cf12d820e..20abdc3f83b54 100644 --- a/tests/ui/nll/ty-outlives/ty-param-closure-approximate-lower-bound.stderr +++ b/tests/ui/nll/ty-outlives/ty-param-closure-approximate-lower-bound.stderr @@ -5,12 +5,28 @@ LL | twice(cell, value, |a, b| invoke(a, b)); | ^^^^^^ | = note: defining type: generic::::{closure#0} with closure substs [ - i16, - for extern "rust-call" fn((std::option::Option>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(1, None) }) T)), - (), + Int( + I16, + ), + FnPtr( + Binder( + ([Tuple([Adt(std::option::Option, [Adt(std::cell::Cell, [Ref('_#1r, Ref(ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(0, None) }), Tuple([]), Not), Not)])]), Ref(ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(1, None) }), Param(T/#0), Not)])]; c_variadic: false)->Tuple([]), + [ + Region( + BrAnon(0, None), + ), + Region( + BrAnon(1, None), + ), + ], + ), + ), + Tuple( + [], + ), ] = note: number of external vids: 2 - = note: where T: '_#1r + = note: where Param(T/#0): '_#1r note: no external requirements --> $DIR/ty-param-closure-approximate-lower-bound.rs:22:1 @@ -27,13 +43,29 @@ LL | twice(cell, value, |a, b| invoke(a, b)); | ^^^^^^ | = note: defining type: generic_fail::::{closure#0} with closure substs [ - i16, - for extern "rust-call" fn((std::option::Option>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(1, None) }) T)), - (), + Int( + I16, + ), + FnPtr( + Binder( + ([Tuple([Adt(std::option::Option, [Adt(std::cell::Cell, [Ref('_#1r, Ref(ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(0, None) }), Tuple([]), Not), Not)])]), Ref(ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(1, None) }), Param(T/#0), Not)])]; c_variadic: false)->Tuple([]), + [ + Region( + BrAnon(0, None), + ), + Region( + BrAnon(1, None), + ), + ], + ), + ), + Tuple( + [], + ), ] = note: late-bound region is '_#2r = note: number of external vids: 3 - = note: where T: '_#1r + = note: where Param(T/#0): '_#1r note: no external requirements --> $DIR/ty-param-closure-approximate-lower-bound.rs:28:1 diff --git a/tests/ui/nll/ty-outlives/ty-param-closure-outlives-from-return-type.stderr b/tests/ui/nll/ty-outlives/ty-param-closure-outlives-from-return-type.stderr index 35979c8bf5171..31f2efeb5dd31 100644 --- a/tests/ui/nll/ty-outlives/ty-param-closure-outlives-from-return-type.stderr +++ b/tests/ui/nll/ty-outlives/ty-param-closure-outlives-from-return-type.stderr @@ -5,12 +5,21 @@ LL | with_signature(x, |y| y) | ^^^ | = note: defining type: no_region::<'_#1r, T>::{closure#0} with closure substs [ - i32, - extern "rust-call" fn((std::boxed::Box,)) -> std::boxed::Box<(dyn std::fmt::Debug + '_#2r)>, - (), + Int( + I32, + ), + FnPtr( + Binder( + ([Tuple([Adt(std::boxed::Box, [Param(T/#1), Adt(std::alloc::Global, [])])])]; c_variadic: false)->Adt(std::boxed::Box, [Dynamic([Binder(Trait(std::fmt::Debug), [])], '_#2r, Dyn), Adt(std::alloc::Global, [])]), + [], + ), + ), + Tuple( + [], + ), ] = note: number of external vids: 3 - = note: where T: '_#2r + = note: where Param(T/#1): '_#2r note: no external requirements --> $DIR/ty-param-closure-outlives-from-return-type.rs:15:1 diff --git a/tests/ui/nll/ty-outlives/ty-param-closure-outlives-from-where-clause.stderr b/tests/ui/nll/ty-outlives/ty-param-closure-outlives-from-where-clause.stderr index 4c97db58c6c3d..ba214bdc78a8f 100644 --- a/tests/ui/nll/ty-outlives/ty-param-closure-outlives-from-where-clause.stderr +++ b/tests/ui/nll/ty-outlives/ty-param-closure-outlives-from-where-clause.stderr @@ -5,13 +5,22 @@ LL | with_signature(a, b, |x, y| { | ^^^^^^ | = note: defining type: no_region::::{closure#0} with closure substs [ - i32, - extern "rust-call" fn((std::cell::Cell<&'_#1r ()>, T)), - (), + Int( + I32, + ), + FnPtr( + Binder( + ([Tuple([Adt(std::cell::Cell, [Ref('_#1r, Tuple([]), Not)]), Param(T/#0)])]; c_variadic: false)->Tuple([]), + [], + ), + ), + Tuple( + [], + ), ] = note: late-bound region is '_#2r = note: number of external vids: 3 - = note: where T: '_#1r + = note: where Param(T/#0): '_#1r note: no external requirements --> $DIR/ty-param-closure-outlives-from-where-clause.rs:26:1 @@ -39,12 +48,21 @@ LL | with_signature(a, b, |x, y| { | ^^^^^^ | = note: defining type: correct_region::<'_#1r, T>::{closure#0} with closure substs [ - i32, - extern "rust-call" fn((std::cell::Cell<&'_#2r ()>, T)), - (), + Int( + I32, + ), + FnPtr( + Binder( + ([Tuple([Adt(std::cell::Cell, [Ref('_#2r, Tuple([]), Not)]), Param(T/#1)])]; c_variadic: false)->Tuple([]), + [], + ), + ), + Tuple( + [], + ), ] = note: number of external vids: 3 - = note: where T: '_#2r + = note: where Param(T/#1): '_#2r note: no external requirements --> $DIR/ty-param-closure-outlives-from-where-clause.rs:38:1 @@ -63,13 +81,22 @@ LL | with_signature(a, b, |x, y| { | ^^^^^^ | = note: defining type: wrong_region::<'_#1r, T>::{closure#0} with closure substs [ - i32, - extern "rust-call" fn((std::cell::Cell<&'_#2r ()>, T)), - (), + Int( + I32, + ), + FnPtr( + Binder( + ([Tuple([Adt(std::cell::Cell, [Ref('_#2r, Tuple([]), Not)]), Param(T/#1)])]; c_variadic: false)->Tuple([]), + [], + ), + ), + Tuple( + [], + ), ] = note: late-bound region is '_#3r = note: number of external vids: 4 - = note: where T: '_#2r + = note: where Param(T/#1): '_#2r note: no external requirements --> $DIR/ty-param-closure-outlives-from-where-clause.rs:59:1 @@ -99,12 +126,21 @@ LL | with_signature(a, b, |x, y| { | ^^^^^^ | = note: defining type: outlives_region::<'_#1r, '_#2r, T>::{closure#0} with closure substs [ - i32, - extern "rust-call" fn((std::cell::Cell<&'_#3r ()>, T)), - (), + Int( + I32, + ), + FnPtr( + Binder( + ([Tuple([Adt(std::cell::Cell, [Ref('_#3r, Tuple([]), Not)]), Param(T/#2)])]; c_variadic: false)->Tuple([]), + [], + ), + ), + Tuple( + [], + ), ] = note: number of external vids: 4 - = note: where T: '_#3r + = note: where Param(T/#2): '_#3r note: no external requirements --> $DIR/ty-param-closure-outlives-from-where-clause.rs:71:1 diff --git a/tests/ui/nll/user-annotations/dump-adt-brace-struct.rs b/tests/ui/nll/user-annotations/dump-adt-brace-struct.rs index ccda9129dabae..cabe85f24ea10 100644 --- a/tests/ui/nll/user-annotations/dump-adt-brace-struct.rs +++ b/tests/ui/nll/user-annotations/dump-adt-brace-struct.rs @@ -6,7 +6,9 @@ #![allow(warnings)] #![feature(rustc_attrs)] -struct SomeStruct { t: T } +struct SomeStruct { + t: T, +} #[rustc_dump_user_substs] fn main() { @@ -16,5 +18,5 @@ fn main() { SomeStruct:: { t: 22 }; // No lifetime bounds given. - SomeStruct::<&'static u32> { t: &22 }; //~ ERROR [&ReStatic u32] + SomeStruct::<&'static u32> { t: &22 }; //~ ERROR UserSubsts { substs: [Ref(ReStatic, Uint(U32), Not)], user_self_ty: None } } diff --git a/tests/ui/nll/user-annotations/dump-adt-brace-struct.stderr b/tests/ui/nll/user-annotations/dump-adt-brace-struct.stderr index 5860621909ce4..f7b77fe667a84 100644 --- a/tests/ui/nll/user-annotations/dump-adt-brace-struct.stderr +++ b/tests/ui/nll/user-annotations/dump-adt-brace-struct.stderr @@ -1,5 +1,5 @@ -error: user substs: UserSubsts { substs: [&ReStatic u32], user_self_ty: None } - --> $DIR/dump-adt-brace-struct.rs:19:5 +error: user substs: UserSubsts { substs: [Ref(ReStatic, Uint(U32), Not)], user_self_ty: None } + --> $DIR/dump-adt-brace-struct.rs:21:5 | LL | SomeStruct::<&'static u32> { t: &22 }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/nll/user-annotations/dump-fn-method.rs b/tests/ui/nll/user-annotations/dump-fn-method.rs index 148d63d848f80..d78a06cffa4eb 100644 --- a/tests/ui/nll/user-annotations/dump-fn-method.rs +++ b/tests/ui/nll/user-annotations/dump-fn-method.rs @@ -7,13 +7,12 @@ // Note: we reference the names T and U in the comments below. trait Bazoom { - fn method(&self, arg: T, arg2: U) { } + fn method(&self, arg: T, arg2: U) {} } -impl Bazoom for S { -} +impl Bazoom for S {} -fn foo<'a, T>(_: T) { } +fn foo<'a, T>(_: T) {} #[rustc_dump_user_substs] fn main() { @@ -26,13 +25,13 @@ fn main() { let x = foo::; x(22); - let x = foo::<&'static u32>; //~ ERROR [&ReStatic u32] + let x = foo::<&'static u32>; //~ ERROR UserSubsts { substs: [Ref(ReStatic, Uint(U32), Not)], user_self_ty: None } x(&22); // Here: we only want the `T` to be given, the rest should be variables. // // (`T` refers to the declaration of `Bazoom`) - let x = <_ as Bazoom>::method::<_>; //~ ERROR [^0, u32, ^1] + let x = <_ as Bazoom>::method::<_>; //~ ERROR UserSubsts { substs: [Bound(DebruijnIndex(0), BoundTy { var: 0, kind: Anon }), Uint(U32), Bound(DebruijnIndex(0), BoundTy { var: 1, kind: Anon })], user_self_ty: None } x(&22, 44, 66); // Here: all are given and definitely contain no lifetimes, so we @@ -41,7 +40,7 @@ fn main() { x(&22, 44, 66); // Here: all are given and we have a lifetime. - let x = >::method::; //~ ERROR [u8, &ReStatic u16, u32] + let x = >::method::; //~ ERROR UserSubsts { substs: [Uint(U8), Ref(ReStatic, Uint(U16), Not), Uint(U32)], user_self_ty: None } x(&22, &44, 66); // Here: we want in particular that *only* the method `U` @@ -49,7 +48,7 @@ fn main() { // // (`U` refers to the declaration of `Bazoom`) let y = 22_u32; - y.method::(44, 66); //~ ERROR [^0, ^1, u32] + y.method::(44, 66); //~ ERROR UserSubsts { substs: [Bound(DebruijnIndex(0), BoundTy { var: 0, kind: Anon }), Bound(DebruijnIndex(0), BoundTy { var: 1, kind: Anon }), Uint(U32)], user_self_ty: None } // Here: nothing is given, so we don't have any annotation. let y = 22_u32; diff --git a/tests/ui/nll/user-annotations/dump-fn-method.stderr b/tests/ui/nll/user-annotations/dump-fn-method.stderr index d139efa888ff7..5de50f4787722 100644 --- a/tests/ui/nll/user-annotations/dump-fn-method.stderr +++ b/tests/ui/nll/user-annotations/dump-fn-method.stderr @@ -1,23 +1,23 @@ -error: user substs: UserSubsts { substs: [&ReStatic u32], user_self_ty: None } - --> $DIR/dump-fn-method.rs:29:13 +error: user substs: UserSubsts { substs: [Ref(ReStatic, Uint(U32), Not)], user_self_ty: None } + --> $DIR/dump-fn-method.rs:28:13 | LL | let x = foo::<&'static u32>; | ^^^^^^^^^^^^^^^^^^^ -error: user substs: UserSubsts { substs: [^0, u32, ^1], user_self_ty: None } - --> $DIR/dump-fn-method.rs:35:13 +error: user substs: UserSubsts { substs: [Bound(DebruijnIndex(0), BoundTy { var: 0, kind: Anon }), Uint(U32), Bound(DebruijnIndex(0), BoundTy { var: 1, kind: Anon })], user_self_ty: None } + --> $DIR/dump-fn-method.rs:34:13 | LL | let x = <_ as Bazoom>::method::<_>; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: user substs: UserSubsts { substs: [u8, &ReStatic u16, u32], user_self_ty: None } - --> $DIR/dump-fn-method.rs:44:13 +error: user substs: UserSubsts { substs: [Uint(U8), Ref(ReStatic, Uint(U16), Not), Uint(U32)], user_self_ty: None } + --> $DIR/dump-fn-method.rs:43:13 | LL | let x = >::method::; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: user substs: UserSubsts { substs: [^0, ^1, u32], user_self_ty: None } - --> $DIR/dump-fn-method.rs:52:5 +error: user substs: UserSubsts { substs: [Bound(DebruijnIndex(0), BoundTy { var: 0, kind: Anon }), Bound(DebruijnIndex(0), BoundTy { var: 1, kind: Anon }), Uint(U32)], user_self_ty: None } + --> $DIR/dump-fn-method.rs:51:5 | LL | y.method::(44, 66); | ^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/print_type_sizes/async.stdout b/tests/ui/print_type_sizes/async.stdout index 6e47bb4930dc5..8e52d4c2a3a16 100644 --- a/tests/ui/print_type_sizes/async.stdout +++ b/tests/ui/print_type_sizes/async.stdout @@ -1,4 +1,4 @@ -print-type-size type: `[async fn body@$DIR/async.rs:8:36: 11:2]`: 16386 bytes, alignment: 1 bytes +print-type-size type: `Generator(DefId(0:7 ~ async[505d]::test::{closure#0}), [Adt(std::future::ResumeTy, []), Tuple([]), Tuple([]), GeneratorWitness(Binder([Adt(std::future::ResumeTy, []), Array(Uint(U8), Const { ty: Uint(Usize), kind: Value(Leaf(0x0000000000002000)) }), Generator(DefId(0:4 ~ async[505d]::wait::{closure#0}), [Adt(std::future::ResumeTy, []), Tuple([]), Tuple([]), GeneratorWitness(Binder([], [])), Tuple([])], Static), Tuple([])], [])), Tuple([Array(Uint(U8), Const { ty: Uint(Usize), kind: Value(Leaf(0x0000000000002000)) })])], Static)`: 16386 bytes, alignment: 1 bytes print-type-size discriminant: 1 bytes print-type-size variant `Suspend0`: 16385 bytes print-type-size field `.arg`: 8192 bytes, offset: 0 bytes, alignment: 1 bytes @@ -10,25 +10,25 @@ print-type-size variant `Returned`: 8192 bytes print-type-size field `.arg`: 8192 bytes, offset: 0 bytes, alignment: 1 bytes print-type-size variant `Panicked`: 8192 bytes print-type-size field `.arg`: 8192 bytes, offset: 0 bytes, alignment: 1 bytes -print-type-size type: `std::mem::ManuallyDrop<[u8; 8192]>`: 8192 bytes, alignment: 1 bytes +print-type-size type: `Adt(std::mem::ManuallyDrop, [Array(Uint(U8), Const { ty: Uint(Usize), kind: Value(Leaf(0x0000000000002000)) })])`: 8192 bytes, alignment: 1 bytes print-type-size field `.value`: 8192 bytes -print-type-size type: `std::mem::MaybeUninit<[u8; 8192]>`: 8192 bytes, alignment: 1 bytes +print-type-size type: `Adt(std::mem::MaybeUninit, [Array(Uint(U8), Const { ty: Uint(Usize), kind: Value(Leaf(0x0000000000002000)) })])`: 8192 bytes, alignment: 1 bytes print-type-size variant `MaybeUninit`: 8192 bytes print-type-size field `.uninit`: 0 bytes print-type-size field `.value`: 8192 bytes -print-type-size type: `[async fn body@$DIR/async.rs:6:17: 6:19]`: 1 bytes, alignment: 1 bytes -print-type-size discriminant: 1 bytes -print-type-size variant `Unresumed`: 0 bytes -print-type-size variant `Returned`: 0 bytes -print-type-size variant `Panicked`: 0 bytes -print-type-size type: `std::mem::ManuallyDrop<[async fn body@$DIR/async.rs:6:17: 6:19]>`: 1 bytes, alignment: 1 bytes +print-type-size type: `Adt(std::mem::ManuallyDrop, [Generator(DefId(0:4 ~ async[505d]::wait::{closure#0}), [Adt(std::future::ResumeTy, []), Tuple([]), Tuple([]), GeneratorWitness(Binder([], [])), Tuple([])], Static)])`: 1 bytes, alignment: 1 bytes print-type-size field `.value`: 1 bytes -print-type-size type: `std::mem::MaybeUninit<[async fn body@$DIR/async.rs:6:17: 6:19]>`: 1 bytes, alignment: 1 bytes +print-type-size type: `Adt(std::mem::MaybeUninit, [Generator(DefId(0:4 ~ async[505d]::wait::{closure#0}), [Adt(std::future::ResumeTy, []), Tuple([]), Tuple([]), GeneratorWitness(Binder([], [])), Tuple([])], Static)])`: 1 bytes, alignment: 1 bytes print-type-size variant `MaybeUninit`: 1 bytes print-type-size field `.uninit`: 0 bytes print-type-size field `.value`: 1 bytes -print-type-size type: `std::task::Poll<()>`: 1 bytes, alignment: 1 bytes +print-type-size type: `Adt(std::task::Poll, [Tuple([])])`: 1 bytes, alignment: 1 bytes print-type-size discriminant: 1 bytes print-type-size variant `Ready`: 0 bytes print-type-size field `.0`: 0 bytes print-type-size variant `Pending`: 0 bytes +print-type-size type: `Generator(DefId(0:4 ~ async[505d]::wait::{closure#0}), [Adt(std::future::ResumeTy, []), Tuple([]), Tuple([]), GeneratorWitness(Binder([], [])), Tuple([])], Static)`: 1 bytes, alignment: 1 bytes +print-type-size discriminant: 1 bytes +print-type-size variant `Unresumed`: 0 bytes +print-type-size variant `Returned`: 0 bytes +print-type-size variant `Panicked`: 0 bytes diff --git a/tests/ui/print_type_sizes/generator.stdout b/tests/ui/print_type_sizes/generator.stdout index 28d4a6e6cff40..fc627d6b37a6a 100644 --- a/tests/ui/print_type_sizes/generator.stdout +++ b/tests/ui/print_type_sizes/generator.stdout @@ -1,4 +1,4 @@ -print-type-size type: `[generator@$DIR/generator.rs:10:5: 10:14]`: 8193 bytes, alignment: 1 bytes +print-type-size type: `Generator(DefId(0:7 ~ generator[151b]::generator::{closure#0}), [Const { ty: Uint(Usize), kind: Value(Leaf(0x0000000000002000)) }, Tuple([]), Tuple([]), Tuple([]), GeneratorWitness(Binder([Tuple([])], [])), Tuple([Array(Uint(U8), Const { ty: Uint(Usize), kind: Value(Leaf(0x0000000000002000)) })])], Movable)`: 8193 bytes, alignment: 1 bytes print-type-size discriminant: 1 bytes print-type-size variant `Unresumed`: 8192 bytes print-type-size field `.array`: 8192 bytes, offset: 0 bytes, alignment: 1 bytes diff --git a/tests/ui/print_type_sizes/generator_discr_placement.stdout b/tests/ui/print_type_sizes/generator_discr_placement.stdout index 7f8f4ccae7c14..415486c7c0f25 100644 --- a/tests/ui/print_type_sizes/generator_discr_placement.stdout +++ b/tests/ui/print_type_sizes/generator_discr_placement.stdout @@ -1,4 +1,4 @@ -print-type-size type: `[generator@$DIR/generator_discr_placement.rs:11:13: 11:15]`: 8 bytes, alignment: 4 bytes +print-type-size type: `Generator(DefId(0:4 ~ generator_discr_placement[c59c]::foo::{closure#0}), [Tuple([]), Tuple([]), Tuple([]), GeneratorWitness(Binder([Int(I32), Tuple([])], [])), Tuple([])], Movable)`: 8 bytes, alignment: 4 bytes print-type-size discriminant: 1 bytes print-type-size variant `Suspend0`: 7 bytes print-type-size padding: 3 bytes diff --git a/tests/ui/print_type_sizes/generics.stdout b/tests/ui/print_type_sizes/generics.stdout index 0f02f39795365..122a26c1b8ded 100644 --- a/tests/ui/print_type_sizes/generics.stdout +++ b/tests/ui/print_type_sizes/generics.stdout @@ -1,14 +1,14 @@ -print-type-size type: `Pair`: 100 bytes, alignment: 1 bytes +print-type-size type: `Adt(Pair, [Adt(FiftyBytes, [])])`: 100 bytes, alignment: 1 bytes print-type-size field `._car`: 50 bytes print-type-size field `._cdr`: 50 bytes -print-type-size type: `FiftyBytes`: 50 bytes, alignment: 1 bytes +print-type-size type: `Adt(FiftyBytes, [])`: 50 bytes, alignment: 1 bytes print-type-size field `.0`: 50 bytes -print-type-size type: `Pair`: 14 bytes, alignment: 1 bytes +print-type-size type: `Adt(Pair, [Adt(SevenBytes, [])])`: 14 bytes, alignment: 1 bytes print-type-size field `._car`: 7 bytes print-type-size field `._cdr`: 7 bytes -print-type-size type: `SevenBytes`: 7 bytes, alignment: 1 bytes +print-type-size type: `Adt(SevenBytes, [])`: 7 bytes, alignment: 1 bytes print-type-size field `.0`: 7 bytes -print-type-size type: `Pair`: 2 bytes, alignment: 1 bytes +print-type-size type: `Adt(Pair, [Uint(U8)])`: 2 bytes, alignment: 1 bytes print-type-size field `._car`: 1 bytes print-type-size field `._cdr`: 1 bytes -print-type-size type: `ZeroSized`: 0 bytes, alignment: 1 bytes +print-type-size type: `Adt(ZeroSized, [])`: 0 bytes, alignment: 1 bytes diff --git a/tests/ui/print_type_sizes/multiple_types.stdout b/tests/ui/print_type_sizes/multiple_types.stdout index 6411881545843..27a750bf1c70d 100644 --- a/tests/ui/print_type_sizes/multiple_types.stdout +++ b/tests/ui/print_type_sizes/multiple_types.stdout @@ -1,10 +1,10 @@ -print-type-size type: `Enum`: 51 bytes, alignment: 1 bytes +print-type-size type: `Adt(Enum, [])`: 51 bytes, alignment: 1 bytes print-type-size discriminant: 1 bytes print-type-size variant `Large`: 50 bytes print-type-size field `.0`: 50 bytes print-type-size variant `Small`: 7 bytes print-type-size field `.0`: 7 bytes -print-type-size type: `FiftyBytes`: 50 bytes, alignment: 1 bytes +print-type-size type: `Adt(FiftyBytes, [])`: 50 bytes, alignment: 1 bytes print-type-size field `.0`: 50 bytes -print-type-size type: `SevenBytes`: 7 bytes, alignment: 1 bytes +print-type-size type: `Adt(SevenBytes, [])`: 7 bytes, alignment: 1 bytes print-type-size field `.0`: 7 bytes diff --git a/tests/ui/print_type_sizes/niche-filling.stdout b/tests/ui/print_type_sizes/niche-filling.stdout index d1753c26ca83b..acc5e406c1d41 100644 --- a/tests/ui/print_type_sizes/niche-filling.stdout +++ b/tests/ui/print_type_sizes/niche-filling.stdout @@ -1,40 +1,40 @@ -print-type-size type: `IndirectNonZero`: 12 bytes, alignment: 4 bytes +print-type-size type: `Adt(IndirectNonZero, [])`: 12 bytes, alignment: 4 bytes print-type-size field `.nested`: 8 bytes print-type-size field `.post`: 2 bytes print-type-size field `.pre`: 1 bytes print-type-size end padding: 1 bytes -print-type-size type: `MyOption`: 12 bytes, alignment: 4 bytes +print-type-size type: `Adt(MyOption, [Adt(IndirectNonZero, [])])`: 12 bytes, alignment: 4 bytes print-type-size variant `Some`: 12 bytes print-type-size field `.0`: 12 bytes print-type-size variant `None`: 0 bytes -print-type-size type: `EmbeddedDiscr`: 8 bytes, alignment: 4 bytes +print-type-size type: `Adt(EmbeddedDiscr, [])`: 8 bytes, alignment: 4 bytes print-type-size discriminant: 1 bytes print-type-size variant `Record`: 7 bytes print-type-size field `.pre`: 1 bytes print-type-size field `.post`: 2 bytes print-type-size field `.val`: 4 bytes print-type-size variant `None`: 0 bytes -print-type-size type: `MyOption>`: 8 bytes, alignment: 4 bytes +print-type-size type: `Adt(MyOption, [Adt(Union1, [Adt(std::num::NonZeroU32, [])])])`: 8 bytes, alignment: 4 bytes print-type-size discriminant: 4 bytes print-type-size variant `Some`: 4 bytes print-type-size field `.0`: 4 bytes print-type-size variant `None`: 0 bytes -print-type-size type: `MyOption>`: 8 bytes, alignment: 4 bytes +print-type-size type: `Adt(MyOption, [Adt(Union2, [Adt(std::num::NonZeroU32, []), Adt(std::num::NonZeroU32, [])])])`: 8 bytes, alignment: 4 bytes print-type-size discriminant: 4 bytes print-type-size variant `Some`: 4 bytes print-type-size field `.0`: 4 bytes print-type-size variant `None`: 0 bytes -print-type-size type: `MyOption>`: 8 bytes, alignment: 4 bytes +print-type-size type: `Adt(MyOption, [Adt(Union2, [Adt(std::num::NonZeroU32, []), Uint(U32)])])`: 8 bytes, alignment: 4 bytes print-type-size discriminant: 4 bytes print-type-size variant `Some`: 4 bytes print-type-size field `.0`: 4 bytes print-type-size variant `None`: 0 bytes -print-type-size type: `NestedNonZero`: 8 bytes, alignment: 4 bytes +print-type-size type: `Adt(NestedNonZero, [])`: 8 bytes, alignment: 4 bytes print-type-size field `.val`: 4 bytes print-type-size field `.post`: 2 bytes print-type-size field `.pre`: 1 bytes print-type-size end padding: 1 bytes -print-type-size type: `Enum4<(), char, (), ()>`: 4 bytes, alignment: 4 bytes +print-type-size type: `Adt(Enum4, [Tuple([]), Char, Tuple([]), Tuple([])])`: 4 bytes, alignment: 4 bytes print-type-size variant `Two`: 4 bytes print-type-size field `.0`: 4 bytes print-type-size variant `One`: 0 bytes @@ -43,34 +43,34 @@ print-type-size variant `Three`: 0 bytes print-type-size field `.0`: 0 bytes print-type-size variant `Four`: 0 bytes print-type-size field `.0`: 0 bytes -print-type-size type: `MyNotNegativeOne`: 4 bytes, alignment: 4 bytes +print-type-size type: `Adt(MyNotNegativeOne, [])`: 4 bytes, alignment: 4 bytes print-type-size field `._i`: 4 bytes -print-type-size type: `MyOption`: 4 bytes, alignment: 4 bytes +print-type-size type: `Adt(MyOption, [Adt(MyNotNegativeOne, [])])`: 4 bytes, alignment: 4 bytes print-type-size variant `Some`: 4 bytes print-type-size field `.0`: 4 bytes print-type-size variant `None`: 0 bytes -print-type-size type: `MyOption`: 4 bytes, alignment: 4 bytes +print-type-size type: `Adt(MyOption, [Adt(std::num::NonZeroU32, [])])`: 4 bytes, alignment: 4 bytes print-type-size variant `Some`: 4 bytes print-type-size field `.0`: 4 bytes print-type-size variant `None`: 0 bytes -print-type-size type: `MyOption`: 4 bytes, alignment: 4 bytes +print-type-size type: `Adt(MyOption, [Char])`: 4 bytes, alignment: 4 bytes print-type-size variant `Some`: 4 bytes print-type-size field `.0`: 4 bytes print-type-size variant `None`: 0 bytes -print-type-size type: `Union1`: 4 bytes, alignment: 4 bytes +print-type-size type: `Adt(Union1, [Adt(std::num::NonZeroU32, [])])`: 4 bytes, alignment: 4 bytes print-type-size variant `Union1`: 4 bytes print-type-size field `.a`: 4 bytes -print-type-size type: `Union2`: 4 bytes, alignment: 4 bytes +print-type-size type: `Adt(Union2, [Adt(std::num::NonZeroU32, []), Adt(std::num::NonZeroU32, [])])`: 4 bytes, alignment: 4 bytes 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: `Union2`: 4 bytes, alignment: 4 bytes +print-type-size type: `Adt(Union2, [Adt(std::num::NonZeroU32, []), Uint(U32)])`: 4 bytes, alignment: 4 bytes 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: `std::num::NonZeroU32`: 4 bytes, alignment: 4 bytes +print-type-size type: `Adt(std::num::NonZeroU32, [])`: 4 bytes, alignment: 4 bytes print-type-size field `.0`: 4 bytes -print-type-size type: `Enum4<(), (), (), MyOption>`: 2 bytes, alignment: 1 bytes +print-type-size type: `Adt(Enum4, [Tuple([]), Tuple([]), Tuple([]), Adt(MyOption, [Uint(U8)])])`: 2 bytes, alignment: 1 bytes print-type-size variant `Four`: 2 bytes print-type-size field `.0`: 2 bytes print-type-size variant `One`: 0 bytes @@ -79,16 +79,16 @@ print-type-size variant `Two`: 0 bytes print-type-size field `.0`: 0 bytes print-type-size variant `Three`: 0 bytes print-type-size field `.0`: 0 bytes -print-type-size type: `MyOption>`: 2 bytes, alignment: 1 bytes +print-type-size type: `Adt(MyOption, [Adt(MyOption, [Uint(U8)])])`: 2 bytes, alignment: 1 bytes print-type-size variant `Some`: 2 bytes print-type-size field `.0`: 2 bytes print-type-size variant `None`: 0 bytes -print-type-size type: `MyOption`: 2 bytes, alignment: 1 bytes +print-type-size type: `Adt(MyOption, [Uint(U8)])`: 2 bytes, alignment: 1 bytes print-type-size discriminant: 1 bytes print-type-size variant `Some`: 1 bytes print-type-size field `.0`: 1 bytes print-type-size variant `None`: 0 bytes -print-type-size type: `Enum4<(), (), bool, ()>`: 1 bytes, alignment: 1 bytes +print-type-size type: `Adt(Enum4, [Tuple([]), Tuple([]), Bool, Tuple([])])`: 1 bytes, alignment: 1 bytes print-type-size variant `Three`: 1 bytes print-type-size field `.0`: 1 bytes print-type-size variant `One`: 0 bytes @@ -97,15 +97,15 @@ print-type-size variant `Two`: 0 bytes print-type-size field `.0`: 0 bytes print-type-size variant `Four`: 0 bytes print-type-size field `.0`: 0 bytes -print-type-size type: `MyOption`: 1 bytes, alignment: 1 bytes +print-type-size type: `Adt(MyOption, [Adt(std::cmp::Ordering, [])])`: 1 bytes, alignment: 1 bytes print-type-size variant `Some`: 1 bytes print-type-size field `.0`: 1 bytes print-type-size variant `None`: 0 bytes -print-type-size type: `MyOption`: 1 bytes, alignment: 1 bytes +print-type-size type: `Adt(MyOption, [Bool])`: 1 bytes, alignment: 1 bytes print-type-size variant `Some`: 1 bytes print-type-size field `.0`: 1 bytes print-type-size variant `None`: 0 bytes -print-type-size type: `std::cmp::Ordering`: 1 bytes, alignment: 1 bytes +print-type-size type: `Adt(std::cmp::Ordering, [])`: 1 bytes, alignment: 1 bytes print-type-size discriminant: 1 bytes print-type-size variant `Less`: 0 bytes print-type-size variant `Equal`: 0 bytes diff --git a/tests/ui/print_type_sizes/no_duplicates.stdout b/tests/ui/print_type_sizes/no_duplicates.stdout index 50180f356ea36..2d5386f7446c8 100644 --- a/tests/ui/print_type_sizes/no_duplicates.stdout +++ b/tests/ui/print_type_sizes/no_duplicates.stdout @@ -1,2 +1,2 @@ -print-type-size type: `SevenBytes`: 7 bytes, alignment: 1 bytes +print-type-size type: `Adt(SevenBytes, [])`: 7 bytes, alignment: 1 bytes print-type-size field `.0`: 7 bytes diff --git a/tests/ui/print_type_sizes/packed.stdout b/tests/ui/print_type_sizes/packed.stdout index 58e1bac9eb794..eb8015b099e0f 100644 --- a/tests/ui/print_type_sizes/packed.stdout +++ b/tests/ui/print_type_sizes/packed.stdout @@ -1,4 +1,4 @@ -print-type-size type: `Packed2C`: 12 bytes, alignment: 2 bytes +print-type-size type: `Adt(Packed2C, [])`: 12 bytes, alignment: 2 bytes print-type-size field `.a`: 1 bytes print-type-size field `.b`: 1 bytes print-type-size field `.g`: 4 bytes @@ -7,7 +7,7 @@ print-type-size padding: 1 bytes print-type-size field `.h`: 2 bytes print-type-size field `.d`: 1 bytes print-type-size end padding: 1 bytes -print-type-size type: `Padded`: 12 bytes, alignment: 4 bytes +print-type-size type: `Adt(Padded, [])`: 12 bytes, alignment: 4 bytes print-type-size field `.g`: 4 bytes print-type-size field `.h`: 2 bytes print-type-size field `.a`: 1 bytes @@ -15,14 +15,14 @@ print-type-size field `.b`: 1 bytes print-type-size field `.c`: 1 bytes print-type-size field `.d`: 1 bytes print-type-size end padding: 2 bytes -print-type-size type: `Packed1`: 10 bytes, alignment: 1 bytes +print-type-size type: `Adt(Packed1, [])`: 10 bytes, alignment: 1 bytes print-type-size field `.a`: 1 bytes print-type-size field `.b`: 1 bytes print-type-size field `.g`: 4 bytes print-type-size field `.c`: 1 bytes print-type-size field `.h`: 2 bytes print-type-size field `.d`: 1 bytes -print-type-size type: `Packed2`: 10 bytes, alignment: 2 bytes +print-type-size type: `Adt(Packed2, [])`: 10 bytes, alignment: 2 bytes print-type-size field `.g`: 4 bytes print-type-size field `.h`: 2 bytes print-type-size field `.a`: 1 bytes diff --git a/tests/ui/print_type_sizes/padding.stdout b/tests/ui/print_type_sizes/padding.stdout index 9afdf76245df7..585b9010faec4 100644 --- a/tests/ui/print_type_sizes/padding.stdout +++ b/tests/ui/print_type_sizes/padding.stdout @@ -1,4 +1,4 @@ -print-type-size type: `E1`: 12 bytes, alignment: 4 bytes +print-type-size type: `Adt(E1, [])`: 12 bytes, alignment: 4 bytes print-type-size discriminant: 1 bytes print-type-size variant `B`: 11 bytes print-type-size padding: 3 bytes @@ -7,7 +7,7 @@ print-type-size variant `A`: 7 bytes print-type-size field `.1`: 1 bytes print-type-size padding: 2 bytes print-type-size field `.0`: 4 bytes, alignment: 4 bytes -print-type-size type: `E2`: 12 bytes, alignment: 4 bytes +print-type-size type: `Adt(E2, [])`: 12 bytes, alignment: 4 bytes print-type-size discriminant: 1 bytes print-type-size variant `B`: 11 bytes print-type-size padding: 3 bytes @@ -16,7 +16,7 @@ print-type-size variant `A`: 7 bytes print-type-size field `.0`: 1 bytes print-type-size padding: 2 bytes print-type-size field `.1`: 4 bytes, alignment: 4 bytes -print-type-size type: `S`: 8 bytes, alignment: 4 bytes +print-type-size type: `Adt(S, [])`: 8 bytes, alignment: 4 bytes print-type-size field `.g`: 4 bytes print-type-size field `.a`: 1 bytes print-type-size field `.b`: 1 bytes diff --git a/tests/ui/print_type_sizes/repr-align.stdout b/tests/ui/print_type_sizes/repr-align.stdout index 33671bd8e14bc..caeca800da2f4 100644 --- a/tests/ui/print_type_sizes/repr-align.stdout +++ b/tests/ui/print_type_sizes/repr-align.stdout @@ -1,16 +1,16 @@ -print-type-size type: `E`: 32 bytes, alignment: 16 bytes +print-type-size type: `Adt(E, [])`: 32 bytes, alignment: 16 bytes print-type-size discriminant: 4 bytes print-type-size variant `B`: 28 bytes print-type-size padding: 12 bytes print-type-size field `.0`: 16 bytes, alignment: 16 bytes print-type-size variant `A`: 4 bytes print-type-size field `.0`: 4 bytes -print-type-size type: `S`: 32 bytes, alignment: 16 bytes +print-type-size type: `Adt(S, [])`: 32 bytes, alignment: 16 bytes print-type-size field `.c`: 16 bytes print-type-size field `.a`: 4 bytes print-type-size field `.b`: 4 bytes print-type-size field `.d`: 1 bytes print-type-size end padding: 7 bytes -print-type-size type: `A`: 16 bytes, alignment: 16 bytes +print-type-size type: `Adt(A, [])`: 16 bytes, alignment: 16 bytes print-type-size field `.0`: 4 bytes print-type-size end padding: 12 bytes diff --git a/tests/ui/print_type_sizes/repr_int_c.stdout b/tests/ui/print_type_sizes/repr_int_c.stdout index 254b3c7a8531e..384eeafc8b6d3 100644 --- a/tests/ui/print_type_sizes/repr_int_c.stdout +++ b/tests/ui/print_type_sizes/repr_int_c.stdout @@ -1,10 +1,10 @@ -print-type-size type: `ReprCu8`: 4 bytes, alignment: 2 bytes +print-type-size type: `Adt(ReprCu8, [])`: 4 bytes, alignment: 2 bytes print-type-size discriminant: 1 bytes print-type-size variant `A`: 3 bytes print-type-size padding: 1 bytes print-type-size field `.0`: 2 bytes, alignment: 2 bytes print-type-size variant `B`: 1 bytes -print-type-size type: `Repru8`: 4 bytes, alignment: 2 bytes +print-type-size type: `Adt(Repru8, [])`: 4 bytes, alignment: 2 bytes print-type-size discriminant: 1 bytes print-type-size variant `A`: 3 bytes print-type-size padding: 1 bytes diff --git a/tests/ui/print_type_sizes/uninhabited.stdout b/tests/ui/print_type_sizes/uninhabited.stdout index 5eb5384bce340..5c1c31bd339b8 100644 --- a/tests/ui/print_type_sizes/uninhabited.stdout +++ b/tests/ui/print_type_sizes/uninhabited.stdout @@ -1,6 +1,6 @@ -print-type-size type: `std::result::Result`: 4 bytes, alignment: 4 bytes +print-type-size type: `Adt(std::result::Result, [Uint(U32), Never])`: 4 bytes, alignment: 4 bytes print-type-size variant `Ok`: 4 bytes print-type-size field `.0`: 4 bytes -print-type-size type: `std::option::Option`: 0 bytes, alignment: 1 bytes +print-type-size type: `Adt(std::option::Option, [Never])`: 0 bytes, alignment: 1 bytes print-type-size variant `None`: 0 bytes -print-type-size type: `std::result::Result`: 0 bytes, alignment: 1 bytes +print-type-size type: `Adt(std::result::Result, [Never, Never])`: 0 bytes, alignment: 1 bytes diff --git a/tests/ui/print_type_sizes/variants.stdout b/tests/ui/print_type_sizes/variants.stdout index 6411881545843..27a750bf1c70d 100644 --- a/tests/ui/print_type_sizes/variants.stdout +++ b/tests/ui/print_type_sizes/variants.stdout @@ -1,10 +1,10 @@ -print-type-size type: `Enum`: 51 bytes, alignment: 1 bytes +print-type-size type: `Adt(Enum, [])`: 51 bytes, alignment: 1 bytes print-type-size discriminant: 1 bytes print-type-size variant `Large`: 50 bytes print-type-size field `.0`: 50 bytes print-type-size variant `Small`: 7 bytes print-type-size field `.0`: 7 bytes -print-type-size type: `FiftyBytes`: 50 bytes, alignment: 1 bytes +print-type-size type: `Adt(FiftyBytes, [])`: 50 bytes, alignment: 1 bytes print-type-size field `.0`: 50 bytes -print-type-size type: `SevenBytes`: 7 bytes, alignment: 1 bytes +print-type-size type: `Adt(SevenBytes, [])`: 7 bytes, alignment: 1 bytes print-type-size field `.0`: 7 bytes diff --git a/tests/ui/print_type_sizes/zero-sized-fields.stdout b/tests/ui/print_type_sizes/zero-sized-fields.stdout index 72f59c4bb57bf..66f5b379d4062 100644 --- a/tests/ui/print_type_sizes/zero-sized-fields.stdout +++ b/tests/ui/print_type_sizes/zero-sized-fields.stdout @@ -1,4 +1,4 @@ -print-type-size type: `S5<(), Empty>`: 16 bytes, alignment: 4 bytes +print-type-size type: `Adt(S5, [Tuple([]), Adt(Empty, [])])`: 16 bytes, alignment: 4 bytes print-type-size field `.tagw`: 0 bytes print-type-size field `.unit`: 0 bytes print-type-size field `.void`: 0 bytes @@ -8,9 +8,9 @@ print-type-size field `.w`: 4 bytes print-type-size field `.x`: 4 bytes print-type-size field `.y`: 4 bytes print-type-size field `.z`: 4 bytes -print-type-size type: `S1`: 8 bytes, alignment: 4 bytes +print-type-size type: `Adt(S1, [])`: 8 bytes, alignment: 4 bytes print-type-size field `.tag`: 0 bytes print-type-size field `.x`: 4 bytes print-type-size field `.y`: 4 bytes -print-type-size type: `Empty`: 0 bytes, alignment: 1 bytes -print-type-size type: `Void`: 0 bytes, alignment: 1 bytes +print-type-size type: `Adt(Empty, [])`: 0 bytes, alignment: 1 bytes +print-type-size type: `Adt(Void, [])`: 0 bytes, alignment: 1 bytes diff --git a/tests/ui/thir-print/thir-flat.stdout b/tests/ui/thir-print/thir-flat.stdout index c399fa66b6a03..3f855383c5439 100644 --- a/tests/ui/thir-print/thir-flat.stdout +++ b/tests/ui/thir-print/thir-flat.stdout @@ -14,7 +14,9 @@ Thir { ], exprs: [ Expr { - ty: (), + ty: Tuple( + [], + ), temp_lifetime: Some( Node(2), ), @@ -24,7 +26,9 @@ Thir { }, }, Expr { - ty: (), + ty: Tuple( + [], + ), temp_lifetime: Some( Node(2), ), @@ -38,7 +42,9 @@ Thir { }, }, Expr { - ty: (), + ty: Tuple( + [], + ), temp_lifetime: Some( Node(2), ), From 32e3232f3cffd5d560a27cbb95cb2204f2fcbe20 Mon Sep 17 00:00:00 2001 From: Boxy Date: Thu, 19 Jan 2023 20:43:15 +0000 Subject: [PATCH 2/8] make type layout use display --- compiler/rustc_ty_utils/src/layout.rs | 2 +- tests/ui/print_type_sizes/async.stdout | 14 +++--- tests/ui/print_type_sizes/generator.stdout | 2 +- .../generator_discr_placement.stdout | 2 +- tests/ui/print_type_sizes/generics.stdout | 12 ++--- .../ui/print_type_sizes/multiple_types.stdout | 6 +-- .../ui/print_type_sizes/niche-filling.stdout | 48 +++++++++---------- .../ui/print_type_sizes/no_duplicates.stdout | 2 +- tests/ui/print_type_sizes/packed.stdout | 8 ++-- tests/ui/print_type_sizes/padding.stdout | 6 +-- tests/ui/print_type_sizes/repr-align.stdout | 6 +-- tests/ui/print_type_sizes/repr_int_c.stdout | 4 +- tests/ui/print_type_sizes/uninhabited.stdout | 6 +-- tests/ui/print_type_sizes/variants.stdout | 6 +-- .../print_type_sizes/zero-sized-fields.stdout | 8 ++-- 15 files changed, 66 insertions(+), 66 deletions(-) diff --git a/compiler/rustc_ty_utils/src/layout.rs b/compiler/rustc_ty_utils/src/layout.rs index 378cd5a99ed86..db09e7bb04dcb 100644 --- a/compiler/rustc_ty_utils/src/layout.rs +++ b/compiler/rustc_ty_utils/src/layout.rs @@ -826,7 +826,7 @@ fn record_layout_for_printing_outlined<'tcx>( // (delay format until we actually need it) let record = |kind, packed, opt_discr_size, variants| { - let type_desc = format!("{:?}", layout.ty); + let type_desc = format!("{}", layout.ty); cx.tcx.sess.code_stats.record_type_size( kind, type_desc, diff --git a/tests/ui/print_type_sizes/async.stdout b/tests/ui/print_type_sizes/async.stdout index 8e52d4c2a3a16..ab4e23aa30d0f 100644 --- a/tests/ui/print_type_sizes/async.stdout +++ b/tests/ui/print_type_sizes/async.stdout @@ -1,4 +1,4 @@ -print-type-size type: `Generator(DefId(0:7 ~ async[505d]::test::{closure#0}), [Adt(std::future::ResumeTy, []), Tuple([]), Tuple([]), GeneratorWitness(Binder([Adt(std::future::ResumeTy, []), Array(Uint(U8), Const { ty: Uint(Usize), kind: Value(Leaf(0x0000000000002000)) }), Generator(DefId(0:4 ~ async[505d]::wait::{closure#0}), [Adt(std::future::ResumeTy, []), Tuple([]), Tuple([]), GeneratorWitness(Binder([], [])), Tuple([])], Static), Tuple([])], [])), Tuple([Array(Uint(U8), Const { ty: Uint(Usize), kind: Value(Leaf(0x0000000000002000)) })])], Static)`: 16386 bytes, alignment: 1 bytes +print-type-size type: `[async fn body@$DIR/async.rs:8:36: 11:2]`: 16386 bytes, alignment: 1 bytes print-type-size discriminant: 1 bytes print-type-size variant `Suspend0`: 16385 bytes print-type-size field `.arg`: 8192 bytes, offset: 0 bytes, alignment: 1 bytes @@ -10,24 +10,24 @@ print-type-size variant `Returned`: 8192 bytes print-type-size field `.arg`: 8192 bytes, offset: 0 bytes, alignment: 1 bytes print-type-size variant `Panicked`: 8192 bytes print-type-size field `.arg`: 8192 bytes, offset: 0 bytes, alignment: 1 bytes -print-type-size type: `Adt(std::mem::ManuallyDrop, [Array(Uint(U8), Const { ty: Uint(Usize), kind: Value(Leaf(0x0000000000002000)) })])`: 8192 bytes, alignment: 1 bytes +print-type-size type: `ManuallyDrop<[u8; 8192]>`: 8192 bytes, alignment: 1 bytes print-type-size field `.value`: 8192 bytes -print-type-size type: `Adt(std::mem::MaybeUninit, [Array(Uint(U8), Const { ty: Uint(Usize), kind: Value(Leaf(0x0000000000002000)) })])`: 8192 bytes, alignment: 1 bytes +print-type-size type: `MaybeUninit<[u8; 8192]>`: 8192 bytes, alignment: 1 bytes print-type-size variant `MaybeUninit`: 8192 bytes print-type-size field `.uninit`: 0 bytes print-type-size field `.value`: 8192 bytes -print-type-size type: `Adt(std::mem::ManuallyDrop, [Generator(DefId(0:4 ~ async[505d]::wait::{closure#0}), [Adt(std::future::ResumeTy, []), Tuple([]), Tuple([]), GeneratorWitness(Binder([], [])), Tuple([])], Static)])`: 1 bytes, alignment: 1 bytes +print-type-size type: `ManuallyDrop<[async fn body@$DIR/async.rs:6:17: 6:19]>`: 1 bytes, alignment: 1 bytes print-type-size field `.value`: 1 bytes -print-type-size type: `Adt(std::mem::MaybeUninit, [Generator(DefId(0:4 ~ async[505d]::wait::{closure#0}), [Adt(std::future::ResumeTy, []), Tuple([]), Tuple([]), GeneratorWitness(Binder([], [])), Tuple([])], Static)])`: 1 bytes, alignment: 1 bytes +print-type-size type: `MaybeUninit<[async fn body@$DIR/async.rs:6:17: 6:19]>`: 1 bytes, alignment: 1 bytes print-type-size variant `MaybeUninit`: 1 bytes print-type-size field `.uninit`: 0 bytes print-type-size field `.value`: 1 bytes -print-type-size type: `Adt(std::task::Poll, [Tuple([])])`: 1 bytes, alignment: 1 bytes +print-type-size type: `Poll<()>`: 1 bytes, alignment: 1 bytes print-type-size discriminant: 1 bytes print-type-size variant `Ready`: 0 bytes print-type-size field `.0`: 0 bytes print-type-size variant `Pending`: 0 bytes -print-type-size type: `Generator(DefId(0:4 ~ async[505d]::wait::{closure#0}), [Adt(std::future::ResumeTy, []), Tuple([]), Tuple([]), GeneratorWitness(Binder([], [])), Tuple([])], Static)`: 1 bytes, alignment: 1 bytes +print-type-size type: `[async fn body@$DIR/async.rs:6:17: 6:19]`: 1 bytes, alignment: 1 bytes print-type-size discriminant: 1 bytes print-type-size variant `Unresumed`: 0 bytes print-type-size variant `Returned`: 0 bytes diff --git a/tests/ui/print_type_sizes/generator.stdout b/tests/ui/print_type_sizes/generator.stdout index fc627d6b37a6a..28d4a6e6cff40 100644 --- a/tests/ui/print_type_sizes/generator.stdout +++ b/tests/ui/print_type_sizes/generator.stdout @@ -1,4 +1,4 @@ -print-type-size type: `Generator(DefId(0:7 ~ generator[151b]::generator::{closure#0}), [Const { ty: Uint(Usize), kind: Value(Leaf(0x0000000000002000)) }, Tuple([]), Tuple([]), Tuple([]), GeneratorWitness(Binder([Tuple([])], [])), Tuple([Array(Uint(U8), Const { ty: Uint(Usize), kind: Value(Leaf(0x0000000000002000)) })])], Movable)`: 8193 bytes, alignment: 1 bytes +print-type-size type: `[generator@$DIR/generator.rs:10:5: 10:14]`: 8193 bytes, alignment: 1 bytes print-type-size discriminant: 1 bytes print-type-size variant `Unresumed`: 8192 bytes print-type-size field `.array`: 8192 bytes, offset: 0 bytes, alignment: 1 bytes diff --git a/tests/ui/print_type_sizes/generator_discr_placement.stdout b/tests/ui/print_type_sizes/generator_discr_placement.stdout index 415486c7c0f25..7f8f4ccae7c14 100644 --- a/tests/ui/print_type_sizes/generator_discr_placement.stdout +++ b/tests/ui/print_type_sizes/generator_discr_placement.stdout @@ -1,4 +1,4 @@ -print-type-size type: `Generator(DefId(0:4 ~ generator_discr_placement[c59c]::foo::{closure#0}), [Tuple([]), Tuple([]), Tuple([]), GeneratorWitness(Binder([Int(I32), Tuple([])], [])), Tuple([])], Movable)`: 8 bytes, alignment: 4 bytes +print-type-size type: `[generator@$DIR/generator_discr_placement.rs:11:13: 11:15]`: 8 bytes, alignment: 4 bytes print-type-size discriminant: 1 bytes print-type-size variant `Suspend0`: 7 bytes print-type-size padding: 3 bytes diff --git a/tests/ui/print_type_sizes/generics.stdout b/tests/ui/print_type_sizes/generics.stdout index 122a26c1b8ded..0f02f39795365 100644 --- a/tests/ui/print_type_sizes/generics.stdout +++ b/tests/ui/print_type_sizes/generics.stdout @@ -1,14 +1,14 @@ -print-type-size type: `Adt(Pair, [Adt(FiftyBytes, [])])`: 100 bytes, alignment: 1 bytes +print-type-size type: `Pair`: 100 bytes, alignment: 1 bytes print-type-size field `._car`: 50 bytes print-type-size field `._cdr`: 50 bytes -print-type-size type: `Adt(FiftyBytes, [])`: 50 bytes, alignment: 1 bytes +print-type-size type: `FiftyBytes`: 50 bytes, alignment: 1 bytes print-type-size field `.0`: 50 bytes -print-type-size type: `Adt(Pair, [Adt(SevenBytes, [])])`: 14 bytes, alignment: 1 bytes +print-type-size type: `Pair`: 14 bytes, alignment: 1 bytes print-type-size field `._car`: 7 bytes print-type-size field `._cdr`: 7 bytes -print-type-size type: `Adt(SevenBytes, [])`: 7 bytes, alignment: 1 bytes +print-type-size type: `SevenBytes`: 7 bytes, alignment: 1 bytes print-type-size field `.0`: 7 bytes -print-type-size type: `Adt(Pair, [Uint(U8)])`: 2 bytes, alignment: 1 bytes +print-type-size type: `Pair`: 2 bytes, alignment: 1 bytes print-type-size field `._car`: 1 bytes print-type-size field `._cdr`: 1 bytes -print-type-size type: `Adt(ZeroSized, [])`: 0 bytes, alignment: 1 bytes +print-type-size type: `ZeroSized`: 0 bytes, alignment: 1 bytes diff --git a/tests/ui/print_type_sizes/multiple_types.stdout b/tests/ui/print_type_sizes/multiple_types.stdout index 27a750bf1c70d..6411881545843 100644 --- a/tests/ui/print_type_sizes/multiple_types.stdout +++ b/tests/ui/print_type_sizes/multiple_types.stdout @@ -1,10 +1,10 @@ -print-type-size type: `Adt(Enum, [])`: 51 bytes, alignment: 1 bytes +print-type-size type: `Enum`: 51 bytes, alignment: 1 bytes print-type-size discriminant: 1 bytes print-type-size variant `Large`: 50 bytes print-type-size field `.0`: 50 bytes print-type-size variant `Small`: 7 bytes print-type-size field `.0`: 7 bytes -print-type-size type: `Adt(FiftyBytes, [])`: 50 bytes, alignment: 1 bytes +print-type-size type: `FiftyBytes`: 50 bytes, alignment: 1 bytes print-type-size field `.0`: 50 bytes -print-type-size type: `Adt(SevenBytes, [])`: 7 bytes, alignment: 1 bytes +print-type-size type: `SevenBytes`: 7 bytes, alignment: 1 bytes print-type-size field `.0`: 7 bytes diff --git a/tests/ui/print_type_sizes/niche-filling.stdout b/tests/ui/print_type_sizes/niche-filling.stdout index acc5e406c1d41..d7d205daffafa 100644 --- a/tests/ui/print_type_sizes/niche-filling.stdout +++ b/tests/ui/print_type_sizes/niche-filling.stdout @@ -1,40 +1,40 @@ -print-type-size type: `Adt(IndirectNonZero, [])`: 12 bytes, alignment: 4 bytes +print-type-size type: `IndirectNonZero`: 12 bytes, alignment: 4 bytes print-type-size field `.nested`: 8 bytes print-type-size field `.post`: 2 bytes print-type-size field `.pre`: 1 bytes print-type-size end padding: 1 bytes -print-type-size type: `Adt(MyOption, [Adt(IndirectNonZero, [])])`: 12 bytes, alignment: 4 bytes +print-type-size type: `MyOption`: 12 bytes, alignment: 4 bytes print-type-size variant `Some`: 12 bytes print-type-size field `.0`: 12 bytes print-type-size variant `None`: 0 bytes -print-type-size type: `Adt(EmbeddedDiscr, [])`: 8 bytes, alignment: 4 bytes +print-type-size type: `EmbeddedDiscr`: 8 bytes, alignment: 4 bytes print-type-size discriminant: 1 bytes print-type-size variant `Record`: 7 bytes print-type-size field `.pre`: 1 bytes print-type-size field `.post`: 2 bytes print-type-size field `.val`: 4 bytes print-type-size variant `None`: 0 bytes -print-type-size type: `Adt(MyOption, [Adt(Union1, [Adt(std::num::NonZeroU32, [])])])`: 8 bytes, alignment: 4 bytes +print-type-size type: `MyOption>`: 8 bytes, alignment: 4 bytes print-type-size discriminant: 4 bytes print-type-size variant `Some`: 4 bytes print-type-size field `.0`: 4 bytes print-type-size variant `None`: 0 bytes -print-type-size type: `Adt(MyOption, [Adt(Union2, [Adt(std::num::NonZeroU32, []), Adt(std::num::NonZeroU32, [])])])`: 8 bytes, alignment: 4 bytes +print-type-size type: `MyOption>`: 8 bytes, alignment: 4 bytes print-type-size discriminant: 4 bytes print-type-size variant `Some`: 4 bytes print-type-size field `.0`: 4 bytes print-type-size variant `None`: 0 bytes -print-type-size type: `Adt(MyOption, [Adt(Union2, [Adt(std::num::NonZeroU32, []), Uint(U32)])])`: 8 bytes, alignment: 4 bytes +print-type-size type: `MyOption>`: 8 bytes, alignment: 4 bytes print-type-size discriminant: 4 bytes print-type-size variant `Some`: 4 bytes print-type-size field `.0`: 4 bytes print-type-size variant `None`: 0 bytes -print-type-size type: `Adt(NestedNonZero, [])`: 8 bytes, alignment: 4 bytes +print-type-size type: `NestedNonZero`: 8 bytes, alignment: 4 bytes print-type-size field `.val`: 4 bytes print-type-size field `.post`: 2 bytes print-type-size field `.pre`: 1 bytes print-type-size end padding: 1 bytes -print-type-size type: `Adt(Enum4, [Tuple([]), Char, Tuple([]), Tuple([])])`: 4 bytes, alignment: 4 bytes +print-type-size type: `Enum4<(), char, (), ()>`: 4 bytes, alignment: 4 bytes print-type-size variant `Two`: 4 bytes print-type-size field `.0`: 4 bytes print-type-size variant `One`: 0 bytes @@ -43,34 +43,34 @@ print-type-size variant `Three`: 0 bytes print-type-size field `.0`: 0 bytes print-type-size variant `Four`: 0 bytes print-type-size field `.0`: 0 bytes -print-type-size type: `Adt(MyNotNegativeOne, [])`: 4 bytes, alignment: 4 bytes +print-type-size type: `MyNotNegativeOne`: 4 bytes, alignment: 4 bytes print-type-size field `._i`: 4 bytes -print-type-size type: `Adt(MyOption, [Adt(MyNotNegativeOne, [])])`: 4 bytes, alignment: 4 bytes +print-type-size type: `MyOption`: 4 bytes, alignment: 4 bytes print-type-size variant `Some`: 4 bytes print-type-size field `.0`: 4 bytes print-type-size variant `None`: 0 bytes -print-type-size type: `Adt(MyOption, [Adt(std::num::NonZeroU32, [])])`: 4 bytes, alignment: 4 bytes +print-type-size type: `MyOption`: 4 bytes, alignment: 4 bytes print-type-size variant `Some`: 4 bytes print-type-size field `.0`: 4 bytes print-type-size variant `None`: 0 bytes -print-type-size type: `Adt(MyOption, [Char])`: 4 bytes, alignment: 4 bytes +print-type-size type: `MyOption`: 4 bytes, alignment: 4 bytes print-type-size variant `Some`: 4 bytes print-type-size field `.0`: 4 bytes print-type-size variant `None`: 0 bytes -print-type-size type: `Adt(Union1, [Adt(std::num::NonZeroU32, [])])`: 4 bytes, alignment: 4 bytes +print-type-size type: `NonZeroU32`: 4 bytes, alignment: 4 bytes +print-type-size field `.0`: 4 bytes +print-type-size type: `Union1`: 4 bytes, alignment: 4 bytes print-type-size variant `Union1`: 4 bytes print-type-size field `.a`: 4 bytes -print-type-size type: `Adt(Union2, [Adt(std::num::NonZeroU32, []), Adt(std::num::NonZeroU32, [])])`: 4 bytes, alignment: 4 bytes +print-type-size type: `Union2`: 4 bytes, alignment: 4 bytes 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: `Adt(Union2, [Adt(std::num::NonZeroU32, []), Uint(U32)])`: 4 bytes, alignment: 4 bytes +print-type-size type: `Union2`: 4 bytes, alignment: 4 bytes 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: `Adt(std::num::NonZeroU32, [])`: 4 bytes, alignment: 4 bytes -print-type-size field `.0`: 4 bytes -print-type-size type: `Adt(Enum4, [Tuple([]), Tuple([]), Tuple([]), Adt(MyOption, [Uint(U8)])])`: 2 bytes, alignment: 1 bytes +print-type-size type: `Enum4<(), (), (), MyOption>`: 2 bytes, alignment: 1 bytes print-type-size variant `Four`: 2 bytes print-type-size field `.0`: 2 bytes print-type-size variant `One`: 0 bytes @@ -79,16 +79,16 @@ print-type-size variant `Two`: 0 bytes print-type-size field `.0`: 0 bytes print-type-size variant `Three`: 0 bytes print-type-size field `.0`: 0 bytes -print-type-size type: `Adt(MyOption, [Adt(MyOption, [Uint(U8)])])`: 2 bytes, alignment: 1 bytes +print-type-size type: `MyOption>`: 2 bytes, alignment: 1 bytes print-type-size variant `Some`: 2 bytes print-type-size field `.0`: 2 bytes print-type-size variant `None`: 0 bytes -print-type-size type: `Adt(MyOption, [Uint(U8)])`: 2 bytes, alignment: 1 bytes +print-type-size type: `MyOption`: 2 bytes, alignment: 1 bytes print-type-size discriminant: 1 bytes print-type-size variant `Some`: 1 bytes print-type-size field `.0`: 1 bytes print-type-size variant `None`: 0 bytes -print-type-size type: `Adt(Enum4, [Tuple([]), Tuple([]), Bool, Tuple([])])`: 1 bytes, alignment: 1 bytes +print-type-size type: `Enum4<(), (), bool, ()>`: 1 bytes, alignment: 1 bytes print-type-size variant `Three`: 1 bytes print-type-size field `.0`: 1 bytes print-type-size variant `One`: 0 bytes @@ -97,15 +97,15 @@ print-type-size variant `Two`: 0 bytes print-type-size field `.0`: 0 bytes print-type-size variant `Four`: 0 bytes print-type-size field `.0`: 0 bytes -print-type-size type: `Adt(MyOption, [Adt(std::cmp::Ordering, [])])`: 1 bytes, alignment: 1 bytes +print-type-size type: `MyOption`: 1 bytes, alignment: 1 bytes print-type-size variant `Some`: 1 bytes print-type-size field `.0`: 1 bytes print-type-size variant `None`: 0 bytes -print-type-size type: `Adt(MyOption, [Bool])`: 1 bytes, alignment: 1 bytes +print-type-size type: `MyOption`: 1 bytes, alignment: 1 bytes print-type-size variant `Some`: 1 bytes print-type-size field `.0`: 1 bytes print-type-size variant `None`: 0 bytes -print-type-size type: `Adt(std::cmp::Ordering, [])`: 1 bytes, alignment: 1 bytes +print-type-size type: `std::cmp::Ordering`: 1 bytes, alignment: 1 bytes print-type-size discriminant: 1 bytes print-type-size variant `Less`: 0 bytes print-type-size variant `Equal`: 0 bytes diff --git a/tests/ui/print_type_sizes/no_duplicates.stdout b/tests/ui/print_type_sizes/no_duplicates.stdout index 2d5386f7446c8..50180f356ea36 100644 --- a/tests/ui/print_type_sizes/no_duplicates.stdout +++ b/tests/ui/print_type_sizes/no_duplicates.stdout @@ -1,2 +1,2 @@ -print-type-size type: `Adt(SevenBytes, [])`: 7 bytes, alignment: 1 bytes +print-type-size type: `SevenBytes`: 7 bytes, alignment: 1 bytes print-type-size field `.0`: 7 bytes diff --git a/tests/ui/print_type_sizes/packed.stdout b/tests/ui/print_type_sizes/packed.stdout index eb8015b099e0f..58e1bac9eb794 100644 --- a/tests/ui/print_type_sizes/packed.stdout +++ b/tests/ui/print_type_sizes/packed.stdout @@ -1,4 +1,4 @@ -print-type-size type: `Adt(Packed2C, [])`: 12 bytes, alignment: 2 bytes +print-type-size type: `Packed2C`: 12 bytes, alignment: 2 bytes print-type-size field `.a`: 1 bytes print-type-size field `.b`: 1 bytes print-type-size field `.g`: 4 bytes @@ -7,7 +7,7 @@ print-type-size padding: 1 bytes print-type-size field `.h`: 2 bytes print-type-size field `.d`: 1 bytes print-type-size end padding: 1 bytes -print-type-size type: `Adt(Padded, [])`: 12 bytes, alignment: 4 bytes +print-type-size type: `Padded`: 12 bytes, alignment: 4 bytes print-type-size field `.g`: 4 bytes print-type-size field `.h`: 2 bytes print-type-size field `.a`: 1 bytes @@ -15,14 +15,14 @@ print-type-size field `.b`: 1 bytes print-type-size field `.c`: 1 bytes print-type-size field `.d`: 1 bytes print-type-size end padding: 2 bytes -print-type-size type: `Adt(Packed1, [])`: 10 bytes, alignment: 1 bytes +print-type-size type: `Packed1`: 10 bytes, alignment: 1 bytes print-type-size field `.a`: 1 bytes print-type-size field `.b`: 1 bytes print-type-size field `.g`: 4 bytes print-type-size field `.c`: 1 bytes print-type-size field `.h`: 2 bytes print-type-size field `.d`: 1 bytes -print-type-size type: `Adt(Packed2, [])`: 10 bytes, alignment: 2 bytes +print-type-size type: `Packed2`: 10 bytes, alignment: 2 bytes print-type-size field `.g`: 4 bytes print-type-size field `.h`: 2 bytes print-type-size field `.a`: 1 bytes diff --git a/tests/ui/print_type_sizes/padding.stdout b/tests/ui/print_type_sizes/padding.stdout index 585b9010faec4..9afdf76245df7 100644 --- a/tests/ui/print_type_sizes/padding.stdout +++ b/tests/ui/print_type_sizes/padding.stdout @@ -1,4 +1,4 @@ -print-type-size type: `Adt(E1, [])`: 12 bytes, alignment: 4 bytes +print-type-size type: `E1`: 12 bytes, alignment: 4 bytes print-type-size discriminant: 1 bytes print-type-size variant `B`: 11 bytes print-type-size padding: 3 bytes @@ -7,7 +7,7 @@ print-type-size variant `A`: 7 bytes print-type-size field `.1`: 1 bytes print-type-size padding: 2 bytes print-type-size field `.0`: 4 bytes, alignment: 4 bytes -print-type-size type: `Adt(E2, [])`: 12 bytes, alignment: 4 bytes +print-type-size type: `E2`: 12 bytes, alignment: 4 bytes print-type-size discriminant: 1 bytes print-type-size variant `B`: 11 bytes print-type-size padding: 3 bytes @@ -16,7 +16,7 @@ print-type-size variant `A`: 7 bytes print-type-size field `.0`: 1 bytes print-type-size padding: 2 bytes print-type-size field `.1`: 4 bytes, alignment: 4 bytes -print-type-size type: `Adt(S, [])`: 8 bytes, alignment: 4 bytes +print-type-size type: `S`: 8 bytes, alignment: 4 bytes print-type-size field `.g`: 4 bytes print-type-size field `.a`: 1 bytes print-type-size field `.b`: 1 bytes diff --git a/tests/ui/print_type_sizes/repr-align.stdout b/tests/ui/print_type_sizes/repr-align.stdout index caeca800da2f4..33671bd8e14bc 100644 --- a/tests/ui/print_type_sizes/repr-align.stdout +++ b/tests/ui/print_type_sizes/repr-align.stdout @@ -1,16 +1,16 @@ -print-type-size type: `Adt(E, [])`: 32 bytes, alignment: 16 bytes +print-type-size type: `E`: 32 bytes, alignment: 16 bytes print-type-size discriminant: 4 bytes print-type-size variant `B`: 28 bytes print-type-size padding: 12 bytes print-type-size field `.0`: 16 bytes, alignment: 16 bytes print-type-size variant `A`: 4 bytes print-type-size field `.0`: 4 bytes -print-type-size type: `Adt(S, [])`: 32 bytes, alignment: 16 bytes +print-type-size type: `S`: 32 bytes, alignment: 16 bytes print-type-size field `.c`: 16 bytes print-type-size field `.a`: 4 bytes print-type-size field `.b`: 4 bytes print-type-size field `.d`: 1 bytes print-type-size end padding: 7 bytes -print-type-size type: `Adt(A, [])`: 16 bytes, alignment: 16 bytes +print-type-size type: `A`: 16 bytes, alignment: 16 bytes print-type-size field `.0`: 4 bytes print-type-size end padding: 12 bytes diff --git a/tests/ui/print_type_sizes/repr_int_c.stdout b/tests/ui/print_type_sizes/repr_int_c.stdout index 384eeafc8b6d3..254b3c7a8531e 100644 --- a/tests/ui/print_type_sizes/repr_int_c.stdout +++ b/tests/ui/print_type_sizes/repr_int_c.stdout @@ -1,10 +1,10 @@ -print-type-size type: `Adt(ReprCu8, [])`: 4 bytes, alignment: 2 bytes +print-type-size type: `ReprCu8`: 4 bytes, alignment: 2 bytes print-type-size discriminant: 1 bytes print-type-size variant `A`: 3 bytes print-type-size padding: 1 bytes print-type-size field `.0`: 2 bytes, alignment: 2 bytes print-type-size variant `B`: 1 bytes -print-type-size type: `Adt(Repru8, [])`: 4 bytes, alignment: 2 bytes +print-type-size type: `Repru8`: 4 bytes, alignment: 2 bytes print-type-size discriminant: 1 bytes print-type-size variant `A`: 3 bytes print-type-size padding: 1 bytes diff --git a/tests/ui/print_type_sizes/uninhabited.stdout b/tests/ui/print_type_sizes/uninhabited.stdout index 5c1c31bd339b8..1116d672eacc7 100644 --- a/tests/ui/print_type_sizes/uninhabited.stdout +++ b/tests/ui/print_type_sizes/uninhabited.stdout @@ -1,6 +1,6 @@ -print-type-size type: `Adt(std::result::Result, [Uint(U32), Never])`: 4 bytes, alignment: 4 bytes +print-type-size type: `Result`: 4 bytes, alignment: 4 bytes print-type-size variant `Ok`: 4 bytes print-type-size field `.0`: 4 bytes -print-type-size type: `Adt(std::option::Option, [Never])`: 0 bytes, alignment: 1 bytes +print-type-size type: `Option`: 0 bytes, alignment: 1 bytes print-type-size variant `None`: 0 bytes -print-type-size type: `Adt(std::result::Result, [Never, Never])`: 0 bytes, alignment: 1 bytes +print-type-size type: `Result`: 0 bytes, alignment: 1 bytes diff --git a/tests/ui/print_type_sizes/variants.stdout b/tests/ui/print_type_sizes/variants.stdout index 27a750bf1c70d..6411881545843 100644 --- a/tests/ui/print_type_sizes/variants.stdout +++ b/tests/ui/print_type_sizes/variants.stdout @@ -1,10 +1,10 @@ -print-type-size type: `Adt(Enum, [])`: 51 bytes, alignment: 1 bytes +print-type-size type: `Enum`: 51 bytes, alignment: 1 bytes print-type-size discriminant: 1 bytes print-type-size variant `Large`: 50 bytes print-type-size field `.0`: 50 bytes print-type-size variant `Small`: 7 bytes print-type-size field `.0`: 7 bytes -print-type-size type: `Adt(FiftyBytes, [])`: 50 bytes, alignment: 1 bytes +print-type-size type: `FiftyBytes`: 50 bytes, alignment: 1 bytes print-type-size field `.0`: 50 bytes -print-type-size type: `Adt(SevenBytes, [])`: 7 bytes, alignment: 1 bytes +print-type-size type: `SevenBytes`: 7 bytes, alignment: 1 bytes print-type-size field `.0`: 7 bytes diff --git a/tests/ui/print_type_sizes/zero-sized-fields.stdout b/tests/ui/print_type_sizes/zero-sized-fields.stdout index 66f5b379d4062..72f59c4bb57bf 100644 --- a/tests/ui/print_type_sizes/zero-sized-fields.stdout +++ b/tests/ui/print_type_sizes/zero-sized-fields.stdout @@ -1,4 +1,4 @@ -print-type-size type: `Adt(S5, [Tuple([]), Adt(Empty, [])])`: 16 bytes, alignment: 4 bytes +print-type-size type: `S5<(), Empty>`: 16 bytes, alignment: 4 bytes print-type-size field `.tagw`: 0 bytes print-type-size field `.unit`: 0 bytes print-type-size field `.void`: 0 bytes @@ -8,9 +8,9 @@ print-type-size field `.w`: 4 bytes print-type-size field `.x`: 4 bytes print-type-size field `.y`: 4 bytes print-type-size field `.z`: 4 bytes -print-type-size type: `Adt(S1, [])`: 8 bytes, alignment: 4 bytes +print-type-size type: `S1`: 8 bytes, alignment: 4 bytes print-type-size field `.tag`: 0 bytes print-type-size field `.x`: 4 bytes print-type-size field `.y`: 4 bytes -print-type-size type: `Adt(Empty, [])`: 0 bytes, alignment: 1 bytes -print-type-size type: `Adt(Void, [])`: 0 bytes, alignment: 1 bytes +print-type-size type: `Empty`: 0 bytes, alignment: 1 bytes +print-type-size type: `Void`: 0 bytes, alignment: 1 bytes From 3e4dfc8ceed1a2d694eebc77801a902d0426592b Mon Sep 17 00:00:00 2001 From: Boxy Date: Fri, 20 Jan 2023 01:45:48 +0000 Subject: [PATCH 3/8] normalize stderr --- .../ui/impl-trait/normalize-tait-in-const.rs | 1 + .../impl-trait/normalize-tait-in-const.stderr | 2 +- .../ui/layout/zero-sized-array-enum-niche.rs | 8 ++++-- .../layout/zero-sized-array-enum-niche.stderr | 14 +++++----- .../projection-no-regions-closure.rs | 8 ++++-- .../projection-no-regions-closure.stderr | 28 +++++++++---------- 6 files changed, 34 insertions(+), 27 deletions(-) diff --git a/tests/ui/impl-trait/normalize-tait-in-const.rs b/tests/ui/impl-trait/normalize-tait-in-const.rs index 020bcbb8396c9..c348a792df9d2 100644 --- a/tests/ui/impl-trait/normalize-tait-in-const.rs +++ b/tests/ui/impl-trait/normalize-tait-in-const.rs @@ -2,6 +2,7 @@ // failure-status: 101 // normalize-stderr-test "note: .*\n\n" -> "" // normalize-stderr-test "thread 'rustc' panicked.*\n" -> "" +// normalize-stderr-test "DefId([^)]*)" -> "..." // rustc-env:RUST_BACKTRACE=0 #![feature(type_alias_impl_trait)] diff --git a/tests/ui/impl-trait/normalize-tait-in-const.stderr b/tests/ui/impl-trait/normalize-tait-in-const.stderr index dc09a53a05792..f39a43c9059a7 100644 --- a/tests/ui/impl-trait/normalize-tait-in-const.stderr +++ b/tests/ui/impl-trait/normalize-tait-in-const.stderr @@ -1,4 +1,4 @@ -error: internal compiler error: compiler/rustc_middle/src/ty/normalize_erasing_regions.rs:198:90: Failed to normalize Alias(Projection, AliasTy { substs: [FnDef(DefId(0:18 ~ normalize_tait_in_const[1c07]::foo), []), Tuple([Ref(ReErased, Ref(ReErased, Adt(S, []), Not), Not)])], def_id: DefId(2:2940 ~ core[a28e]::ops::function::FnOnce::Output) }), maybe try to call `try_normalize_erasing_regions` instead +error: internal compiler error: compiler/rustc_middle/src/ty/normalize_erasing_regions.rs:198:90: Failed to normalize Alias(Projection, AliasTy { substs: [FnDef(...), []), Tuple([Ref(ReErased, Ref(ReErased, Adt(S, []), Not), Not)])], def_id: ...) }), maybe try to call `try_normalize_erasing_regions` instead query stack during panic: #0 [eval_to_allocation_raw] const-evaluating + checking `BAR` diff --git a/tests/ui/layout/zero-sized-array-enum-niche.rs b/tests/ui/layout/zero-sized-array-enum-niche.rs index 23bbbfbfc5881..4988fa850694a 100644 --- a/tests/ui/layout/zero-sized-array-enum-niche.rs +++ b/tests/ui/layout/zero-sized-array-enum-niche.rs @@ -1,4 +1,5 @@ // normalize-stderr-test "pref: Align\([1-8] bytes\)" -> "pref: $$PREF_ALIGN" +// normalize-stderr-test "Leaf\(0x\d+\)" -> "Leaf(...)" #![feature(rustc_attrs)] #![crate_type = "lib"] @@ -18,7 +19,8 @@ type AlignedResult = Result<[u32; 0], bool>; //~ ERROR: layout_of // Here's another case with multiple ZST alignments, where we should // get the maximal alignment and matching size. #[rustc_layout(debug)] -enum MultipleAlignments { //~ ERROR: layout_of +enum MultipleAlignments { + //~^ ERROR: layout_of Align2([u16; 0]), Align4([u32; 0]), Niche(bool), @@ -38,7 +40,9 @@ type NicheLosesToTagged = Result<[u32; 0], Packed>; //~ ER // Should get tag_encoding: Direct, size == align == 4. #[repr(u16)] -enum U16IsZero { _Zero = 0 } +enum U16IsZero { + _Zero = 0, +} #[rustc_layout(debug)] type NicheWinsOverTagged = Result<[u32; 0], Packed>; //~ ERROR: layout_of diff --git a/tests/ui/layout/zero-sized-array-enum-niche.stderr b/tests/ui/layout/zero-sized-array-enum-niche.stderr index bae956d947b86..b2929e11e8d83 100644 --- a/tests/ui/layout/zero-sized-array-enum-niche.stderr +++ b/tests/ui/layout/zero-sized-array-enum-niche.stderr @@ -1,4 +1,4 @@ -error: layout_of(Adt(std::result::Result, [Array(Uint(U32), Const { ty: Uint(Usize), kind: Value(Leaf(0x0000000000000000)) }), Bool])) = Layout { +error: layout_of(Adt(std::result::Result, [Array(Uint(U32), Const { ty: Uint(Usize), kind: Value(Leaf(...)) }), Bool])) = Layout { size: Size(4 bytes), align: AbiAndPrefAlign { abi: Align(4 bytes), @@ -92,7 +92,7 @@ error: layout_of(Adt(std::result::Result, [Array(Uint(U32), Const { ty: Uint(Usi ], }, } - --> $DIR/zero-sized-array-enum-niche.rs:13:1 + --> $DIR/zero-sized-array-enum-niche.rs:14:1 | LL | type AlignedResult = Result<[u32; 0], bool>; | ^^^^^^^^^^^^^^^^^^ @@ -213,12 +213,12 @@ error: layout_of(Adt(MultipleAlignments, [])) = Layout { ], }, } - --> $DIR/zero-sized-array-enum-niche.rs:21:1 + --> $DIR/zero-sized-array-enum-niche.rs:22:1 | LL | enum MultipleAlignments { | ^^^^^^^^^^^^^^^^^^^^^^^ -error: layout_of(Adt(std::result::Result, [Array(Uint(U32), Const { ty: Uint(Usize), kind: Value(Leaf(0x0000000000000000)) }), Adt(Packed, [Adt(std::num::NonZeroU16, [])])])) = Layout { +error: layout_of(Adt(std::result::Result, [Array(Uint(U32), Const { ty: Uint(Usize), kind: Value(Leaf(...)) }), Adt(Packed, [Adt(std::num::NonZeroU16, [])])])) = Layout { size: Size(4 bytes), align: AbiAndPrefAlign { abi: Align(4 bytes), @@ -312,12 +312,12 @@ error: layout_of(Adt(std::result::Result, [Array(Uint(U32), Const { ty: Uint(Usi ], }, } - --> $DIR/zero-sized-array-enum-niche.rs:37:1 + --> $DIR/zero-sized-array-enum-niche.rs:39:1 | LL | type NicheLosesToTagged = Result<[u32; 0], Packed>; | ^^^^^^^^^^^^^^^^^^^^^^^ -error: layout_of(Adt(std::result::Result, [Array(Uint(U32), Const { ty: Uint(Usize), kind: Value(Leaf(0x0000000000000000)) }), Adt(Packed, [Adt(U16IsZero, [])])])) = Layout { +error: layout_of(Adt(std::result::Result, [Array(Uint(U32), Const { ty: Uint(Usize), kind: Value(Leaf(...)) }), Adt(Packed, [Adt(U16IsZero, [])])])) = Layout { size: Size(4 bytes), align: AbiAndPrefAlign { abi: Align(4 bytes), @@ -415,7 +415,7 @@ error: layout_of(Adt(std::result::Result, [Array(Uint(U32), Const { ty: Uint(Usi ], }, } - --> $DIR/zero-sized-array-enum-niche.rs:44:1 + --> $DIR/zero-sized-array-enum-niche.rs:48:1 | LL | type NicheWinsOverTagged = Result<[u32; 0], Packed>; | ^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/nll/ty-outlives/projection-no-regions-closure.rs b/tests/ui/nll/ty-outlives/projection-no-regions-closure.rs index 2d9c008c75924..c1a5ed1df4483 100644 --- a/tests/ui/nll/ty-outlives/projection-no-regions-closure.rs +++ b/tests/ui/nll/ty-outlives/projection-no-regions-closure.rs @@ -1,4 +1,5 @@ // compile-flags:-Zverbose +// normalize-stderr-test "DefId([^)]*)" -> "..." // Tests closures that propagate an outlives relationship to their // creator where the subject is a projection with no regions (` Anything for T { } +impl Anything for T {} fn with_signature<'a, T, F>(x: Box, op: F) -> Box - where F: FnOnce(Box) -> Box +where + F: FnOnce(Box) -> Box, { op(x) } diff --git a/tests/ui/nll/ty-outlives/projection-no-regions-closure.stderr b/tests/ui/nll/ty-outlives/projection-no-regions-closure.stderr index b77e50e53d424..66f8432d18928 100644 --- a/tests/ui/nll/ty-outlives/projection-no-regions-closure.stderr +++ b/tests/ui/nll/ty-outlives/projection-no-regions-closure.stderr @@ -1,5 +1,5 @@ note: external requirements - --> $DIR/projection-no-regions-closure.rs:25:23 + --> $DIR/projection-no-regions-closure.rs:27:23 | LL | with_signature(x, |mut y| Box::new(y.next())) | ^^^^^^^ @@ -19,10 +19,10 @@ LL | with_signature(x, |mut y| Box::new(y.next())) ), ] = note: number of external vids: 3 - = note: where Alias(Projection, AliasTy { substs: [Param(T/#1)], def_id: DefId(2:7157 ~ core[a28e]::iter::traits::iterator::Iterator::Item) }): '_#2r + = note: where Alias(Projection, AliasTy { substs: [Param(T/#1)], def_id: ...) }): '_#2r note: no external requirements - --> $DIR/projection-no-regions-closure.rs:21:1 + --> $DIR/projection-no-regions-closure.rs:23:1 | LL | / fn no_region<'a, T>(x: Box) -> Box LL | | where @@ -32,7 +32,7 @@ LL | | T: Iterator, = note: defining type: no_region::<'_#1r, T> error[E0309]: the associated type `::Item` may not live long enough - --> $DIR/projection-no-regions-closure.rs:25:31 + --> $DIR/projection-no-regions-closure.rs:27:31 | LL | with_signature(x, |mut y| Box::new(y.next())) | ^^^^^^^^^^^^^^^^^^ @@ -41,7 +41,7 @@ LL | with_signature(x, |mut y| Box::new(y.next())) = note: ...so that the type `::Item` will meet its required lifetime bounds note: external requirements - --> $DIR/projection-no-regions-closure.rs:34:23 + --> $DIR/projection-no-regions-closure.rs:36:23 | LL | with_signature(x, |mut y| Box::new(y.next())) | ^^^^^^^ @@ -61,10 +61,10 @@ LL | with_signature(x, |mut y| Box::new(y.next())) ), ] = note: number of external vids: 3 - = note: where Alias(Projection, AliasTy { substs: [Param(T/#1)], def_id: DefId(2:7157 ~ core[a28e]::iter::traits::iterator::Iterator::Item) }): '_#2r + = note: where Alias(Projection, AliasTy { substs: [Param(T/#1)], def_id: ...) }): '_#2r note: no external requirements - --> $DIR/projection-no-regions-closure.rs:30:1 + --> $DIR/projection-no-regions-closure.rs:32:1 | LL | / fn correct_region<'a, T>(x: Box) -> Box LL | | where @@ -74,7 +74,7 @@ LL | | T: 'a + Iterator, = note: defining type: correct_region::<'_#1r, T> note: external requirements - --> $DIR/projection-no-regions-closure.rs:42:23 + --> $DIR/projection-no-regions-closure.rs:44:23 | LL | with_signature(x, |mut y| Box::new(y.next())) | ^^^^^^^ @@ -94,10 +94,10 @@ LL | with_signature(x, |mut y| Box::new(y.next())) ), ] = note: number of external vids: 4 - = note: where Alias(Projection, AliasTy { substs: [Param(T/#2)], def_id: DefId(2:7157 ~ core[a28e]::iter::traits::iterator::Iterator::Item) }): '_#3r + = note: where Alias(Projection, AliasTy { substs: [Param(T/#2)], def_id: ...) }): '_#3r note: no external requirements - --> $DIR/projection-no-regions-closure.rs:38:1 + --> $DIR/projection-no-regions-closure.rs:40:1 | LL | / fn wrong_region<'a, 'b, T>(x: Box) -> Box LL | | where @@ -107,7 +107,7 @@ LL | | T: 'b + Iterator, = note: defining type: wrong_region::<'_#1r, '_#2r, T> error[E0309]: the associated type `::Item` may not live long enough - --> $DIR/projection-no-regions-closure.rs:42:31 + --> $DIR/projection-no-regions-closure.rs:44:31 | LL | with_signature(x, |mut y| Box::new(y.next())) | ^^^^^^^^^^^^^^^^^^ @@ -116,7 +116,7 @@ LL | with_signature(x, |mut y| Box::new(y.next())) = note: ...so that the type `::Item` will meet its required lifetime bounds note: external requirements - --> $DIR/projection-no-regions-closure.rs:52:23 + --> $DIR/projection-no-regions-closure.rs:54:23 | LL | with_signature(x, |mut y| Box::new(y.next())) | ^^^^^^^ @@ -136,10 +136,10 @@ LL | with_signature(x, |mut y| Box::new(y.next())) ), ] = note: number of external vids: 4 - = note: where Alias(Projection, AliasTy { substs: [Param(T/#2)], def_id: DefId(2:7157 ~ core[a28e]::iter::traits::iterator::Iterator::Item) }): '_#3r + = note: where Alias(Projection, AliasTy { substs: [Param(T/#2)], def_id: ...) }): '_#3r note: no external requirements - --> $DIR/projection-no-regions-closure.rs:47:1 + --> $DIR/projection-no-regions-closure.rs:49:1 | LL | / fn outlives_region<'a, 'b, T>(x: Box) -> Box LL | | where From 2440e8053bb4ce5e347129695976b053f9a85938 Mon Sep 17 00:00:00 2001 From: Boxy Date: Fri, 20 Jan 2023 00:19:39 +0000 Subject: [PATCH 4/8] mir printing changes --- compiler/rustc_middle/src/mir/graphviz.rs | 2 +- compiler/rustc_middle/src/mir/mod.rs | 16 +- compiler/rustc_middle/src/mir/pretty.rs | 14 +- .../rustc_middle/src/ty/typeck_results.rs | 13 +- ...await.b-{closure#0}.generator_resume.0.mir | 17 + ...anup.main-{closure#0}.generator_drop.0.mir | 7 + ...ny.main-{closure#0}.generator_resume.0.mir | 7 + .../inline_into_box_place.main.Inline.diff | 2 +- ...=> issue_99325.main.built.after.32bit.mir} | 10 +- .../issue_99325.main.built.after.64bit.mir | 295 ++++++++++++++++++ tests/mir-opt/issue_99325.rs | 1 + ...trinsics.discriminant.LowerIntrinsics.diff | 6 +- ...egion_subtyping_basic.main.nll.0.32bit.mir | 2 +- ...egion_subtyping_basic.main.nll.0.64bit.mir | 2 +- 14 files changed, 372 insertions(+), 22 deletions(-) rename tests/mir-opt/{issue_99325.main.built.after.mir => issue_99325.main.built.after.32bit.mir} (96%) create mode 100644 tests/mir-opt/issue_99325.main.built.after.64bit.mir diff --git a/compiler/rustc_middle/src/mir/graphviz.rs b/compiler/rustc_middle/src/mir/graphviz.rs index 5de56dad07a41..9253b033336cc 100644 --- a/compiler/rustc_middle/src/mir/graphviz.rs +++ b/compiler/rustc_middle/src/mir/graphviz.rs @@ -103,7 +103,7 @@ fn write_graph_label<'tcx, W: std::fmt::Write>( write!(w, "{:?}: {}", Place::from(arg), escape(&body.local_decls[arg].ty))?; } - write!(w, ") -> {}", escape(&body.return_ty()))?; + write!(w, ") -> {}", dot::escape_html(&format!("{}", body.return_ty())))?; write!(w, r#"
"#)?; for local in body.vars_and_temps_iter() { diff --git a/compiler/rustc_middle/src/mir/mod.rs b/compiler/rustc_middle/src/mir/mod.rs index 552af589bec59..75868544b855a 100644 --- a/compiler/rustc_middle/src/mir/mod.rs +++ b/compiler/rustc_middle/src/mir/mod.rs @@ -1061,7 +1061,7 @@ impl<'tcx> Debug for VarDebugInfoContents<'tcx> { VarDebugInfoContents::Const(c) => write!(fmt, "{}", c), VarDebugInfoContents::Place(p) => write!(fmt, "{:?}", p), VarDebugInfoContents::Composite { ty, fragments } => { - write!(fmt, "{:?}{{ ", ty)?; + ty::print::with_no_trimmed_paths!(write!(fmt, "{}{{ ", ty))?; for f in fragments.iter() { write!(fmt, "{:?}, ", f)?; } @@ -1722,7 +1722,8 @@ impl Debug for Place<'_> { write!(fmt, ")")?; } ProjectionElem::Field(field, ty) => { - write!(fmt, ".{:?}: {:?})", field.index(), ty)?; + let ty = ty::print::with_no_trimmed_paths!(format!("{ty}")); + write!(fmt, ".{:?}: {})", field.index(), ty)?; } ProjectionElem::Index(ref index) => { write!(fmt, "[{:?}]", index)?; @@ -2009,7 +2010,8 @@ impl<'tcx> Debug for Rvalue<'tcx> { } Len(ref a) => write!(fmt, "Len({:?})", a), Cast(ref kind, ref place, ref ty) => { - write!(fmt, "{:?} as {:?} ({:?})", place, ty, kind) + let ty = ty::print::with_no_trimmed_paths!(format!("{ty}")); + write!(fmt, "{:?} as {} ({:?})", place, ty, kind) } BinaryOp(ref op, box (ref a, ref b)) => write!(fmt, "{:?}({:?}, {:?})", op, a, b), CheckedBinaryOp(ref op, box (ref a, ref b)) => { @@ -2017,7 +2019,10 @@ impl<'tcx> Debug for Rvalue<'tcx> { } UnaryOp(ref op, ref a) => write!(fmt, "{:?}({:?})", op, a), Discriminant(ref place) => write!(fmt, "discriminant({:?})", place), - NullaryOp(ref op, ref t) => write!(fmt, "{:?}({:?})", op, t), + NullaryOp(ref op, ref t) => { + let t = ty::print::with_no_trimmed_paths!(format!("{t}")); + write!(fmt, "{:?}({})", op, t) + } ThreadLocalRef(did) => ty::tls::with(|tcx| { let muta = tcx.static_mutability(did).unwrap().prefix_str(); write!(fmt, "&/*tls*/ {}{}", muta, tcx.def_path_str(did)) @@ -2144,7 +2149,8 @@ impl<'tcx> Debug for Rvalue<'tcx> { } ShallowInitBox(ref place, ref ty) => { - write!(fmt, "ShallowInitBox({:?}, {:?})", place, ty) + let ty = ty::print::with_no_trimmed_paths!(format!("{ty}")); + write!(fmt, "ShallowInitBox({:?}, {})", place, ty) } } } diff --git a/compiler/rustc_middle/src/mir/pretty.rs b/compiler/rustc_middle/src/mir/pretty.rs index 40289af257ff4..9d363f0afbf87 100644 --- a/compiler/rustc_middle/src/mir/pretty.rs +++ b/compiler/rustc_middle/src/mir/pretty.rs @@ -582,8 +582,14 @@ fn write_scope_tree( let mut_str = if local_decl.mutability == Mutability::Mut { "mut " } else { "" }; - let mut indented_decl = - format!("{0:1$}let {2}{3:?}: {4:?}", INDENT, indent, mut_str, local, local_decl.ty); + let mut indented_decl = format!( + "{0:1$}let {2}{3:?}: {4}", + INDENT, + indent, + mut_str, + local, + ty::print::with_no_trimmed_paths!(format!("{}", local_decl.ty)) + ); if let Some(user_ty) = &local_decl.user_ty { for user_ty in user_ty.projections() { write!(indented_decl, " as {:?}", user_ty).unwrap(); @@ -1049,11 +1055,11 @@ fn write_user_type_annotations( for (index, annotation) in body.user_type_annotations.iter_enumerated() { writeln!( w, - "| {:?}: user_ty: {:?}, span: {}, inferred_ty: {:?}", + "| {:?}: user_ty: {:?}, span: {}, inferred_ty: {}", index.index(), annotation.user_ty, tcx.sess.source_map().span_to_embeddable_string(annotation.span), - annotation.inferred_ty, + ty::print::with_no_trimmed_paths!(format!("{}", annotation.inferred_ty)), )?; } if !body.user_type_annotations.is_empty() { diff --git a/compiler/rustc_middle/src/ty/typeck_results.rs b/compiler/rustc_middle/src/ty/typeck_results.rs index 79a6c730d7159..b9a6afaacf7e6 100644 --- a/compiler/rustc_middle/src/ty/typeck_results.rs +++ b/compiler/rustc_middle/src/ty/typeck_results.rs @@ -703,7 +703,7 @@ impl<'tcx> CanonicalUserType<'tcx> { /// A user-given type annotation attached to a constant. These arise /// from constants that are named via paths, like `Foo::::new` and /// so forth. -#[derive(Copy, Clone, Debug, PartialEq, TyEncodable, TyDecodable)] +#[derive(Copy, Clone, PartialEq, TyEncodable, TyDecodable)] #[derive(Eq, Hash, HashStable, TypeFoldable, TypeVisitable, Lift)] pub enum UserType<'tcx> { Ty(Ty<'tcx>), @@ -712,3 +712,14 @@ pub enum UserType<'tcx> { /// given substitutions applied. TypeOf(DefId, UserSubsts<'tcx>), } + +impl<'tcx> std::fmt::Debug for UserType<'tcx> { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + Self::Ty(arg0) => { + ty::print::with_no_trimmed_paths!(f.write_fmt(format_args!("Ty({})", arg0))) + } + Self::TypeOf(arg0, arg1) => f.debug_tuple("TypeOf").field(arg0).field(arg1).finish(), + } + } +} diff --git a/tests/mir-opt/building/async_await.b-{closure#0}.generator_resume.0.mir b/tests/mir-opt/building/async_await.b-{closure#0}.generator_resume.0.mir index 1449247aedad3..65311abb73d2b 100644 --- a/tests/mir-opt/building/async_await.b-{closure#0}.generator_resume.0.mir +++ b/tests/mir-opt/building/async_await.b-{closure#0}.generator_resume.0.mir @@ -1,6 +1,7 @@ // MIR for `b::{closure#0}` 0 generator_resume /* generator_layout = GeneratorLayout { field_tys: { +<<<<<<< master _0: GeneratorSavedTy { ty: impl std::future::Future, source_info: SourceInfo { @@ -17,6 +18,22 @@ }, ignore_for_traits: false, }, +======= + _0: Alias( + Opaque, + AliasTy { + substs: [], + def_id: DefId(0:7 ~ async_await[672b]::a::{opaque#0}), + }, + ), + _1: Alias( + Opaque, + AliasTy { + substs: [], + def_id: DefId(0:7 ~ async_await[672b]::a::{opaque#0}), + }, + ), +>>>>>>> mir printing changes }, variant_fields: { Unresumed(0): [], diff --git a/tests/mir-opt/generator_drop_cleanup.main-{closure#0}.generator_drop.0.mir b/tests/mir-opt/generator_drop_cleanup.main-{closure#0}.generator_drop.0.mir index afe518642146f..812c7c6374259 100644 --- a/tests/mir-opt/generator_drop_cleanup.main-{closure#0}.generator_drop.0.mir +++ b/tests/mir-opt/generator_drop_cleanup.main-{closure#0}.generator_drop.0.mir @@ -1,6 +1,7 @@ // MIR for `main::{closure#0}` 0 generator_drop /* generator_layout = GeneratorLayout { field_tys: { +<<<<<<< master _0: GeneratorSavedTy { ty: std::string::String, source_info: SourceInfo { @@ -9,6 +10,12 @@ }, ignore_for_traits: false, }, +======= + _0: Adt( + std::string::String, + [], + ), +>>>>>>> mir printing changes }, variant_fields: { Unresumed(0): [], diff --git a/tests/mir-opt/generator_tiny.main-{closure#0}.generator_resume.0.mir b/tests/mir-opt/generator_tiny.main-{closure#0}.generator_resume.0.mir index 2f096c3e0a189..6dd4650c4f4ac 100644 --- a/tests/mir-opt/generator_tiny.main-{closure#0}.generator_resume.0.mir +++ b/tests/mir-opt/generator_tiny.main-{closure#0}.generator_resume.0.mir @@ -1,6 +1,7 @@ // MIR for `main::{closure#0}` 0 generator_resume /* generator_layout = GeneratorLayout { field_tys: { +<<<<<<< master _0: GeneratorSavedTy { ty: HasDrop, source_info: SourceInfo { @@ -9,6 +10,12 @@ }, ignore_for_traits: false, }, +======= + _0: Adt( + HasDrop, + [], + ), +>>>>>>> mir printing changes }, variant_fields: { Unresumed(0): [], diff --git a/tests/mir-opt/inline/inline_into_box_place.main.Inline.diff b/tests/mir-opt/inline/inline_into_box_place.main.Inline.diff index a28da146e3786..b3cfec7fb3f3e 100644 --- a/tests/mir-opt/inline/inline_into_box_place.main.Inline.diff +++ b/tests/mir-opt/inline/inline_into_box_place.main.Inline.diff @@ -50,7 +50,7 @@ - bb2: { + // + span: $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + // + user_ty: UserType(0) -+ // + literal: Const { ty: alloc::raw_vec::RawVec, val: Unevaluated(alloc::raw_vec::RawVec::::NEW, [u32], None) } ++ // + literal: Const { ty: alloc::raw_vec::RawVec, val: Unevaluated(alloc::raw_vec::RawVec::::NEW, [Uint(U32)], None) } + Deinit(_9); // scope 3 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + (_9.0: alloc::raw_vec::RawVec) = move _10; // scope 3 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + (_9.1: usize) = const 0_usize; // scope 3 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL diff --git a/tests/mir-opt/issue_99325.main.built.after.mir b/tests/mir-opt/issue_99325.main.built.after.32bit.mir similarity index 96% rename from tests/mir-opt/issue_99325.main.built.after.mir rename to tests/mir-opt/issue_99325.main.built.after.32bit.mir index 3e035c18db862..b770dc1c4c4cf 100644 --- a/tests/mir-opt/issue_99325.main.built.after.mir +++ b/tests/mir-opt/issue_99325.main.built.after.32bit.mir @@ -1,8 +1,8 @@ // MIR for `main` after built | User Type Annotations -| 0: user_ty: Canonical { max_universe: U0, variables: [], value: TypeOf(DefId(0:3 ~ issue_99325[8f58]::function_with_bytes), UserSubsts { substs: [Const { ty: &'static [u8; 4], kind: Value(Branch([Leaf(0x41), Leaf(0x41), Leaf(0x41), Leaf(0x41)])) }], user_self_ty: None }) }, span: $DIR/issue_99325.rs:10:16: 10:46, inferred_ty: fn() -> &'static [u8] {function_with_bytes::<&*b"AAAA">} -| 1: user_ty: Canonical { max_universe: U0, variables: [], value: TypeOf(DefId(0:3 ~ issue_99325[8f58]::function_with_bytes), UserSubsts { substs: [Const { ty: &'static [u8; 4], kind: Unevaluated(UnevaluatedConst { def: WithOptConstParam { did: DefId(0:8 ~ issue_99325[8f58]::main::{constant#1}), const_param_did: Some(DefId(0:4 ~ issue_99325[8f58]::function_with_bytes::BYTES)) }, substs: [] }) }], user_self_ty: None }) }, span: $DIR/issue_99325.rs:11:16: 11:68, inferred_ty: fn() -> &'static [u8] {function_with_bytes::<&*b"AAAA">} +| 0: user_ty: Canonical { max_universe: U0, variables: [], value: TypeOf(DefId(0:3 ~ issue_99325[8f58]::function_with_bytes), UserSubsts { substs: [Const { ty: Ref(ReStatic, Array(Uint(U8), Const { ty: Uint(Usize), kind: Value(Leaf(0x00000004)) }), Not), kind: Value(Branch([Leaf(0x41), Leaf(0x41), Leaf(0x41), Leaf(0x41)])) }], user_self_ty: None }) }, span: $DIR/issue_99325.rs:11:16: 11:46, inferred_ty: fn() -> &'static [u8] {function_with_bytes::<&*b"AAAA">} +| 1: user_ty: Canonical { max_universe: U0, variables: [], value: TypeOf(DefId(0:3 ~ issue_99325[8f58]::function_with_bytes), UserSubsts { substs: [Const { ty: Ref(ReStatic, Array(Uint(U8), Const { ty: Uint(Usize), kind: Value(Leaf(0x00000004)) }), Not), kind: Unevaluated(UnevaluatedConst { def: WithOptConstParam { did: DefId(0:8 ~ issue_99325[8f58]::main::{constant#1}), const_param_did: Some(DefId(0:4 ~ issue_99325[8f58]::function_with_bytes::BYTES)) }, substs: [] }) }], user_self_ty: None }) }, span: $DIR/issue_99325.rs:12:16: 12:68, inferred_ty: fn() -> &'static [u8] {function_with_bytes::<&*b"AAAA">} | fn main() -> () { let mut _0: (); // return place in scope 0 at $DIR/issue_99325.rs:+0:15: +0:15 @@ -71,7 +71,7 @@ fn main() -> () { StorageLive(_4); // scope 0 at $DIR/issue_99325.rs:+1:16: +1:48 _4 = function_with_bytes::<&*b"AAAA">() -> [return: bb1, unwind: bb19]; // scope 0 at $DIR/issue_99325.rs:+1:16: +1:48 // mir::Constant - // + span: $DIR/issue_99325.rs:10:16: 10:46 + // + span: $DIR/issue_99325.rs:11:16: 11:46 // + user_ty: UserType(0) // + literal: Const { ty: fn() -> &'static [u8] {function_with_bytes::<&*b"AAAA">}, val: Value() } } @@ -179,7 +179,7 @@ fn main() -> () { StorageLive(_26); // scope 0 at $DIR/issue_99325.rs:+2:16: +2:70 _26 = function_with_bytes::<&*b"AAAA">() -> [return: bb10, unwind: bb19]; // scope 0 at $DIR/issue_99325.rs:+2:16: +2:70 // mir::Constant - // + span: $DIR/issue_99325.rs:11:16: 11:68 + // + span: $DIR/issue_99325.rs:12:16: 12:68 // + user_ty: UserType(1) // + literal: Const { ty: fn() -> &'static [u8] {function_with_bytes::<&*b"AAAA">}, val: Value() } } @@ -190,7 +190,7 @@ fn main() -> () { StorageLive(_28); // scope 0 at $DIR/issue_99325.rs:+2:72: +2:79 _28 = const b"AAAA"; // scope 0 at $DIR/issue_99325.rs:+2:72: +2:79 // mir::Constant - // + span: $DIR/issue_99325.rs:11:72: 11:79 + // + span: $DIR/issue_99325.rs:12:72: 12:79 // + literal: Const { ty: &[u8; 4], val: Value(Scalar(alloc4)) } _27 = &_28; // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL _24 = (move _25, move _27); // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL diff --git a/tests/mir-opt/issue_99325.main.built.after.64bit.mir b/tests/mir-opt/issue_99325.main.built.after.64bit.mir new file mode 100644 index 0000000000000..a96517075cb61 --- /dev/null +++ b/tests/mir-opt/issue_99325.main.built.after.64bit.mir @@ -0,0 +1,295 @@ +// MIR for `main` after built + +| User Type Annotations +| 0: user_ty: Canonical { max_universe: U0, variables: [], value: TypeOf(DefId(0:3 ~ issue_99325[8f58]::function_with_bytes), UserSubsts { substs: [Const { ty: Ref(ReStatic, Array(Uint(U8), Const { ty: Uint(Usize), kind: Value(Leaf(0x0000000000000004)) }), Not), kind: Value(Branch([Leaf(0x41), Leaf(0x41), Leaf(0x41), Leaf(0x41)])) }], user_self_ty: None }) }, span: $DIR/issue_99325.rs:11:16: 11:46, inferred_ty: fn() -> &'static [u8] {function_with_bytes::<&*b"AAAA">} +| 1: user_ty: Canonical { max_universe: U0, variables: [], value: TypeOf(DefId(0:3 ~ issue_99325[8f58]::function_with_bytes), UserSubsts { substs: [Const { ty: Ref(ReStatic, Array(Uint(U8), Const { ty: Uint(Usize), kind: Value(Leaf(0x0000000000000004)) }), Not), kind: Unevaluated(UnevaluatedConst { def: WithOptConstParam { did: DefId(0:8 ~ issue_99325[8f58]::main::{constant#1}), const_param_did: Some(DefId(0:4 ~ issue_99325[8f58]::function_with_bytes::BYTES)) }, substs: [] }) }], user_self_ty: None }) }, span: $DIR/issue_99325.rs:12:16: 12:68, inferred_ty: fn() -> &'static [u8] {function_with_bytes::<&*b"AAAA">} +| +fn main() -> () { + let mut _0: (); // return place in scope 0 at $DIR/issue_99325.rs:+0:15: +0:15 + let _1: (); // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _2: (&&[u8], &&[u8; 4]); // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _3: &&[u8]; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let _4: &[u8]; // in scope 0 at $DIR/issue_99325.rs:+1:16: +1:48 + let mut _5: &&[u8; 4]; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let _6: &[u8; 4]; // in scope 0 at $DIR/issue_99325.rs:+1:50: +1:75 + let _7: [u8; 4]; // in scope 0 at $DIR/issue_99325.rs:+1:51: +1:75 + let _8: &&[u8]; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let _9: &&[u8; 4]; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _10: bool; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _11: bool; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _12: &&[u8]; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _13: &&[u8; 4]; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _14: !; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let _16: !; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _17: core::panicking::AssertKind; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _18: &&[u8]; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let _19: &&[u8]; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _20: &&[u8; 4]; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let _21: &&[u8; 4]; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _22: std::option::Option>; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let _23: (); // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _24: (&&[u8], &&[u8; 4]); // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _25: &&[u8]; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let _26: &[u8]; // in scope 0 at $DIR/issue_99325.rs:+2:16: +2:70 + let mut _27: &&[u8; 4]; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let _28: &[u8; 4]; // in scope 0 at $DIR/issue_99325.rs:+2:72: +2:79 + let _29: &&[u8]; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let _30: &&[u8; 4]; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _31: bool; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _32: bool; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _33: &&[u8]; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _34: &&[u8; 4]; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _35: !; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let _37: !; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _38: core::panicking::AssertKind; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _39: &&[u8]; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let _40: &&[u8]; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _41: &&[u8; 4]; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let _42: &&[u8; 4]; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _43: std::option::Option>; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + scope 1 { + debug left_val => _8; // in scope 1 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + debug right_val => _9; // in scope 1 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let _15: core::panicking::AssertKind; // in scope 1 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + scope 2 { + debug kind => _15; // in scope 2 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + } + } + scope 3 { + debug left_val => _29; // in scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + debug right_val => _30; // in scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let _36: core::panicking::AssertKind; // in scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + scope 4 { + debug kind => _36; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + } + } + + bb0: { + StorageLive(_1); // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_2); // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_3); // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_4); // scope 0 at $DIR/issue_99325.rs:+1:16: +1:48 + _4 = function_with_bytes::<&*b"AAAA">() -> [return: bb1, unwind: bb19]; // scope 0 at $DIR/issue_99325.rs:+1:16: +1:48 + // mir::Constant + // + span: $DIR/issue_99325.rs:11:16: 11:46 + // + user_ty: UserType(0) + // + literal: Const { ty: fn() -> &'static [u8] {function_with_bytes::<&*b"AAAA">}, val: Value() } + } + + bb1: { + _3 = &_4; // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_5); // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_6); // scope 0 at $DIR/issue_99325.rs:+1:50: +1:75 + StorageLive(_7); // scope 0 at $DIR/issue_99325.rs:+1:51: +1:75 + _7 = [const 65_u8, const 65_u8, const 65_u8, const 65_u8]; // scope 0 at $DIR/issue_99325.rs:+1:51: +1:75 + _6 = &_7; // scope 0 at $DIR/issue_99325.rs:+1:50: +1:75 + _5 = &_6; // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _2 = (move _3, move _5); // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_5); // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_3); // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + FakeRead(ForMatchedPlace(None), _2); // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_8); // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _8 = (_2.0: &&[u8]); // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_9); // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _9 = (_2.1: &&[u8; 4]); // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_10); // scope 1 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_11); // scope 1 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_12); // scope 1 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _12 = &(*_8); // scope 1 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_13); // scope 1 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _13 = &(*_9); // scope 1 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _11 = <&[u8] as PartialEq<&[u8; 4]>>::eq(move _12, move _13) -> [return: bb2, unwind: bb19]; // scope 1 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + // mir::Constant + // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL + // + literal: Const { ty: for<'a, 'b> fn(&'a &[u8], &'b &[u8; 4]) -> bool {<&[u8] as PartialEq<&[u8; 4]>>::eq}, val: Value() } + } + + bb2: { + StorageDead(_13); // scope 1 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_12); // scope 1 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _10 = Not(move _11); // scope 1 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_11); // scope 1 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + switchInt(move _10) -> [0: bb4, otherwise: bb3]; // scope 1 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + } + + bb3: { + StorageLive(_15); // scope 1 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _15 = core::panicking::AssertKind::Eq; // scope 1 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + FakeRead(ForLet(None), _15); // scope 1 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_16); // scope 2 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_17); // scope 2 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _17 = move _15; // scope 2 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_18); // scope 2 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_19); // scope 2 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _19 = &(*_8); // scope 2 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _18 = &(*_19); // scope 2 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_20); // scope 2 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_21); // scope 2 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _21 = &(*_9); // scope 2 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _20 = &(*_21); // scope 2 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_22); // scope 2 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _22 = Option::>::None; // scope 2 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _16 = core::panicking::assert_failed::<&[u8], &[u8; 4]>(move _17, move _18, move _20, move _22) -> bb19; // scope 2 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + // mir::Constant + // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL + // + literal: Const { ty: for<'a, 'b, 'c> fn(core::panicking::AssertKind, &'a &[u8], &'b &[u8; 4], Option>) -> ! {core::panicking::assert_failed::<&[u8], &[u8; 4]>}, val: Value() } + } + + bb4: { + goto -> bb7; // scope 1 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + } + + bb5: { + StorageDead(_22); // scope 2 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_20); // scope 2 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_18); // scope 2 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_17); // scope 2 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_21); // scope 2 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_19); // scope 2 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_16); // scope 2 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_15); // scope 1 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + unreachable; // scope 1 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + } + + bb6: { + goto -> bb8; // scope 1 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + } + + bb7: { + _1 = const (); // scope 1 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + goto -> bb8; // scope 1 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + } + + bb8: { + StorageDead(_10); // scope 1 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_9); // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_8); // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + goto -> bb9; // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + } + + bb9: { + StorageDead(_7); // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_6); // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_4); // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_2); // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_1); // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_23); // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_24); // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_25); // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_26); // scope 0 at $DIR/issue_99325.rs:+2:16: +2:70 + _26 = function_with_bytes::<&*b"AAAA">() -> [return: bb10, unwind: bb19]; // scope 0 at $DIR/issue_99325.rs:+2:16: +2:70 + // mir::Constant + // + span: $DIR/issue_99325.rs:12:16: 12:68 + // + user_ty: UserType(1) + // + literal: Const { ty: fn() -> &'static [u8] {function_with_bytes::<&*b"AAAA">}, val: Value() } + } + + bb10: { + _25 = &_26; // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_27); // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_28); // scope 0 at $DIR/issue_99325.rs:+2:72: +2:79 + _28 = const b"AAAA"; // scope 0 at $DIR/issue_99325.rs:+2:72: +2:79 + // mir::Constant + // + span: $DIR/issue_99325.rs:12:72: 12:79 + // + literal: Const { ty: &[u8; 4], val: Value(Scalar(alloc4)) } + _27 = &_28; // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _24 = (move _25, move _27); // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_27); // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_25); // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + FakeRead(ForMatchedPlace(None), _24); // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_29); // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _29 = (_24.0: &&[u8]); // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_30); // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _30 = (_24.1: &&[u8; 4]); // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_31); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_32); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_33); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _33 = &(*_29); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_34); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _34 = &(*_30); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _32 = <&[u8] as PartialEq<&[u8; 4]>>::eq(move _33, move _34) -> [return: bb11, unwind: bb19]; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + // mir::Constant + // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL + // + literal: Const { ty: for<'a, 'b> fn(&'a &[u8], &'b &[u8; 4]) -> bool {<&[u8] as PartialEq<&[u8; 4]>>::eq}, val: Value() } + } + + bb11: { + StorageDead(_34); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_33); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _31 = Not(move _32); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_32); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + switchInt(move _31) -> [0: bb13, otherwise: bb12]; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + } + + bb12: { + StorageLive(_36); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _36 = core::panicking::AssertKind::Eq; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + FakeRead(ForLet(None), _36); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_37); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_38); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _38 = move _36; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_39); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_40); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _40 = &(*_29); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _39 = &(*_40); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_41); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_42); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _42 = &(*_30); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _41 = &(*_42); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_43); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _43 = Option::>::None; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _37 = core::panicking::assert_failed::<&[u8], &[u8; 4]>(move _38, move _39, move _41, move _43) -> bb19; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + // mir::Constant + // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL + // + literal: Const { ty: for<'a, 'b, 'c> fn(core::panicking::AssertKind, &'a &[u8], &'b &[u8; 4], Option>) -> ! {core::panicking::assert_failed::<&[u8], &[u8; 4]>}, val: Value() } + } + + bb13: { + goto -> bb16; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + } + + bb14: { + StorageDead(_43); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_41); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_39); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_38); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_42); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_40); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_37); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_36); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + unreachable; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + } + + bb15: { + goto -> bb17; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + } + + bb16: { + _23 = const (); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + goto -> bb17; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + } + + bb17: { + StorageDead(_31); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_30); // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_29); // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + goto -> bb18; // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + } + + bb18: { + StorageDead(_28); // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_26); // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_24); // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_23); // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _0 = const (); // scope 0 at $DIR/issue_99325.rs:+0:15: +3:2 + return; // scope 0 at $DIR/issue_99325.rs:+3:2: +3:2 + } + + bb19 (cleanup): { + resume; // scope 0 at $DIR/issue_99325.rs:+0:1: +3:2 + } +} + +alloc4 (size: 4, align: 1) { + 41 41 41 41 │ AAAA +} diff --git a/tests/mir-opt/issue_99325.rs b/tests/mir-opt/issue_99325.rs index fe819cddb2c34..1460d59bc741a 100644 --- a/tests/mir-opt/issue_99325.rs +++ b/tests/mir-opt/issue_99325.rs @@ -5,6 +5,7 @@ pub fn function_with_bytes() -> &'static [u8] { BYTES } +// EMIT_MIR_FOR_EACH_BIT_WIDTH // EMIT_MIR issue_99325.main.built.after.mir pub fn main() { assert_eq!(function_with_bytes::(), &[0x41, 0x41, 0x41, 0x41]); diff --git a/tests/mir-opt/lower_intrinsics.discriminant.LowerIntrinsics.diff b/tests/mir-opt/lower_intrinsics.discriminant.LowerIntrinsics.diff index d962ef8cb12dc..c9963bf1a99a3 100644 --- a/tests/mir-opt/lower_intrinsics.discriminant.LowerIntrinsics.diff +++ b/tests/mir-opt/lower_intrinsics.discriminant.LowerIntrinsics.diff @@ -47,7 +47,7 @@ _19 = const _; // scope 0 at $DIR/lower_intrinsics.rs:+2:42: +2:44 // mir::Constant // + span: $DIR/lower_intrinsics.rs:50:42: 50:44 - // + literal: Const { ty: &i32, val: Unevaluated(discriminant, [T], Some(promoted[2])) } + // + literal: Const { ty: &i32, val: Unevaluated(discriminant, [Param(T/#0)], Some(promoted[2])) } _7 = &(*_19); // scope 0 at $DIR/lower_intrinsics.rs:+2:42: +2:44 _6 = &(*_7); // scope 0 at $DIR/lower_intrinsics.rs:+2:42: +2:44 - _5 = discriminant_value::(move _6) -> bb2; // scope 0 at $DIR/lower_intrinsics.rs:+2:5: +2:45 @@ -68,7 +68,7 @@ _18 = const _; // scope 0 at $DIR/lower_intrinsics.rs:+3:42: +3:45 // mir::Constant // + span: $DIR/lower_intrinsics.rs:51:42: 51:45 - // + literal: Const { ty: &(), val: Unevaluated(discriminant, [T], Some(promoted[1])) } + // + literal: Const { ty: &(), val: Unevaluated(discriminant, [Param(T/#0)], Some(promoted[1])) } _11 = &(*_18); // scope 0 at $DIR/lower_intrinsics.rs:+3:42: +3:45 _10 = &(*_11); // scope 0 at $DIR/lower_intrinsics.rs:+3:42: +3:45 - _9 = discriminant_value::<()>(move _10) -> bb3; // scope 0 at $DIR/lower_intrinsics.rs:+3:5: +3:46 @@ -89,7 +89,7 @@ _17 = const _; // scope 0 at $DIR/lower_intrinsics.rs:+4:42: +4:47 // mir::Constant // + span: $DIR/lower_intrinsics.rs:52:42: 52:47 - // + literal: Const { ty: &E, val: Unevaluated(discriminant, [T], Some(promoted[0])) } + // + literal: Const { ty: &E, val: Unevaluated(discriminant, [Param(T/#0)], Some(promoted[0])) } _15 = &(*_17); // scope 0 at $DIR/lower_intrinsics.rs:+4:42: +4:47 _14 = &(*_15); // scope 0 at $DIR/lower_intrinsics.rs:+4:42: +4:47 - _13 = discriminant_value::(move _14) -> bb4; // scope 0 at $DIR/lower_intrinsics.rs:+4:5: +4:48 diff --git a/tests/mir-opt/nll/region_subtyping_basic.main.nll.0.32bit.mir b/tests/mir-opt/nll/region_subtyping_basic.main.nll.0.32bit.mir index 798e45df8ca76..6369bf2c0e634 100644 --- a/tests/mir-opt/nll/region_subtyping_basic.main.nll.0.32bit.mir +++ b/tests/mir-opt/nll/region_subtyping_basic.main.nll.0.32bit.mir @@ -22,7 +22,7 @@ | fn main() -> () { let mut _0: (); // return place in scope 0 at $DIR/region_subtyping_basic.rs:+0:11: +0:11 - let mut _1: [usize; Const(Value(Leaf(0x00000003)): usize)]; // in scope 0 at $DIR/region_subtyping_basic.rs:+1:9: +1:14 + let mut _1: [usize; Const(Value(Leaf(0x00000003)): Uint(Usize))]; // in scope 0 at $DIR/region_subtyping_basic.rs:+1:9: +1:14 let _3: usize; // in scope 0 at $DIR/region_subtyping_basic.rs:+2:16: +2:17 let mut _4: usize; // in scope 0 at $DIR/region_subtyping_basic.rs:+2:14: +2:18 let mut _5: bool; // in scope 0 at $DIR/region_subtyping_basic.rs:+2:14: +2:18 diff --git a/tests/mir-opt/nll/region_subtyping_basic.main.nll.0.64bit.mir b/tests/mir-opt/nll/region_subtyping_basic.main.nll.0.64bit.mir index 4767bfc76ed9d..f7260f4664c63 100644 --- a/tests/mir-opt/nll/region_subtyping_basic.main.nll.0.64bit.mir +++ b/tests/mir-opt/nll/region_subtyping_basic.main.nll.0.64bit.mir @@ -22,7 +22,7 @@ | fn main() -> () { let mut _0: (); // return place in scope 0 at $DIR/region_subtyping_basic.rs:+0:11: +0:11 - let mut _1: [usize; Const(Value(Leaf(0x0000000000000003)): usize)]; // in scope 0 at $DIR/region_subtyping_basic.rs:+1:9: +1:14 + let mut _1: [usize; Const(Value(Leaf(0x0000000000000003)): Uint(Usize))]; // in scope 0 at $DIR/region_subtyping_basic.rs:+1:9: +1:14 let _3: usize; // in scope 0 at $DIR/region_subtyping_basic.rs:+2:16: +2:17 let mut _4: usize; // in scope 0 at $DIR/region_subtyping_basic.rs:+2:14: +2:18 let mut _5: bool; // in scope 0 at $DIR/region_subtyping_basic.rs:+2:14: +2:18 From ea96099ea4d512979a0ba40d2f624b33f825c1e4 Mon Sep 17 00:00:00 2001 From: Boxy Date: Fri, 20 Jan 2023 18:00:46 +0000 Subject: [PATCH 5/8] dont use `escape` with `Ty` debug formatting --- compiler/rustc_middle/src/mir/graphviz.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/compiler/rustc_middle/src/mir/graphviz.rs b/compiler/rustc_middle/src/mir/graphviz.rs index 9253b033336cc..cdfbc0fc0a3af 100644 --- a/compiler/rustc_middle/src/mir/graphviz.rs +++ b/compiler/rustc_middle/src/mir/graphviz.rs @@ -3,7 +3,6 @@ use rustc_graphviz as dot; use rustc_hir::def_id::DefId; use rustc_middle::mir::*; use rustc_middle::ty::{self, TyCtxt}; -use std::fmt::Debug; use std::io::{self, Write}; use super::generic_graph::mir_fn_to_generic_graph; @@ -103,7 +102,7 @@ fn write_graph_label<'tcx, W: std::fmt::Write>( write!(w, "{:?}: {}", Place::from(arg), escape(&body.local_decls[arg].ty))?; } - write!(w, ") -> {}", dot::escape_html(&format!("{}", body.return_ty())))?; + write!(w, ") -> {}", escape(&body.return_ty()))?; write!(w, r#"
"#)?; for local in body.vars_and_temps_iter() { @@ -122,13 +121,13 @@ fn write_graph_label<'tcx, W: std::fmt::Write>( w, r#"debug {} => {};
"#, var_debug_info.name, - escape(&var_debug_info.value), + dot::escape_html(&format!("{:?}", &var_debug_info.value)), )?; } Ok(()) } -fn escape(t: &T) -> String { - dot::escape_html(&format!("{:?}", t)) +fn escape(t: &T) -> String { + dot::escape_html(&format!("{}", t)) } From 6f011f1525e1d2118f28448fd03700f194230bf9 Mon Sep 17 00:00:00 2001 From: Boxy Date: Fri, 20 Jan 2023 21:07:49 +0000 Subject: [PATCH 6/8] format `layout_of({ty})` without `Debug` --- compiler/rustc_passes/src/layout_test.rs | 16 +++++++++------- tests/ui/layout/debug.stderr | 10 +++++----- tests/ui/layout/hexagon-enum.stderr | 10 +++++----- ...158-scalarpair-payload-might-be-uninit.stderr | 10 +++++----- .../layout/issue-96185-overaligned-enum.stderr | 4 ++-- tests/ui/layout/thumb-enum.stderr | 10 +++++----- .../ui/layout/zero-sized-array-enum-niche.stderr | 8 ++++---- 7 files changed, 35 insertions(+), 33 deletions(-) diff --git a/compiler/rustc_passes/src/layout_test.rs b/compiler/rustc_passes/src/layout_test.rs index 827d86780aa8c..acce73ae785bd 100644 --- a/compiler/rustc_passes/src/layout_test.rs +++ b/compiler/rustc_passes/src/layout_test.rs @@ -69,13 +69,15 @@ fn dump_layout_of(tcx: TyCtxt<'_>, item_def_id: LocalDefId, attr: &Attribute) { } sym::debug => { - let normalized_ty = format!( - "{:?}", - tcx.normalize_erasing_regions( - param_env.with_reveal_all_normalized(tcx), - ty, - ) - ); + let normalized_ty = + rustc_middle::ty::print::with_no_trimmed_paths!(format!( + "{}", + tcx.normalize_erasing_regions( + param_env.with_reveal_all_normalized(tcx), + ty, + ) + )); + let ty_layout = format!("{:#?}", *ty_layout); tcx.sess.emit_err(LayoutOf { span: tcx.def_span(item_def_id.to_def_id()), diff --git a/tests/ui/layout/debug.stderr b/tests/ui/layout/debug.stderr index 3d08c9c11dd0a..c5e1c41d1304c 100644 --- a/tests/ui/layout/debug.stderr +++ b/tests/ui/layout/debug.stderr @@ -1,4 +1,4 @@ -error: layout_of(Adt(E, [])) = Layout { +error: layout_of(E) = Layout { size: Size(12 bytes), align: AbiAndPrefAlign { abi: Align(4 bytes), @@ -86,7 +86,7 @@ error: layout_of(Adt(E, [])) = Layout { LL | enum E { Foo, Bar(!, i32, i32) } | ^^^^^^ -error: layout_of(Adt(S, [])) = Layout { +error: layout_of(S) = Layout { size: Size(8 bytes), align: AbiAndPrefAlign { abi: Align(4 bytes), @@ -130,7 +130,7 @@ error: layout_of(Adt(S, [])) = Layout { LL | struct S { f1: i32, f2: (), f3: i32 } | ^^^^^^^^ -error: layout_of(Adt(U, [])) = Layout { +error: layout_of(U) = Layout { size: Size(8 bytes), align: AbiAndPrefAlign { abi: Align(4 bytes), @@ -152,7 +152,7 @@ error: layout_of(Adt(U, [])) = Layout { LL | union U { f1: (i32, i32), f3: i32 } | ^^^^^^^ -error: layout_of(Adt(std::result::Result, [Int(I32), Int(I32)])) = Layout { +error: layout_of(std::result::Result) = Layout { size: Size(8 bytes), align: AbiAndPrefAlign { abi: Align(4 bytes), @@ -281,7 +281,7 @@ error: layout_of(Adt(std::result::Result, [Int(I32), Int(I32)])) = Layout { LL | type Test = Result; | ^^^^^^^^^ -error: layout_of(Int(I32)) = Layout { +error: layout_of(i32) = Layout { size: Size(4 bytes), align: AbiAndPrefAlign { abi: Align(4 bytes), diff --git a/tests/ui/layout/hexagon-enum.stderr b/tests/ui/layout/hexagon-enum.stderr index 94509450e4679..d850dd69c96e3 100644 --- a/tests/ui/layout/hexagon-enum.stderr +++ b/tests/ui/layout/hexagon-enum.stderr @@ -1,4 +1,4 @@ -error: layout_of(Adt(A, [])) = Layout { +error: layout_of(A) = Layout { size: Size(1 bytes), align: AbiAndPrefAlign { abi: Align(1 bytes), @@ -68,7 +68,7 @@ error: layout_of(Adt(A, [])) = Layout { LL | enum A { Apple } | ^^^^^^ -error: layout_of(Adt(B, [])) = Layout { +error: layout_of(B) = Layout { size: Size(1 bytes), align: AbiAndPrefAlign { abi: Align(1 bytes), @@ -138,7 +138,7 @@ error: layout_of(Adt(B, [])) = Layout { LL | enum B { Banana = 255, } | ^^^^^^ -error: layout_of(Adt(C, [])) = Layout { +error: layout_of(C) = Layout { size: Size(2 bytes), align: AbiAndPrefAlign { abi: Align(2 bytes), @@ -208,7 +208,7 @@ error: layout_of(Adt(C, [])) = Layout { LL | enum C { Chaenomeles = 256, } | ^^^^^^ -error: layout_of(Adt(P, [])) = Layout { +error: layout_of(P) = Layout { size: Size(4 bytes), align: AbiAndPrefAlign { abi: Align(4 bytes), @@ -278,7 +278,7 @@ error: layout_of(Adt(P, [])) = Layout { LL | enum P { Peach = 0x1000_0000isize, } | ^^^^^^ -error: layout_of(Adt(T, [])) = Layout { +error: layout_of(T) = Layout { size: Size(4 bytes), align: AbiAndPrefAlign { abi: Align(4 bytes), diff --git a/tests/ui/layout/issue-96158-scalarpair-payload-might-be-uninit.stderr b/tests/ui/layout/issue-96158-scalarpair-payload-might-be-uninit.stderr index d50caa41db428..20d4c418e879c 100644 --- a/tests/ui/layout/issue-96158-scalarpair-payload-might-be-uninit.stderr +++ b/tests/ui/layout/issue-96158-scalarpair-payload-might-be-uninit.stderr @@ -1,4 +1,4 @@ -error: layout_of(Adt(MissingPayloadField, [])) = Layout { +error: layout_of(MissingPayloadField) = Layout { size: Size(2 bytes), align: AbiAndPrefAlign { abi: Align(1 bytes), @@ -108,7 +108,7 @@ error: layout_of(Adt(MissingPayloadField, [])) = Layout { LL | pub enum MissingPayloadField { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: layout_of(Adt(CommonPayloadField, [])) = Layout { +error: layout_of(CommonPayloadField) = Layout { size: Size(2 bytes), align: AbiAndPrefAlign { abi: Align(1 bytes), @@ -237,7 +237,7 @@ error: layout_of(Adt(CommonPayloadField, [])) = Layout { LL | pub enum CommonPayloadField { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: layout_of(Adt(CommonPayloadFieldIsMaybeUninit, [])) = Layout { +error: layout_of(CommonPayloadFieldIsMaybeUninit) = Layout { size: Size(2 bytes), align: AbiAndPrefAlign { abi: Align(1 bytes), @@ -363,7 +363,7 @@ error: layout_of(Adt(CommonPayloadFieldIsMaybeUninit, [])) = Layout { LL | pub enum CommonPayloadFieldIsMaybeUninit { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: layout_of(Adt(NicheFirst, [])) = Layout { +error: layout_of(NicheFirst) = Layout { size: Size(2 bytes), align: AbiAndPrefAlign { abi: Align(1 bytes), @@ -507,7 +507,7 @@ error: layout_of(Adt(NicheFirst, [])) = Layout { LL | pub enum NicheFirst { | ^^^^^^^^^^^^^^^^^^^ -error: layout_of(Adt(NicheSecond, [])) = Layout { +error: layout_of(NicheSecond) = Layout { size: Size(2 bytes), align: AbiAndPrefAlign { abi: Align(1 bytes), diff --git a/tests/ui/layout/issue-96185-overaligned-enum.stderr b/tests/ui/layout/issue-96185-overaligned-enum.stderr index 4057ad19b8b49..de6177c8dfc4d 100644 --- a/tests/ui/layout/issue-96185-overaligned-enum.stderr +++ b/tests/ui/layout/issue-96185-overaligned-enum.stderr @@ -1,4 +1,4 @@ -error: layout_of(Adt(Aligned1, [])) = Layout { +error: layout_of(Aligned1) = Layout { size: Size(8 bytes), align: AbiAndPrefAlign { abi: Align(8 bytes), @@ -80,7 +80,7 @@ error: layout_of(Adt(Aligned1, [])) = Layout { LL | pub enum Aligned1 { | ^^^^^^^^^^^^^^^^^ -error: layout_of(Adt(Aligned2, [])) = Layout { +error: layout_of(Aligned2) = Layout { size: Size(1 bytes), align: AbiAndPrefAlign { abi: Align(1 bytes), diff --git a/tests/ui/layout/thumb-enum.stderr b/tests/ui/layout/thumb-enum.stderr index b12d8528b6e45..227bd950b6666 100644 --- a/tests/ui/layout/thumb-enum.stderr +++ b/tests/ui/layout/thumb-enum.stderr @@ -1,4 +1,4 @@ -error: layout_of(Adt(A, [])) = Layout { +error: layout_of(A) = Layout { size: Size(1 bytes), align: AbiAndPrefAlign { abi: Align(1 bytes), @@ -68,7 +68,7 @@ error: layout_of(Adt(A, [])) = Layout { LL | enum A { Apple } | ^^^^^^ -error: layout_of(Adt(B, [])) = Layout { +error: layout_of(B) = Layout { size: Size(1 bytes), align: AbiAndPrefAlign { abi: Align(1 bytes), @@ -138,7 +138,7 @@ error: layout_of(Adt(B, [])) = Layout { LL | enum B { Banana = 255, } | ^^^^^^ -error: layout_of(Adt(C, [])) = Layout { +error: layout_of(C) = Layout { size: Size(2 bytes), align: AbiAndPrefAlign { abi: Align(2 bytes), @@ -208,7 +208,7 @@ error: layout_of(Adt(C, [])) = Layout { LL | enum C { Chaenomeles = 256, } | ^^^^^^ -error: layout_of(Adt(P, [])) = Layout { +error: layout_of(P) = Layout { size: Size(4 bytes), align: AbiAndPrefAlign { abi: Align(4 bytes), @@ -278,7 +278,7 @@ error: layout_of(Adt(P, [])) = Layout { LL | enum P { Peach = 0x1000_0000isize, } | ^^^^^^ -error: layout_of(Adt(T, [])) = Layout { +error: layout_of(T) = Layout { size: Size(4 bytes), align: AbiAndPrefAlign { abi: Align(4 bytes), diff --git a/tests/ui/layout/zero-sized-array-enum-niche.stderr b/tests/ui/layout/zero-sized-array-enum-niche.stderr index b2929e11e8d83..ce688655415b6 100644 --- a/tests/ui/layout/zero-sized-array-enum-niche.stderr +++ b/tests/ui/layout/zero-sized-array-enum-niche.stderr @@ -1,4 +1,4 @@ -error: layout_of(Adt(std::result::Result, [Array(Uint(U32), Const { ty: Uint(Usize), kind: Value(Leaf(...)) }), Bool])) = Layout { +error: layout_of(std::result::Result<[u32; 0], bool>) = Layout { size: Size(4 bytes), align: AbiAndPrefAlign { abi: Align(4 bytes), @@ -97,7 +97,7 @@ error: layout_of(Adt(std::result::Result, [Array(Uint(U32), Const { ty: Uint(Usi LL | type AlignedResult = Result<[u32; 0], bool>; | ^^^^^^^^^^^^^^^^^^ -error: layout_of(Adt(MultipleAlignments, [])) = Layout { +error: layout_of(MultipleAlignments) = Layout { size: Size(4 bytes), align: AbiAndPrefAlign { abi: Align(4 bytes), @@ -218,7 +218,7 @@ error: layout_of(Adt(MultipleAlignments, [])) = Layout { LL | enum MultipleAlignments { | ^^^^^^^^^^^^^^^^^^^^^^^ -error: layout_of(Adt(std::result::Result, [Array(Uint(U32), Const { ty: Uint(Usize), kind: Value(Leaf(...)) }), Adt(Packed, [Adt(std::num::NonZeroU16, [])])])) = Layout { +error: layout_of(std::result::Result<[u32; 0], Packed>) = Layout { size: Size(4 bytes), align: AbiAndPrefAlign { abi: Align(4 bytes), @@ -317,7 +317,7 @@ error: layout_of(Adt(std::result::Result, [Array(Uint(U32), Const { ty: Uint(Usi LL | type NicheLosesToTagged = Result<[u32; 0], Packed>; | ^^^^^^^^^^^^^^^^^^^^^^^ -error: layout_of(Adt(std::result::Result, [Array(Uint(U32), Const { ty: Uint(Usize), kind: Value(Leaf(...)) }), Adt(Packed, [Adt(U16IsZero, [])])])) = Layout { +error: layout_of(std::result::Result<[u32; 0], Packed>) = Layout { size: Size(4 bytes), align: AbiAndPrefAlign { abi: Align(4 bytes), From 9bdf7cacba15c9ee2d4763f32342c034a0985880 Mon Sep 17 00:00:00 2001 From: Boxy Date: Mon, 23 Jan 2023 16:02:00 +0000 Subject: [PATCH 7/8] special case `TyAndLayout` debug impl --- compiler/rustc_target/src/abi/call/mod.rs | 23 +++++++++++++++++++++-- compiler/rustc_target/src/abi/mod.rs | 11 ++++++++++- 2 files changed, 31 insertions(+), 3 deletions(-) diff --git a/compiler/rustc_target/src/abi/call/mod.rs b/compiler/rustc_target/src/abi/call/mod.rs index a0730fbb650dc..7b394b895f345 100644 --- a/compiler/rustc_target/src/abi/call/mod.rs +++ b/compiler/rustc_target/src/abi/call/mod.rs @@ -458,12 +458,18 @@ impl<'a, Ty> TyAndLayout<'a, Ty> { /// Information about how to pass an argument to, /// or return a value from, a function, under some ABI. -#[derive(PartialEq, Eq, Hash, Debug, HashStable_Generic)] +#[derive(PartialEq, Eq, Hash, HashStable_Generic)] pub struct ArgAbi<'a, Ty> { pub layout: TyAndLayout<'a, Ty>, pub mode: PassMode, } +impl<'a, Ty: fmt::Debug + fmt::Display> fmt::Debug for ArgAbi<'a, Ty> { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("ArgAbi").field("layout", &self.layout).field("mode", &self.mode).finish() + } +} + impl<'a, Ty> ArgAbi<'a, Ty> { pub fn new( cx: &impl HasDataLayout, @@ -605,7 +611,7 @@ pub enum Conv { /// /// I will do my best to describe this structure, but these /// comments are reverse-engineered and may be inaccurate. -NDM -#[derive(PartialEq, Eq, Hash, Debug, HashStable_Generic)] +#[derive(PartialEq, Eq, Hash, HashStable_Generic)] pub struct FnAbi<'a, Ty> { /// The LLVM types of each argument. pub args: Box<[ArgAbi<'a, Ty>]>, @@ -626,6 +632,19 @@ pub struct FnAbi<'a, Ty> { pub can_unwind: bool, } +impl<'a, Ty: fmt::Debug + fmt::Display> fmt::Debug for FnAbi<'a, Ty> { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("FnAbi") + .field("args", &self.args) + .field("ret", &self.ret) + .field("c_variadic", &self.c_variadic) + .field("fixed_count", &self.fixed_count) + .field("conv", &self.conv) + .field("can_unwind", &self.can_unwind) + .finish() + } +} + /// Error produced by attempting to adjust a `FnAbi`, for a "foreign" ABI. #[derive(Copy, Clone, Debug, HashStable_Generic)] pub enum AdjustForForeignAbiError { diff --git a/compiler/rustc_target/src/abi/mod.rs b/compiler/rustc_target/src/abi/mod.rs index 39761baf1bc29..fe7dbca4edc18 100644 --- a/compiler/rustc_target/src/abi/mod.rs +++ b/compiler/rustc_target/src/abi/mod.rs @@ -68,12 +68,21 @@ impl<'a> Layout<'a> { /// to that obtained from `layout_of(ty)`, as we need to produce /// layouts for which Rust types do not exist, such as enum variants /// or synthetic fields of enums (i.e., discriminants) and fat pointers. -#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, HashStable_Generic)] +#[derive(Copy, Clone, PartialEq, Eq, Hash, HashStable_Generic)] pub struct TyAndLayout<'a, Ty> { pub ty: Ty, pub layout: Layout<'a>, } +impl<'a, Ty: fmt::Debug + fmt::Display> fmt::Debug for TyAndLayout<'a, Ty> { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("TyAndLayout") + .field("ty", &format_args!("{}", &self.ty)) + .field("layout", &self.layout) + .finish() + } +} + impl<'a, Ty> Deref for TyAndLayout<'a, Ty> { type Target = &'a LayoutS; fn deref(&self) -> &&'a LayoutS { From 31b33737fe4eea47cfca1f0720dcdff77415fd93 Mon Sep 17 00:00:00 2001 From: Boxy Date: Mon, 30 Jan 2023 00:38:37 +0000 Subject: [PATCH 8/8] rebase --- ...await.b-{closure#0}.generator_resume.0.mir | 33 +++++----- ...anup.main-{closure#0}.generator_drop.0.mir | 12 ++-- ...ny.main-{closure#0}.generator_resume.0.mir | 12 ++-- ...rator-print-verbose-1.drop_tracking.stderr | 2 +- ...r-print-verbose-1.drop_tracking_mir.stderr | 2 +- ...or-print-verbose-1.no_drop_tracking.stderr | 2 +- .../print/generator-print-verbose-1.stderr | 62 ------------------- tests/ui/thir-print/thir-tree-match.stdout | 54 ++++++++-------- tests/ui/thir-print/thir-tree.stdout | 6 +- 9 files changed, 55 insertions(+), 130 deletions(-) delete mode 100644 tests/ui/generator/print/generator-print-verbose-1.stderr diff --git a/tests/mir-opt/building/async_await.b-{closure#0}.generator_resume.0.mir b/tests/mir-opt/building/async_await.b-{closure#0}.generator_resume.0.mir index 65311abb73d2b..cc87b27b9cd39 100644 --- a/tests/mir-opt/building/async_await.b-{closure#0}.generator_resume.0.mir +++ b/tests/mir-opt/building/async_await.b-{closure#0}.generator_resume.0.mir @@ -1,9 +1,14 @@ // MIR for `b::{closure#0}` 0 generator_resume /* generator_layout = GeneratorLayout { field_tys: { -<<<<<<< master _0: GeneratorSavedTy { - ty: impl std::future::Future, + ty: Alias( + Opaque, + AliasTy { + substs: [], + def_id: DefId(0:7 ~ async_await[672b]::a::{opaque#0}), + }, + ), source_info: SourceInfo { span: $DIR/async_await.rs:15:8: 15:14 (#9), scope: scope[0], @@ -11,29 +16,19 @@ ignore_for_traits: false, }, _1: GeneratorSavedTy { - ty: impl std::future::Future, + ty: Alias( + Opaque, + AliasTy { + substs: [], + def_id: DefId(0:7 ~ async_await[672b]::a::{opaque#0}), + }, + ), source_info: SourceInfo { span: $DIR/async_await.rs:16:8: 16:14 (#12), scope: scope[0], }, ignore_for_traits: false, }, -======= - _0: Alias( - Opaque, - AliasTy { - substs: [], - def_id: DefId(0:7 ~ async_await[672b]::a::{opaque#0}), - }, - ), - _1: Alias( - Opaque, - AliasTy { - substs: [], - def_id: DefId(0:7 ~ async_await[672b]::a::{opaque#0}), - }, - ), ->>>>>>> mir printing changes }, variant_fields: { Unresumed(0): [], diff --git a/tests/mir-opt/generator_drop_cleanup.main-{closure#0}.generator_drop.0.mir b/tests/mir-opt/generator_drop_cleanup.main-{closure#0}.generator_drop.0.mir index 812c7c6374259..e1342606fc6b9 100644 --- a/tests/mir-opt/generator_drop_cleanup.main-{closure#0}.generator_drop.0.mir +++ b/tests/mir-opt/generator_drop_cleanup.main-{closure#0}.generator_drop.0.mir @@ -1,21 +1,17 @@ // MIR for `main::{closure#0}` 0 generator_drop /* generator_layout = GeneratorLayout { field_tys: { -<<<<<<< master _0: GeneratorSavedTy { - ty: std::string::String, + ty: Adt( + std::string::String, + [], + ), source_info: SourceInfo { span: $DIR/generator_drop_cleanup.rs:11:13: 11:15 (#0), scope: scope[0], }, ignore_for_traits: false, }, -======= - _0: Adt( - std::string::String, - [], - ), ->>>>>>> mir printing changes }, variant_fields: { Unresumed(0): [], diff --git a/tests/mir-opt/generator_tiny.main-{closure#0}.generator_resume.0.mir b/tests/mir-opt/generator_tiny.main-{closure#0}.generator_resume.0.mir index 6dd4650c4f4ac..d57168ec65d46 100644 --- a/tests/mir-opt/generator_tiny.main-{closure#0}.generator_resume.0.mir +++ b/tests/mir-opt/generator_tiny.main-{closure#0}.generator_resume.0.mir @@ -1,21 +1,17 @@ // MIR for `main::{closure#0}` 0 generator_resume /* generator_layout = GeneratorLayout { field_tys: { -<<<<<<< master _0: GeneratorSavedTy { - ty: HasDrop, + ty: Adt( + HasDrop, + [], + ), source_info: SourceInfo { span: $DIR/generator_tiny.rs:20:13: 20:15 (#0), scope: scope[0], }, ignore_for_traits: false, }, -======= - _0: Adt( - HasDrop, - [], - ), ->>>>>>> mir printing changes }, variant_fields: { Unresumed(0): [], diff --git a/tests/ui/generator/print/generator-print-verbose-1.drop_tracking.stderr b/tests/ui/generator/print/generator-print-verbose-1.drop_tracking.stderr index 7d0a201699b5c..3f70914a8deef 100644 --- a/tests/ui/generator/print/generator-print-verbose-1.drop_tracking.stderr +++ b/tests/ui/generator/print/generator-print-verbose-1.drop_tracking.stderr @@ -37,7 +37,7 @@ note: required because it's used within this generator | LL | || { | ^^ -note: required because it appears within the type `Opaque(DefId(0:35 ~ generator_print_verbose_1[749a]::make_gen2::{opaque#0}), [Arc>])` +note: required because it appears within the type `Opaque(DefId(0:35 ~ generator_print_verbose_1[749a]::make_gen2::{opaque#0}), [Adt(Arc, [Adt(RefCell, [Int(I32)])])])` --> $DIR/generator-print-verbose-1.rs:44:30 | LL | pub fn make_gen2(t: T) -> impl Generator { diff --git a/tests/ui/generator/print/generator-print-verbose-1.drop_tracking_mir.stderr b/tests/ui/generator/print/generator-print-verbose-1.drop_tracking_mir.stderr index c045b1441c146..3c6213733ff5d 100644 --- a/tests/ui/generator/print/generator-print-verbose-1.drop_tracking_mir.stderr +++ b/tests/ui/generator/print/generator-print-verbose-1.drop_tracking_mir.stderr @@ -33,7 +33,7 @@ note: required because it's used within this generator | LL | || { | ^^ -note: required because it appears within the type `Opaque(DefId(0:35 ~ generator_print_verbose_1[749a]::make_gen2::{opaque#0}), [Arc>])` +note: required because it appears within the type `Opaque(DefId(0:35 ~ generator_print_verbose_1[749a]::make_gen2::{opaque#0}), [Adt(Arc, [Adt(RefCell, [Int(I32)])])])` --> $DIR/generator-print-verbose-1.rs:44:30 | LL | pub fn make_gen2(t: T) -> impl Generator { diff --git a/tests/ui/generator/print/generator-print-verbose-1.no_drop_tracking.stderr b/tests/ui/generator/print/generator-print-verbose-1.no_drop_tracking.stderr index 7d0a201699b5c..3f70914a8deef 100644 --- a/tests/ui/generator/print/generator-print-verbose-1.no_drop_tracking.stderr +++ b/tests/ui/generator/print/generator-print-verbose-1.no_drop_tracking.stderr @@ -37,7 +37,7 @@ note: required because it's used within this generator | LL | || { | ^^ -note: required because it appears within the type `Opaque(DefId(0:35 ~ generator_print_verbose_1[749a]::make_gen2::{opaque#0}), [Arc>])` +note: required because it appears within the type `Opaque(DefId(0:35 ~ generator_print_verbose_1[749a]::make_gen2::{opaque#0}), [Adt(Arc, [Adt(RefCell, [Int(I32)])])])` --> $DIR/generator-print-verbose-1.rs:44:30 | LL | pub fn make_gen2(t: T) -> impl Generator { diff --git a/tests/ui/generator/print/generator-print-verbose-1.stderr b/tests/ui/generator/print/generator-print-verbose-1.stderr deleted file mode 100644 index ac27ba49a1f4f..0000000000000 --- a/tests/ui/generator/print/generator-print-verbose-1.stderr +++ /dev/null @@ -1,62 +0,0 @@ -error: generator cannot be sent between threads safely - --> $DIR/generator-print-verbose-1.rs:37:18 - | -LL | require_send(send_gen); - | ^^^^^^^^ generator is not `Send` - | - = help: the trait `Sync` is not implemented for `RefCell` -note: generator is not `Send` as this value is used across a yield - --> $DIR/generator-print-verbose-1.rs:35:9 - | -LL | let _non_send_gen = make_non_send_generator(); - | ------------- has type `Opaque(DefId(0:34 ~ generator_print_verbose_1[749a]::make_non_send_generator::{opaque#0}), [])` which is not `Send` -LL | yield; - | ^^^^^ yield occurs here, with `_non_send_gen` maybe used later -LL | }; - | - `_non_send_gen` is later dropped here -note: required by a bound in `require_send` - --> $DIR/generator-print-verbose-1.rs:26:25 - | -LL | fn require_send(_: impl Send) {} - | ^^^^ required by this bound in `require_send` - -error[E0277]: `RefCell` cannot be shared between threads safely - --> $DIR/generator-print-verbose-1.rs:56:18 - | -LL | require_send(send_gen); - | ------------ ^^^^^^^^ `RefCell` cannot be shared between threads safely - | | - | required by a bound introduced by this call - | - = help: the trait `Sync` is not implemented for `RefCell` - = note: required for `Arc>` to implement `Send` -note: required because it's used within this generator - --> $DIR/generator-print-verbose-1.rs:42:5 - | -LL | || { - | ^^ -note: required because it appears within the type `Opaque(DefId(0:35 ~ generator_print_verbose_1[749a]::make_gen2::{opaque#0}), [Adt(Arc, [Adt(RefCell, [Int(I32)])])])` - --> $DIR/generator-print-verbose-1.rs:41:30 - | -LL | pub fn make_gen2(t: T) -> impl Generator { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ -note: required because it appears within the type `Opaque(DefId(0:36 ~ generator_print_verbose_1[749a]::make_non_send_generator2::{opaque#0}), [])` - --> $DIR/generator-print-verbose-1.rs:47:34 - | -LL | fn make_non_send_generator2() -> impl Generator>> { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: required because it captures the following types: `Opaque(DefId(0:36 ~ generator_print_verbose_1[749a]::make_non_send_generator2::{opaque#0}), [])`, `()` -note: required because it's used within this generator - --> $DIR/generator-print-verbose-1.rs:52:20 - | -LL | let send_gen = || { - | ^^ -note: required by a bound in `require_send` - --> $DIR/generator-print-verbose-1.rs:26:25 - | -LL | fn require_send(_: impl Send) {} - | ^^^^ required by this bound in `require_send` - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/thir-print/thir-tree-match.stdout b/tests/ui/thir-print/thir-tree-match.stdout index d6174ec262a44..a092b925c6555 100644 --- a/tests/ui/thir-print/thir-tree-match.stdout +++ b/tests/ui/thir-print/thir-tree-match.stdout @@ -1,13 +1,13 @@ DefId(0:16 ~ thir_tree_match[3c9a]::has_match): params: [ Param { - ty: Foo + ty: Adt(Foo, []) ty_span: Some($DIR/thir-tree-match.rs:15:19: 15:22 (#0)) self_kind: None hir_id: Some(HirId(DefId(0:16 ~ thir_tree_match[3c9a]::has_match).1)) param: Some( Pat: { - ty: Foo + ty: Adt(Foo, []) span: $DIR/thir-tree-match.rs:15:14: 15:17 (#0) kind: PatKind { Binding { @@ -15,7 +15,7 @@ params: [ name: "foo" mode: ByValue var: LocalVarId(HirId(DefId(0:16 ~ thir_tree_match[3c9a]::has_match).2)) - ty: Foo + ty: Adt(Foo, []) is_primary: true subpattern: None } @@ -26,7 +26,7 @@ params: [ ] body: Expr { - ty: bool + ty: Bool temp_lifetime: Some(Node(26)) span: $DIR/thir-tree-match.rs:15:32: 21:2 (#0) kind: @@ -35,7 +35,7 @@ body: lint_level: Inherited value: Expr { - ty: bool + ty: Bool temp_lifetime: Some(Node(26)) span: $DIR/thir-tree-match.rs:15:32: 21:2 (#0) kind: @@ -44,7 +44,7 @@ body: lint_level: Explicit(HirId(DefId(0:16 ~ thir_tree_match[3c9a]::has_match).26)) value: Expr { - ty: bool + ty: Bool temp_lifetime: Some(Node(26)) span: $DIR/thir-tree-match.rs:15:32: 21:2 (#0) kind: @@ -57,7 +57,7 @@ body: stmts: [] expr: Expr { - ty: bool + ty: Bool temp_lifetime: Some(Node(26)) span: $DIR/thir-tree-match.rs:16:5: 20:6 (#0) kind: @@ -66,14 +66,14 @@ body: lint_level: Explicit(HirId(DefId(0:16 ~ thir_tree_match[3c9a]::has_match).3)) value: Expr { - ty: bool + ty: Bool temp_lifetime: Some(Node(26)) span: $DIR/thir-tree-match.rs:16:5: 20:6 (#0) kind: Match { scrutinee: Expr { - ty: Foo + ty: Adt(Foo, []) temp_lifetime: Some(Node(26)) span: $DIR/thir-tree-match.rs:16:11: 16:14 (#0) kind: @@ -82,7 +82,7 @@ body: lint_level: Explicit(HirId(DefId(0:16 ~ thir_tree_match[3c9a]::has_match).4)) value: Expr { - ty: Foo + ty: Adt(Foo, []) temp_lifetime: Some(Node(26)) span: $DIR/thir-tree-match.rs:16:11: 16:14 (#0) kind: @@ -96,7 +96,7 @@ body: Arm { pattern: Pat: { - ty: Foo + ty: Adt(Foo, []) span: $DIR/thir-tree-match.rs:17:9: 17:32 (#0) kind: PatKind { Variant { @@ -110,7 +110,7 @@ body: variant_index: 0 subpatterns: [ Pat: { - ty: Bar + ty: Adt(Bar, []) span: $DIR/thir-tree-match.rs:17:21: 17:31 (#0) kind: PatKind { Variant { @@ -133,7 +133,7 @@ body: guard: None body: Expr { - ty: bool + ty: Bool temp_lifetime: Some(Node(13)) span: $DIR/thir-tree-match.rs:17:36: 17:40 (#0) kind: @@ -142,7 +142,7 @@ body: lint_level: Inherited value: Expr { - ty: bool + ty: Bool temp_lifetime: Some(Node(13)) span: $DIR/thir-tree-match.rs:17:36: 17:40 (#0) kind: @@ -151,7 +151,7 @@ body: lint_level: Explicit(HirId(DefId(0:16 ~ thir_tree_match[3c9a]::has_match).13)) value: Expr { - ty: bool + ty: Bool temp_lifetime: Some(Node(13)) span: $DIR/thir-tree-match.rs:17:36: 17:40 (#0) kind: @@ -169,7 +169,7 @@ body: Arm { pattern: Pat: { - ty: Foo + ty: Adt(Foo, []) span: $DIR/thir-tree-match.rs:18:9: 18:23 (#0) kind: PatKind { Variant { @@ -183,7 +183,7 @@ body: variant_index: 0 subpatterns: [ Pat: { - ty: Bar + ty: Adt(Bar, []) span: $DIR/thir-tree-match.rs:18:21: 18:22 (#0) kind: PatKind { Wild @@ -196,7 +196,7 @@ body: guard: None body: Expr { - ty: bool + ty: Bool temp_lifetime: Some(Node(19)) span: $DIR/thir-tree-match.rs:18:27: 18:32 (#0) kind: @@ -205,7 +205,7 @@ body: lint_level: Inherited value: Expr { - ty: bool + ty: Bool temp_lifetime: Some(Node(19)) span: $DIR/thir-tree-match.rs:18:27: 18:32 (#0) kind: @@ -214,7 +214,7 @@ body: lint_level: Explicit(HirId(DefId(0:16 ~ thir_tree_match[3c9a]::has_match).19)) value: Expr { - ty: bool + ty: Bool temp_lifetime: Some(Node(19)) span: $DIR/thir-tree-match.rs:18:27: 18:32 (#0) kind: @@ -232,7 +232,7 @@ body: Arm { pattern: Pat: { - ty: Foo + ty: Adt(Foo, []) span: $DIR/thir-tree-match.rs:19:9: 19:20 (#0) kind: PatKind { Variant { @@ -251,7 +251,7 @@ body: guard: None body: Expr { - ty: bool + ty: Bool temp_lifetime: Some(Node(24)) span: $DIR/thir-tree-match.rs:19:24: 19:28 (#0) kind: @@ -260,7 +260,7 @@ body: lint_level: Inherited value: Expr { - ty: bool + ty: Bool temp_lifetime: Some(Node(24)) span: $DIR/thir-tree-match.rs:19:24: 19:28 (#0) kind: @@ -269,7 +269,7 @@ body: lint_level: Explicit(HirId(DefId(0:16 ~ thir_tree_match[3c9a]::has_match).24)) value: Expr { - ty: bool + ty: Bool temp_lifetime: Some(Node(24)) span: $DIR/thir-tree-match.rs:19:24: 19:28 (#0) kind: @@ -302,7 +302,7 @@ params: [ ] body: Expr { - ty: () + ty: Tuple([]) temp_lifetime: Some(Node(2)) span: $DIR/thir-tree-match.rs:23:11: 23:13 (#0) kind: @@ -311,7 +311,7 @@ body: lint_level: Inherited value: Expr { - ty: () + ty: Tuple([]) temp_lifetime: Some(Node(2)) span: $DIR/thir-tree-match.rs:23:11: 23:13 (#0) kind: @@ -320,7 +320,7 @@ body: lint_level: Explicit(HirId(DefId(0:17 ~ thir_tree_match[3c9a]::main).2)) value: Expr { - ty: () + ty: Tuple([]) temp_lifetime: Some(Node(2)) span: $DIR/thir-tree-match.rs:23:11: 23:13 (#0) kind: diff --git a/tests/ui/thir-print/thir-tree.stdout b/tests/ui/thir-print/thir-tree.stdout index 0a35d9fb78ca2..817edc303a663 100644 --- a/tests/ui/thir-print/thir-tree.stdout +++ b/tests/ui/thir-print/thir-tree.stdout @@ -3,7 +3,7 @@ params: [ ] body: Expr { - ty: () + ty: Tuple([]) temp_lifetime: Some(Node(2)) span: $DIR/thir-tree.rs:4:15: 4:17 (#0) kind: @@ -12,7 +12,7 @@ body: lint_level: Inherited value: Expr { - ty: () + ty: Tuple([]) temp_lifetime: Some(Node(2)) span: $DIR/thir-tree.rs:4:15: 4:17 (#0) kind: @@ -21,7 +21,7 @@ body: lint_level: Explicit(HirId(DefId(0:3 ~ thir_tree[8f1d]::main).2)) value: Expr { - ty: () + ty: Tuple([]) temp_lifetime: Some(Node(2)) span: $DIR/thir-tree.rs:4:15: 4:17 (#0) kind: