diff options
Diffstat (limited to 'tests')
187 files changed, 1434 insertions, 739 deletions
diff --git a/tests/codegen/branch-protection-old-llvm.rs b/tests/codegen/branch-protection-old-llvm.rs new file mode 100644 index 00000000000..bb3c7a4b70c --- /dev/null +++ b/tests/codegen/branch-protection-old-llvm.rs @@ -0,0 +1,45 @@ +// Test that the correct module flags are emitted with different branch protection flags. + +//@ revisions: BTI PACRET LEAF BKEY NONE +//@ needs-llvm-components: aarch64 +//@ [BTI] compile-flags: -Z branch-protection=bti +//@ [PACRET] compile-flags: -Z branch-protection=pac-ret +//@ [LEAF] compile-flags: -Z branch-protection=pac-ret,leaf +//@ [BKEY] compile-flags: -Z branch-protection=pac-ret,b-key +//@ compile-flags: --target aarch64-unknown-linux-gnu +//@ ignore-llvm-version: 19 - 99 + +#![crate_type = "lib"] +#![feature(no_core, lang_items)] +#![no_core] + +#[lang = "sized"] +trait Sized {} + +// A basic test function. +pub fn test() {} + +// BTI: !"branch-target-enforcement", i32 1 +// BTI: !"sign-return-address", i32 0 +// BTI: !"sign-return-address-all", i32 0 +// BTI: !"sign-return-address-with-bkey", i32 0 + +// PACRET: !"branch-target-enforcement", i32 0 +// PACRET: !"sign-return-address", i32 1 +// PACRET: !"sign-return-address-all", i32 0 +// PACRET: !"sign-return-address-with-bkey", i32 0 + +// LEAF: !"branch-target-enforcement", i32 0 +// LEAF: !"sign-return-address", i32 1 +// LEAF: !"sign-return-address-all", i32 1 +// LEAF: !"sign-return-address-with-bkey", i32 0 + +// BKEY: !"branch-target-enforcement", i32 0 +// BKEY: !"sign-return-address", i32 1 +// BKEY: !"sign-return-address-all", i32 0 +// BKEY: !"sign-return-address-with-bkey", i32 1 + +// NONE-NOT: branch-target-enforcement +// NONE-NOT: sign-return-address +// NONE-NOT: sign-return-address-all +// NONE-NOT: sign-return-address-with-bkey diff --git a/tests/codegen/branch-protection.rs b/tests/codegen/branch-protection.rs index a29ec67d578..2f5ff9e98c2 100644 --- a/tests/codegen/branch-protection.rs +++ b/tests/codegen/branch-protection.rs @@ -7,6 +7,7 @@ //@ [LEAF] compile-flags: -Z branch-protection=pac-ret,leaf //@ [BKEY] compile-flags: -Z branch-protection=pac-ret,b-key //@ compile-flags: --target aarch64-unknown-linux-gnu +//@ min-llvm-version: 19 #![crate_type = "lib"] #![feature(no_core, lang_items)] @@ -16,23 +17,32 @@ trait Sized {} // A basic test function. +// CHECK: @test(){{.*}} [[ATTR:#[0-9]+]] { +#[no_mangle] pub fn test() {} +// BTI: attributes [[ATTR]] = {{.*}} "branch-target-enforcement" // BTI: !"branch-target-enforcement", i32 1 // BTI: !"sign-return-address", i32 0 // BTI: !"sign-return-address-all", i32 0 // BTI: !"sign-return-address-with-bkey", i32 0 +// PACRET: attributes [[ATTR]] = {{.*}} "sign-return-address"="non-leaf" +// PACRET-SAME: "sign-return-address-key"="a_key" // PACRET: !"branch-target-enforcement", i32 0 // PACRET: !"sign-return-address", i32 1 // PACRET: !"sign-return-address-all", i32 0 // PACRET: !"sign-return-address-with-bkey", i32 0 +// LEAF: attributes [[ATTR]] = {{.*}} "sign-return-address"="all" +// LEAF-SAME: "sign-return-address-key"="a_key" // LEAF: !"branch-target-enforcement", i32 0 // LEAF: !"sign-return-address", i32 1 // LEAF: !"sign-return-address-all", i32 1 // LEAF: !"sign-return-address-with-bkey", i32 0 +// BKEY: attributes [[ATTR]] = {{.*}} "sign-return-address"="non-leaf" +// BKEY-SAME: "sign-return-address-key"="b_key" // BKEY: !"branch-target-enforcement", i32 0 // BKEY: !"sign-return-address", i32 1 // BKEY: !"sign-return-address-all", i32 0 diff --git a/tests/codegen/intrinsics/select_unpredictable.rs b/tests/codegen/intrinsics/select_unpredictable.rs new file mode 100644 index 00000000000..2054838dd79 --- /dev/null +++ b/tests/codegen/intrinsics/select_unpredictable.rs @@ -0,0 +1,35 @@ +//@ compile-flags: -O + +#![feature(core_intrinsics)] +#![crate_type = "lib"] + +#[no_mangle] +pub fn test_int(p: bool, a: u64, b: u64) -> u64 { + // CHECK-LABEL: define{{.*}} @test_int + // CHECK: select i1 %p, i64 %a, i64 %b, !unpredictable + core::intrinsics::select_unpredictable(p, a, b) +} + +#[no_mangle] +pub fn test_pair(p: bool, a: (u64, u64), b: (u64, u64)) -> (u64, u64) { + // CHECK-LABEL: define{{.*}} @test_pair + // CHECK: select i1 %p, {{.*}}, !unpredictable + core::intrinsics::select_unpredictable(p, a, b) +} + +struct Large { + e: [u64; 100], +} + +#[no_mangle] +pub fn test_struct(p: bool, a: Large, b: Large) -> Large { + // CHECK-LABEL: define{{.*}} @test_struct + // CHECK: select i1 %p, {{.*}}, !unpredictable + core::intrinsics::select_unpredictable(p, a, b) +} + +#[no_mangle] +pub fn test_zst(p: bool, a: (), b: ()) -> () { + // CHECK-LABEL: define{{.*}} @test_zst + core::intrinsics::select_unpredictable(p, a, b) +} diff --git a/tests/crashes/121613-2.rs b/tests/crashes/121613-2.rs deleted file mode 100644 index ddc4f37c96a..00000000000 --- a/tests/crashes/121613-2.rs +++ /dev/null @@ -1,28 +0,0 @@ -//@ known-bug: #121613 -fn main() { - // destructure through a qualified path - let <Foo as A>::Assoc { br } = StructStruct { br: 2 }; - //~^ ERROR usage of qualified paths in this context is experimental - let _ = <Foo as A>::Assoc { br: 2 }; - //~^ ERROR usage of qualified paths in this context is experimental - let <E>::V(..) = E::V(|a, b| a.cmp(b)); - //~^ ERROR usage of qualified paths in this context is experimental -} - -struct StructStruct { - br: i8, -} - -struct Foo; - -trait A { - type Assoc; -} - -impl A for Foo { - type Assoc = StructStruct; -} - -enum E { - V(u8) -} diff --git a/tests/crashes/121613.rs b/tests/crashes/121613.rs deleted file mode 100644 index ec9ba82a68c..00000000000 --- a/tests/crashes/121613.rs +++ /dev/null @@ -1,24 +0,0 @@ -//@ known-bug: #121613 -fn main() { - let _ = <Foo as A>::Assoc { br: 2 }; - - let <E>::V(..) = E::V(|a, b| a.cmp(b)); -} - -struct StructStruct { - br: i8, -} - -struct Foo; - -trait A { - type Assoc; -} - -impl A for Foo { - type Assoc = StructStruct; -} - -enum E { - V(u8), -} diff --git a/tests/crashes/122914.rs b/tests/crashes/122914.rs deleted file mode 100644 index 63a84bc8099..00000000000 --- a/tests/crashes/122914.rs +++ /dev/null @@ -1,11 +0,0 @@ -//@ known-bug: #122914 -use std::future::Future; -use std::pin::Pin; - -impl<'a, F> Poll { - fn project<'_>(self: Pin<&'pin mut Future>) -> Projection<'pin, 'a, F> { - me.local_set.with(|| { - let _ = self.poll(cx); - }) - } -} diff --git a/tests/crashes/127222.rs b/tests/crashes/127222.rs deleted file mode 100644 index eda0ea3d9b7..00000000000 --- a/tests/crashes/127222.rs +++ /dev/null @@ -1,3 +0,0 @@ -//@ known-bug: rust-lang/rust#127222 -#[marker] -trait Foo = PartialEq<i32> + Send; diff --git a/tests/incremental/hashes/call_expressions.rs b/tests/incremental/hashes/call_expressions.rs index 36b6980bcc6..71423ef6aff 100644 --- a/tests/incremental/hashes/call_expressions.rs +++ b/tests/incremental/hashes/call_expressions.rs @@ -162,7 +162,7 @@ pub fn change_to_ufcs() { } #[cfg(not(any(cfail1,cfail4)))] -#[rustc_clean(cfg="cfail2", except="opt_hir_owner_nodes,typeck")] +#[rustc_clean(cfg="cfail2", except="opt_hir_owner_nodes,optimized_mir,typeck")] #[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail5", except="opt_hir_owner_nodes,optimized_mir,typeck")] #[rustc_clean(cfg="cfail6")] diff --git a/tests/mir-opt/const_prop/offset_of.rs b/tests/mir-opt/const_prop/offset_of.rs index 264c8a3d21c..c2f5e83d686 100644 --- a/tests/mir-opt/const_prop/offset_of.rs +++ b/tests/mir-opt/const_prop/offset_of.rs @@ -2,7 +2,7 @@ //@ test-mir-pass: GVN // EMIT_MIR_FOR_EACH_PANIC_STRATEGY -#![feature(offset_of_enum, offset_of_nested)] +#![feature(offset_of_enum)] use std::marker::PhantomData; use std::mem::offset_of; diff --git a/tests/mir-opt/const_prop/slice_len.rs b/tests/mir-opt/const_prop/slice_len.rs index 265a496f39a..221fb18f92c 100644 --- a/tests/mir-opt/const_prop/slice_len.rs +++ b/tests/mir-opt/const_prop/slice_len.rs @@ -1,5 +1,5 @@ //@ test-mir-pass: GVN -//@ compile-flags: -Zmir-enable-passes=+InstSimplify -Zdump-mir-exclude-alloc-bytes +//@ compile-flags: -Zmir-enable-passes=+InstSimplify-after-simplifycfg -Zdump-mir-exclude-alloc-bytes // EMIT_MIR_FOR_EACH_PANIC_STRATEGY // EMIT_MIR_FOR_EACH_BIT_WIDTH diff --git a/tests/mir-opt/dataflow-const-prop/offset_of.rs b/tests/mir-opt/dataflow-const-prop/offset_of.rs index 12396b31ed0..bb4a74d3712 100644 --- a/tests/mir-opt/dataflow-const-prop/offset_of.rs +++ b/tests/mir-opt/dataflow-const-prop/offset_of.rs @@ -1,8 +1,6 @@ //@ test-mir-pass: DataflowConstProp // EMIT_MIR_FOR_EACH_PANIC_STRATEGY -#![feature(offset_of_nested)] - use std::marker::PhantomData; use std::mem::offset_of; diff --git a/tests/mir-opt/dataflow-const-prop/slice_len.rs b/tests/mir-opt/dataflow-const-prop/slice_len.rs index 5d9733f498c..64c043cca79 100644 --- a/tests/mir-opt/dataflow-const-prop/slice_len.rs +++ b/tests/mir-opt/dataflow-const-prop/slice_len.rs @@ -1,6 +1,6 @@ // EMIT_MIR_FOR_EACH_PANIC_STRATEGY //@ test-mir-pass: DataflowConstProp -//@ compile-flags: -Zmir-enable-passes=+InstSimplify +//@ compile-flags: -Zmir-enable-passes=+InstSimplify-after-simplifycfg // EMIT_MIR_FOR_EACH_BIT_WIDTH // EMIT_MIR slice_len.main.DataflowConstProp.diff diff --git a/tests/mir-opt/inline/dyn_trait.get_query.Inline.panic-abort.diff b/tests/mir-opt/inline/dyn_trait.get_query.Inline.panic-abort.diff index 9d5042caae2..4e495c37fbc 100644 --- a/tests/mir-opt/inline/dyn_trait.get_query.Inline.panic-abort.diff +++ b/tests/mir-opt/inline/dyn_trait.get_query.Inline.panic-abort.diff @@ -21,14 +21,14 @@ bb0: { StorageLive(_2); StorageLive(_3); - _3 = &(*_1); + _3 = _1; _2 = <Q as Query>::cache::<T>(move _3) -> [return: bb1, unwind unreachable]; } bb1: { StorageDead(_3); StorageLive(_4); - _4 = &(*_2); + _4 = _2; - _0 = try_execute_query::<<Q as Query>::C>(move _4) -> [return: bb2, unwind unreachable]; + StorageLive(_5); + _5 = _4 as &dyn Cache<V = <Q as Query>::V> (PointerCoercion(Unsize)); diff --git a/tests/mir-opt/inline/dyn_trait.get_query.Inline.panic-unwind.diff b/tests/mir-opt/inline/dyn_trait.get_query.Inline.panic-unwind.diff index 9bd3855c58f..7fdb7618212 100644 --- a/tests/mir-opt/inline/dyn_trait.get_query.Inline.panic-unwind.diff +++ b/tests/mir-opt/inline/dyn_trait.get_query.Inline.panic-unwind.diff @@ -21,14 +21,14 @@ bb0: { StorageLive(_2); StorageLive(_3); - _3 = &(*_1); + _3 = _1; _2 = <Q as Query>::cache::<T>(move _3) -> [return: bb1, unwind continue]; } bb1: { StorageDead(_3); StorageLive(_4); - _4 = &(*_2); + _4 = _2; - _0 = try_execute_query::<<Q as Query>::C>(move _4) -> [return: bb2, unwind continue]; + StorageLive(_5); + _5 = _4 as &dyn Cache<V = <Q as Query>::V> (PointerCoercion(Unsize)); diff --git a/tests/mir-opt/inline/dyn_trait.mk_cycle.Inline.panic-abort.diff b/tests/mir-opt/inline/dyn_trait.mk_cycle.Inline.panic-abort.diff index d7801b7a0cc..8df4408690b 100644 --- a/tests/mir-opt/inline/dyn_trait.mk_cycle.Inline.panic-abort.diff +++ b/tests/mir-opt/inline/dyn_trait.mk_cycle.Inline.panic-abort.diff @@ -8,7 +8,7 @@ bb0: { StorageLive(_2); - _2 = &(*_1); + _2 = _1; _0 = <dyn Cache<V = V> as Cache>::store_nocache(move _2) -> [return: bb1, unwind unreachable]; } diff --git a/tests/mir-opt/inline/dyn_trait.mk_cycle.Inline.panic-unwind.diff b/tests/mir-opt/inline/dyn_trait.mk_cycle.Inline.panic-unwind.diff index 7b1cf895a87..43a0621f766 100644 --- a/tests/mir-opt/inline/dyn_trait.mk_cycle.Inline.panic-unwind.diff +++ b/tests/mir-opt/inline/dyn_trait.mk_cycle.Inline.panic-unwind.diff @@ -8,7 +8,7 @@ bb0: { StorageLive(_2); - _2 = &(*_1); + _2 = _1; _0 = <dyn Cache<V = V> as Cache>::store_nocache(move _2) -> [return: bb1, unwind continue]; } diff --git a/tests/mir-opt/inline/dyn_trait.try_execute_query.Inline.panic-abort.diff b/tests/mir-opt/inline/dyn_trait.try_execute_query.Inline.panic-abort.diff index 96e16d023ba..e72c312f549 100644 --- a/tests/mir-opt/inline/dyn_trait.try_execute_query.Inline.panic-abort.diff +++ b/tests/mir-opt/inline/dyn_trait.try_execute_query.Inline.panic-abort.diff @@ -13,7 +13,7 @@ bb0: { StorageLive(_2); StorageLive(_3); - _3 = &(*_1); + _3 = _1; _2 = move _3 as &dyn Cache<V = <C as Cache>::V> (PointerCoercion(Unsize)); StorageDead(_3); - _0 = mk_cycle::<<C as Cache>::V>(move _2) -> [return: bb1, unwind unreachable]; diff --git a/tests/mir-opt/inline/dyn_trait.try_execute_query.Inline.panic-unwind.diff b/tests/mir-opt/inline/dyn_trait.try_execute_query.Inline.panic-unwind.diff index 06d65abcbc1..46728f9e2e6 100644 --- a/tests/mir-opt/inline/dyn_trait.try_execute_query.Inline.panic-unwind.diff +++ b/tests/mir-opt/inline/dyn_trait.try_execute_query.Inline.panic-unwind.diff @@ -13,7 +13,7 @@ bb0: { StorageLive(_2); StorageLive(_3); - _3 = &(*_1); + _3 = _1; _2 = move _3 as &dyn Cache<V = <C as Cache>::V> (PointerCoercion(Unsize)); StorageDead(_3); - _0 = mk_cycle::<<C as Cache>::V>(move _2) -> [return: bb1, unwind continue]; diff --git a/tests/mir-opt/inline/inline_closure_borrows_arg.foo.Inline.after.mir b/tests/mir-opt/inline/inline_closure_borrows_arg.foo.Inline.after.mir index a6198ca053b..f524b054b61 100644 --- a/tests/mir-opt/inline/inline_closure_borrows_arg.foo.Inline.after.mir +++ b/tests/mir-opt/inline/inline_closure_borrows_arg.foo.Inline.after.mir @@ -26,9 +26,9 @@ fn foo(_1: T, _2: &i32) -> i32 { _4 = &_3; StorageLive(_5); StorageLive(_6); - _6 = &(*_2); + _6 = _2; StorageLive(_7); - _7 = &(*_2); + _7 = _2; _5 = (move _6, move _7); StorageLive(_8); _8 = move (_5.0: &i32); diff --git a/tests/mir-opt/inline/inline_retag.bar.Inline.after.mir b/tests/mir-opt/inline/inline_retag.bar.Inline.after.mir index dcce4aad444..ec3c79e2a37 100644 --- a/tests/mir-opt/inline/inline_retag.bar.Inline.after.mir +++ b/tests/mir-opt/inline/inline_retag.bar.Inline.after.mir @@ -31,14 +31,14 @@ fn bar() -> bool { StorageLive(_4); _10 = const bar::promoted[1]; Retag(_10); - _4 = &(*_10); - _3 = &(*_4); + _4 = _10; + _3 = _4; StorageLive(_6); StorageLive(_7); _9 = const bar::promoted[0]; Retag(_9); - _7 = &(*_9); - _6 = &(*_7); + _7 = _9; + _6 = _7; Retag(_3); Retag(_6); StorageLive(_11); diff --git a/tests/mir-opt/inline/inline_trait_method.test.Inline.after.panic-abort.mir b/tests/mir-opt/inline/inline_trait_method.test.Inline.after.panic-abort.mir index 2441e3f1c2c..d7b4302b06d 100644 --- a/tests/mir-opt/inline/inline_trait_method.test.Inline.after.panic-abort.mir +++ b/tests/mir-opt/inline/inline_trait_method.test.Inline.after.panic-abort.mir @@ -7,7 +7,7 @@ fn test(_1: &dyn X) -> u32 { bb0: { StorageLive(_2); - _2 = &(*_1); + _2 = _1; _0 = <dyn X as X>::y(move _2) -> [return: bb1, unwind unreachable]; } diff --git a/tests/mir-opt/inline/inline_trait_method.test.Inline.after.panic-unwind.mir b/tests/mir-opt/inline/inline_trait_method.test.Inline.after.panic-unwind.mir index da18a5adc37..0d6f3e61f71 100644 --- a/tests/mir-opt/inline/inline_trait_method.test.Inline.after.panic-unwind.mir +++ b/tests/mir-opt/inline/inline_trait_method.test.Inline.after.panic-unwind.mir @@ -7,7 +7,7 @@ fn test(_1: &dyn X) -> u32 { bb0: { StorageLive(_2); - _2 = &(*_1); + _2 = _1; _0 = <dyn X as X>::y(move _2) -> [return: bb1, unwind continue]; } diff --git a/tests/mir-opt/inline/inline_trait_method_2.test2.Inline.after.panic-abort.mir b/tests/mir-opt/inline/inline_trait_method_2.test2.Inline.after.panic-abort.mir index f0d1cfe0359..af79c7ce196 100644 --- a/tests/mir-opt/inline/inline_trait_method_2.test2.Inline.after.panic-abort.mir +++ b/tests/mir-opt/inline/inline_trait_method_2.test2.Inline.after.panic-abort.mir @@ -12,8 +12,8 @@ fn test2(_1: &dyn X) -> bool { bb0: { StorageLive(_2); StorageLive(_3); - _3 = &(*_1); - _2 = move _3 as &dyn X (PointerCoercion(Unsize)); + _3 = _1; + _2 = move _3; StorageDead(_3); _0 = <dyn X as X>::y(move _2) -> [return: bb1, unwind unreachable]; } diff --git a/tests/mir-opt/inline/inline_trait_method_2.test2.Inline.after.panic-unwind.mir b/tests/mir-opt/inline/inline_trait_method_2.test2.Inline.after.panic-unwind.mir index f37b0814301..bf5a56b8e62 100644 --- a/tests/mir-opt/inline/inline_trait_method_2.test2.Inline.after.panic-unwind.mir +++ b/tests/mir-opt/inline/inline_trait_method_2.test2.Inline.after.panic-unwind.mir @@ -12,8 +12,8 @@ fn test2(_1: &dyn X) -> bool { bb0: { StorageLive(_2); StorageLive(_3); - _3 = &(*_1); - _2 = move _3 as &dyn X (PointerCoercion(Unsize)); + _3 = _1; + _2 = move _3; StorageDead(_3); _0 = <dyn X as X>::y(move _2) -> [return: bb1, unwind continue]; } diff --git a/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.a.Inline.after.mir b/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.a.Inline.after.mir index 7cc65efe07b..8c457037ec9 100644 --- a/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.a.Inline.after.mir +++ b/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.a.Inline.after.mir @@ -14,11 +14,11 @@ fn a(_1: &mut [T]) -> &mut [T] { StorageLive(_2); StorageLive(_3); StorageLive(_4); - _4 = &mut (*_1); + _4 = _1; _3 = _4; - _2 = &mut (*_3); + _2 = _3; StorageDead(_4); - _0 = &mut (*_2); + _0 = _2; StorageDead(_3); StorageDead(_2); return; diff --git a/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.b.Inline.after.mir b/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.b.Inline.after.mir index 408cc5bb341..e27d9fe38c7 100644 --- a/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.b.Inline.after.mir +++ b/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.b.Inline.after.mir @@ -16,7 +16,7 @@ fn b(_1: &mut Box<T>) -> &mut T { StorageLive(_2); StorageLive(_3); StorageLive(_4); - _4 = &mut (*_1); + _4 = _1; StorageLive(_5); StorageLive(_6); _5 = (*_4); @@ -24,9 +24,9 @@ fn b(_1: &mut Box<T>) -> &mut T { _3 = &mut (*_6); StorageDead(_6); StorageDead(_5); - _2 = &mut (*_3); + _2 = _3; StorageDead(_4); - _0 = &mut (*_2); + _0 = _2; StorageDead(_3); StorageDead(_2); return; diff --git a/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.c.Inline.after.mir b/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.c.Inline.after.mir index bad7f31ae9b..da0464c64d6 100644 --- a/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.c.Inline.after.mir +++ b/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.c.Inline.after.mir @@ -12,9 +12,9 @@ fn c(_1: &[T]) -> &[T] { bb0: { StorageLive(_2); StorageLive(_3); - _3 = &(*_1); + _3 = _1; _2 = _3; - _0 = &(*_2); + _0 = _2; StorageDead(_3); StorageDead(_2); return; diff --git a/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.d.Inline.after.mir b/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.d.Inline.after.mir index 4d20f6c4419..25eaedfc842 100644 --- a/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.d.Inline.after.mir +++ b/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.d.Inline.after.mir @@ -14,7 +14,7 @@ fn d(_1: &Box<T>) -> &T { bb0: { StorageLive(_2); StorageLive(_3); - _3 = &(*_1); + _3 = _1; StorageLive(_4); StorageLive(_5); _4 = (*_3); @@ -22,7 +22,7 @@ fn d(_1: &Box<T>) -> &T { _2 = &(*_5); StorageDead(_5); StorageDead(_4); - _0 = &(*_2); + _0 = _2; StorageDead(_3); StorageDead(_2); return; diff --git a/tests/mir-opt/instsimplify/bool_compare.eq_false.InstSimplify.diff b/tests/mir-opt/instsimplify/bool_compare.eq_false.InstSimplify-after-simplifycfg.diff index 5c09963d433..fea5f4f02ce 100644 --- a/tests/mir-opt/instsimplify/bool_compare.eq_false.InstSimplify.diff +++ b/tests/mir-opt/instsimplify/bool_compare.eq_false.InstSimplify-after-simplifycfg.diff @@ -1,5 +1,5 @@ -- // MIR for `eq_false` before InstSimplify -+ // MIR for `eq_false` after InstSimplify +- // MIR for `eq_false` before InstSimplify-after-simplifycfg ++ // MIR for `eq_false` after InstSimplify-after-simplifycfg fn eq_false(_1: bool) -> u32 { debug x => _1; diff --git a/tests/mir-opt/instsimplify/bool_compare.eq_true.InstSimplify.diff b/tests/mir-opt/instsimplify/bool_compare.eq_true.InstSimplify-after-simplifycfg.diff index a80133b0eb0..9a509ccfa67 100644 --- a/tests/mir-opt/instsimplify/bool_compare.eq_true.InstSimplify.diff +++ b/tests/mir-opt/instsimplify/bool_compare.eq_true.InstSimplify-after-simplifycfg.diff @@ -1,5 +1,5 @@ -- // MIR for `eq_true` before InstSimplify -+ // MIR for `eq_true` after InstSimplify +- // MIR for `eq_true` before InstSimplify-after-simplifycfg ++ // MIR for `eq_true` after InstSimplify-after-simplifycfg fn eq_true(_1: bool) -> u32 { debug x => _1; diff --git a/tests/mir-opt/instsimplify/bool_compare.false_eq.InstSimplify.diff b/tests/mir-opt/instsimplify/bool_compare.false_eq.InstSimplify-after-simplifycfg.diff index 8235d5263bb..e4ec4c80579 100644 --- a/tests/mir-opt/instsimplify/bool_compare.false_eq.InstSimplify.diff +++ b/tests/mir-opt/instsimplify/bool_compare.false_eq.InstSimplify-after-simplifycfg.diff @@ -1,5 +1,5 @@ -- // MIR for `false_eq` before InstSimplify -+ // MIR for `false_eq` after InstSimplify +- // MIR for `false_eq` before InstSimplify-after-simplifycfg ++ // MIR for `false_eq` after InstSimplify-after-simplifycfg fn false_eq(_1: bool) -> u32 { debug x => _1; diff --git a/tests/mir-opt/instsimplify/bool_compare.false_ne.InstSimplify.diff b/tests/mir-opt/instsimplify/bool_compare.false_ne.InstSimplify-after-simplifycfg.diff index 77d076c6c14..3aea55f4db4 100644 --- a/tests/mir-opt/instsimplify/bool_compare.false_ne.InstSimplify.diff +++ b/tests/mir-opt/instsimplify/bool_compare.false_ne.InstSimplify-after-simplifycfg.diff @@ -1,5 +1,5 @@ -- // MIR for `false_ne` before InstSimplify -+ // MIR for `false_ne` after InstSimplify +- // MIR for `false_ne` before InstSimplify-after-simplifycfg ++ // MIR for `false_ne` after InstSimplify-after-simplifycfg fn false_ne(_1: bool) -> u32 { debug x => _1; diff --git a/tests/mir-opt/instsimplify/bool_compare.ne_false.InstSimplify.diff b/tests/mir-opt/instsimplify/bool_compare.ne_false.InstSimplify-after-simplifycfg.diff index 2362b11297e..b6e891088a1 100644 --- a/tests/mir-opt/instsimplify/bool_compare.ne_false.InstSimplify.diff +++ b/tests/mir-opt/instsimplify/bool_compare.ne_false.InstSimplify-after-simplifycfg.diff @@ -1,5 +1,5 @@ -- // MIR for `ne_false` before InstSimplify -+ // MIR for `ne_false` after InstSimplify +- // MIR for `ne_false` before InstSimplify-after-simplifycfg ++ // MIR for `ne_false` after InstSimplify-after-simplifycfg fn ne_false(_1: bool) -> u32 { debug x => _1; diff --git a/tests/mir-opt/instsimplify/bool_compare.ne_true.InstSimplify.diff b/tests/mir-opt/instsimplify/bool_compare.ne_true.InstSimplify-after-simplifycfg.diff index 6ccbd2fb7a1..974738bb3a9 100644 --- a/tests/mir-opt/instsimplify/bool_compare.ne_true.InstSimplify.diff +++ b/tests/mir-opt/instsimplify/bool_compare.ne_true.InstSimplify-after-simplifycfg.diff @@ -1,5 +1,5 @@ -- // MIR for `ne_true` before InstSimplify -+ // MIR for `ne_true` after InstSimplify +- // MIR for `ne_true` before InstSimplify-after-simplifycfg ++ // MIR for `ne_true` after InstSimplify-after-simplifycfg fn ne_true(_1: bool) -> u32 { debug x => _1; diff --git a/tests/mir-opt/instsimplify/bool_compare.rs b/tests/mir-opt/instsimplify/bool_compare.rs index d1d903f9ef2..3911f81fe5c 100644 --- a/tests/mir-opt/instsimplify/bool_compare.rs +++ b/tests/mir-opt/instsimplify/bool_compare.rs @@ -1,55 +1,55 @@ -//@ test-mir-pass: InstSimplify +//@ test-mir-pass: InstSimplify-after-simplifycfg -// EMIT_MIR bool_compare.eq_true.InstSimplify.diff +// EMIT_MIR bool_compare.eq_true.InstSimplify-after-simplifycfg.diff fn eq_true(x: bool) -> u32 { // CHECK-LABEL: fn eq_true( // CHECK-NOT: Eq( if x == true { 0 } else { 1 } } -// EMIT_MIR bool_compare.true_eq.InstSimplify.diff +// EMIT_MIR bool_compare.true_eq.InstSimplify-after-simplifycfg.diff fn true_eq(x: bool) -> u32 { // CHECK-LABEL: fn true_eq( // CHECK-NOT: Eq( if true == x { 0 } else { 1 } } -// EMIT_MIR bool_compare.ne_true.InstSimplify.diff +// EMIT_MIR bool_compare.ne_true.InstSimplify-after-simplifycfg.diff fn ne_true(x: bool) -> u32 { // CHECK-LABEL: fn ne_true( // CHECK: Not( if x != true { 0 } else { 1 } } -// EMIT_MIR bool_compare.true_ne.InstSimplify.diff +// EMIT_MIR bool_compare.true_ne.InstSimplify-after-simplifycfg.diff fn true_ne(x: bool) -> u32 { // CHECK-LABEL: fn true_ne( // CHECK: Not( if true != x { 0 } else { 1 } } -// EMIT_MIR bool_compare.eq_false.InstSimplify.diff +// EMIT_MIR bool_compare.eq_false.InstSimplify-after-simplifycfg.diff fn eq_false(x: bool) -> u32 { // CHECK-LABEL: fn eq_false( // CHECK: Not( if x == false { 0 } else { 1 } } -// EMIT_MIR bool_compare.false_eq.InstSimplify.diff +// EMIT_MIR bool_compare.false_eq.InstSimplify-after-simplifycfg.diff fn false_eq(x: bool) -> u32 { // CHECK-LABEL: fn false_eq( // CHECK: Not( if false == x { 0 } else { 1 } } -// EMIT_MIR bool_compare.ne_false.InstSimplify.diff +// EMIT_MIR bool_compare.ne_false.InstSimplify-after-simplifycfg.diff fn ne_false(x: bool) -> u32 { // CHECK-LABEL: fn ne_false( // CHECK-NOT: Ne( if x != false { 0 } else { 1 } } -// EMIT_MIR bool_compare.false_ne.InstSimplify.diff +// EMIT_MIR bool_compare.false_ne.InstSimplify-after-simplifycfg.diff fn false_ne(x: bool) -> u32 { // CHECK-LABEL: fn false_ne( // CHECK-NOT: Ne( diff --git a/tests/mir-opt/instsimplify/bool_compare.true_eq.InstSimplify.diff b/tests/mir-opt/instsimplify/bool_compare.true_eq.InstSimplify-after-simplifycfg.diff index 18675329a2e..240835bf7f2 100644 --- a/tests/mir-opt/instsimplify/bool_compare.true_eq.InstSimplify.diff +++ b/tests/mir-opt/instsimplify/bool_compare.true_eq.InstSimplify-after-simplifycfg.diff @@ -1,5 +1,5 @@ -- // MIR for `true_eq` before InstSimplify -+ // MIR for `true_eq` after InstSimplify +- // MIR for `true_eq` before InstSimplify-after-simplifycfg ++ // MIR for `true_eq` after InstSimplify-after-simplifycfg fn true_eq(_1: bool) -> u32 { debug x => _1; diff --git a/tests/mir-opt/instsimplify/bool_compare.true_ne.InstSimplify.diff b/tests/mir-opt/instsimplify/bool_compare.true_ne.InstSimplify-after-simplifycfg.diff index dc91cf8a5c4..1e2b2c27f57 100644 --- a/tests/mir-opt/instsimplify/bool_compare.true_ne.InstSimplify.diff +++ b/tests/mir-opt/instsimplify/bool_compare.true_ne.InstSimplify-after-simplifycfg.diff @@ -1,5 +1,5 @@ -- // MIR for `true_ne` before InstSimplify -+ // MIR for `true_ne` after InstSimplify +- // MIR for `true_ne` before InstSimplify-after-simplifycfg ++ // MIR for `true_ne` after InstSimplify-after-simplifycfg fn true_ne(_1: bool) -> u32 { debug x => _1; diff --git a/tests/mir-opt/instsimplify/casts.redundant.InstSimplify.diff b/tests/mir-opt/instsimplify/casts.redundant.InstSimplify-after-simplifycfg.diff index e7451d55777..7001589d9e3 100644 --- a/tests/mir-opt/instsimplify/casts.redundant.InstSimplify.diff +++ b/tests/mir-opt/instsimplify/casts.redundant.InstSimplify-after-simplifycfg.diff @@ -1,5 +1,5 @@ -- // MIR for `redundant` before InstSimplify -+ // MIR for `redundant` after InstSimplify +- // MIR for `redundant` before InstSimplify-after-simplifycfg ++ // MIR for `redundant` after InstSimplify-after-simplifycfg fn redundant(_1: *const &u8) -> *const &u8 { debug x => _1; diff --git a/tests/mir-opt/instsimplify/casts.roundtrip.InstSimplify.diff b/tests/mir-opt/instsimplify/casts.roundtrip.InstSimplify-after-simplifycfg.diff index e87ac762dfe..e1045db9730 100644 --- a/tests/mir-opt/instsimplify/casts.roundtrip.InstSimplify.diff +++ b/tests/mir-opt/instsimplify/casts.roundtrip.InstSimplify-after-simplifycfg.diff @@ -1,5 +1,5 @@ -- // MIR for `roundtrip` before InstSimplify -+ // MIR for `roundtrip` after InstSimplify +- // MIR for `roundtrip` before InstSimplify-after-simplifycfg ++ // MIR for `roundtrip` after InstSimplify-after-simplifycfg fn roundtrip(_1: *const u8) -> *const u8 { debug x => _1; diff --git a/tests/mir-opt/instsimplify/casts.rs b/tests/mir-opt/instsimplify/casts.rs index 15ceea76713..24dbb67b42d 100644 --- a/tests/mir-opt/instsimplify/casts.rs +++ b/tests/mir-opt/instsimplify/casts.rs @@ -1,4 +1,4 @@ -//@ test-mir-pass: InstSimplify +//@ test-mir-pass: InstSimplify-after-simplifycfg //@ compile-flags: -Zinline-mir #![crate_type = "lib"] #![feature(core_intrinsics)] @@ -8,7 +8,7 @@ fn generic_cast<T, U>(x: *const T) -> *const U { x as *const U } -// EMIT_MIR casts.redundant.InstSimplify.diff +// EMIT_MIR casts.redundant.InstSimplify-after-simplifycfg.diff pub fn redundant<'a, 'b: 'a>(x: *const &'a u8) -> *const &'a u8 { // CHECK-LABEL: fn redundant( // CHECK: inlined generic_cast @@ -16,7 +16,7 @@ pub fn redundant<'a, 'b: 'a>(x: *const &'a u8) -> *const &'a u8 { generic_cast::<&'a u8, &'b u8>(x) as *const &'a u8 } -// EMIT_MIR casts.roundtrip.InstSimplify.diff +// EMIT_MIR casts.roundtrip.InstSimplify-after-simplifycfg.diff pub fn roundtrip(x: *const u8) -> *const u8 { // CHECK-LABEL: fn roundtrip( // CHECK: _4 = _1; @@ -25,7 +25,7 @@ pub fn roundtrip(x: *const u8) -> *const u8 { x as *mut u8 as *const u8 } -// EMIT_MIR casts.roundtrip.InstSimplify.diff +// EMIT_MIR casts.roundtrip.InstSimplify-after-simplifycfg.diff pub fn cast_thin_via_aggregate(x: *const u8) -> *const () { // CHECK-LABEL: fn cast_thin_via_aggregate( // CHECK: _2 = _1; diff --git a/tests/mir-opt/instsimplify/combine_array_len.norm2.InstSimplify.panic-abort.diff b/tests/mir-opt/instsimplify/combine_array_len.norm2.InstSimplify-after-simplifycfg.panic-abort.diff index 3e7d0ce51e2..a7de09ca386 100644 --- a/tests/mir-opt/instsimplify/combine_array_len.norm2.InstSimplify.panic-abort.diff +++ b/tests/mir-opt/instsimplify/combine_array_len.norm2.InstSimplify-after-simplifycfg.panic-abort.diff @@ -1,5 +1,5 @@ -- // MIR for `norm2` before InstSimplify -+ // MIR for `norm2` after InstSimplify +- // MIR for `norm2` before InstSimplify-after-simplifycfg ++ // MIR for `norm2` after InstSimplify-after-simplifycfg fn norm2(_1: [f32; 2]) -> f32 { debug x => _1; diff --git a/tests/mir-opt/instsimplify/combine_array_len.norm2.InstSimplify.panic-unwind.diff b/tests/mir-opt/instsimplify/combine_array_len.norm2.InstSimplify-after-simplifycfg.panic-unwind.diff index 4833c1089e3..c15f7e47fe3 100644 --- a/tests/mir-opt/instsimplify/combine_array_len.norm2.InstSimplify.panic-unwind.diff +++ b/tests/mir-opt/instsimplify/combine_array_len.norm2.InstSimplify-after-simplifycfg.panic-unwind.diff @@ -1,5 +1,5 @@ -- // MIR for `norm2` before InstSimplify -+ // MIR for `norm2` after InstSimplify +- // MIR for `norm2` before InstSimplify-after-simplifycfg ++ // MIR for `norm2` after InstSimplify-after-simplifycfg fn norm2(_1: [f32; 2]) -> f32 { debug x => _1; diff --git a/tests/mir-opt/instsimplify/combine_array_len.rs b/tests/mir-opt/instsimplify/combine_array_len.rs index f12284f6482..91f43f75689 100644 --- a/tests/mir-opt/instsimplify/combine_array_len.rs +++ b/tests/mir-opt/instsimplify/combine_array_len.rs @@ -1,7 +1,7 @@ // EMIT_MIR_FOR_EACH_PANIC_STRATEGY -//@ test-mir-pass: InstSimplify +//@ test-mir-pass: InstSimplify-after-simplifycfg -// EMIT_MIR combine_array_len.norm2.InstSimplify.diff +// EMIT_MIR combine_array_len.norm2.InstSimplify-after-simplifycfg.diff fn norm2(x: [f32; 2]) -> f32 { // CHECK-LABEL: fn norm2( // CHECK-NOT: Len( diff --git a/tests/mir-opt/instsimplify/combine_clone_of_primitives.rs b/tests/mir-opt/instsimplify/combine_clone_of_primitives.rs index 7b1f3d14f4f..4f7288333d1 100644 --- a/tests/mir-opt/instsimplify/combine_clone_of_primitives.rs +++ b/tests/mir-opt/instsimplify/combine_clone_of_primitives.rs @@ -1,7 +1,7 @@ -//@ test-mir-pass: InstSimplify +//@ test-mir-pass: InstSimplify-after-simplifycfg // EMIT_MIR_FOR_EACH_PANIC_STRATEGY -// EMIT_MIR combine_clone_of_primitives.{impl#0}-clone.InstSimplify.diff +// EMIT_MIR combine_clone_of_primitives.{impl#0}-clone.InstSimplify-after-simplifycfg.diff #[derive(Clone)] struct MyThing<T> { v: T, diff --git a/tests/mir-opt/instsimplify/combine_clone_of_primitives.{impl#0}-clone.InstSimplify.panic-abort.diff b/tests/mir-opt/instsimplify/combine_clone_of_primitives.{impl#0}-clone.InstSimplify-after-simplifycfg.panic-abort.diff index 48586f8b334..c6f858d89eb 100644 --- a/tests/mir-opt/instsimplify/combine_clone_of_primitives.{impl#0}-clone.InstSimplify.panic-abort.diff +++ b/tests/mir-opt/instsimplify/combine_clone_of_primitives.{impl#0}-clone.InstSimplify-after-simplifycfg.panic-abort.diff @@ -1,5 +1,5 @@ -- // MIR for `<impl at $DIR/combine_clone_of_primitives.rs:5:10: 5:15>::clone` before InstSimplify -+ // MIR for `<impl at $DIR/combine_clone_of_primitives.rs:5:10: 5:15>::clone` after InstSimplify +- // MIR for `<impl at $DIR/combine_clone_of_primitives.rs:5:10: 5:15>::clone` before InstSimplify-after-simplifycfg ++ // MIR for `<impl at $DIR/combine_clone_of_primitives.rs:5:10: 5:15>::clone` after InstSimplify-after-simplifycfg fn <impl at $DIR/combine_clone_of_primitives.rs:5:10: 5:15>::clone(_1: &MyThing<T>) -> MyThing<T> { debug self => _1; diff --git a/tests/mir-opt/instsimplify/combine_clone_of_primitives.{impl#0}-clone.InstSimplify.panic-unwind.diff b/tests/mir-opt/instsimplify/combine_clone_of_primitives.{impl#0}-clone.InstSimplify-after-simplifycfg.panic-unwind.diff index a57266e9c12..691ab1f0e7f 100644 --- a/tests/mir-opt/instsimplify/combine_clone_of_primitives.{impl#0}-clone.InstSimplify.panic-unwind.diff +++ b/tests/mir-opt/instsimplify/combine_clone_of_primitives.{impl#0}-clone.InstSimplify-after-simplifycfg.panic-unwind.diff @@ -1,5 +1,5 @@ -- // MIR for `<impl at $DIR/combine_clone_of_primitives.rs:5:10: 5:15>::clone` before InstSimplify -+ // MIR for `<impl at $DIR/combine_clone_of_primitives.rs:5:10: 5:15>::clone` after InstSimplify +- // MIR for `<impl at $DIR/combine_clone_of_primitives.rs:5:10: 5:15>::clone` before InstSimplify-after-simplifycfg ++ // MIR for `<impl at $DIR/combine_clone_of_primitives.rs:5:10: 5:15>::clone` after InstSimplify-after-simplifycfg fn <impl at $DIR/combine_clone_of_primitives.rs:5:10: 5:15>::clone(_1: &MyThing<T>) -> MyThing<T> { debug self => _1; diff --git a/tests/mir-opt/instsimplify/combine_transmutes.adt_transmutes.InstSimplify.diff b/tests/mir-opt/instsimplify/combine_transmutes.adt_transmutes.InstSimplify-after-simplifycfg.diff index 17730e66291..9844aa2a64e 100644 --- a/tests/mir-opt/instsimplify/combine_transmutes.adt_transmutes.InstSimplify.diff +++ b/tests/mir-opt/instsimplify/combine_transmutes.adt_transmutes.InstSimplify-after-simplifycfg.diff @@ -1,5 +1,5 @@ -- // MIR for `adt_transmutes` before InstSimplify -+ // MIR for `adt_transmutes` after InstSimplify +- // MIR for `adt_transmutes` before InstSimplify-after-simplifycfg ++ // MIR for `adt_transmutes` after InstSimplify-after-simplifycfg fn adt_transmutes() -> () { let mut _0: (); diff --git a/tests/mir-opt/instsimplify/combine_transmutes.identity_transmutes.InstSimplify.diff b/tests/mir-opt/instsimplify/combine_transmutes.identity_transmutes.InstSimplify-after-simplifycfg.diff index 58ae5919071..589f7159b9b 100644 --- a/tests/mir-opt/instsimplify/combine_transmutes.identity_transmutes.InstSimplify.diff +++ b/tests/mir-opt/instsimplify/combine_transmutes.identity_transmutes.InstSimplify-after-simplifycfg.diff @@ -1,5 +1,5 @@ -- // MIR for `identity_transmutes` before InstSimplify -+ // MIR for `identity_transmutes` after InstSimplify +- // MIR for `identity_transmutes` before InstSimplify-after-simplifycfg ++ // MIR for `identity_transmutes` after InstSimplify-after-simplifycfg fn identity_transmutes() -> () { let mut _0: (); diff --git a/tests/mir-opt/instsimplify/combine_transmutes.integer_transmutes.InstSimplify.diff b/tests/mir-opt/instsimplify/combine_transmutes.integer_transmutes.InstSimplify-after-simplifycfg.diff index 8eff802dd3c..b7baa89dc80 100644 --- a/tests/mir-opt/instsimplify/combine_transmutes.integer_transmutes.InstSimplify.diff +++ b/tests/mir-opt/instsimplify/combine_transmutes.integer_transmutes.InstSimplify-after-simplifycfg.diff @@ -1,5 +1,5 @@ -- // MIR for `integer_transmutes` before InstSimplify -+ // MIR for `integer_transmutes` after InstSimplify +- // MIR for `integer_transmutes` before InstSimplify-after-simplifycfg ++ // MIR for `integer_transmutes` after InstSimplify-after-simplifycfg fn integer_transmutes() -> () { let mut _0: (); diff --git a/tests/mir-opt/instsimplify/combine_transmutes.rs b/tests/mir-opt/instsimplify/combine_transmutes.rs index c3622c20697..23f10b71f3c 100644 --- a/tests/mir-opt/instsimplify/combine_transmutes.rs +++ b/tests/mir-opt/instsimplify/combine_transmutes.rs @@ -1,4 +1,4 @@ -//@ test-mir-pass: InstSimplify +//@ test-mir-pass: InstSimplify-after-simplifycfg //@ compile-flags: -C panic=abort #![crate_type = "lib"] #![feature(core_intrinsics)] @@ -7,7 +7,7 @@ use std::intrinsics::mir::*; use std::mem::{transmute, ManuallyDrop, MaybeUninit}; -// EMIT_MIR combine_transmutes.identity_transmutes.InstSimplify.diff +// EMIT_MIR combine_transmutes.identity_transmutes.InstSimplify-after-simplifycfg.diff pub unsafe fn identity_transmutes() { // CHECK-LABEL: fn identity_transmutes( // CHECK-NOT: as i32 (Transmute); @@ -19,7 +19,7 @@ pub unsafe fn identity_transmutes() { } #[custom_mir(dialect = "runtime", phase = "initial")] -// EMIT_MIR combine_transmutes.integer_transmutes.InstSimplify.diff +// EMIT_MIR combine_transmutes.integer_transmutes.InstSimplify-after-simplifycfg.diff pub unsafe fn integer_transmutes() { // CHECK-LABEL: fn integer_transmutes( // CHECK-NOT: _i32 as u32 (Transmute); @@ -43,7 +43,7 @@ pub unsafe fn integer_transmutes() { } } -// EMIT_MIR combine_transmutes.adt_transmutes.InstSimplify.diff +// EMIT_MIR combine_transmutes.adt_transmutes.InstSimplify-after-simplifycfg.diff pub unsafe fn adt_transmutes() { // CHECK-LABEL: fn adt_transmutes( // CHECK: as u8 (Transmute); diff --git a/tests/mir-opt/instsimplify/duplicate_switch_targets.assert_zero.InstSimplify.diff b/tests/mir-opt/instsimplify/duplicate_switch_targets.assert_zero.InstSimplify-after-simplifycfg.diff index e2b45c882d6..7596aa20308 100644 --- a/tests/mir-opt/instsimplify/duplicate_switch_targets.assert_zero.InstSimplify.diff +++ b/tests/mir-opt/instsimplify/duplicate_switch_targets.assert_zero.InstSimplify-after-simplifycfg.diff @@ -1,5 +1,5 @@ -- // MIR for `assert_zero` before InstSimplify -+ // MIR for `assert_zero` after InstSimplify +- // MIR for `assert_zero` before InstSimplify-after-simplifycfg ++ // MIR for `assert_zero` after InstSimplify-after-simplifycfg fn assert_zero(_1: u8) -> u8 { let mut _0: u8; diff --git a/tests/mir-opt/instsimplify/duplicate_switch_targets.rs b/tests/mir-opt/instsimplify/duplicate_switch_targets.rs index a47d9d5a71d..d610ba5f690 100644 --- a/tests/mir-opt/instsimplify/duplicate_switch_targets.rs +++ b/tests/mir-opt/instsimplify/duplicate_switch_targets.rs @@ -1,11 +1,11 @@ -//@ test-mir-pass: InstSimplify +//@ test-mir-pass: InstSimplify-after-simplifycfg #![feature(custom_mir, core_intrinsics)] #![crate_type = "lib"] use std::intrinsics::mir::*; -// EMIT_MIR duplicate_switch_targets.assert_zero.InstSimplify.diff +// EMIT_MIR duplicate_switch_targets.assert_zero.InstSimplify-after-simplifycfg.diff #[custom_mir(dialect = "runtime", phase = "post-cleanup")] pub unsafe fn assert_zero(x: u8) -> u8 { // CHECK-LABEL: fn assert_zero( diff --git a/tests/mir-opt/instsimplify/intrinsic_asserts.generic.InstSimplify.diff b/tests/mir-opt/instsimplify/intrinsic_asserts.generic.InstSimplify-after-simplifycfg.diff index 2ecacb5e39f..d35844b21d1 100644 --- a/tests/mir-opt/instsimplify/intrinsic_asserts.generic.InstSimplify.diff +++ b/tests/mir-opt/instsimplify/intrinsic_asserts.generic.InstSimplify-after-simplifycfg.diff @@ -1,5 +1,5 @@ -- // MIR for `generic` before InstSimplify -+ // MIR for `generic` after InstSimplify +- // MIR for `generic` before InstSimplify-after-simplifycfg ++ // MIR for `generic` after InstSimplify-after-simplifycfg fn generic() -> () { let mut _0: (); diff --git a/tests/mir-opt/instsimplify/intrinsic_asserts.generic_ref.InstSimplify.diff b/tests/mir-opt/instsimplify/intrinsic_asserts.generic_ref.InstSimplify-after-simplifycfg.diff index d29af0945f7..6ddd8481ca7 100644 --- a/tests/mir-opt/instsimplify/intrinsic_asserts.generic_ref.InstSimplify.diff +++ b/tests/mir-opt/instsimplify/intrinsic_asserts.generic_ref.InstSimplify-after-simplifycfg.diff @@ -1,5 +1,5 @@ -- // MIR for `generic_ref` before InstSimplify -+ // MIR for `generic_ref` after InstSimplify +- // MIR for `generic_ref` before InstSimplify-after-simplifycfg ++ // MIR for `generic_ref` after InstSimplify-after-simplifycfg fn generic_ref() -> () { let mut _0: (); diff --git a/tests/mir-opt/instsimplify/intrinsic_asserts.panics.InstSimplify.diff b/tests/mir-opt/instsimplify/intrinsic_asserts.panics.InstSimplify-after-simplifycfg.diff index 1be386acfcc..1b7aa124c36 100644 --- a/tests/mir-opt/instsimplify/intrinsic_asserts.panics.InstSimplify.diff +++ b/tests/mir-opt/instsimplify/intrinsic_asserts.panics.InstSimplify-after-simplifycfg.diff @@ -1,5 +1,5 @@ -- // MIR for `panics` before InstSimplify -+ // MIR for `panics` after InstSimplify +- // MIR for `panics` before InstSimplify-after-simplifycfg ++ // MIR for `panics` after InstSimplify-after-simplifycfg fn panics() -> () { let mut _0: (); diff --git a/tests/mir-opt/instsimplify/intrinsic_asserts.removable.InstSimplify.diff b/tests/mir-opt/instsimplify/intrinsic_asserts.removable.InstSimplify-after-simplifycfg.diff index f2e69783842..20e046d8e19 100644 --- a/tests/mir-opt/instsimplify/intrinsic_asserts.removable.InstSimplify.diff +++ b/tests/mir-opt/instsimplify/intrinsic_asserts.removable.InstSimplify-after-simplifycfg.diff @@ -1,5 +1,5 @@ -- // MIR for `removable` before InstSimplify -+ // MIR for `removable` after InstSimplify +- // MIR for `removable` before InstSimplify-after-simplifycfg ++ // MIR for `removable` after InstSimplify-after-simplifycfg fn removable() -> () { let mut _0: (); diff --git a/tests/mir-opt/instsimplify/intrinsic_asserts.rs b/tests/mir-opt/instsimplify/intrinsic_asserts.rs index c031c978162..c71e08b9f1f 100644 --- a/tests/mir-opt/instsimplify/intrinsic_asserts.rs +++ b/tests/mir-opt/instsimplify/intrinsic_asserts.rs @@ -1,10 +1,10 @@ -//@ test-mir-pass: InstSimplify +//@ test-mir-pass: InstSimplify-after-simplifycfg #![crate_type = "lib"] #![feature(core_intrinsics)] // All these assertions pass, so all the intrinsic calls should be deleted. -// EMIT_MIR intrinsic_asserts.removable.InstSimplify.diff +// EMIT_MIR intrinsic_asserts.removable.InstSimplify-after-simplifycfg.diff pub fn removable() { // CHECK-LABEL: fn removable( // CHECK-NOT: assert_inhabited @@ -18,7 +18,7 @@ pub fn removable() { enum Never {} // These assertions all diverge, so their target blocks should become None. -// EMIT_MIR intrinsic_asserts.panics.InstSimplify.diff +// EMIT_MIR intrinsic_asserts.panics.InstSimplify-after-simplifycfg.diff pub fn panics() { // CHECK-LABEL: fn panics( // CHECK: assert_inhabited::<Never>() -> unwind @@ -30,7 +30,7 @@ pub fn panics() { } // Whether or not these asserts pass isn't known, so they shouldn't be modified. -// EMIT_MIR intrinsic_asserts.generic.InstSimplify.diff +// EMIT_MIR intrinsic_asserts.generic.InstSimplify-after-simplifycfg.diff pub fn generic<T>() { // CHECK-LABEL: fn generic( // CHECK: assert_inhabited::<T>() -> [return: @@ -42,7 +42,7 @@ pub fn generic<T>() { } // Whether or not these asserts pass isn't known, so they shouldn't be modified. -// EMIT_MIR intrinsic_asserts.generic_ref.InstSimplify.diff +// EMIT_MIR intrinsic_asserts.generic_ref.InstSimplify-after-simplifycfg.diff pub fn generic_ref<T>() { // CHECK-LABEL: fn generic_ref( // CHECK: assert_mem_uninitialized_valid::<&T>() -> [return: diff --git a/tests/mir-opt/instsimplify/ref_of_deref.pointers.InstSimplify.diff b/tests/mir-opt/instsimplify/ref_of_deref.pointers.InstSimplify-after-simplifycfg.diff index 52b3d1e1d40..ca26f0240f9 100644 --- a/tests/mir-opt/instsimplify/ref_of_deref.pointers.InstSimplify.diff +++ b/tests/mir-opt/instsimplify/ref_of_deref.pointers.InstSimplify-after-simplifycfg.diff @@ -1,5 +1,5 @@ -- // MIR for `pointers` before InstSimplify -+ // MIR for `pointers` after InstSimplify +- // MIR for `pointers` before InstSimplify-after-simplifycfg ++ // MIR for `pointers` after InstSimplify-after-simplifycfg fn pointers(_1: *const [i32], _2: *mut i32) -> () { debug const_ptr => _1; diff --git a/tests/mir-opt/instsimplify/ref_of_deref.references.InstSimplify.diff b/tests/mir-opt/instsimplify/ref_of_deref.references.InstSimplify-after-simplifycfg.diff index ca0828a225a..928ee3acaa0 100644 --- a/tests/mir-opt/instsimplify/ref_of_deref.references.InstSimplify.diff +++ b/tests/mir-opt/instsimplify/ref_of_deref.references.InstSimplify-after-simplifycfg.diff @@ -1,5 +1,5 @@ -- // MIR for `references` before InstSimplify -+ // MIR for `references` after InstSimplify +- // MIR for `references` before InstSimplify-after-simplifycfg ++ // MIR for `references` after InstSimplify-after-simplifycfg fn references(_1: &i32, _2: &mut [i32]) -> () { debug const_ref => _1; diff --git a/tests/mir-opt/instsimplify/ref_of_deref.rs b/tests/mir-opt/instsimplify/ref_of_deref.rs index 37e164bc17f..dc0f5f8198b 100644 --- a/tests/mir-opt/instsimplify/ref_of_deref.rs +++ b/tests/mir-opt/instsimplify/ref_of_deref.rs @@ -1,11 +1,11 @@ -//@ test-mir-pass: InstSimplify +//@ test-mir-pass: InstSimplify-after-simplifycfg #![crate_type = "lib"] #![feature(raw_ref_op)] // For each of these, only 2 of the 6 should simplify, // as the others have the wrong types. -// EMIT_MIR ref_of_deref.references.InstSimplify.diff +// EMIT_MIR ref_of_deref.references.InstSimplify-after-simplifycfg.diff // CHECK-LABEL: references pub fn references(const_ref: &i32, mut_ref: &mut [i32]) { // CHECK: _3 = _1; @@ -22,7 +22,7 @@ pub fn references(const_ref: &i32, mut_ref: &mut [i32]) { let _f = &raw mut *mut_ref; } -// EMIT_MIR ref_of_deref.pointers.InstSimplify.diff +// EMIT_MIR ref_of_deref.pointers.InstSimplify-after-simplifycfg.diff // CHECK-LABEL: pointers pub unsafe fn pointers(const_ptr: *const [i32], mut_ptr: *mut i32) { // CHECK: _3 = &(*_1); diff --git a/tests/mir-opt/instsimplify/ub_check.rs b/tests/mir-opt/instsimplify/ub_check.rs index 5f13f5ba059..ee72511c132 100644 --- a/tests/mir-opt/instsimplify/ub_check.rs +++ b/tests/mir-opt/instsimplify/ub_check.rs @@ -1,7 +1,7 @@ -//@ test-mir-pass: InstSimplify +//@ test-mir-pass: InstSimplify-after-simplifycfg //@ compile-flags: -Cdebug-assertions=no -Zinline-mir -// EMIT_MIR ub_check.unwrap_unchecked.InstSimplify.diff +// EMIT_MIR ub_check.unwrap_unchecked.InstSimplify-after-simplifycfg.diff pub fn unwrap_unchecked(x: Option<i32>) -> i32 { // CHECK-LABEL: fn unwrap_unchecked( // CHECK-NOT: UbChecks() diff --git a/tests/mir-opt/instsimplify/ub_check.unwrap_unchecked.InstSimplify.diff b/tests/mir-opt/instsimplify/ub_check.unwrap_unchecked.InstSimplify-after-simplifycfg.diff index 4d8d6589842..7ef77e76d12 100644 --- a/tests/mir-opt/instsimplify/ub_check.unwrap_unchecked.InstSimplify.diff +++ b/tests/mir-opt/instsimplify/ub_check.unwrap_unchecked.InstSimplify-after-simplifycfg.diff @@ -1,5 +1,5 @@ -- // MIR for `unwrap_unchecked` before InstSimplify -+ // MIR for `unwrap_unchecked` after InstSimplify +- // MIR for `unwrap_unchecked` before InstSimplify-after-simplifycfg ++ // MIR for `unwrap_unchecked` after InstSimplify-after-simplifycfg fn unwrap_unchecked(_1: Option<i32>) -> i32 { debug x => _1; diff --git a/tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.panic-abort.diff b/tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.panic-abort.diff index 1f88339b586..861ee1d3d3d 100644 --- a/tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.panic-abort.diff +++ b/tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.panic-abort.diff @@ -5,7 +5,7 @@ debug x => _1; let mut _0: (); let _2: &[T]; - let mut _3: &[T; 3]; + let _3: &[T; 3]; let _4: [T; 3]; let mut _5: usize; let mut _6: bool; @@ -23,12 +23,10 @@ } bb0: { - StorageLive(_3); StorageLive(_4); _4 = [_1, _1, _1]; _3 = &_4; - _2 = move _3 as &[T] (PointerCoercion(Unsize)); - StorageDead(_3); + _2 = _3 as &[T] (PointerCoercion(Unsize)); nop; nop; goto -> bb2; diff --git a/tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.panic-unwind.diff b/tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.panic-unwind.diff index 19a581ba3f0..f27be953384 100644 --- a/tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.panic-unwind.diff +++ b/tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.panic-unwind.diff @@ -5,7 +5,7 @@ debug x => _1; let mut _0: (); let _2: &[T]; - let mut _3: &[T; 3]; + let _3: &[T; 3]; let _4: [T; 3]; let mut _5: usize; let mut _6: bool; @@ -23,12 +23,10 @@ } bb0: { - StorageLive(_3); StorageLive(_4); _4 = [_1, _1, _1]; _3 = &_4; - _2 = move _3 as &[T] (PointerCoercion(Unsize)); - StorageDead(_3); + _2 = _3 as &[T] (PointerCoercion(Unsize)); nop; nop; goto -> bb2; diff --git a/tests/mir-opt/issue_78192.f.InstSimplify.diff b/tests/mir-opt/issue_78192.f.InstSimplify-after-simplifycfg.diff index 10e3dd20362..53957bb3cb1 100644 --- a/tests/mir-opt/issue_78192.f.InstSimplify.diff +++ b/tests/mir-opt/issue_78192.f.InstSimplify-after-simplifycfg.diff @@ -1,5 +1,5 @@ -- // MIR for `f` before InstSimplify -+ // MIR for `f` after InstSimplify +- // MIR for `f` before InstSimplify-after-simplifycfg ++ // MIR for `f` after InstSimplify-after-simplifycfg fn f(_1: &T) -> *const T { debug a => _1; @@ -17,8 +17,7 @@ StorageLive(_4); _4 = &raw const (*_1); _3 = &_4; -- _2 = &(*_3); -+ _2 = _3; + _2 = _3; StorageDead(_3); _0 = (*_2); StorageDead(_4); diff --git a/tests/mir-opt/issue_78192.rs b/tests/mir-opt/issue_78192.rs index 857b1dec951..a82f0e3a665 100644 --- a/tests/mir-opt/issue_78192.rs +++ b/tests/mir-opt/issue_78192.rs @@ -9,4 +9,4 @@ fn main() { f(&2); } -// EMIT_MIR issue_78192.f.InstSimplify.diff +// EMIT_MIR issue_78192.f.InstSimplify-after-simplifycfg.diff diff --git a/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.32bit.panic-abort.diff b/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.32bit.panic-abort.diff index 465cb1a9b1f..959efa2a548 100644 --- a/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.32bit.panic-abort.diff +++ b/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.32bit.panic-abort.diff @@ -24,7 +24,7 @@ let _13: std::alloc::AllocError; let mut _14: !; let mut _15: &dyn std::fmt::Debug; - let mut _16: &std::alloc::AllocError; + let _16: &std::alloc::AllocError; scope 7 { } scope 8 { @@ -86,21 +86,21 @@ StorageDead(_8); StorageDead(_7); StorageLive(_12); + StorageLive(_16); _12 = discriminant(_6); switchInt(move _12) -> [0: bb6, 1: bb5, otherwise: bb1]; } bb5: { StorageLive(_15); - StorageLive(_16); _16 = &_13; - _15 = move _16 as &dyn std::fmt::Debug (PointerCoercion(Unsize)); - StorageDead(_16); + _15 = _16 as &dyn std::fmt::Debug (PointerCoercion(Unsize)); _14 = result::unwrap_failed(const "called `Result::unwrap()` on an `Err` value", move _15) -> unwind unreachable; } bb6: { _5 = move ((_6 as Ok).0: std::ptr::NonNull<[u8]>); + StorageDead(_16); StorageDead(_12); StorageDead(_6); - StorageLive(_17); diff --git a/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.64bit.panic-abort.diff b/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.64bit.panic-abort.diff index 925d8997b8a..97f5245a8c9 100644 --- a/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.64bit.panic-abort.diff +++ b/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.64bit.panic-abort.diff @@ -24,7 +24,7 @@ let _13: std::alloc::AllocError; let mut _14: !; let mut _15: &dyn std::fmt::Debug; - let mut _16: &std::alloc::AllocError; + let _16: &std::alloc::AllocError; scope 7 { } scope 8 { @@ -86,21 +86,21 @@ StorageDead(_8); StorageDead(_7); StorageLive(_12); + StorageLive(_16); _12 = discriminant(_6); switchInt(move _12) -> [0: bb6, 1: bb5, otherwise: bb1]; } bb5: { StorageLive(_15); - StorageLive(_16); _16 = &_13; - _15 = move _16 as &dyn std::fmt::Debug (PointerCoercion(Unsize)); - StorageDead(_16); + _15 = _16 as &dyn std::fmt::Debug (PointerCoercion(Unsize)); _14 = result::unwrap_failed(const "called `Result::unwrap()` on an `Err` value", move _15) -> unwind unreachable; } bb6: { _5 = move ((_6 as Ok).0: std::ptr::NonNull<[u8]>); + StorageDead(_16); StorageDead(_12); StorageDead(_6); - StorageLive(_17); diff --git a/tests/mir-opt/pre-codegen/loops.vec_move.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/loops.vec_move.PreCodegen.after.mir index cb29473d762..e537dd6a28e 100644 --- a/tests/mir-opt/pre-codegen/loops.vec_move.PreCodegen.after.mir +++ b/tests/mir-opt/pre-codegen/loops.vec_move.PreCodegen.after.mir @@ -30,13 +30,11 @@ fn vec_move(_1: Vec<impl Sized>) -> () { bb2: { StorageLive(_5); - StorageLive(_4); _4 = &mut _3; _5 = <std::vec::IntoIter<impl Sized> as Iterator>::next(move _4) -> [return: bb3, unwind: bb9]; } bb3: { - StorageDead(_4); _6 = discriminant(_5); switchInt(move _6) -> [0: bb4, 1: bb6, otherwise: bb8]; } diff --git a/tests/mir-opt/pre-codegen/no_inlined_clone.rs b/tests/mir-opt/pre-codegen/no_inlined_clone.rs new file mode 100644 index 00000000000..475b230b465 --- /dev/null +++ b/tests/mir-opt/pre-codegen/no_inlined_clone.rs @@ -0,0 +1,12 @@ +#![crate_type = "lib"] + +// EMIT_MIR no_inlined_clone.{impl#0}-clone.PreCodegen.after.mir + +// CHECK-LABEL: ::clone( +// CHECK-NOT: inlined clone::impls::<impl Clone for {{.*}}>::clone +// CHECK: return; + +#[derive(Clone)] +struct Foo { + a: i32, +} diff --git a/tests/mir-opt/pre-codegen/no_inlined_clone.{impl#0}-clone.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/no_inlined_clone.{impl#0}-clone.PreCodegen.after.mir new file mode 100644 index 00000000000..71898daa1bf --- /dev/null +++ b/tests/mir-opt/pre-codegen/no_inlined_clone.{impl#0}-clone.PreCodegen.after.mir @@ -0,0 +1,15 @@ +// MIR for `<impl at $DIR/no_inlined_clone.rs:9:10: 9:15>::clone` after PreCodegen + +fn <impl at $DIR/no_inlined_clone.rs:9:10: 9:15>::clone(_1: &Foo) -> Foo { + debug self => _1; + let mut _0: Foo; + let mut _2: i32; + + bb0: { + StorageLive(_2); + _2 = ((*_1).0: i32); + _0 = Foo { a: move _2 }; + StorageDead(_2); + return; + } +} diff --git a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ScalarReplacementOfAggregates.32bit.panic-abort.diff b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ScalarReplacementOfAggregates.32bit.panic-abort.diff index 802bfbbcdc5..c01a12eaa4f 100644 --- a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ScalarReplacementOfAggregates.32bit.panic-abort.diff +++ b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ScalarReplacementOfAggregates.32bit.panic-abort.diff @@ -37,7 +37,7 @@ _4 = [const 0_i32, const 1_i32, const 2_i32, const 3_i32, const 4_i32, const 5_i32]; StorageLive(_5); _5 = const 3_usize; - _6 = Len(_4); + _6 = const 6_usize; _7 = Lt(_5, _6); assert(move _7, "index out of bounds: the length is {} but the index is {}", move _6, _5) -> [success: bb2, unwind unreachable]; } diff --git a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ScalarReplacementOfAggregates.32bit.panic-unwind.diff b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ScalarReplacementOfAggregates.32bit.panic-unwind.diff index de94a557403..64028e4437b 100644 --- a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ScalarReplacementOfAggregates.32bit.panic-unwind.diff +++ b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ScalarReplacementOfAggregates.32bit.panic-unwind.diff @@ -37,7 +37,7 @@ _4 = [const 0_i32, const 1_i32, const 2_i32, const 3_i32, const 4_i32, const 5_i32]; StorageLive(_5); _5 = const 3_usize; - _6 = Len(_4); + _6 = const 6_usize; _7 = Lt(_5, _6); assert(move _7, "index out of bounds: the length is {} but the index is {}", move _6, _5) -> [success: bb2, unwind continue]; } diff --git a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ScalarReplacementOfAggregates.64bit.panic-abort.diff b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ScalarReplacementOfAggregates.64bit.panic-abort.diff index 802bfbbcdc5..c01a12eaa4f 100644 --- a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ScalarReplacementOfAggregates.64bit.panic-abort.diff +++ b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ScalarReplacementOfAggregates.64bit.panic-abort.diff @@ -37,7 +37,7 @@ _4 = [const 0_i32, const 1_i32, const 2_i32, const 3_i32, const 4_i32, const 5_i32]; StorageLive(_5); _5 = const 3_usize; - _6 = Len(_4); + _6 = const 6_usize; _7 = Lt(_5, _6); assert(move _7, "index out of bounds: the length is {} but the index is {}", move _6, _5) -> [success: bb2, unwind unreachable]; } diff --git a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ScalarReplacementOfAggregates.64bit.panic-unwind.diff b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ScalarReplacementOfAggregates.64bit.panic-unwind.diff index de94a557403..64028e4437b 100644 --- a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ScalarReplacementOfAggregates.64bit.panic-unwind.diff +++ b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ScalarReplacementOfAggregates.64bit.panic-unwind.diff @@ -37,7 +37,7 @@ _4 = [const 0_i32, const 1_i32, const 2_i32, const 3_i32, const 4_i32, const 5_i32]; StorageLive(_5); _5 = const 3_usize; - _6 = Len(_4); + _6 = const 6_usize; _7 = Lt(_5, _6); assert(move _7, "index out of bounds: the length is {} but the index is {}", move _6, _5) -> [success: bb2, unwind continue]; } diff --git a/tests/mir-opt/pre-codegen/range_iter.inclusive_loop.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/range_iter.inclusive_loop.PreCodegen.after.panic-abort.mir index ce79a33013d..a7fe52d8390 100644 --- a/tests/mir-opt/pre-codegen/range_iter.inclusive_loop.PreCodegen.after.panic-abort.mir +++ b/tests/mir-opt/pre-codegen/range_iter.inclusive_loop.PreCodegen.after.panic-abort.mir @@ -36,13 +36,11 @@ fn inclusive_loop(_1: u32, _2: u32, _3: impl Fn(u32)) -> () { bb1: { StorageLive(_7); - StorageLive(_6); _6 = &mut _5; _7 = <RangeInclusive<u32> as iter::range::RangeInclusiveIteratorImpl>::spec_next(move _6) -> [return: bb2, unwind unreachable]; } bb2: { - StorageDead(_6); _8 = discriminant(_7); switchInt(move _8) -> [0: bb3, 1: bb5, otherwise: bb7]; } diff --git a/tests/mir-opt/pre-codegen/range_iter.inclusive_loop.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/range_iter.inclusive_loop.PreCodegen.after.panic-unwind.mir index 602ecb7c9b8..3e2bbcd3c91 100644 --- a/tests/mir-opt/pre-codegen/range_iter.inclusive_loop.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/range_iter.inclusive_loop.PreCodegen.after.panic-unwind.mir @@ -36,13 +36,11 @@ fn inclusive_loop(_1: u32, _2: u32, _3: impl Fn(u32)) -> () { bb1: { StorageLive(_7); - StorageLive(_6); _6 = &mut _5; _7 = <RangeInclusive<u32> as iter::range::RangeInclusiveIteratorImpl>::spec_next(move _6) -> [return: bb2, unwind: bb8]; } bb2: { - StorageDead(_6); _8 = discriminant(_7); switchInt(move _8) -> [0: bb3, 1: bb5, otherwise: bb7]; } diff --git a/tests/mir-opt/pre-codegen/slice_filter.variant_a-{closure#0}.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/slice_filter.variant_a-{closure#0}.PreCodegen.after.mir index dfa13230254..e382f744723 100644 --- a/tests/mir-opt/pre-codegen/slice_filter.variant_a-{closure#0}.PreCodegen.after.mir +++ b/tests/mir-opt/pre-codegen/slice_filter.variant_a-{closure#0}.PreCodegen.after.mir @@ -32,7 +32,7 @@ fn variant_a::{closure#0}(_1: &mut {closure@$DIR/slice_filter.rs:7:25: 7:39}, _2 debug other => _10; scope 3 (inlined std::cmp::impls::<impl PartialOrd for usize>::le) { debug self => _4; - debug other => _9; + debug other => _6; let mut _11: usize; let mut _12: usize; } @@ -42,7 +42,7 @@ fn variant_a::{closure#0}(_1: &mut {closure@$DIR/slice_filter.rs:7:25: 7:39}, _2 debug other => _16; scope 5 (inlined std::cmp::impls::<impl PartialOrd for usize>::le) { debug self => _7; - debug other => _15; + debug other => _5; let mut _17: usize; let mut _18: usize; } @@ -52,7 +52,7 @@ fn variant_a::{closure#0}(_1: &mut {closure@$DIR/slice_filter.rs:7:25: 7:39}, _2 debug other => _22; scope 7 (inlined std::cmp::impls::<impl PartialOrd for usize>::le) { debug self => _6; - debug other => _21; + debug other => _4; } } scope 8 (inlined std::cmp::impls::<impl PartialOrd for &usize>::le) { @@ -60,7 +60,7 @@ fn variant_a::{closure#0}(_1: &mut {closure@$DIR/slice_filter.rs:7:25: 7:39}, _2 debug other => _26; scope 9 (inlined std::cmp::impls::<impl PartialOrd for usize>::le) { debug self => _5; - debug other => _25; + debug other => _7; let mut _27: usize; let mut _28: usize; } @@ -77,7 +77,8 @@ fn variant_a::{closure#0}(_1: &mut {closure@$DIR/slice_filter.rs:7:25: 7:39}, _2 StorageLive(_8); _8 = &_4; StorageLive(_10); - _9 = &((*_3).2: usize); + StorageLive(_9); + _9 = _6; _10 = &_9; _11 = ((*_3).0: usize); _12 = ((*_3).2: usize); @@ -86,19 +87,22 @@ fn variant_a::{closure#0}(_1: &mut {closure@$DIR/slice_filter.rs:7:25: 7:39}, _2 } bb1: { + StorageDead(_9); StorageDead(_10); StorageDead(_8); goto -> bb4; } bb2: { + StorageDead(_9); StorageDead(_10); StorageDead(_8); StorageLive(_19); StorageLive(_14); _14 = &_7; StorageLive(_16); - _15 = &((*_3).1: usize); + StorageLive(_15); + _15 = _5; _16 = &_15; StorageLive(_17); _17 = ((*_3).3: usize); @@ -111,6 +115,7 @@ fn variant_a::{closure#0}(_1: &mut {closure@$DIR/slice_filter.rs:7:25: 7:39}, _2 } bb3: { + StorageDead(_15); StorageDead(_16); StorageDead(_14); goto -> bb4; @@ -121,13 +126,15 @@ fn variant_a::{closure#0}(_1: &mut {closure@$DIR/slice_filter.rs:7:25: 7:39}, _2 StorageLive(_20); _20 = &_6; StorageLive(_22); - _21 = &((*_3).0: usize); + StorageLive(_21); + _21 = _4; _22 = &_21; _23 = Le(_12, _11); switchInt(move _23) -> [0: bb5, otherwise: bb6]; } bb5: { + StorageDead(_21); StorageDead(_22); StorageDead(_20); _0 = const false; @@ -135,12 +142,14 @@ fn variant_a::{closure#0}(_1: &mut {closure@$DIR/slice_filter.rs:7:25: 7:39}, _2 } bb6: { + StorageDead(_21); StorageDead(_22); StorageDead(_20); StorageLive(_24); _24 = &_5; StorageLive(_26); - _25 = &((*_3).3: usize); + StorageLive(_25); + _25 = _7; _26 = &_25; StorageLive(_27); _27 = ((*_3).1: usize); @@ -149,6 +158,7 @@ fn variant_a::{closure#0}(_1: &mut {closure@$DIR/slice_filter.rs:7:25: 7:39}, _2 _0 = Le(move _27, move _28); StorageDead(_28); StorageDead(_27); + StorageDead(_25); StorageDead(_26); StorageDead(_24); goto -> bb7; @@ -160,6 +170,7 @@ fn variant_a::{closure#0}(_1: &mut {closure@$DIR/slice_filter.rs:7:25: 7:39}, _2 } bb8: { + StorageDead(_15); StorageDead(_16); StorageDead(_14); _0 = const true; diff --git a/tests/mir-opt/pre-codegen/slice_index.slice_get_mut_usize.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/slice_index.slice_get_mut_usize.PreCodegen.after.panic-abort.mir index d7f09fafeeb..58e9b45a4a0 100644 --- a/tests/mir-opt/pre-codegen/slice_index.slice_get_mut_usize.PreCodegen.after.panic-abort.mir +++ b/tests/mir-opt/pre-codegen/slice_index.slice_get_mut_usize.PreCodegen.after.panic-abort.mir @@ -20,7 +20,7 @@ fn slice_get_mut_usize(_1: &mut [u32], _2: usize) -> Option<&mut u32> { } bb0: { - StorageLive(_7); + StorageLive(_8); StorageLive(_4); StorageLive(_3); _3 = PtrMetadata(_1); @@ -36,7 +36,7 @@ fn slice_get_mut_usize(_1: &mut [u32], _2: usize) -> Option<&mut u32> { bb2: { StorageDead(_3); - StorageLive(_8); + StorageLive(_7); StorageLive(_5); _5 = &raw mut (*_1); StorageLive(_6); @@ -45,14 +45,14 @@ fn slice_get_mut_usize(_1: &mut [u32], _2: usize) -> Option<&mut u32> { StorageDead(_6); StorageDead(_5); _8 = &mut (*_7); - _0 = Option::<&mut u32>::Some(move _8); - StorageDead(_8); + _0 = Option::<&mut u32>::Some(_8); + StorageDead(_7); goto -> bb3; } bb3: { StorageDead(_4); - StorageDead(_7); + StorageDead(_8); return; } } diff --git a/tests/mir-opt/pre-codegen/slice_index.slice_get_mut_usize.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/slice_index.slice_get_mut_usize.PreCodegen.after.panic-unwind.mir index d7f09fafeeb..58e9b45a4a0 100644 --- a/tests/mir-opt/pre-codegen/slice_index.slice_get_mut_usize.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/slice_index.slice_get_mut_usize.PreCodegen.after.panic-unwind.mir @@ -20,7 +20,7 @@ fn slice_get_mut_usize(_1: &mut [u32], _2: usize) -> Option<&mut u32> { } bb0: { - StorageLive(_7); + StorageLive(_8); StorageLive(_4); StorageLive(_3); _3 = PtrMetadata(_1); @@ -36,7 +36,7 @@ fn slice_get_mut_usize(_1: &mut [u32], _2: usize) -> Option<&mut u32> { bb2: { StorageDead(_3); - StorageLive(_8); + StorageLive(_7); StorageLive(_5); _5 = &raw mut (*_1); StorageLive(_6); @@ -45,14 +45,14 @@ fn slice_get_mut_usize(_1: &mut [u32], _2: usize) -> Option<&mut u32> { StorageDead(_6); StorageDead(_5); _8 = &mut (*_7); - _0 = Option::<&mut u32>::Some(move _8); - StorageDead(_8); + _0 = Option::<&mut u32>::Some(_8); + StorageDead(_7); goto -> bb3; } bb3: { StorageDead(_4); - StorageDead(_7); + StorageDead(_8); return; } } diff --git a/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-abort.mir index 2f13cfa4dab..ee80726a675 100644 --- a/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-abort.mir +++ b/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-abort.mir @@ -35,6 +35,7 @@ fn slice_get_unchecked_mut_range(_1: &mut [u32], _2: std::ops::Range<usize>) -> bb0: { _3 = move (_2.0: usize); _4 = move (_2.1: usize); + StorageLive(_11); StorageLive(_5); _5 = &raw mut (*_1); StorageLive(_8); @@ -56,6 +57,7 @@ fn slice_get_unchecked_mut_range(_1: &mut [u32], _2: std::ops::Range<usize>) -> StorageDead(_8); StorageDead(_5); _0 = &mut (*_11); + StorageDead(_11); return; } } diff --git a/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-unwind.mir index 2f13cfa4dab..ee80726a675 100644 --- a/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-unwind.mir @@ -35,6 +35,7 @@ fn slice_get_unchecked_mut_range(_1: &mut [u32], _2: std::ops::Range<usize>) -> bb0: { _3 = move (_2.0: usize); _4 = move (_2.1: usize); + StorageLive(_11); StorageLive(_5); _5 = &raw mut (*_1); StorageLive(_8); @@ -56,6 +57,7 @@ fn slice_get_unchecked_mut_range(_1: &mut [u32], _2: std::ops::Range<usize>) -> StorageDead(_8); StorageDead(_5); _0 = &mut (*_11); + StorageDead(_11); return; } } diff --git a/tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.PreCodegen.after.panic-unwind.mir index d5fdb2e08cc..4c766c6497a 100644 --- a/tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.PreCodegen.after.panic-unwind.mir @@ -108,13 +108,11 @@ fn enumerated_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () { bb4: { StorageLive(_15); - StorageLive(_14); _14 = &mut _13; _15 = <Enumerate<std::slice::Iter<'_, T>> as Iterator>::next(move _14) -> [return: bb5, unwind: bb11]; } bb5: { - StorageDead(_14); _16 = discriminant(_15); switchInt(move _16) -> [0: bb6, 1: bb8, otherwise: bb10]; } diff --git a/tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.panic-abort.mir index cc2beac06f2..03de9fd938e 100644 --- a/tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.panic-abort.mir +++ b/tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.panic-abort.mir @@ -98,13 +98,11 @@ fn forward_loop(_1: &[T], _2: impl Fn(&T)) -> () { bb4: { StorageLive(_14); - StorageLive(_13); _13 = &mut _12; _14 = <std::slice::Iter<'_, T> as Iterator>::next(move _13) -> [return: bb5, unwind unreachable]; } bb5: { - StorageDead(_13); _15 = discriminant(_14); switchInt(move _15) -> [0: bb6, 1: bb8, otherwise: bb10]; } diff --git a/tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.panic-unwind.mir index d66edb28570..c7c722274f2 100644 --- a/tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.panic-unwind.mir @@ -98,13 +98,11 @@ fn forward_loop(_1: &[T], _2: impl Fn(&T)) -> () { bb4: { StorageLive(_14); - StorageLive(_13); _13 = &mut _12; _14 = <std::slice::Iter<'_, T> as Iterator>::next(move _13) -> [return: bb5, unwind: bb11]; } bb5: { - StorageDead(_13); _15 = discriminant(_14); switchInt(move _15) -> [0: bb6, 1: bb8, otherwise: bb10]; } diff --git a/tests/mir-opt/pre-codegen/spans.outer.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/spans.outer.PreCodegen.after.panic-abort.mir index 485dc9179ce..c76e5315db9 100644 --- a/tests/mir-opt/pre-codegen/spans.outer.PreCodegen.after.panic-abort.mir +++ b/tests/mir-opt/pre-codegen/spans.outer.PreCodegen.after.panic-abort.mir @@ -3,16 +3,14 @@ fn outer(_1: u8) -> u8 { debug v => _1; // in scope 0 at $DIR/spans.rs:10:14: 10:15 let mut _0: u8; // return place in scope 0 at $DIR/spans.rs:10:24: 10:26 - let mut _2: &u8; // in scope 0 at $DIR/spans.rs:11:11: 11:13 + let _2: &u8; // in scope 0 at $DIR/spans.rs:11:11: 11:13 scope 1 (inlined inner) { // at $DIR/spans.rs:11:5: 11:14 debug x => _2; // in scope 1 at $DIR/spans.rs:14:14: 14:15 } bb0: { - StorageLive(_2); // scope 0 at $DIR/spans.rs:11:11: 11:13 _2 = &_1; // scope 0 at $DIR/spans.rs:11:11: 11:13 _0 = _1; // scope 1 at $DIR/spans.rs:15:5: 15:7 - StorageDead(_2); // scope 0 at $DIR/spans.rs:11:13: 11:14 return; // scope 0 at $DIR/spans.rs:12:2: 12:2 } } diff --git a/tests/mir-opt/pre-codegen/spans.outer.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/spans.outer.PreCodegen.after.panic-unwind.mir index 485dc9179ce..c76e5315db9 100644 --- a/tests/mir-opt/pre-codegen/spans.outer.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/spans.outer.PreCodegen.after.panic-unwind.mir @@ -3,16 +3,14 @@ fn outer(_1: u8) -> u8 { debug v => _1; // in scope 0 at $DIR/spans.rs:10:14: 10:15 let mut _0: u8; // return place in scope 0 at $DIR/spans.rs:10:24: 10:26 - let mut _2: &u8; // in scope 0 at $DIR/spans.rs:11:11: 11:13 + let _2: &u8; // in scope 0 at $DIR/spans.rs:11:11: 11:13 scope 1 (inlined inner) { // at $DIR/spans.rs:11:5: 11:14 debug x => _2; // in scope 1 at $DIR/spans.rs:14:14: 14:15 } bb0: { - StorageLive(_2); // scope 0 at $DIR/spans.rs:11:11: 11:13 _2 = &_1; // scope 0 at $DIR/spans.rs:11:11: 11:13 _0 = _1; // scope 1 at $DIR/spans.rs:15:5: 15:7 - StorageDead(_2); // scope 0 at $DIR/spans.rs:11:13: 11:14 return; // scope 0 at $DIR/spans.rs:12:2: 12:2 } } diff --git a/tests/mir-opt/pre-codegen/vec_deref.vec_deref_to_slice.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/vec_deref.vec_deref_to_slice.PreCodegen.after.panic-abort.mir index 1c9ed25d7f2..14ad951a476 100644 --- a/tests/mir-opt/pre-codegen/vec_deref.vec_deref_to_slice.PreCodegen.after.panic-abort.mir +++ b/tests/mir-opt/pre-codegen/vec_deref.vec_deref_to_slice.PreCodegen.after.panic-abort.mir @@ -56,10 +56,12 @@ fn vec_deref_to_slice(_1: &Vec<u8>) -> &[u8] { StorageDead(_2); StorageLive(_5); _5 = ((*_1).1: usize); + StorageLive(_6); _6 = *const [u8] from (_4, _5); + _0 = &(*_6); + StorageDead(_6); StorageDead(_5); StorageDead(_4); - _0 = &(*_6); return; } } diff --git a/tests/mir-opt/pre-codegen/vec_deref.vec_deref_to_slice.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/vec_deref.vec_deref_to_slice.PreCodegen.after.panic-unwind.mir index 1c9ed25d7f2..14ad951a476 100644 --- a/tests/mir-opt/pre-codegen/vec_deref.vec_deref_to_slice.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/vec_deref.vec_deref_to_slice.PreCodegen.after.panic-unwind.mir @@ -56,10 +56,12 @@ fn vec_deref_to_slice(_1: &Vec<u8>) -> &[u8] { StorageDead(_2); StorageLive(_5); _5 = ((*_1).1: usize); + StorageLive(_6); _6 = *const [u8] from (_4, _5); + _0 = &(*_6); + StorageDead(_6); StorageDead(_5); StorageDead(_4); - _0 = &(*_6); return; } } diff --git a/tests/run-make/raw-dylib-import-name-type/Makefile b/tests/run-make/raw-dylib-import-name-type/Makefile deleted file mode 100644 index 901d3e861c2..00000000000 --- a/tests/run-make/raw-dylib-import-name-type/Makefile +++ /dev/null @@ -1,17 +0,0 @@ -# Test the behavior of #[link(.., kind = "raw-dylib")] with alternative calling conventions. - -# only-x86 -# only-windows - -include ../tools.mk - -all: - $(RUSTC) --crate-type bin driver.rs -L "$(TMPDIR)" - $(call COMPILE_OBJ,"$(TMPDIR)"/extern.obj,extern.c) -ifdef IS_MSVC - $(CC) "$(TMPDIR)"/extern.obj extern.msvc.def -link -dll -out:"$(TMPDIR)"/extern.dll -noimplib -else - $(CC) "$(TMPDIR)"/extern.obj extern.gnu.def --no-leading-underscore -shared -o "$(TMPDIR)"/extern.dll -endif - "$(TMPDIR)"/driver > "$(TMPDIR)"/output.txt - $(RUSTC_TEST_OP) "$(TMPDIR)"/output.txt output.txt diff --git a/tests/run-make/raw-dylib-import-name-type/rmake.rs b/tests/run-make/raw-dylib-import-name-type/rmake.rs new file mode 100644 index 00000000000..13a2c99150e --- /dev/null +++ b/tests/run-make/raw-dylib-import-name-type/rmake.rs @@ -0,0 +1,37 @@ +// `raw-dylib` is a Windows-specific attribute which emits idata sections for the items in the +// attached extern block, +// so they may be linked against without linking against an import library. +// To learn more, read https://github.com/rust-lang/rfcs/blob/master/text/2627-raw-dylib-kind.md +// This test uses this feature alongside `import_name_type`, which allows for customization +// of how Windows symbols will be named. A sanity check of this feature is done by comparison +// with expected output. +// See https://github.com/rust-lang/rust/pull/100732 + +//@ only-x86 +//@ only-windows +// Reason: this test specifically exercises a 32bit Windows calling convention. + +use run_make_support::{cc, diff, is_msvc, run, rustc}; + +// NOTE: build_native_dynamic lib is not used, as the special `def` files +// must be passed to the CC compiler. + +fn main() { + rustc().crate_type("bin").input("driver.rs").run(); + if is_msvc() { + cc().arg("-c").out_exe("extern").input("extern.c").run(); + cc().input("extern.obj") + .arg("extern.msvc.def") + .args(&["-link", "-dll", "-noimplib", "-out:extern.dll"]) + .run(); + } else { + cc().arg("-v").arg("-c").out_exe("extern.obj").input("extern.c").run(); + cc().input("extern.obj") + .arg("extern.gnu.def") + .args(&["--no-leading-underscore", "-shared"]) + .output("extern.dll") + .run(); + }; + let out = run("driver").stdout_utf8(); + diff().expected_file("output.txt").actual_text("actual", out).normalize(r#"\r"#, "").run(); +} diff --git a/tests/run-make/raw-dylib-link-ordinal/Makefile b/tests/run-make/raw-dylib-link-ordinal/Makefile deleted file mode 100644 index 3cf1300c243..00000000000 --- a/tests/run-make/raw-dylib-link-ordinal/Makefile +++ /dev/null @@ -1,17 +0,0 @@ -# Test the behavior of #[link(.., kind = "raw-dylib")] and #[link_ordinal] on windows-msvc - -# only-windows - -include ../tools.mk - -all: - $(RUSTC) --crate-type lib --crate-name raw_dylib_test lib.rs - $(RUSTC) --crate-type bin driver.rs -L "$(TMPDIR)" - $(call COMPILE_OBJ,"$(TMPDIR)"/exporter.obj,exporter.c) -ifdef IS_MSVC - $(CC) "$(TMPDIR)"/exporter.obj exporter.def -link -dll -out:"$(TMPDIR)"/exporter.dll -noimplib -else - $(CC) "$(TMPDIR)"/exporter.obj exporter.def -shared -o "$(TMPDIR)"/exporter.dll -endif - "$(TMPDIR)"/driver | tr -d '\r' > "$(TMPDIR)"/output.txt - $(RUSTC_TEST_OP) "$(TMPDIR)"/output.txt output.txt diff --git a/tests/run-make/raw-dylib-link-ordinal/rmake.rs b/tests/run-make/raw-dylib-link-ordinal/rmake.rs new file mode 100644 index 00000000000..b52181ae3f9 --- /dev/null +++ b/tests/run-make/raw-dylib-link-ordinal/rmake.rs @@ -0,0 +1,34 @@ +// `raw-dylib` is a Windows-specific attribute which emits idata sections for the items in the +// attached extern block, +// so they may be linked against without linking against an import library. +// To learn more, read https://github.com/rust-lang/rfcs/blob/master/text/2627-raw-dylib-kind.md +// `#[link_ordinal(n)]` allows Rust to link against DLLs that export symbols by ordinal rather +// than by name. As long as the ordinal matches, the name of the function in Rust is not +// required to match the name of the corresponding function in the exporting DLL. +// This test is a sanity check for this feature, done by comparing its output against expected +// output. +// See https://github.com/rust-lang/rust/pull/89025 + +//@ only-windows + +use run_make_support::{cc, diff, is_msvc, run, rustc}; + +// NOTE: build_native_dynamic lib is not used, as the special `def` files +// must be passed to the CC compiler. + +fn main() { + rustc().crate_type("lib").crate_name("raw_dylib_test").input("lib.rs").run(); + rustc().crate_type("bin").input("driver.rs").run(); + if is_msvc() { + cc().arg("-c").out_exe("exporter").input("exporter.c").run(); + cc().input("exporter.obj") + .arg("exporter.def") + .args(&["-link", "-dll", "-noimplib", "-out:exporter.dll"]) + .run(); + } else { + cc().arg("-v").arg("-c").out_exe("exporter.obj").input("exporter.c").run(); + cc().input("exporter.obj").arg("exporter.def").arg("-shared").output("exporter.dll").run(); + }; + let out = run("driver").stdout_utf8(); + diff().expected_file("output.txt").actual_text("actual", out).normalize(r#"\r"#, "").run(); +} diff --git a/tests/run-make/raw-dylib-stdcall-ordinal/Makefile b/tests/run-make/raw-dylib-stdcall-ordinal/Makefile deleted file mode 100644 index 70e4de62c1a..00000000000 --- a/tests/run-make/raw-dylib-stdcall-ordinal/Makefile +++ /dev/null @@ -1,18 +0,0 @@ -# Test the behavior of #[link(.., kind = "raw-dylib")], #[link_ordinal], and alternative calling conventions on i686 windows. - -# only-x86 -# only-windows - -include ../tools.mk - -all: - $(RUSTC) --crate-type lib --crate-name raw_dylib_test lib.rs - $(RUSTC) --crate-type bin driver.rs -L "$(TMPDIR)" - $(call COMPILE_OBJ,"$(TMPDIR)"/exporter.obj,exporter.c) -ifdef IS_MSVC - $(CC) "$(TMPDIR)"/exporter.obj exporter-msvc.def -link -dll -out:"$(TMPDIR)"/exporter.dll -noimplib -else - $(CC) "$(TMPDIR)"/exporter.obj exporter-gnu.def -shared -o "$(TMPDIR)"/exporter.dll -endif - "$(TMPDIR)"/driver > "$(TMPDIR)"/actual_output.txt - $(RUSTC_TEST_OP) "$(TMPDIR)"/actual_output.txt expected_output.txt diff --git a/tests/run-make/raw-dylib-stdcall-ordinal/rmake.rs b/tests/run-make/raw-dylib-stdcall-ordinal/rmake.rs new file mode 100644 index 00000000000..320ea1520d8 --- /dev/null +++ b/tests/run-make/raw-dylib-stdcall-ordinal/rmake.rs @@ -0,0 +1,41 @@ +// `raw-dylib` is a Windows-specific attribute which emits idata sections for the items in the +// attached extern block, +// so they may be linked against without linking against an import library. +// To learn more, read https://github.com/rust-lang/rfcs/blob/master/text/2627-raw-dylib-kind.md +// Almost identical to `raw-dylib-link-ordinal`, but with the addition of calling conventions, +// such as stdcall. +// See https://github.com/rust-lang/rust/pull/90782 + +//@ only-x86 +//@ only-windows +// Reason: this test specifically exercises a 32bit Windows calling convention. + +use run_make_support::{cc, diff, is_msvc, run, rustc}; + +// NOTE: build_native_dynamic lib is not used, as the special `def` files +// must be passed to the CC compiler. + +fn main() { + rustc().crate_type("lib").crate_name("raw_dylib_test").input("lib.rs").run(); + rustc().crate_type("bin").input("driver.rs").run(); + if is_msvc() { + cc().arg("-c").out_exe("exporter").input("exporter.c").run(); + cc().input("exporter.obj") + .arg("exporter-msvc.def") + .args(&["-link", "-dll", "-noimplib", "-out:exporter.dll"]) + .run(); + } else { + cc().arg("-v").arg("-c").out_exe("exporter.obj").input("exporter.c").run(); + cc().input("exporter.obj") + .arg("exporter-gnu.def") + .arg("-shared") + .output("exporter.dll") + .run(); + }; + let out = run("driver").stdout_utf8(); + diff() + .expected_file("expected_output.txt") + .actual_text("actual", out) + .normalize(r#"\r"#, "") + .run(); +} diff --git a/tests/run-make/share-generics-dylib/Makefile b/tests/run-make/share-generics-dylib/Makefile deleted file mode 100644 index 9d97eca80d3..00000000000 --- a/tests/run-make/share-generics-dylib/Makefile +++ /dev/null @@ -1,23 +0,0 @@ -# ignore-cross-compile -# This test makes sure all generic instances get re-exported from Rust dylibs for use by -# `-Zshare-generics`. There are two rlibs (`instance_provider_a` and `instance_provider_b`) -# which both provide an instance of `Cell<i32>::set`. There is `instance_user_dylib` which is -# supposed to re-export both these instances, and then there are `instance_user_a_rlib` and -# `instance_user_b_rlib` which each rely on a specific instance to be available. -# -# In the end everything is linked together into `linked_leaf`. If `instance_user_dylib` does -# not export both then we'll get an `undefined reference` error for one of the instances. -# -# This is regression test for https://github.com/rust-lang/rust/issues/67276. - -include ../tools.mk - -COMMON_ARGS=-Cprefer-dynamic -Zshare-generics=yes -Ccodegen-units=1 -Csymbol-mangling-version=v0 - -all: - $(RUSTC) instance_provider_a.rs $(COMMON_ARGS) --crate-type=rlib - $(RUSTC) instance_provider_b.rs $(COMMON_ARGS) --crate-type=rlib - $(RUSTC) instance_user_dylib.rs $(COMMON_ARGS) --crate-type=dylib - $(RUSTC) instance_user_a_rlib.rs $(COMMON_ARGS) --crate-type=rlib - $(RUSTC) instance_user_b_rlib.rs $(COMMON_ARGS) --crate-type=rlib - $(RUSTC) linked_leaf.rs $(COMMON_ARGS) --crate-type=bin diff --git a/tests/run-make/share-generics-dylib/rmake.rs b/tests/run-make/share-generics-dylib/rmake.rs new file mode 100644 index 00000000000..e0e647fe199 --- /dev/null +++ b/tests/run-make/share-generics-dylib/rmake.rs @@ -0,0 +1,30 @@ +// This test makes sure all generic instances get re-exported from Rust dylibs for use by +// `-Zshare-generics`. There are two rlibs (`instance_provider_a` and `instance_provider_b`) +// which both provide an instance of `Cell<i32>::set`. There is `instance_user_dylib` which is +// supposed to re-export both these instances, and then there are `instance_user_a_rlib` and +// `instance_user_b_rlib` which each rely on a specific instance to be available. +// +// In the end everything is linked together into `linked_leaf`. If `instance_user_dylib` does +// not export both then we'll get an `undefined reference` error for one of the instances. +// +// This is regression test for https://github.com/rust-lang/rust/issues/67276. + +use run_make_support::rustc; + +fn main() { + compile("rlib", "instance_provider_a.rs"); + compile("rlib", "instance_provider_b.rs"); + compile("dylib", "instance_user_dylib.rs"); + compile("rlib", "instance_user_a_rlib.rs"); + compile("rlib", "instance_user_b_rlib.rs"); + compile("bin", "linked_leaf.rs"); +} + +fn compile(crate_type: &str, input: &str) { + rustc() + .input(input) + .crate_type(crate_type) + .args(&["-Cprefer-dynamic", "-Zshare-generics=yes", "-Csymbol-mangling-version=v0"]) + .codegen_units(1) + .run(); +} diff --git a/tests/rustdoc-gui/code-example-buttons.goml b/tests/rustdoc-gui/code-example-buttons.goml new file mode 100644 index 00000000000..57ea2970072 --- /dev/null +++ b/tests/rustdoc-gui/code-example-buttons.goml @@ -0,0 +1,21 @@ +// This test ensures that code blocks buttons are displayed on hover and when you click on them. +go-to: "file://" + |DOC_PATH| + "/test_docs/fn.foo.html" + +// First we check we "hover". +move-cursor-to: ".example-wrap" +assert-css: (".example-wrap .copy-button", { "visibility": "visible" }) +move-cursor-to: ".search-input" +assert-css: (".example-wrap .copy-button", { "visibility": "hidden" }) + +// Now we check the click. +assert-count: (".example-wrap:not(:hover) .button-holder.keep-visible", 0) +click: ".example-wrap" +move-cursor-to: ".search-input" +// It should have a new class and be visible. +wait-for-count: (".example-wrap:not(:hover) .button-holder.keep-visible", 1) +wait-for-css: (".example-wrap:not(:hover) .button-holder.keep-visible", { "visibility": "visible" }) +// Clicking again will remove the class. +click: ".example-wrap" +move-cursor-to: ".search-input" +assert-count: (".example-wrap:not(:hover) .button-holder.keep-visible", 0) +assert-css: (".example-wrap .copy-button", { "visibility": "hidden" }) diff --git a/tests/rustdoc-gui/duplicate-macro-reexport.goml b/tests/rustdoc-gui/duplicate-macro-reexport.goml index 7d01c88f31b..a838d99c4bf 100644 --- a/tests/rustdoc-gui/duplicate-macro-reexport.goml +++ b/tests/rustdoc-gui/duplicate-macro-reexport.goml @@ -4,11 +4,11 @@ go-to: "file://" + |DOC_PATH| + "/test_docs/macro.a.html" wait-for: ".sidebar-elems .macro" // Check there is only one macro named "a" listed in the sidebar. assert-count: ( - "//*[@class='sidebar-elems']//*[@class='block macro']//li/a[text()='a']", + "//*[@class='sidebar-elems']//*[@class='block macro']//li/a[normalize-space()='a']", 1, ) // Check there is only one macro named "b" listed in the sidebar. assert-count: ( - "//*[@class='sidebar-elems']//*[@class='block macro']//li/a[text()='b']", + "//*[@class='sidebar-elems']//*[@class='block macro']//li/a[normalize-space()='b']", 1, ) diff --git a/tests/rustdoc-gui/font-weight.goml b/tests/rustdoc-gui/font-weight.goml index 602b8d6f5b3..26e9bf515a3 100644 --- a/tests/rustdoc-gui/font-weight.goml +++ b/tests/rustdoc-gui/font-weight.goml @@ -1,8 +1,8 @@ // This test checks that the font weight is correctly applied. go-to: "file://" + |DOC_PATH| + "/lib2/struct.Foo.html" -assert-css: ("//*[@class='rust item-decl']//a[text()='Alias']", {"font-weight": "400"}) +assert-css: ("//*[@class='rust item-decl']//a[normalize-space()='Alias']", {"font-weight": "400"}) assert-css: ( - "//*[@class='structfield section-header']//a[text()='Alias']", + "//*[@class='structfield section-header']//a[normalize-space()='Alias']", {"font-weight": "400"}, ) assert-css: ("#method\.a_method > .code-header", {"font-weight": "600"}) diff --git a/tests/rustdoc-gui/item-info.goml b/tests/rustdoc-gui/item-info.goml index 1eb46e832b7..7a0194c6cc1 100644 --- a/tests/rustdoc-gui/item-info.goml +++ b/tests/rustdoc-gui/item-info.goml @@ -12,11 +12,11 @@ assert-position: (".item-info .stab", {"x": 245}) // test for <https://github.com/rust-lang/rust/issues/118615>. set-window-size: (850, 800) store-position: ( - "//*[@class='stab portability']//code[text()='Win32_System']", + "//*[@class='stab portability']//code[normalize-space()='Win32_System']", {"x": first_line_x, "y": first_line_y}, ) store-position: ( - "//*[@class='stab portability']//code[text()='Win32_System_Diagnostics']", + "//*[@class='stab portability']//code[normalize-space()='Win32_System_Diagnostics']", {"x": second_line_x, "y": second_line_y}, ) assert: |first_line_x| != |second_line_x| && |first_line_x| == 516 && |second_line_x| == 272 diff --git a/tests/rustdoc-gui/label-next-to-symbol.goml b/tests/rustdoc-gui/label-next-to-symbol.goml index 0582bd2cad3..a8363f29dd5 100644 --- a/tests/rustdoc-gui/label-next-to-symbol.goml +++ b/tests/rustdoc-gui/label-next-to-symbol.goml @@ -23,11 +23,12 @@ assert-css: ( // table like view assert-css: (".desc.docblock-short", { "padding-left": "0px" }) compare-elements-position-near: ( - "//*[@class='item-name']//a[text()='replaced_function']", + "//*[@class='item-name']//a[normalize-space()='replaced_function']", ".item-name .stab.deprecated", {"y": 2}, ) -compare-elements-position: ( +// "Unix" part is on second line +compare-elements-position-false: ( ".item-name .stab.deprecated", ".item-name .stab.portability", ["y"], @@ -35,8 +36,8 @@ compare-elements-position: ( // Ensure no wrap compare-elements-position: ( - "//*[@class='item-name']//a[text()='replaced_function']/..", - "//*[@class='desc docblock-short'][text()='a thing with a label']", + "//*[@class='item-name']//a[normalize-space()='replaced_function']/..", + "//*[@class='desc docblock-short'][normalize-space()='a thing with a label']", ["y"], ) @@ -45,7 +46,7 @@ set-window-size: (600, 600) // staggered layout with 2em spacing assert-css: (".desc.docblock-short", { "padding-left": "32px" }) compare-elements-position-near: ( - "//*[@class='item-name']//a[text()='replaced_function']", + "//*[@class='item-name']//a[normalize-space()='replaced_function']", ".item-name .stab.deprecated", {"y": 2}, ) @@ -57,13 +58,13 @@ compare-elements-position: ( // Ensure wrap compare-elements-position-false: ( - "//*[@class='item-name']//a[text()='replaced_function']/..", - "//*[@class='desc docblock-short'][text()='a thing with a label']", + "//*[@class='item-name']//a[normalize-space()='replaced_function']/..", + "//*[@class='desc docblock-short'][normalize-space()='a thing with a label']", ["y"], ) compare-elements-position-false: ( ".item-name .stab.deprecated", - "//*[@class='desc docblock-short'][text()='a thing with a label']", + "//*[@class='desc docblock-short'][normalize-space()='a thing with a label']", ["y"], ) @@ -73,7 +74,7 @@ go-to: "file://" + |DOC_PATH| + "/test_docs/cfgs/index.html" // This part of the tags should not be on the same line as the beginning since the width // is too small for that. compare-elements-position-false: ( - "//*[@class='stab portability']/code[text()='appservice-api-c']", - "//*[@class='stab portability']/code[text()='server']", + "//*[@class='stab portability']/code[normalize-space()='appservice-api-c']", + "//*[@class='stab portability']/code[normalize-space()='server']", ["y"], ) diff --git a/tests/rustdoc-gui/notable-trait.goml b/tests/rustdoc-gui/notable-trait.goml index 6ee810c5768..e2a8a43007e 100644 --- a/tests/rustdoc-gui/notable-trait.goml +++ b/tests/rustdoc-gui/notable-trait.goml @@ -9,19 +9,19 @@ define-function: ( block { // Checking they have the same y position. compare-elements-position: ( - "//*[@id='method.create_an_iterator_from_read']//a[text()='NotableStructWithLongName']", + "//*[@id='method.create_an_iterator_from_read']//a[normalize-space()='NotableStructWithLongName']", "//*[@id='method.create_an_iterator_from_read']//*[@class='tooltip']", ["y"], ) // Checking they don't have the same x position. compare-elements-position-false: ( - "//*[@id='method.create_an_iterator_from_read']//a[text()='NotableStructWithLongName']", + "//*[@id='method.create_an_iterator_from_read']//a[normalize-space()='NotableStructWithLongName']", "//*[@id='method.create_an_iterator_from_read']//*[@class='tooltip']", ["x"], ) // The `i` should be *after* the type. assert-position: ( - "//*[@id='method.create_an_iterator_from_read']//a[text()='NotableStructWithLongName']", + "//*[@id='method.create_an_iterator_from_read']//a[normalize-space()='NotableStructWithLongName']", {"x": |x|}, ) assert-position: ( @@ -70,7 +70,7 @@ call-function: ("check-notable-tooltip-position-complete", { // Now only the `i` should be on the next line. set-window-size: (1055, 600) compare-elements-position-false: ( - "//*[@id='method.create_an_iterator_from_read']//a[text()='NotableStructWithLongName']", + "//*[@id='method.create_an_iterator_from_read']//a[normalize-space()='NotableStructWithLongName']", "//*[@id='method.create_an_iterator_from_read']//*[@class='tooltip']", ["y", "x"], ) diff --git a/tests/rustdoc-gui/search-result-color.goml b/tests/rustdoc-gui/search-result-color.goml index 9825f92b453..e8da43eb896 100644 --- a/tests/rustdoc-gui/search-result-color.goml +++ b/tests/rustdoc-gui/search-result-color.goml @@ -20,11 +20,11 @@ define-function: ( ALL, ) assert-css: ( - "//*[@class='desc'][text()='Just a normal struct.']", + "//*[@class='desc'][normalize-space()='Just a normal struct.']", {"color": |desc_color|}, ) assert-css: ( - "//*[@class='result-name']//*[text()='test_docs::']", + "//*[@class='result-name']//*[normalize-space()='test_docs::']", {"color": |path_color|}, ) @@ -85,19 +85,19 @@ define-function: ( move-cursor-to: ".search-input" focus: ".search-input" // To ensure the `<a>` container isn't focused or hovered. assert-css: ( - "//*[@class='result-name']//*[text()='test_docs::']/ancestor::a", + "//*[@class='result-name']//*[normalize-space()='test_docs::']/ancestor::a", {"color": |path_color|, "background-color": "transparent"}, ALL, ) // Checking color and background on hover. - move-cursor-to: "//*[@class='desc'][text()='Just a normal struct.']" + move-cursor-to: "//*[@class='desc'][normalize-space()='Just a normal struct.']" assert-css: ( - "//*[@class='result-name']//*[text()='test_docs::']", + "//*[@class='result-name']//*[normalize-space()='test_docs::']", {"color": |hover_path_color|}, ) assert-css: ( - "//*[@class='result-name']//*[text()='test_docs::']/ancestor::a", + "//*[@class='result-name']//*[normalize-space()='test_docs::']/ancestor::a", {"color": |hover_path_color|, "background-color": |hover_background|}, ) } diff --git a/tests/rustdoc-gui/sidebar-macro-reexport.goml b/tests/rustdoc-gui/sidebar-macro-reexport.goml index 0f7ef6c3558..cad25507fbb 100644 --- a/tests/rustdoc-gui/sidebar-macro-reexport.goml +++ b/tests/rustdoc-gui/sidebar-macro-reexport.goml @@ -2,4 +2,4 @@ // displayed twice in the sidebar. go-to: "file://" + |DOC_PATH| + "/test_docs/macro.repro.html" wait-for: ".sidebar-elems .block.macro a" -assert-count: ("//*[@class='sidebar-elems']//*[@class='block macro']//a[text()='repro']", 1) +assert-count: ("//*[@class='sidebar-elems']//*[@class='block macro']//a[normalize-space()='repro']", 1) diff --git a/tests/rustdoc-gui/sidebar-mobile.goml b/tests/rustdoc-gui/sidebar-mobile.goml index b4ff483c180..4ada4837a57 100644 --- a/tests/rustdoc-gui/sidebar-mobile.goml +++ b/tests/rustdoc-gui/sidebar-mobile.goml @@ -25,9 +25,12 @@ click: ".sidebar-menu-toggle" assert-css: (".sidebar", {"left": "0px"}) // Make sure the "struct Foo" header is hidden, since the mobile topbar already does it. -assert-css: ("//nav[contains(@class, 'sidebar')]//h2/a[text()='Foo']/parent::h2", {"display": "none"}) +assert-css: ("//nav[contains(@class, 'sidebar')]//h2/a[normalize-space()='Foo']/parent::h2", {"display": "none"}) // Make sure the global navigation is still here. -assert-css: ("//nav[contains(@class, 'sidebar')]//h2/a[text()='In crate test_docs']/parent::h2", {"display": "block"}) +assert-css: ( + "//nav[contains(@class, 'sidebar')]//h2/a[normalize-space()='In crate test_docs']/parent::h2", + {"display": "block"} +) // Click elsewhere. click: "body" diff --git a/tests/rustdoc-gui/sidebar-source-code.goml b/tests/rustdoc-gui/sidebar-source-code.goml index ef0b5ab38b1..6afccf6a95f 100644 --- a/tests/rustdoc-gui/sidebar-source-code.goml +++ b/tests/rustdoc-gui/sidebar-source-code.goml @@ -66,12 +66,12 @@ click: "#sidebar-button" // We wait for the sidebar to be expanded. wait-for-css: (".src-sidebar-expanded nav.sidebar", {"width": "300px"}) assert: "//*[@class='dir-entry' and @open]/*[text()='lib2']" -assert: "//*[@class='dir-entry' and @open]/*[text()='another_folder']" -assert: "//*[@class='dir-entry' and @open]/*[text()='sub_mod']" +assert: "//*[@class='dir-entry' and @open]/*[normalize-space()='another_folder']" +assert: "//*[@class='dir-entry' and @open]/*[normalize-space()='sub_mod']" // Only "another_folder" should be "open" in "lib2". -assert: "//*[@class='dir-entry' and not(@open)]/*[text()='another_mod']" +assert: "//*[@class='dir-entry' and not(@open)]/*[normalize-space()='another_mod']" // All other trees should be collapsed. -assert-count: ("//*[@id='src-sidebar']/details[not(text()='lib2') and not(@open)]", 11) +assert-count: ("//*[@id='src-sidebar']/details[not(normalize-space()='lib2') and not(@open)]", 11) // We now switch to mobile mode. set-window-size: (600, 600) diff --git a/tests/rustdoc-gui/source-anchor-scroll.goml b/tests/rustdoc-gui/source-anchor-scroll.goml index 940851ea146..3508b26a0bf 100644 --- a/tests/rustdoc-gui/source-anchor-scroll.goml +++ b/tests/rustdoc-gui/source-anchor-scroll.goml @@ -11,7 +11,7 @@ click: '//a[text() = "barbar" and @href="#5-7"]' assert-property: ("html", {"scrollTop": "123"}) click: '//a[text() = "bar" and @href="#28-36"]' assert-property: ("html", {"scrollTop": "154"}) -click: '//a[text() = "sub_fn" and @href="#2-4"]' +click: '//a[normalize-space() = "sub_fn" and @href="#2-4"]' assert-property: ("html", {"scrollTop": "51"}) // We now check that clicking on lines doesn't change the scroll diff --git a/tests/rustdoc/extremely_long_typename.extremely_long_typename.html b/tests/rustdoc/extremely_long_typename.extremely_long_typename.html new file mode 100644 index 00000000000..b20e59866da --- /dev/null +++ b/tests/rustdoc/extremely_long_typename.extremely_long_typename.html @@ -0,0 +1 @@ +<li><div class="item-name"><a class="struct" href="struct.CreateSubscriptionPaymentSettingsPaymentMethodOptionsCustomerBalanceBankTransferEuBankTransfer.html" title="struct extremely_long_typename::CreateSubscriptionPaymentSettingsPaymentMethodOptionsCustomerBalanceBankTransferEuBankTransfer">Create<wbr />Subscription<wbr />Payment<wbr />Settings<wbr />Payment<wbr />Method<wbr />Options<wbr />Customer<wbr />Balance<wbr />Bank<wbr />Transfer<wbr />EuBank<wbr />Transfer</a></div></li> \ No newline at end of file diff --git a/tests/rustdoc/extremely_long_typename.rs b/tests/rustdoc/extremely_long_typename.rs new file mode 100644 index 00000000000..212afe2d110 --- /dev/null +++ b/tests/rustdoc/extremely_long_typename.rs @@ -0,0 +1,7 @@ +// ignore-tidy-linelength +// Make sure that, if an extremely long type name is named, +// the item table has it line wrapped. +// There should be some reasonably-placed `<wbr>` tags in the snapshot file. + +// @snapshot extremely_long_typename "extremely_long_typename/index.html" '//ul[@class="item-table"]/li' +pub struct CreateSubscriptionPaymentSettingsPaymentMethodOptionsCustomerBalanceBankTransferEuBankTransfer; diff --git a/tests/rustdoc/item-desc-list-at-start.item-table.html b/tests/rustdoc/item-desc-list-at-start.item-table.html index 72bde573cea..cff4f816529 100644 --- a/tests/rustdoc/item-desc-list-at-start.item-table.html +++ b/tests/rustdoc/item-desc-list-at-start.item-table.html @@ -1 +1 @@ -<ul class="item-table"><li><div class="item-name"><a class="constant" href="constant.MY_CONSTANT.html" title="constant item_desc_list_at_start::MY_CONSTANT">MY_CONSTANT</a></div><div class="desc docblock-short">Groups: <code>SamplePatternSGIS</code>, <code>SamplePatternEXT</code></div></li></ul> \ No newline at end of file +<ul class="item-table"><li><div class="item-name"><a class="constant" href="constant.MY_CONSTANT.html" title="constant item_desc_list_at_start::MY_CONSTANT">MY_<wbr />CONSTANT</a></div><div class="desc docblock-short">Groups: <code>SamplePatternSGIS</code>, <code>SamplePatternEXT</code></div></li></ul> \ No newline at end of file diff --git a/tests/ui/coherence/normalize-for-errors.next.stderr b/tests/ui/coherence/normalize-for-errors.next.stderr index 6c56a917741..634a10b7a14 100644 --- a/tests/ui/coherence/normalize-for-errors.next.stderr +++ b/tests/ui/coherence/normalize-for-errors.next.stderr @@ -7,6 +7,7 @@ LL | LL | impl<S: Iterator> MyTrait<S> for (Box<<(MyType,) as Mirror>::Assoc>, S::Item) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(Box<(MyType,)>, <_ as Iterator>::Item)` | + = note: upstream crates may add a new impl of trait `std::clone::Clone` for type `(MyType,)` in future versions = note: upstream crates may add a new impl of trait `std::marker::Copy` for type `std::boxed::Box<(MyType,)>` in future versions error: aborting due to 1 previous error diff --git a/tests/ui/coherence/normalize-for-errors.rs b/tests/ui/coherence/normalize-for-errors.rs index 2288118676a..4188389a3ad 100644 --- a/tests/ui/coherence/normalize-for-errors.rs +++ b/tests/ui/coherence/normalize-for-errors.rs @@ -18,5 +18,6 @@ impl<S: Iterator> MyTrait<S> for (Box<<(MyType,) as Mirror>::Assoc>, S::Item) {} //~^ ERROR conflicting implementations of trait `MyTrait<_>` for type `(Box<(MyType,)>, //~| NOTE conflicting implementation for `(Box<(MyType,)>, //~| NOTE upstream crates may add a new impl of trait `std::marker::Copy` for type `std::boxed::Box<(MyType,)>` in future versions +//[next]~| NOTE upstream crates may add a new impl of trait `std::clone::Clone` for type `(MyType,)` in future versions fn main() {} diff --git a/tests/ui/coherence/super-traits/super-trait-knowable-1.current.stderr b/tests/ui/coherence/super-traits/super-trait-knowable-1.current.stderr new file mode 100644 index 00000000000..fb01cf158d9 --- /dev/null +++ b/tests/ui/coherence/super-traits/super-trait-knowable-1.current.stderr @@ -0,0 +1,13 @@ +error[E0119]: conflicting implementations of trait `Overlap<_>` for type `()` + --> $DIR/super-trait-knowable-1.rs:16:1 + | +LL | impl<T, U: Sub<T>> Overlap<T> for U {} + | ----------------------------------- first implementation here +LL | impl<T> Overlap<T> for () {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `()` + | + = note: downstream crates may implement trait `Sub<_>` for type `()` + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0119`. diff --git a/tests/ui/coherence/super-traits/super-trait-knowable-1.rs b/tests/ui/coherence/super-traits/super-trait-knowable-1.rs new file mode 100644 index 00000000000..80df8c19ee5 --- /dev/null +++ b/tests/ui/coherence/super-traits/super-trait-knowable-1.rs @@ -0,0 +1,19 @@ +// Added in #124532. While `(): Super` is knowable, `(): Sub<?t>` is not. +// +// We therefore elaborate super trait bounds in the implicit negative +// overlap check. + +//@ revisions: current next +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[next] compile-flags: -Znext-solver +//@[next] check-pass + +trait Super {} +trait Sub<T>: Super {} + +trait Overlap<T> {} +impl<T, U: Sub<T>> Overlap<T> for U {} +impl<T> Overlap<T> for () {} +//[current]~^ ERROR conflicting implementations + +fn main() {} diff --git a/tests/ui/coherence/super-traits/super-trait-knowable-2.rs b/tests/ui/coherence/super-traits/super-trait-knowable-2.rs new file mode 100644 index 00000000000..d1f2e8d1c1a --- /dev/null +++ b/tests/ui/coherence/super-traits/super-trait-knowable-2.rs @@ -0,0 +1,33 @@ +// A regression test for pyella-0.1.5 which broke when +// enabling the new solver in coherence. +// +// `Tensor: TensorValue` is knowable while `Tensor: TensorOp<?t2>` +// may be implemented downstream. We previously didn't check the +// super trait bound in coherence, causing these impls to overlap. +// +// However, we did fail to normalize `<Tensor as TensorValue::Unmasked` +// which caused the old solver to emit a `Tensor: TensorValue` goal in +// `fn normalize_to_error` which then failed, causing this test to pass. + +//@ revisions: current next +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[next] compile-flags: -Znext-solver +//@ check-pass + +pub trait TensorValue { + type Unmasked; +} + +trait TensorCompare<T> {} +pub trait TensorOp<T>: TensorValue {} + +pub struct Tensor; +impl<T2> TensorCompare<T2> for Tensor {} +impl<T1, T2> TensorCompare<T2> for T1 +where + T1: TensorOp<T2>, + T1::Unmasked: Sized, +{} + + +fn main() {} diff --git a/tests/ui/coherence/super-traits/super-trait-knowable-3.current.stderr b/tests/ui/coherence/super-traits/super-trait-knowable-3.current.stderr new file mode 100644 index 00000000000..542edb8b7f6 --- /dev/null +++ b/tests/ui/coherence/super-traits/super-trait-knowable-3.current.stderr @@ -0,0 +1,13 @@ +error[E0119]: conflicting implementations of trait `Overlap<_>` for type `()` + --> $DIR/super-trait-knowable-3.rs:19:1 + | +LL | impl<T, U: Bound<W<T>>> Overlap<T> for U {} + | ---------------------------------------- first implementation here +LL | impl<T> Overlap<T> for () {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `()` + | + = note: downstream crates may implement trait `Sub<_>` for type `()` + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0119`. diff --git a/tests/ui/coherence/super-traits/super-trait-knowable-3.rs b/tests/ui/coherence/super-traits/super-trait-knowable-3.rs new file mode 100644 index 00000000000..295d7ac48d8 --- /dev/null +++ b/tests/ui/coherence/super-traits/super-trait-knowable-3.rs @@ -0,0 +1,22 @@ +// Unlike in `super-trait-knowable-1.rs`, the knowable +// super trait bound is in a nested goal so this would not +// compile if we were to only elaborate root goals. + +//@ revisions: current next +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[next] compile-flags: -Znext-solver +//@[next] check-pass + +trait Super {} +trait Sub<T>: Super {} + +struct W<T>(T); +trait Bound<T> {} +impl<T: Sub<U>, U> Bound<W<U>> for T {} + +trait Overlap<T> {} +impl<T, U: Bound<W<T>>> Overlap<T> for U {} +impl<T> Overlap<T> for () {} +//[current]~^ ERROR conflicting implementations of trait `Overlap<_>` for type `()` + +fn main() {} diff --git a/tests/ui/const-ptr/forbidden_slices.stderr b/tests/ui/const-ptr/forbidden_slices.stderr index eb41a25c818..034e8bd1852 100644 --- a/tests/ui/const-ptr/forbidden_slices.stderr +++ b/tests/ui/const-ptr/forbidden_slices.stderr @@ -118,7 +118,7 @@ LL | pub static R1: &[()] = unsafe { from_ptr_range(ptr::null()..ptr::null()) }; error[E0080]: could not evaluate static initializer --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL | - = note: out-of-bounds pointer arithmetic: ALLOC10 has size 4, so pointer to 8 bytes starting at offset 0 is out-of-bounds + = note: out-of-bounds pointer arithmetic: expected a pointer to 8 bytes of memory, but got ALLOC10 and there are only 4 bytes starting at that pointer | note: inside `std::ptr::const_ptr::<impl *const u32>::add` --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL @@ -177,7 +177,7 @@ LL | pub static R7: &[u16] = unsafe { error[E0080]: could not evaluate static initializer --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL | - = note: out-of-bounds pointer arithmetic: ALLOC11 has size 8, so pointer to 8 bytes starting at offset 1 is out-of-bounds + = note: out-of-bounds pointer arithmetic: expected a pointer to 8 bytes of memory, but got ALLOC11+0x1 and there are only 7 bytes starting at that pointer | note: inside `std::ptr::const_ptr::<impl *const u64>::add` --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL diff --git a/tests/ui/const-ptr/out_of_bounds_read.stderr b/tests/ui/const-ptr/out_of_bounds_read.stderr index 7634ba25210..7f354963eb1 100644 --- a/tests/ui/const-ptr/out_of_bounds_read.stderr +++ b/tests/ui/const-ptr/out_of_bounds_read.stderr @@ -1,7 +1,7 @@ error[E0080]: evaluation of constant value failed --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL | - = note: memory access failed: ALLOC0 has size 4, so pointer to 4 bytes starting at offset 4 is out-of-bounds + = note: memory access failed: expected a pointer to 4 bytes of memory, but got ALLOC0+0x4 which is at or beyond the end of the allocation of size 4 bytes | note: inside `std::ptr::read::<u32>` --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL @@ -14,7 +14,7 @@ LL | const _READ: u32 = unsafe { ptr::read(PAST_END_PTR) }; error[E0080]: evaluation of constant value failed --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL | - = note: memory access failed: ALLOC0 has size 4, so pointer to 4 bytes starting at offset 4 is out-of-bounds + = note: memory access failed: expected a pointer to 4 bytes of memory, but got ALLOC0+0x4 which is at or beyond the end of the allocation of size 4 bytes | note: inside `std::ptr::read::<u32>` --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL @@ -29,7 +29,7 @@ LL | const _CONST_READ: u32 = unsafe { PAST_END_PTR.read() }; error[E0080]: evaluation of constant value failed --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL | - = note: memory access failed: ALLOC0 has size 4, so pointer to 4 bytes starting at offset 4 is out-of-bounds + = note: memory access failed: expected a pointer to 4 bytes of memory, but got ALLOC0+0x4 which is at or beyond the end of the allocation of size 4 bytes | note: inside `std::ptr::read::<u32>` --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL diff --git a/tests/ui/consts/const-compare-bytes-ub.stderr b/tests/ui/consts/const-compare-bytes-ub.stderr index 9e49706c4c8..8a923779a5b 100644 --- a/tests/ui/consts/const-compare-bytes-ub.stderr +++ b/tests/ui/consts/const-compare-bytes-ub.stderr @@ -2,31 +2,31 @@ error[E0080]: evaluation of constant value failed --> $DIR/const-compare-bytes-ub.rs:10:9 | LL | compare_bytes(0 as *const u8, 2 as *const u8, 1) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ memory access failed: null pointer is a dangling pointer (it has no provenance) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ memory access failed: expected a pointer to 1 byte of memory, but got a null pointer error[E0080]: evaluation of constant value failed --> $DIR/const-compare-bytes-ub.rs:14:9 | LL | compare_bytes(1 as *const u8, 0 as *const u8, 1) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ memory access failed: 0x1[noalloc] is a dangling pointer (it has no provenance) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ memory access failed: expected a pointer to 1 byte of memory, but got 0x1[noalloc] which is a dangling pointer (it has no provenance) error[E0080]: evaluation of constant value failed --> $DIR/const-compare-bytes-ub.rs:18:9 | LL | compare_bytes(1 as *const u8, 2 as *const u8, 1) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ memory access failed: 0x1[noalloc] is a dangling pointer (it has no provenance) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ memory access failed: expected a pointer to 1 byte of memory, but got 0x1[noalloc] which is a dangling pointer (it has no provenance) error[E0080]: evaluation of constant value failed --> $DIR/const-compare-bytes-ub.rs:22:9 | LL | compare_bytes([1, 2, 3].as_ptr(), [1, 2, 3, 4].as_ptr(), 4) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ memory access failed: ALLOC0 has size 3, so pointer to 4 bytes starting at offset 0 is out-of-bounds + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ memory access failed: expected a pointer to 4 bytes of memory, but got ALLOC0 and there are only 3 bytes starting at that pointer error[E0080]: evaluation of constant value failed --> $DIR/const-compare-bytes-ub.rs:26:9 | LL | compare_bytes([1, 2, 3, 4].as_ptr(), [1, 2, 3].as_ptr(), 4) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ memory access failed: ALLOC1 has size 3, so pointer to 4 bytes starting at offset 0 is out-of-bounds + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ memory access failed: expected a pointer to 4 bytes of memory, but got ALLOC1 and there are only 3 bytes starting at that pointer error[E0080]: evaluation of constant value failed --> $DIR/const-compare-bytes-ub.rs:30:9 diff --git a/tests/ui/consts/const-deref-ptr.stderr b/tests/ui/consts/const-deref-ptr.stderr index b102b4d17cc..070685e0b9d 100644 --- a/tests/ui/consts/const-deref-ptr.stderr +++ b/tests/ui/consts/const-deref-ptr.stderr @@ -2,7 +2,7 @@ error[E0080]: could not evaluate static initializer --> $DIR/const-deref-ptr.rs:4:29 | LL | static C: u64 = unsafe {*(0xdeadbeef as *const u64)}; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ memory access failed: 0xdeadbeef[noalloc] is a dangling pointer (it has no provenance) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ memory access failed: expected a pointer to 8 bytes of memory, but got 0xdeadbeef[noalloc] which is a dangling pointer (it has no provenance) error: aborting due to 1 previous error diff --git a/tests/ui/consts/const-eval/const_raw_ptr_ops2.stderr b/tests/ui/consts/const-eval/const_raw_ptr_ops2.stderr index e6cd25e42ff..b0c864652e5 100644 --- a/tests/ui/consts/const-eval/const_raw_ptr_ops2.stderr +++ b/tests/ui/consts/const-eval/const_raw_ptr_ops2.stderr @@ -2,13 +2,13 @@ error[E0080]: evaluation of constant value failed --> $DIR/const_raw_ptr_ops2.rs:7:26 | LL | const Z2: i32 = unsafe { *(42 as *const i32) }; - | ^^^^^^^^^^^^^^^^^^^ memory access failed: 0x2a[noalloc] is a dangling pointer (it has no provenance) + | ^^^^^^^^^^^^^^^^^^^ memory access failed: expected a pointer to 4 bytes of memory, but got 0x2a[noalloc] which is a dangling pointer (it has no provenance) error[E0080]: evaluation of constant value failed --> $DIR/const_raw_ptr_ops2.rs:9:26 | LL | const Z3: i32 = unsafe { *(44 as *const i32) }; - | ^^^^^^^^^^^^^^^^^^^ memory access failed: 0x2c[noalloc] is a dangling pointer (it has no provenance) + | ^^^^^^^^^^^^^^^^^^^ memory access failed: expected a pointer to 4 bytes of memory, but got 0x2c[noalloc] which is a dangling pointer (it has no provenance) error: aborting due to 2 previous errors diff --git a/tests/ui/consts/const-eval/nonnull_as_ref_ub.stderr b/tests/ui/consts/const-eval/nonnull_as_ref_ub.stderr index b878c8d1b37..bd6dafb9366 100644 --- a/tests/ui/consts/const-eval/nonnull_as_ref_ub.stderr +++ b/tests/ui/consts/const-eval/nonnull_as_ref_ub.stderr @@ -2,7 +2,7 @@ error[E0080]: evaluation of constant value failed --> $DIR/nonnull_as_ref_ub.rs:4:29 | LL | const _: () = assert!(42 == *unsafe { NON_NULL.as_ref() }); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ memory access failed: 0x1[noalloc] is a dangling pointer (it has no provenance) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ memory access failed: expected a pointer to 1 byte of memory, but got 0x1[noalloc] which is a dangling pointer (it has no provenance) error: aborting due to 1 previous error diff --git a/tests/ui/consts/const-eval/raw-bytes.32bit.stderr b/tests/ui/consts/const-eval/raw-bytes.32bit.stderr index d7d24f373eb..25f17f9c38a 100644 --- a/tests/ui/consts/const-eval/raw-bytes.32bit.stderr +++ b/tests/ui/consts/const-eval/raw-bytes.32bit.stderr @@ -440,7 +440,7 @@ error[E0080]: evaluation of constant value failed --> $DIR/raw-bytes.rs:196:62 | LL | const RAW_TRAIT_OBJ_VTABLE_NULL: *const dyn Trait = unsafe { mem::transmute((&92u8, 0usize)) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds pointer use: null pointer is a dangling pointer (it has no provenance) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds pointer use: expected a pointer to some allocation, but got a null pointer error[E0080]: evaluation of constant value failed --> $DIR/raw-bytes.rs:199:65 diff --git a/tests/ui/consts/const-eval/raw-bytes.64bit.stderr b/tests/ui/consts/const-eval/raw-bytes.64bit.stderr index 22679acda98..0fb9694895d 100644 --- a/tests/ui/consts/const-eval/raw-bytes.64bit.stderr +++ b/tests/ui/consts/const-eval/raw-bytes.64bit.stderr @@ -440,7 +440,7 @@ error[E0080]: evaluation of constant value failed --> $DIR/raw-bytes.rs:196:62 | LL | const RAW_TRAIT_OBJ_VTABLE_NULL: *const dyn Trait = unsafe { mem::transmute((&92u8, 0usize)) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds pointer use: null pointer is a dangling pointer (it has no provenance) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds pointer use: expected a pointer to some allocation, but got a null pointer error[E0080]: evaluation of constant value failed --> $DIR/raw-bytes.rs:199:65 diff --git a/tests/ui/consts/const-eval/raw-pointer-ub.rs b/tests/ui/consts/const-eval/raw-pointer-ub.rs index 47105de453c..5aced5b1bd6 100644 --- a/tests/ui/consts/const-eval/raw-pointer-ub.rs +++ b/tests/ui/consts/const-eval/raw-pointer-ub.rs @@ -39,7 +39,7 @@ const OOB: () = unsafe { let mem = [0u32; 1]; let ptr = mem.as_ptr().cast::<u64>(); let _val = *ptr; //~ERROR: evaluation of constant value failed - //~^NOTE: size 4, so pointer to 8 bytes starting at offset 0 is out-of-bounds + //~^NOTE: expected a pointer to 8 bytes of memory }; fn main() {} diff --git a/tests/ui/consts/const-eval/raw-pointer-ub.stderr b/tests/ui/consts/const-eval/raw-pointer-ub.stderr index cba06fdc639..5fce25701bd 100644 --- a/tests/ui/consts/const-eval/raw-pointer-ub.stderr +++ b/tests/ui/consts/const-eval/raw-pointer-ub.stderr @@ -35,7 +35,7 @@ error[E0080]: evaluation of constant value failed --> $DIR/raw-pointer-ub.rs:41:16 | LL | let _val = *ptr; - | ^^^^ memory access failed: ALLOC0 has size 4, so pointer to 8 bytes starting at offset 0 is out-of-bounds + | ^^^^ memory access failed: expected a pointer to 8 bytes of memory, but got ALLOC0 and there are only 4 bytes starting at that pointer error: aborting due to 5 previous errors diff --git a/tests/ui/consts/const-eval/ub-nonnull.stderr b/tests/ui/consts/const-eval/ub-nonnull.stderr index ab0fb2abdb3..fe3060dda17 100644 --- a/tests/ui/consts/const-eval/ub-nonnull.stderr +++ b/tests/ui/consts/const-eval/ub-nonnull.stderr @@ -13,7 +13,7 @@ error[E0080]: evaluation of constant value failed --> $DIR/ub-nonnull.rs:20:29 | LL | let out_of_bounds_ptr = &ptr[255]; - | ^^^^^^^^^ out-of-bounds pointer arithmetic: ALLOC1 has size 1, so pointer to 255 bytes starting at offset 0 is out-of-bounds + | ^^^^^^^^^ out-of-bounds pointer arithmetic: expected a pointer to 255 bytes of memory, but got ALLOC1 and there are only 1 bytes starting at that pointer error[E0080]: it is undefined behavior to use this value --> $DIR/ub-nonnull.rs:24:1 diff --git a/tests/ui/consts/const-eval/ub-wide-ptr.stderr b/tests/ui/consts/const-eval/ub-wide-ptr.stderr index 4fe744265df..c29cc836fff 100644 --- a/tests/ui/consts/const-eval/ub-wide-ptr.stderr +++ b/tests/ui/consts/const-eval/ub-wide-ptr.stderr @@ -262,7 +262,7 @@ error[E0080]: evaluation of constant value failed --> $DIR/ub-wide-ptr.rs:144:62 | LL | const RAW_TRAIT_OBJ_VTABLE_NULL: *const dyn Trait = unsafe { mem::transmute((&92u8, 0usize)) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds pointer use: null pointer is a dangling pointer (it has no provenance) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds pointer use: expected a pointer to some allocation, but got a null pointer error[E0080]: evaluation of constant value failed --> $DIR/ub-wide-ptr.rs:147:65 @@ -274,7 +274,7 @@ error[E0080]: could not evaluate static initializer --> $DIR/ub-wide-ptr.rs:156:5 | LL | mem::transmute::<_, &dyn Trait>((&92u8, 0usize)) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds pointer use: null pointer is a dangling pointer (it has no provenance) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds pointer use: expected a pointer to some allocation, but got a null pointer error[E0080]: could not evaluate static initializer --> $DIR/ub-wide-ptr.rs:161:5 diff --git a/tests/ui/consts/copy-intrinsic.rs b/tests/ui/consts/copy-intrinsic.rs index 4183dc0fcd6..e3f43ce2037 100644 --- a/tests/ui/consts/copy-intrinsic.rs +++ b/tests/ui/consts/copy-intrinsic.rs @@ -27,7 +27,7 @@ const COPY_OOB_1: () = unsafe { copy_nonoverlapping(0x100 as *const i32, dangle, 0); // Non-zero-sized copy is not. copy_nonoverlapping(0x100 as *const i32, dangle, 1); //~ ERROR evaluation of constant value failed [E0080] - //~| 0x100[noalloc] is a dangling pointer + //~| got 0x100[noalloc] which is a dangling pointer }; const COPY_OOB_2: () = unsafe { let x = 0i32; @@ -36,7 +36,7 @@ const COPY_OOB_2: () = unsafe { copy_nonoverlapping(dangle, 0x100 as *mut i32, 0); // Non-zero-sized copy is not. copy_nonoverlapping(dangle, 0x100 as *mut i32, 1); //~ ERROR evaluation of constant value failed [E0080] - //~| offset 40 is out-of-bounds + //~| +0x28 which is at or beyond the end of the allocation }; const COPY_SIZE_OVERFLOW: () = unsafe { diff --git a/tests/ui/consts/copy-intrinsic.stderr b/tests/ui/consts/copy-intrinsic.stderr index d34e61cd962..2dbb471131e 100644 --- a/tests/ui/consts/copy-intrinsic.stderr +++ b/tests/ui/consts/copy-intrinsic.stderr @@ -2,13 +2,13 @@ error[E0080]: evaluation of constant value failed --> $DIR/copy-intrinsic.rs:29:5 | LL | copy_nonoverlapping(0x100 as *const i32, dangle, 1); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ memory access failed: 0x100[noalloc] is a dangling pointer (it has no provenance) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ memory access failed: expected a pointer to 4 bytes of memory, but got 0x100[noalloc] which is a dangling pointer (it has no provenance) error[E0080]: evaluation of constant value failed --> $DIR/copy-intrinsic.rs:38:5 | LL | copy_nonoverlapping(dangle, 0x100 as *mut i32, 1); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ memory access failed: ALLOC0 has size 4, so pointer to 4 bytes starting at offset 40 is out-of-bounds + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ memory access failed: expected a pointer to 4 bytes of memory, but got ALLOC0+0x28 which is at or beyond the end of the allocation of size 4 bytes error[E0080]: evaluation of constant value failed --> $DIR/copy-intrinsic.rs:45:5 diff --git a/tests/ui/consts/offset_from_ub.rs b/tests/ui/consts/offset_from_ub.rs index 1506c212fba..66bb056ceb0 100644 --- a/tests/ui/consts/offset_from_ub.rs +++ b/tests/ui/consts/offset_from_ub.rs @@ -1,3 +1,4 @@ +//@ normalize-stderr-test: "to \d+ bytes of memory" -> "to $$BYTES bytes of memory" #![feature(const_ptr_sub_ptr)] #![feature(core_intrinsics)] @@ -36,7 +37,7 @@ pub const DIFFERENT_INT: isize = { // offset_from with two different integers: l let ptr1 = 8 as *const u8; let ptr2 = 16 as *const u8; unsafe { ptr_offset_from(ptr2, ptr1) } //~ERROR evaluation of constant value failed - //~| different pointers without provenance + //~| dangling pointer }; const OUT_OF_BOUNDS_1: isize = { @@ -45,7 +46,7 @@ const OUT_OF_BOUNDS_1: isize = { let end_ptr = (start_ptr).wrapping_add(length); // First ptr is out of bounds unsafe { ptr_offset_from(end_ptr, start_ptr) } //~ERROR evaluation of constant value failed - //~| pointer to 10 bytes starting at offset 0 is out-of-bounds + //~| expected a pointer to 10 bytes of memory }; const OUT_OF_BOUNDS_2: isize = { @@ -54,7 +55,7 @@ const OUT_OF_BOUNDS_2: isize = { let end_ptr = (start_ptr).wrapping_add(length); // Second ptr is out of bounds unsafe { ptr_offset_from(start_ptr, end_ptr) } //~ERROR evaluation of constant value failed - //~| pointer to 10 bytes starting at offset 0 is out-of-bounds + //~| expected a pointer to 10 bytes of memory }; pub const DIFFERENT_ALLOC_UNSIGNED: usize = { diff --git a/tests/ui/consts/offset_from_ub.stderr b/tests/ui/consts/offset_from_ub.stderr index 7b623126d54..f2f27735630 100644 --- a/tests/ui/consts/offset_from_ub.stderr +++ b/tests/ui/consts/offset_from_ub.stderr @@ -1,5 +1,5 @@ error[E0080]: evaluation of constant value failed - --> $DIR/offset_from_ub.rs:18:27 + --> $DIR/offset_from_ub.rs:19:27 | LL | let offset = unsafe { ptr_offset_from(field_ptr, base_ptr) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `ptr_offset_from` called on pointers into different allocations @@ -12,67 +12,67 @@ error[E0080]: evaluation of constant value failed note: inside `std::ptr::const_ptr::<impl *const u8>::offset_from` --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL note: inside `NOT_PTR` - --> $DIR/offset_from_ub.rs:24:14 + --> $DIR/offset_from_ub.rs:25:14 | LL | unsafe { (42 as *const u8).offset_from(&5u8) as usize } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0080]: evaluation of constant value failed - --> $DIR/offset_from_ub.rs:31:14 + --> $DIR/offset_from_ub.rs:32:14 | LL | unsafe { ptr_offset_from(field_ptr, base_ptr as *const u16) } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ exact_div: 1_isize cannot be divided by 2_isize without remainder error[E0080]: evaluation of constant value failed - --> $DIR/offset_from_ub.rs:38:14 + --> $DIR/offset_from_ub.rs:39:14 | LL | unsafe { ptr_offset_from(ptr2, ptr1) } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ `ptr_offset_from` called on different pointers without provenance (i.e., without an associated allocation) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds `offset_from`: expected a pointer to $BYTES bytes of memory, but got 0x8[noalloc] which is a dangling pointer (it has no provenance) error[E0080]: evaluation of constant value failed - --> $DIR/offset_from_ub.rs:47:14 + --> $DIR/offset_from_ub.rs:48:14 | LL | unsafe { ptr_offset_from(end_ptr, start_ptr) } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds `offset_from`: ALLOC0 has size 4, so pointer to 10 bytes starting at offset 0 is out-of-bounds + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds `offset_from`: expected a pointer to $BYTES bytes of memory, but got ALLOC0 and there are only 4 bytes starting at that pointer error[E0080]: evaluation of constant value failed - --> $DIR/offset_from_ub.rs:56:14 + --> $DIR/offset_from_ub.rs:57:14 | LL | unsafe { ptr_offset_from(start_ptr, end_ptr) } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds `offset_from`: ALLOC1 has size 4, so pointer to 10 bytes starting at offset 0 is out-of-bounds + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds `offset_from`: expected a pointer to $BYTES bytes of memory, but got ALLOC1 and there are only 4 bytes starting at that pointer error[E0080]: evaluation of constant value failed - --> $DIR/offset_from_ub.rs:65:14 + --> $DIR/offset_from_ub.rs:66:14 | LL | unsafe { ptr_offset_from_unsigned(field_ptr, base_ptr) } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `ptr_offset_from_unsigned` called on pointers into different allocations error[E0080]: evaluation of constant value failed - --> $DIR/offset_from_ub.rs:72:14 + --> $DIR/offset_from_ub.rs:73:14 | LL | unsafe { ptr_offset_from(ptr2, ptr1) } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ `ptr_offset_from` called when first pointer is too far ahead of second error[E0080]: evaluation of constant value failed - --> $DIR/offset_from_ub.rs:78:14 + --> $DIR/offset_from_ub.rs:79:14 | LL | unsafe { ptr_offset_from(ptr1, ptr2) } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ `ptr_offset_from` called when first pointer is too far before second error[E0080]: evaluation of constant value failed - --> $DIR/offset_from_ub.rs:86:14 + --> $DIR/offset_from_ub.rs:87:14 | LL | unsafe { ptr_offset_from(ptr1, ptr2) } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ `ptr_offset_from` called when first pointer is too far before second error[E0080]: evaluation of constant value failed - --> $DIR/offset_from_ub.rs:93:14 + --> $DIR/offset_from_ub.rs:94:14 | LL | unsafe { ptr_offset_from_unsigned(p, p.add(2) ) } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `ptr_offset_from_unsigned` called when first pointer has smaller offset than second: 0 < 8 error[E0080]: evaluation of constant value failed - --> $DIR/offset_from_ub.rs:100:14 + --> $DIR/offset_from_ub.rs:101:14 | LL | unsafe { ptr_offset_from_unsigned(ptr2, ptr1) } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `ptr_offset_from_unsigned` called when first pointer is too far ahead of second @@ -80,12 +80,12 @@ LL | unsafe { ptr_offset_from_unsigned(ptr2, ptr1) } error[E0080]: evaluation of constant value failed --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL | - = note: `ptr_offset_from` called on different pointers without provenance (i.e., without an associated allocation) + = note: out-of-bounds `offset_from`: expected a pointer to $BYTES bytes of memory, but got a null pointer | note: inside `std::ptr::const_ptr::<impl *const u8>::offset_from` --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL note: inside `OFFSET_VERY_FAR1` - --> $DIR/offset_from_ub.rs:109:14 + --> $DIR/offset_from_ub.rs:110:14 | LL | unsafe { ptr2.offset_from(ptr1) } | ^^^^^^^^^^^^^^^^^^^^^^ @@ -93,12 +93,12 @@ LL | unsafe { ptr2.offset_from(ptr1) } error[E0080]: evaluation of constant value failed --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL | - = note: `ptr_offset_from` called on different pointers without provenance (i.e., without an associated allocation) + = note: `ptr_offset_from` called when first pointer is too far before second | note: inside `std::ptr::const_ptr::<impl *const u8>::offset_from` --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL note: inside `OFFSET_VERY_FAR2` - --> $DIR/offset_from_ub.rs:115:14 + --> $DIR/offset_from_ub.rs:116:14 | LL | unsafe { ptr1.offset_from(ptr2.wrapping_offset(1)) } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/consts/offset_ub.rs b/tests/ui/consts/offset_ub.rs index ebc7019a75a..b239b91e11c 100644 --- a/tests/ui/consts/offset_ub.rs +++ b/tests/ui/consts/offset_ub.rs @@ -1,7 +1,8 @@ use std::ptr; - +//@ normalize-stderr-test: "0xf+" -> "0xf..f" //@ normalize-stderr-test: "0x7f+" -> "0x7f..f" +//@ normalize-stderr-test: "to \d+ bytes of memory" -> "to $$BYTES bytes of memory" pub const BEFORE_START: *const u8 = unsafe { (&0u8 as *const u8).offset(-1) }; //~NOTE diff --git a/tests/ui/consts/offset_ub.stderr b/tests/ui/consts/offset_ub.stderr index 89371f06d9d..b42d9482f8a 100644 --- a/tests/ui/consts/offset_ub.stderr +++ b/tests/ui/consts/offset_ub.stderr @@ -6,7 +6,7 @@ error[E0080]: evaluation of constant value failed note: inside `std::ptr::const_ptr::<impl *const u8>::offset` --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL note: inside `BEFORE_START` - --> $DIR/offset_ub.rs:7:46 + --> $DIR/offset_ub.rs:8:46 | LL | pub const BEFORE_START: *const u8 = unsafe { (&0u8 as *const u8).offset(-1) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -14,12 +14,12 @@ LL | pub const BEFORE_START: *const u8 = unsafe { (&0u8 as *const u8).offset(-1) error[E0080]: evaluation of constant value failed --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL | - = note: out-of-bounds pointer arithmetic: ALLOC0 has size 1, so pointer to 2 bytes starting at offset 0 is out-of-bounds + = note: out-of-bounds pointer arithmetic: expected a pointer to $BYTES bytes of memory, but got ALLOC0 and there are only 1 bytes starting at that pointer | note: inside `std::ptr::const_ptr::<impl *const u8>::offset` --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL note: inside `AFTER_END` - --> $DIR/offset_ub.rs:8:43 + --> $DIR/offset_ub.rs:9:43 | LL | pub const AFTER_END: *const u8 = unsafe { (&0u8 as *const u8).offset(2) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -27,12 +27,12 @@ LL | pub const AFTER_END: *const u8 = unsafe { (&0u8 as *const u8).offset(2) }; error[E0080]: evaluation of constant value failed --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL | - = note: out-of-bounds pointer arithmetic: ALLOC1 has size 100, so pointer to 101 bytes starting at offset 0 is out-of-bounds + = note: out-of-bounds pointer arithmetic: expected a pointer to $BYTES bytes of memory, but got ALLOC1 and there are only 100 bytes starting at that pointer | note: inside `std::ptr::const_ptr::<impl *const u8>::offset` --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL note: inside `AFTER_ARRAY` - --> $DIR/offset_ub.rs:9:45 + --> $DIR/offset_ub.rs:10:45 | LL | pub const AFTER_ARRAY: *const u8 = unsafe { [0u8; 100].as_ptr().offset(101) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -45,7 +45,7 @@ error[E0080]: evaluation of constant value failed note: inside `std::ptr::const_ptr::<impl *const u16>::offset` --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL note: inside `OVERFLOW` - --> $DIR/offset_ub.rs:11:43 + --> $DIR/offset_ub.rs:12:43 | LL | pub const OVERFLOW: *const u16 = unsafe { [0u16; 1].as_ptr().offset(isize::MAX) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -58,7 +58,7 @@ error[E0080]: evaluation of constant value failed note: inside `std::ptr::const_ptr::<impl *const u16>::offset` --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL note: inside `UNDERFLOW` - --> $DIR/offset_ub.rs:12:44 + --> $DIR/offset_ub.rs:13:44 | LL | pub const UNDERFLOW: *const u16 = unsafe { [0u16; 1].as_ptr().offset(isize::MIN) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -71,7 +71,7 @@ error[E0080]: evaluation of constant value failed note: inside `std::ptr::const_ptr::<impl *const u8>::offset` --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL note: inside `OVERFLOW_ADDRESS_SPACE` - --> $DIR/offset_ub.rs:13:56 + --> $DIR/offset_ub.rs:14:56 | LL | pub const OVERFLOW_ADDRESS_SPACE: *const u8 = unsafe { (usize::MAX as *const u8).offset(2) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -84,7 +84,7 @@ error[E0080]: evaluation of constant value failed note: inside `std::ptr::const_ptr::<impl *const u8>::offset` --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL note: inside `UNDERFLOW_ADDRESS_SPACE` - --> $DIR/offset_ub.rs:14:57 + --> $DIR/offset_ub.rs:15:57 | LL | pub const UNDERFLOW_ADDRESS_SPACE: *const u8 = unsafe { (1 as *const u8).offset(-2) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -92,12 +92,12 @@ LL | pub const UNDERFLOW_ADDRESS_SPACE: *const u8 = unsafe { (1 as *const u8).of error[E0080]: evaluation of constant value failed --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL | - = note: out-of-bounds pointer arithmetic: ALLOC2 has size 1, so pointer to 2 bytes starting at offset -4 is out-of-bounds + = note: out-of-bounds pointer arithmetic: expected a pointer to $BYTES bytes of memory, but got ALLOC2-0x4 which points to before the beginning of the allocation | note: inside `std::ptr::const_ptr::<impl *const u8>::offset` --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL note: inside `NEGATIVE_OFFSET` - --> $DIR/offset_ub.rs:15:49 + --> $DIR/offset_ub.rs:16:49 | LL | pub const NEGATIVE_OFFSET: *const u8 = unsafe { [0u8; 1].as_ptr().wrapping_offset(-2).offset(-2) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -105,12 +105,12 @@ LL | pub const NEGATIVE_OFFSET: *const u8 = unsafe { [0u8; 1].as_ptr().wrapping_ error[E0080]: evaluation of constant value failed --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL | - = note: out-of-bounds pointer arithmetic: ALLOC3 has size 0, so pointer to 1 byte starting at offset 0 is out-of-bounds + = note: out-of-bounds pointer arithmetic: expected a pointer to 1 byte of memory, but got ALLOC3 which is at or beyond the end of the allocation of size 0 bytes | note: inside `std::ptr::const_ptr::<impl *const u8>::offset` --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL note: inside `ZERO_SIZED_ALLOC` - --> $DIR/offset_ub.rs:17:50 + --> $DIR/offset_ub.rs:18:50 | LL | pub const ZERO_SIZED_ALLOC: *const u8 = unsafe { [0u8; 0].as_ptr().offset(1) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -118,12 +118,12 @@ LL | pub const ZERO_SIZED_ALLOC: *const u8 = unsafe { [0u8; 0].as_ptr().offset(1 error[E0080]: evaluation of constant value failed --> $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL | - = note: out-of-bounds pointer arithmetic: 0x1[noalloc] is a dangling pointer (it has no provenance) + = note: out-of-bounds pointer arithmetic: expected a pointer to $BYTES bytes of memory, but got 0x1[noalloc] which is a dangling pointer (it has no provenance) | note: inside `std::ptr::mut_ptr::<impl *mut u8>::offset` --> $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL note: inside `DANGLING` - --> $DIR/offset_ub.rs:18:42 + --> $DIR/offset_ub.rs:19:42 | LL | pub const DANGLING: *const u8 = unsafe { ptr::NonNull::<u8>::dangling().as_ptr().offset(4) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -131,12 +131,12 @@ LL | pub const DANGLING: *const u8 = unsafe { ptr::NonNull::<u8>::dangling().as_ error[E0080]: evaluation of constant value failed --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL | - = note: out-of-bounds pointer arithmetic: 0x7f..f[noalloc] is a dangling pointer (it has no provenance) + = note: out-of-bounds pointer arithmetic: expected a pointer to $BYTES bytes of memory, but got 0x7f..f[noalloc] which is a dangling pointer (it has no provenance) | note: inside `std::ptr::const_ptr::<impl *const u8>::offset` --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL note: inside `UNDERFLOW_ABS` - --> $DIR/offset_ub.rs:21:47 + --> $DIR/offset_ub.rs:22:47 | LL | pub const UNDERFLOW_ABS: *const u8 = unsafe { (usize::MAX as *const u8).offset(isize::MIN) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/delegation/explicit-paths.rs b/tests/ui/delegation/explicit-paths.rs index d42e305b252..3b0454eb524 100644 --- a/tests/ui/delegation/explicit-paths.rs +++ b/tests/ui/delegation/explicit-paths.rs @@ -22,9 +22,7 @@ mod fn_to_other { use super::*; reuse Trait::foo1; - //~^ ERROR delegation to a trait method from a free function is not supported yet reuse <S as Trait>::foo2; - //~^ ERROR delegation to a trait method from a free function is not supported yet reuse to_reuse::foo3; reuse S::foo4; //~^ ERROR cannot find function `foo4` in `S` diff --git a/tests/ui/delegation/explicit-paths.stderr b/tests/ui/delegation/explicit-paths.stderr index b5afe19f878..8098ea8c54f 100644 --- a/tests/ui/delegation/explicit-paths.stderr +++ b/tests/ui/delegation/explicit-paths.stderr @@ -1,5 +1,5 @@ error[E0407]: method `foo3` is not a member of trait `Trait` - --> $DIR/explicit-paths.rs:51:9 + --> $DIR/explicit-paths.rs:49:9 | LL | reuse to_reuse::foo3; | ^^^^^^^^^^^^^^^^----^ @@ -8,7 +8,7 @@ LL | reuse to_reuse::foo3; | not a member of trait `Trait` error[E0407]: method `foo4` is not a member of trait `Trait` - --> $DIR/explicit-paths.rs:53:9 + --> $DIR/explicit-paths.rs:51:9 | LL | reuse F::foo4 { &self.0 } | ^^^^^^^^^----^^^^^^^^^^^^ @@ -17,49 +17,49 @@ LL | reuse F::foo4 { &self.0 } | not a member of trait `Trait` error[E0425]: cannot find function `foo4` in `S` - --> $DIR/explicit-paths.rs:29:14 + --> $DIR/explicit-paths.rs:27:14 | LL | reuse S::foo4; | ^^^^ not found in `S` error[E0425]: cannot find function `foo4` in `F` - --> $DIR/explicit-paths.rs:40:18 + --> $DIR/explicit-paths.rs:38:18 | LL | reuse F::foo4 { &self.0 } | ^^^^ not found in `F` | note: function `fn_to_other::foo4` exists but is inaccessible - --> $DIR/explicit-paths.rs:29:5 + --> $DIR/explicit-paths.rs:27:5 | LL | reuse S::foo4; | ^^^^^^^^^^^^^^ not accessible error[E0425]: cannot find function `foo4` in `F` - --> $DIR/explicit-paths.rs:53:18 + --> $DIR/explicit-paths.rs:51:18 | LL | reuse F::foo4 { &self.0 } | ^^^^ not found in `F` | note: function `fn_to_other::foo4` exists but is inaccessible - --> $DIR/explicit-paths.rs:29:5 + --> $DIR/explicit-paths.rs:27:5 | LL | reuse S::foo4; | ^^^^^^^^^^^^^^ not accessible error[E0425]: cannot find function `foo4` in `F` - --> $DIR/explicit-paths.rs:67:18 + --> $DIR/explicit-paths.rs:65:18 | LL | reuse F::foo4 { &F } | ^^^^ not found in `F` | note: function `fn_to_other::foo4` exists but is inaccessible - --> $DIR/explicit-paths.rs:29:5 + --> $DIR/explicit-paths.rs:27:5 | LL | reuse S::foo4; | ^^^^^^^^^^^^^^ not accessible error[E0119]: conflicting implementations of trait `Trait` for type `S` - --> $DIR/explicit-paths.rs:76:5 + --> $DIR/explicit-paths.rs:74:5 | LL | impl Trait for S { | ---------------- first implementation here @@ -67,26 +67,8 @@ LL | impl Trait for S { LL | impl Trait for S { | ^^^^^^^^^^^^^^^^ conflicting implementation for `S` -error: delegation to a trait method from a free function is not supported yet - --> $DIR/explicit-paths.rs:24:18 - | -LL | fn foo1(&self, x: i32) -> i32 { x } - | ----------------------------- callee defined here -... -LL | reuse Trait::foo1; - | ^^^^ - -error: delegation to a trait method from a free function is not supported yet - --> $DIR/explicit-paths.rs:26:25 - | -LL | fn foo2(x: i32) -> i32 { x } - | ---------------------- callee defined here -... -LL | reuse <S as Trait>::foo2; - | ^^^^ - error[E0308]: mismatched types - --> $DIR/explicit-paths.rs:63:36 + --> $DIR/explicit-paths.rs:61:36 | LL | trait Trait2 : Trait { | -------------------- found this type parameter @@ -104,7 +86,7 @@ LL | fn foo1(&self, x: i32) -> i32 { x } | ^^^^ ----- error[E0277]: the trait bound `S2: Trait` is not satisfied - --> $DIR/explicit-paths.rs:78:16 + --> $DIR/explicit-paths.rs:76:16 | LL | reuse <S2 as Trait>::foo1; | ^^ the trait `Trait` is not implemented for `S2` @@ -114,7 +96,7 @@ LL | reuse <S2 as Trait>::foo1; S error[E0308]: mismatched types - --> $DIR/explicit-paths.rs:78:30 + --> $DIR/explicit-paths.rs:76:30 | LL | reuse <S2 as Trait>::foo1; | ^^^^ @@ -130,7 +112,7 @@ note: method defined here LL | fn foo1(&self, x: i32) -> i32 { x } | ^^^^ ----- -error: aborting due to 12 previous errors +error: aborting due to 10 previous errors Some errors have detailed explanations: E0119, E0277, E0308, E0407, E0425. For more information about an error, try `rustc --explain E0119`. diff --git a/tests/ui/delegation/generics/free-fn-to-free-fn-pass.rs b/tests/ui/delegation/generics/free-fn-to-free-fn-pass.rs new file mode 100644 index 00000000000..625bbdd758c --- /dev/null +++ b/tests/ui/delegation/generics/free-fn-to-free-fn-pass.rs @@ -0,0 +1,28 @@ +//@ run-pass +#![feature(fn_delegation)] +#![allow(incomplete_features)] + +mod to_reuse { + pub fn types<T, U>(x: U, y: T) -> (T, U) { + (y, x) + } + pub fn late<'a, 'b>(x: &'a u8, y: &'b u8) -> u8 { + *x + *y + } + pub fn early<'a: 'a>(x: &'a str) -> &'a str { + x + } +} + +reuse to_reuse::types; +reuse to_reuse::late; +reuse to_reuse::early; + +fn main() { + assert_eq!(types(0, "str"), ("str", 0)); + assert_eq!(late(&1u8, &2u8), 3); + { + let s: &'static str = "hello world"; + assert_eq!(early::<'static>(s), "hello world"); + } +} diff --git a/tests/ui/delegation/generics/free-fn-to-free-fn.rs b/tests/ui/delegation/generics/free-fn-to-free-fn.rs new file mode 100644 index 00000000000..3741ad66485 --- /dev/null +++ b/tests/ui/delegation/generics/free-fn-to-free-fn.rs @@ -0,0 +1,27 @@ +#![feature(fn_delegation)] +#![allow(incomplete_features)] + +mod to_reuse { + pub fn consts<const N: i32>() -> i32 { + N + } + pub fn late<'a>(x: &'a u8) -> u8 { + *x + } + pub fn bounds<T: Clone>(_: T) {} +} + +// FIXME(fn_delegation): this is supposed to work eventually +reuse to_reuse::consts; +//~^ ERROR type annotations needed +reuse to_reuse::late; +reuse to_reuse::bounds; + +fn main() { + late::<'static>(&0u8); + //~^ ERROR cannot specify lifetime arguments explicitly if late bound lifetime parameters are present + + struct S; + bounds(S); + //~^ ERROR the trait bound `S: Clone` is not satisfied +} diff --git a/tests/ui/delegation/generics/free-fn-to-free-fn.stderr b/tests/ui/delegation/generics/free-fn-to-free-fn.stderr new file mode 100644 index 00000000000..5ba56ce1718 --- /dev/null +++ b/tests/ui/delegation/generics/free-fn-to-free-fn.stderr @@ -0,0 +1,54 @@ +error[E0284]: type annotations needed + --> $DIR/free-fn-to-free-fn.rs:15:17 + | +LL | reuse to_reuse::consts; + | ^^^^^^ cannot infer the value of the const parameter `N` declared on the function `consts` + | +note: required by a const generic parameter in `to_reuse::consts` + --> $DIR/free-fn-to-free-fn.rs:5:19 + | +LL | pub fn consts<const N: i32>() -> i32 { + | ^^^^^^^^^^^^ required by this const generic parameter in `consts` +help: consider specifying the generic argument + | +LL | reuse to_reuse::consts::<N>; + | +++++ + +error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present + --> $DIR/free-fn-to-free-fn.rs:21:12 + | +LL | late::<'static>(&0u8); + | ^^^^^^^ + | +note: the late bound lifetime parameter is introduced here + --> $DIR/free-fn-to-free-fn.rs:8:17 + | +LL | pub fn late<'a>(x: &'a u8) -> u8 { + | ^^ + +error[E0277]: the trait bound `S: Clone` is not satisfied + --> $DIR/free-fn-to-free-fn.rs:25:12 + | +LL | bounds(S); + | ------ ^ the trait `Clone` is not implemented for `S` + | | + | required by a bound introduced by this call + | +note: required by a bound in `bounds` + --> $DIR/free-fn-to-free-fn.rs:11:22 + | +LL | pub fn bounds<T: Clone>(_: T) {} + | ^^^^^ required by this bound in `bounds` +... +LL | reuse to_reuse::bounds; + | ------ required by a bound in this function +help: consider annotating `S` with `#[derive(Clone)]` + | +LL + #[derive(Clone)] +LL | struct S; + | + +error: aborting due to 3 previous errors + +Some errors have detailed explanations: E0277, E0284, E0794. +For more information about an error, try `rustc --explain E0277`. diff --git a/tests/ui/delegation/generics/free-fn-to-trait-method-pass.rs b/tests/ui/delegation/generics/free-fn-to-trait-method-pass.rs new file mode 100644 index 00000000000..f7b7c09e2ca --- /dev/null +++ b/tests/ui/delegation/generics/free-fn-to-trait-method-pass.rs @@ -0,0 +1,30 @@ +//@ run-pass +#![feature(fn_delegation)] +#![allow(incomplete_features)] + +mod types { + pub trait Trait<T> { + fn foo<U>(&self, x: U, y: T) -> (T, U) {(y, x)} + } + impl<T> Trait<T> for u8 {} +} + +mod types_and_lifetimes { + pub trait Trait<'a, T> { + fn foo<'b, U>(&self, _: &'b U, _: &'a T) -> bool { + true + } + } + impl<'a, T> Trait<'a, T> for u8 {} +} + +reuse types::Trait::foo as types; +reuse types_and_lifetimes::Trait::foo as types_and_lifetimes; + +fn main() { + assert_eq!(types(&2, "str", 1), (1, "str")); + + struct T; + struct U; + assert_eq!(types_and_lifetimes::<u8, T, U>(&1, &U, &T), true); +} diff --git a/tests/ui/delegation/generics/free-fn-to-trait-method.rs b/tests/ui/delegation/generics/free-fn-to-trait-method.rs new file mode 100644 index 00000000000..70be1a4ace7 --- /dev/null +++ b/tests/ui/delegation/generics/free-fn-to-trait-method.rs @@ -0,0 +1,56 @@ +#![feature(fn_delegation)] +#![allow(incomplete_features)] + +mod default_param { + pub trait Trait<T = u32> { + fn foo(&self, _: T) {} + } + + impl<T> Trait<T> for u8 {} +} + +mod types_and_lifetimes { + pub trait Trait<'a, T> { + fn foo<'b: 'b>(&'a self, x: &'b T) { + loop {} + } + } + impl<'a, T> Trait<'a, T> for u8 {} +} + +mod bounds { + pub trait Trait<T> { + fn foo<U: Clone>(&self, t: T, u: U) where T: Copy {} + } + + impl<T> Trait<T> for u8 {} +} + +mod generic_arguments { + trait Trait<T> { + fn foo<U>(&self, _: U, _: T) {} + } + + impl<T> Trait<T> for u8 {} + + reuse Trait::<_>::foo::<i32> as generic_arguments1; + //~^ ERROR mismatched types + reuse <u8 as Trait<_>>::foo as generic_arguments2; + //~^ ERROR mismatched types + reuse <_ as Trait<_>>::foo as generic_arguments3; // OK +} + +reuse default_param::Trait::foo as default_param; +reuse types_and_lifetimes::Trait::foo as types_and_lifetimes; +reuse bounds::Trait::foo as bounds; + +fn main() { + default_param(&0u8, "hello world"); // OK, default params are not substituted + types_and_lifetimes::<'static, 'static, _, _>(&0u8, &0u16); // OK, lifetimes go first + + struct S; + struct U; + bounds(&0u8, S, U); + //~^ ERROR the trait bound `S: Copy` is not satisfied + //~| ERROR the trait bound `U: Clone` is not satisfied +} diff --git a/tests/ui/delegation/generics/free-fn-to-trait-method.stderr b/tests/ui/delegation/generics/free-fn-to-trait-method.stderr new file mode 100644 index 00000000000..d8299d00c7e --- /dev/null +++ b/tests/ui/delegation/generics/free-fn-to-trait-method.stderr @@ -0,0 +1,88 @@ +error[E0308]: mismatched types + --> $DIR/free-fn-to-trait-method.rs:36:23 + | +LL | fn foo<U>(&self, _: U, _: T) {} + | - found this type parameter +... +LL | reuse Trait::<_>::foo::<i32> as generic_arguments1; + | ^^^ + | | + | expected `i32`, found type parameter `U` + | arguments to this function are incorrect + | + = note: expected type `i32` + found type parameter `U` +note: method defined here + --> $DIR/free-fn-to-trait-method.rs:31:12 + | +LL | fn foo<U>(&self, _: U, _: T) {} + | ^^^ ---- + +error[E0308]: mismatched types + --> $DIR/free-fn-to-trait-method.rs:38:29 + | +LL | trait Trait<T> { + | -------------- found this type parameter +... +LL | reuse <u8 as Trait<_>>::foo as generic_arguments2; + | ^^^ + | | + | expected `&u8`, found `&Self` + | arguments to this function are incorrect + | + = note: expected reference `&u8` + found reference `&Self` +note: method defined here + --> $DIR/free-fn-to-trait-method.rs:31:12 + | +LL | fn foo<U>(&self, _: U, _: T) {} + | ^^^ ----- + +error[E0277]: the trait bound `S: Copy` is not satisfied + --> $DIR/free-fn-to-trait-method.rs:53:18 + | +LL | bounds(&0u8, S, U); + | ------ ^ the trait `Copy` is not implemented for `S` + | | + | required by a bound introduced by this call + | +note: required by a bound in `bounds` + --> $DIR/free-fn-to-trait-method.rs:23:54 + | +LL | fn foo<U: Clone>(&self, t: T, u: U) where T: Copy {} + | ^^^^ required by this bound in `bounds` +... +LL | reuse bounds::Trait::foo as bounds; + | ------ required by a bound in this function +help: consider annotating `S` with `#[derive(Copy)]` + | +LL + #[derive(Copy)] +LL | struct S; + | + +error[E0277]: the trait bound `U: Clone` is not satisfied + --> $DIR/free-fn-to-trait-method.rs:53:21 + | +LL | bounds(&0u8, S, U); + | ------ ^ the trait `Clone` is not implemented for `U` + | | + | required by a bound introduced by this call + | +note: required by a bound in `bounds` + --> $DIR/free-fn-to-trait-method.rs:23:19 + | +LL | fn foo<U: Clone>(&self, t: T, u: U) where T: Copy {} + | ^^^^^ required by this bound in `bounds` +... +LL | reuse bounds::Trait::foo as bounds; + | ------ required by a bound in this function +help: consider annotating `U` with `#[derive(Clone)]` + | +LL + #[derive(Clone)] +LL | struct U; + | + +error: aborting due to 4 previous errors + +Some errors have detailed explanations: E0277, E0308. +For more information about an error, try `rustc --explain E0277`. diff --git a/tests/ui/delegation/ice-issue-124347.rs b/tests/ui/delegation/ice-issue-124347.rs index 82a96055099..3bfae8face5 100644 --- a/tests/ui/delegation/ice-issue-124347.rs +++ b/tests/ui/delegation/ice-issue-124347.rs @@ -6,7 +6,8 @@ trait Trait { //~^ ERROR recursive delegation is not supported yet } +// FIXME(fn_delegation): `recursive delegation` error should be emitted here reuse foo; -//~^ ERROR recursive delegation is not supported yet +//~^ ERROR cycle detected when computing generics of `foo` fn main() {} diff --git a/tests/ui/delegation/ice-issue-124347.stderr b/tests/ui/delegation/ice-issue-124347.stderr index 5a3f4525d29..87dd75ffec8 100644 --- a/tests/ui/delegation/ice-issue-124347.stderr +++ b/tests/ui/delegation/ice-issue-124347.stderr @@ -4,11 +4,20 @@ error: recursive delegation is not supported yet LL | reuse Trait::foo { &self.0 } | ^^^ callee defined here -error: recursive delegation is not supported yet - --> $DIR/ice-issue-124347.rs:9:7 +error[E0391]: cycle detected when computing generics of `foo` + --> $DIR/ice-issue-124347.rs:10:7 + | +LL | reuse foo; + | ^^^ + | + = note: ...which immediately requires computing generics of `foo` again +note: cycle used when checking that `foo` is well-formed + --> $DIR/ice-issue-124347.rs:10:7 | LL | reuse foo; - | ^^^ callee defined here + | ^^^ + = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information error: aborting due to 2 previous errors +For more information about this error, try `rustc --explain E0391`. diff --git a/tests/ui/delegation/not-supported.rs b/tests/ui/delegation/not-supported.rs index 25d7a4cb895..5701cc6055d 100644 --- a/tests/ui/delegation/not-supported.rs +++ b/tests/ui/delegation/not-supported.rs @@ -1,4 +1,6 @@ +#![feature(const_trait_impl)] #![feature(c_variadic)] +#![feature(effects)] #![feature(fn_delegation)] #![allow(incomplete_features)] @@ -14,9 +16,9 @@ mod generics { fn foo3<'a: 'a>(_: &'a u32) {} reuse GenericTrait::bar; - //~^ ERROR delegation with early bound generics is not supported yet + //~^ ERROR early bound generics are not supported for associated delegation items reuse GenericTrait::bar1; - //~^ ERROR delegation with early bound generics is not supported yet + //~^ ERROR early bound generics are not supported for associated delegation items } struct F; @@ -27,37 +29,37 @@ mod generics { impl<T> GenericTrait<T> for S { reuse <F as GenericTrait<T>>::bar { &self.0 } - //~^ ERROR delegation with early bound generics is not supported yet + //~^ ERROR early bound generics are not supported for associated delegation items reuse GenericTrait::<T>::bar1; - //~^ ERROR delegation with early bound generics is not supported yet + //~^ ERROR early bound generics are not supported for associated delegation items } impl GenericTrait<()> for () { reuse GenericTrait::bar { &F } - //~^ ERROR delegation with early bound generics is not supported yet + //~^ ERROR early bound generics are not supported for associated delegation items reuse GenericTrait::bar1; - //~^ ERROR delegation with early bound generics is not supported yet + //~^ ERROR early bound generics are not supported for associated delegation items } impl Trait for &S { reuse Trait::foo; - //~^ ERROR delegation with early bound generics is not supported yet + //~^ ERROR early bound generics are not supported for associated delegation items } impl Trait for S { reuse Trait::foo1 { &self.0 } reuse Trait::foo2 { &self.0 } - //~^ ERROR delegation with early bound generics is not supported yet + //~^ ERROR early bound generics are not supported for associated delegation items //~| ERROR method `foo2` has 0 type parameters but its trait declaration has 1 type parameter reuse <F as Trait>::foo3; - //~^ ERROR delegation with early bound generics is not supported yet + //~^ ERROR early bound generics are not supported for associated delegation items //~| ERROR lifetime parameters or bounds on method `foo3` do not match the trait declaration } struct GenericS<T>(T); impl<T> Trait for GenericS<T> { reuse Trait::foo { &self.0 } - //~^ ERROR delegation with early bound generics is not supported yet + //~^ ERROR early bound generics are not supported for associated delegation items } } @@ -68,13 +70,10 @@ mod opaque { mod to_reuse { use super::Trait; - pub fn opaque_arg(_: impl Trait) -> i32 { 0 } pub fn opaque_ret() -> impl Trait { unimplemented!() } //~^ warn: this function depends on never type fallback being `()` //~| warn: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! } - reuse to_reuse::opaque_arg; - //~^ ERROR delegation with early bound generics is not supported yet trait ToReuse { fn opaque_ret() -> impl Trait { unimplemented!() } @@ -104,4 +103,14 @@ mod recursive { //~^ ERROR recursive delegation is not supported yet } +mod effects { + #[const_trait] + trait Trait { + fn foo(); + } + + reuse Trait::foo; + //~^ ERROR delegation to a function with effect parameter is not supported yet +} + fn main() {} diff --git a/tests/ui/delegation/not-supported.stderr b/tests/ui/delegation/not-supported.stderr index 4ce01fd5d88..e7ba9fc6719 100644 --- a/tests/ui/delegation/not-supported.stderr +++ b/tests/ui/delegation/not-supported.stderr @@ -1,5 +1,10 @@ -error: delegation with early bound generics is not supported yet - --> $DIR/not-supported.rs:16:29 +error: using `#![feature(effects)]` without enabling next trait solver globally + | + = note: the next trait solver must be enabled globally for the effects feature to work correctly + = help: use `-Znext-solver` to enable + +error: early bound generics are not supported for associated delegation items + --> $DIR/not-supported.rs:18:29 | LL | fn bar(&self, x: T) -> T { x } | ------------------------ callee defined here @@ -7,8 +12,8 @@ LL | fn bar(&self, x: T) -> T { x } LL | reuse GenericTrait::bar; | ^^^ -error: delegation with early bound generics is not supported yet - --> $DIR/not-supported.rs:18:29 +error: early bound generics are not supported for associated delegation items + --> $DIR/not-supported.rs:20:29 | LL | fn bar1() {} | --------- callee defined here @@ -16,8 +21,8 @@ LL | fn bar1() {} LL | reuse GenericTrait::bar1; | ^^^^ -error: delegation with early bound generics is not supported yet - --> $DIR/not-supported.rs:29:39 +error: early bound generics are not supported for associated delegation items + --> $DIR/not-supported.rs:31:39 | LL | fn bar(&self, x: T) -> T { x } | ------------------------ callee defined here @@ -25,8 +30,8 @@ LL | fn bar(&self, x: T) -> T { x } LL | reuse <F as GenericTrait<T>>::bar { &self.0 } | ^^^ -error: delegation with early bound generics is not supported yet - --> $DIR/not-supported.rs:31:34 +error: early bound generics are not supported for associated delegation items + --> $DIR/not-supported.rs:33:34 | LL | fn bar1() {} | --------- callee defined here @@ -34,8 +39,8 @@ LL | fn bar1() {} LL | reuse GenericTrait::<T>::bar1; | ^^^^ -error: delegation with early bound generics is not supported yet - --> $DIR/not-supported.rs:36:29 +error: early bound generics are not supported for associated delegation items + --> $DIR/not-supported.rs:38:29 | LL | fn bar(&self, x: T) -> T { x } | ------------------------ callee defined here @@ -43,8 +48,8 @@ LL | fn bar(&self, x: T) -> T { x } LL | reuse GenericTrait::bar { &F } | ^^^ -error: delegation with early bound generics is not supported yet - --> $DIR/not-supported.rs:38:29 +error: early bound generics are not supported for associated delegation items + --> $DIR/not-supported.rs:40:29 | LL | fn bar1() {} | --------- callee defined here @@ -52,8 +57,8 @@ LL | fn bar1() {} LL | reuse GenericTrait::bar1; | ^^^^ -error: delegation with early bound generics is not supported yet - --> $DIR/not-supported.rs:43:22 +error: early bound generics are not supported for associated delegation items + --> $DIR/not-supported.rs:45:22 | LL | fn foo(&self, x: i32) -> i32 { x } | ---------------------------- callee defined here @@ -62,7 +67,7 @@ LL | reuse Trait::foo; | ^^^ error[E0049]: method `foo2` has 0 type parameters but its trait declaration has 1 type parameter - --> $DIR/not-supported.rs:49:22 + --> $DIR/not-supported.rs:51:22 | LL | fn foo2<T>(&self, x: T) -> T { x } | - expected 1 type parameter @@ -70,8 +75,8 @@ LL | fn foo2<T>(&self, x: T) -> T { x } LL | reuse Trait::foo2 { &self.0 } | ^^^^ found 0 type parameters -error: delegation with early bound generics is not supported yet - --> $DIR/not-supported.rs:52:29 +error: early bound generics are not supported for associated delegation items + --> $DIR/not-supported.rs:54:29 | LL | fn foo3<'a: 'a>(_: &'a u32) {} | --------------------------- callee defined here @@ -80,7 +85,7 @@ LL | reuse <F as Trait>::foo3; | ^^^^ error[E0195]: lifetime parameters or bounds on method `foo3` do not match the trait declaration - --> $DIR/not-supported.rs:52:29 + --> $DIR/not-supported.rs:54:29 | LL | fn foo3<'a: 'a>(_: &'a u32) {} | -------- lifetimes in impl do not match this method in trait @@ -88,8 +93,17 @@ LL | fn foo3<'a: 'a>(_: &'a u32) {} LL | reuse <F as Trait>::foo3; | ^^^^ lifetimes do not match method in trait -error: delegation with early bound generics is not supported yet - --> $DIR/not-supported.rs:59:22 +error: delegation to a function with effect parameter is not supported yet + --> $DIR/not-supported.rs:112:18 + | +LL | fn foo(); + | --------- callee defined here +... +LL | reuse Trait::foo; + | ^^^ + +error: early bound generics are not supported for associated delegation items + --> $DIR/not-supported.rs:61:22 | LL | fn foo(&self, x: i32) -> i32 { x } | ---------------------------- callee defined here @@ -97,8 +111,8 @@ LL | fn foo(&self, x: i32) -> i32 { x } LL | reuse Trait::foo { &self.0 } | ^^^ -error: delegation with early bound generics is not supported yet - --> $DIR/not-supported.rs:49:22 +error: early bound generics are not supported for associated delegation items + --> $DIR/not-supported.rs:51:22 | LL | fn foo2<T>(&self, x: T) -> T { x } | ---------------------------- callee defined here @@ -106,17 +120,8 @@ LL | fn foo2<T>(&self, x: T) -> T { x } LL | reuse Trait::foo2 { &self.0 } | ^^^^ -error: delegation with early bound generics is not supported yet - --> $DIR/not-supported.rs:76:21 - | -LL | pub fn opaque_arg(_: impl Trait) -> i32 { 0 } - | --------------------------------------- callee defined here -... -LL | reuse to_reuse::opaque_arg; - | ^^^^^^^^^^ - warning: this function depends on never type fallback being `()` - --> $DIR/not-supported.rs:80:9 + --> $DIR/not-supported.rs:79:9 | LL | fn opaque_ret() -> impl Trait { unimplemented!() } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -125,33 +130,33 @@ LL | fn opaque_ret() -> impl Trait { unimplemented!() } = note: for more information, see issue #123748 <https://github.com/rust-lang/rust/issues/123748> = help: specify the types explicitly note: in edition 2024, the requirement `!: opaque::Trait` will fail - --> $DIR/not-supported.rs:80:28 + --> $DIR/not-supported.rs:79:28 | LL | fn opaque_ret() -> impl Trait { unimplemented!() } | ^^^^^^^^^^ = note: `#[warn(dependency_on_unit_never_type_fallback)]` on by default -error[E0391]: cycle detected when computing type of `opaque::<impl at $DIR/not-supported.rs:86:5: 86:24>::{synthetic#0}` - --> $DIR/not-supported.rs:87:25 +error[E0391]: cycle detected when computing type of `opaque::<impl at $DIR/not-supported.rs:85:5: 85:24>::{synthetic#0}` + --> $DIR/not-supported.rs:86:25 | LL | reuse to_reuse::opaque_ret; | ^^^^^^^^^^ | note: ...which requires comparing an impl and trait method signature, inferring any hidden `impl Trait` types in the process... - --> $DIR/not-supported.rs:87:25 + --> $DIR/not-supported.rs:86:25 | LL | reuse to_reuse::opaque_ret; | ^^^^^^^^^^ - = note: ...which again requires computing type of `opaque::<impl at $DIR/not-supported.rs:86:5: 86:24>::{synthetic#0}`, completing the cycle -note: cycle used when checking that `opaque::<impl at $DIR/not-supported.rs:86:5: 86:24>` is well-formed - --> $DIR/not-supported.rs:86:5 + = note: ...which again requires computing type of `opaque::<impl at $DIR/not-supported.rs:85:5: 85:24>::{synthetic#0}`, completing the cycle +note: cycle used when checking that `opaque::<impl at $DIR/not-supported.rs:85:5: 85:24>` is well-formed + --> $DIR/not-supported.rs:85:5 | LL | impl ToReuse for u8 { | ^^^^^^^^^^^^^^^^^^^ = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information warning: this function depends on never type fallback being `()` - --> $DIR/not-supported.rs:72:9 + --> $DIR/not-supported.rs:73:9 | LL | pub fn opaque_ret() -> impl Trait { unimplemented!() } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -160,32 +165,32 @@ LL | pub fn opaque_ret() -> impl Trait { unimplemented!() } = note: for more information, see issue #123748 <https://github.com/rust-lang/rust/issues/123748> = help: specify the types explicitly note: in edition 2024, the requirement `!: opaque::Trait` will fail - --> $DIR/not-supported.rs:72:32 + --> $DIR/not-supported.rs:73:32 | LL | pub fn opaque_ret() -> impl Trait { unimplemented!() } | ^^^^^^^^^^ -error[E0391]: cycle detected when computing type of `opaque::<impl at $DIR/not-supported.rs:89:5: 89:25>::{synthetic#0}` - --> $DIR/not-supported.rs:90:24 +error[E0391]: cycle detected when computing type of `opaque::<impl at $DIR/not-supported.rs:88:5: 88:25>::{synthetic#0}` + --> $DIR/not-supported.rs:89:24 | LL | reuse ToReuse::opaque_ret; | ^^^^^^^^^^ | note: ...which requires comparing an impl and trait method signature, inferring any hidden `impl Trait` types in the process... - --> $DIR/not-supported.rs:90:24 + --> $DIR/not-supported.rs:89:24 | LL | reuse ToReuse::opaque_ret; | ^^^^^^^^^^ - = note: ...which again requires computing type of `opaque::<impl at $DIR/not-supported.rs:89:5: 89:25>::{synthetic#0}`, completing the cycle -note: cycle used when checking that `opaque::<impl at $DIR/not-supported.rs:89:5: 89:25>` is well-formed - --> $DIR/not-supported.rs:89:5 + = note: ...which again requires computing type of `opaque::<impl at $DIR/not-supported.rs:88:5: 88:25>::{synthetic#0}`, completing the cycle +note: cycle used when checking that `opaque::<impl at $DIR/not-supported.rs:88:5: 88:25>` is well-formed + --> $DIR/not-supported.rs:88:5 | LL | impl ToReuse for u16 { | ^^^^^^^^^^^^^^^^^^^^ = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information error: recursive delegation is not supported yet - --> $DIR/not-supported.rs:103:22 + --> $DIR/not-supported.rs:102:22 | LL | pub reuse to_reuse2::foo; | --- callee defined here @@ -193,7 +198,7 @@ LL | pub reuse to_reuse2::foo; LL | reuse to_reuse1::foo; | ^^^ -error: aborting due to 16 previous errors; 2 warnings emitted +error: aborting due to 17 previous errors; 2 warnings emitted Some errors have detailed explanations: E0049, E0195, E0391. For more information about an error, try `rustc --explain E0049`. diff --git a/tests/ui/delegation/target-expr.rs b/tests/ui/delegation/target-expr.rs index fd7ea943b9d..f766ca7356a 100644 --- a/tests/ui/delegation/target-expr.rs +++ b/tests/ui/delegation/target-expr.rs @@ -14,9 +14,7 @@ fn foo(x: i32) -> i32 { x } fn bar<T: Default>(_: T) { reuse Trait::static_method { - //~^ ERROR delegation to a trait method from a free function is not supported yet - //~| ERROR delegation with early bound generics is not supported yet - //~| ERROR mismatched types + //~^ ERROR mismatched types let _ = T::Default(); //~^ ERROR can't use generic parameters from outer item } @@ -25,7 +23,6 @@ fn bar<T: Default>(_: T) { fn main() { let y = 0; reuse <S as Trait>::static_method { - //~^ ERROR delegation to a trait method from a free function is not supported yet let x = y; //~^ ERROR can't capture dynamic environment in a fn item foo(self); diff --git a/tests/ui/delegation/target-expr.stderr b/tests/ui/delegation/target-expr.stderr index b30f0c474c6..f5556bf9f45 100644 --- a/tests/ui/delegation/target-expr.stderr +++ b/tests/ui/delegation/target-expr.stderr @@ -1,16 +1,16 @@ error[E0401]: can't use generic parameters from outer item - --> $DIR/target-expr.rs:20:17 + --> $DIR/target-expr.rs:18:17 | LL | fn bar<T: Default>(_: T) { | - type parameter from outer item LL | reuse Trait::static_method { | - help: try introducing a local generic parameter here: `T,` -... +LL | LL | let _ = T::Default(); | ^^^^^^^^^^ use of generic parameter from outer item error[E0434]: can't capture dynamic environment in a fn item - --> $DIR/target-expr.rs:29:17 + --> $DIR/target-expr.rs:26:17 | LL | let x = y; | ^ @@ -18,7 +18,7 @@ LL | let x = y; = help: use the `|| { ... }` closure form instead error[E0424]: expected value, found module `self` - --> $DIR/target-expr.rs:36:5 + --> $DIR/target-expr.rs:33:5 | LL | fn main() { | ---- this function can't have a `self` parameter @@ -27,58 +27,29 @@ LL | self.0; | ^^^^ `self` value is a keyword only available in methods with a `self` parameter error[E0425]: cannot find value `x` in this scope - --> $DIR/target-expr.rs:38:13 + --> $DIR/target-expr.rs:35:13 | LL | let z = x; | ^ | help: the binding `x` is available in a different scope in the same function - --> $DIR/target-expr.rs:29:13 + --> $DIR/target-expr.rs:26:13 | LL | let x = y; | ^ -error: delegation with early bound generics is not supported yet - --> $DIR/target-expr.rs:16:18 - | -LL | fn static_method(x: i32) -> i32 { x } - | ------------------------------- callee defined here -... -LL | reuse Trait::static_method { - | ^^^^^^^^^^^^^ - -error: delegation to a trait method from a free function is not supported yet - --> $DIR/target-expr.rs:16:18 - | -LL | fn static_method(x: i32) -> i32 { x } - | ------------------------------- callee defined here -... -LL | reuse Trait::static_method { - | ^^^^^^^^^^^^^ - -error: delegation to a trait method from a free function is not supported yet - --> $DIR/target-expr.rs:27:25 - | -LL | fn static_method(x: i32) -> i32 { x } - | ------------------------------- callee defined here -... -LL | reuse <S as Trait>::static_method { - | ^^^^^^^^^^^^^ - error[E0308]: mismatched types --> $DIR/target-expr.rs:16:32 | LL | reuse Trait::static_method { | ________________________________^ LL | | -LL | | -LL | | LL | | let _ = T::Default(); LL | | LL | | } | |_____^ expected `i32`, found `()` -error: aborting due to 8 previous errors +error: aborting due to 5 previous errors Some errors have detailed explanations: E0308, E0401, E0424, E0425, E0434. For more information about an error, try `rustc --explain E0308`. diff --git a/tests/ui/derives/clone-debug-dead-code-in-the-same-struct.rs b/tests/ui/derives/clone-debug-dead-code-in-the-same-struct.rs index 885dacc727a..6ab1fb7b039 100644 --- a/tests/ui/derives/clone-debug-dead-code-in-the-same-struct.rs +++ b/tests/ui/derives/clone-debug-dead-code-in-the-same-struct.rs @@ -1,9 +1,9 @@ #![forbid(dead_code)] #[derive(Debug)] -pub struct Whatever { //~ ERROR struct `Whatever` is never constructed +pub struct Whatever { pub field0: (), - field1: (), + field1: (), //~ ERROR fields `field1`, `field2`, `field3`, and `field4` are never read field2: (), field3: (), field4: (), diff --git a/tests/ui/derives/clone-debug-dead-code-in-the-same-struct.stderr b/tests/ui/derives/clone-debug-dead-code-in-the-same-struct.stderr index e10d28ad03a..e9b757b6bae 100644 --- a/tests/ui/derives/clone-debug-dead-code-in-the-same-struct.stderr +++ b/tests/ui/derives/clone-debug-dead-code-in-the-same-struct.stderr @@ -1,9 +1,19 @@ -error: struct `Whatever` is never constructed - --> $DIR/clone-debug-dead-code-in-the-same-struct.rs:4:12 +error: fields `field1`, `field2`, `field3`, and `field4` are never read + --> $DIR/clone-debug-dead-code-in-the-same-struct.rs:6:5 | LL | pub struct Whatever { - | ^^^^^^^^ + | -------- fields in this struct +LL | pub field0: (), +LL | field1: (), + | ^^^^^^ +LL | field2: (), + | ^^^^^^ +LL | field3: (), + | ^^^^^^ +LL | field4: (), + | ^^^^^^ | + = note: `Whatever` has a derived impl for the trait `Debug`, but this is intentionally ignored during dead code analysis note: the lint level is defined here --> $DIR/clone-debug-dead-code-in-the-same-struct.rs:1:11 | diff --git a/tests/ui/error-codes/E0396-fixed.stderr b/tests/ui/error-codes/E0396-fixed.stderr index 2f8ea7993f7..c14f4948095 100644 --- a/tests/ui/error-codes/E0396-fixed.stderr +++ b/tests/ui/error-codes/E0396-fixed.stderr @@ -2,7 +2,7 @@ error[E0080]: evaluation of constant value failed --> $DIR/E0396-fixed.rs:5:28 | LL | const VALUE: u8 = unsafe { *REG_ADDR }; - | ^^^^^^^^^ memory access failed: 0x5f3759df[noalloc] is a dangling pointer (it has no provenance) + | ^^^^^^^^^ memory access failed: expected a pointer to 1 byte of memory, but got 0x5f3759df[noalloc] which is a dangling pointer (it has no provenance) error: aborting due to 1 previous error diff --git a/tests/ui/feature-gates/feature-gate-offset-of-enum.rs b/tests/ui/feature-gates/feature-gate-offset-of-enum.rs index 1f2f7ee1e19..cc9efeb67f3 100644 --- a/tests/ui/feature-gates/feature-gate-offset-of-enum.rs +++ b/tests/ui/feature-gates/feature-gate-offset-of-enum.rs @@ -1,5 +1,3 @@ -#![feature(offset_of_nested)] - use std::mem::offset_of; enum Alpha { diff --git a/tests/ui/feature-gates/feature-gate-offset-of-enum.stderr b/tests/ui/feature-gates/feature-gate-offset-of-enum.stderr index fc7dd7923f7..8a73abc8cad 100644 --- a/tests/ui/feature-gates/feature-gate-offset-of-enum.stderr +++ b/tests/ui/feature-gates/feature-gate-offset-of-enum.stderr @@ -1,5 +1,5 @@ error[E0573]: expected type, found variant `Alpha::One` - --> $DIR/feature-gate-offset-of-enum.rs:11:16 + --> $DIR/feature-gate-offset-of-enum.rs:9:16 | LL | offset_of!(Alpha::One, 0); | ^^^^^^^^^^ @@ -8,7 +8,7 @@ LL | offset_of!(Alpha::One, 0); | help: try using the variant's enum: `Alpha` error[E0658]: using enums in offset_of is experimental - --> $DIR/feature-gate-offset-of-enum.rs:12:23 + --> $DIR/feature-gate-offset-of-enum.rs:10:23 | LL | offset_of!(Alpha, One); | ^^^ @@ -18,13 +18,13 @@ LL | offset_of!(Alpha, One); = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0795]: `One` is an enum variant; expected field at end of `offset_of` - --> $DIR/feature-gate-offset-of-enum.rs:12:23 + --> $DIR/feature-gate-offset-of-enum.rs:10:23 | LL | offset_of!(Alpha, One); | ^^^ enum variant error[E0658]: using enums in offset_of is experimental - --> $DIR/feature-gate-offset-of-enum.rs:14:23 + --> $DIR/feature-gate-offset-of-enum.rs:12:23 | LL | offset_of!(Alpha, Two.0); | ^^^ diff --git a/tests/ui/feature-gates/feature-gate-offset-of-nested.rs b/tests/ui/feature-gates/feature-gate-offset-of-nested.rs deleted file mode 100644 index c4eb4720fde..00000000000 --- a/tests/ui/feature-gates/feature-gate-offset-of-nested.rs +++ /dev/null @@ -1,28 +0,0 @@ -#![feature(offset_of_enum)] - -use std::mem::offset_of; - -struct S { - a: u8, - b: (u8, u8), - c: T, -} - -struct T { - t: &'static str, -} - -enum Alpha { - One(u8), - Two(u8), -} - -fn main() { - offset_of!(Alpha, Two.0); //~ ERROR only a single ident or integer is stable as the field in offset_of - offset_of!(S, a); - offset_of!((u8, S), 1); - offset_of!((u32, (S, T)), 1.1); //~ ERROR only a single ident or integer is stable as the field in offset_of - offset_of!(S, b.0); //~ ERROR only a single ident or integer is stable as the field in offset_of - offset_of!((S, ()), 0.c); //~ ERROR only a single ident or integer is stable as the field in offset_of - offset_of!(S, c.t); //~ ERROR only a single ident or integer is stable as the field in offset_of -} diff --git a/tests/ui/feature-gates/feature-gate-offset-of-nested.stderr b/tests/ui/feature-gates/feature-gate-offset-of-nested.stderr deleted file mode 100644 index f367fc9fa0d..00000000000 --- a/tests/ui/feature-gates/feature-gate-offset-of-nested.stderr +++ /dev/null @@ -1,60 +0,0 @@ -error[E0658]: only a single ident or integer is stable as the field in offset_of - --> $DIR/feature-gate-offset-of-nested.rs:21:27 - | -LL | offset_of!(Alpha, Two.0); - | ^ - | - = note: see issue #120140 <https://github.com/rust-lang/rust/issues/120140> for more information - = help: add `#![feature(offset_of_nested)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - -error[E0658]: only a single ident or integer is stable as the field in offset_of - --> $DIR/feature-gate-offset-of-nested.rs:24:33 - | -LL | offset_of!((u32, (S, T)), 1.1); - | _____----------------------------^- - | | | - | | in this macro invocation -LL | | offset_of!(S, b.0); -LL | | offset_of!((S, ()), 0.c); -LL | | offset_of!(S, c.t); -... | - | - = note: see issue #120140 <https://github.com/rust-lang/rust/issues/120140> for more information - = help: add `#![feature(offset_of_nested)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - = note: this error originates in the macro `offset_of` (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0658]: only a single ident or integer is stable as the field in offset_of - --> $DIR/feature-gate-offset-of-nested.rs:25:21 - | -LL | offset_of!(S, b.0); - | ^ - | - = note: see issue #120140 <https://github.com/rust-lang/rust/issues/120140> for more information - = help: add `#![feature(offset_of_nested)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - -error[E0658]: only a single ident or integer is stable as the field in offset_of - --> $DIR/feature-gate-offset-of-nested.rs:26:27 - | -LL | offset_of!((S, ()), 0.c); - | ^ - | - = note: see issue #120140 <https://github.com/rust-lang/rust/issues/120140> for more information - = help: add `#![feature(offset_of_nested)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - -error[E0658]: only a single ident or integer is stable as the field in offset_of - --> $DIR/feature-gate-offset-of-nested.rs:27:21 - | -LL | offset_of!(S, c.t); - | ^ - | - = note: see issue #120140 <https://github.com/rust-lang/rust/issues/120140> for more information - = help: add `#![feature(offset_of_nested)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - -error: aborting due to 5 previous errors - -For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/inference/need_type_info/incompat-call-after-qualified-path-0.rs b/tests/ui/inference/need_type_info/incompat-call-after-qualified-path-0.rs new file mode 100644 index 00000000000..830a6390fce --- /dev/null +++ b/tests/ui/inference/need_type_info/incompat-call-after-qualified-path-0.rs @@ -0,0 +1,24 @@ +// issue#121613 + +#![feature(more_qualified_paths)] + +struct S {} + +struct Foo; + +trait A { + type Assoc; +} + +impl A for Foo { + type Assoc = S; +} + +fn f() {} + +fn main() { + <Foo as A>::Assoc {}; + f(|a, b| a.cmp(b)); + //~^ ERROR: type annotations needed + //~| ERROR: this function takes 0 arguments but 1 argument was supplied +} diff --git a/tests/ui/inference/need_type_info/incompat-call-after-qualified-path-0.stderr b/tests/ui/inference/need_type_info/incompat-call-after-qualified-path-0.stderr new file mode 100644 index 00000000000..10056bdf3d4 --- /dev/null +++ b/tests/ui/inference/need_type_info/incompat-call-after-qualified-path-0.stderr @@ -0,0 +1,32 @@ +error[E0282]: type annotations needed + --> $DIR/incompat-call-after-qualified-path-0.rs:21:6 + | +LL | f(|a, b| a.cmp(b)); + | ^ - type must be known at this point + | +help: consider giving this closure parameter an explicit type + | +LL | f(|a: /* Type */, b| a.cmp(b)); + | ++++++++++++ + +error[E0061]: this function takes 0 arguments but 1 argument was supplied + --> $DIR/incompat-call-after-qualified-path-0.rs:21:3 + | +LL | f(|a, b| a.cmp(b)); + | ^ --------------- unexpected argument + | +note: function defined here + --> $DIR/incompat-call-after-qualified-path-0.rs:17:4 + | +LL | fn f() {} + | ^ +help: remove the extra argument + | +LL - f(|a, b| a.cmp(b)); +LL + f(); + | + +error: aborting due to 2 previous errors + +Some errors have detailed explanations: E0061, E0282. +For more information about an error, try `rustc --explain E0061`. diff --git a/tests/ui/inference/need_type_info/incompat-call-after-qualified-path-1.rs b/tests/ui/inference/need_type_info/incompat-call-after-qualified-path-1.rs new file mode 100644 index 00000000000..6b786332a8f --- /dev/null +++ b/tests/ui/inference/need_type_info/incompat-call-after-qualified-path-1.rs @@ -0,0 +1,28 @@ +// issue#121613 + +#![feature(more_qualified_paths)] + +struct S<T> { + a: T +} + +struct Foo; + +trait A { + type Assoc<T>; +} + +impl A for Foo { + type Assoc<T> = S<T>; +} + +fn f() {} + +fn main() { + <Foo as A>::Assoc::<i32> { + a: 1 + }; + f(|a, b| a.cmp(b)); + //~^ ERROR: type annotations needed + //~| ERROR: this function takes 0 arguments but 1 argument was supplied +} diff --git a/tests/ui/inference/need_type_info/incompat-call-after-qualified-path-1.stderr b/tests/ui/inference/need_type_info/incompat-call-after-qualified-path-1.stderr new file mode 100644 index 00000000000..632a9b99f84 --- /dev/null +++ b/tests/ui/inference/need_type_info/incompat-call-after-qualified-path-1.stderr @@ -0,0 +1,32 @@ +error[E0282]: type annotations needed + --> $DIR/incompat-call-after-qualified-path-1.rs:25:6 + | +LL | f(|a, b| a.cmp(b)); + | ^ - type must be known at this point + | +help: consider giving this closure parameter an explicit type + | +LL | f(|a: /* Type */, b| a.cmp(b)); + | ++++++++++++ + +error[E0061]: this function takes 0 arguments but 1 argument was supplied + --> $DIR/incompat-call-after-qualified-path-1.rs:25:3 + | +LL | f(|a, b| a.cmp(b)); + | ^ --------------- unexpected argument + | +note: function defined here + --> $DIR/incompat-call-after-qualified-path-1.rs:19:4 + | +LL | fn f() {} + | ^ +help: remove the extra argument + | +LL - f(|a, b| a.cmp(b)); +LL + f(); + | + +error: aborting due to 2 previous errors + +Some errors have detailed explanations: E0061, E0282. +For more information about an error, try `rustc --explain E0061`. diff --git a/tests/ui/issues/issue-48728.stderr b/tests/ui/issues/issue-48728.current.stderr index 6b4247f1d79..2a1b4ff7818 100644 --- a/tests/ui/issues/issue-48728.stderr +++ b/tests/ui/issues/issue-48728.current.stderr @@ -1,5 +1,5 @@ error[E0119]: conflicting implementations of trait `Clone` for type `Node<[_]>` - --> $DIR/issue-48728.rs:4:10 + --> $DIR/issue-48728.rs:9:10 | LL | #[derive(Clone)] | ^^^^^ conflicting implementation for `Node<[_]>` diff --git a/tests/ui/issues/issue-48728.rs b/tests/ui/issues/issue-48728.rs index cbdc10bd2e1..7ef05f4277b 100644 --- a/tests/ui/issues/issue-48728.rs +++ b/tests/ui/issues/issue-48728.rs @@ -1,7 +1,12 @@ // Regression test for #48728, an ICE that occurred computing // coherence "help" information. -#[derive(Clone)] //~ ERROR conflicting implementations of trait `Clone` +//@ revisions: current next +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[next] compile-flags: -Znext-solver +//@[next] check-pass + +#[derive(Clone)] //[current]~ ERROR conflicting implementations of trait `Clone` struct Node<T: ?Sized>(Box<T>); impl<T: Clone + ?Sized> Clone for Node<[T]> { diff --git a/tests/ui/lint/dead-code/offset-of-correct-param-env.rs b/tests/ui/lint/dead-code/offset-of-correct-param-env.rs index 61babdeb28b..8cb242f8282 100644 --- a/tests/ui/lint/dead-code/offset-of-correct-param-env.rs +++ b/tests/ui/lint/dead-code/offset-of-correct-param-env.rs @@ -1,6 +1,5 @@ //@ check-pass -#![feature(offset_of_nested)] #![deny(dead_code)] // This struct contains a projection that can only be normalized after getting the field type. diff --git a/tests/ui/lint/dead-code/offset-of.rs b/tests/ui/lint/dead-code/offset-of.rs index 5269426d2ff..89e9fd910cb 100644 --- a/tests/ui/lint/dead-code/offset-of.rs +++ b/tests/ui/lint/dead-code/offset-of.rs @@ -1,4 +1,3 @@ -#![feature(offset_of_nested)] #![deny(dead_code)] use std::mem::offset_of; diff --git a/tests/ui/lint/dead-code/offset-of.stderr b/tests/ui/lint/dead-code/offset-of.stderr index ed2916461cd..4a903a9d6e8 100644 --- a/tests/ui/lint/dead-code/offset-of.stderr +++ b/tests/ui/lint/dead-code/offset-of.stderr @@ -1,5 +1,5 @@ error: field `b` is never read - --> $DIR/offset-of.rs:8:5 + --> $DIR/offset-of.rs:7:5 | LL | struct Alpha { | ----- field in this struct @@ -8,13 +8,13 @@ LL | b: (), | ^ | note: the lint level is defined here - --> $DIR/offset-of.rs:2:9 + --> $DIR/offset-of.rs:1:9 | LL | #![deny(dead_code)] | ^^^^^^^^^ error: field `a` is never read - --> $DIR/offset-of.rs:13:5 + --> $DIR/offset-of.rs:12:5 | LL | struct Beta { | ---- field in this struct @@ -22,7 +22,7 @@ LL | a: (), | ^ error: field `a` is never read - --> $DIR/offset-of.rs:18:5 + --> $DIR/offset-of.rs:17:5 | LL | struct Gamma { | ----- field in this struct @@ -30,7 +30,7 @@ LL | a: (), | ^ error: field `b` is never read - --> $DIR/offset-of.rs:24:5 + --> $DIR/offset-of.rs:23:5 | LL | struct Delta { | ----- field in this struct @@ -39,7 +39,7 @@ LL | b: (), | ^ error: field `a` is never read - --> $DIR/offset-of.rs:35:5 + --> $DIR/offset-of.rs:34:5 | LL | struct Project<T: Trait> { | ------- field in this struct diff --git a/tests/ui/lint/dead-code/unconstructible-pub-struct.rs b/tests/ui/lint/dead-code/unconstructible-pub-struct.rs new file mode 100644 index 00000000000..2202cbb6730 --- /dev/null +++ b/tests/ui/lint/dead-code/unconstructible-pub-struct.rs @@ -0,0 +1,35 @@ +#![feature(never_type)] +#![deny(dead_code)] + +pub struct T1(!); +pub struct T2(()); +pub struct T3<X>(std::marker::PhantomData<X>); + +pub struct T4 { + _x: !, +} + +pub struct T5<X> { + _x: !, + _y: X, +} + +pub struct T6 { + _x: (), +} + +pub struct T7<X> { + _x: (), + _y: X, +} + +pub struct T8<X> { + _x: std::marker::PhantomData<X>, +} + +pub struct T9<X> { //~ ERROR struct `T9` is never constructed + _x: std::marker::PhantomData<X>, + _y: i32, +} + +fn main() {} diff --git a/tests/ui/lint/dead-code/unconstructible-pub-struct.stderr b/tests/ui/lint/dead-code/unconstructible-pub-struct.stderr new file mode 100644 index 00000000000..a3dde042bbe --- /dev/null +++ b/tests/ui/lint/dead-code/unconstructible-pub-struct.stderr @@ -0,0 +1,14 @@ +error: struct `T9` is never constructed + --> $DIR/unconstructible-pub-struct.rs:30:12 + | +LL | pub struct T9<X> { + | ^^ + | +note: the lint level is defined here + --> $DIR/unconstructible-pub-struct.rs:2:9 + | +LL | #![deny(dead_code)] + | ^^^^^^^^^ + +error: aborting due to 1 previous error + diff --git a/tests/ui/methods/dont-ice-on-object-lookup-w-error-region.rs b/tests/ui/methods/dont-ice-on-object-lookup-w-error-region.rs new file mode 100644 index 00000000000..0a6d196364f --- /dev/null +++ b/tests/ui/methods/dont-ice-on-object-lookup-w-error-region.rs @@ -0,0 +1,11 @@ +// Fix for issue: #122914 + +use std::future::Future; +use std::pin::Pin; + +fn project(x: Pin<&'missing mut dyn Future<Output = ()>>) { + //~^ ERROR use of undeclared lifetime name `'missing` + let _ = x.poll(todo!()); +} + +fn main() {} diff --git a/tests/ui/methods/dont-ice-on-object-lookup-w-error-region.stderr b/tests/ui/methods/dont-ice-on-object-lookup-w-error-region.stderr new file mode 100644 index 00000000000..2c33941be43 --- /dev/null +++ b/tests/ui/methods/dont-ice-on-object-lookup-w-error-region.stderr @@ -0,0 +1,11 @@ +error[E0261]: use of undeclared lifetime name `'missing` + --> $DIR/dont-ice-on-object-lookup-w-error-region.rs:6:20 + | +LL | fn project(x: Pin<&'missing mut dyn Future<Output = ()>>) { + | - ^^^^^^^^ undeclared lifetime + | | + | help: consider introducing lifetime `'missing` here: `<'missing>` + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0261`. diff --git a/tests/ui/offset-of/offset-of-enum.rs b/tests/ui/offset-of/offset-of-enum.rs index cb2f04786ac..64850e47823 100644 --- a/tests/ui/offset-of/offset-of-enum.rs +++ b/tests/ui/offset-of/offset-of-enum.rs @@ -1,4 +1,4 @@ -#![feature(offset_of_enum, offset_of_nested)] +#![feature(offset_of_enum)] use std::mem::offset_of; diff --git a/tests/ui/offset-of/offset-of-private.rs b/tests/ui/offset-of/offset-of-private.rs index 1c326b5c79a..8b8ffb5e08e 100644 --- a/tests/ui/offset-of/offset-of-private.rs +++ b/tests/ui/offset-of/offset-of-private.rs @@ -1,4 +1,4 @@ -#![feature(offset_of_enum, offset_of_nested)] +#![feature(offset_of_enum)] use std::mem::offset_of; diff --git a/tests/ui/offset-of/offset-of-self.rs b/tests/ui/offset-of/offset-of-self.rs index 1558e13b530..e5730b8cf6c 100644 --- a/tests/ui/offset-of/offset-of-self.rs +++ b/tests/ui/offset-of/offset-of-self.rs @@ -1,5 +1,3 @@ -#![feature(offset_of_nested)] - use std::mem::offset_of; struct C<T> { diff --git a/tests/ui/offset-of/offset-of-self.stderr b/tests/ui/offset-of/offset-of-self.stderr index 7c7576e066b..5bbb4ecf091 100644 --- a/tests/ui/offset-of/offset-of-self.stderr +++ b/tests/ui/offset-of/offset-of-self.stderr @@ -1,11 +1,11 @@ error: offset_of expects dot-separated field and variant names - --> $DIR/offset-of-self.rs:20:26 + --> $DIR/offset-of-self.rs:18:26 | LL | offset_of!(Self, Self::v); | ^^^^^^^ error[E0412]: cannot find type `S` in module `self` - --> $DIR/offset-of-self.rs:34:26 + --> $DIR/offset-of-self.rs:32:26 | LL | offset_of!(self::S, v); | ^ not found in `self` @@ -21,7 +21,7 @@ LL + offset_of!(S, v); | error[E0411]: cannot find type `Self` in this scope - --> $DIR/offset-of-self.rs:51:16 + --> $DIR/offset-of-self.rs:49:16 | LL | fn main() { | ---- `Self` not allowed in a function @@ -30,7 +30,7 @@ LL | offset_of!(Self, v); | ^^^^ `Self` is only available in impls, traits, and type definitions error[E0609]: no field `Self` on type `S` - --> $DIR/offset-of-self.rs:21:23 + --> $DIR/offset-of-self.rs:19:23 | LL | offset_of!(S, Self); | ^^^^ @@ -38,13 +38,13 @@ LL | offset_of!(S, Self); = note: available fields are: `v`, `w` error[E0616]: field `v` of struct `T` is private - --> $DIR/offset-of-self.rs:40:30 + --> $DIR/offset-of-self.rs:38:30 | LL | offset_of!(Self, v) | ^ private field error[E0609]: no field `self` on type `S` - --> $DIR/offset-of-self.rs:53:19 + --> $DIR/offset-of-self.rs:51:19 | LL | offset_of!(S, self); | ^^^^ @@ -52,7 +52,7 @@ LL | offset_of!(S, self); = note: available fields are: `v`, `w` error[E0609]: no field `self` on type `u8` - --> $DIR/offset-of-self.rs:54:21 + --> $DIR/offset-of-self.rs:52:21 | LL | offset_of!(S, v.self); | ^^^^ diff --git a/tests/ui/offset-of/offset-of-slice.rs b/tests/ui/offset-of/offset-of-slice.rs index a0fe3198f68..e6eb12abd7b 100644 --- a/tests/ui/offset-of/offset-of-slice.rs +++ b/tests/ui/offset-of/offset-of-slice.rs @@ -1,5 +1,5 @@ //@run-pass -#![feature(offset_of_slice, offset_of_nested)] +#![feature(offset_of_slice)] use std::mem::offset_of; diff --git a/tests/ui/offset-of/offset-of-tuple-nested.rs b/tests/ui/offset-of/offset-of-tuple-nested.rs index 4a58b7167cb..210a8b6e897 100644 --- a/tests/ui/offset-of/offset-of-tuple-nested.rs +++ b/tests/ui/offset-of/offset-of-tuple-nested.rs @@ -2,8 +2,6 @@ // Test for issue #112204 -- make sure this goes through the entire compilation pipeline, // similar to why `offset-of-unsized.rs` is also build-pass -#![feature(offset_of_nested)] - use std::mem::offset_of; type ComplexTup = ((u8, (u8, (u8, u16), u8)), (u8, u32, u16)); diff --git a/tests/ui/offset-of/offset-of-tuple.rs b/tests/ui/offset-of/offset-of-tuple.rs index 75ba8d77f2f..b0822352c9d 100644 --- a/tests/ui/offset-of/offset-of-tuple.rs +++ b/tests/ui/offset-of/offset-of-tuple.rs @@ -1,4 +1,3 @@ -#![feature(offset_of_nested)] #![feature(builtin_syntax)] use std::mem::offset_of; diff --git a/tests/ui/offset-of/offset-of-tuple.stderr b/tests/ui/offset-of/offset-of-tuple.stderr index 1e2d9240267..e6b45c0b6b8 100644 --- a/tests/ui/offset-of/offset-of-tuple.stderr +++ b/tests/ui/offset-of/offset-of-tuple.stderr @@ -1,11 +1,11 @@ error: suffixes on a tuple index are invalid - --> $DIR/offset-of-tuple.rs:19:35 + --> $DIR/offset-of-tuple.rs:18:35 | LL | builtin # offset_of((u8, u8), 1_u8); | ^^^^ invalid suffix `u8` error: leading `+` is not supported - --> $DIR/offset-of-tuple.rs:23:37 + --> $DIR/offset-of-tuple.rs:22:37 | LL | { builtin # offset_of((u8, u8), +1) }; | ^ unexpected `+` @@ -17,67 +17,67 @@ LL + { builtin # offset_of((u8, u8), 1) }; | error: offset_of expects dot-separated field and variant names - --> $DIR/offset-of-tuple.rs:24:38 + --> $DIR/offset-of-tuple.rs:23:38 | LL | { builtin # offset_of((u8, u8), 1.) }; | ^ error: unexpected token: `)` - --> $DIR/offset-of-tuple.rs:25:40 + --> $DIR/offset-of-tuple.rs:24:40 | LL | { builtin # offset_of((u8, u8), 1 .) }; | ^ error: unexpected token: `)` - --> $DIR/offset-of-tuple.rs:47:45 + --> $DIR/offset-of-tuple.rs:46:45 | LL | { builtin # offset_of(ComplexTup, 0.0.1.) }; | ^ error: unexpected token: `)` - --> $DIR/offset-of-tuple.rs:48:46 + --> $DIR/offset-of-tuple.rs:47:46 | LL | { builtin # offset_of(ComplexTup, 0 .0.1.) }; | ^ error: unexpected token: `)` - --> $DIR/offset-of-tuple.rs:49:47 + --> $DIR/offset-of-tuple.rs:48:47 | LL | { builtin # offset_of(ComplexTup, 0 . 0.1.) }; | ^ error: unexpected token: `)` - --> $DIR/offset-of-tuple.rs:50:46 + --> $DIR/offset-of-tuple.rs:49:46 | LL | { builtin # offset_of(ComplexTup, 0. 0.1.) }; | ^ error: unexpected token: `)` - --> $DIR/offset-of-tuple.rs:51:46 + --> $DIR/offset-of-tuple.rs:50:46 | LL | { builtin # offset_of(ComplexTup, 0.0 .1.) }; | ^ error: unexpected token: `)` - --> $DIR/offset-of-tuple.rs:52:47 + --> $DIR/offset-of-tuple.rs:51:47 | LL | { builtin # offset_of(ComplexTup, 0.0 . 1.) }; | ^ error: unexpected token: `)` - --> $DIR/offset-of-tuple.rs:53:46 + --> $DIR/offset-of-tuple.rs:52:46 | LL | { builtin # offset_of(ComplexTup, 0.0. 1.) }; | ^ error: suffixes on a tuple index are invalid - --> $DIR/offset-of-tuple.rs:10:26 + --> $DIR/offset-of-tuple.rs:9:26 | LL | offset_of!((u8, u8), 1_u8); | ^^^^ invalid suffix `u8` error: no rules expected the token `+` - --> $DIR/offset-of-tuple.rs:12:26 + --> $DIR/offset-of-tuple.rs:11:26 | LL | offset_of!((u8, u8), +1); | ^ no rules expected this token in macro call @@ -86,115 +86,115 @@ note: while trying to match meta-variable `$fields:expr` --> $SRC_DIR/core/src/mem/mod.rs:LL:COL error: offset_of expects dot-separated field and variant names - --> $DIR/offset-of-tuple.rs:13:26 + --> $DIR/offset-of-tuple.rs:12:26 | LL | offset_of!((u8, u8), -1); | ^^ error: offset_of expects dot-separated field and variant names - --> $DIR/offset-of-tuple.rs:14:27 + --> $DIR/offset-of-tuple.rs:13:27 | LL | offset_of!((u8, u8), 1.); | ^ error: unexpected token: `)` - --> $DIR/offset-of-tuple.rs:15:29 + --> $DIR/offset-of-tuple.rs:14:29 | LL | offset_of!((u8, u8), 1 .); | ^ error: unexpected token: `)` - --> $DIR/offset-of-tuple.rs:36:34 + --> $DIR/offset-of-tuple.rs:35:34 | LL | offset_of!(ComplexTup, 0.0.1.); | ^ error: unexpected token: `)` - --> $DIR/offset-of-tuple.rs:37:35 + --> $DIR/offset-of-tuple.rs:36:35 | LL | offset_of!(ComplexTup, 0 .0.1.); | ^ error: unexpected token: `)` - --> $DIR/offset-of-tuple.rs:38:36 + --> $DIR/offset-of-tuple.rs:37:36 | LL | offset_of!(ComplexTup, 0 . 0.1.); | ^ error: unexpected token: `)` - --> $DIR/offset-of-tuple.rs:39:35 + --> $DIR/offset-of-tuple.rs:38:35 | LL | offset_of!(ComplexTup, 0. 0.1.); | ^ error: unexpected token: `)` - --> $DIR/offset-of-tuple.rs:40:35 + --> $DIR/offset-of-tuple.rs:39:35 | LL | offset_of!(ComplexTup, 0.0 .1.); | ^ error: unexpected token: `)` - --> $DIR/offset-of-tuple.rs:41:36 + --> $DIR/offset-of-tuple.rs:40:36 | LL | offset_of!(ComplexTup, 0.0 . 1.); | ^ error: unexpected token: `)` - --> $DIR/offset-of-tuple.rs:42:35 + --> $DIR/offset-of-tuple.rs:41:35 | LL | offset_of!(ComplexTup, 0.0. 1.); | ^ error[E0609]: no field `_0` on type `(u8, u8)` - --> $DIR/offset-of-tuple.rs:7:26 + --> $DIR/offset-of-tuple.rs:6:26 | LL | offset_of!((u8, u8), _0); | ^^ error[E0609]: no field `01` on type `(u8, u8)` - --> $DIR/offset-of-tuple.rs:8:26 + --> $DIR/offset-of-tuple.rs:7:26 | LL | offset_of!((u8, u8), 01); | ^^ error[E0609]: no field `1e2` on type `(u8, u8)` - --> $DIR/offset-of-tuple.rs:9:26 + --> $DIR/offset-of-tuple.rs:8:26 | LL | offset_of!((u8, u8), 1e2); | ^^^ error[E0609]: no field `1_` on type `(u8, u8)` - --> $DIR/offset-of-tuple.rs:10:26 + --> $DIR/offset-of-tuple.rs:9:26 | LL | offset_of!((u8, u8), 1_u8); | ^^^^ error[E0609]: no field `1e2` on type `(u8, u8)` - --> $DIR/offset-of-tuple.rs:16:35 + --> $DIR/offset-of-tuple.rs:15:35 | LL | builtin # offset_of((u8, u8), 1e2); | ^^^ error[E0609]: no field `_0` on type `(u8, u8)` - --> $DIR/offset-of-tuple.rs:17:35 + --> $DIR/offset-of-tuple.rs:16:35 | LL | builtin # offset_of((u8, u8), _0); | ^^ error[E0609]: no field `01` on type `(u8, u8)` - --> $DIR/offset-of-tuple.rs:18:35 + --> $DIR/offset-of-tuple.rs:17:35 | LL | builtin # offset_of((u8, u8), 01); | ^^ error[E0609]: no field `1_` on type `(u8, u8)` - --> $DIR/offset-of-tuple.rs:19:35 + --> $DIR/offset-of-tuple.rs:18:35 | LL | builtin # offset_of((u8, u8), 1_u8); | ^^^^ error[E0609]: no field `2` on type `(u8, u16)` - --> $DIR/offset-of-tuple.rs:31:47 + --> $DIR/offset-of-tuple.rs:30:47 | LL | offset_of!(((u8, u16), (u32, u16, u8)), 0.2); | _____------------------------------------------^- @@ -207,7 +207,7 @@ LL | | offset_of!(((u8, u16), (u32, u16, u8)), 1.2.0); = note: this error originates in the macro `offset_of` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0609]: no field `0` on type `u8` - --> $DIR/offset-of-tuple.rs:33:49 + --> $DIR/offset-of-tuple.rs:32:49 | LL | offset_of!(((u8, u16), (u32, u16, u8)), 1.2.0); | ^ diff --git a/tests/ui/offset-of/offset-of-unstable-with-feature.rs b/tests/ui/offset-of/offset-of-unstable-with-feature.rs index c9d4f30e99a..c2614ba3d8a 100644 --- a/tests/ui/offset-of/offset-of-unstable-with-feature.rs +++ b/tests/ui/offset-of/offset-of-unstable-with-feature.rs @@ -1,7 +1,7 @@ //@ check-pass //@ aux-build:offset-of-staged-api.rs -#![feature(offset_of_nested, unstable_test_feature)] +#![feature(unstable_test_feature)] use std::mem::offset_of; diff --git a/tests/ui/offset-of/offset-of-unstable.rs b/tests/ui/offset-of/offset-of-unstable.rs index ab6f89ce52a..d249e8871c3 100644 --- a/tests/ui/offset-of/offset-of-unstable.rs +++ b/tests/ui/offset-of/offset-of-unstable.rs @@ -1,7 +1,5 @@ //@ aux-build:offset-of-staged-api.rs -#![feature(offset_of_nested)] - use std::mem::offset_of; extern crate offset_of_staged_api; diff --git a/tests/ui/offset-of/offset-of-unstable.stderr b/tests/ui/offset-of/offset-of-unstable.stderr index 4882dee4042..44ccad3ff39 100644 --- a/tests/ui/offset-of/offset-of-unstable.stderr +++ b/tests/ui/offset-of/offset-of-unstable.stderr @@ -1,5 +1,5 @@ error[E0658]: use of unstable library feature 'unstable_test_feature' - --> $DIR/offset-of-unstable.rs:14:9 + --> $DIR/offset-of-unstable.rs:12:9 | LL | Unstable, | ^^^^^^^^ @@ -8,7 +8,7 @@ LL | Unstable, = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: use of unstable library feature 'unstable_test_feature' - --> $DIR/offset-of-unstable.rs:23:9 + --> $DIR/offset-of-unstable.rs:21:9 | LL | UnstableWithStableFieldType, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -17,7 +17,7 @@ LL | UnstableWithStableFieldType, = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: use of unstable library feature 'unstable_test_feature' - --> $DIR/offset-of-unstable.rs:28:9 + --> $DIR/offset-of-unstable.rs:26:9 | LL | UnstableWithStableFieldType, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -26,7 +26,7 @@ LL | UnstableWithStableFieldType, = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: use of unstable library feature 'unstable_test_feature' - --> $DIR/offset-of-unstable.rs:12:5 + --> $DIR/offset-of-unstable.rs:10:5 | LL | / offset_of!( LL | | @@ -40,7 +40,7 @@ LL | | ); = note: this error originates in the macro `offset_of` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0658]: use of unstable library feature 'unstable_test_feature' - --> $DIR/offset-of-unstable.rs:18:5 + --> $DIR/offset-of-unstable.rs:16:5 | LL | offset_of!(StableWithUnstableField, unstable); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -50,7 +50,7 @@ LL | offset_of!(StableWithUnstableField, unstable); = note: this error originates in the macro `offset_of` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0658]: use of unstable library feature 'unstable_test_feature' - --> $DIR/offset-of-unstable.rs:20:5 + --> $DIR/offset-of-unstable.rs:18:5 | LL | offset_of!(StableWithUnstableFieldType, stable.unstable); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -60,7 +60,7 @@ LL | offset_of!(StableWithUnstableFieldType, stable.unstable); = note: this error originates in the macro `offset_of` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0658]: use of unstable library feature 'unstable_test_feature' - --> $DIR/offset-of-unstable.rs:21:5 + --> $DIR/offset-of-unstable.rs:19:5 | LL | / offset_of!( LL | | @@ -74,7 +74,7 @@ LL | | ); = note: this error originates in the macro `offset_of` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0658]: use of unstable library feature 'unstable_test_feature' - --> $DIR/offset-of-unstable.rs:26:5 + --> $DIR/offset-of-unstable.rs:24:5 | LL | / offset_of!( LL | | diff --git a/tests/ui/parser/brace-in-let-chain.stderr b/tests/ui/parser/brace-in-let-chain.stderr index d76cb25ad8b..913a34700df 100644 --- a/tests/ui/parser/brace-in-let-chain.stderr +++ b/tests/ui/parser/brace-in-let-chain.stderr @@ -17,14 +17,8 @@ LL | fn qux() { | - unclosed delimiter ... LL | fn foo() { - | - unclosed delimiter -... -LL | fn bar() { - | - unclosed delimiter + | - another 3 unclosed delimiters begin from here ... -LL | fn baz() { - | - unclosed delimiter -LL | if false { LL | { | - this delimiter might not be properly closed... LL | && let () = () diff --git a/tests/ui/parser/mismatched-delimiter-corner-case-issue-127868.rs b/tests/ui/parser/mismatched-delimiter-corner-case-issue-127868.rs new file mode 100644 index 00000000000..5dcaa266325 --- /dev/null +++ b/tests/ui/parser/mismatched-delimiter-corner-case-issue-127868.rs @@ -0,0 +1,6 @@ +// issue: rust-lang/rust#127868 + +fn main() { + let a = [[[[[[[[[[[[[[[[[[[[1, {, (, [,; +} //~ ERROR mismatched closing delimiter: `}` +//~ ERROR this file contains an unclosed delimiter diff --git a/tests/ui/parser/mismatched-delimiter-corner-case-issue-127868.stderr b/tests/ui/parser/mismatched-delimiter-corner-case-issue-127868.stderr new file mode 100644 index 00000000000..94e25c18e40 --- /dev/null +++ b/tests/ui/parser/mismatched-delimiter-corner-case-issue-127868.stderr @@ -0,0 +1,30 @@ +error: mismatched closing delimiter: `}` + --> $DIR/mismatched-delimiter-corner-case-issue-127868.rs:4:42 + | +LL | fn main() { + | - closing delimiter possibly meant for this +LL | let a = [[[[[[[[[[[[[[[[[[[[1, {, (, [,; + | ^ unclosed delimiter +LL | } + | ^ mismatched closing delimiter + +error: this file contains an unclosed delimiter + --> $DIR/mismatched-delimiter-corner-case-issue-127868.rs:6:52 + | +LL | fn main() { + | - unclosed delimiter +LL | let a = [[[[[[[[[[[[[[[[[[[[1, {, (, [,; + | ----- - this delimiter might not be properly closed... + | ||||| + | ||||another 16 unclosed delimiters begin from here + | |||unclosed delimiter + | ||unclosed delimiter + | |unclosed delimiter + | unclosed delimiter +LL | } + | - ...as it matches this but it has different indentation +LL | + | ^ + +error: aborting due to 2 previous errors + diff --git a/tests/ui/sanitizer/cfi-sized-associated-ty.rs b/tests/ui/sanitizer/cfi-sized-associated-ty.rs new file mode 100644 index 00000000000..f5b4e22e9d9 --- /dev/null +++ b/tests/ui/sanitizer/cfi-sized-associated-ty.rs @@ -0,0 +1,38 @@ +// Check that we only elaborate non-`Self: Sized` associated types when +// erasing the receiver from trait ref. + +//@ revisions: cfi kcfi +// FIXME(#122848) Remove only-linux once OSX CFI binaries work +//@ only-linux +//@ [cfi] needs-sanitizer-cfi +//@ [kcfi] needs-sanitizer-kcfi +//@ compile-flags: -C target-feature=-crt-static +//@ [cfi] compile-flags: -C codegen-units=1 -C lto -C prefer-dynamic=off -C opt-level=0 +//@ [cfi] compile-flags: -Z sanitizer=cfi +//@ [kcfi] compile-flags: -Z sanitizer=kcfi +//@ [kcfi] compile-flags: -C panic=abort -C prefer-dynamic=off +//@ run-pass + +trait Foo { + type Bar<'a> + where + Self: Sized; + + fn test(&self); +} + +impl Foo for () { + type Bar<'a> = () + where + Self: Sized; + + fn test(&self) {} +} + +fn test(x: &dyn Foo) { + x.test(); +} + +fn main() { + test(&()); +} diff --git a/tests/ui/traits/alias/not-a-marker.rs b/tests/ui/traits/alias/not-a-marker.rs new file mode 100644 index 00000000000..b004b9ff9ae --- /dev/null +++ b/tests/ui/traits/alias/not-a-marker.rs @@ -0,0 +1,7 @@ +#![feature(trait_alias, marker_trait_attr)] + +#[marker] +//~^ ERROR attribute should be applied to a trait +trait Foo = Send; + +fn main() {} diff --git a/tests/ui/traits/alias/not-a-marker.stderr b/tests/ui/traits/alias/not-a-marker.stderr new file mode 100644 index 00000000000..2f3f6fea30f --- /dev/null +++ b/tests/ui/traits/alias/not-a-marker.stderr @@ -0,0 +1,11 @@ +error: attribute should be applied to a trait + --> $DIR/not-a-marker.rs:3:1 + | +LL | #[marker] + | ^^^^^^^^^ +LL | +LL | trait Foo = Send; + | ----------------- not a trait + +error: aborting due to 1 previous error + |
