diff options
Diffstat (limited to 'src/test')
807 files changed, 7147 insertions, 5003 deletions
diff --git a/src/test/codegen/issue-37945.rs b/src/test/codegen/issue-37945.rs index ee63a783f52..4234c26b5e8 100644 --- a/src/test/codegen/issue-37945.rs +++ b/src/test/codegen/issue-37945.rs @@ -17,7 +17,7 @@ pub fn is_empty_1(xs: Iter<f32>) -> bool { // CHECK-NEXT: start: // CHECK-NEXT: [[A:%.*]] = icmp ne {{i32\*|ptr}} %xs.1, null // CHECK-NEXT: tail call void @llvm.assume(i1 [[A]]) -// CHECK-NEXT: [[B:%.*]] = icmp eq {{i32\*|ptr}} %xs.0, %xs.1 +// CHECK-NEXT: [[B:%.*]] = icmp eq {{i32\*|ptr}} %xs.1, %xs.0 // CHECK-NEXT: ret i1 [[B:%.*]] {xs}.next().is_none() } @@ -28,7 +28,7 @@ pub fn is_empty_2(xs: Iter<f32>) -> bool { // CHECK-NEXT: start: // CHECK-NEXT: [[C:%.*]] = icmp ne {{i32\*|ptr}} %xs.1, null // CHECK-NEXT: tail call void @llvm.assume(i1 [[C]]) -// CHECK-NEXT: [[D:%.*]] = icmp eq {{i32\*|ptr}} %xs.0, %xs.1 +// CHECK-NEXT: [[D:%.*]] = icmp eq {{i32\*|ptr}} %xs.1, %xs.0 // CHECK-NEXT: ret i1 [[D:%.*]] xs.map(|&x| x).next().is_none() } diff --git a/src/test/codegen/issue-75659.rs b/src/test/codegen/issue-75659.rs index d093c841d68..6bcb59affe3 100644 --- a/src/test/codegen/issue-75659.rs +++ b/src/test/codegen/issue-75659.rs @@ -1,7 +1,7 @@ // This test checks that the call to memchr/slice_contains is optimized away // when searching in small slices. -// compile-flags: -O +// compile-flags: -O -Zinline-mir=no // only-x86_64 #![crate_type = "lib"] diff --git a/src/test/codegen/issue-98156-const-arg-temp-lifetime.rs b/src/test/codegen/issue-98156-const-arg-temp-lifetime.rs new file mode 100644 index 00000000000..12ace5fff6b --- /dev/null +++ b/src/test/codegen/issue-98156-const-arg-temp-lifetime.rs @@ -0,0 +1,27 @@ +// This test checks that temporaries for indirectly-passed arguments get lifetime markers. + +// compile-flags: -O -C no-prepopulate-passes -Zmir-opt-level=0 + +#![crate_type = "lib"] + +extern "Rust" { + fn f(x: [u8; 1024]); +} + +const A: [u8; 1024] = [0; 1024]; + +// CHECK-LABEL: @const_arg_indirect +#[no_mangle] +pub unsafe fn const_arg_indirect() { + // Ensure that the live ranges for the two argument temporaries don't overlap. + + // CHECK: call void @llvm.lifetime.start + // CHECK: call void @f + // CHECK: call void @llvm.lifetime.end + // CHECK: call void @llvm.lifetime.start + // CHECK: call void @f + // CHECK: call void @llvm.lifetime.end + + f(A); + f(A); +} diff --git a/src/test/codegen/mem-replace-direct-memcpy.rs b/src/test/codegen/mem-replace-direct-memcpy.rs index d1c4c56dbe4..b41ef538d71 100644 --- a/src/test/codegen/mem-replace-direct-memcpy.rs +++ b/src/test/codegen/mem-replace-direct-memcpy.rs @@ -3,7 +3,7 @@ // may e.g. multiply `size_of::<T>()` with a variable "count" (which is only // known to be `1` after inlining). -// compile-flags: -C no-prepopulate-passes +// compile-flags: -C no-prepopulate-passes -Zinline-mir=no #![crate_type = "lib"] @@ -12,14 +12,12 @@ pub fn replace_byte(dst: &mut u8, src: u8) -> u8 { } // NOTE(eddyb) the `CHECK-NOT`s ensure that the only calls of `@llvm.memcpy` in -// the entire output, are the two direct calls we want, from `ptr::{read,write}`. +// the entire output, are the two direct calls we want, from `ptr::replace`. // CHECK-NOT: call void @llvm.memcpy -// CHECK: ; core::ptr::read +// CHECK: ; core::mem::replace // CHECK-NOT: call void @llvm.memcpy -// CHECK: call void @llvm.memcpy.{{.+}}({{i8\*|ptr}} align 1 %{{.*}}, {{i8\*|ptr}} align 1 %src, i{{.*}} 1, i1 false) +// CHECK: call void @llvm.memcpy.{{.+}}({{i8\*|ptr}} align 1 %{{.*}}, {{i8\*|ptr}} align 1 %dest, i{{.*}} 1, i1 false) // CHECK-NOT: call void @llvm.memcpy -// CHECK: ; core::ptr::write -// CHECK-NOT: call void @llvm.memcpy -// CHECK: call void @llvm.memcpy.{{.+}}({{i8\*|ptr}} align 1 %dst, {{i8\*|ptr}} align 1 %src, i{{.*}} 1, i1 false) +// CHECK: call void @llvm.memcpy.{{.+}}({{i8\*|ptr}} align 1 %dest, {{i8\*|ptr}} align 1 %src{{.*}}, i{{.*}} 1, i1 false) // CHECK-NOT: call void @llvm.memcpy diff --git a/src/test/codegen/remap_path_prefix/main.rs b/src/test/codegen/remap_path_prefix/main.rs index 381f11ff1ef..9bef743ddcb 100644 --- a/src/test/codegen/remap_path_prefix/main.rs +++ b/src/test/codegen/remap_path_prefix/main.rs @@ -1,7 +1,7 @@ // ignore-windows // -// compile-flags: -g -C no-prepopulate-passes --remap-path-prefix={{cwd}}=/the/cwd --remap-path-prefix={{src-base}}=/the/src +// compile-flags: -g -C no-prepopulate-passes --remap-path-prefix={{cwd}}=/the/cwd --remap-path-prefix={{src-base}}=/the/src -Zinline-mir=no // aux-build:remap_path_prefix_aux.rs extern crate remap_path_prefix_aux; diff --git a/src/test/codegen/simd-wide-sum.rs b/src/test/codegen/simd-wide-sum.rs index fde9b0fcd8a..015ac4fe4d1 100644 --- a/src/test/codegen/simd-wide-sum.rs +++ b/src/test/codegen/simd-wide-sum.rs @@ -47,8 +47,9 @@ pub fn wider_reduce_iter(x: Simd<u8, N>) -> u16 { #[no_mangle] // CHECK-LABEL: @wider_reduce_into_iter pub fn wider_reduce_into_iter(x: Simd<u8, N>) -> u16 { - // CHECK: zext <8 x i8> - // CHECK-SAME: to <8 x i16> - // CHECK: call i16 @llvm.vector.reduce.add.v8i16(<8 x i16> + // FIXME MIR inlining messes up LLVM optimizations. + // WOULD-CHECK: zext <8 x i8> + // WOULD-CHECK-SAME: to <8 x i16> + // WOULD-CHECK: call i16 @llvm.vector.reduce.add.v8i16(<8 x i16> x.to_array().into_iter().map(u16::from).sum() } diff --git a/src/test/codegen/slice-ref-equality.rs b/src/test/codegen/slice-ref-equality.rs index e5cde5e9e74..47fde12bf30 100644 --- a/src/test/codegen/slice-ref-equality.rs +++ b/src/test/codegen/slice-ref-equality.rs @@ -1,4 +1,4 @@ -// compile-flags: -C opt-level=3 +// compile-flags: -C opt-level=3 -Zmerge-functions=disabled #![crate_type = "lib"] diff --git a/src/test/codegen/swap-small-types.rs b/src/test/codegen/swap-small-types.rs index 2f375844cc7..03e2a2327fc 100644 --- a/src/test/codegen/swap-small-types.rs +++ b/src/test/codegen/swap-small-types.rs @@ -11,9 +11,10 @@ type RGB48 = [u16; 3]; // CHECK-LABEL: @swap_rgb48 #[no_mangle] pub fn swap_rgb48(x: &mut RGB48, y: &mut RGB48) { -// CHECK-NOT: alloca -// CHECK: load i48 -// CHECK: store i48 + // FIXME MIR inlining messes up LLVM optimizations. +// WOULD-CHECK-NOT: alloca +// WOULD-CHECK: load i48 +// WOULD-CHECK: store i48 swap(x, y) } diff --git a/src/test/codegen/vec-in-place.rs b/src/test/codegen/vec-in-place.rs index 13c41f7d4a9..62139aa9beb 100644 --- a/src/test/codegen/vec-in-place.rs +++ b/src/test/codegen/vec-in-place.rs @@ -53,16 +53,18 @@ pub fn vec_iterator_cast_unwrap(vec: Vec<Wrapper<u8>>) -> Vec<u8> { // CHECK-LABEL: @vec_iterator_cast_aggregate #[no_mangle] pub fn vec_iterator_cast_aggregate(vec: Vec<[u64; 4]>) -> Vec<Foo> { - // CHECK-NOT: loop - // CHECK-NOT: call + // FIXME These checks should be the same as other functions. + // CHECK-NOT: @__rust_alloc + // CHECK-NOT: @__rust_alloc vec.into_iter().map(|e| unsafe { std::mem::transmute(e) }).collect() } // CHECK-LABEL: @vec_iterator_cast_deaggregate #[no_mangle] pub fn vec_iterator_cast_deaggregate(vec: Vec<Bar>) -> Vec<[u64; 4]> { - // CHECK-NOT: loop - // CHECK-NOT: call + // FIXME These checks should be the same as other functions. + // CHECK-NOT: @__rust_alloc + // CHECK-NOT: @__rust_alloc // Safety: For the purpose of this test we assume that Bar layout matches [u64; 4]. // This currently is not guaranteed for repr(Rust) types, but it happens to work here and diff --git a/src/test/incremental/issue-61323.rs b/src/test/incremental/issue-61323.rs index 448ce367b8c..97cbfe408f2 100644 --- a/src/test/incremental/issue-61323.rs +++ b/src/test/incremental/issue-61323.rs @@ -10,6 +10,6 @@ struct C(Box<A>); #[cfg(cfail)] struct C(A); -//[cfail]~^ ERROR 12:1: 12:13: recursive type `C` has infinite size [E0072] +//[cfail]~^ ERROR 12:1: 12:9: recursive type `C` has infinite size [E0072] fn main() {} diff --git a/src/test/mir-opt/const_promotion_extern_static.BAR.PromoteTemps.diff b/src/test/mir-opt/const_promotion_extern_static.BAR.PromoteTemps.diff index 816c598059d..268d8f46464 100644 --- a/src/test/mir-opt/const_promotion_extern_static.BAR.PromoteTemps.diff +++ b/src/test/mir-opt/const_promotion_extern_static.BAR.PromoteTemps.diff @@ -40,11 +40,11 @@ - StorageDead(_5); // scope 0 at $DIR/const-promotion-extern-static.rs:9:43: 9:44 - StorageDead(_3); // scope 0 at $DIR/const-promotion-extern-static.rs:9:43: 9:44 StorageDead(_1); // scope 0 at $DIR/const-promotion-extern-static.rs:9:43: 9:44 - return; // scope 0 at $DIR/const-promotion-extern-static.rs:9:1: 9:45 + return; // scope 0 at $DIR/const-promotion-extern-static.rs:9:1: 9:28 } bb2 (cleanup): { - resume; // scope 0 at $DIR/const-promotion-extern-static.rs:9:1: 9:45 + resume; // scope 0 at $DIR/const-promotion-extern-static.rs:9:1: 9:28 } - } - diff --git a/src/test/mir-opt/const_promotion_extern_static.BOP.mir_map.0.mir b/src/test/mir-opt/const_promotion_extern_static.BOP.mir_map.0.mir index 4d24387afc7..2e63c2c25fa 100644 --- a/src/test/mir-opt/const_promotion_extern_static.BOP.mir_map.0.mir +++ b/src/test/mir-opt/const_promotion_extern_static.BOP.mir_map.0.mir @@ -12,6 +12,6 @@ static BOP: &i32 = { _1 = &_2; // scope 0 at $DIR/const-promotion-extern-static.rs:16:20: 16:23 _0 = &(*_1); // scope 0 at $DIR/const-promotion-extern-static.rs:16:20: 16:23 StorageDead(_1); // scope 0 at $DIR/const-promotion-extern-static.rs:16:22: 16:23 - return; // scope 0 at $DIR/const-promotion-extern-static.rs:16:1: 16:24 + return; // scope 0 at $DIR/const-promotion-extern-static.rs:16:1: 16:17 } } diff --git a/src/test/mir-opt/const_promotion_extern_static.FOO.PromoteTemps.diff b/src/test/mir-opt/const_promotion_extern_static.FOO.PromoteTemps.diff index 096b427bb75..322a1b206f9 100644 --- a/src/test/mir-opt/const_promotion_extern_static.FOO.PromoteTemps.diff +++ b/src/test/mir-opt/const_promotion_extern_static.FOO.PromoteTemps.diff @@ -42,11 +42,11 @@ - StorageDead(_5); // scope 0 at $DIR/const-promotion-extern-static.rs:13:54: 13:55 - StorageDead(_3); // scope 0 at $DIR/const-promotion-extern-static.rs:13:54: 13:55 StorageDead(_1); // scope 0 at $DIR/const-promotion-extern-static.rs:13:54: 13:55 - return; // scope 0 at $DIR/const-promotion-extern-static.rs:13:1: 13:56 + return; // scope 0 at $DIR/const-promotion-extern-static.rs:13:1: 13:28 } bb2 (cleanup): { - resume; // scope 0 at $DIR/const-promotion-extern-static.rs:13:1: 13:56 + resume; // scope 0 at $DIR/const-promotion-extern-static.rs:13:1: 13:28 } } - diff --git a/src/test/mir-opt/inline/caller-with-trivial-bound.rs b/src/test/mir-opt/inline/caller-with-trivial-bound.rs new file mode 100644 index 00000000000..8545db89414 --- /dev/null +++ b/src/test/mir-opt/inline/caller-with-trivial-bound.rs @@ -0,0 +1,26 @@ +// ignore-wasm32 compiled with panic=abort by default +// needs-unwind + +#![crate_type = "lib"] +pub trait Factory<T> { + type Item; +} + +pub struct IntFactory; + +impl<T> Factory<T> for IntFactory { + type Item = usize; +} + +// EMIT_MIR caller_with_trivial_bound.foo.Inline.diff +pub fn foo<T>() +where + IntFactory: Factory<T>, +{ + let mut x: <IntFactory as Factory<T>>::Item = bar::<T>(); +} + +#[inline(always)] +pub fn bar<T>() -> <IntFactory as Factory<T>>::Item { + 0usize +} diff --git a/src/test/mir-opt/inline/caller_with_trivial_bound.foo.Inline.diff b/src/test/mir-opt/inline/caller_with_trivial_bound.foo.Inline.diff new file mode 100644 index 00000000000..5d236373a4c --- /dev/null +++ b/src/test/mir-opt/inline/caller_with_trivial_bound.foo.Inline.diff @@ -0,0 +1,33 @@ +- // MIR for `foo` before Inline ++ // MIR for `foo` after Inline + + fn foo() -> () { + let mut _0: (); // return place in scope 0 at $DIR/caller-with-trivial-bound.rs:17:1: 17:1 + let mut _1: <IntFactory as Factory<T>>::Item; // in scope 0 at $DIR/caller-with-trivial-bound.rs:20:9: 20:14 + scope 1 { + debug x => _1; // in scope 1 at $DIR/caller-with-trivial-bound.rs:20:9: 20:14 + } + + bb0: { + StorageLive(_1); // scope 0 at $DIR/caller-with-trivial-bound.rs:20:9: 20:14 + _1 = bar::<T>() -> bb1; // scope 0 at $DIR/caller-with-trivial-bound.rs:20:51: 20:61 + // mir::Constant + // + span: $DIR/caller-with-trivial-bound.rs:20:51: 20:59 + // + literal: Const { ty: fn() -> <IntFactory as Factory<T>>::Item {bar::<T>}, val: Value(Scalar(<ZST>)) } + } + + bb1: { + _0 = const (); // scope 0 at $DIR/caller-with-trivial-bound.rs:19:1: 21:2 + drop(_1) -> [return: bb2, unwind: bb3]; // scope 0 at $DIR/caller-with-trivial-bound.rs:21:1: 21:2 + } + + bb2: { + StorageDead(_1); // scope 0 at $DIR/caller-with-trivial-bound.rs:21:1: 21:2 + return; // scope 0 at $DIR/caller-with-trivial-bound.rs:21:2: 21:2 + } + + bb3 (cleanup): { + resume; // scope 0 at $DIR/caller-with-trivial-bound.rs:16:1: 21:2 + } + } + diff --git a/src/test/mir-opt/inline/inline_cycle.one.Inline.diff b/src/test/mir-opt/inline/inline_cycle.one.Inline.diff index b732e7cdb9b..3b32cb80911 100644 --- a/src/test/mir-opt/inline/inline_cycle.one.Inline.diff +++ b/src/test/mir-opt/inline/inline_cycle.one.Inline.diff @@ -5,17 +5,20 @@ let mut _0: (); // return place in scope 0 at $DIR/inline-cycle.rs:13:10: 13:10 let _1: (); // in scope 0 at $DIR/inline-cycle.rs:14:5: 14:24 + scope 1 (inlined <C as Call>::call) { // at $DIR/inline-cycle.rs:14:5: 14:24 ++ scope 2 (inlined <A<C> as Call>::call) { // at $DIR/inline-cycle.rs:43:9: 43:23 ++ scope 3 (inlined <B<C> as Call>::call) { // at $DIR/inline-cycle.rs:28:9: 28:31 ++ } ++ } + } bb0: { StorageLive(_1); // scope 0 at $DIR/inline-cycle.rs:14:5: 14:24 - _1 = <C as Call>::call() -> bb1; // scope 0 at $DIR/inline-cycle.rs:14:5: 14:24 -+ _1 = <A<C> as Call>::call() -> bb1; // scope 1 at $DIR/inline-cycle.rs:43:9: 43:23 ++ _1 = <C as Call>::call() -> bb1; // scope 3 at $DIR/inline-cycle.rs:36:9: 36:28 // mir::Constant - // + span: $DIR/inline-cycle.rs:14:5: 14:22 -- // + literal: Const { ty: fn() {<C as Call>::call}, val: Value(Scalar(<ZST>)) } -+ // + span: $DIR/inline-cycle.rs:43:9: 43:21 -+ // + literal: Const { ty: fn() {<A<C> as Call>::call}, val: Value(Scalar(<ZST>)) } ++ // + span: $DIR/inline-cycle.rs:36:9: 36:26 + // + literal: Const { ty: fn() {<C as Call>::call}, val: Value(Scalar(<ZST>)) } } bb1: { diff --git a/src/test/mir-opt/inline/inline_cycle.two.Inline.diff b/src/test/mir-opt/inline/inline_cycle.two.Inline.diff index eac5bf8edec..c7f8a64afcd 100644 --- a/src/test/mir-opt/inline/inline_cycle.two.Inline.diff +++ b/src/test/mir-opt/inline/inline_cycle.two.Inline.diff @@ -11,6 +11,9 @@ + let _3: (); // in scope 1 at $DIR/inline-cycle.rs:54:5: 54:8 + let mut _4: fn() {f}; // in scope 1 at $DIR/inline-cycle.rs:54:5: 54:6 + scope 2 (inlined <fn() {f} as FnOnce<()>>::call_once - shim(fn() {f})) { // at $DIR/inline-cycle.rs:54:5: 54:8 ++ scope 3 (inlined f) { // at $SRC_DIR/core/src/ops/function.rs:LL:COL ++ let _6: (); // in scope 3 at $DIR/inline-cycle.rs:59:5: 59:12 ++ } + } + } @@ -21,19 +24,26 @@ + _2 = f; // scope 0 at $DIR/inline-cycle.rs:49:5: 49:12 // mir::Constant - // + span: $DIR/inline-cycle.rs:49:5: 49:9 -- // + literal: Const { ty: fn(fn() {f}) {call::<fn() {f}>}, val: Value(Scalar(<ZST>)) } -- // mir::Constant - // + span: $DIR/inline-cycle.rs:49:10: 49:11 - // + literal: Const { ty: fn() {f}, val: Value(Scalar(<ZST>)) } ++ // + span: $DIR/inline-cycle.rs:49:10: 49:11 ++ // + literal: Const { ty: fn() {f}, val: Value(Scalar(<ZST>)) } + StorageLive(_3); // scope 1 at $DIR/inline-cycle.rs:54:5: 54:8 + StorageLive(_4); // scope 1 at $DIR/inline-cycle.rs:54:5: 54:6 + _4 = move _2; // scope 1 at $DIR/inline-cycle.rs:54:5: 54:6 + StorageLive(_5); // scope 1 at $DIR/inline-cycle.rs:54:5: 54:8 + _5 = const (); // scope 1 at $DIR/inline-cycle.rs:54:5: 54:8 -+ _3 = move _4() -> bb1; // scope 2 at $SRC_DIR/core/src/ops/function.rs:LL:COL ++ StorageLive(_6); // scope 3 at $DIR/inline-cycle.rs:59:5: 59:12 ++ _6 = call::<fn() {f}>(f) -> bb1; // scope 3 at $DIR/inline-cycle.rs:59:5: 59:12 ++ // mir::Constant ++ // + span: $DIR/inline-cycle.rs:59:5: 59:9 + // + literal: Const { ty: fn(fn() {f}) {call::<fn() {f}>}, val: Value(Scalar(<ZST>)) } + // mir::Constant +- // + span: $DIR/inline-cycle.rs:49:10: 49:11 ++ // + span: $DIR/inline-cycle.rs:59:10: 59:11 + // + literal: Const { ty: fn() {f}, val: Value(Scalar(<ZST>)) } } bb1: { ++ StorageDead(_6); // scope 3 at $DIR/inline-cycle.rs:59:12: 59:13 + StorageDead(_5); // scope 1 at $DIR/inline-cycle.rs:54:5: 54:8 + StorageDead(_4); // scope 1 at $DIR/inline-cycle.rs:54:7: 54:8 + StorageDead(_3); // scope 1 at $DIR/inline-cycle.rs:54:8: 54:9 diff --git a/src/test/mir-opt/inline/inline_cycle_generic.main.Inline.diff b/src/test/mir-opt/inline/inline_cycle_generic.main.Inline.diff index 267f53a8dfe..2a19b21510a 100644 --- a/src/test/mir-opt/inline/inline_cycle_generic.main.Inline.diff +++ b/src/test/mir-opt/inline/inline_cycle_generic.main.Inline.diff @@ -4,12 +4,22 @@ fn main() -> () { let mut _0: (); // return place in scope 0 at $DIR/inline-cycle-generic.rs:8:11: 8:11 let _1: (); // in scope 0 at $DIR/inline-cycle-generic.rs:9:5: 9:24 ++ scope 1 (inlined <C as Call>::call) { // at $DIR/inline-cycle-generic.rs:9:5: 9:24 ++ scope 2 (inlined <B<A> as Call>::call) { // at $DIR/inline-cycle-generic.rs:38:9: 38:31 ++ scope 3 (inlined <A as Call>::call) { // at $DIR/inline-cycle-generic.rs:31:9: 31:28 ++ scope 4 (inlined <B<C> as Call>::call) { // at $DIR/inline-cycle-generic.rs:23:9: 23:31 ++ } ++ } ++ } ++ } bb0: { StorageLive(_1); // scope 0 at $DIR/inline-cycle-generic.rs:9:5: 9:24 - _1 = <C as Call>::call() -> bb1; // scope 0 at $DIR/inline-cycle-generic.rs:9:5: 9:24 +- _1 = <C as Call>::call() -> bb1; // scope 0 at $DIR/inline-cycle-generic.rs:9:5: 9:24 ++ _1 = <C as Call>::call() -> bb1; // scope 4 at $DIR/inline-cycle-generic.rs:31:9: 31:28 // mir::Constant - // + span: $DIR/inline-cycle-generic.rs:9:5: 9:22 +- // + span: $DIR/inline-cycle-generic.rs:9:5: 9:22 ++ // + span: $DIR/inline-cycle-generic.rs:31:9: 31:26 // + literal: Const { ty: fn() {<C as Call>::call}, val: Value(Scalar(<ZST>)) } } @@ -17,6 +27,10 @@ StorageDead(_1); // scope 0 at $DIR/inline-cycle-generic.rs:9:24: 9:25 _0 = const (); // scope 0 at $DIR/inline-cycle-generic.rs:8:11: 10:2 return; // scope 0 at $DIR/inline-cycle-generic.rs:10:2: 10:2 ++ } ++ ++ bb2 (cleanup): { ++ resume; // scope 0 at $DIR/inline-cycle-generic.rs:8:1: 10:2 } } diff --git a/src/test/mir-opt/issue_41697.{impl#0}-{constant#0}.SimplifyCfg-promote-consts.after.32bit.mir b/src/test/mir-opt/issue_41697.{impl#0}-{constant#0}.SimplifyCfg-promote-consts.after.32bit.mir index db9caf84314..701e291f46e 100644 --- a/src/test/mir-opt/issue_41697.{impl#0}-{constant#0}.SimplifyCfg-promote-consts.after.32bit.mir +++ b/src/test/mir-opt/issue_41697.{impl#0}-{constant#0}.SimplifyCfg-promote-consts.after.32bit.mir @@ -1,6 +1,6 @@ -// MIR for `<impl at $DIR/issue-41697.rs:18:1: 22:2>::{constant#0}` after SimplifyCfg-promote-consts +// MIR for `<impl at $DIR/issue-41697.rs:18:1: 18:23>::{constant#0}` after SimplifyCfg-promote-consts -<impl at $DIR/issue-41697.rs:18:1: 22:2>::{constant#0}: usize = { +<impl at $DIR/issue-41697.rs:18:1: 18:23>::{constant#0}: usize = { let mut _0: usize; // return place in scope 0 at $DIR/issue-41697.rs:18:19: 18:22 let mut _1: (usize, bool); // in scope 0 at $DIR/issue-41697.rs:18:19: 18:22 diff --git a/src/test/mir-opt/issue_41697.{impl#0}-{constant#0}.SimplifyCfg-promote-consts.after.64bit.mir b/src/test/mir-opt/issue_41697.{impl#0}-{constant#0}.SimplifyCfg-promote-consts.after.64bit.mir index db9caf84314..701e291f46e 100644 --- a/src/test/mir-opt/issue_41697.{impl#0}-{constant#0}.SimplifyCfg-promote-consts.after.64bit.mir +++ b/src/test/mir-opt/issue_41697.{impl#0}-{constant#0}.SimplifyCfg-promote-consts.after.64bit.mir @@ -1,6 +1,6 @@ -// MIR for `<impl at $DIR/issue-41697.rs:18:1: 22:2>::{constant#0}` after SimplifyCfg-promote-consts +// MIR for `<impl at $DIR/issue-41697.rs:18:1: 18:23>::{constant#0}` after SimplifyCfg-promote-consts -<impl at $DIR/issue-41697.rs:18:1: 22:2>::{constant#0}: usize = { +<impl at $DIR/issue-41697.rs:18:1: 18:23>::{constant#0}: usize = { let mut _0: usize; // return place in scope 0 at $DIR/issue-41697.rs:18:19: 18:22 let mut _1: (usize, bool); // in scope 0 at $DIR/issue-41697.rs:18:19: 18:22 diff --git a/src/test/mir-opt/retag.array_casts.SimplifyCfg-elaborate-drops.after.mir b/src/test/mir-opt/retag.array_casts.SimplifyCfg-elaborate-drops.after.mir index 69742d6bc3b..c8c45da1913 100644 --- a/src/test/mir-opt/retag.array_casts.SimplifyCfg-elaborate-drops.after.mir +++ b/src/test/mir-opt/retag.array_casts.SimplifyCfg-elaborate-drops.after.mir @@ -129,6 +129,7 @@ fn array_casts() -> () { _18 = &(*_35); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL Retag(_18); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL _13 = (move _14, move _18); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + Retag(_13); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL StorageDead(_18); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL StorageDead(_14); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL StorageLive(_20); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL @@ -171,6 +172,7 @@ fn array_casts() -> () { Retag(_32); // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL StorageLive(_34); // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL _34 = Option::<Arguments>::None; // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + Retag(_34); // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL _28 = core::panicking::assert_failed::<usize, usize>(move _29, move _30, move _32, move _34); // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL // mir::Constant // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL diff --git a/src/test/mir-opt/retag.{impl#0}-foo.SimplifyCfg-elaborate-drops.after.mir b/src/test/mir-opt/retag.{impl#0}-foo.SimplifyCfg-elaborate-drops.after.mir index f9ed3932d33..980f07d5f10 100644 --- a/src/test/mir-opt/retag.{impl#0}-foo.SimplifyCfg-elaborate-drops.after.mir +++ b/src/test/mir-opt/retag.{impl#0}-foo.SimplifyCfg-elaborate-drops.after.mir @@ -1,6 +1,6 @@ -// MIR for `<impl at $DIR/retag.rs:11:1: 19:2>::foo` after SimplifyCfg-elaborate-drops +// MIR for `<impl at $DIR/retag.rs:11:1: 11:10>::foo` after SimplifyCfg-elaborate-drops -fn <impl at $DIR/retag.rs:11:1: 19:2>::foo(_1: &Test, _2: &mut i32) -> &mut i32 { +fn <impl at $DIR/retag.rs:11:1: 11:10>::foo(_1: &Test, _2: &mut i32) -> &mut i32 { debug self => _1; // in scope 0 at $DIR/retag.rs:13:16: 13:21 debug x => _2; // in scope 0 at $DIR/retag.rs:13:23: 13:24 let mut _0: &mut i32; // return place in scope 0 at $DIR/retag.rs:13:42: 13:53 diff --git a/src/test/mir-opt/retag.{impl#0}-foo_shr.SimplifyCfg-elaborate-drops.after.mir b/src/test/mir-opt/retag.{impl#0}-foo_shr.SimplifyCfg-elaborate-drops.after.mir index 87a8603a931..9c252d63fc7 100644 --- a/src/test/mir-opt/retag.{impl#0}-foo_shr.SimplifyCfg-elaborate-drops.after.mir +++ b/src/test/mir-opt/retag.{impl#0}-foo_shr.SimplifyCfg-elaborate-drops.after.mir @@ -1,6 +1,6 @@ -// MIR for `<impl at $DIR/retag.rs:11:1: 19:2>::foo_shr` after SimplifyCfg-elaborate-drops +// MIR for `<impl at $DIR/retag.rs:11:1: 11:10>::foo_shr` after SimplifyCfg-elaborate-drops -fn <impl at $DIR/retag.rs:11:1: 19:2>::foo_shr(_1: &Test, _2: &i32) -> &i32 { +fn <impl at $DIR/retag.rs:11:1: 11:10>::foo_shr(_1: &Test, _2: &i32) -> &i32 { debug self => _1; // in scope 0 at $DIR/retag.rs:16:20: 16:25 debug x => _2; // in scope 0 at $DIR/retag.rs:16:27: 16:28 let mut _0: &i32; // return place in scope 0 at $DIR/retag.rs:16:42: 16:49 diff --git a/src/test/mir-opt/storage_live_dead_in_statics.XXX.mir_map.0.mir b/src/test/mir-opt/storage_live_dead_in_statics.XXX.mir_map.0.mir index e0875ab0069..2c4738aa866 100644 --- a/src/test/mir-opt/storage_live_dead_in_statics.XXX.mir_map.0.mir +++ b/src/test/mir-opt/storage_live_dead_in_statics.XXX.mir_map.0.mir @@ -198,6 +198,6 @@ static XXX: &Foo = { _0 = &(*_1); // scope 0 at $DIR/storage_live_dead_in_statics.rs:5:28: 23:2 StorageDead(_5); // scope 0 at $DIR/storage_live_dead_in_statics.rs:23:1: 23:2 StorageDead(_1); // scope 0 at $DIR/storage_live_dead_in_statics.rs:23:1: 23:2 - return; // scope 0 at $DIR/storage_live_dead_in_statics.rs:5:1: 23:3 + return; // scope 0 at $DIR/storage_live_dead_in_statics.rs:5:1: 5:25 } } diff --git a/src/test/mir-opt/unusual_item_types.{impl#0}-ASSOCIATED_CONSTANT.mir_map.0.32bit.mir b/src/test/mir-opt/unusual_item_types.{impl#0}-ASSOCIATED_CONSTANT.mir_map.0.32bit.mir index a046a89bc8c..c41fe61d48b 100644 --- a/src/test/mir-opt/unusual_item_types.{impl#0}-ASSOCIATED_CONSTANT.mir_map.0.32bit.mir +++ b/src/test/mir-opt/unusual_item_types.{impl#0}-ASSOCIATED_CONSTANT.mir_map.0.32bit.mir @@ -1,10 +1,10 @@ -// MIR for `<impl at $DIR/unusual-item-types.rs:9:1: 11:2>::ASSOCIATED_CONSTANT` 0 mir_map +// MIR for `<impl at $DIR/unusual-item-types.rs:9:1: 9:7>::ASSOCIATED_CONSTANT` 0 mir_map -const <impl at $DIR/unusual-item-types.rs:9:1: 11:2>::ASSOCIATED_CONSTANT: i32 = { +const <impl at $DIR/unusual-item-types.rs:9:1: 9:7>::ASSOCIATED_CONSTANT: i32 = { let mut _0: i32; // return place in scope 0 at $DIR/unusual-item-types.rs:10:32: 10:35 bb0: { _0 = const 2_i32; // scope 0 at $DIR/unusual-item-types.rs:10:38: 10:39 - return; // scope 0 at $DIR/unusual-item-types.rs:10:5: 10:40 + return; // scope 0 at $DIR/unusual-item-types.rs:10:5: 10:35 } } diff --git a/src/test/mir-opt/unusual_item_types.{impl#0}-ASSOCIATED_CONSTANT.mir_map.0.64bit.mir b/src/test/mir-opt/unusual_item_types.{impl#0}-ASSOCIATED_CONSTANT.mir_map.0.64bit.mir index a046a89bc8c..c41fe61d48b 100644 --- a/src/test/mir-opt/unusual_item_types.{impl#0}-ASSOCIATED_CONSTANT.mir_map.0.64bit.mir +++ b/src/test/mir-opt/unusual_item_types.{impl#0}-ASSOCIATED_CONSTANT.mir_map.0.64bit.mir @@ -1,10 +1,10 @@ -// MIR for `<impl at $DIR/unusual-item-types.rs:9:1: 11:2>::ASSOCIATED_CONSTANT` 0 mir_map +// MIR for `<impl at $DIR/unusual-item-types.rs:9:1: 9:7>::ASSOCIATED_CONSTANT` 0 mir_map -const <impl at $DIR/unusual-item-types.rs:9:1: 11:2>::ASSOCIATED_CONSTANT: i32 = { +const <impl at $DIR/unusual-item-types.rs:9:1: 9:7>::ASSOCIATED_CONSTANT: i32 = { let mut _0: i32; // return place in scope 0 at $DIR/unusual-item-types.rs:10:32: 10:35 bb0: { _0 = const 2_i32; // scope 0 at $DIR/unusual-item-types.rs:10:38: 10:39 - return; // scope 0 at $DIR/unusual-item-types.rs:10:5: 10:40 + return; // scope 0 at $DIR/unusual-item-types.rs:10:5: 10:35 } } diff --git a/src/test/run-make-fulldeps/alloc-no-oom-handling/Makefile b/src/test/run-make-fulldeps/alloc-no-oom-handling/Makefile index 6e25eb7e459..eb6ad9bd1a7 100644 --- a/src/test/run-make-fulldeps/alloc-no-oom-handling/Makefile +++ b/src/test/run-make-fulldeps/alloc-no-oom-handling/Makefile @@ -1,4 +1,4 @@ -include ../tools.mk all: - $(RUSTC) --edition=2021 --crate-type=rlib ../../../../library/alloc/src/lib.rs --cfg no_global_oom_handling + $(RUSTC) --edition=2021 -Dwarnings --crate-type=rlib ../../../../library/alloc/src/lib.rs --cfg no_global_oom_handling diff --git a/src/test/run-make-fulldeps/atomic-lock-free/atomic_lock_free.rs b/src/test/run-make-fulldeps/atomic-lock-free/atomic_lock_free.rs index e9b28504a90..47d90b1856b 100644 --- a/src/test/run-make-fulldeps/atomic-lock-free/atomic_lock_free.rs +++ b/src/test/run-make-fulldeps/atomic-lock-free/atomic_lock_free.rs @@ -3,7 +3,7 @@ #![no_core] extern "rust-intrinsic" { - fn atomic_xadd<T>(dst: *mut T, src: T) -> T; + fn atomic_xadd_seqcst<T>(dst: *mut T, src: T) -> T; } #[lang = "sized"] @@ -17,50 +17,50 @@ impl<T: ?Sized> Copy for *mut T {} #[cfg(target_has_atomic = "8")] pub unsafe fn atomic_u8(x: *mut u8) { - atomic_xadd(x, 1); - atomic_xadd(x, 1); + atomic_xadd_seqcst(x, 1); + atomic_xadd_seqcst(x, 1); } #[cfg(target_has_atomic = "8")] pub unsafe fn atomic_i8(x: *mut i8) { - atomic_xadd(x, 1); + atomic_xadd_seqcst(x, 1); } #[cfg(target_has_atomic = "16")] pub unsafe fn atomic_u16(x: *mut u16) { - atomic_xadd(x, 1); + atomic_xadd_seqcst(x, 1); } #[cfg(target_has_atomic = "16")] pub unsafe fn atomic_i16(x: *mut i16) { - atomic_xadd(x, 1); + atomic_xadd_seqcst(x, 1); } #[cfg(target_has_atomic = "32")] pub unsafe fn atomic_u32(x: *mut u32) { - atomic_xadd(x, 1); + atomic_xadd_seqcst(x, 1); } #[cfg(target_has_atomic = "32")] pub unsafe fn atomic_i32(x: *mut i32) { - atomic_xadd(x, 1); + atomic_xadd_seqcst(x, 1); } #[cfg(target_has_atomic = "64")] pub unsafe fn atomic_u64(x: *mut u64) { - atomic_xadd(x, 1); + atomic_xadd_seqcst(x, 1); } #[cfg(target_has_atomic = "64")] pub unsafe fn atomic_i64(x: *mut i64) { - atomic_xadd(x, 1); + atomic_xadd_seqcst(x, 1); } #[cfg(target_has_atomic = "128")] pub unsafe fn atomic_u128(x: *mut u128) { - atomic_xadd(x, 1); + atomic_xadd_seqcst(x, 1); } #[cfg(target_has_atomic = "128")] pub unsafe fn atomic_i128(x: *mut i128) { - atomic_xadd(x, 1); + atomic_xadd_seqcst(x, 1); } #[cfg(target_has_atomic = "ptr")] pub unsafe fn atomic_usize(x: *mut usize) { - atomic_xadd(x, 1); + atomic_xadd_seqcst(x, 1); } #[cfg(target_has_atomic = "ptr")] pub unsafe fn atomic_isize(x: *mut isize) { - atomic_xadd(x, 1); + atomic_xadd_seqcst(x, 1); } diff --git a/src/test/run-make/issue-88756-default-output/Makefile b/src/test/run-make/issue-88756-default-output/Makefile new file mode 100644 index 00000000000..cacbcbf3933 --- /dev/null +++ b/src/test/run-make/issue-88756-default-output/Makefile @@ -0,0 +1,4 @@ +-include ../../run-make-fulldeps/tools.mk + +all: + $(BARE_RUSTDOC) 2>&1 | sed -E 's@/nightly/|/beta/|/stable/|/1\.[0-9]+\.[0-9]+/@/$$CHANNEL/@g' | diff - output-default.stdout diff --git a/src/test/run-make/issue-88756-default-output/README.md b/src/test/run-make/issue-88756-default-output/README.md new file mode 100644 index 00000000000..8cbfac4f7d2 --- /dev/null +++ b/src/test/run-make/issue-88756-default-output/README.md @@ -0,0 +1 @@ +This is a test to verify that the default behavior of `rustdoc` is printing out help output instead of erroring out (#88756). diff --git a/src/test/run-make/issue-88756-default-output/output-default.stdout b/src/test/run-make/issue-88756-default-output/output-default.stdout new file mode 100644 index 00000000000..6d16fe5673b --- /dev/null +++ b/src/test/run-make/issue-88756-default-output/output-default.stdout @@ -0,0 +1,193 @@ +rustdoc [options] <input> + +Options: + -h, --help show this help message + -V, --version print rustdoc's version + -v, --verbose use verbose output + -w, --output-format [html] + the output type to write + --output PATH Which directory to place the output. This option is + deprecated, use --out-dir instead. + -o, --out-dir PATH which directory to place the output + --crate-name NAME + specify the name of this crate + --crate-type [bin|lib|rlib|dylib|cdylib|staticlib|proc-macro] + Comma separated list of types of crates + for the compiler to emit + -L, --library-path DIR + directory to add to crate search path + --cfg pass a --cfg to rustc + --check-cfg pass a --check-cfg to rustc + --extern NAME[=PATH] + pass an --extern to rustc + --extern-html-root-url NAME=URL + base URL to use for dependencies; for example, + "std=/doc" links std::vec::Vec to + /doc/std/vec/struct.Vec.html + --extern-html-root-takes-precedence + give precedence to `--extern-html-root-url`, not + `html_root_url` + -C, --codegen OPT[=VALUE] + pass a codegen option to rustc + --document-private-items + document private items + --document-hidden-items + document items that have doc(hidden) + --test run code examples as tests + --test-args ARGS + arguments to pass to the test runner + --test-run-directory PATH + The working directory in which to run tests + --target TRIPLE target triple to document + --markdown-css FILES + CSS files to include via <link> in a rendered Markdown + file + --html-in-header FILES + files to include inline in the <head> section of a + rendered Markdown file or generated documentation + --html-before-content FILES + files to include inline between <body> and the content + of a rendered Markdown file or generated documentation + --html-after-content FILES + files to include inline between the content and + </body> of a rendered Markdown file or generated + documentation + --markdown-before-content FILES + files to include inline between <body> and the content + of a rendered Markdown file or generated documentation + --markdown-after-content FILES + files to include inline between the content and + </body> of a rendered Markdown file or generated + documentation + --markdown-playground-url URL + URL to send code snippets to + --markdown-no-toc + don't include table of contents + -e, --extend-css PATH + To add some CSS rules with a given file to generate + doc with your own theme. However, your theme might + break if the rustdoc's generated HTML changes, so be + careful! + -Z FLAG internal and debugging options (only on nightly build) + --sysroot PATH Override the system root + --playground-url URL + URL to send code snippets to, may be reset by + --markdown-playground-url or + `#![doc(html_playground_url=...)]` + --display-doctest-warnings + show warnings that originate in doctests + --crate-version VERSION + crate version to print into documentation + --sort-modules-by-appearance + sort modules by where they appear in the program, + rather than alphabetically + --default-theme THEME + Set the default theme. THEME should be the theme name, + generally lowercase. If an unknown default theme is + specified, the builtin default is used. The set of + themes, and the rustdoc built-in default, are not + stable. + --default-setting SETTING[=VALUE] + Default value for a rustdoc setting (used when + "rustdoc-SETTING" is absent from web browser Local + Storage). If VALUE is not supplied, "true" is used. + Supported SETTINGs and VALUEs are not documented and + not stable. + --theme FILES additional themes which will be added to the generated + docs + --check-theme FILES + check if given theme is valid + --resource-suffix PATH + suffix to add to CSS and JavaScript files, e.g., + "light.css" will become "light-suffix.css" + --edition EDITION + edition to use when compiling rust code (default: + 2015) + --color auto|always|never + Configure coloring of output: + auto = colorize, if output goes to a tty (default); + always = always colorize output; + never = never colorize output + --error-format human|json|short + How errors and other messages are produced + --json CONFIG Configure the structure of JSON diagnostics + --disable-minification + Disable minification applied on JS files + -A, --allow LINT Set lint allowed + -W, --warn LINT Set lint warnings + --force-warn LINT + Set lint force-warn + -D, --deny LINT Set lint denied + -F, --forbid LINT Set lint forbidden + --cap-lints LEVEL + Set the most restrictive lint level. More restrictive + lints are capped at this level. By default, it is at + `forbid` level. + --index-page PATH + Markdown file to be used as index page + --enable-index-page + To enable generation of the index page + --static-root-path PATH + Path string to force loading static files from in + output pages. If not set, uses combinations of '../' + to reach the documentation root. + --disable-per-crate-search + disables generating the crate selector on the search + box + --persist-doctests PATH + Directory to persist doctest executables into + --show-coverage + calculate percentage of public items with + documentation + --enable-per-target-ignores + parse ignore-foo for ignoring doctests on a per-target + basis + --runtool The tool to run tests with when building for a different target than host + + --runtool-arg One (of possibly many) arguments to pass to the runtool + + --test-builder PATH + The rustc-like binary to use as the test builder + --check Run rustdoc checks + --generate-redirect-map + Generate JSON file at the top level instead of + generating HTML redirection files + --emit [unversioned-shared-resources,toolchain-shared-resources,invocation-specific] + Comma separated list of types of output for rustdoc to + emit + --no-run Compile doctests without running them + --show-type-layout + Include the memory layout of types in the docs + --nocapture Don't capture stdout and stderr of tests + --generate-link-to-definition + Make the identifiers in the HTML source code pages + navigable + --scrape-examples-output-path collect function call information and output at the given path + + --scrape-examples-target-crate collect function call information for functions from the target crate + + --scrape-tests Include test code when scraping examples + --with-examples path to function call information (for displaying examples in the documentation) + + --plugin-path DIR + removed, see issue #44136 + <https://github.com/rust-lang/rust/issues/44136> for + more information + --passes PASSES removed, see issue #44136 + <https://github.com/rust-lang/rust/issues/44136> for + more information + --plugins PLUGINS + removed, see issue #44136 + <https://github.com/rust-lang/rust/issues/44136> for + more information + --no-defaults removed, see issue #44136 + <https://github.com/rust-lang/rust/issues/44136> for + more information + -r, --input-format [rust] + removed, see issue #44136 + <https://github.com/rust-lang/rust/issues/44136> for + more information + + @path Read newline separated options from `path` + +More information available at https://doc.rust-lang.org/$CHANNEL/rustdoc/what-is-rustdoc.html diff --git a/src/test/run-make/issue-88756-default-output/x.rs b/src/test/run-make/issue-88756-default-output/x.rs new file mode 100644 index 00000000000..5df7576133a --- /dev/null +++ b/src/test/run-make/issue-88756-default-output/x.rs @@ -0,0 +1 @@ +// nothing to see here diff --git a/src/test/run-make/issue-88756-opt-help/Makefile b/src/test/run-make/issue-88756-opt-help/Makefile new file mode 100644 index 00000000000..8ababbf5b4e --- /dev/null +++ b/src/test/run-make/issue-88756-opt-help/Makefile @@ -0,0 +1,4 @@ +-include ../../run-make-fulldeps/tools.mk + +all: + $(RUSTDOC) -W help 2>&1 | diff - output-default.stdout diff --git a/src/test/run-make/issue-88756-opt-help/README.md b/src/test/run-make/issue-88756-opt-help/README.md new file mode 100644 index 00000000000..9b742753f25 --- /dev/null +++ b/src/test/run-make/issue-88756-opt-help/README.md @@ -0,0 +1 @@ +This is a test to verify that `rustdoc` behaves the same as rustc and prints out help output for its options like -W (#88756). diff --git a/src/test/run-make/issue-88756-opt-help/output-default.stdout b/src/test/run-make/issue-88756-opt-help/output-default.stdout new file mode 100644 index 00000000000..5cb7ecb649a --- /dev/null +++ b/src/test/run-make/issue-88756-opt-help/output-default.stdout @@ -0,0 +1,193 @@ + -W allow-features=val -- only allow the listed language features to be enabled in code (space separated) + -W always-encode-mir=val -- encode MIR of all functions into the crate metadata (default: no) + -W assume-incomplete-release=val -- make cfg(version) treat the current version as incomplete (default: no) + -W asm-comments=val -- generate comments into the assembly (may change behavior) (default: no) + -W assert-incr-state=val -- assert that the incremental cache is in given state: either `loaded` or `not-loaded`. + -W binary-dep-depinfo=val -- include artifacts (sysroot, crate dependencies) used during compilation in dep-info (default: no) + -W branch-protection=val -- set options for branch target identification and pointer authentication on AArch64 + -W cf-protection=val -- instrument control-flow architecture protection + -W cgu-partitioning-strategy=val -- the codegen unit partitioning strategy to use + -W chalk=val -- enable the experimental Chalk-based trait solving engine + -W codegen-backend=val -- the backend to use + -W combine-cgu=val -- combine CGUs into a single one + -W crate-attr=val -- inject the given attribute in the crate + -W debug-info-for-profiling=val -- emit discriminators and other data necessary for AutoFDO + -W debug-macros=val -- emit line numbers debug info inside macros (default: no) + -W deduplicate-diagnostics=val -- deduplicate identical diagnostics (default: yes) + -W dep-info-omit-d-target=val -- in dep-info output, omit targets for tracking dependencies of the dep-info files themselves (default: no) + -W dep-tasks=val -- print tasks that execute and the color their dep node gets (requires debug build) (default: no) + -W dlltool=val -- import library generation tool (windows-gnu only) + -W dont-buffer-diagnostics=val -- emit diagnostics rather than buffering (breaks NLL error downgrading, sorting) (default: no) + -W drop-tracking=val -- enables drop tracking in generators (default: no) + -W dual-proc-macros=val -- load proc macros for both target and host, but only link to the target (default: no) + -W dump-dep-graph=val -- dump the dependency graph to $RUST_DEP_GRAPH (default: /tmp/dep_graph.gv) (default: no) + -W dump-mir=val -- dump MIR state to file. + `val` is used to select which passes and functions to dump. For example: + `all` matches all passes and functions, + `foo` matches all passes for functions whose name contains 'foo', + `foo & ConstProp` only the 'ConstProp' pass for function names containing 'foo', + `foo | bar` all passes for function names containing 'foo' or 'bar'. + -W dump-mir-dataflow=val -- in addition to `.mir` files, create graphviz `.dot` files with dataflow results (default: no) + -W dump-mir-dir=val -- the directory the MIR is dumped into (default: `mir_dump`) + -W dump-mir-exclude-pass-number=val -- exclude the pass number when dumping MIR (used in tests) (default: no) + -W dump-mir-graphviz=val -- in addition to `.mir` files, create graphviz `.dot` files (and with `-Z instrument-coverage`, also create a `.dot` file for the MIR-derived coverage graph) (default: no) + -W dump-mir-spanview=val -- in addition to `.mir` files, create `.html` files to view spans for all `statement`s (including terminators), only `terminator` spans, or computed `block` spans (one span encompassing a block's terminator and all statements). If `-Z instrument-coverage` is also enabled, create an additional `.html` file showing the computed coverage spans. + -W emit-stack-sizes=val -- emit a section containing stack size metadata (default: no) + -W fewer-names=val -- reduce memory use by retaining fewer names within compilation artifacts (LLVM-IR) (default: no) + -W force-unstable-if-unmarked=val -- force all crates to be `rustc_private` unstable (default: no) + -W fuel=val -- set the optimization fuel quota for a crate + -W function-sections=val -- whether each function should go in its own section + -W future-incompat-test=val -- forces all lints to be future incompatible, used for internal testing (default: no) + -W gcc-ld=val -- implementation of ld used by cc + -W graphviz-dark-mode=val -- use dark-themed colors in graphviz output (default: no) + -W graphviz-font=val -- use the given `fontname` in graphviz output; can be overridden by setting environment variable `RUSTC_GRAPHVIZ_FONT` (default: `Courier, monospace`) + -W hir-stats=val -- print some statistics about AST and HIR (default: no) + -W human-readable-cgu-names=val -- generate human-readable, predictable names for codegen units (default: no) + -W identify-regions=val -- display unnamed regions as `'<id>`, using a non-ident unique id (default: no) + -W incremental-ignore-spans=val -- ignore spans during ICH computation -- used for testing (default: no) + -W incremental-info=val -- print high-level information about incremental reuse (or the lack thereof) (default: no) + -W incremental-relative-spans=val -- hash spans relative to their parent item for incr. comp. (default: no) + -W incremental-verify-ich=val -- verify incr. comp. hashes of green query instances (default: no) + -W inline-mir=val -- enable MIR inlining (default: no) + -W inline-mir-threshold=val -- a default MIR inlining threshold (default: 50) + -W inline-mir-hint-threshold=val -- inlining threshold for functions with inline hint (default: 100) + -W inline-in-all-cgus=val -- control whether `#[inline]` functions are in all CGUs + -W input-stats=val -- gather statistics about the input (default: no) + -W instrument-coverage=val -- instrument the generated code to support LLVM source-based code coverage reports (note, the compiler build config must include `profiler = true`); implies `-C symbol-mangling-version=v0`. Optional values are: + `=all` (implicit value) + `=except-unused-generics` + `=except-unused-functions` + `=off` (default) + -W instrument-mcount=val -- insert function instrument code for mcount-based tracing (default: no) + -W keep-hygiene-data=val -- keep hygiene data after analysis (default: no) + -W link-native-libraries=val -- link native libraries in the linker invocation (default: yes) + -W link-only=val -- link the `.rlink` file generated by `-Z no-link` (default: no) + -W llvm-plugins=val -- a list LLVM plugins to enable (space separated) + -W llvm-time-trace=val -- generate JSON tracing data file from LLVM data (default: no) + -W location-detail=val -- comma separated list of location details to be tracked when using caller_location valid options are `file`, `line`, and `column` (default: all) + -W ls=val -- list the symbols defined by a library crate (default: no) + -W macro-backtrace=val -- show macro backtraces (default: no) + -W merge-functions=val -- control the operation of the MergeFunctions LLVM pass, taking the same values as the target option of the same name + -W meta-stats=val -- gather metadata statistics (default: no) + -W mir-emit-retag=val -- emit Retagging MIR statements, interpreted e.g., by miri; implies -Zmir-opt-level=0 (default: no) + -W mir-enable-passes=val -- use like `-Zmir-enable-passes=+DestProp,-InstCombine`. Forces the specified passes to be enabled, overriding all other checks. Passes that are not specified are enabled or disabled by other flags as usual. + -W mir-opt-level=val -- MIR optimization level (0-4; default: 1 in non optimized builds and 2 in optimized builds) + -W move-size-limit=val -- the size at which the `large_assignments` lint starts to be emitted + -W mutable-noalias=val -- emit noalias metadata for mutable references (default: yes) + -W new-llvm-pass-manager=val -- use new LLVM pass manager (default: no) + -W nll-facts=val -- dump facts from NLL analysis into side files (default: no) + -W nll-facts-dir=val -- the directory the NLL facts are dumped into (default: `nll-facts`) + -W no-analysis=val -- parse and expand the source, but run no analysis + -W no-codegen=val -- run all passes except codegen; no output + -W no-generate-arange-section=val -- omit DWARF address ranges that give faster lookups + -W no-interleave-lints=val -- execute lints separately; allows benchmarking individual lints + -W no-leak-check=val -- disable the 'leak check' for subtyping; unsound, but useful for tests + -W no-link=val -- compile without linking + -W no-parallel-llvm=val -- run LLVM in non-parallel mode (while keeping codegen-units and ThinLTO) + -W no-unique-section-names=val -- do not use unique names for text and data sections when -Z function-sections is used + -W no-profiler-runtime=val -- prevent automatic injection of the profiler_builtins crate + -W normalize-docs=val -- normalize associated items in rustdoc when generating documentation + -W oom=val -- panic strategy for out-of-memory handling + -W osx-rpath-install-name=val -- pass `-install_name @rpath/...` to the macOS linker (default: no) + -W panic-abort-tests=val -- support compiling tests with panic=abort (default: no) + -W panic-in-drop=val -- panic strategy for panics in drops + -W parse-only=val -- parse only; do not compile, assemble, or link (default: no) + -W perf-stats=val -- print some performance-related statistics (default: no) + -W pick-stable-methods-before-any-unstable=val -- try to pick stable methods first before picking any unstable methods (default: yes) + -W plt=val -- whether to use the PLT when calling into shared libraries; + only has effect for PIC code on systems with ELF binaries + (default: PLT is disabled if full relro is enabled) + -W polonius=val -- enable polonius-based borrow-checker (default: no) + -W polymorphize=val -- perform polymorphization analysis + -W pre-link-arg=val -- a single extra argument to prepend the linker invocation (can be used several times) + -W pre-link-args=val -- extra arguments to prepend to the linker invocation (space separated) + -W precise-enum-drop-elaboration=val -- use a more precise version of drop elaboration for matches on enums (default: yes). This results in better codegen, but has caused miscompilations on some tier 2 platforms. See #77382 and #74551. + -W print-fuel=val -- make rustc print the total optimization fuel used by a crate + -W print-llvm-passes=val -- print the LLVM optimization passes being run (default: no) + -W print-mono-items=val -- print the result of the monomorphization collection pass + -W print-type-sizes=val -- print layout information for each type encountered (default: no) + -W proc-macro-backtrace=val -- show backtraces for panics during proc-macro execution (default: no) + -W profile=val -- insert profiling code (default: no) + -W profile-closures=val -- profile size of closures + -W profile-emit=val -- file path to emit profiling data at runtime when using 'profile' (default based on relative source path) + -W profiler-runtime=val -- name of the profiler runtime crate to automatically inject (default: `profiler_builtins`) + -W profile-sample-use=val -- use the given `.prof` file for sampled profile-guided optimization (also known as AutoFDO) + -W query-dep-graph=val -- enable queries of the dependency graph for regression testing (default: no) + -W randomize-layout=val -- randomize the layout of types (default: no) + -W layout-seed=val -- seed layout randomization + -W relax-elf-relocations=val -- whether ELF relocations can be relaxed + -W relro-level=val -- choose which RELRO level to use + -W remap-cwd-prefix=val -- remap paths under the current working directory to this path prefix + -W simulate-remapped-rust-src-base=val -- simulate the effect of remap-debuginfo = true at bootstrapping by remapping path to rust's source base directory. only meant for testing purposes + -W report-delayed-bugs=val -- immediately print bugs registered with `delay_span_bug` (default: no) + -W sanitizer=val -- use a sanitizer + -W sanitizer-memory-track-origins=val -- enable origins tracking in MemorySanitizer + -W sanitizer-recover=val -- enable recovery for selected sanitizers + -W saturating-float-casts=val -- make float->int casts UB-free: numbers outside the integer type's range are clipped to the max/min integer respectively, and NaN is mapped to 0 (default: yes) + -W save-analysis=val -- write syntax and type analysis (in JSON format) information, in addition to normal output (default: no) + -W self-profile=val -- run the self profiler and output the raw event data + -W self-profile-events=val -- specify the events recorded by the self profiler; + for example: `-Z self-profile-events=default,query-keys` + all options: none, all, default, generic-activity, query-provider, query-cache-hit + query-blocked, incr-cache-load, incr-result-hashing, query-keys, function-args, args, llvm, artifact-sizes + -W self-profile-counter=val -- counter used by the self profiler (default: `wall-time`), one of: + `wall-time` (monotonic clock, i.e. `std::time::Instant`) + `instructions:u` (retired instructions, userspace-only) + `instructions-minus-irqs:u` (subtracting hardware interrupt counts for extra accuracy) + -W share-generics=val -- make the current crate share its generic instantiations + -W show-span=val -- show spans for compiler debugging (expr|pat|ty) + -W span-debug=val -- forward proc_macro::Span's `Debug` impl to `Span` + -W span-free-formats=val -- exclude spans when debug-printing compiler state (default: no) + -W src-hash-algorithm=val -- hash algorithm of source files in debug info (`md5`, `sha1`, or `sha256`) + -W stack-protector=val -- control stack smash protection strategy (`rustc --print stack-protector-strategies` for details) + -W strict-init-checks=val -- control if mem::uninitialized and mem::zeroed panic on more UB + -W strip=val -- tell the linker which information to strip (`none` (default), `debuginfo` or `symbols`) + -W split-dwarf-kind=val -- split dwarf variant (only if -Csplit-debuginfo is enabled and on relevant platform) + (default: `split`) + + `split`: sections which do not require relocation are written into a DWARF object (`.dwo`) + file which is ignored by the linker + `single`: sections which do not require relocation are written into object file but ignored + by the linker + -W split-dwarf-inlining=val -- provide minimal debug info in the object/executable to facilitate online symbolication/stack traces in the absence of .dwo/.dwp files when using Split DWARF + -W symbol-mangling-version=val -- which mangling version to use for symbol names ('legacy' (default) or 'v0') + -W teach=val -- show extended diagnostic help (default: no) + -W temps-dir=val -- the directory the intermediate files are written to + -W terminal-width=val -- set the current terminal width + -W translate-lang=val -- language identifier for diagnostic output + -W translate-additional-ftl=val -- additional fluent translation to preferentially use (for testing translation) + -W translate-directionality-markers=val -- emit directionality isolation markers in translated diagnostics + -W tune-cpu=val -- select processor to schedule for (`rustc --print target-cpus` for details) + -W thinlto=val -- enable ThinLTO when possible + -W thir-unsafeck=val -- use the THIR unsafety checker (default: no) + -W threads=val -- use a thread pool with N threads + -W time=val -- measure time of rustc processes (default: no) + -W time-llvm-passes=val -- measure time of each LLVM pass (default: no) + -W time-passes=val -- measure time of each rustc pass (default: no) + -W tls-model=val -- choose the TLS model to use (`rustc --print tls-models` for details) + -W trace-macros=val -- for every macro invocation, print its name and arguments (default: no) + -W translate-remapped-path-to-local-path=val -- translate remapped paths into local paths when possible (default: yes) + -W trap-unreachable=val -- generate trap instructions for unreachable intrinsics (default: use target setting, usually yes) + -W treat-err-as-bug=val -- treat error number `val` that occurs as bug + -W trim-diagnostic-paths=val -- in diagnostics, use heuristics to shorten paths referring to items + -W ui-testing=val -- emit compiler diagnostics in a form suitable for UI testing (default: no) + -W uninit-const-chunk-threshold=val -- allow generating const initializers with mixed init/uninit chunks, and set the maximum number of chunks for which this is allowed (default: 16) + -W unleash-the-miri-inside-of-you=val -- take the brakes off const evaluation. NOTE: this is unsound (default: no) + -W unpretty=val -- present the input source, unstable (and less-pretty) variants; + `normal`, `identified`, + `expanded`, `expanded,identified`, + `expanded,hygiene` (with internal representations), + `ast-tree` (raw AST before expansion), + `ast-tree,expanded` (raw AST after expansion), + `hir` (the HIR), `hir,identified`, + `hir,typed` (HIR with types for each node), + `hir-tree` (dump the raw HIR), + `mir` (the MIR), or `mir-cfg` (graphviz formatted MIR) + -W unsound-mir-opts=val -- enable unsound and buggy MIR optimizations (default: no) + -W unstable-options=val -- adds unstable command line options to rustc interface (default: no) + -W use-ctors-section=val -- use legacy .ctors section for initializers rather than .init_array + -W validate-mir=val -- validate MIR after each transformation + -W verbose=val -- in general, enable more debug printouts (default: no) + -W verify-llvm-ir=val -- verify LLVM IR (default: no) + -W virtual-function-elimination=val -- enables dead virtual function elimination optimization. Requires `-Clto[=[fat,yes]]` + -W wasi-exec-model=val -- whether to build a wasi command or reactor diff --git a/src/test/run-make/issue-88756-opt-help/x.rs b/src/test/run-make/issue-88756-opt-help/x.rs new file mode 100644 index 00000000000..5df7576133a --- /dev/null +++ b/src/test/run-make/issue-88756-opt-help/x.rs @@ -0,0 +1 @@ +// nothing to see here diff --git a/src/test/rustdoc-gui/docblock-details.goml b/src/test/rustdoc-gui/docblock-details.goml new file mode 100644 index 00000000000..2edbf1e4e2d --- /dev/null +++ b/src/test/rustdoc-gui/docblock-details.goml @@ -0,0 +1,23 @@ +// This ensures that the `<details>`/`<summary>` elements are displayed as expected. +goto: file://|DOC_PATH|/test_docs/details/struct.Details.html +show-text: true +local-storage: {"rustdoc-theme": "dark", "rustdoc-use-system-theme": "false"} +reload: + +// We first check that the headers in the `.top-doc` doc block still have their +// bottom border. +assert-text: (".top-doc .docblock > h3", "Hello") +assert-css: ( + ".top-doc .docblock > h3", + {"border-bottom": "1px solid rgb(221, 221, 221)"}, +) +// We now check that the `<summary>` doesn't have a bottom border and has the correct display. +assert-css: ( + ".top-doc .docblock summary h4", + {"border-bottom": "0px none rgb(221, 221, 221)"}, +) +// This allows to ensure that summary is on one line only! +assert-property: (".top-doc .docblock summary h4", {"offsetHeight": "33"}) +assert-css: (".top-doc .docblock summary h4", {"margin-top": "15px", "margin-bottom": "5px"}) +// So `33 + 15 + 5` == `53` +assert-property: (".top-doc .docblock summary", {"offsetHeight": "53"}) diff --git a/src/test/rustdoc-gui/pocket-menu.goml b/src/test/rustdoc-gui/pocket-menu.goml index ba2986e969a..54f3790a765 100644 --- a/src/test/rustdoc-gui/pocket-menu.goml +++ b/src/test/rustdoc-gui/pocket-menu.goml @@ -24,6 +24,11 @@ click: "#help-button" assert-css: ("#help-button .popover", {"display": "block"}) assert-css: ("#settings-menu .popover", {"display": "none"}) +// Now verify that clicking the help menu again closes it. +click: "#help-button" +assert-css: ("#help-button .popover", {"display": "none"}) +assert-css: ("#settings-menu .popover", {"display": "none"}) + // We check the borders color now: // Ayu theme diff --git a/src/test/rustdoc-gui/settings.goml b/src/test/rustdoc-gui/settings.goml index 237a4751a8d..c402c7991c8 100644 --- a/src/test/rustdoc-gui/settings.goml +++ b/src/test/rustdoc-gui/settings.goml @@ -121,6 +121,20 @@ local-storage: {"rustdoc-disable-shortcuts": "false"} click: ".setting-line:last-child .toggle .label" assert-local-storage: {"rustdoc-disable-shortcuts": "true"} +// Make sure that "Disable keyboard shortcuts" actually took effect. +press-key: "Escape" +press-key: "?" +assert-false: "#help-button .popover" +wait-for-css: ("#settings-menu .popover", {"display": "block"}) + +// Now turn keyboard shortcuts back on, and see if they work. +click: ".setting-line:last-child .toggle .label" +assert-local-storage: {"rustdoc-disable-shortcuts": "false"} +press-key: "Escape" +press-key: "?" +wait-for-css: ("#help-button .popover", {"display": "block"}) +assert-css: ("#settings-menu .popover", {"display": "none"}) + // Now we go to the settings page to check that the CSS is loaded as expected. goto: file://|DOC_PATH|/settings.html wait-for: "#settings" diff --git a/src/test/rustdoc-gui/sidebar-source-code-display.goml b/src/test/rustdoc-gui/sidebar-source-code-display.goml index 8f53e8627ee..c441f84a821 100644 --- a/src/test/rustdoc-gui/sidebar-source-code-display.goml +++ b/src/test/rustdoc-gui/sidebar-source-code-display.goml @@ -116,3 +116,39 @@ assert-css: ( "#source-sidebar .expand + .children .folders .name", {"color": "rgb(255, 180, 76)", "background-color": "rgb(20, 25, 31)"}, ) + +// Now checking on mobile devices. +size: (500, 700) +reload: +// Waiting for the sidebar to be displayed... +wait-for-css: ("#sidebar-toggle", {"visibility": "visible", "opacity": 1}) + +// We now check it takes the full size of the display. +assert-property: ("body", {"clientWidth": "500", "clientHeight": "700"}) +assert-property: (".sidebar", {"clientWidth": "500", "clientHeight": "700"}) + +// We now check the display of the toggle once the sidebar is expanded. +assert-property: ("#sidebar-toggle", {"clientWidth": "500", "clientHeight": "39"}) +assert-css: ( + "#sidebar-toggle", + { + "border-top-width": "0px", + "border-right-width": "0px", + "border-left-width": "0px", + "border-bottom-width": "1px", + }, +) + +// We now check that the scroll position is kept when opening the sidebar. +click: "#sidebar-toggle" +wait-for-css: (".sidebar", {"width": "0px"}) +// We scroll to line 117 to change the scroll position. +scroll-to: '//*[@id="117"]' +assert-window-property: {"pageYOffset": "2519"} +// Expanding the sidebar... +click: "#sidebar-toggle" +wait-for-css: (".sidebar", {"width": "500px"}) +click: "#sidebar-toggle" +wait-for-css: (".sidebar", {"width": "0px"}) +// The "scrollTop" property should be the same. +assert-window-property: {"pageYOffset": "2519"} diff --git a/src/test/rustdoc-gui/sidebar-source-code.goml b/src/test/rustdoc-gui/sidebar-source-code.goml index 724520bc399..86df478fa1d 100644 --- a/src/test/rustdoc-gui/sidebar-source-code.goml +++ b/src/test/rustdoc-gui/sidebar-source-code.goml @@ -18,8 +18,8 @@ assert: "nav.sidebar" // We now switch to mobile mode. size: (600, 600) -// We check that the sidebar has the expected width (0 and 1px for the border). -assert-css: ("nav.sidebar", {"width": "1px"}) +// We check that the sidebar has the expected width (0). +assert-css: ("nav.sidebar", {"width": "0px"}) // We expand the sidebar. click: "#sidebar-toggle" assert-css: (".source-sidebar-expanded nav.sidebar", {"width": "600px"}) diff --git a/src/test/rustdoc-gui/src/test_docs/lib.rs b/src/test/rustdoc-gui/src/test_docs/lib.rs index b6fe9eb2565..aa2f78289be 100644 --- a/src/test/rustdoc-gui/src/test_docs/lib.rs +++ b/src/test/rustdoc-gui/src/test_docs/lib.rs @@ -277,3 +277,15 @@ pub use macros::*; #[doc(alias = "AliasForTheStdReexport")] pub use ::std as TheStdReexport; + +pub mod details { + /// We check the appearance of the `<details>`/`<summary>` in here. + /// + /// ## Hello + /// + /// <details> + /// <summary><h4>I'm a summary</h4></summary> + /// <div>I'm the content of the details!</div> + /// </details> + pub struct Details; +} diff --git a/src/test/rustdoc-json/assoc_items.rs b/src/test/rustdoc-json/assoc_items.rs new file mode 100644 index 00000000000..2ee64c9f6eb --- /dev/null +++ b/src/test/rustdoc-json/assoc_items.rs @@ -0,0 +1,29 @@ +#![no_std] + +// @has assoc_items.json + +pub struct Simple; + +impl Simple { + // @has - "$.index[*][?(@.name=='CONSTANT')].kind" \"assoc_const\" + pub const CONSTANT: usize = 0; +} + +pub trait EasyToImpl { + // @has - "$.index[*][?(@.name=='ToDeclare')].kind" \"assoc_type\" + // @has - "$.index[*][?(@.name=='ToDeclare')].inner.default" null + type ToDeclare; + // @has - "$.index[*][?(@.name=='AN_ATTRIBUTE')].kind" \"assoc_const\" + // @has - "$.index[*][?(@.name=='AN_ATTRIBUTE')].inner.default" null + const AN_ATTRIBUTE: usize; +} + +impl EasyToImpl for Simple { + // @has - "$.index[*][?(@.name=='ToDeclare')].inner.default.kind" \"primitive\" + // @has - "$.index[*][?(@.name=='ToDeclare')].inner.default.inner" \"usize\" + type ToDeclare = usize; + // @has - "$.index[*][?(@.name=='AN_ATTRIBUTE')].inner.type.kind" \"primitive\" + // @has - "$.index[*][?(@.name=='AN_ATTRIBUTE')].inner.type.inner" \"usize\" + // @has - "$.index[*][?(@.name=='AN_ATTRIBUTE')].inner.default" \"12\" + const AN_ATTRIBUTE: usize = 12; +} diff --git a/src/test/rustdoc-json/assoc_type.rs b/src/test/rustdoc-json/assoc_type.rs new file mode 100644 index 00000000000..716bb3d2848 --- /dev/null +++ b/src/test/rustdoc-json/assoc_type.rs @@ -0,0 +1,22 @@ +// Regression test for <https://github.com/rust-lang/rust/issues/98547>. + +// @has assoc_type.json +// @has - "$.index[*][?(@.name=='Trait')]" +// @has - "$.index[*][?(@.name=='AssocType')]" +// @has - "$.index[*][?(@.name=='S')]" +// @has - "$.index[*][?(@.name=='S2')]" + +pub trait Trait { + type AssocType; +} + +impl<T> Trait for T { + type AssocType = Self; +} + +pub struct S; + +/// Not needed for the #98547 ICE to occur, but added to maximize the chance of +/// getting an ICE in the future. See +/// <https://github.com/rust-lang/rust/pull/98548#discussion_r908219164> +pub struct S2; diff --git a/src/test/rustdoc-json/blanket_impls.rs b/src/test/rustdoc-json/blanket_impls.rs new file mode 100644 index 00000000000..edf1a9fe2fc --- /dev/null +++ b/src/test/rustdoc-json/blanket_impls.rs @@ -0,0 +1,9 @@ +// Regression test for <https://github.com/rust-lang/rust/issues/98658> + +#![no_std] + +// @has blanket_impls.json +// @has - "$.index[*][?(@.name=='Error')].kind" \"assoc_type\" +// @has - "$.index[*][?(@.name=='Error')].inner.default.kind" \"resolved_path\" +// @has - "$.index[*][?(@.name=='Error')].inner.default.inner.name" \"Infallible\" +pub struct ForBlanketTryFromImpl; diff --git a/src/test/rustdoc-json/glob_import.rs b/src/test/rustdoc-json/glob_import.rs new file mode 100644 index 00000000000..d7ac952d1bb --- /dev/null +++ b/src/test/rustdoc-json/glob_import.rs @@ -0,0 +1,24 @@ +// This is a regression test for <https://github.com/rust-lang/rust/issues/98003>. + +#![feature(no_core)] +#![no_std] +#![no_core] + +// @has glob_import.json +// @has - "$.index[*][?(@.name=='glob')]" +// @has - "$.index[*][?(@.kind=='import')].inner.name" \"*\" + + +mod m1 { + pub fn f() {} +} +mod m2 { + pub fn f(_: u8) {} +} + +pub use m1::*; +pub use m2::*; + +pub mod glob { + pub use *; +} diff --git a/src/test/rustdoc-ui/issue-79494.rs b/src/test/rustdoc-ui/issue-79494.rs new file mode 100644 index 00000000000..fc39424b793 --- /dev/null +++ b/src/test/rustdoc-ui/issue-79494.rs @@ -0,0 +1,5 @@ +// only-x86_64-unknown-linux-gnu + +#![feature(const_transmute)] + +const ZST: &[u8] = unsafe { std::mem::transmute(1usize) }; //~ ERROR cannot transmute between types of different sizes, or dependently-sized types diff --git a/src/test/rustdoc-ui/issue-79494.stderr b/src/test/rustdoc-ui/issue-79494.stderr new file mode 100644 index 00000000000..7ed5ed38247 --- /dev/null +++ b/src/test/rustdoc-ui/issue-79494.stderr @@ -0,0 +1,12 @@ +error[E0512]: cannot transmute between types of different sizes, or dependently-sized types + --> $DIR/issue-79494.rs:5:29 + | +LL | const ZST: &[u8] = unsafe { std::mem::transmute(1usize) }; + | ^^^^^^^^^^^^^^^^^^^ + | + = note: source type: `usize` (64 bits) + = note: target type: `&[u8]` (128 bits) + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0512`. diff --git a/src/test/rustdoc-ui/issue-83883-describe-lints.stdout b/src/test/rustdoc-ui/issue-83883-describe-lints.stdout index 651faf5761f..5cb7ecb649a 100644 --- a/src/test/rustdoc-ui/issue-83883-describe-lints.stdout +++ b/src/test/rustdoc-ui/issue-83883-describe-lints.stdout @@ -1,25 +1,193 @@ + -W allow-features=val -- only allow the listed language features to be enabled in code (space separated) + -W always-encode-mir=val -- encode MIR of all functions into the crate metadata (default: no) + -W assume-incomplete-release=val -- make cfg(version) treat the current version as incomplete (default: no) + -W asm-comments=val -- generate comments into the assembly (may change behavior) (default: no) + -W assert-incr-state=val -- assert that the incremental cache is in given state: either `loaded` or `not-loaded`. + -W binary-dep-depinfo=val -- include artifacts (sysroot, crate dependencies) used during compilation in dep-info (default: no) + -W branch-protection=val -- set options for branch target identification and pointer authentication on AArch64 + -W cf-protection=val -- instrument control-flow architecture protection + -W cgu-partitioning-strategy=val -- the codegen unit partitioning strategy to use + -W chalk=val -- enable the experimental Chalk-based trait solving engine + -W codegen-backend=val -- the backend to use + -W combine-cgu=val -- combine CGUs into a single one + -W crate-attr=val -- inject the given attribute in the crate + -W debug-info-for-profiling=val -- emit discriminators and other data necessary for AutoFDO + -W debug-macros=val -- emit line numbers debug info inside macros (default: no) + -W deduplicate-diagnostics=val -- deduplicate identical diagnostics (default: yes) + -W dep-info-omit-d-target=val -- in dep-info output, omit targets for tracking dependencies of the dep-info files themselves (default: no) + -W dep-tasks=val -- print tasks that execute and the color their dep node gets (requires debug build) (default: no) + -W dlltool=val -- import library generation tool (windows-gnu only) + -W dont-buffer-diagnostics=val -- emit diagnostics rather than buffering (breaks NLL error downgrading, sorting) (default: no) + -W drop-tracking=val -- enables drop tracking in generators (default: no) + -W dual-proc-macros=val -- load proc macros for both target and host, but only link to the target (default: no) + -W dump-dep-graph=val -- dump the dependency graph to $RUST_DEP_GRAPH (default: /tmp/dep_graph.gv) (default: no) + -W dump-mir=val -- dump MIR state to file. + `val` is used to select which passes and functions to dump. For example: + `all` matches all passes and functions, + `foo` matches all passes for functions whose name contains 'foo', + `foo & ConstProp` only the 'ConstProp' pass for function names containing 'foo', + `foo | bar` all passes for function names containing 'foo' or 'bar'. + -W dump-mir-dataflow=val -- in addition to `.mir` files, create graphviz `.dot` files with dataflow results (default: no) + -W dump-mir-dir=val -- the directory the MIR is dumped into (default: `mir_dump`) + -W dump-mir-exclude-pass-number=val -- exclude the pass number when dumping MIR (used in tests) (default: no) + -W dump-mir-graphviz=val -- in addition to `.mir` files, create graphviz `.dot` files (and with `-Z instrument-coverage`, also create a `.dot` file for the MIR-derived coverage graph) (default: no) + -W dump-mir-spanview=val -- in addition to `.mir` files, create `.html` files to view spans for all `statement`s (including terminators), only `terminator` spans, or computed `block` spans (one span encompassing a block's terminator and all statements). If `-Z instrument-coverage` is also enabled, create an additional `.html` file showing the computed coverage spans. + -W emit-stack-sizes=val -- emit a section containing stack size metadata (default: no) + -W fewer-names=val -- reduce memory use by retaining fewer names within compilation artifacts (LLVM-IR) (default: no) + -W force-unstable-if-unmarked=val -- force all crates to be `rustc_private` unstable (default: no) + -W fuel=val -- set the optimization fuel quota for a crate + -W function-sections=val -- whether each function should go in its own section + -W future-incompat-test=val -- forces all lints to be future incompatible, used for internal testing (default: no) + -W gcc-ld=val -- implementation of ld used by cc + -W graphviz-dark-mode=val -- use dark-themed colors in graphviz output (default: no) + -W graphviz-font=val -- use the given `fontname` in graphviz output; can be overridden by setting environment variable `RUSTC_GRAPHVIZ_FONT` (default: `Courier, monospace`) + -W hir-stats=val -- print some statistics about AST and HIR (default: no) + -W human-readable-cgu-names=val -- generate human-readable, predictable names for codegen units (default: no) + -W identify-regions=val -- display unnamed regions as `'<id>`, using a non-ident unique id (default: no) + -W incremental-ignore-spans=val -- ignore spans during ICH computation -- used for testing (default: no) + -W incremental-info=val -- print high-level information about incremental reuse (or the lack thereof) (default: no) + -W incremental-relative-spans=val -- hash spans relative to their parent item for incr. comp. (default: no) + -W incremental-verify-ich=val -- verify incr. comp. hashes of green query instances (default: no) + -W inline-mir=val -- enable MIR inlining (default: no) + -W inline-mir-threshold=val -- a default MIR inlining threshold (default: 50) + -W inline-mir-hint-threshold=val -- inlining threshold for functions with inline hint (default: 100) + -W inline-in-all-cgus=val -- control whether `#[inline]` functions are in all CGUs + -W input-stats=val -- gather statistics about the input (default: no) + -W instrument-coverage=val -- instrument the generated code to support LLVM source-based code coverage reports (note, the compiler build config must include `profiler = true`); implies `-C symbol-mangling-version=v0`. Optional values are: + `=all` (implicit value) + `=except-unused-generics` + `=except-unused-functions` + `=off` (default) + -W instrument-mcount=val -- insert function instrument code for mcount-based tracing (default: no) + -W keep-hygiene-data=val -- keep hygiene data after analysis (default: no) + -W link-native-libraries=val -- link native libraries in the linker invocation (default: yes) + -W link-only=val -- link the `.rlink` file generated by `-Z no-link` (default: no) + -W llvm-plugins=val -- a list LLVM plugins to enable (space separated) + -W llvm-time-trace=val -- generate JSON tracing data file from LLVM data (default: no) + -W location-detail=val -- comma separated list of location details to be tracked when using caller_location valid options are `file`, `line`, and `column` (default: all) + -W ls=val -- list the symbols defined by a library crate (default: no) + -W macro-backtrace=val -- show macro backtraces (default: no) + -W merge-functions=val -- control the operation of the MergeFunctions LLVM pass, taking the same values as the target option of the same name + -W meta-stats=val -- gather metadata statistics (default: no) + -W mir-emit-retag=val -- emit Retagging MIR statements, interpreted e.g., by miri; implies -Zmir-opt-level=0 (default: no) + -W mir-enable-passes=val -- use like `-Zmir-enable-passes=+DestProp,-InstCombine`. Forces the specified passes to be enabled, overriding all other checks. Passes that are not specified are enabled or disabled by other flags as usual. + -W mir-opt-level=val -- MIR optimization level (0-4; default: 1 in non optimized builds and 2 in optimized builds) + -W move-size-limit=val -- the size at which the `large_assignments` lint starts to be emitted + -W mutable-noalias=val -- emit noalias metadata for mutable references (default: yes) + -W new-llvm-pass-manager=val -- use new LLVM pass manager (default: no) + -W nll-facts=val -- dump facts from NLL analysis into side files (default: no) + -W nll-facts-dir=val -- the directory the NLL facts are dumped into (default: `nll-facts`) + -W no-analysis=val -- parse and expand the source, but run no analysis + -W no-codegen=val -- run all passes except codegen; no output + -W no-generate-arange-section=val -- omit DWARF address ranges that give faster lookups + -W no-interleave-lints=val -- execute lints separately; allows benchmarking individual lints + -W no-leak-check=val -- disable the 'leak check' for subtyping; unsound, but useful for tests + -W no-link=val -- compile without linking + -W no-parallel-llvm=val -- run LLVM in non-parallel mode (while keeping codegen-units and ThinLTO) + -W no-unique-section-names=val -- do not use unique names for text and data sections when -Z function-sections is used + -W no-profiler-runtime=val -- prevent automatic injection of the profiler_builtins crate + -W normalize-docs=val -- normalize associated items in rustdoc when generating documentation + -W oom=val -- panic strategy for out-of-memory handling + -W osx-rpath-install-name=val -- pass `-install_name @rpath/...` to the macOS linker (default: no) + -W panic-abort-tests=val -- support compiling tests with panic=abort (default: no) + -W panic-in-drop=val -- panic strategy for panics in drops + -W parse-only=val -- parse only; do not compile, assemble, or link (default: no) + -W perf-stats=val -- print some performance-related statistics (default: no) + -W pick-stable-methods-before-any-unstable=val -- try to pick stable methods first before picking any unstable methods (default: yes) + -W plt=val -- whether to use the PLT when calling into shared libraries; + only has effect for PIC code on systems with ELF binaries + (default: PLT is disabled if full relro is enabled) + -W polonius=val -- enable polonius-based borrow-checker (default: no) + -W polymorphize=val -- perform polymorphization analysis + -W pre-link-arg=val -- a single extra argument to prepend the linker invocation (can be used several times) + -W pre-link-args=val -- extra arguments to prepend to the linker invocation (space separated) + -W precise-enum-drop-elaboration=val -- use a more precise version of drop elaboration for matches on enums (default: yes). This results in better codegen, but has caused miscompilations on some tier 2 platforms. See #77382 and #74551. + -W print-fuel=val -- make rustc print the total optimization fuel used by a crate + -W print-llvm-passes=val -- print the LLVM optimization passes being run (default: no) + -W print-mono-items=val -- print the result of the monomorphization collection pass + -W print-type-sizes=val -- print layout information for each type encountered (default: no) + -W proc-macro-backtrace=val -- show backtraces for panics during proc-macro execution (default: no) + -W profile=val -- insert profiling code (default: no) + -W profile-closures=val -- profile size of closures + -W profile-emit=val -- file path to emit profiling data at runtime when using 'profile' (default based on relative source path) + -W profiler-runtime=val -- name of the profiler runtime crate to automatically inject (default: `profiler_builtins`) + -W profile-sample-use=val -- use the given `.prof` file for sampled profile-guided optimization (also known as AutoFDO) + -W query-dep-graph=val -- enable queries of the dependency graph for regression testing (default: no) + -W randomize-layout=val -- randomize the layout of types (default: no) + -W layout-seed=val -- seed layout randomization + -W relax-elf-relocations=val -- whether ELF relocations can be relaxed + -W relro-level=val -- choose which RELRO level to use + -W remap-cwd-prefix=val -- remap paths under the current working directory to this path prefix + -W simulate-remapped-rust-src-base=val -- simulate the effect of remap-debuginfo = true at bootstrapping by remapping path to rust's source base directory. only meant for testing purposes + -W report-delayed-bugs=val -- immediately print bugs registered with `delay_span_bug` (default: no) + -W sanitizer=val -- use a sanitizer + -W sanitizer-memory-track-origins=val -- enable origins tracking in MemorySanitizer + -W sanitizer-recover=val -- enable recovery for selected sanitizers + -W saturating-float-casts=val -- make float->int casts UB-free: numbers outside the integer type's range are clipped to the max/min integer respectively, and NaN is mapped to 0 (default: yes) + -W save-analysis=val -- write syntax and type analysis (in JSON format) information, in addition to normal output (default: no) + -W self-profile=val -- run the self profiler and output the raw event data + -W self-profile-events=val -- specify the events recorded by the self profiler; + for example: `-Z self-profile-events=default,query-keys` + all options: none, all, default, generic-activity, query-provider, query-cache-hit + query-blocked, incr-cache-load, incr-result-hashing, query-keys, function-args, args, llvm, artifact-sizes + -W self-profile-counter=val -- counter used by the self profiler (default: `wall-time`), one of: + `wall-time` (monotonic clock, i.e. `std::time::Instant`) + `instructions:u` (retired instructions, userspace-only) + `instructions-minus-irqs:u` (subtracting hardware interrupt counts for extra accuracy) + -W share-generics=val -- make the current crate share its generic instantiations + -W show-span=val -- show spans for compiler debugging (expr|pat|ty) + -W span-debug=val -- forward proc_macro::Span's `Debug` impl to `Span` + -W span-free-formats=val -- exclude spans when debug-printing compiler state (default: no) + -W src-hash-algorithm=val -- hash algorithm of source files in debug info (`md5`, `sha1`, or `sha256`) + -W stack-protector=val -- control stack smash protection strategy (`rustc --print stack-protector-strategies` for details) + -W strict-init-checks=val -- control if mem::uninitialized and mem::zeroed panic on more UB + -W strip=val -- tell the linker which information to strip (`none` (default), `debuginfo` or `symbols`) + -W split-dwarf-kind=val -- split dwarf variant (only if -Csplit-debuginfo is enabled and on relevant platform) + (default: `split`) -Available lint options: - -W <foo> Warn about <foo> - -A <foo> Allow <foo> - -D <foo> Deny <foo> - -F <foo> Forbid <foo> (deny <foo> and all attempts to override) - - -Lint checks provided by rustc: - - $NAMES $LEVELS $MEANINGS - -Lint groups provided by rustc: - - $NAMES $SUB_LINTS - -Lint checks provided by plugins loaded by this crate: - - $NAMES $LEVELS $MEANINGS - -Lint groups provided by plugins loaded by this crate: - - rustdoc::all $GROUPS - - + `split`: sections which do not require relocation are written into a DWARF object (`.dwo`) + file which is ignored by the linker + `single`: sections which do not require relocation are written into object file but ignored + by the linker + -W split-dwarf-inlining=val -- provide minimal debug info in the object/executable to facilitate online symbolication/stack traces in the absence of .dwo/.dwp files when using Split DWARF + -W symbol-mangling-version=val -- which mangling version to use for symbol names ('legacy' (default) or 'v0') + -W teach=val -- show extended diagnostic help (default: no) + -W temps-dir=val -- the directory the intermediate files are written to + -W terminal-width=val -- set the current terminal width + -W translate-lang=val -- language identifier for diagnostic output + -W translate-additional-ftl=val -- additional fluent translation to preferentially use (for testing translation) + -W translate-directionality-markers=val -- emit directionality isolation markers in translated diagnostics + -W tune-cpu=val -- select processor to schedule for (`rustc --print target-cpus` for details) + -W thinlto=val -- enable ThinLTO when possible + -W thir-unsafeck=val -- use the THIR unsafety checker (default: no) + -W threads=val -- use a thread pool with N threads + -W time=val -- measure time of rustc processes (default: no) + -W time-llvm-passes=val -- measure time of each LLVM pass (default: no) + -W time-passes=val -- measure time of each rustc pass (default: no) + -W tls-model=val -- choose the TLS model to use (`rustc --print tls-models` for details) + -W trace-macros=val -- for every macro invocation, print its name and arguments (default: no) + -W translate-remapped-path-to-local-path=val -- translate remapped paths into local paths when possible (default: yes) + -W trap-unreachable=val -- generate trap instructions for unreachable intrinsics (default: use target setting, usually yes) + -W treat-err-as-bug=val -- treat error number `val` that occurs as bug + -W trim-diagnostic-paths=val -- in diagnostics, use heuristics to shorten paths referring to items + -W ui-testing=val -- emit compiler diagnostics in a form suitable for UI testing (default: no) + -W uninit-const-chunk-threshold=val -- allow generating const initializers with mixed init/uninit chunks, and set the maximum number of chunks for which this is allowed (default: 16) + -W unleash-the-miri-inside-of-you=val -- take the brakes off const evaluation. NOTE: this is unsound (default: no) + -W unpretty=val -- present the input source, unstable (and less-pretty) variants; + `normal`, `identified`, + `expanded`, `expanded,identified`, + `expanded,hygiene` (with internal representations), + `ast-tree` (raw AST before expansion), + `ast-tree,expanded` (raw AST after expansion), + `hir` (the HIR), `hir,identified`, + `hir,typed` (HIR with types for each node), + `hir-tree` (dump the raw HIR), + `mir` (the MIR), or `mir-cfg` (graphviz formatted MIR) + -W unsound-mir-opts=val -- enable unsound and buggy MIR optimizations (default: no) + -W unstable-options=val -- adds unstable command line options to rustc interface (default: no) + -W use-ctors-section=val -- use legacy .ctors section for initializers rather than .init_array + -W validate-mir=val -- validate MIR after each transformation + -W verbose=val -- in general, enable more debug printouts (default: no) + -W verify-llvm-ir=val -- verify LLVM IR (default: no) + -W virtual-function-elimination=val -- enables dead virtual function elimination optimization. Requires `-Clto[=[fat,yes]]` + -W wasi-exec-model=val -- whether to build a wasi command or reactor diff --git a/src/test/rustdoc-ui/issue-98690.rs b/src/test/rustdoc-ui/issue-98690.rs new file mode 100644 index 00000000000..fe9bd87ab28 --- /dev/null +++ b/src/test/rustdoc-ui/issue-98690.rs @@ -0,0 +1,10 @@ +// compile-flags: --test --persist-doctests /../../ -Z unstable-options +// failure-status: 101 +// only-linux + +#![crate_name = "foo"] + +//! ```rust +//! use foo::dummy; +//! dummy(); +//! ``` diff --git a/src/test/rustdoc-ui/issue-98690.stderr b/src/test/rustdoc-ui/issue-98690.stderr new file mode 100644 index 00000000000..47d94f99a45 --- /dev/null +++ b/src/test/rustdoc-ui/issue-98690.stderr @@ -0,0 +1 @@ +Couldn't create directory for doctest executables: Permission denied (os error 13) diff --git a/src/test/rustdoc-ui/lint-missing-doc-code-example.stderr b/src/test/rustdoc-ui/lint-missing-doc-code-example.stderr index 37157978542..9e51ecd2ba0 100644 --- a/src/test/rustdoc-ui/lint-missing-doc-code-example.stderr +++ b/src/test/rustdoc-ui/lint-missing-doc-code-example.stderr @@ -1,9 +1,8 @@ error: missing code example in this documentation --> $DIR/lint-missing-doc-code-example.rs:19:1 | -LL | / pub mod module1 { -LL | | } - | |_^ +LL | pub mod module1 { + | ^^^^^^^^^^^^^^^ | note: the lint level is defined here --> $DIR/lint-missing-doc-code-example.rs:2:9 diff --git a/src/test/rustdoc/auxiliary/issue-98697-reexport-with-anonymous-lifetime.rs b/src/test/rustdoc/auxiliary/issue-98697-reexport-with-anonymous-lifetime.rs new file mode 100644 index 00000000000..22cbeae7266 --- /dev/null +++ b/src/test/rustdoc/auxiliary/issue-98697-reexport-with-anonymous-lifetime.rs @@ -0,0 +1,9 @@ +/// When reexporting this function, make sure the anonymous lifetimes are not rendered. +/// +/// https://github.com/rust-lang/rust/issues/98697 +pub fn repro<F>() +where + F: Fn(&str), +{ + unimplemented!() +} diff --git a/src/test/rustdoc/check-source-code-urls-to-def.rs b/src/test/rustdoc/check-source-code-urls-to-def.rs index 12c5df2871c..ec44e1bc65c 100644 --- a/src/test/rustdoc/check-source-code-urls-to-def.rs +++ b/src/test/rustdoc/check-source-code-urls-to-def.rs @@ -14,10 +14,10 @@ extern crate source_code; #[path = "auxiliary/source-code-bar.rs"] pub mod bar; -// @count - '//a[@href="../../src/foo/auxiliary/source-code-bar.rs.html#5-7"]' 4 +// @count - '//a[@href="../../src/foo/auxiliary/source-code-bar.rs.html#5"]' 4 use bar::Bar; -// @has - '//a[@href="../../src/foo/auxiliary/source-code-bar.rs.html#13-17"]' 'self' -// @has - '//a[@href="../../src/foo/auxiliary/source-code-bar.rs.html#14-16"]' 'Trait' +// @has - '//a[@href="../../src/foo/auxiliary/source-code-bar.rs.html#13"]' 'self' +// @has - '//a[@href="../../src/foo/auxiliary/source-code-bar.rs.html#14"]' 'Trait' use bar::sub::{self, Trait}; pub struct Foo; @@ -42,8 +42,8 @@ pub fn foo(a: u32, b: &str, c: String, d: Foo, e: bar::Bar, f: source_code::Sour y.hello(); } -// @has - '//a[@href="../../src/foo/auxiliary/source-code-bar.rs.html#14-16"]' 'bar::sub::Trait' -// @has - '//a[@href="../../src/foo/auxiliary/source-code-bar.rs.html#14-16"]' 'Trait' +// @has - '//a[@href="../../src/foo/auxiliary/source-code-bar.rs.html#14"]' 'bar::sub::Trait' +// @has - '//a[@href="../../src/foo/auxiliary/source-code-bar.rs.html#14"]' 'Trait' pub fn foo2<T: bar::sub::Trait, V: Trait>(t: &T, v: &V, b: bool) {} pub trait AnotherTrait {} diff --git a/src/test/rustdoc/inline_cross/macros.rs b/src/test/rustdoc/inline_cross/macros.rs index 13b4c3c7f61..5daa0d4baad 100644 --- a/src/test/rustdoc/inline_cross/macros.rs +++ b/src/test/rustdoc/inline_cross/macros.rs @@ -15,5 +15,5 @@ extern crate macros; // @has - '//*[@class="docblock"]' 'docs for my_macro' // @has - '//*[@class="stab deprecated"]' 'Deprecated since 1.2.3: text' // @has - '//*[@class="stab unstable"]' 'macro_test' -// @has - '//a/@href' '../src/macros/macros.rs.html#8-10' +// @has - '//a/@href' '../src/macros/macros.rs.html#8' pub use macros::my_macro; diff --git a/src/test/rustdoc/issue-98697.rs b/src/test/rustdoc/issue-98697.rs new file mode 100644 index 00000000000..25ab55acd77 --- /dev/null +++ b/src/test/rustdoc/issue-98697.rs @@ -0,0 +1,13 @@ +// aux-build:issue-98697-reexport-with-anonymous-lifetime.rs +// ignore-cross-compile + +// When reexporting a function with a HRTB with anonymous lifetimes, +// make sure the anonymous lifetimes are not rendered. +// +// https://github.com/rust-lang/rust/issues/98697 + +extern crate issue_98697_reexport_with_anonymous_lifetime; + +// @has issue_98697/fn.repro.html '//pre[@class="rust fn"]/code' 'fn repro<F>() where F: Fn(&str)' +// @!has issue_98697/fn.repro.html '//pre[@class="rust fn"]/code' 'for<' +pub use issue_98697_reexport_with_anonymous_lifetime::repro; diff --git a/src/test/ui/argument-suggestions/basic.stderr b/src/test/ui/argument-suggestions/basic.stderr index dd4812b5b25..c495ad6b842 100644 --- a/src/test/ui/argument-suggestions/basic.stderr +++ b/src/test/ui/argument-suggestions/basic.stderr @@ -16,7 +16,7 @@ error[E0061]: this function takes 0 arguments but 1 argument was supplied --> $DIR/basic.rs:21:5 | LL | extra(""); - | ^^^^^ -- argument unexpected + | ^^^^^ -- argument of type `&'static str` unexpected | note: function defined here --> $DIR/basic.rs:14:4 diff --git a/src/test/ui/argument-suggestions/extra_arguments.stderr b/src/test/ui/argument-suggestions/extra_arguments.stderr index 9b63f9bcbfa..32b1e15737a 100644 --- a/src/test/ui/argument-suggestions/extra_arguments.stderr +++ b/src/test/ui/argument-suggestions/extra_arguments.stderr @@ -2,7 +2,7 @@ error[E0061]: this function takes 0 arguments but 1 argument was supplied --> $DIR/extra_arguments.rs:7:3 | LL | empty(""); - | ^^^^^ -- argument unexpected + | ^^^^^ -- argument of type `&'static str` unexpected | note: function defined here --> $DIR/extra_arguments.rs:1:4 @@ -18,7 +18,7 @@ error[E0061]: this function takes 1 argument but 2 arguments were supplied --> $DIR/extra_arguments.rs:9:3 | LL | one_arg(1, 1); - | ^^^^^^^ - argument unexpected + | ^^^^^^^ - argument of type `{integer}` unexpected | note: function defined here --> $DIR/extra_arguments.rs:2:4 @@ -34,7 +34,7 @@ error[E0061]: this function takes 1 argument but 2 arguments were supplied --> $DIR/extra_arguments.rs:10:3 | LL | one_arg(1, ""); - | ^^^^^^^ -- argument unexpected + | ^^^^^^^ -- argument of type `&'static str` unexpected | note: function defined here --> $DIR/extra_arguments.rs:2:4 @@ -50,9 +50,9 @@ error[E0061]: this function takes 1 argument but 3 arguments were supplied --> $DIR/extra_arguments.rs:11:3 | LL | one_arg(1, "", 1.0); - | ^^^^^^^ -- --- argument unexpected + | ^^^^^^^ -- --- argument of type `{float}` unexpected | | - | argument unexpected + | argument of type `&'static str` unexpected | note: function defined here --> $DIR/extra_arguments.rs:2:4 @@ -68,7 +68,7 @@ error[E0061]: this function takes 2 arguments but 3 arguments were supplied --> $DIR/extra_arguments.rs:13:3 | LL | two_arg_same(1, 1, 1); - | ^^^^^^^^^^^^ - argument unexpected + | ^^^^^^^^^^^^ - argument of type `{integer}` unexpected | note: function defined here --> $DIR/extra_arguments.rs:3:4 @@ -84,7 +84,7 @@ error[E0061]: this function takes 2 arguments but 3 arguments were supplied --> $DIR/extra_arguments.rs:14:3 | LL | two_arg_same(1, 1, 1.0); - | ^^^^^^^^^^^^ --- argument unexpected + | ^^^^^^^^^^^^ --- argument of type `{float}` unexpected | note: function defined here --> $DIR/extra_arguments.rs:3:4 @@ -100,7 +100,7 @@ error[E0061]: this function takes 2 arguments but 3 arguments were supplied --> $DIR/extra_arguments.rs:16:3 | LL | two_arg_diff(1, 1, ""); - | ^^^^^^^^^^^^ - argument of type `&str` unexpected + | ^^^^^^^^^^^^ - argument of type `{integer}` unexpected | note: function defined here --> $DIR/extra_arguments.rs:4:4 @@ -116,7 +116,7 @@ error[E0061]: this function takes 2 arguments but 3 arguments were supplied --> $DIR/extra_arguments.rs:17:3 | LL | two_arg_diff(1, "", ""); - | ^^^^^^^^^^^^ -- argument unexpected + | ^^^^^^^^^^^^ -- argument of type `&'static str` unexpected | note: function defined here --> $DIR/extra_arguments.rs:4:4 @@ -132,9 +132,9 @@ error[E0061]: this function takes 2 arguments but 4 arguments were supplied --> $DIR/extra_arguments.rs:18:3 | LL | two_arg_diff(1, 1, "", ""); - | ^^^^^^^^^^^^ - -- argument unexpected + | ^^^^^^^^^^^^ - -- argument of type `&'static str` unexpected | | - | argument of type `&str` unexpected + | argument of type `{integer}` unexpected | note: function defined here --> $DIR/extra_arguments.rs:4:4 @@ -150,9 +150,9 @@ error[E0061]: this function takes 2 arguments but 4 arguments were supplied --> $DIR/extra_arguments.rs:19:3 | LL | two_arg_diff(1, "", 1, ""); - | ^^^^^^^^^^^^ - -- argument unexpected + | ^^^^^^^^^^^^ - -- argument of type `&'static str` unexpected | | - | argument unexpected + | argument of type `{integer}` unexpected | note: function defined here --> $DIR/extra_arguments.rs:4:4 @@ -168,7 +168,7 @@ error[E0061]: this function takes 2 arguments but 3 arguments were supplied --> $DIR/extra_arguments.rs:22:3 | LL | two_arg_same(1, 1, ""); - | ^^^^^^^^^^^^ -- argument unexpected + | ^^^^^^^^^^^^ -- argument of type `&'static str` unexpected | note: function defined here --> $DIR/extra_arguments.rs:3:4 @@ -184,7 +184,7 @@ error[E0061]: this function takes 2 arguments but 3 arguments were supplied --> $DIR/extra_arguments.rs:23:3 | LL | two_arg_diff(1, 1, ""); - | ^^^^^^^^^^^^ - argument of type `&str` unexpected + | ^^^^^^^^^^^^ - argument of type `{integer}` unexpected | note: function defined here --> $DIR/extra_arguments.rs:4:4 @@ -203,7 +203,7 @@ LL | two_arg_same( | ^^^^^^^^^^^^ ... LL | "" - | -- argument unexpected + | -- argument of type `&'static str` unexpected | note: function defined here --> $DIR/extra_arguments.rs:3:4 @@ -222,7 +222,7 @@ LL | two_arg_diff( | ^^^^^^^^^^^^ LL | 1, LL | 1, - | - argument of type `&str` unexpected + | - argument of type `{integer}` unexpected | note: function defined here --> $DIR/extra_arguments.rs:4:4 diff --git a/src/test/ui/argument-suggestions/issue-97484.stderr b/src/test/ui/argument-suggestions/issue-97484.stderr index 2af24d521f3..9589e919c0a 100644 --- a/src/test/ui/argument-suggestions/issue-97484.stderr +++ b/src/test/ui/argument-suggestions/issue-97484.stderr @@ -2,21 +2,20 @@ error[E0061]: this function takes 4 arguments but 7 arguments were supplied --> $DIR/issue-97484.rs:12:5 | LL | foo(&&A, B, C, D, E, F, G); - | ^^^ - - - argument unexpected + | ^^^ - - - argument of type `F` unexpected | | | - | | argument of type `&E` unexpected - | argument of type `D` unexpected + | | argument of type `C` unexpected + | argument of type `B` unexpected | note: function defined here --> $DIR/issue-97484.rs:9:4 | LL | fn foo(a: &A, d: D, e: &E, g: G) {} | ^^^ ----- ---- ----- ---- -help: consider removing the `` - | -LL - foo(&&A, B, C, D, E, F, G); -LL + foo(&&A, B, C, D, E, F, G); +help: consider borrowing here | +LL | foo(&&A, B, C, D, &E, F, G); + | ~~ help: remove the extra arguments | LL | foo(&&A, D, /* &E */, G); diff --git a/src/test/ui/argument-suggestions/mixed_cases.stderr b/src/test/ui/argument-suggestions/mixed_cases.stderr index 3fe4473a594..a52a30d7884 100644 --- a/src/test/ui/argument-suggestions/mixed_cases.stderr +++ b/src/test/ui/argument-suggestions/mixed_cases.stderr @@ -2,7 +2,7 @@ error[E0061]: this function takes 2 arguments but 3 arguments were supplied --> $DIR/mixed_cases.rs:10:3 | LL | two_args(1, "", X {}); - | ^^^^^^^^ -- ---- argument unexpected + | ^^^^^^^^ -- ---- argument of type `X` unexpected | | | expected `f32`, found `&str` | @@ -20,9 +20,9 @@ error[E0061]: this function takes 3 arguments but 4 arguments were supplied --> $DIR/mixed_cases.rs:11:3 | LL | three_args(1, "", X {}, ""); - | ^^^^^^^^^^ -- ---- -- argument unexpected + | ^^^^^^^^^^ -- ---- -- argument of type `&'static str` unexpected | | | - | | argument of type `&str` unexpected + | | argument of type `X` unexpected | an argument of type `f32` is missing | note: function defined here @@ -58,7 +58,7 @@ error[E0308]: arguments to this function are incorrect --> $DIR/mixed_cases.rs:17:3 | LL | three_args(1, "", X {}); - | ^^^^^^^^^^ -- ---- argument of type `&str` unexpected + | ^^^^^^^^^^ -- ---- argument of type `X` unexpected | | | an argument of type `f32` is missing | diff --git a/src/test/ui/array-slice-vec/array_const_index-0.stderr b/src/test/ui/array-slice-vec/array_const_index-0.stderr index b44251efdea..4832398713d 100644 --- a/src/test/ui/array-slice-vec/array_const_index-0.stderr +++ b/src/test/ui/array-slice-vec/array_const_index-0.stderr @@ -2,9 +2,7 @@ error: any use of this value will cause an error --> $DIR/array_const_index-0.rs:2:16 | LL | const B: i32 = (&A)[1]; - | ---------------^^^^^^^- - | | - | index out of bounds: the length is 0 but the index is 1 + | ------------ ^^^^^^^ index out of bounds: the length is 0 but the index is 1 | = note: `#[deny(const_err)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -17,9 +15,7 @@ error: any use of this value will cause an error --> $DIR/array_const_index-0.rs:2:16 | LL | const B: i32 = (&A)[1]; - | ---------------^^^^^^^- - | | - | index out of bounds: the length is 0 but the index is 1 + | ------------ ^^^^^^^ index out of bounds: the length is 0 but the index is 1 | = note: `#[deny(const_err)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! diff --git a/src/test/ui/array-slice-vec/array_const_index-1.stderr b/src/test/ui/array-slice-vec/array_const_index-1.stderr index 8beebafb04c..361f518c052 100644 --- a/src/test/ui/array-slice-vec/array_const_index-1.stderr +++ b/src/test/ui/array-slice-vec/array_const_index-1.stderr @@ -2,9 +2,7 @@ error: any use of this value will cause an error --> $DIR/array_const_index-1.rs:2:16 | LL | const B: i32 = A[1]; - | ---------------^^^^- - | | - | index out of bounds: the length is 0 but the index is 1 + | ------------ ^^^^ index out of bounds: the length is 0 but the index is 1 | = note: `#[deny(const_err)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -17,9 +15,7 @@ error: any use of this value will cause an error --> $DIR/array_const_index-1.rs:2:16 | LL | const B: i32 = A[1]; - | ---------------^^^^- - | | - | index out of bounds: the length is 0 but the index is 1 + | ------------ ^^^^ index out of bounds: the length is 0 but the index is 1 | = note: `#[deny(const_err)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! diff --git a/src/test/ui/array-slice-vec/infer_array_len.stderr b/src/test/ui/array-slice-vec/infer_array_len.stderr index 8da6d97251b..919550cac30 100644 --- a/src/test/ui/array-slice-vec/infer_array_len.stderr +++ b/src/test/ui/array-slice-vec/infer_array_len.stderr @@ -4,7 +4,6 @@ error[E0282]: type annotations needed LL | let [_, _] = a.into(); | ^^^^^^ | - = note: type must be known at this point help: consider giving this pattern a type | LL | let [_, _]: _ = a.into(); diff --git a/src/test/ui/array-slice-vec/slice-pat-type-mismatches.stderr b/src/test/ui/array-slice-vec/slice-pat-type-mismatches.stderr index 20a5b99845b..70a4cbebeee 100644 --- a/src/test/ui/array-slice-vec/slice-pat-type-mismatches.stderr +++ b/src/test/ui/array-slice-vec/slice-pat-type-mismatches.stderr @@ -27,8 +27,6 @@ error[E0282]: type annotations needed | LL | [] => {} | ^^ cannot infer type - | - = note: type must be known at this point error: aborting due to 5 previous errors diff --git a/src/test/ui/associated-consts/assoc-const-ty-mismatch.stderr b/src/test/ui/associated-consts/assoc-const-ty-mismatch.stderr index 703245145ce..58a8aceca2f 100644 --- a/src/test/ui/associated-consts/assoc-const-ty-mismatch.stderr +++ b/src/test/ui/associated-consts/assoc-const-ty-mismatch.stderr @@ -8,7 +8,7 @@ note: associated constant defined here does not match type --> $DIR/assoc-const-ty-mismatch.rs:5:3 | LL | const N: usize; - | ^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^ error: mismatch in bind of associated type, got const --> $DIR/assoc-const-ty-mismatch.rs:25:18 @@ -20,7 +20,7 @@ note: associated type defined here does not match const --> $DIR/assoc-const-ty-mismatch.rs:9:3 | LL | type T; - | ^^^^^^^ + | ^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/associated-consts/associated-const-ambiguity-report.stderr b/src/test/ui/associated-consts/associated-const-ambiguity-report.stderr index 60cf9a533cd..5435f22321c 100644 --- a/src/test/ui/associated-consts/associated-const-ambiguity-report.stderr +++ b/src/test/ui/associated-consts/associated-const-ambiguity-report.stderr @@ -8,12 +8,12 @@ note: candidate #1 is defined in an impl of the trait `Foo` for the type `i32` --> $DIR/associated-const-ambiguity-report.rs:10:5 | LL | const ID: i32 = 1; - | ^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^ note: candidate #2 is defined in an impl of the trait `Bar` for the type `i32` --> $DIR/associated-const-ambiguity-report.rs:14:5 | LL | const ID: i32 = 3; - | ^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^ help: disambiguate the associated constant for candidate #1 | LL | const X: i32 = <i32 as Foo>::ID; diff --git a/src/test/ui/associated-consts/associated-const-dead-code.stderr b/src/test/ui/associated-consts/associated-const-dead-code.stderr index 7a4dbfe087b..cc701cc4b94 100644 --- a/src/test/ui/associated-consts/associated-const-dead-code.stderr +++ b/src/test/ui/associated-consts/associated-const-dead-code.stderr @@ -1,8 +1,8 @@ error: associated constant `BAR` is never used - --> $DIR/associated-const-dead-code.rs:6:5 + --> $DIR/associated-const-dead-code.rs:6:11 | LL | const BAR: u32 = 1; - | ^^^^^^^^^^^^^^^^^^^ + | ^^^ | note: the lint level is defined here --> $DIR/associated-const-dead-code.rs:1:9 diff --git a/src/test/ui/associated-consts/associated-const-private-impl.stderr b/src/test/ui/associated-consts/associated-const-private-impl.stderr index aa356c596f8..a3fa3002e1e 100644 --- a/src/test/ui/associated-consts/associated-const-private-impl.stderr +++ b/src/test/ui/associated-consts/associated-const-private-impl.stderr @@ -2,7 +2,7 @@ error[E0624]: associated constant `ID` is private --> $DIR/associated-const-private-impl.rs:13:30 | LL | const ID: i32 = 1; - | ------------------ private associated constant defined here + | ------------- private associated constant defined here ... LL | assert_eq!(1, bar1::Foo::ID); | ^^ private associated constant diff --git a/src/test/ui/associated-consts/defaults-cyclic-fail.stderr b/src/test/ui/associated-consts/defaults-cyclic-fail.stderr index c4cd9c2a49f..582473905cf 100644 --- a/src/test/ui/associated-consts/defaults-cyclic-fail.stderr +++ b/src/test/ui/associated-consts/defaults-cyclic-fail.stderr @@ -2,13 +2,13 @@ error[E0391]: cycle detected when const-evaluating + checking `Tr::A` --> $DIR/defaults-cyclic-fail.rs:5:5 | LL | const A: u8 = Self::B; - | ^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^ | note: ...which requires const-evaluating + checking `Tr::B`... --> $DIR/defaults-cyclic-fail.rs:8:5 | LL | const B: u8 = Self::A; - | ^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^ = note: ...which again requires const-evaluating + checking `Tr::A`, completing the cycle note: cycle used when const-evaluating + checking `main::promoted[1]` --> $DIR/defaults-cyclic-fail.rs:16:16 diff --git a/src/test/ui/associated-consts/defaults-not-assumed-fail.stderr b/src/test/ui/associated-consts/defaults-not-assumed-fail.stderr index f04ea0b7477..66ee6031c71 100644 --- a/src/test/ui/associated-consts/defaults-not-assumed-fail.stderr +++ b/src/test/ui/associated-consts/defaults-not-assumed-fail.stderr @@ -2,9 +2,7 @@ error: any use of this value will cause an error --> $DIR/defaults-not-assumed-fail.rs:8:19 | LL | const B: u8 = Self::A + 1; - | --------------^^^^^^^^^^^- - | | - | attempt to compute `u8::MAX + 1_u8`, which would overflow + | ----------- ^^^^^^^^^^^ attempt to compute `u8::MAX + 1_u8`, which would overflow | = note: `#[deny(const_err)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -34,9 +32,7 @@ error: any use of this value will cause an error --> $DIR/defaults-not-assumed-fail.rs:8:19 | LL | const B: u8 = Self::A + 1; - | --------------^^^^^^^^^^^- - | | - | attempt to compute `u8::MAX + 1_u8`, which would overflow + | ----------- ^^^^^^^^^^^ attempt to compute `u8::MAX + 1_u8`, which would overflow | = note: `#[deny(const_err)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! diff --git a/src/test/ui/associated-consts/issue-24949-assoc-const-static-recursion-impl.stderr b/src/test/ui/associated-consts/issue-24949-assoc-const-static-recursion-impl.stderr index b4dc730d863..51a50cfdaf9 100644 --- a/src/test/ui/associated-consts/issue-24949-assoc-const-static-recursion-impl.stderr +++ b/src/test/ui/associated-consts/issue-24949-assoc-const-static-recursion-impl.stderr @@ -1,4 +1,4 @@ -error[E0391]: cycle detected when elaborating drops for `<impl at $DIR/issue-24949-assoc-const-static-recursion-impl.rs:11:1: 13:2>::BAR` +error[E0391]: cycle detected when elaborating drops for `<impl at $DIR/issue-24949-assoc-const-static-recursion-impl.rs:11:1: 11:19>::BAR` --> $DIR/issue-24949-assoc-const-static-recursion-impl.rs:12:22 | LL | const BAR: u32 = IMPL_REF_BAR; @@ -8,23 +8,23 @@ note: ...which requires const-evaluating + checking `IMPL_REF_BAR`... --> $DIR/issue-24949-assoc-const-static-recursion-impl.rs:7:1 | LL | const IMPL_REF_BAR: u32 = GlobalImplRef::BAR; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^ note: ...which requires const-evaluating + checking `IMPL_REF_BAR`... --> $DIR/issue-24949-assoc-const-static-recursion-impl.rs:7:1 | LL | const IMPL_REF_BAR: u32 = GlobalImplRef::BAR; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -note: ...which requires const-evaluating + checking `<impl at $DIR/issue-24949-assoc-const-static-recursion-impl.rs:11:1: 13:2>::BAR`... + | ^^^^^^^^^^^^^^^^^^^^^^^ +note: ...which requires const-evaluating + checking `<impl at $DIR/issue-24949-assoc-const-static-recursion-impl.rs:11:1: 11:19>::BAR`... --> $DIR/issue-24949-assoc-const-static-recursion-impl.rs:12:5 | LL | const BAR: u32 = IMPL_REF_BAR; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -note: ...which requires caching mir of `<impl at $DIR/issue-24949-assoc-const-static-recursion-impl.rs:11:1: 13:2>::BAR` for CTFE... + | ^^^^^^^^^^^^^^ +note: ...which requires caching mir of `<impl at $DIR/issue-24949-assoc-const-static-recursion-impl.rs:11:1: 11:19>::BAR` for CTFE... --> $DIR/issue-24949-assoc-const-static-recursion-impl.rs:12:5 | LL | const BAR: u32 = IMPL_REF_BAR; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: ...which again requires elaborating drops for `<impl at $DIR/issue-24949-assoc-const-static-recursion-impl.rs:11:1: 13:2>::BAR`, completing the cycle + | ^^^^^^^^^^^^^^ + = note: ...which again requires elaborating drops for `<impl at $DIR/issue-24949-assoc-const-static-recursion-impl.rs:11:1: 11:19>::BAR`, completing the cycle = note: cycle used when running analysis passes on this crate error: aborting due to previous error diff --git a/src/test/ui/associated-consts/issue-24949-assoc-const-static-recursion-trait-default.stderr b/src/test/ui/associated-consts/issue-24949-assoc-const-static-recursion-trait-default.stderr index 97ede6ad388..b9d1808feb3 100644 --- a/src/test/ui/associated-consts/issue-24949-assoc-const-static-recursion-trait-default.stderr +++ b/src/test/ui/associated-consts/issue-24949-assoc-const-static-recursion-trait-default.stderr @@ -8,22 +8,22 @@ note: ...which requires const-evaluating + checking `DEFAULT_REF_BAR`... --> $DIR/issue-24949-assoc-const-static-recursion-trait-default.rs:11:1 | LL | const DEFAULT_REF_BAR: u32 = <GlobalDefaultRef>::BAR; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ note: ...which requires const-evaluating + checking `DEFAULT_REF_BAR`... --> $DIR/issue-24949-assoc-const-static-recursion-trait-default.rs:11:1 | LL | const DEFAULT_REF_BAR: u32 = <GlobalDefaultRef>::BAR; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ note: ...which requires const-evaluating + checking `FooDefault::BAR`... --> $DIR/issue-24949-assoc-const-static-recursion-trait-default.rs:8:5 | LL | const BAR: u32 = DEFAULT_REF_BAR; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^ note: ...which requires caching mir of `FooDefault::BAR` for CTFE... --> $DIR/issue-24949-assoc-const-static-recursion-trait-default.rs:8:5 | LL | const BAR: u32 = DEFAULT_REF_BAR; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^ = note: ...which again requires elaborating drops for `FooDefault::BAR`, completing the cycle = note: cycle used when running analysis passes on this crate diff --git a/src/test/ui/associated-consts/issue-24949-assoc-const-static-recursion-trait.stderr b/src/test/ui/associated-consts/issue-24949-assoc-const-static-recursion-trait.stderr index bd97c31229e..271e69206cd 100644 --- a/src/test/ui/associated-consts/issue-24949-assoc-const-static-recursion-trait.stderr +++ b/src/test/ui/associated-consts/issue-24949-assoc-const-static-recursion-trait.stderr @@ -1,4 +1,4 @@ -error[E0391]: cycle detected when elaborating drops for `<impl at $DIR/issue-24949-assoc-const-static-recursion-trait.rs:11:1: 13:2>::BAR` +error[E0391]: cycle detected when elaborating drops for `<impl at $DIR/issue-24949-assoc-const-static-recursion-trait.rs:11:1: 11:28>::BAR` --> $DIR/issue-24949-assoc-const-static-recursion-trait.rs:12:22 | LL | const BAR: u32 = TRAIT_REF_BAR; @@ -8,23 +8,23 @@ note: ...which requires const-evaluating + checking `TRAIT_REF_BAR`... --> $DIR/issue-24949-assoc-const-static-recursion-trait.rs:7:1 | LL | const TRAIT_REF_BAR: u32 = <GlobalTraitRef>::BAR; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^ note: ...which requires const-evaluating + checking `TRAIT_REF_BAR`... --> $DIR/issue-24949-assoc-const-static-recursion-trait.rs:7:1 | LL | const TRAIT_REF_BAR: u32 = <GlobalTraitRef>::BAR; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -note: ...which requires const-evaluating + checking `<impl at $DIR/issue-24949-assoc-const-static-recursion-trait.rs:11:1: 13:2>::BAR`... + | ^^^^^^^^^^^^^^^^^^^^^^^^ +note: ...which requires const-evaluating + checking `<impl at $DIR/issue-24949-assoc-const-static-recursion-trait.rs:11:1: 11:28>::BAR`... --> $DIR/issue-24949-assoc-const-static-recursion-trait.rs:12:5 | LL | const BAR: u32 = TRAIT_REF_BAR; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -note: ...which requires caching mir of `<impl at $DIR/issue-24949-assoc-const-static-recursion-trait.rs:11:1: 13:2>::BAR` for CTFE... + | ^^^^^^^^^^^^^^ +note: ...which requires caching mir of `<impl at $DIR/issue-24949-assoc-const-static-recursion-trait.rs:11:1: 11:28>::BAR` for CTFE... --> $DIR/issue-24949-assoc-const-static-recursion-trait.rs:12:5 | LL | const BAR: u32 = TRAIT_REF_BAR; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: ...which again requires elaborating drops for `<impl at $DIR/issue-24949-assoc-const-static-recursion-trait.rs:11:1: 13:2>::BAR`, completing the cycle + | ^^^^^^^^^^^^^^ + = note: ...which again requires elaborating drops for `<impl at $DIR/issue-24949-assoc-const-static-recursion-trait.rs:11:1: 11:28>::BAR`, completing the cycle = note: cycle used when running analysis passes on this crate error: aborting due to previous error diff --git a/src/test/ui/associated-item/associated-item-duplicate-names-2.stderr b/src/test/ui/associated-item/associated-item-duplicate-names-2.stderr index ea475ffc554..f4efd131248 100644 --- a/src/test/ui/associated-item/associated-item-duplicate-names-2.stderr +++ b/src/test/ui/associated-item/associated-item-duplicate-names-2.stderr @@ -2,9 +2,9 @@ error[E0201]: duplicate definitions with name `bar`: --> $DIR/associated-item-duplicate-names-2.rs:5:5 | LL | const bar: bool = true; - | ----------------------- previous definition of `bar` here + | --------------- previous definition of `bar` here LL | fn bar() {} - | ^^^^^^^^^^^ duplicate definition + | ^^^^^^^^ duplicate definition error: aborting due to previous error diff --git a/src/test/ui/associated-item/associated-item-duplicate-names-3.stderr b/src/test/ui/associated-item/associated-item-duplicate-names-3.stderr index 57495863c98..03782f66348 100644 --- a/src/test/ui/associated-item/associated-item-duplicate-names-3.stderr +++ b/src/test/ui/associated-item/associated-item-duplicate-names-3.stderr @@ -2,9 +2,9 @@ error[E0201]: duplicate definitions with name `Bar`: --> $DIR/associated-item-duplicate-names-3.rs:14:5 | LL | type Bar = i16; - | --------------- previous definition of `Bar` here + | -------- previous definition of `Bar` here LL | type Bar = u16; - | ^^^^^^^^^^^^^^^ duplicate definition + | ^^^^^^^^ duplicate definition error: aborting due to previous error diff --git a/src/test/ui/associated-item/associated-item-duplicate-names.stderr b/src/test/ui/associated-item/associated-item-duplicate-names.stderr index f4af9e02939..c9119c10271 100644 --- a/src/test/ui/associated-item/associated-item-duplicate-names.stderr +++ b/src/test/ui/associated-item/associated-item-duplicate-names.stderr @@ -2,17 +2,17 @@ error[E0201]: duplicate definitions with name `Ty`: --> $DIR/associated-item-duplicate-names.rs:11:5 | LL | type Ty = (); - | ------------- previous definition of `Ty` here + | ------- previous definition of `Ty` here LL | type Ty = usize; - | ^^^^^^^^^^^^^^^^ duplicate definition + | ^^^^^^^ duplicate definition error[E0201]: duplicate definitions with name `BAR`: --> $DIR/associated-item-duplicate-names.rs:13:5 | LL | const BAR: u32 = 7; - | ------------------- previous definition of `BAR` here + | -------------- previous definition of `BAR` here LL | const BAR: u32 = 8; - | ^^^^^^^^^^^^^^^^^^^ duplicate definition + | ^^^^^^^^^^^^^^ duplicate definition error: aborting due to 2 previous errors diff --git a/src/test/ui/associated-item/issue-48027.stderr b/src/test/ui/associated-item/issue-48027.stderr index 9ae25a8c222..5487af1a835 100644 --- a/src/test/ui/associated-item/issue-48027.stderr +++ b/src/test/ui/associated-item/issue-48027.stderr @@ -1,15 +1,3 @@ -error[E0283]: type annotations needed - --> $DIR/issue-48027.rs:3:32 - | -LL | fn return_n(&self) -> [u8; Bar::X]; - | ^^^^^^ - | | - | cannot infer type - | help: use the fully qualified path to an implementation: `<Type as Bar>::X` - | - = note: cannot satisfy `_: Bar` - = note: associated constants cannot be accessed directly on a `trait`, they can only be accessed through a specific `impl` - error[E0038]: the trait `Bar` cannot be made into an object --> $DIR/issue-48027.rs:6:6 | @@ -25,6 +13,18 @@ LL | const X: usize; | ^ ...because it contains this associated `const` = help: consider moving `X` to another trait +error[E0283]: type annotations needed + --> $DIR/issue-48027.rs:3:32 + | +LL | fn return_n(&self) -> [u8; Bar::X]; + | ^^^^^^ + | | + | cannot infer type + | help: use the fully qualified path to an implementation: `<Type as Bar>::X` + | + = note: cannot satisfy `_: Bar` + = note: associated constants cannot be accessed directly on a `trait`, they can only be accessed through a specific `impl` + error: aborting due to 2 previous errors Some errors have detailed explanations: E0038, E0283. diff --git a/src/test/ui/associated-type-bounds/assoc-type-eq-with-dyn-atb-fail.rs b/src/test/ui/associated-type-bounds/assoc-type-eq-with-dyn-atb-fail.rs index 67b97c21805..4c36289f47b 100644 --- a/src/test/ui/associated-type-bounds/assoc-type-eq-with-dyn-atb-fail.rs +++ b/src/test/ui/associated-type-bounds/assoc-type-eq-with-dyn-atb-fail.rs @@ -30,7 +30,7 @@ impl Thing for AssocNoCopy { type Out = Box<dyn Bar<Assoc: Copy>>; fn func() -> Self::Out { - Box::new(AssocNoCopy) //~^ ERROR the trait bound `String: Copy` is not satisfied + Box::new(AssocNoCopy) } } diff --git a/src/test/ui/associated-type-bounds/assoc-type-eq-with-dyn-atb-fail.stderr b/src/test/ui/associated-type-bounds/assoc-type-eq-with-dyn-atb-fail.stderr index f1dcd34066d..a32ab453152 100644 --- a/src/test/ui/associated-type-bounds/assoc-type-eq-with-dyn-atb-fail.stderr +++ b/src/test/ui/associated-type-bounds/assoc-type-eq-with-dyn-atb-fail.stderr @@ -1,10 +1,8 @@ error[E0277]: the trait bound `String: Copy` is not satisfied - --> $DIR/assoc-type-eq-with-dyn-atb-fail.rs:33:9 + --> $DIR/assoc-type-eq-with-dyn-atb-fail.rs:32:18 | -LL | Box::new(AssocNoCopy) - | ^^^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `String` - | - = note: required for the cast to the object type `dyn Bar<Assoc = <AssocNoCopy as Thing>::Out::{opaque#0}>` +LL | fn func() -> Self::Out { + | ^^^^^^^^^ the trait `Copy` is not implemented for `String` error: aborting due to previous error diff --git a/src/test/ui/associated-types/associated-type-projection-ambig-between-bound-and-where-clause.stderr b/src/test/ui/associated-types/associated-type-projection-ambig-between-bound-and-where-clause.stderr index 19fc2f652c6..236552baf92 100644 --- a/src/test/ui/associated-types/associated-type-projection-ambig-between-bound-and-where-clause.stderr +++ b/src/test/ui/associated-types/associated-type-projection-ambig-between-bound-and-where-clause.stderr @@ -2,10 +2,10 @@ error[E0221]: ambiguous associated type `Color` in bounds of `C` --> $DIR/associated-type-projection-ambig-between-bound-and-where-clause.rs:16:24 | LL | type Color; - | ----------- ambiguous `Color` from `Vehicle` + | ---------- ambiguous `Color` from `Vehicle` ... LL | type Color; - | ----------- ambiguous `Color` from `Box` + | ---------- ambiguous `Color` from `Box` ... LL | fn a<C:Vehicle+Box>(_: C::Color) { | ^^^^^^^^ ambiguous associated type `Color` @@ -23,10 +23,10 @@ error[E0221]: ambiguous associated type `Color` in bounds of `C` --> $DIR/associated-type-projection-ambig-between-bound-and-where-clause.rs:20:12 | LL | type Color; - | ----------- ambiguous `Color` from `Vehicle` + | ---------- ambiguous `Color` from `Vehicle` ... LL | type Color; - | ----------- ambiguous `Color` from `Box` + | ---------- ambiguous `Color` from `Box` ... LL | fn b<C>(_: C::Color) where C : Vehicle+Box { | ^^^^^^^^ ambiguous associated type `Color` @@ -44,10 +44,10 @@ error[E0221]: ambiguous associated type `Color` in bounds of `C` --> $DIR/associated-type-projection-ambig-between-bound-and-where-clause.rs:24:12 | LL | type Color; - | ----------- ambiguous `Color` from `Vehicle` + | ---------- ambiguous `Color` from `Vehicle` ... LL | type Color; - | ----------- ambiguous `Color` from `Box` + | ---------- ambiguous `Color` from `Box` ... LL | fn c<C>(_: C::Color) where C : Vehicle, C : Box { | ^^^^^^^^ ambiguous associated type `Color` @@ -65,10 +65,10 @@ error[E0221]: ambiguous associated type `Color` in bounds of `X` --> $DIR/associated-type-projection-ambig-between-bound-and-where-clause.rs:35:20 | LL | type Color; - | ----------- ambiguous `Color` from `Vehicle` + | ---------- ambiguous `Color` from `Vehicle` ... LL | type Color; - | ----------- ambiguous `Color` from `Box` + | ---------- ambiguous `Color` from `Box` ... LL | fn e(&self, _: X::Color) where X : Box; | ^^^^^^^^ ambiguous associated type `Color` @@ -86,10 +86,10 @@ error[E0221]: ambiguous associated type `Color` in bounds of `X` --> $DIR/associated-type-projection-ambig-between-bound-and-where-clause.rs:38:20 | LL | type Color; - | ----------- ambiguous `Color` from `Vehicle` + | ---------- ambiguous `Color` from `Vehicle` ... LL | type Color; - | ----------- ambiguous `Color` from `Box` + | ---------- ambiguous `Color` from `Box` ... LL | fn f(&self, _: X::Color) where X : Box { } | ^^^^^^^^ ambiguous associated type `Color` @@ -107,10 +107,10 @@ error[E0221]: ambiguous associated type `Color` in bounds of `X` --> $DIR/associated-type-projection-ambig-between-bound-and-where-clause.rs:30:20 | LL | type Color; - | ----------- ambiguous `Color` from `Vehicle` + | ---------- ambiguous `Color` from `Vehicle` ... LL | type Color; - | ----------- ambiguous `Color` from `Box` + | ---------- ambiguous `Color` from `Box` ... LL | fn d(&self, _: X::Color) where X : Box { } | ^^^^^^^^ ambiguous associated type `Color` diff --git a/src/test/ui/associated-types/associated-type-projection-from-multiple-supertraits.stderr b/src/test/ui/associated-types/associated-type-projection-from-multiple-supertraits.stderr index 66a4899c77f..e765f932398 100644 --- a/src/test/ui/associated-types/associated-type-projection-from-multiple-supertraits.stderr +++ b/src/test/ui/associated-types/associated-type-projection-from-multiple-supertraits.stderr @@ -10,10 +10,10 @@ error[E0221]: ambiguous associated type `Color` in bounds of `C` --> $DIR/associated-type-projection-from-multiple-supertraits.rs:19:32 | LL | type Color; - | ----------- ambiguous `Color` from `Vehicle` + | ---------- ambiguous `Color` from `Vehicle` ... LL | type Color; - | ----------- ambiguous `Color` from `Box` + | ---------- ambiguous `Color` from `Box` ... LL | fn dent<C:BoxCar>(c: C, color: C::Color) { | ^^^^^^^^ ambiguous associated type `Color` @@ -31,10 +31,10 @@ error[E0222]: ambiguous associated type `Color` in bounds of `BoxCar` --> $DIR/associated-type-projection-from-multiple-supertraits.rs:23:37 | LL | type Color; - | ----------- ambiguous `Color` from `Vehicle` + | ---------- ambiguous `Color` from `Vehicle` ... LL | type Color; - | ----------- ambiguous `Color` from `Box` + | ---------- ambiguous `Color` from `Box` ... LL | fn dent_object<COLOR>(c: dyn BoxCar<Color=COLOR>) { | ^^^^^^^^^^^ ambiguous associated type `Color` @@ -49,10 +49,10 @@ error[E0191]: the value of the associated types `Color` (from trait `Box`), `Col --> $DIR/associated-type-projection-from-multiple-supertraits.rs:23:30 | LL | type Color; - | ----------- `Vehicle::Color` defined here + | ---------- `Vehicle::Color` defined here ... LL | type Color; - | ----------- `Box::Color` defined here + | ---------- `Box::Color` defined here ... LL | fn dent_object<COLOR>(c: dyn BoxCar<Color=COLOR>) { | ^^^^^^^^^^^^^^^^^^^ associated types `Color` (from trait `Vehicle`), `Color` (from trait `Box`) must be specified @@ -63,10 +63,10 @@ error[E0221]: ambiguous associated type `Color` in bounds of `C` --> $DIR/associated-type-projection-from-multiple-supertraits.rs:28:29 | LL | type Color; - | ----------- ambiguous `Color` from `Vehicle` + | ---------- ambiguous `Color` from `Vehicle` ... LL | type Color; - | ----------- ambiguous `Color` from `Box` + | ---------- ambiguous `Color` from `Box` ... LL | fn paint<C:BoxCar>(c: C, d: C::Color) { | ^^^^^^^^ ambiguous associated type `Color` @@ -84,10 +84,10 @@ error[E0191]: the value of the associated types `Color` (from trait `Box`), `Col --> $DIR/associated-type-projection-from-multiple-supertraits.rs:32:32 | LL | type Color; - | ----------- `Vehicle::Color` defined here + | ---------- `Vehicle::Color` defined here ... LL | type Color; - | ----------- `Box::Color` defined here + | ---------- `Box::Color` defined here ... LL | fn dent_object_2<COLOR>(c: dyn BoxCar) where <dyn BoxCar as Vehicle>::Color = COLOR { | ^^^^^^ associated types `Color` (from trait `Vehicle`), `Color` (from trait `Box`) must be specified diff --git a/src/test/ui/associated-types/associated-types-coherence-failure.stderr b/src/test/ui/associated-types/associated-types-coherence-failure.stderr index 211613b3714..40c02dca32f 100644 --- a/src/test/ui/associated-types/associated-types-coherence-failure.stderr +++ b/src/test/ui/associated-types/associated-types-coherence-failure.stderr @@ -2,19 +2,19 @@ error[E0119]: conflicting implementations of trait `IntoCow<'_, _>` for type `Co --> $DIR/associated-types-coherence-failure.rs:21:1 | LL | impl<'a, B: ?Sized> IntoCow<'a, B> for <B as ToOwned>::Owned where B: ToOwned { - | ----------------------------------------------------------------------------- first implementation here + | ------------------------------------------------------------ first implementation here ... LL | impl<'a, B: ?Sized> IntoCow<'a, B> for Cow<'a, B> where B: ToOwned { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `Cow<'_, _>` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `Cow<'_, _>` error[E0119]: conflicting implementations of trait `IntoCow<'_, _>` for type `&_` --> $DIR/associated-types-coherence-failure.rs:28:1 | LL | impl<'a, B: ?Sized> IntoCow<'a, B> for <B as ToOwned>::Owned where B: ToOwned { - | ----------------------------------------------------------------------------- first implementation here + | ------------------------------------------------------------ first implementation here ... LL | impl<'a, B: ?Sized> IntoCow<'a, B> for &'a B where B: ToOwned { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `&_` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `&_` error: aborting due to 2 previous errors diff --git a/src/test/ui/associated-types/associated-types-eq-3.stderr b/src/test/ui/associated-types/associated-types-eq-3.stderr index 521907a6044..bed63a5e6df 100644 --- a/src/test/ui/associated-types/associated-types-eq-3.stderr +++ b/src/test/ui/associated-types/associated-types-eq-3.stderr @@ -41,7 +41,7 @@ note: expected this to be `Bar` | LL | type A = usize; | ^^^^^ - = note: required for the cast to the object type `dyn Foo<A = Bar>` + = note: required for the cast from `isize` to the object type `dyn Foo<A = Bar>` error: aborting due to 3 previous errors diff --git a/src/test/ui/associated-types/associated-types-incomplete-object.stderr b/src/test/ui/associated-types/associated-types-incomplete-object.stderr index 24732271c42..32866c71468 100644 --- a/src/test/ui/associated-types/associated-types-incomplete-object.stderr +++ b/src/test/ui/associated-types/associated-types-incomplete-object.stderr @@ -2,7 +2,7 @@ error[E0191]: the value of the associated type `B` (from trait `Foo`) must be sp --> $DIR/associated-types-incomplete-object.rs:23:30 | LL | type B; - | ------- `B` defined here + | ------ `B` defined here ... LL | let b = &42isize as &dyn Foo<A=usize>; | ^^^^^^^^^^^^ help: specify the associated type: `Foo<A=usize, B = Type>` @@ -11,7 +11,7 @@ error[E0191]: the value of the associated type `A` (from trait `Foo`) must be sp --> $DIR/associated-types-incomplete-object.rs:26:30 | LL | type A; - | ------- `A` defined here + | ------ `A` defined here ... LL | let c = &42isize as &dyn Foo<B=char>; | ^^^^^^^^^^^ help: specify the associated type: `Foo<B=char, A = Type>` @@ -20,9 +20,9 @@ error[E0191]: the value of the associated types `A` (from trait `Foo`), `B` (fro --> $DIR/associated-types-incomplete-object.rs:29:30 | LL | type A; - | ------- `A` defined here + | ------ `A` defined here LL | type B; - | ------- `B` defined here + | ------ `B` defined here ... LL | let d = &42isize as &dyn Foo; | ^^^ help: specify the associated types: `Foo<A = Type, B = Type>` diff --git a/src/test/ui/associated-types/associated-types-issue-17359.stderr b/src/test/ui/associated-types/associated-types-issue-17359.stderr index 575a072c558..9e40d809586 100644 --- a/src/test/ui/associated-types/associated-types-issue-17359.stderr +++ b/src/test/ui/associated-types/associated-types-issue-17359.stderr @@ -2,7 +2,7 @@ error[E0046]: not all trait items implemented, missing: `Type` --> $DIR/associated-types-issue-17359.rs:8:1 | LL | type Type; - | ---------- `Type` from trait + | --------- `Type` from trait ... LL | impl Trait for isize {} | ^^^^^^^^^^^^^^^^^^^^ missing `Type` in implementation diff --git a/src/test/ui/associated-types/associated-types-no-suitable-supertrait.stderr b/src/test/ui/associated-types/associated-types-no-suitable-supertrait.stderr index da79c7ac77f..bd3ee2abd2c 100644 --- a/src/test/ui/associated-types/associated-types-no-suitable-supertrait.stderr +++ b/src/test/ui/associated-types/associated-types-no-suitable-supertrait.stderr @@ -1,3 +1,9 @@ +error[E0277]: the trait bound `(T, U): Get` is not satisfied + --> $DIR/associated-types-no-suitable-supertrait.rs:22:40 + | +LL | fn uhoh<U:Get>(&self, foo: U, bar: <(T, U) as Get>::Value) {} + | ^^^^^^^^^^^^^^^^^^^^^^ the trait `Get` is not implemented for `(T, U)` + error[E0277]: the trait bound `Self: Get` is not satisfied --> $DIR/associated-types-no-suitable-supertrait.rs:17:40 | @@ -9,12 +15,6 @@ help: consider further restricting `Self` LL | fn uhoh<U:Get>(&self, foo: U, bar: <Self as Get>::Value) where Self: Get {} | +++++++++++++++ -error[E0277]: the trait bound `(T, U): Get` is not satisfied - --> $DIR/associated-types-no-suitable-supertrait.rs:22:40 - | -LL | fn uhoh<U:Get>(&self, foo: U, bar: <(T, U) as Get>::Value) {} - | ^^^^^^^^^^^^^^^^^^^^^^ the trait `Get` is not implemented for `(T, U)` - error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/associated-types/associated-types-overridden-binding-2.stderr b/src/test/ui/associated-types/associated-types-overridden-binding-2.stderr index 9f1abf2a6c4..dbd9a44ed97 100644 --- a/src/test/ui/associated-types/associated-types-overridden-binding-2.stderr +++ b/src/test/ui/associated-types/associated-types-overridden-binding-2.stderr @@ -4,7 +4,7 @@ error[E0271]: type mismatch resolving `<std::vec::IntoIter<u32> as Iterator>::It LL | let _: &dyn I32Iterator<Item = u32> = &vec![42].into_iter(); | ^^^^^^^^^^^^^^^^^^^^^ expected `i32`, found `u32` | - = note: required for the cast to the object type `dyn Iterator<Item = u32, Item = i32>` + = note: required for the cast from `std::vec::IntoIter<u32>` to the object type `dyn Iterator<Item = u32, Item = i32>` error: aborting due to previous error diff --git a/src/test/ui/associated-types/associated-types-path-1.stderr b/src/test/ui/associated-types/associated-types-path-1.stderr index 6512d60b2c2..a67f77e37c7 100644 --- a/src/test/ui/associated-types/associated-types-path-1.stderr +++ b/src/test/ui/associated-types/associated-types-path-1.stderr @@ -8,10 +8,10 @@ error[E0221]: ambiguous associated type `A` in bounds of `T` --> $DIR/associated-types-path-1.rs:11:34 | LL | type A; - | ------- ambiguous `A` from `Foo` + | ------ ambiguous `A` from `Foo` ... LL | type A; - | ------- ambiguous `A` from `Bar` + | ------ ambiguous `A` from `Bar` ... LL | pub fn f2<T: Foo + Bar>(a: T, x: T::A) {} | ^^^^ ambiguous associated type `A` diff --git a/src/test/ui/associated-types/defaults-mixed.stderr b/src/test/ui/associated-types/defaults-mixed.stderr index 69ddd5f2326..0f4a6968c70 100644 --- a/src/test/ui/associated-types/defaults-mixed.stderr +++ b/src/test/ui/associated-types/defaults-mixed.stderr @@ -2,7 +2,7 @@ error[E0046]: not all trait items implemented, missing: `Bar` --> $DIR/defaults-mixed.rs:11:1 | LL | type Bar; - | --------- `Bar` from trait + | -------- `Bar` from trait ... LL | impl Trait for () {} | ^^^^^^^^^^^^^^^^^ missing `Bar` in implementation @@ -11,7 +11,7 @@ error[E0046]: not all trait items implemented, missing: `Bar` --> $DIR/defaults-mixed.rs:14:1 | LL | type Bar; - | --------- `Bar` from trait + | -------- `Bar` from trait ... LL | impl Trait for bool { | ^^^^^^^^^^^^^^^^^^^ missing `Bar` in implementation diff --git a/src/test/ui/associated-types/hr-associated-type-bound-2.rs b/src/test/ui/associated-types/hr-associated-type-bound-2.rs index 2eb956c8dbb..a89f61a81a5 100644 --- a/src/test/ui/associated-types/hr-associated-type-bound-2.rs +++ b/src/test/ui/associated-types/hr-associated-type-bound-2.rs @@ -12,7 +12,7 @@ impl X<'_> for u32 //~ overflow evaluating the requirement `for<'b> u32: X<'b>` where for<'b> <Self as X<'b>>::U: Clone, { - type U = str; //~ overflow evaluating the requirement `for<'b> u32: X<'b>` + type U = str; } fn main() { diff --git a/src/test/ui/associated-types/hr-associated-type-bound-2.stderr b/src/test/ui/associated-types/hr-associated-type-bound-2.stderr index fe9b4d630b9..e007f5a163b 100644 --- a/src/test/ui/associated-types/hr-associated-type-bound-2.stderr +++ b/src/test/ui/associated-types/hr-associated-type-bound-2.stderr @@ -1,28 +1,8 @@ error[E0275]: overflow evaluating the requirement `for<'b> u32: X<'b>` --> $DIR/hr-associated-type-bound-2.rs:11:1 | -LL | / impl X<'_> for u32 -LL | | where -LL | | for<'b> <Self as X<'b>>::U: Clone, -LL | | { -LL | | type U = str; -LL | | } - | |_^ - | - = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`hr_associated_type_bound_2`) -note: required because of the requirements on the impl of `for<'b> X<'b>` for `u32` - --> $DIR/hr-associated-type-bound-2.rs:11:6 - | LL | impl X<'_> for u32 - | ^^^^^ ^^^ - = note: 128 redundant requirements hidden - = note: required because of the requirements on the impl of `for<'b> X<'b>` for `u32` - -error[E0275]: overflow evaluating the requirement `for<'b> u32: X<'b>` - --> $DIR/hr-associated-type-bound-2.rs:15:5 - | -LL | type U = str; - | ^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^ | = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`hr_associated_type_bound_2`) note: required because of the requirements on the impl of `for<'b> X<'b>` for `u32` @@ -33,6 +13,6 @@ LL | impl X<'_> for u32 = note: 128 redundant requirements hidden = note: required because of the requirements on the impl of `for<'b> X<'b>` for `u32` -error: aborting due to 2 previous errors +error: aborting due to previous error For more information about this error, try `rustc --explain E0275`. diff --git a/src/test/ui/associated-types/hr-associated-type-bound-param-2.stderr b/src/test/ui/associated-types/hr-associated-type-bound-param-2.stderr index 5809c407a5f..52294f8c94a 100644 --- a/src/test/ui/associated-types/hr-associated-type-bound-param-2.stderr +++ b/src/test/ui/associated-types/hr-associated-type-bound-param-2.stderr @@ -15,10 +15,10 @@ LL | for<'b> <T as Z<'b, u16>>::W: Clone, | ^^^^^ required by this bound in `Z` error[E0277]: the trait bound `str: Clone` is not satisfied - --> $DIR/hr-associated-type-bound-param-2.rs:3:8 + --> $DIR/hr-associated-type-bound-param-2.rs:15:14 | -LL | T: Z<'a, u16>, - | ^^^^^^^^^^ the trait `Clone` is not implemented for `str` +LL | type W = str; + | ^^^ the trait `Clone` is not implemented for `str` | = help: the trait `Clone` is implemented for `String` note: required by a bound in `Z` @@ -31,10 +31,10 @@ LL | for<'b> <T as Z<'b, u16>>::W: Clone, | ^^^^^ required by this bound in `Z` error[E0277]: the trait bound `str: Clone` is not satisfied - --> $DIR/hr-associated-type-bound-param-2.rs:15:14 + --> $DIR/hr-associated-type-bound-param-2.rs:3:8 | -LL | type W = str; - | ^^^ the trait `Clone` is not implemented for `str` +LL | T: Z<'a, u16>, + | ^^^^^^^^^^ the trait `Clone` is not implemented for `str` | = help: the trait `Clone` is implemented for `String` note: required by a bound in `Z` diff --git a/src/test/ui/associated-types/impl-wf-cycle-1.rs b/src/test/ui/associated-types/impl-wf-cycle-1.rs index ba074210a2b..365eddaed13 100644 --- a/src/test/ui/associated-types/impl-wf-cycle-1.rs +++ b/src/test/ui/associated-types/impl-wf-cycle-1.rs @@ -13,16 +13,14 @@ trait Grault { } impl<T: Grault> Grault for (T,) +//~^ ERROR overflow evaluating the requirement `<(T,) as Grault>::A == _` where Self::A: Baz, Self::B: Fiz, { type A = (); - //~^ ERROR overflow evaluating the requirement `<(T,) as Grault>::A == _` type B = bool; - //~^ ERROR overflow evaluating the requirement `<(T,) as Grault>::A == _` } -//~^^^^^^^^^^ ERROR overflow evaluating the requirement `<(T,) as Grault>::A == _` fn main() { let x: <(_,) as Grault>::A = (); diff --git a/src/test/ui/associated-types/impl-wf-cycle-1.stderr b/src/test/ui/associated-types/impl-wf-cycle-1.stderr index 73167d08311..939c9bbdb6b 100644 --- a/src/test/ui/associated-types/impl-wf-cycle-1.stderr +++ b/src/test/ui/associated-types/impl-wf-cycle-1.stderr @@ -1,42 +1,8 @@ error[E0275]: overflow evaluating the requirement `<(T,) as Grault>::A == _` --> $DIR/impl-wf-cycle-1.rs:15:1 | -LL | / impl<T: Grault> Grault for (T,) -LL | | where -LL | | Self::A: Baz, -LL | | Self::B: Fiz, -... | -LL | | -LL | | } - | |_^ - | -note: required because of the requirements on the impl of `Grault` for `(T,)` - --> $DIR/impl-wf-cycle-1.rs:15:17 - | LL | impl<T: Grault> Grault for (T,) - | ^^^^^^ ^^^^ - = note: 1 redundant requirement hidden - = note: required because of the requirements on the impl of `Grault` for `(T,)` - -error[E0275]: overflow evaluating the requirement `<(T,) as Grault>::A == _` - --> $DIR/impl-wf-cycle-1.rs:20:5 - | -LL | type A = (); - | ^^^^^^^^^^^^ - | -note: required because of the requirements on the impl of `Grault` for `(T,)` - --> $DIR/impl-wf-cycle-1.rs:15:17 - | -LL | impl<T: Grault> Grault for (T,) - | ^^^^^^ ^^^^ - = note: 1 redundant requirement hidden - = note: required because of the requirements on the impl of `Grault` for `(T,)` - -error[E0275]: overflow evaluating the requirement `<(T,) as Grault>::A == _` - --> $DIR/impl-wf-cycle-1.rs:22:5 - | -LL | type B = bool; - | ^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: required because of the requirements on the impl of `Grault` for `(T,)` --> $DIR/impl-wf-cycle-1.rs:15:17 @@ -46,6 +12,6 @@ LL | impl<T: Grault> Grault for (T,) = note: 1 redundant requirement hidden = note: required because of the requirements on the impl of `Grault` for `(T,)` -error: aborting due to 3 previous errors +error: aborting due to previous error For more information about this error, try `rustc --explain E0275`. diff --git a/src/test/ui/associated-types/impl-wf-cycle-2.rs b/src/test/ui/associated-types/impl-wf-cycle-2.rs index 6fccc54f229..f2f3072e344 100644 --- a/src/test/ui/associated-types/impl-wf-cycle-2.rs +++ b/src/test/ui/associated-types/impl-wf-cycle-2.rs @@ -5,12 +5,11 @@ trait Grault { } impl<T: Grault> Grault for (T,) +//~^ ERROR overflow evaluating the requirement `<(T,) as Grault>::A == _` where Self::A: Copy, { type A = (); - //~^ ERROR overflow evaluating the requirement `<(T,) as Grault>::A == _` } -//~^^^^^^^ ERROR overflow evaluating the requirement `<(T,) as Grault>::A == _` fn main() {} diff --git a/src/test/ui/associated-types/impl-wf-cycle-2.stderr b/src/test/ui/associated-types/impl-wf-cycle-2.stderr index a17e63f28fe..d02ed2cacdf 100644 --- a/src/test/ui/associated-types/impl-wf-cycle-2.stderr +++ b/src/test/ui/associated-types/impl-wf-cycle-2.stderr @@ -1,26 +1,8 @@ error[E0275]: overflow evaluating the requirement `<(T,) as Grault>::A == _` --> $DIR/impl-wf-cycle-2.rs:7:1 | -LL | / impl<T: Grault> Grault for (T,) -LL | | where -LL | | Self::A: Copy, -LL | | { -LL | | type A = (); -LL | | -LL | | } - | |_^ - | -note: required because of the requirements on the impl of `Grault` for `(T,)` - --> $DIR/impl-wf-cycle-2.rs:7:17 - | LL | impl<T: Grault> Grault for (T,) - | ^^^^^^ ^^^^ - -error[E0275]: overflow evaluating the requirement `<(T,) as Grault>::A == _` - --> $DIR/impl-wf-cycle-2.rs:11:5 - | -LL | type A = (); - | ^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: required because of the requirements on the impl of `Grault` for `(T,)` --> $DIR/impl-wf-cycle-2.rs:7:17 @@ -28,6 +10,6 @@ note: required because of the requirements on the impl of `Grault` for `(T,)` LL | impl<T: Grault> Grault for (T,) | ^^^^^^ ^^^^ -error: aborting due to 2 previous errors +error: aborting due to previous error For more information about this error, try `rustc --explain E0275`. diff --git a/src/test/ui/associated-types/issue-22560.stderr b/src/test/ui/associated-types/issue-22560.stderr index 71655d54baa..700923c1b3f 100644 --- a/src/test/ui/associated-types/issue-22560.stderr +++ b/src/test/ui/associated-types/issue-22560.stderr @@ -1,26 +1,22 @@ error[E0393]: the type parameter `Rhs` must be explicitly specified --> $DIR/issue-22560.rs:9:23 | -LL | / trait Sub<Rhs=Self> { -LL | | type Output; -LL | | } - | |_- type parameter `Rhs` must be specified for this -LL | -LL | type Test = dyn Add + Sub; - | ^^^ help: set the type parameter to the desired type: `Sub<Rhs>` +LL | trait Sub<Rhs=Self> { + | ------------------- type parameter `Rhs` must be specified for this +... +LL | type Test = dyn Add + Sub; + | ^^^ help: set the type parameter to the desired type: `Sub<Rhs>` | = note: because of the default `Self` reference, type parameters must be specified on object types error[E0393]: the type parameter `Rhs` must be explicitly specified --> $DIR/issue-22560.rs:9:17 | -LL | / trait Add<Rhs=Self> { -LL | | type Output; -LL | | } - | |_- type parameter `Rhs` must be specified for this +LL | trait Add<Rhs=Self> { + | ------------------- type parameter `Rhs` must be specified for this ... -LL | type Test = dyn Add + Sub; - | ^^^ help: set the type parameter to the desired type: `Add<Rhs>` +LL | type Test = dyn Add + Sub; + | ^^^ help: set the type parameter to the desired type: `Add<Rhs>` | = note: because of the default `Self` reference, type parameters must be specified on object types @@ -39,10 +35,10 @@ error[E0191]: the value of the associated types `Output` (from trait `Add`), `Ou --> $DIR/issue-22560.rs:9:17 | LL | type Output; - | ------------ `Output` defined here + | ----------- `Output` defined here ... LL | type Output; - | ------------ `Output` defined here + | ----------- `Output` defined here ... LL | type Test = dyn Add + Sub; | ^^^ ^^^ associated type `Output` must be specified diff --git a/src/test/ui/associated-types/issue-23595-1.stderr b/src/test/ui/associated-types/issue-23595-1.stderr index bb455684ee3..4307477a56a 100644 --- a/src/test/ui/associated-types/issue-23595-1.stderr +++ b/src/test/ui/associated-types/issue-23595-1.stderr @@ -2,14 +2,11 @@ error[E0191]: the value of the associated types `ChildKey` (from trait `Hierarch --> $DIR/issue-23595-1.rs:8:58 | LL | type Value; - | ----------- `Value` defined here + | ---------- `Value` defined here LL | type ChildKey; - | -------------- `ChildKey` defined here + | ------------- `ChildKey` defined here LL | type Children = dyn Index<Self::ChildKey, Output=dyn Hierarchy>; - | -----------------------------------------------------^^^^^^^^^-- - | | | - | | help: specify the associated types: `Hierarchy<Value = Type, ChildKey = Type, Children = Type>` - | `Children` defined here + | ------------- `Children` defined here ^^^^^^^^^ help: specify the associated types: `Hierarchy<Value = Type, ChildKey = Type, Children = Type>` error: aborting due to previous error diff --git a/src/test/ui/associated-types/issue-47814.rs b/src/test/ui/associated-types/issue-47814.rs new file mode 100644 index 00000000000..90e8a3bc2f2 --- /dev/null +++ b/src/test/ui/associated-types/issue-47814.rs @@ -0,0 +1,13 @@ +struct ArpIPv4<'a> { + s: &'a u8 +} + +impl<'a> ArpIPv4<'a> { + const LENGTH: usize = 20; + + pub fn to_buffer() -> [u8; Self::LENGTH] { //~ ERROR generic `Self` types are currently not permitted in anonymous constants + unimplemented!() + } +} + +pub fn main() {} diff --git a/src/test/ui/associated-types/issue-47814.stderr b/src/test/ui/associated-types/issue-47814.stderr new file mode 100644 index 00000000000..2e4ddb81166 --- /dev/null +++ b/src/test/ui/associated-types/issue-47814.stderr @@ -0,0 +1,14 @@ +error: generic `Self` types are currently not permitted in anonymous constants + --> $DIR/issue-47814.rs:8:32 + | +LL | pub fn to_buffer() -> [u8; Self::LENGTH] { + | ^^^^ + | +note: not a concrete type + --> $DIR/issue-47814.rs:5:10 + | +LL | impl<'a> ArpIPv4<'a> { + | ^^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/src/test/ui/associated-types/issue-59324.stderr b/src/test/ui/associated-types/issue-59324.stderr index 45d2dfb5375..a84b599b52b 100644 --- a/src/test/ui/associated-types/issue-59324.stderr +++ b/src/test/ui/associated-types/issue-59324.stderr @@ -5,10 +5,7 @@ LL | / pub trait ThriftService<Bug: NotFoo>: LL | | LL | | LL | | Service<AssocType = <Bug as Foo>::OnlyFoo> -... | -LL | | -LL | | } - | |_^ the trait `Foo` is not implemented for `Bug` + | |______________________________________________^ the trait `Foo` is not implemented for `Bug` | help: consider further restricting this bound | @@ -46,6 +43,12 @@ help: consider further restricting this bound LL | pub trait ThriftService<Bug: NotFoo + Foo>: | +++++ +error[E0277]: the trait bound `(): Foo` is not satisfied + --> $DIR/issue-59324.rs:23:29 + | +LL | fn with_factory<H>(factory: dyn ThriftService<()>) {} + | ^^^^^^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `()` + error[E0277]: the trait bound `Bug: Foo` is not satisfied --> $DIR/issue-59324.rs:19:10 | @@ -57,12 +60,6 @@ help: consider further restricting this bound LL | pub trait ThriftService<Bug: NotFoo + Foo>: | +++++ -error[E0277]: the trait bound `(): Foo` is not satisfied - --> $DIR/issue-59324.rs:23:29 - | -LL | fn with_factory<H>(factory: dyn ThriftService<()>) {} - | ^^^^^^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `()` - error: aborting due to 5 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/associated-types/issue-65774-1.stderr b/src/test/ui/associated-types/issue-65774-1.stderr index e468a1b3ba4..419de689c52 100644 --- a/src/test/ui/associated-types/issue-65774-1.stderr +++ b/src/test/ui/associated-types/issue-65774-1.stderr @@ -23,7 +23,7 @@ note: required because of the requirements on the impl of `MyDisplay` for `&mut | LL | impl<'a, T: MyDisplay> MyDisplay for &'a mut T { } | ^^^^^^^^^ ^^^^^^^^^ - = note: required for the cast to the object type `dyn MyDisplay` + = note: required for the cast from `&mut T` to the object type `dyn MyDisplay` error: aborting due to 2 previous errors diff --git a/src/test/ui/associated-types/issue-65774-2.stderr b/src/test/ui/associated-types/issue-65774-2.stderr index 4cef4db4698..c22302cdc26 100644 --- a/src/test/ui/associated-types/issue-65774-2.stderr +++ b/src/test/ui/associated-types/issue-65774-2.stderr @@ -18,7 +18,7 @@ LL | writer.my_write(valref) | ^^^^^^ the trait `MyDisplay` is not implemented for `T` | = help: the trait `MyDisplay` is implemented for `&'a mut T` - = note: required for the cast to the object type `dyn MyDisplay` + = note: required for the cast from `T` to the object type `dyn MyDisplay` error: aborting due to 2 previous errors diff --git a/src/test/ui/associated-types/issue-85103.stderr b/src/test/ui/associated-types/issue-85103.stderr index 142f3c411ec..bddd1dce8e6 100644 --- a/src/test/ui/associated-types/issue-85103.stderr +++ b/src/test/ui/associated-types/issue-85103.stderr @@ -2,7 +2,7 @@ error: layout error: NormalizationFailure(<[E] as std::borrow::ToOwned>::Owned, --> $DIR/issue-85103.rs:6:1 | LL | type Edges<'a, E> = Cow<'a, [E]>; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/associated-types/missing-associated-types.stderr b/src/test/ui/associated-types/missing-associated-types.stderr index 8c52736b02c..f617df984ae 100644 --- a/src/test/ui/associated-types/missing-associated-types.stderr +++ b/src/test/ui/associated-types/missing-associated-types.stderr @@ -13,7 +13,7 @@ error[E0191]: the value of the associated types `A` (from trait `Y`), `Output` ( --> $DIR/missing-associated-types.rs:12:21 | LL | type A; - | ------- `A` defined here + | ------ `A` defined here ... LL | type Foo<Rhs> = dyn Add<Rhs> + Sub<Rhs> + X<Rhs> + Y<Rhs>; | ^^^^^^^^ ^^^^^^^^ ^^^^^^ ^^^^^^ associated type `A` must be specified @@ -42,9 +42,9 @@ error[E0191]: the value of the associated types `A` (from trait `Z`), `B` (from --> $DIR/missing-associated-types.rs:15:21 | LL | type A; - | ------- `A` defined here + | ------ `A` defined here LL | type B; - | ------- `B` defined here + | ------ `B` defined here ... LL | type Bar<Rhs> = dyn Add<Rhs> + Sub<Rhs> + X<Rhs> + Z<Rhs>; | ^^^^^^^^ ^^^^^^^^ ^^^^^^ ^^^^^^ associated types `A`, `B`, `Output` must be specified @@ -78,7 +78,7 @@ error[E0191]: the value of the associated types `A` (from trait `Y`), `Output` ( --> $DIR/missing-associated-types.rs:18:21 | LL | type A; - | ------- `A` defined here + | ------ `A` defined here ... LL | type Baz<Rhs> = dyn Add<Rhs> + Sub<Rhs> + Y<Rhs>; | ^^^^^^^^ ^^^^^^^^ ^^^^^^ associated type `A` must be specified diff --git a/src/test/ui/async-await/async-block-control-flow-static-semantics.stderr b/src/test/ui/async-await/async-block-control-flow-static-semantics.stderr index e0818337d20..e5887689690 100644 --- a/src/test/ui/async-await/async-block-control-flow-static-semantics.stderr +++ b/src/test/ui/async-await/async-block-control-flow-static-semantics.stderr @@ -37,7 +37,7 @@ error[E0271]: type mismatch resolving `<impl Future<Output = u8> as Future>::Out LL | let _: &dyn Future<Output = ()> = █ | ^^^^^^ expected `()`, found `u8` | - = note: required for the cast to the object type `dyn Future<Output = ()>` + = note: required for the cast from `impl Future<Output = u8>` to the object type `dyn Future<Output = ()>` error[E0308]: mismatched types --> $DIR/async-block-control-flow-static-semantics.rs:12:43 @@ -53,7 +53,7 @@ error[E0271]: type mismatch resolving `<impl Future<Output = u8> as Future>::Out LL | let _: &dyn Future<Output = ()> = █ | ^^^^^^ expected `()`, found `u8` | - = note: required for the cast to the object type `dyn Future<Output = ()>` + = note: required for the cast from `impl Future<Output = u8>` to the object type `dyn Future<Output = ()>` error[E0308]: mismatched types --> $DIR/async-block-control-flow-static-semantics.rs:47:44 diff --git a/src/test/ui/async-await/issue-86507.stderr b/src/test/ui/async-await/issue-86507.stderr index 5bbc20359c6..0e21dba980d 100644 --- a/src/test/ui/async-await/issue-86507.stderr +++ b/src/test/ui/async-await/issue-86507.stderr @@ -13,7 +13,7 @@ note: captured value is not `Send` because `&` references cannot be sent unless | LL | let x = x; | ^ has type `&T` which is not `Send`, because `T` is not `Sync` - = note: required for the cast to the object type `dyn Future<Output = ()> + Send` + = note: required for the cast from `impl Future<Output = ()>` to the object type `dyn Future<Output = ()> + Send` help: consider further restricting this bound | LL | fn bar<'me, 'async_trait, T: Send + std::marker::Sync>(x: &'me T) diff --git a/src/test/ui/async-await/issues/issue-65159.rs b/src/test/ui/async-await/issues/issue-65159.rs index df2ca025705..1dbf5db6c32 100644 --- a/src/test/ui/async-await/issues/issue-65159.rs +++ b/src/test/ui/async-await/issues/issue-65159.rs @@ -6,6 +6,7 @@ async fn copy() -> Result<()> //~^ ERROR this enum takes 2 generic arguments { Ok(()) + //~^ ERROR type annotations needed } fn main() { } diff --git a/src/test/ui/async-await/issues/issue-65159.stderr b/src/test/ui/async-await/issues/issue-65159.stderr index 45f5ec40cd7..9918f569cbc 100644 --- a/src/test/ui/async-await/issues/issue-65159.stderr +++ b/src/test/ui/async-await/issues/issue-65159.stderr @@ -16,6 +16,18 @@ help: add missing generic argument LL | async fn copy() -> Result<(), E> | +++ -error: aborting due to previous error +error[E0282]: type annotations needed + --> $DIR/issue-65159.rs:8:5 + | +LL | Ok(()) + | ^^ cannot infer type of the type parameter `E` declared on the enum `Result` + | +help: consider specifying the generic arguments + | +LL | Ok::<(), E>(()) + | +++++++++ + +error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0107`. +Some errors have detailed explanations: E0107, E0282. +For more information about an error, try `rustc --explain E0107`. diff --git a/src/test/ui/auto-traits/suspicious-impls-lint.stderr b/src/test/ui/auto-traits/suspicious-impls-lint.stderr index 03460b28dcd..97b2d7221fd 100644 --- a/src/test/ui/auto-traits/suspicious-impls-lint.stderr +++ b/src/test/ui/auto-traits/suspicious-impls-lint.stderr @@ -2,7 +2,7 @@ error: cross-crate traits with a default impl, like `Send`, should not be specia --> $DIR/suspicious-impls-lint.rs:9:1 | LL | unsafe impl<T: Send> Send for MayImplementSendErr<&T> {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: the lint level is defined here --> $DIR/suspicious-impls-lint.rs:1:9 @@ -16,13 +16,13 @@ note: try using the same sequence of generic parameters as the struct definition --> $DIR/suspicious-impls-lint.rs:8:1 | LL | struct MayImplementSendErr<T>(T); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: cross-crate traits with a default impl, like `Send`, should not be specialized --> $DIR/suspicious-impls-lint.rs:21:1 | LL | unsafe impl Send for ContainsVec<i32> {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = warning: this will change its meaning in a future release! = note: for more information, see issue #93367 <https://github.com/rust-lang/rust/issues/93367> @@ -31,13 +31,13 @@ note: try using the same sequence of generic parameters as the struct definition --> $DIR/suspicious-impls-lint.rs:20:1 | LL | struct ContainsVec<T>(Vec<T>); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^ error: cross-crate traits with a default impl, like `Send`, should not be specialized --> $DIR/suspicious-impls-lint.rs:32:1 | LL | unsafe impl<T: Send> Send for TwoParamsSame<T, T> {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = warning: this will change its meaning in a future release! = note: for more information, see issue #93367 <https://github.com/rust-lang/rust/issues/93367> @@ -46,13 +46,13 @@ note: try using the same sequence of generic parameters as the struct definition --> $DIR/suspicious-impls-lint.rs:31:1 | LL | struct TwoParamsSame<T, U>(T, U); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ error: cross-crate traits with a default impl, like `Send`, should not be specialized --> $DIR/suspicious-impls-lint.rs:40:1 | LL | unsafe impl<T> Send for WithPhantomDataSend<*const T, i8> {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = warning: this will change its meaning in a future release! = note: for more information, see issue #93367 <https://github.com/rust-lang/rust/issues/93367> @@ -61,13 +61,13 @@ note: try using the same sequence of generic parameters as the struct definition --> $DIR/suspicious-impls-lint.rs:39:1 | LL | pub struct WithPhantomDataSend<T, U>(PhantomData<T>, U); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: cross-crate traits with a default impl, like `Sync`, should not be specialized --> $DIR/suspicious-impls-lint.rs:46:1 | LL | unsafe impl<T> Sync for WithLifetime<'static, Vec<T>> {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = warning: this will change its meaning in a future release! = note: for more information, see issue #93367 <https://github.com/rust-lang/rust/issues/93367> @@ -76,7 +76,7 @@ note: try using the same sequence of generic parameters as the struct definition --> $DIR/suspicious-impls-lint.rs:44:1 | LL | pub struct WithLifetime<'a, T>(&'a (), T); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 5 previous errors diff --git a/src/test/ui/binop/binop-move-semantics.stderr b/src/test/ui/binop/binop-move-semantics.stderr index 2cd6d1abfdc..695b01d5ee3 100644 --- a/src/test/ui/binop/binop-move-semantics.stderr +++ b/src/test/ui/binop/binop-move-semantics.stderr @@ -63,8 +63,20 @@ LL | use_mut(n); use_imm(m); error[E0507]: cannot move out of `*m` which is behind a mutable reference --> $DIR/binop-move-semantics.rs:30:5 | -LL | *m - | ^^ move occurs because `*m` has type `T`, which does not implement the `Copy` trait +LL | *m + | -^ + | | + | _____move occurs because `*m` has type `T`, which does not implement the `Copy` trait + | | +LL | | + +LL | | *n; + | |______- `*m` moved due to usage in operator + | +note: calling this operator moves the left-hand side + --> $SRC_DIR/core/src/ops/arith.rs:LL:COL + | +LL | fn add(self, rhs: Rhs) -> Self::Output; + | ^^^^ error[E0507]: cannot move out of `*n` which is behind a shared reference --> $DIR/binop-move-semantics.rs:32:5 diff --git a/src/test/ui/binop/issue-28837.stderr b/src/test/ui/binop/issue-28837.stderr index 1875ea06a06..b9c7e1bea70 100644 --- a/src/test/ui/binop/issue-28837.stderr +++ b/src/test/ui/binop/issue-28837.stderr @@ -10,18 +10,12 @@ note: an implementation of `Add<_>` might be missing for `A` --> $DIR/issue-28837.rs:1:1 | LL | struct A; - | ^^^^^^^^^ must implement `Add<_>` + | ^^^^^^^^ must implement `Add<_>` note: the following trait must be implemented --> $SRC_DIR/core/src/ops/arith.rs:LL:COL | -LL | / pub trait Add<Rhs = Self> { -LL | | /// The resulting type after applying the `+` operator. -LL | | #[stable(feature = "rust1", since = "1.0.0")] -LL | | type Output; -... | -LL | | fn add(self, rhs: Rhs) -> Self::Output; -LL | | } - | |_^ +LL | pub trait Add<Rhs = Self> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0369]: cannot subtract `A` from `A` --> $DIR/issue-28837.rs:8:7 @@ -35,18 +29,12 @@ note: an implementation of `Sub<_>` might be missing for `A` --> $DIR/issue-28837.rs:1:1 | LL | struct A; - | ^^^^^^^^^ must implement `Sub<_>` + | ^^^^^^^^ must implement `Sub<_>` note: the following trait must be implemented --> $SRC_DIR/core/src/ops/arith.rs:LL:COL | -LL | / pub trait Sub<Rhs = Self> { -LL | | /// The resulting type after applying the `-` operator. -LL | | #[stable(feature = "rust1", since = "1.0.0")] -LL | | type Output; -... | -LL | | fn sub(self, rhs: Rhs) -> Self::Output; -LL | | } - | |_^ +LL | pub trait Sub<Rhs = Self> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0369]: cannot multiply `A` by `A` --> $DIR/issue-28837.rs:10:7 @@ -60,18 +48,12 @@ note: an implementation of `Mul<_>` might be missing for `A` --> $DIR/issue-28837.rs:1:1 | LL | struct A; - | ^^^^^^^^^ must implement `Mul<_>` + | ^^^^^^^^ must implement `Mul<_>` note: the following trait must be implemented --> $SRC_DIR/core/src/ops/arith.rs:LL:COL | -LL | / pub trait Mul<Rhs = Self> { -LL | | /// The resulting type after applying the `*` operator. -LL | | #[stable(feature = "rust1", since = "1.0.0")] -LL | | type Output; -... | -LL | | fn mul(self, rhs: Rhs) -> Self::Output; -LL | | } - | |_^ +LL | pub trait Mul<Rhs = Self> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0369]: cannot divide `A` by `A` --> $DIR/issue-28837.rs:12:7 @@ -85,18 +67,12 @@ note: an implementation of `Div<_>` might be missing for `A` --> $DIR/issue-28837.rs:1:1 | LL | struct A; - | ^^^^^^^^^ must implement `Div<_>` + | ^^^^^^^^ must implement `Div<_>` note: the following trait must be implemented --> $SRC_DIR/core/src/ops/arith.rs:LL:COL | -LL | / pub trait Div<Rhs = Self> { -LL | | /// The resulting type after applying the `/` operator. -LL | | #[stable(feature = "rust1", since = "1.0.0")] -LL | | type Output; -... | -LL | | fn div(self, rhs: Rhs) -> Self::Output; -LL | | } - | |_^ +LL | pub trait Div<Rhs = Self> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0369]: cannot mod `A` by `A` --> $DIR/issue-28837.rs:14:7 @@ -110,18 +86,12 @@ note: an implementation of `Rem<_>` might be missing for `A` --> $DIR/issue-28837.rs:1:1 | LL | struct A; - | ^^^^^^^^^ must implement `Rem<_>` + | ^^^^^^^^ must implement `Rem<_>` note: the following trait must be implemented --> $SRC_DIR/core/src/ops/arith.rs:LL:COL | -LL | / pub trait Rem<Rhs = Self> { -LL | | /// The resulting type after applying the `%` operator. -LL | | #[stable(feature = "rust1", since = "1.0.0")] -LL | | type Output; -... | -LL | | fn rem(self, rhs: Rhs) -> Self::Output; -LL | | } - | |_^ +LL | pub trait Rem<Rhs = Self> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0369]: no implementation for `A & A` --> $DIR/issue-28837.rs:16:7 @@ -135,18 +105,12 @@ note: an implementation of `BitAnd<_>` might be missing for `A` --> $DIR/issue-28837.rs:1:1 | LL | struct A; - | ^^^^^^^^^ must implement `BitAnd<_>` + | ^^^^^^^^ must implement `BitAnd<_>` note: the following trait must be implemented --> $SRC_DIR/core/src/ops/bit.rs:LL:COL | -LL | / pub trait BitAnd<Rhs = Self> { -LL | | /// The resulting type after applying the `&` operator. -LL | | #[stable(feature = "rust1", since = "1.0.0")] -LL | | type Output; -... | -LL | | fn bitand(self, rhs: Rhs) -> Self::Output; -LL | | } - | |_^ +LL | pub trait BitAnd<Rhs = Self> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0369]: no implementation for `A | A` --> $DIR/issue-28837.rs:18:7 @@ -160,18 +124,12 @@ note: an implementation of `BitOr<_>` might be missing for `A` --> $DIR/issue-28837.rs:1:1 | LL | struct A; - | ^^^^^^^^^ must implement `BitOr<_>` + | ^^^^^^^^ must implement `BitOr<_>` note: the following trait must be implemented --> $SRC_DIR/core/src/ops/bit.rs:LL:COL | -LL | / pub trait BitOr<Rhs = Self> { -LL | | /// The resulting type after applying the `|` operator. -LL | | #[stable(feature = "rust1", since = "1.0.0")] -LL | | type Output; -... | -LL | | fn bitor(self, rhs: Rhs) -> Self::Output; -LL | | } - | |_^ +LL | pub trait BitOr<Rhs = Self> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0369]: no implementation for `A << A` --> $DIR/issue-28837.rs:20:7 @@ -185,18 +143,12 @@ note: an implementation of `Shl<_>` might be missing for `A` --> $DIR/issue-28837.rs:1:1 | LL | struct A; - | ^^^^^^^^^ must implement `Shl<_>` + | ^^^^^^^^ must implement `Shl<_>` note: the following trait must be implemented --> $SRC_DIR/core/src/ops/bit.rs:LL:COL | -LL | / pub trait Shl<Rhs = Self> { -LL | | /// The resulting type after applying the `<<` operator. -LL | | #[stable(feature = "rust1", since = "1.0.0")] -LL | | type Output; -... | -LL | | fn shl(self, rhs: Rhs) -> Self::Output; -LL | | } - | |_^ +LL | pub trait Shl<Rhs = Self> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0369]: no implementation for `A >> A` --> $DIR/issue-28837.rs:22:7 @@ -210,18 +162,12 @@ note: an implementation of `Shr<_>` might be missing for `A` --> $DIR/issue-28837.rs:1:1 | LL | struct A; - | ^^^^^^^^^ must implement `Shr<_>` + | ^^^^^^^^ must implement `Shr<_>` note: the following trait must be implemented --> $SRC_DIR/core/src/ops/bit.rs:LL:COL | -LL | / pub trait Shr<Rhs = Self> { -LL | | /// The resulting type after applying the `>>` operator. -LL | | #[stable(feature = "rust1", since = "1.0.0")] -LL | | type Output; -... | -LL | | fn shr(self, rhs: Rhs) -> Self::Output; -LL | | } - | |_^ +LL | pub trait Shr<Rhs = Self> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0369]: binary operation `==` cannot be applied to type `A` --> $DIR/issue-28837.rs:24:7 @@ -235,7 +181,7 @@ note: an implementation of `PartialEq<_>` might be missing for `A` --> $DIR/issue-28837.rs:1:1 | LL | struct A; - | ^^^^^^^^^ must implement `PartialEq<_>` + | ^^^^^^^^ must implement `PartialEq<_>` help: consider annotating `A` with `#[derive(PartialEq)]` | LL | #[derive(PartialEq)] @@ -253,7 +199,7 @@ note: an implementation of `PartialEq<_>` might be missing for `A` --> $DIR/issue-28837.rs:1:1 | LL | struct A; - | ^^^^^^^^^ must implement `PartialEq<_>` + | ^^^^^^^^ must implement `PartialEq<_>` help: consider annotating `A` with `#[derive(PartialEq)]` | LL | #[derive(PartialEq)] @@ -271,7 +217,7 @@ note: an implementation of `PartialOrd<_>` might be missing for `A` --> $DIR/issue-28837.rs:1:1 | LL | struct A; - | ^^^^^^^^^ must implement `PartialOrd<_>` + | ^^^^^^^^ must implement `PartialOrd<_>` help: consider annotating `A` with `#[derive(PartialEq, PartialOrd)]` | LL | #[derive(PartialEq, PartialOrd)] @@ -289,7 +235,7 @@ note: an implementation of `PartialOrd<_>` might be missing for `A` --> $DIR/issue-28837.rs:1:1 | LL | struct A; - | ^^^^^^^^^ must implement `PartialOrd<_>` + | ^^^^^^^^ must implement `PartialOrd<_>` help: consider annotating `A` with `#[derive(PartialEq, PartialOrd)]` | LL | #[derive(PartialEq, PartialOrd)] @@ -307,7 +253,7 @@ note: an implementation of `PartialOrd<_>` might be missing for `A` --> $DIR/issue-28837.rs:1:1 | LL | struct A; - | ^^^^^^^^^ must implement `PartialOrd<_>` + | ^^^^^^^^ must implement `PartialOrd<_>` help: consider annotating `A` with `#[derive(PartialEq, PartialOrd)]` | LL | #[derive(PartialEq, PartialOrd)] @@ -325,7 +271,7 @@ note: an implementation of `PartialOrd<_>` might be missing for `A` --> $DIR/issue-28837.rs:1:1 | LL | struct A; - | ^^^^^^^^^ must implement `PartialOrd<_>` + | ^^^^^^^^ must implement `PartialOrd<_>` help: consider annotating `A` with `#[derive(PartialEq, PartialOrd)]` | LL | #[derive(PartialEq, PartialOrd)] diff --git a/src/test/ui/binop/issue-3820.stderr b/src/test/ui/binop/issue-3820.stderr index d5c24e1bb6c..f21f8906911 100644 --- a/src/test/ui/binop/issue-3820.stderr +++ b/src/test/ui/binop/issue-3820.stderr @@ -14,14 +14,8 @@ LL | struct Thing { note: the following trait must be implemented --> $SRC_DIR/core/src/ops/arith.rs:LL:COL | -LL | / pub trait Mul<Rhs = Self> { -LL | | /// The resulting type after applying the `*` operator. -LL | | #[stable(feature = "rust1", since = "1.0.0")] -LL | | type Output; -... | -LL | | fn mul(self, rhs: Rhs) -> Self::Output; -LL | | } - | |_^ +LL | pub trait Mul<Rhs = Self> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/blind/blind-item-block-middle.stderr b/src/test/ui/blind/blind-item-block-middle.stderr index dd83f6edf62..eb64fea9433 100644 --- a/src/test/ui/blind/blind-item-block-middle.stderr +++ b/src/test/ui/blind/blind-item-block-middle.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/blind-item-block-middle.rs:6:9 | LL | mod foo { pub struct bar; } - | --------------- unit struct defined here + | -------------- unit struct defined here ... LL | let bar = 5; | ^^^ - this expression has type `{integer}` diff --git a/src/test/ui/borrowck/borrowck-borrow-mut-base-ptr-in-aliasable-loc.stderr b/src/test/ui/borrowck/borrowck-borrow-mut-base-ptr-in-aliasable-loc.stderr index 0866f54b9fa..c99c0f77982 100644 --- a/src/test/ui/borrowck/borrowck-borrow-mut-base-ptr-in-aliasable-loc.stderr +++ b/src/test/ui/borrowck/borrowck-borrow-mut-base-ptr-in-aliasable-loc.stderr @@ -2,7 +2,7 @@ error[E0594]: cannot assign to `**t1`, which is behind a `&` reference --> $DIR/borrowck-borrow-mut-base-ptr-in-aliasable-loc.rs:9:5 | LL | let t1 = t0; - | -- help: consider changing this to be a mutable reference: `&mut &mut isize` + | -- consider changing this binding's type to be: `&mut &mut isize` LL | let p: &isize = &**t0; LL | **t1 = 22; | ^^^^^^^^^ `t1` is a `&` reference, so the data it refers to cannot be written diff --git a/src/test/ui/borrowck/issue-81365-1.stderr b/src/test/ui/borrowck/issue-81365-1.stderr index ef88d7f14a3..d79394834dc 100644 --- a/src/test/ui/borrowck/issue-81365-1.stderr +++ b/src/test/ui/borrowck/issue-81365-1.stderr @@ -13,7 +13,7 @@ note: deref defined here --> $DIR/issue-81365-1.rs:12:5 | LL | type Target = DerefTarget; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/borrowck/issue-81365-2.stderr b/src/test/ui/borrowck/issue-81365-2.stderr index e71edb50964..764eaaa7cc7 100644 --- a/src/test/ui/borrowck/issue-81365-2.stderr +++ b/src/test/ui/borrowck/issue-81365-2.stderr @@ -13,7 +13,7 @@ note: deref defined here --> $DIR/issue-81365-2.rs:12:5 | LL | type Target = DerefTarget; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/borrowck/issue-81365-3.stderr b/src/test/ui/borrowck/issue-81365-3.stderr index 70bb6bb93a9..9447174fd21 100644 --- a/src/test/ui/borrowck/issue-81365-3.stderr +++ b/src/test/ui/borrowck/issue-81365-3.stderr @@ -13,7 +13,7 @@ note: deref defined here --> $DIR/issue-81365-3.rs:23:5 | LL | type Target = Container; - | ^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/borrowck/issue-81365-4.stderr b/src/test/ui/borrowck/issue-81365-4.stderr index e714bb86d1c..0ab3fa92706 100644 --- a/src/test/ui/borrowck/issue-81365-4.stderr +++ b/src/test/ui/borrowck/issue-81365-4.stderr @@ -13,7 +13,7 @@ note: deref defined here --> $DIR/issue-81365-4.rs:24:5 | LL | type Target = Container; - | ^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/borrowck/issue-81365-5.stderr b/src/test/ui/borrowck/issue-81365-5.stderr index 8201894c6db..20ff229ffe7 100644 --- a/src/test/ui/borrowck/issue-81365-5.stderr +++ b/src/test/ui/borrowck/issue-81365-5.stderr @@ -13,7 +13,7 @@ note: deref defined here --> $DIR/issue-81365-5.rs:19:5 | LL | type Target = DerefTarget; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/borrowck/issue-81365-6.stderr b/src/test/ui/borrowck/issue-81365-6.stderr index 85ed6acca3d..575aed73b46 100644 --- a/src/test/ui/borrowck/issue-81365-6.stderr +++ b/src/test/ui/borrowck/issue-81365-6.stderr @@ -13,7 +13,7 @@ note: deref defined here --> $DIR/issue-81365-6.rs:9:5 | LL | type Target = [()]; - | ^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/borrowck/issue-81365-7.stderr b/src/test/ui/borrowck/issue-81365-7.stderr index 506732ec0c5..52d2d9e75a9 100644 --- a/src/test/ui/borrowck/issue-81365-7.stderr +++ b/src/test/ui/borrowck/issue-81365-7.stderr @@ -13,7 +13,7 @@ note: deref defined here --> $DIR/issue-81365-7.rs:12:5 | LL | type Target = DerefTarget; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/borrowck/issue-81365-8.stderr b/src/test/ui/borrowck/issue-81365-8.stderr index 716b6e9b51f..fd83e10a295 100644 --- a/src/test/ui/borrowck/issue-81365-8.stderr +++ b/src/test/ui/borrowck/issue-81365-8.stderr @@ -13,7 +13,7 @@ note: deref defined here --> $DIR/issue-81365-8.rs:12:5 | LL | type Target = DerefTarget; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/borrowck/issue-81899.stderr b/src/test/ui/borrowck/issue-81899.stderr index e7345ff3f9a..29288be4934 100644 --- a/src/test/ui/borrowck/issue-81899.stderr +++ b/src/test/ui/borrowck/issue-81899.stderr @@ -16,9 +16,7 @@ error: any use of this value will cause an error --> $DIR/issue-81899.rs:4:23 | LL | const _CONST: &[u8] = &f(&[], |_| {}); - | ----------------------^^^^^^^^^^^^^^^- - | | - | referenced constant has errors + | ------------------- ^^^^^^^^^^^^^^^ referenced constant has errors | = note: `#[deny(const_err)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -32,9 +30,7 @@ error: any use of this value will cause an error --> $DIR/issue-81899.rs:4:23 | LL | const _CONST: &[u8] = &f(&[], |_| {}); - | ----------------------^^^^^^^^^^^^^^^- - | | - | referenced constant has errors + | ------------------- ^^^^^^^^^^^^^^^ referenced constant has errors | = note: `#[deny(const_err)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! diff --git a/src/test/ui/borrowck/issue-82126-mismatched-subst-and-hir.rs b/src/test/ui/borrowck/issue-82126-mismatched-subst-and-hir.rs index dd0320bc53b..2c8a700bc2e 100644 --- a/src/test/ui/borrowck/issue-82126-mismatched-subst-and-hir.rs +++ b/src/test/ui/borrowck/issue-82126-mismatched-subst-and-hir.rs @@ -17,6 +17,7 @@ async fn buy_lock(generator: &Mutex<MarketMultiplier>) -> LockedMarket<'_> { //~^ ERROR this struct takes 0 lifetime arguments but 1 lifetime argument was supplied //~^^ ERROR this struct takes 1 generic argument but 0 generic arguments were supplied LockedMarket(generator.lock().unwrap().buy()) + //~^ ERROR cannot return value referencing temporary } struct LockedMarket<T>(T); diff --git a/src/test/ui/borrowck/issue-82126-mismatched-subst-and-hir.stderr b/src/test/ui/borrowck/issue-82126-mismatched-subst-and-hir.stderr index d2b927fb664..4bd06673043 100644 --- a/src/test/ui/borrowck/issue-82126-mismatched-subst-and-hir.stderr +++ b/src/test/ui/borrowck/issue-82126-mismatched-subst-and-hir.stderr @@ -7,7 +7,7 @@ LL | async fn buy_lock(generator: &Mutex<MarketMultiplier>) -> LockedMarket<'_> | expected 0 lifetime arguments | note: struct defined here, with 0 lifetime parameters - --> $DIR/issue-82126-mismatched-subst-and-hir.rs:22:8 + --> $DIR/issue-82126-mismatched-subst-and-hir.rs:23:8 | LL | struct LockedMarket<T>(T); | ^^^^^^^^^^^^ @@ -19,7 +19,7 @@ LL | async fn buy_lock(generator: &Mutex<MarketMultiplier>) -> LockedMarket<'_> | ^^^^^^^^^^^^ expected 1 generic argument | note: struct defined here, with 1 generic parameter: `T` - --> $DIR/issue-82126-mismatched-subst-and-hir.rs:22:8 + --> $DIR/issue-82126-mismatched-subst-and-hir.rs:23:8 | LL | struct LockedMarket<T>(T); | ^^^^^^^^^^^^ - @@ -28,6 +28,16 @@ help: add missing generic argument LL | async fn buy_lock(generator: &Mutex<MarketMultiplier>) -> LockedMarket<'_, T> { | +++ -error: aborting due to 2 previous errors +error[E0515]: cannot return value referencing temporary value + --> $DIR/issue-82126-mismatched-subst-and-hir.rs:19:5 + | +LL | LockedMarket(generator.lock().unwrap().buy()) + | ^^^^^^^^^^^^^-------------------------^^^^^^^ + | | | + | | temporary value created here + | returns a value referencing data owned by the current function + +error: aborting due to 3 previous errors -For more information about this error, try `rustc --explain E0107`. +Some errors have detailed explanations: E0107, E0515. +For more information about an error, try `rustc --explain E0107`. diff --git a/src/test/ui/borrowck/issue-85765.rs b/src/test/ui/borrowck/issue-85765.rs index 2b1ab2f7050..1598cd5d3c8 100644 --- a/src/test/ui/borrowck/issue-85765.rs +++ b/src/test/ui/borrowck/issue-85765.rs @@ -1,7 +1,7 @@ fn main() { let mut test = Vec::new(); let rofl: &Vec<Vec<i32>> = &mut test; - //~^ HELP consider changing this to be a mutable reference + //~^ NOTE consider changing this binding's type to be rofl.push(Vec::new()); //~^ ERROR cannot borrow `*rofl` as mutable, as it is behind a `&` reference //~| NOTE `rofl` is a `&` reference, so the data it refers to cannot be borrowed as mutable @@ -15,14 +15,14 @@ fn main() { #[rustfmt::skip] let x: &usize = &mut{0}; - //~^ HELP consider changing this to be a mutable reference + //~^ NOTE consider changing this binding's type to be *x = 1; //~^ ERROR cannot assign to `*x`, which is behind a `&` reference //~| NOTE `x` is a `&` reference, so the data it refers to cannot be written #[rustfmt::skip] let y: &usize = &mut(0); - //~^ HELP consider changing this to be a mutable reference + //~^ NOTE consider changing this binding's type to be *y = 1; //~^ ERROR cannot assign to `*y`, which is behind a `&` reference //~| NOTE `y` is a `&` reference, so the data it refers to cannot be written diff --git a/src/test/ui/borrowck/issue-85765.stderr b/src/test/ui/borrowck/issue-85765.stderr index 80acaa7d21c..13033962142 100644 --- a/src/test/ui/borrowck/issue-85765.stderr +++ b/src/test/ui/borrowck/issue-85765.stderr @@ -2,7 +2,7 @@ error[E0596]: cannot borrow `*rofl` as mutable, as it is behind a `&` reference --> $DIR/issue-85765.rs:5:5 | LL | let rofl: &Vec<Vec<i32>> = &mut test; - | ---- help: consider changing this to be a mutable reference: `&mut Vec<Vec<i32>>` + | ---- consider changing this binding's type to be: `&mut Vec<Vec<i32>>` LL | LL | rofl.push(Vec::new()); | ^^^^^^^^^^^^^^^^^^^^^ `rofl` is a `&` reference, so the data it refers to cannot be borrowed as mutable @@ -20,7 +20,7 @@ error[E0594]: cannot assign to `*x`, which is behind a `&` reference --> $DIR/issue-85765.rs:19:5 | LL | let x: &usize = &mut{0}; - | - help: consider changing this to be a mutable reference: `&mut usize` + | - consider changing this binding's type to be: `&mut usize` LL | LL | *x = 1; | ^^^^^^ `x` is a `&` reference, so the data it refers to cannot be written @@ -29,7 +29,7 @@ error[E0594]: cannot assign to `*y`, which is behind a `&` reference --> $DIR/issue-85765.rs:26:5 | LL | let y: &usize = &mut(0); - | - help: consider changing this to be a mutable reference: `&mut usize` + | - consider changing this binding's type to be: `&mut usize` LL | LL | *y = 1; | ^^^^^^ `y` is a `&` reference, so the data it refers to cannot be written diff --git a/src/test/ui/borrowck/issue-88434-minimal-example.stderr b/src/test/ui/borrowck/issue-88434-minimal-example.stderr index 47d83c65355..daded200bd9 100644 --- a/src/test/ui/borrowck/issue-88434-minimal-example.stderr +++ b/src/test/ui/borrowck/issue-88434-minimal-example.stderr @@ -16,9 +16,7 @@ error: any use of this value will cause an error --> $DIR/issue-88434-minimal-example.rs:3:21 | LL | const _CONST: &() = &f(&|_| {}); - | --------------------^^^^^^^^^^^- - | | - | referenced constant has errors + | ----------------- ^^^^^^^^^^^ referenced constant has errors | = note: `#[deny(const_err)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -32,9 +30,7 @@ error: any use of this value will cause an error --> $DIR/issue-88434-minimal-example.rs:3:21 | LL | const _CONST: &() = &f(&|_| {}); - | --------------------^^^^^^^^^^^- - | | - | referenced constant has errors + | ----------------- ^^^^^^^^^^^ referenced constant has errors | = note: `#[deny(const_err)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! diff --git a/src/test/ui/borrowck/issue-88434-removal-index-should-be-less.stderr b/src/test/ui/borrowck/issue-88434-removal-index-should-be-less.stderr index b08a7cfc7fe..ce6a37ee418 100644 --- a/src/test/ui/borrowck/issue-88434-removal-index-should-be-less.stderr +++ b/src/test/ui/borrowck/issue-88434-removal-index-should-be-less.stderr @@ -16,9 +16,7 @@ error: any use of this value will cause an error --> $DIR/issue-88434-removal-index-should-be-less.rs:3:23 | LL | const _CONST: &[u8] = &f(&[], |_| {}); - | ----------------------^^^^^^^^^^^^^^^- - | | - | referenced constant has errors + | ------------------- ^^^^^^^^^^^^^^^ referenced constant has errors | = note: `#[deny(const_err)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -32,9 +30,7 @@ error: any use of this value will cause an error --> $DIR/issue-88434-removal-index-should-be-less.rs:3:23 | LL | const _CONST: &[u8] = &f(&[], |_| {}); - | ----------------------^^^^^^^^^^^^^^^- - | | - | referenced constant has errors + | ------------------- ^^^^^^^^^^^^^^^ referenced constant has errors | = note: `#[deny(const_err)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! diff --git a/src/test/ui/borrowck/issue-91206.rs b/src/test/ui/borrowck/issue-91206.rs index 3b1fbf4b699..67407c1eae3 100644 --- a/src/test/ui/borrowck/issue-91206.rs +++ b/src/test/ui/borrowck/issue-91206.rs @@ -9,7 +9,8 @@ impl TestClient { fn main() { let client = TestClient; let inner = client.get_inner_ref(); - //~^ HELP consider changing this to be a mutable reference + //~^ NOTE consider changing this binding's type to be inner.clear(); //~^ ERROR cannot borrow `*inner` as mutable, as it is behind a `&` reference [E0596] + //~| NOTE `inner` is a `&` reference, so the data it refers to cannot be borrowed as mutable } diff --git a/src/test/ui/borrowck/issue-91206.stderr b/src/test/ui/borrowck/issue-91206.stderr index 535d247452a..12d8d27c5f0 100644 --- a/src/test/ui/borrowck/issue-91206.stderr +++ b/src/test/ui/borrowck/issue-91206.stderr @@ -2,7 +2,7 @@ error[E0596]: cannot borrow `*inner` as mutable, as it is behind a `&` reference --> $DIR/issue-91206.rs:13:5 | LL | let inner = client.get_inner_ref(); - | ----- help: consider changing this to be a mutable reference: `&mut Vec<usize>` + | ----- consider changing this binding's type to be: `&mut Vec<usize>` LL | LL | inner.clear(); | ^^^^^^^^^^^^^ `inner` is a `&` reference, so the data it refers to cannot be borrowed as mutable diff --git a/src/test/ui/borrowck/issue-92015.stderr b/src/test/ui/borrowck/issue-92015.stderr index 32a65d3b5bb..62b1183e71b 100644 --- a/src/test/ui/borrowck/issue-92015.stderr +++ b/src/test/ui/borrowck/issue-92015.stderr @@ -2,7 +2,7 @@ error[E0594]: cannot assign to `*foo`, which is behind a `&` reference --> $DIR/issue-92015.rs:6:5 | LL | let foo = Some(&0).unwrap(); - | --- help: consider changing this to be a mutable reference: `&mut i32` + | --- consider changing this binding's type to be: `&mut i32` LL | *foo = 1; | ^^^^^^^^ `foo` is a `&` reference, so the data it refers to cannot be written diff --git a/src/test/ui/borrowck/suggest-as-ref-on-mut-closure.rs b/src/test/ui/borrowck/suggest-as-ref-on-mut-closure.rs new file mode 100644 index 00000000000..1dcf0461879 --- /dev/null +++ b/src/test/ui/borrowck/suggest-as-ref-on-mut-closure.rs @@ -0,0 +1,16 @@ +// This is not exactly right, yet. + +// Ideally we should be suggesting `as_mut` for the first case, +// and suggesting to change `as_ref` to `as_mut` in the second. + +fn x(cb: &mut Option<&mut dyn FnMut()>) { + cb.map(|cb| cb()); + //~^ ERROR cannot move out of `*cb` which is behind a mutable reference +} + +fn x2(cb: &mut Option<&mut dyn FnMut()>) { + cb.as_ref().map(|cb| cb()); + //~^ ERROR cannot borrow `*cb` as mutable, as it is behind a `&` reference +} + +fn main() {} diff --git a/src/test/ui/borrowck/suggest-as-ref-on-mut-closure.stderr b/src/test/ui/borrowck/suggest-as-ref-on-mut-closure.stderr new file mode 100644 index 00000000000..af26169c806 --- /dev/null +++ b/src/test/ui/borrowck/suggest-as-ref-on-mut-closure.stderr @@ -0,0 +1,31 @@ +error[E0507]: cannot move out of `*cb` which is behind a mutable reference + --> $DIR/suggest-as-ref-on-mut-closure.rs:7:5 + | +LL | cb.map(|cb| cb()); + | ^^^-------------- + | | | + | | `*cb` moved due to this method call + | move occurs because `*cb` has type `Option<&mut dyn FnMut()>`, which does not implement the `Copy` trait + | +note: this function takes ownership of the receiver `self`, which moves `*cb` + --> $SRC_DIR/core/src/option.rs:LL:COL + | +LL | pub const fn map<U, F>(self, f: F) -> Option<U> + | ^^^^ +help: consider calling `.as_ref()` to borrow the type's contents + | +LL | cb.as_ref().map(|cb| cb()); + | +++++++++ + +error[E0596]: cannot borrow `*cb` as mutable, as it is behind a `&` reference + --> $DIR/suggest-as-ref-on-mut-closure.rs:12:26 + | +LL | cb.as_ref().map(|cb| cb()); + | -- ^^ `cb` is a `&` reference, so the data it refers to cannot be borrowed as mutable + | | + | consider changing this binding's type to be: `&mut &mut dyn FnMut()` + +error: aborting due to 2 previous errors + +Some errors have detailed explanations: E0507, E0596. +For more information about an error, try `rustc --explain E0507`. diff --git a/src/test/ui/cast/issue-85586.stderr b/src/test/ui/cast/issue-85586.stderr index 271885a133a..ed8a6fc62e9 100644 --- a/src/test/ui/cast/issue-85586.stderr +++ b/src/test/ui/cast/issue-85586.stderr @@ -3,8 +3,6 @@ error[E0282]: type annotations needed | LL | let b = (a + 1) as usize; | ^^^^^^^ cannot infer type - | - = note: type must be known at this point error: aborting due to previous error diff --git a/src/test/ui/chalkify/bugs/async.rs b/src/test/ui/chalkify/bugs/async.rs index 58fc93064ed..ae5224dbd6f 100644 --- a/src/test/ui/chalkify/bugs/async.rs +++ b/src/test/ui/chalkify/bugs/async.rs @@ -1,5 +1,5 @@ // check-fail -// known-bug +// known-bug: unknown // compile-flags: -Z chalk --edition=2021 fn main() -> () {} diff --git a/src/test/ui/chalkify/bugs/async.stderr b/src/test/ui/chalkify/bugs/async.stderr index 5b7ca8d46cf..f53ed53f73c 100644 --- a/src/test/ui/chalkify/bugs/async.stderr +++ b/src/test/ui/chalkify/bugs/async.stderr @@ -29,13 +29,10 @@ LL | T: Generator<ResumeTy, Yield = ()>, | ^^^^^^^^^^ required by this bound in `std::future::from_generator` error[E0280]: the requirement `<impl Future<Output = u32> as Future>::Output == u32` is not satisfied - --> $DIR/async.rs:7:29 + --> $DIR/async.rs:7:25 | -LL | async fn foo(x: u32) -> u32 { - | _____________________________^ -LL | | x -LL | | } - | |_^ +LL | async fn foo(x: u32) -> u32 { + | ^^^ error: aborting due to 3 previous errors diff --git a/src/test/ui/closures/2229_closure_analysis/issue-87987.stderr b/src/test/ui/closures/2229_closure_analysis/issue-87987.stderr index 57b8f7ae609..5696a010c3f 100644 --- a/src/test/ui/closures/2229_closure_analysis/issue-87987.stderr +++ b/src/test/ui/closures/2229_closure_analysis/issue-87987.stderr @@ -4,9 +4,9 @@ warning: fields `field_1` and `field_2` are never read LL | struct Props { | ----- fields in this struct LL | field_1: u32, - | ^^^^^^^^^^^^ + | ^^^^^^^ LL | field_2: u32, - | ^^^^^^^^^^^^ + | ^^^^^^^ | = note: `#[warn(dead_code)]` on by default diff --git a/src/test/ui/closures/2229_closure_analysis/match/non-exhaustive-match.stderr b/src/test/ui/closures/2229_closure_analysis/match/non-exhaustive-match.stderr index 32d36274ff6..e0678bc718f 100644 --- a/src/test/ui/closures/2229_closure_analysis/match/non-exhaustive-match.stderr +++ b/src/test/ui/closures/2229_closure_analysis/match/non-exhaustive-match.stderr @@ -25,7 +25,7 @@ note: `E1` defined here --> $DIR/auxiliary/match_non_exhaustive_lib.rs:2:1 | LL | pub enum E1 {} - | ^^^^^^^^^^^^^^ + | ^^^^^^^^^^^ = note: the matched value is of type `E1`, which is marked as non-exhaustive help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown | @@ -44,7 +44,7 @@ note: `E2` defined here --> $DIR/auxiliary/match_non_exhaustive_lib.rs:5:1 | LL | pub enum E2 { A, B } - | ^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^ = note: the matched value is of type `E2`, which is marked as non-exhaustive help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | diff --git a/src/test/ui/coercion/coerce-issue-49593-box-never-windows.nofallback.stderr b/src/test/ui/coercion/coerce-issue-49593-box-never-windows.nofallback.stderr index 3350d1efb53..980da536034 100644 --- a/src/test/ui/coercion/coerce-issue-49593-box-never-windows.nofallback.stderr +++ b/src/test/ui/coercion/coerce-issue-49593-box-never-windows.nofallback.stderr @@ -4,7 +4,7 @@ error[E0277]: the trait bound `(): std::error::Error` is not satisfied LL | /* *mut $0 is coerced to Box<dyn Error> here */ Box::<_ /* ! */>::new(x) | ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::error::Error` is not implemented for `()` | - = note: required for the cast to the object type `dyn std::error::Error` + = note: required for the cast from `()` to the object type `dyn std::error::Error` error[E0277]: the trait bound `(): std::error::Error` is not satisfied --> $DIR/coerce-issue-49593-box-never-windows.rs:23:49 @@ -12,7 +12,7 @@ error[E0277]: the trait bound `(): std::error::Error` is not satisfied LL | /* *mut $0 is coerced to *mut Error here */ raw_ptr_box::<_ /* ! */>(x) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::error::Error` is not implemented for `()` | - = note: required for the cast to the object type `(dyn std::error::Error + 'static)` + = note: required for the cast from `()` to the object type `(dyn std::error::Error + 'static)` error: aborting due to 2 previous errors diff --git a/src/test/ui/coercion/coerce-issue-49593-box-never.nofallback.stderr b/src/test/ui/coercion/coerce-issue-49593-box-never.nofallback.stderr index fcd2d7f78ff..322681b97bc 100644 --- a/src/test/ui/coercion/coerce-issue-49593-box-never.nofallback.stderr +++ b/src/test/ui/coercion/coerce-issue-49593-box-never.nofallback.stderr @@ -4,7 +4,7 @@ error[E0277]: the trait bound `(): std::error::Error` is not satisfied LL | /* *mut $0 is coerced to Box<dyn Error> here */ Box::<_ /* ! */>::new(x) | ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::error::Error` is not implemented for `()` | - = note: required for the cast to the object type `dyn std::error::Error` + = note: required for the cast from `()` to the object type `dyn std::error::Error` error[E0277]: the trait bound `(): std::error::Error` is not satisfied --> $DIR/coerce-issue-49593-box-never.rs:23:49 @@ -12,7 +12,7 @@ error[E0277]: the trait bound `(): std::error::Error` is not satisfied LL | /* *mut $0 is coerced to *mut Error here */ raw_ptr_box::<_ /* ! */>(x) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::error::Error` is not implemented for `()` | - = note: required for the cast to the object type `(dyn std::error::Error + 'static)` + = note: required for the cast from `()` to the object type `(dyn std::error::Error + 'static)` error: aborting due to 2 previous errors diff --git a/src/test/ui/coherence/coherence-impl-trait-for-marker-trait-negative.stderr b/src/test/ui/coherence/coherence-impl-trait-for-marker-trait-negative.stderr index 91289148079..c364c707ff9 100644 --- a/src/test/ui/coherence/coherence-impl-trait-for-marker-trait-negative.stderr +++ b/src/test/ui/coherence/coherence-impl-trait-for-marker-trait-negative.stderr @@ -1,3 +1,15 @@ +error[E0371]: the object type `(dyn Object + Marker2 + 'static)` automatically implements the trait `Marker1` + --> $DIR/coherence-impl-trait-for-marker-trait-negative.rs:15:1 + | +LL | impl !Marker1 for dyn Object + Marker2 { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `(dyn Object + Marker2 + 'static)` automatically implements trait `Marker1` + +error[E0371]: the object type `(dyn Object + Marker2 + 'static)` automatically implements the trait `Marker2` + --> $DIR/coherence-impl-trait-for-marker-trait-negative.rs:17:1 + | +LL | impl !Marker2 for dyn Object + Marker2 { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `(dyn Object + Marker2 + 'static)` automatically implements trait `Marker2` + error[E0117]: only traits defined in the current crate can be implemented for arbitrary types --> $DIR/coherence-impl-trait-for-marker-trait-negative.rs:23:1 | @@ -21,18 +33,6 @@ error[E0321]: cross-crate traits with a default impl, like `Send`, can only be i LL | impl !Send for dyn Object + Marker2 {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't implement cross-crate trait with a default impl for non-struct/enum type -error[E0371]: the object type `(dyn Object + Marker2 + 'static)` automatically implements the trait `Marker1` - --> $DIR/coherence-impl-trait-for-marker-trait-negative.rs:15:1 - | -LL | impl !Marker1 for dyn Object + Marker2 { } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `(dyn Object + Marker2 + 'static)` automatically implements trait `Marker1` - -error[E0371]: the object type `(dyn Object + Marker2 + 'static)` automatically implements the trait `Marker2` - --> $DIR/coherence-impl-trait-for-marker-trait-negative.rs:17:1 - | -LL | impl !Marker2 for dyn Object + Marker2 { } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `(dyn Object + Marker2 + 'static)` automatically implements trait `Marker2` - error: aborting due to 5 previous errors Some errors have detailed explanations: E0117, E0321, E0371. diff --git a/src/test/ui/coherence/coherence-impl-trait-for-marker-trait-positive.stderr b/src/test/ui/coherence/coherence-impl-trait-for-marker-trait-positive.stderr index 056198374a4..b80429794f9 100644 --- a/src/test/ui/coherence/coherence-impl-trait-for-marker-trait-positive.stderr +++ b/src/test/ui/coherence/coherence-impl-trait-for-marker-trait-positive.stderr @@ -1,3 +1,15 @@ +error[E0371]: the object type `(dyn Object + Marker2 + 'static)` automatically implements the trait `Marker1` + --> $DIR/coherence-impl-trait-for-marker-trait-positive.rs:15:1 + | +LL | impl Marker1 for dyn Object + Marker2 { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `(dyn Object + Marker2 + 'static)` automatically implements trait `Marker1` + +error[E0371]: the object type `(dyn Object + Marker2 + 'static)` automatically implements the trait `Marker2` + --> $DIR/coherence-impl-trait-for-marker-trait-positive.rs:17:1 + | +LL | impl Marker2 for dyn Object + Marker2 { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `(dyn Object + Marker2 + 'static)` automatically implements trait `Marker2` + error[E0117]: only traits defined in the current crate can be implemented for arbitrary types --> $DIR/coherence-impl-trait-for-marker-trait-positive.rs:23:1 | @@ -21,18 +33,6 @@ error[E0321]: cross-crate traits with a default impl, like `Send`, can only be i LL | unsafe impl Send for dyn Object + Marker2 {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't implement cross-crate trait with a default impl for non-struct/enum type -error[E0371]: the object type `(dyn Object + Marker2 + 'static)` automatically implements the trait `Marker1` - --> $DIR/coherence-impl-trait-for-marker-trait-positive.rs:15:1 - | -LL | impl Marker1 for dyn Object + Marker2 { } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `(dyn Object + Marker2 + 'static)` automatically implements trait `Marker1` - -error[E0371]: the object type `(dyn Object + Marker2 + 'static)` automatically implements the trait `Marker2` - --> $DIR/coherence-impl-trait-for-marker-trait-positive.rs:17:1 - | -LL | impl Marker2 for dyn Object + Marker2 { } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `(dyn Object + Marker2 + 'static)` automatically implements trait `Marker2` - error: aborting due to 5 previous errors Some errors have detailed explanations: E0117, E0321, E0371. diff --git a/src/test/ui/coherence/coherence-impls-copy.stderr b/src/test/ui/coherence/coherence-impls-copy.stderr index b3ca354c633..86356af2564 100644 --- a/src/test/ui/coherence/coherence-impls-copy.stderr +++ b/src/test/ui/coherence/coherence-impls-copy.stderr @@ -9,49 +9,49 @@ LL | impl Copy for i32 {} | = note: define and implement a trait or new type instead +error[E0119]: conflicting implementations of trait `std::marker::Copy` for type `&NotSync` + --> $DIR/coherence-impls-copy.rs:28:1 + | +LL | impl Copy for &'static NotSync {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: conflicting implementation in crate `core`: + - impl<T> Copy for &T + where T: ?Sized; + error[E0117]: only traits defined in the current crate can be implemented for arbitrary types - --> $DIR/coherence-impls-copy.rs:25:1 + --> $DIR/coherence-impls-copy.rs:33:1 | -LL | impl Copy for (MyType, MyType) {} - | ^^^^^^^^^^^^^^---------------- +LL | impl Copy for &'static [NotSync] {} + | ^^^^^^^^^^^^^^------------------ | | | - | | this is not defined in the current crate because tuples are always foreign + | | this is not defined in the current crate because slices are always foreign | impl doesn't use only types from inside the current crate | = note: define and implement a trait or new type instead error[E0117]: only traits defined in the current crate can be implemented for arbitrary types - --> $DIR/coherence-impls-copy.rs:30:1 + --> $DIR/coherence-impls-copy.rs:25:1 | -LL | impl Copy for [MyType] {} - | ^^^^^^^^^^^^^^-------- +LL | impl Copy for (MyType, MyType) {} + | ^^^^^^^^^^^^^^---------------- | | | - | | this is not defined in the current crate because slices are always foreign + | | this is not defined in the current crate because tuples are always foreign | impl doesn't use only types from inside the current crate | = note: define and implement a trait or new type instead error[E0117]: only traits defined in the current crate can be implemented for arbitrary types - --> $DIR/coherence-impls-copy.rs:33:1 + --> $DIR/coherence-impls-copy.rs:30:1 | -LL | impl Copy for &'static [NotSync] {} - | ^^^^^^^^^^^^^^------------------ +LL | impl Copy for [MyType] {} + | ^^^^^^^^^^^^^^-------- | | | | | this is not defined in the current crate because slices are always foreign | impl doesn't use only types from inside the current crate | = note: define and implement a trait or new type instead -error[E0119]: conflicting implementations of trait `std::marker::Copy` for type `&NotSync` - --> $DIR/coherence-impls-copy.rs:28:1 - | -LL | impl Copy for &'static NotSync {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: conflicting implementation in crate `core`: - - impl<T> Copy for &T - where T: ?Sized; - error[E0206]: the trait `Copy` may not be implemented for this type --> $DIR/coherence-impls-copy.rs:21:15 | diff --git a/src/test/ui/coherence/coherence-impls-send.stderr b/src/test/ui/coherence/coherence-impls-send.stderr index dd1fd1b0dce..e1071846e14 100644 --- a/src/test/ui/coherence/coherence-impls-send.stderr +++ b/src/test/ui/coherence/coherence-impls-send.stderr @@ -1,4 +1,15 @@ error[E0117]: only traits defined in the current crate can be implemented for arbitrary types + --> $DIR/coherence-impls-send.rs:25:1 + | +LL | unsafe impl Send for &'static [NotSync] {} + | ^^^^^^^^^^^^^^^^^^^^^------------------ + | | | + | | this is not defined in the current crate because slices are always foreign + | impl doesn't use only types from inside the current crate + | + = note: define and implement a trait or new type instead + +error[E0117]: only traits defined in the current crate can be implemented for arbitrary types --> $DIR/coherence-impls-send.rs:16:1 | LL | unsafe impl Send for (MyType, MyType) {} @@ -26,17 +37,6 @@ LL | unsafe impl Send for [MyType] {} | = note: define and implement a trait or new type instead -error[E0117]: only traits defined in the current crate can be implemented for arbitrary types - --> $DIR/coherence-impls-send.rs:25:1 - | -LL | unsafe impl Send for &'static [NotSync] {} - | ^^^^^^^^^^^^^^^^^^^^^------------------ - | | | - | | this is not defined in the current crate because slices are always foreign - | impl doesn't use only types from inside the current crate - | - = note: define and implement a trait or new type instead - error: aborting due to 4 previous errors Some errors have detailed explanations: E0117, E0321. diff --git a/src/test/ui/coherence/coherence-impls-sized.stderr b/src/test/ui/coherence/coherence-impls-sized.stderr index e1e4acd4cd8..17a7544521d 100644 --- a/src/test/ui/coherence/coherence-impls-sized.stderr +++ b/src/test/ui/coherence/coherence-impls-sized.stderr @@ -1,36 +1,3 @@ -error[E0117]: only traits defined in the current crate can be implemented for arbitrary types - --> $DIR/coherence-impls-sized.rs:20:1 - | -LL | impl Sized for (MyType, MyType) {} - | ^^^^^^^^^^^^^^^---------------- - | | | - | | this is not defined in the current crate because tuples are always foreign - | impl doesn't use only types from inside the current crate - | - = note: define and implement a trait or new type instead - -error[E0117]: only traits defined in the current crate can be implemented for arbitrary types - --> $DIR/coherence-impls-sized.rs:27:1 - | -LL | impl Sized for [MyType] {} - | ^^^^^^^^^^^^^^^-------- - | | | - | | this is not defined in the current crate because slices are always foreign - | impl doesn't use only types from inside the current crate - | - = note: define and implement a trait or new type instead - -error[E0117]: only traits defined in the current crate can be implemented for arbitrary types - --> $DIR/coherence-impls-sized.rs:31:1 - | -LL | impl Sized for &'static [NotSync] {} - | ^^^^^^^^^^^^^^^------------------ - | | | - | | this is not defined in the current crate because slices are always foreign - | impl doesn't use only types from inside the current crate - | - = note: define and implement a trait or new type instead - error[E0322]: explicit impls for the `Sized` trait are not permitted --> $DIR/coherence-impls-sized.rs:14:1 | @@ -49,6 +16,17 @@ error[E0322]: explicit impls for the `Sized` trait are not permitted LL | impl Sized for (MyType, MyType) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl of `Sized` not allowed +error[E0117]: only traits defined in the current crate can be implemented for arbitrary types + --> $DIR/coherence-impls-sized.rs:20:1 + | +LL | impl Sized for (MyType, MyType) {} + | ^^^^^^^^^^^^^^^---------------- + | | | + | | this is not defined in the current crate because tuples are always foreign + | impl doesn't use only types from inside the current crate + | + = note: define and implement a trait or new type instead + error[E0322]: explicit impls for the `Sized` trait are not permitted --> $DIR/coherence-impls-sized.rs:24:1 | @@ -61,12 +39,34 @@ error[E0322]: explicit impls for the `Sized` trait are not permitted LL | impl Sized for [MyType] {} | ^^^^^^^^^^^^^^^^^^^^^^^ impl of `Sized` not allowed +error[E0117]: only traits defined in the current crate can be implemented for arbitrary types + --> $DIR/coherence-impls-sized.rs:27:1 + | +LL | impl Sized for [MyType] {} + | ^^^^^^^^^^^^^^^-------- + | | | + | | this is not defined in the current crate because slices are always foreign + | impl doesn't use only types from inside the current crate + | + = note: define and implement a trait or new type instead + error[E0322]: explicit impls for the `Sized` trait are not permitted --> $DIR/coherence-impls-sized.rs:31:1 | LL | impl Sized for &'static [NotSync] {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl of `Sized` not allowed +error[E0117]: only traits defined in the current crate can be implemented for arbitrary types + --> $DIR/coherence-impls-sized.rs:31:1 + | +LL | impl Sized for &'static [NotSync] {} + | ^^^^^^^^^^^^^^^------------------ + | | | + | | this is not defined in the current crate because slices are always foreign + | impl doesn't use only types from inside the current crate + | + = note: define and implement a trait or new type instead + error: aborting due to 9 previous errors Some errors have detailed explanations: E0117, E0322. diff --git a/src/test/ui/coherence/coherence-overlap-downstream.stderr b/src/test/ui/coherence/coherence-overlap-downstream.stderr index 9ab099489d9..7f373e595a3 100644 --- a/src/test/ui/coherence/coherence-overlap-downstream.stderr +++ b/src/test/ui/coherence/coherence-overlap-downstream.stderr @@ -10,7 +10,7 @@ error[E0119]: conflicting implementations of trait `Foo<_>` for type `i32` --> $DIR/coherence-overlap-downstream.rs:14:1 | LL | impl<X, T> Foo<X> for T where T: Bar<X> {} - | --------------------------------------- first implementation here + | ----------------------- first implementation here LL | impl<X> Foo<X> for i32 {} | ^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `i32` | diff --git a/src/test/ui/coherence/coherence-overlap-trait-alias.stderr b/src/test/ui/coherence/coherence-overlap-trait-alias.stderr index 421c86ee51a..e324c1e799f 100644 --- a/src/test/ui/coherence/coherence-overlap-trait-alias.stderr +++ b/src/test/ui/coherence/coherence-overlap-trait-alias.stderr @@ -1,8 +1,8 @@ -error[E0283]: type annotations needed +error[E0283]: type annotations needed: cannot satisfy `u32: C` --> $DIR/coherence-overlap-trait-alias.rs:15:6 | LL | impl C for u32 {} - | ^ cannot infer type for type `u32` + | ^ | note: multiple `impl`s satisfying `u32: C` found --> $DIR/coherence-overlap-trait-alias.rs:14:1 diff --git a/src/test/ui/coherence/coherence-overlap-upstream.stderr b/src/test/ui/coherence/coherence-overlap-upstream.stderr index 8272c887586..f6145c1883a 100644 --- a/src/test/ui/coherence/coherence-overlap-upstream.stderr +++ b/src/test/ui/coherence/coherence-overlap-upstream.stderr @@ -2,7 +2,7 @@ error[E0119]: conflicting implementations of trait `Foo` for type `i16` --> $DIR/coherence-overlap-upstream.rs:13:1 | LL | impl<T> Foo for T where T: Remote {} - | --------------------------------- first implementation here + | ----------------- first implementation here LL | impl Foo for i16 {} | ^^^^^^^^^^^^^^^^ conflicting implementation for `i16` | diff --git a/src/test/ui/coherence/coherence-wasm-bindgen.stderr b/src/test/ui/coherence/coherence-wasm-bindgen.stderr index 432646e5321..aa74e231539 100644 --- a/src/test/ui/coherence/coherence-wasm-bindgen.stderr +++ b/src/test/ui/coherence/coherence-wasm-bindgen.stderr @@ -1,22 +1,11 @@ error: conflicting implementations of trait `IntoWasmAbi` for type `&dyn std::ops::Fn(&_) -> _` --> $DIR/coherence-wasm-bindgen.rs:28:1 | -LL | / impl<'a, 'b, A, R> IntoWasmAbi for &'a (dyn Fn(A) -> R + 'b) -LL | | where -LL | | A: FromWasmAbi, -LL | | R: ReturnWasmAbi, -LL | | { -LL | | } - | |_- first implementation here +LL | impl<'a, 'b, A, R> IntoWasmAbi for &'a (dyn Fn(A) -> R + 'b) + | ------------------------------------------------------------ first implementation here ... -LL | / impl<'a, 'b, A, R> IntoWasmAbi for &'a (dyn for<'x> Fn(&'x A) -> R + 'b) -LL | | where -LL | | A: RefFromWasmAbi, -LL | | R: ReturnWasmAbi, -... | -LL | | -LL | | } - | |_^ conflicting implementation for `&dyn std::ops::Fn(&_) -> _` +LL | impl<'a, 'b, A, R> IntoWasmAbi for &'a (dyn for<'x> Fn(&'x A) -> R + 'b) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `&dyn std::ops::Fn(&_) -> _` | note: the lint level is defined here --> $DIR/coherence-wasm-bindgen.rs:10:9 diff --git a/src/test/ui/coherence/coherence-with-closure.stderr b/src/test/ui/coherence/coherence-with-closure.stderr index 20b986cee69..d2ca63fa146 100644 --- a/src/test/ui/coherence/coherence-with-closure.stderr +++ b/src/test/ui/coherence/coherence-with-closure.stderr @@ -1,3 +1,12 @@ +error[E0119]: conflicting implementations of trait `Trait` for type `Wrapper<OpaqueClosure>` + --> $DIR/coherence-with-closure.rs:12:1 + | +LL | impl Trait for Wrapper<OpaqueClosure> {} + | ------------------------------------- first implementation here +LL | +LL | impl<T: Sync> Trait for Wrapper<T> {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `Wrapper<OpaqueClosure>` + error: cannot implement trait on type alias impl trait --> $DIR/coherence-with-closure.rs:10:24 | @@ -10,15 +19,6 @@ note: type alias impl trait defined here LL | type OpaqueClosure = impl Sized; | ^^^^^^^^^^ -error[E0119]: conflicting implementations of trait `Trait` for type `Wrapper<OpaqueClosure>` - --> $DIR/coherence-with-closure.rs:12:1 - | -LL | impl Trait for Wrapper<OpaqueClosure> {} - | ------------------------------------- first implementation here -LL | -LL | impl<T: Sync> Trait for Wrapper<T> {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `Wrapper<OpaqueClosure>` - error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/coherence/coherence-with-generator.stderr b/src/test/ui/coherence/coherence-with-generator.stderr index 249ad3cb9ec..804bc1c3a6d 100644 --- a/src/test/ui/coherence/coherence-with-generator.stderr +++ b/src/test/ui/coherence/coherence-with-generator.stderr @@ -1,3 +1,12 @@ +error[E0119]: conflicting implementations of trait `Trait` for type `Wrapper<OpaqueGenerator>` + --> $DIR/coherence-with-generator.rs:16:1 + | +LL | impl Trait for Wrapper<OpaqueGenerator> {} + | --------------------------------------- first implementation here +LL | +LL | impl<T: Sync> Trait for Wrapper<T> {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `Wrapper<OpaqueGenerator>` + error: cannot implement trait on type alias impl trait --> $DIR/coherence-with-generator.rs:14:24 | @@ -10,15 +19,6 @@ note: type alias impl trait defined here LL | type OpaqueGenerator = impl Sized; | ^^^^^^^^^^ -error[E0119]: conflicting implementations of trait `Trait` for type `Wrapper<OpaqueGenerator>` - --> $DIR/coherence-with-generator.rs:16:1 - | -LL | impl Trait for Wrapper<OpaqueGenerator> {} - | --------------------------------------- first implementation here -LL | -LL | impl<T: Sync> Trait for Wrapper<T> {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `Wrapper<OpaqueGenerator>` - error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/conflicting-repr-hints.stderr b/src/test/ui/conflicting-repr-hints.stderr index 0f32fc0481b..0c7c50d6730 100644 --- a/src/test/ui/conflicting-repr-hints.stderr +++ b/src/test/ui/conflicting-repr-hints.stderr @@ -21,72 +21,61 @@ error[E0587]: type has conflicting packed and align representation hints --> $DIR/conflicting-repr-hints.rs:29:1 | LL | struct F(i32); - | ^^^^^^^^^^^^^^ + | ^^^^^^^^ error[E0587]: type has conflicting packed and align representation hints --> $DIR/conflicting-repr-hints.rs:33:1 | LL | struct G(i32); - | ^^^^^^^^^^^^^^ + | ^^^^^^^^ error[E0587]: type has conflicting packed and align representation hints --> $DIR/conflicting-repr-hints.rs:37:1 | LL | struct H(i32); - | ^^^^^^^^^^^^^^ + | ^^^^^^^^ error[E0634]: type has conflicting packed representation hints --> $DIR/conflicting-repr-hints.rs:40:1 | LL | struct I(i32); - | ^^^^^^^^^^^^^^ + | ^^^^^^^^ error[E0634]: type has conflicting packed representation hints --> $DIR/conflicting-repr-hints.rs:44:1 | LL | struct J(i32); - | ^^^^^^^^^^^^^^ + | ^^^^^^^^ error[E0587]: type has conflicting packed and align representation hints --> $DIR/conflicting-repr-hints.rs:50:1 | -LL | / union X { -LL | | -LL | | i: i32, -LL | | } - | |_^ +LL | union X { + | ^^^^^^^ error[E0587]: type has conflicting packed and align representation hints --> $DIR/conflicting-repr-hints.rs:57:1 | -LL | / union Y { -LL | | -LL | | i: i32, -LL | | } - | |_^ +LL | union Y { + | ^^^^^^^ error[E0587]: type has conflicting packed and align representation hints --> $DIR/conflicting-repr-hints.rs:64:1 | -LL | / union Z { -LL | | -LL | | i: i32, -LL | | } - | |_^ +LL | union Z { + | ^^^^^^^ error[E0587]: type has conflicting packed and align representation hints --> $DIR/conflicting-repr-hints.rs:70:1 | LL | pub struct S(u16); - | ^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^ error[E0587]: type has conflicting packed and align representation hints --> $DIR/conflicting-repr-hints.rs:73:1 | -LL | / pub union U { -LL | | u: u16 -LL | | } - | |_^ +LL | pub union U { + | ^^^^^^^^^^^ error: aborting due to 12 previous errors diff --git a/src/test/ui/const-generics/const-param-elided-lifetime.min.stderr b/src/test/ui/const-generics/const-param-elided-lifetime.min.stderr index 48d85e7ff64..4bba42c7782 100644 --- a/src/test/ui/const-generics/const-param-elided-lifetime.min.stderr +++ b/src/test/ui/const-generics/const-param-elided-lifetime.min.stderr @@ -47,15 +47,6 @@ LL | impl<const N: &u8> A<N> { = help: more complex types are supported with `#![feature(adt_const_params)]` error: `&'static u8` is forbidden as the type of a const generic parameter - --> $DIR/const-param-elided-lifetime.rs:17:21 - | -LL | fn foo<const M: &u8>(&self) {} - | ^^^ - | - = note: the only supported types are integers, `bool` and `char` - = help: more complex types are supported with `#![feature(adt_const_params)]` - -error: `&'static u8` is forbidden as the type of a const generic parameter --> $DIR/const-param-elided-lifetime.rs:22:15 | LL | impl<const N: &u8> B for A<N> {} @@ -73,6 +64,15 @@ LL | fn bar<const N: &u8>() {} = note: the only supported types are integers, `bool` and `char` = help: more complex types are supported with `#![feature(adt_const_params)]` +error: `&'static u8` is forbidden as the type of a const generic parameter + --> $DIR/const-param-elided-lifetime.rs:17:21 + | +LL | fn foo<const M: &u8>(&self) {} + | ^^^ + | + = note: the only supported types are integers, `bool` and `char` + = help: more complex types are supported with `#![feature(adt_const_params)]` + error: aborting due to 10 previous errors For more information about this error, try `rustc --explain E0637`. diff --git a/src/test/ui/const-generics/defaults/trait_objects_fail.stderr b/src/test/ui/const-generics/defaults/trait_objects_fail.stderr index 60dc96f675a..da85b2059f0 100644 --- a/src/test/ui/const-generics/defaults/trait_objects_fail.stderr +++ b/src/test/ui/const-generics/defaults/trait_objects_fail.stderr @@ -7,7 +7,7 @@ LL | foo(&10_u32); | required by a bound introduced by this call | = help: the trait `Trait<2_u8>` is implemented for `u32` - = note: required for the cast to the object type `dyn Trait` + = note: required for the cast from `u32` to the object type `dyn Trait` error[E0277]: the trait bound `bool: Traitor<{_: u8}>` is not satisfied --> $DIR/trait_objects_fail.rs:28:9 @@ -18,7 +18,7 @@ LL | bar(&true); | required by a bound introduced by this call | = help: the trait `Traitor<2_u8, 3_u8>` is implemented for `bool` - = note: required for the cast to the object type `dyn Traitor<{_: u8}>` + = note: required for the cast from `bool` to the object type `dyn Traitor<{_: u8}>` error: aborting due to 2 previous errors diff --git a/src/test/ui/const-generics/generic_arg_infer/issue-91614.stderr b/src/test/ui/const-generics/generic_arg_infer/issue-91614.stderr index 463605e2431..688db695fa8 100644 --- a/src/test/ui/const-generics/generic_arg_infer/issue-91614.stderr +++ b/src/test/ui/const-generics/generic_arg_infer/issue-91614.stderr @@ -2,7 +2,7 @@ error[E0283]: type annotations needed for `Mask<_, LANES>` --> $DIR/issue-91614.rs:6:9 | LL | let y = Mask::<_, _>::splat(false); - | ^ + | ^ ------------------- type must be known at this point | = note: cannot satisfy `_: MaskElement` note: required by a bound in `Mask::<T, LANES>::splat` diff --git a/src/test/ui/const-generics/generic_const_exprs/eval-privacy.stderr b/src/test/ui/const-generics/generic_const_exprs/eval-privacy.stderr index c6b0ce93145..2d9de8805bb 100644 --- a/src/test/ui/const-generics/generic_const_exprs/eval-privacy.stderr +++ b/src/test/ui/const-generics/generic_const_exprs/eval-privacy.stderr @@ -2,7 +2,7 @@ error[E0446]: private type `fn(u8) -> u8 {my_const_fn}` in public interface --> $DIR/eval-privacy.rs:16:5 | LL | type AssocTy = Const<{ my_const_fn(U) }>; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type + | ^^^^^^^^^^^^ can't leak private type ... LL | const fn my_const_fn(val: u8) -> u8 { | ----------------------------------- `fn(u8) -> u8 {my_const_fn}` declared as private diff --git a/src/test/ui/const-generics/generic_const_exprs/issue-72787.min.stderr b/src/test/ui/const-generics/generic_const_exprs/issue-72787.min.stderr index 02dce4f7a97..41afaec86b6 100644 --- a/src/test/ui/const-generics/generic_const_exprs/issue-72787.min.stderr +++ b/src/test/ui/const-generics/generic_const_exprs/issue-72787.min.stderr @@ -34,19 +34,19 @@ LL | IsLessOrEqual<{ 8 - I }, { 8 - J }>: True, = help: const parameters may only be used as standalone arguments, i.e. `J` = help: use `#![feature(generic_const_exprs)]` to allow generic const expressions -error[E0283]: type annotations needed +error[E0283]: type annotations needed: cannot satisfy `IsLessOrEqual<I, 8_u32>: True` --> $DIR/issue-72787.rs:21:26 | LL | IsLessOrEqual<I, 8>: True, - | ^^^^ cannot infer type for struct `IsLessOrEqual<I, 8_u32>` + | ^^^^ | = note: cannot satisfy `IsLessOrEqual<I, 8_u32>: True` -error[E0283]: type annotations needed +error[E0283]: type annotations needed: cannot satisfy `IsLessOrEqual<I, 8_u32>: True` --> $DIR/issue-72787.rs:21:26 | LL | IsLessOrEqual<I, 8>: True, - | ^^^^ cannot infer type for struct `IsLessOrEqual<I, 8_u32>` + | ^^^^ | = note: cannot satisfy `IsLessOrEqual<I, 8_u32>: True` diff --git a/src/test/ui/const-generics/generic_const_exprs/issue-72787.rs b/src/test/ui/const-generics/generic_const_exprs/issue-72787.rs index 77ad57f0640..c651bf1c8de 100644 --- a/src/test/ui/const-generics/generic_const_exprs/issue-72787.rs +++ b/src/test/ui/const-generics/generic_const_exprs/issue-72787.rs @@ -19,8 +19,8 @@ struct S<const I: u32, const J: u32>; impl<const I: u32, const J: u32> S<I, J> where IsLessOrEqual<I, 8>: True, -//[min]~^ Error type annotations needed [E0283] -//[min]~| Error type annotations needed [E0283] +//[min]~^ Error type annotations needed +//[min]~| Error type annotations needed IsLessOrEqual<J, 8>: True, IsLessOrEqual<{ 8 - I }, { 8 - J }>: True, //[min]~^ Error generic parameters may not be used in const operations diff --git a/src/test/ui/const-generics/generic_const_exprs/issue-97047-ice-1.rs b/src/test/ui/const-generics/generic_const_exprs/issue-97047-ice-1.rs new file mode 100644 index 00000000000..67e30232e2f --- /dev/null +++ b/src/test/ui/const-generics/generic_const_exprs/issue-97047-ice-1.rs @@ -0,0 +1,25 @@ +// check-pass + +#![feature(adt_const_params, generic_const_exprs)] +//~^ WARN the feature `adt_const_params` is incomplete and may not be safe to use and/or cause compiler crashes [incomplete_features] +//~^^ WARN the feature `generic_const_exprs` is incomplete and may not be safe to use and/or cause compiler crashes [incomplete_features] + +pub struct Changes<const CHANGES: &'static [&'static str]> +where + [(); CHANGES.len()]:, +{ + changes: [usize; CHANGES.len()], +} + +impl<const CHANGES: &'static [&'static str]> Changes<CHANGES> +where + [(); CHANGES.len()]:, +{ + pub const fn new() -> Self { + Self { + changes: [0; CHANGES.len()], + } + } +} + +pub fn main() {} diff --git a/src/test/ui/const-generics/generic_const_exprs/issue-97047-ice-1.stderr b/src/test/ui/const-generics/generic_const_exprs/issue-97047-ice-1.stderr new file mode 100644 index 00000000000..b5b2b0e405a --- /dev/null +++ b/src/test/ui/const-generics/generic_const_exprs/issue-97047-ice-1.stderr @@ -0,0 +1,19 @@ +warning: the feature `adt_const_params` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/issue-97047-ice-1.rs:3:12 + | +LL | #![feature(adt_const_params, generic_const_exprs)] + | ^^^^^^^^^^^^^^^^ + | + = note: `#[warn(incomplete_features)]` on by default + = note: see issue #95174 <https://github.com/rust-lang/rust/issues/95174> for more information + +warning: the feature `generic_const_exprs` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/issue-97047-ice-1.rs:3:30 + | +LL | #![feature(adt_const_params, generic_const_exprs)] + | ^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #76560 <https://github.com/rust-lang/rust/issues/76560> for more information + +warning: 2 warnings emitted + diff --git a/src/test/ui/const-generics/generic_const_exprs/issue-97047-ice-2.rs b/src/test/ui/const-generics/generic_const_exprs/issue-97047-ice-2.rs new file mode 100644 index 00000000000..00568a08944 --- /dev/null +++ b/src/test/ui/const-generics/generic_const_exprs/issue-97047-ice-2.rs @@ -0,0 +1,23 @@ +// check-pass + +#![feature(adt_const_params, generic_const_exprs)] +//~^ WARN the feature `adt_const_params` is incomplete and may not be safe to use and/or cause compiler crashes [incomplete_features] +//~^^ WARN the feature `generic_const_exprs` is incomplete and may not be safe to use and/or cause compiler crashes [incomplete_features] + +pub struct Changes<const CHANGES: &'static [&'static str]> +where + [(); CHANGES.len()]:, +{ + changes: [usize; CHANGES.len()], +} + +impl<const CHANGES: &'static [&'static str]> Changes<CHANGES> +where + [(); CHANGES.len()]:, +{ + pub fn combine(&mut self, other: &Self) { + for _change in &self.changes {} + } +} + +pub fn main() {} diff --git a/src/test/ui/const-generics/generic_const_exprs/issue-97047-ice-2.stderr b/src/test/ui/const-generics/generic_const_exprs/issue-97047-ice-2.stderr new file mode 100644 index 00000000000..5dfbd87ccd4 --- /dev/null +++ b/src/test/ui/const-generics/generic_const_exprs/issue-97047-ice-2.stderr @@ -0,0 +1,19 @@ +warning: the feature `adt_const_params` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/issue-97047-ice-2.rs:3:12 + | +LL | #![feature(adt_const_params, generic_const_exprs)] + | ^^^^^^^^^^^^^^^^ + | + = note: `#[warn(incomplete_features)]` on by default + = note: see issue #95174 <https://github.com/rust-lang/rust/issues/95174> for more information + +warning: the feature `generic_const_exprs` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/issue-97047-ice-2.rs:3:30 + | +LL | #![feature(adt_const_params, generic_const_exprs)] + | ^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #76560 <https://github.com/rust-lang/rust/issues/76560> for more information + +warning: 2 warnings emitted + diff --git a/src/test/ui/const-generics/ice-68875.rs b/src/test/ui/const-generics/ice-68875.rs new file mode 100644 index 00000000000..2ef7cfdbe27 --- /dev/null +++ b/src/test/ui/const-generics/ice-68875.rs @@ -0,0 +1,11 @@ +// check-fail + +struct DataWrapper<'a> { + data: &'a [u8; Self::SIZE], //~ ERROR generic `Self` types are currently not permitted in anonymous constants +} + +impl DataWrapper<'_> { + const SIZE: usize = 14; +} + +pub fn main() {} diff --git a/src/test/ui/const-generics/ice-68875.stderr b/src/test/ui/const-generics/ice-68875.stderr new file mode 100644 index 00000000000..1db62c57fd4 --- /dev/null +++ b/src/test/ui/const-generics/ice-68875.stderr @@ -0,0 +1,8 @@ +error: generic `Self` types are currently not permitted in anonymous constants + --> $DIR/ice-68875.rs:4:20 + | +LL | data: &'a [u8; Self::SIZE], + | ^^^^ + +error: aborting due to previous error + diff --git a/src/test/ui/const-generics/issue-46511.rs b/src/test/ui/const-generics/issue-46511.rs new file mode 100644 index 00000000000..71c50e2f3f7 --- /dev/null +++ b/src/test/ui/const-generics/issue-46511.rs @@ -0,0 +1,8 @@ +// check-fail + +struct Foo<'a> //~ ERROR parameter `'a` is never used [E0392] +{ + _a: [u8; std::mem::size_of::<&'a mut u8>()] //~ ERROR a non-static lifetime is not allowed in a `const` +} + +pub fn main() {} diff --git a/src/test/ui/const-generics/issue-46511.stderr b/src/test/ui/const-generics/issue-46511.stderr new file mode 100644 index 00000000000..b21afa56dcb --- /dev/null +++ b/src/test/ui/const-generics/issue-46511.stderr @@ -0,0 +1,21 @@ +error[E0658]: a non-static lifetime is not allowed in a `const` + --> $DIR/issue-46511.rs:5:35 + | +LL | _a: [u8; std::mem::size_of::<&'a mut u8>()] + | ^^ + | + = note: see issue #76560 <https://github.com/rust-lang/rust/issues/76560> for more information + = help: add `#![feature(generic_const_exprs)]` to the crate attributes to enable + +error[E0392]: parameter `'a` is never used + --> $DIR/issue-46511.rs:3:12 + | +LL | struct Foo<'a> + | ^^ unused parameter + | + = help: consider removing `'a`, referring to it in a field, or using a marker such as `PhantomData` + +error: aborting due to 2 previous errors + +Some errors have detailed explanations: E0392, E0658. +For more information about an error, try `rustc --explain E0392`. diff --git a/src/test/ui/const-generics/issue-66451.rs b/src/test/ui/const-generics/issue-66451.rs new file mode 100644 index 00000000000..3335f7d5984 --- /dev/null +++ b/src/test/ui/const-generics/issue-66451.rs @@ -0,0 +1,28 @@ +#![feature(adt_const_params)] +#![allow(incomplete_features)] + +#[derive(Debug, PartialEq, Eq)] +struct Foo { + value: i32, + nested: &'static Bar<i32>, +} + +#[derive(Debug, PartialEq, Eq)] +struct Bar<T>(T); + +struct Test<const F: Foo>; + +fn main() { + let x: Test<{ + Foo { + value: 3, + nested: &Bar(4), + } + }> = Test; + let y: Test<{ + Foo { + value: 3, + nested: &Bar(5), + } + }> = x; //~ ERROR mismatched types +} diff --git a/src/test/ui/const-generics/issue-66451.stderr b/src/test/ui/const-generics/issue-66451.stderr new file mode 100644 index 00000000000..b691eac4f2d --- /dev/null +++ b/src/test/ui/const-generics/issue-66451.stderr @@ -0,0 +1,20 @@ +error[E0308]: mismatched types + --> $DIR/issue-66451.rs:27:10 + | +LL | let y: Test<{ + | ____________- +LL | | Foo { +LL | | value: 3, +LL | | nested: &Bar(5), +LL | | } +LL | | }> = x; + | | - ^ expected `Foo { value: 3_i32, nested: &Bar::<i32>(5_i32) }`, found `Foo { value: 3_i32, nested: &Bar::<i32>(4_i32) }` + | |______| + | expected due to this + | + = note: expected struct `Test<Foo { value: 3_i32, nested: &Bar::<i32>(5_i32) }>` + found struct `Test<Foo { value: 3_i32, nested: &Bar::<i32>(4_i32) }>` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/const-generics/issues/issue-83765.stderr b/src/test/ui/const-generics/issues/issue-83765.stderr index 98931a3936f..28ddddf1be6 100644 --- a/src/test/ui/const-generics/issues/issue-83765.stderr +++ b/src/test/ui/const-generics/issues/issue-83765.stderr @@ -2,7 +2,7 @@ error[E0391]: cycle detected when resolving instance `<LazyUpdim<T, { T::DIM }, --> $DIR/issue-83765.rs:5:5 | LL | const DIM: usize; - | ^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^ | note: ...which requires checking if `TensorDimension` fulfills its obligations... --> $DIR/issue-83765.rs:4:1 diff --git a/src/test/ui/const-generics/min_const_generics/invalid-patterns.32bit.stderr b/src/test/ui/const-generics/min_const_generics/invalid-patterns.32bit.stderr index 415a53a5627..f5396b8381a 100644 --- a/src/test/ui/const-generics/min_const_generics/invalid-patterns.32bit.stderr +++ b/src/test/ui/const-generics/min_const_generics/invalid-patterns.32bit.stderr @@ -26,7 +26,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/invalid-patterns.rs:38:21 | LL | get_flag::<false, { unsafe { char_raw.character } }>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered uninitialized bytes, but expected a valid unicode scalar value (in `0..=0x10FFFF` but not in `0xD800..=0xDFFF`) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered uninitialized bytes, but expected a valid unicode scalar value (in `0..=0x10FFFF` but not in `0xD800..=0xDFFF`) | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 4, align: 4) { @@ -37,7 +37,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/invalid-patterns.rs:40:14 | LL | get_flag::<{ unsafe { bool_raw.boolean } }, 'z'>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered 0x42, but expected a boolean + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0x42, but expected a boolean | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 1, align: 1) { @@ -48,7 +48,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/invalid-patterns.rs:42:14 | LL | get_flag::<{ unsafe { bool_raw.boolean } }, { unsafe { char_raw.character } }>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered 0x42, but expected a boolean + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0x42, but expected a boolean | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 1, align: 1) { @@ -59,7 +59,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/invalid-patterns.rs:42:47 | LL | get_flag::<{ unsafe { bool_raw.boolean } }, { unsafe { char_raw.character } }>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered uninitialized bytes, but expected a valid unicode scalar value (in `0..=0x10FFFF` but not in `0xD800..=0xDFFF`) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered uninitialized bytes, but expected a valid unicode scalar value (in `0..=0x10FFFF` but not in `0xD800..=0xDFFF`) | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 4, align: 4) { diff --git a/src/test/ui/const-generics/min_const_generics/invalid-patterns.64bit.stderr b/src/test/ui/const-generics/min_const_generics/invalid-patterns.64bit.stderr index 415a53a5627..f5396b8381a 100644 --- a/src/test/ui/const-generics/min_const_generics/invalid-patterns.64bit.stderr +++ b/src/test/ui/const-generics/min_const_generics/invalid-patterns.64bit.stderr @@ -26,7 +26,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/invalid-patterns.rs:38:21 | LL | get_flag::<false, { unsafe { char_raw.character } }>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered uninitialized bytes, but expected a valid unicode scalar value (in `0..=0x10FFFF` but not in `0xD800..=0xDFFF`) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered uninitialized bytes, but expected a valid unicode scalar value (in `0..=0x10FFFF` but not in `0xD800..=0xDFFF`) | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 4, align: 4) { @@ -37,7 +37,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/invalid-patterns.rs:40:14 | LL | get_flag::<{ unsafe { bool_raw.boolean } }, 'z'>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered 0x42, but expected a boolean + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0x42, but expected a boolean | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 1, align: 1) { @@ -48,7 +48,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/invalid-patterns.rs:42:14 | LL | get_flag::<{ unsafe { bool_raw.boolean } }, { unsafe { char_raw.character } }>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered 0x42, but expected a boolean + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0x42, but expected a boolean | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 1, align: 1) { @@ -59,7 +59,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/invalid-patterns.rs:42:47 | LL | get_flag::<{ unsafe { bool_raw.boolean } }, { unsafe { char_raw.character } }>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered uninitialized bytes, but expected a valid unicode scalar value (in `0..=0x10FFFF` but not in `0xD800..=0xDFFF`) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered uninitialized bytes, but expected a valid unicode scalar value (in `0..=0x10FFFF` but not in `0xD800..=0xDFFF`) | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 4, align: 4) { diff --git a/src/test/ui/const-generics/try_unify_ignore_lifetimes.rs b/src/test/ui/const-generics/try_unify_ignore_lifetimes.rs new file mode 100644 index 00000000000..2ae0ae70dd9 --- /dev/null +++ b/src/test/ui/const-generics/try_unify_ignore_lifetimes.rs @@ -0,0 +1,33 @@ +// check-pass +#![feature(generic_const_exprs)] +#![allow(incomplete_features)] + +struct Num<const N: usize>; + +trait NumT { + const VALUE: usize; +} + +impl<const N: usize> NumT for Num<N> { + const VALUE: usize = N; +} + +struct Foo<'a, N: NumT>(&'a [u32; N::VALUE]) where [(); N::VALUE]:; + +trait Bar { + type Size: NumT; + + fn bar<'a>(foo: &Foo<'a, Self::Size>) where [(); Self::Size::VALUE]: { + todo!(); + } +} + +trait Baz<'a> { + type Size: NumT; + + fn baz(foo: &Foo<'a, Self::Size>) where [(); Self::Size::VALUE]: { + todo!(); + } +} + +fn main() {} diff --git a/src/test/ui/const-ptr/forbidden_slices.32bit.stderr b/src/test/ui/const-ptr/forbidden_slices.32bit.stderr index 023d5ea34d8..ce281797e56 100644 --- a/src/test/ui/const-ptr/forbidden_slices.32bit.stderr +++ b/src/test/ui/const-ptr/forbidden_slices.32bit.stderr @@ -44,7 +44,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/forbidden_slices.rs:26:1 | LL | pub static S4: &[u8] = unsafe { from_raw_parts((&D1) as *const _ as _, 1) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed at .<deref>[0]: encountered uninitialized bytes + | ^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered uninitialized bytes | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 8, align: 4) { @@ -55,7 +55,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/forbidden_slices.rs:28:1 | LL | pub static S5: &[u8] = unsafe { from_raw_parts((&D3) as *const _ as _, size_of::<&u32>()) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed at .<deref>: encountered a pointer, but expected plain (non-pointer) bytes + | ^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>: encountered a pointer, but expected plain (non-pointer) bytes | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 8, align: 4) { @@ -66,7 +66,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/forbidden_slices.rs:30:1 | LL | pub static S6: &[bool] = unsafe { from_raw_parts((&D0) as *const _ as _, 4) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed at .<deref>[0]: encountered 0x11, but expected a boolean + | ^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered 0x11, but expected a boolean | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 8, align: 4) { @@ -76,13 +76,8 @@ LL | pub static S6: &[bool] = unsafe { from_raw_parts((&D0) as *const _ as _, 4) error[E0080]: it is undefined behavior to use this value --> $DIR/forbidden_slices.rs:33:1 | -LL | / pub static S7: &[u16] = unsafe { -LL | | -LL | | let ptr = (&D2 as *const Struct as *const u16).byte_add(1); -LL | | -LL | | from_raw_parts(ptr, 4) -LL | | }; - | |__^ type validation failed: encountered an unaligned reference (required 2 byte alignment but found 1) +LL | pub static S7: &[u16] = unsafe { + | ^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered an unaligned reference (required 2 byte alignment but found 1) | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 8, align: 4) { @@ -163,12 +158,8 @@ LL | from_ptr_range(ptr..ptr.add(2)) error[E0080]: it is undefined behavior to use this value --> $DIR/forbidden_slices.rs:53:1 | -LL | / pub static R4: &[u8] = unsafe { -LL | | -LL | | let ptr = (&D1) as *const MaybeUninit<&u32> as *const u8; -LL | | from_ptr_range(ptr..ptr.add(1)) -LL | | }; - | |__^ type validation failed at .<deref>[0]: encountered uninitialized bytes +LL | pub static R4: &[u8] = unsafe { + | ^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered uninitialized bytes | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 8, align: 4) { @@ -178,12 +169,8 @@ LL | | }; error[E0080]: it is undefined behavior to use this value --> $DIR/forbidden_slices.rs:58:1 | -LL | / pub static R5: &[u8] = unsafe { -LL | | -LL | | let ptr = &D3 as *const &u32; -LL | | from_ptr_range(ptr.cast()..ptr.add(1).cast()) -LL | | }; - | |__^ type validation failed at .<deref>: encountered a pointer, but expected plain (non-pointer) bytes +LL | pub static R5: &[u8] = unsafe { + | ^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>: encountered a pointer, but expected plain (non-pointer) bytes | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 8, align: 4) { @@ -193,12 +180,8 @@ LL | | }; error[E0080]: it is undefined behavior to use this value --> $DIR/forbidden_slices.rs:63:1 | -LL | / pub static R6: &[bool] = unsafe { -LL | | -LL | | let ptr = &D0 as *const u32 as *const bool; -LL | | from_ptr_range(ptr..ptr.add(4)) -LL | | }; - | |__^ type validation failed at .<deref>[0]: encountered 0x11, but expected a boolean +LL | pub static R6: &[bool] = unsafe { + | ^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered 0x11, but expected a boolean | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 8, align: 4) { @@ -208,12 +191,8 @@ LL | | }; error[E0080]: it is undefined behavior to use this value --> $DIR/forbidden_slices.rs:68:1 | -LL | / pub static R7: &[u16] = unsafe { -LL | | -LL | | let ptr = (&D2 as *const Struct as *const u16).byte_add(1); -LL | | from_ptr_range(ptr..ptr.add(4)) -LL | | }; - | |__^ type validation failed: encountered an unaligned reference (required 2 byte alignment but found 1) +LL | pub static R7: &[u16] = unsafe { + | ^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered an unaligned reference (required 2 byte alignment but found 1) | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 8, align: 4) { diff --git a/src/test/ui/const-ptr/forbidden_slices.64bit.stderr b/src/test/ui/const-ptr/forbidden_slices.64bit.stderr index ed89c253d53..6c484f7c95b 100644 --- a/src/test/ui/const-ptr/forbidden_slices.64bit.stderr +++ b/src/test/ui/const-ptr/forbidden_slices.64bit.stderr @@ -44,7 +44,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/forbidden_slices.rs:26:1 | LL | pub static S4: &[u8] = unsafe { from_raw_parts((&D1) as *const _ as _, 1) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed at .<deref>[0]: encountered uninitialized bytes + | ^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered uninitialized bytes | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 16, align: 8) { @@ -55,7 +55,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/forbidden_slices.rs:28:1 | LL | pub static S5: &[u8] = unsafe { from_raw_parts((&D3) as *const _ as _, size_of::<&u32>()) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed at .<deref>: encountered a pointer, but expected plain (non-pointer) bytes + | ^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>: encountered a pointer, but expected plain (non-pointer) bytes | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 16, align: 8) { @@ -66,7 +66,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/forbidden_slices.rs:30:1 | LL | pub static S6: &[bool] = unsafe { from_raw_parts((&D0) as *const _ as _, 4) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed at .<deref>[0]: encountered 0x11, but expected a boolean + | ^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered 0x11, but expected a boolean | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 16, align: 8) { @@ -76,13 +76,8 @@ LL | pub static S6: &[bool] = unsafe { from_raw_parts((&D0) as *const _ as _, 4) error[E0080]: it is undefined behavior to use this value --> $DIR/forbidden_slices.rs:33:1 | -LL | / pub static S7: &[u16] = unsafe { -LL | | -LL | | let ptr = (&D2 as *const Struct as *const u16).byte_add(1); -LL | | -LL | | from_raw_parts(ptr, 4) -LL | | }; - | |__^ type validation failed: encountered an unaligned reference (required 2 byte alignment but found 1) +LL | pub static S7: &[u16] = unsafe { + | ^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered an unaligned reference (required 2 byte alignment but found 1) | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 16, align: 8) { @@ -163,12 +158,8 @@ LL | from_ptr_range(ptr..ptr.add(2)) error[E0080]: it is undefined behavior to use this value --> $DIR/forbidden_slices.rs:53:1 | -LL | / pub static R4: &[u8] = unsafe { -LL | | -LL | | let ptr = (&D1) as *const MaybeUninit<&u32> as *const u8; -LL | | from_ptr_range(ptr..ptr.add(1)) -LL | | }; - | |__^ type validation failed at .<deref>[0]: encountered uninitialized bytes +LL | pub static R4: &[u8] = unsafe { + | ^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered uninitialized bytes | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 16, align: 8) { @@ -178,12 +169,8 @@ LL | | }; error[E0080]: it is undefined behavior to use this value --> $DIR/forbidden_slices.rs:58:1 | -LL | / pub static R5: &[u8] = unsafe { -LL | | -LL | | let ptr = &D3 as *const &u32; -LL | | from_ptr_range(ptr.cast()..ptr.add(1).cast()) -LL | | }; - | |__^ type validation failed at .<deref>: encountered a pointer, but expected plain (non-pointer) bytes +LL | pub static R5: &[u8] = unsafe { + | ^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>: encountered a pointer, but expected plain (non-pointer) bytes | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 16, align: 8) { @@ -193,12 +180,8 @@ LL | | }; error[E0080]: it is undefined behavior to use this value --> $DIR/forbidden_slices.rs:63:1 | -LL | / pub static R6: &[bool] = unsafe { -LL | | -LL | | let ptr = &D0 as *const u32 as *const bool; -LL | | from_ptr_range(ptr..ptr.add(4)) -LL | | }; - | |__^ type validation failed at .<deref>[0]: encountered 0x11, but expected a boolean +LL | pub static R6: &[bool] = unsafe { + | ^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered 0x11, but expected a boolean | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 16, align: 8) { @@ -208,12 +191,8 @@ LL | | }; error[E0080]: it is undefined behavior to use this value --> $DIR/forbidden_slices.rs:68:1 | -LL | / pub static R7: &[u16] = unsafe { -LL | | -LL | | let ptr = (&D2 as *const Struct as *const u16).byte_add(1); -LL | | from_ptr_range(ptr..ptr.add(4)) -LL | | }; - | |__^ type validation failed: encountered an unaligned reference (required 2 byte alignment but found 1) +LL | pub static R7: &[u16] = unsafe { + | ^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered an unaligned reference (required 2 byte alignment but found 1) | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 16, align: 8) { diff --git a/src/test/ui/consts/assert-type-intrinsics.stderr b/src/test/ui/consts/assert-type-intrinsics.stderr index 89f8f2ffc55..f3b9170d428 100644 --- a/src/test/ui/consts/assert-type-intrinsics.stderr +++ b/src/test/ui/consts/assert-type-intrinsics.stderr @@ -1,11 +1,10 @@ error: any use of this value will cause an error --> $DIR/assert-type-intrinsics.rs:14:9 | -LL | / const _BAD1: () = unsafe { -LL | | MaybeUninit::<!>::uninit().assume_init(); - | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ aborted execution: attempted to instantiate uninhabited type `!` -LL | | }; - | |______- +LL | const _BAD1: () = unsafe { + | --------------- +LL | MaybeUninit::<!>::uninit().assume_init(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ aborted execution: attempted to instantiate uninhabited type `!` | = note: `#[deny(const_err)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -14,11 +13,10 @@ LL | | }; error: any use of this value will cause an error --> $DIR/assert-type-intrinsics.rs:17:9 | -LL | / const _BAD2: () = unsafe { -LL | | intrinsics::assert_uninit_valid::<bool>(); - | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ aborted execution: attempted to leave type `bool` uninitialized, which is invalid -LL | | }; - | |______- +LL | const _BAD2: () = unsafe { + | --------------- +LL | intrinsics::assert_uninit_valid::<bool>(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ aborted execution: attempted to leave type `bool` uninitialized, which is invalid | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> @@ -26,11 +24,10 @@ LL | | }; error: any use of this value will cause an error --> $DIR/assert-type-intrinsics.rs:20:9 | -LL | / const _BAD3: () = unsafe { -LL | | intrinsics::assert_zero_valid::<&'static i32>(); - | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ aborted execution: attempted to zero-initialize type `&i32`, which is invalid -LL | | }; - | |______- +LL | const _BAD3: () = unsafe { + | --------------- +LL | intrinsics::assert_zero_valid::<&'static i32>(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ aborted execution: attempted to zero-initialize type `&i32`, which is invalid | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> @@ -41,11 +38,10 @@ Future incompatibility report: Future breakage diagnostic: error: any use of this value will cause an error --> $DIR/assert-type-intrinsics.rs:14:9 | -LL | / const _BAD1: () = unsafe { -LL | | MaybeUninit::<!>::uninit().assume_init(); - | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ aborted execution: attempted to instantiate uninhabited type `!` -LL | | }; - | |______- +LL | const _BAD1: () = unsafe { + | --------------- +LL | MaybeUninit::<!>::uninit().assume_init(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ aborted execution: attempted to instantiate uninhabited type `!` | = note: `#[deny(const_err)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -55,11 +51,10 @@ Future breakage diagnostic: error: any use of this value will cause an error --> $DIR/assert-type-intrinsics.rs:17:9 | -LL | / const _BAD2: () = unsafe { -LL | | intrinsics::assert_uninit_valid::<bool>(); - | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ aborted execution: attempted to leave type `bool` uninitialized, which is invalid -LL | | }; - | |______- +LL | const _BAD2: () = unsafe { + | --------------- +LL | intrinsics::assert_uninit_valid::<bool>(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ aborted execution: attempted to leave type `bool` uninitialized, which is invalid | = note: `#[deny(const_err)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -69,11 +64,10 @@ Future breakage diagnostic: error: any use of this value will cause an error --> $DIR/assert-type-intrinsics.rs:20:9 | -LL | / const _BAD3: () = unsafe { -LL | | intrinsics::assert_zero_valid::<&'static i32>(); - | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ aborted execution: attempted to zero-initialize type `&i32`, which is invalid -LL | | }; - | |______- +LL | const _BAD3: () = unsafe { + | --------------- +LL | intrinsics::assert_zero_valid::<&'static i32>(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ aborted execution: attempted to zero-initialize type `&i32`, which is invalid | = note: `#[deny(const_err)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! diff --git a/src/test/ui/consts/assoc_const_generic_impl.stderr b/src/test/ui/consts/assoc_const_generic_impl.stderr index cccf62a8ff6..17cbaef1f06 100644 --- a/src/test/ui/consts/assoc_const_generic_impl.stderr +++ b/src/test/ui/consts/assoc_const_generic_impl.stderr @@ -2,9 +2,7 @@ warning: any use of this value will cause an error --> $DIR/assoc_const_generic_impl.rs:11:34 | LL | const I_AM_ZERO_SIZED: () = [()][std::mem::size_of::<Self>()]; - | -----------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- - | | - | index out of bounds: the length is 1 but the index is 4 + | ------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ index out of bounds: the length is 1 but the index is 4 | note: the lint level is defined here --> $DIR/assoc_const_generic_impl.rs:3:9 @@ -27,9 +25,7 @@ warning: any use of this value will cause an error --> $DIR/assoc_const_generic_impl.rs:11:34 | LL | const I_AM_ZERO_SIZED: () = [()][std::mem::size_of::<Self>()]; - | -----------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- - | | - | index out of bounds: the length is 1 but the index is 4 + | ------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ index out of bounds: the length is 1 but the index is 4 | note: the lint level is defined here --> $DIR/assoc_const_generic_impl.rs:3:9 diff --git a/src/test/ui/consts/const-as-fn.stderr b/src/test/ui/consts/const-as-fn.stderr index b8dd4134b28..6c51ed89393 100644 --- a/src/test/ui/consts/const-as-fn.stderr +++ b/src/test/ui/consts/const-as-fn.stderr @@ -2,7 +2,7 @@ error[E0618]: expected function, found `usize` --> $DIR/const-as-fn.rs:4:5 | LL | const FOO: usize = 0; - | --------------------- `FOO` defined here + | ---------------- `FOO` defined here ... LL | FOO(); | ^^^-- diff --git a/src/test/ui/consts/const-err-early.stderr b/src/test/ui/consts/const-err-early.stderr index 385e770eb4f..1b94aa080dd 100644 --- a/src/test/ui/consts/const-err-early.stderr +++ b/src/test/ui/consts/const-err-early.stderr @@ -2,9 +2,7 @@ error: any use of this value will cause an error --> $DIR/const-err-early.rs:3:19 | LL | pub const A: i8 = -i8::MIN; - | ------------------^^^^^^^^- - | | - | attempt to negate `i8::MIN`, which would overflow + | --------------- ^^^^^^^^ attempt to negate `i8::MIN`, which would overflow | note: the lint level is defined here --> $DIR/const-err-early.rs:1:9 @@ -18,9 +16,7 @@ error: any use of this value will cause an error --> $DIR/const-err-early.rs:5:19 | LL | pub const B: u8 = 200u8 + 200u8; - | ------------------^^^^^^^^^^^^^- - | | - | attempt to compute `200_u8 + 200_u8`, which would overflow + | --------------- ^^^^^^^^^^^^^ attempt to compute `200_u8 + 200_u8`, which would overflow | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> @@ -29,9 +25,7 @@ error: any use of this value will cause an error --> $DIR/const-err-early.rs:7:19 | LL | pub const C: u8 = 200u8 * 4; - | ------------------^^^^^^^^^- - | | - | attempt to compute `200_u8 * 4_u8`, which would overflow + | --------------- ^^^^^^^^^ attempt to compute `200_u8 * 4_u8`, which would overflow | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> @@ -40,9 +34,7 @@ error: any use of this value will cause an error --> $DIR/const-err-early.rs:9:19 | LL | pub const D: u8 = 42u8 - (42u8 + 1); - | ------------------^^^^^^^^^^^^^^^^^- - | | - | attempt to compute `42_u8 - 43_u8`, which would overflow + | --------------- ^^^^^^^^^^^^^^^^^ attempt to compute `42_u8 - 43_u8`, which would overflow | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> @@ -51,9 +43,7 @@ error: any use of this value will cause an error --> $DIR/const-err-early.rs:11:19 | LL | pub const E: u8 = [5u8][1]; - | ------------------^^^^^^^^- - | | - | index out of bounds: the length is 1 but the index is 1 + | --------------- ^^^^^^^^ index out of bounds: the length is 1 but the index is 1 | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> @@ -65,9 +55,7 @@ error: any use of this value will cause an error --> $DIR/const-err-early.rs:3:19 | LL | pub const A: i8 = -i8::MIN; - | ------------------^^^^^^^^- - | | - | attempt to negate `i8::MIN`, which would overflow + | --------------- ^^^^^^^^ attempt to negate `i8::MIN`, which would overflow | note: the lint level is defined here --> $DIR/const-err-early.rs:1:9 @@ -82,9 +70,7 @@ error: any use of this value will cause an error --> $DIR/const-err-early.rs:5:19 | LL | pub const B: u8 = 200u8 + 200u8; - | ------------------^^^^^^^^^^^^^- - | | - | attempt to compute `200_u8 + 200_u8`, which would overflow + | --------------- ^^^^^^^^^^^^^ attempt to compute `200_u8 + 200_u8`, which would overflow | note: the lint level is defined here --> $DIR/const-err-early.rs:1:9 @@ -99,9 +85,7 @@ error: any use of this value will cause an error --> $DIR/const-err-early.rs:7:19 | LL | pub const C: u8 = 200u8 * 4; - | ------------------^^^^^^^^^- - | | - | attempt to compute `200_u8 * 4_u8`, which would overflow + | --------------- ^^^^^^^^^ attempt to compute `200_u8 * 4_u8`, which would overflow | note: the lint level is defined here --> $DIR/const-err-early.rs:1:9 @@ -116,9 +100,7 @@ error: any use of this value will cause an error --> $DIR/const-err-early.rs:9:19 | LL | pub const D: u8 = 42u8 - (42u8 + 1); - | ------------------^^^^^^^^^^^^^^^^^- - | | - | attempt to compute `42_u8 - 43_u8`, which would overflow + | --------------- ^^^^^^^^^^^^^^^^^ attempt to compute `42_u8 - 43_u8`, which would overflow | note: the lint level is defined here --> $DIR/const-err-early.rs:1:9 @@ -133,9 +115,7 @@ error: any use of this value will cause an error --> $DIR/const-err-early.rs:11:19 | LL | pub const E: u8 = [5u8][1]; - | ------------------^^^^^^^^- - | | - | index out of bounds: the length is 1 but the index is 1 + | --------------- ^^^^^^^^ index out of bounds: the length is 1 but the index is 1 | note: the lint level is defined here --> $DIR/const-err-early.rs:1:9 diff --git a/src/test/ui/consts/const-err-multi.stderr b/src/test/ui/consts/const-err-multi.stderr index a195459ff08..f179843654e 100644 --- a/src/test/ui/consts/const-err-multi.stderr +++ b/src/test/ui/consts/const-err-multi.stderr @@ -2,9 +2,7 @@ error: any use of this value will cause an error --> $DIR/const-err-multi.rs:3:19 | LL | pub const A: i8 = -i8::MIN; - | ------------------^^^^^^^^- - | | - | attempt to negate `i8::MIN`, which would overflow + | --------------- ^^^^^^^^ attempt to negate `i8::MIN`, which would overflow | note: the lint level is defined here --> $DIR/const-err-multi.rs:1:9 @@ -18,9 +16,7 @@ error: any use of this value will cause an error --> $DIR/const-err-multi.rs:6:19 | LL | pub const B: i8 = A; - | ------------------^- - | | - | referenced constant has errors + | --------------- ^ referenced constant has errors | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> @@ -29,9 +25,7 @@ error: any use of this value will cause an error --> $DIR/const-err-multi.rs:9:19 | LL | pub const C: u8 = A as u8; - | ------------------^------- - | | - | referenced constant has errors + | --------------- ^ referenced constant has errors | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> @@ -40,9 +34,7 @@ error: any use of this value will cause an error --> $DIR/const-err-multi.rs:12:24 | LL | pub const D: i8 = 50 - A; - | -----------------------^- - | | - | referenced constant has errors + | --------------- ^ referenced constant has errors | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> @@ -54,9 +46,7 @@ error: any use of this value will cause an error --> $DIR/const-err-multi.rs:3:19 | LL | pub const A: i8 = -i8::MIN; - | ------------------^^^^^^^^- - | | - | attempt to negate `i8::MIN`, which would overflow + | --------------- ^^^^^^^^ attempt to negate `i8::MIN`, which would overflow | note: the lint level is defined here --> $DIR/const-err-multi.rs:1:9 @@ -71,9 +61,7 @@ error: any use of this value will cause an error --> $DIR/const-err-multi.rs:6:19 | LL | pub const B: i8 = A; - | ------------------^- - | | - | referenced constant has errors + | --------------- ^ referenced constant has errors | note: the lint level is defined here --> $DIR/const-err-multi.rs:1:9 @@ -88,9 +76,7 @@ error: any use of this value will cause an error --> $DIR/const-err-multi.rs:9:19 | LL | pub const C: u8 = A as u8; - | ------------------^------- - | | - | referenced constant has errors + | --------------- ^ referenced constant has errors | note: the lint level is defined here --> $DIR/const-err-multi.rs:1:9 @@ -105,9 +91,7 @@ error: any use of this value will cause an error --> $DIR/const-err-multi.rs:12:24 | LL | pub const D: i8 = 50 - A; - | -----------------------^- - | | - | referenced constant has errors + | --------------- ^ referenced constant has errors | note: the lint level is defined here --> $DIR/const-err-multi.rs:1:9 diff --git a/src/test/ui/consts/const-err.stderr b/src/test/ui/consts/const-err.stderr index 3b03e702dc4..e3b0d29c853 100644 --- a/src/test/ui/consts/const-err.stderr +++ b/src/test/ui/consts/const-err.stderr @@ -2,9 +2,7 @@ warning: any use of this value will cause an error --> $DIR/const-err.rs:11:17 | LL | const FOO: u8 = [5u8][1]; - | ----------------^^^^^^^^- - | | - | index out of bounds: the length is 1 but the index is 1 + | ------------- ^^^^^^^^ index out of bounds: the length is 1 but the index is 1 | note: the lint level is defined here --> $DIR/const-err.rs:5:9 @@ -34,9 +32,7 @@ warning: any use of this value will cause an error --> $DIR/const-err.rs:11:17 | LL | const FOO: u8 = [5u8][1]; - | ----------------^^^^^^^^- - | | - | index out of bounds: the length is 1 but the index is 1 + | ------------- ^^^^^^^^ index out of bounds: the length is 1 but the index is 1 | note: the lint level is defined here --> $DIR/const-err.rs:5:9 diff --git a/src/test/ui/consts/const-err4.32bit.stderr b/src/test/ui/consts/const-err4.32bit.stderr index 922569f66cf..a553847833a 100644 --- a/src/test/ui/consts/const-err4.32bit.stderr +++ b/src/test/ui/consts/const-err4.32bit.stderr @@ -2,7 +2,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/const-err4.rs:9:11 | LL | Boo = [unsafe { Foo { b: () }.a }; 4][3], - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered uninitialized bytes, but expected initialized bytes + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered uninitialized bytes, but expected initialized bytes | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 4, align: 4) { diff --git a/src/test/ui/consts/const-err4.64bit.stderr b/src/test/ui/consts/const-err4.64bit.stderr index d7b848e8345..66bfc30c3a8 100644 --- a/src/test/ui/consts/const-err4.64bit.stderr +++ b/src/test/ui/consts/const-err4.64bit.stderr @@ -2,7 +2,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/const-err4.rs:9:11 | LL | Boo = [unsafe { Foo { b: () }.a }; 4][3], - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered uninitialized bytes, but expected initialized bytes + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered uninitialized bytes, but expected initialized bytes | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 8, align: 8) { diff --git a/src/test/ui/consts/const-eval/conditional_array_execution.stderr b/src/test/ui/consts/const-eval/conditional_array_execution.stderr index f88bf445426..2312e2a45db 100644 --- a/src/test/ui/consts/const-eval/conditional_array_execution.stderr +++ b/src/test/ui/consts/const-eval/conditional_array_execution.stderr @@ -2,9 +2,7 @@ warning: any use of this value will cause an error --> $DIR/conditional_array_execution.rs:7:19 | LL | const FOO: u32 = [X - Y, Y - X][(X < Y) as usize]; - | ------------------^^^^^--------------------------- - | | - | attempt to compute `5_u32 - 6_u32`, which would overflow + | -------------- ^^^^^ attempt to compute `5_u32 - 6_u32`, which would overflow | note: the lint level is defined here --> $DIR/conditional_array_execution.rs:3:9 @@ -38,9 +36,7 @@ warning: any use of this value will cause an error --> $DIR/conditional_array_execution.rs:7:19 | LL | const FOO: u32 = [X - Y, Y - X][(X < Y) as usize]; - | ------------------^^^^^--------------------------- - | | - | attempt to compute `5_u32 - 6_u32`, which would overflow + | -------------- ^^^^^ attempt to compute `5_u32 - 6_u32`, which would overflow | note: the lint level is defined here --> $DIR/conditional_array_execution.rs:3:9 diff --git a/src/test/ui/consts/const-eval/const-eval-overflow-2.stderr b/src/test/ui/consts/const-eval/const-eval-overflow-2.stderr index 1c74b978827..cf50c19caa7 100644 --- a/src/test/ui/consts/const-eval/const-eval-overflow-2.stderr +++ b/src/test/ui/consts/const-eval/const-eval-overflow-2.stderr @@ -17,9 +17,7 @@ warning: any use of this value will cause an error --> $DIR/const-eval-overflow-2.rs:11:25 | LL | const NEG_NEG_128: i8 = -NEG_128; - | ------------------------^^^^^^^^- - | | - | attempt to negate `i8::MIN`, which would overflow + | --------------------- ^^^^^^^^ attempt to negate `i8::MIN`, which would overflow | note: the lint level is defined here --> $DIR/const-eval-overflow-2.rs:4:36 diff --git a/src/test/ui/consts/const-eval/const-eval-overflow2.stderr b/src/test/ui/consts/const-eval/const-eval-overflow2.stderr index 948ead521ea..dab9a76c7d4 100644 --- a/src/test/ui/consts/const-eval/const-eval-overflow2.stderr +++ b/src/test/ui/consts/const-eval/const-eval-overflow2.stderr @@ -1,12 +1,11 @@ error: any use of this value will cause an error --> $DIR/const-eval-overflow2.rs:14:6 | -LL | / const VALS_I8: (i8,) = -LL | | ( -LL | | i8::MIN - 1, - | | ^^^^^^^^^^^ attempt to compute `i8::MIN - 1_i8`, which would overflow -LL | | ); - | |_______- +LL | const VALS_I8: (i8,) = + | -------------------- +LL | ( +LL | i8::MIN - 1, + | ^^^^^^^^^^^ attempt to compute `i8::MIN - 1_i8`, which would overflow | note: the lint level is defined here --> $DIR/const-eval-overflow2.rs:8:9 @@ -19,12 +18,11 @@ LL | #![deny(const_err)] error: any use of this value will cause an error --> $DIR/const-eval-overflow2.rs:21:6 | -LL | / const VALS_I16: (i16,) = -LL | | ( -LL | | i16::MIN - 1, - | | ^^^^^^^^^^^^ attempt to compute `i16::MIN - 1_i16`, which would overflow -LL | | ); - | |_______- +LL | const VALS_I16: (i16,) = + | ---------------------- +LL | ( +LL | i16::MIN - 1, + | ^^^^^^^^^^^^ attempt to compute `i16::MIN - 1_i16`, which would overflow | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> @@ -32,12 +30,11 @@ LL | | ); error: any use of this value will cause an error --> $DIR/const-eval-overflow2.rs:28:6 | -LL | / const VALS_I32: (i32,) = -LL | | ( -LL | | i32::MIN - 1, - | | ^^^^^^^^^^^^ attempt to compute `i32::MIN - 1_i32`, which would overflow -LL | | ); - | |_______- +LL | const VALS_I32: (i32,) = + | ---------------------- +LL | ( +LL | i32::MIN - 1, + | ^^^^^^^^^^^^ attempt to compute `i32::MIN - 1_i32`, which would overflow | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> @@ -45,12 +42,11 @@ LL | | ); error: any use of this value will cause an error --> $DIR/const-eval-overflow2.rs:35:6 | -LL | / const VALS_I64: (i64,) = -LL | | ( -LL | | i64::MIN - 1, - | | ^^^^^^^^^^^^ attempt to compute `i64::MIN - 1_i64`, which would overflow -LL | | ); - | |_______- +LL | const VALS_I64: (i64,) = + | ---------------------- +LL | ( +LL | i64::MIN - 1, + | ^^^^^^^^^^^^ attempt to compute `i64::MIN - 1_i64`, which would overflow | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> @@ -58,12 +54,11 @@ LL | | ); error: any use of this value will cause an error --> $DIR/const-eval-overflow2.rs:42:6 | -LL | / const VALS_U8: (u8,) = -LL | | ( -LL | | u8::MIN - 1, - | | ^^^^^^^^^^^ attempt to compute `0_u8 - 1_u8`, which would overflow -LL | | ); - | |_______- +LL | const VALS_U8: (u8,) = + | -------------------- +LL | ( +LL | u8::MIN - 1, + | ^^^^^^^^^^^ attempt to compute `0_u8 - 1_u8`, which would overflow | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> @@ -71,11 +66,10 @@ LL | | ); error: any use of this value will cause an error --> $DIR/const-eval-overflow2.rs:48:6 | -LL | / const VALS_U16: (u16,) = ( -LL | | u16::MIN - 1, - | | ^^^^^^^^^^^^ attempt to compute `0_u16 - 1_u16`, which would overflow -LL | | ); - | |_______- +LL | const VALS_U16: (u16,) = ( + | ---------------------- +LL | u16::MIN - 1, + | ^^^^^^^^^^^^ attempt to compute `0_u16 - 1_u16`, which would overflow | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> @@ -83,11 +77,10 @@ LL | | ); error: any use of this value will cause an error --> $DIR/const-eval-overflow2.rs:54:6 | -LL | / const VALS_U32: (u32,) = ( -LL | | u32::MIN - 1, - | | ^^^^^^^^^^^^ attempt to compute `0_u32 - 1_u32`, which would overflow -LL | | ); - | |_______- +LL | const VALS_U32: (u32,) = ( + | ---------------------- +LL | u32::MIN - 1, + | ^^^^^^^^^^^^ attempt to compute `0_u32 - 1_u32`, which would overflow | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> @@ -95,12 +88,11 @@ LL | | ); error: any use of this value will cause an error --> $DIR/const-eval-overflow2.rs:61:6 | -LL | / const VALS_U64: (u64,) = -LL | | ( -LL | | u64::MIN - 1, - | | ^^^^^^^^^^^^ attempt to compute `0_u64 - 1_u64`, which would overflow -LL | | ); - | |_______- +LL | const VALS_U64: (u64,) = + | ---------------------- +LL | ( +LL | u64::MIN - 1, + | ^^^^^^^^^^^^ attempt to compute `0_u64 - 1_u64`, which would overflow | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> @@ -111,12 +103,11 @@ Future incompatibility report: Future breakage diagnostic: error: any use of this value will cause an error --> $DIR/const-eval-overflow2.rs:14:6 | -LL | / const VALS_I8: (i8,) = -LL | | ( -LL | | i8::MIN - 1, - | | ^^^^^^^^^^^ attempt to compute `i8::MIN - 1_i8`, which would overflow -LL | | ); - | |_______- +LL | const VALS_I8: (i8,) = + | -------------------- +LL | ( +LL | i8::MIN - 1, + | ^^^^^^^^^^^ attempt to compute `i8::MIN - 1_i8`, which would overflow | note: the lint level is defined here --> $DIR/const-eval-overflow2.rs:8:9 @@ -130,12 +121,11 @@ Future breakage diagnostic: error: any use of this value will cause an error --> $DIR/const-eval-overflow2.rs:21:6 | -LL | / const VALS_I16: (i16,) = -LL | | ( -LL | | i16::MIN - 1, - | | ^^^^^^^^^^^^ attempt to compute `i16::MIN - 1_i16`, which would overflow -LL | | ); - | |_______- +LL | const VALS_I16: (i16,) = + | ---------------------- +LL | ( +LL | i16::MIN - 1, + | ^^^^^^^^^^^^ attempt to compute `i16::MIN - 1_i16`, which would overflow | note: the lint level is defined here --> $DIR/const-eval-overflow2.rs:8:9 @@ -149,12 +139,11 @@ Future breakage diagnostic: error: any use of this value will cause an error --> $DIR/const-eval-overflow2.rs:28:6 | -LL | / const VALS_I32: (i32,) = -LL | | ( -LL | | i32::MIN - 1, - | | ^^^^^^^^^^^^ attempt to compute `i32::MIN - 1_i32`, which would overflow -LL | | ); - | |_______- +LL | const VALS_I32: (i32,) = + | ---------------------- +LL | ( +LL | i32::MIN - 1, + | ^^^^^^^^^^^^ attempt to compute `i32::MIN - 1_i32`, which would overflow | note: the lint level is defined here --> $DIR/const-eval-overflow2.rs:8:9 @@ -168,12 +157,11 @@ Future breakage diagnostic: error: any use of this value will cause an error --> $DIR/const-eval-overflow2.rs:35:6 | -LL | / const VALS_I64: (i64,) = -LL | | ( -LL | | i64::MIN - 1, - | | ^^^^^^^^^^^^ attempt to compute `i64::MIN - 1_i64`, which would overflow -LL | | ); - | |_______- +LL | const VALS_I64: (i64,) = + | ---------------------- +LL | ( +LL | i64::MIN - 1, + | ^^^^^^^^^^^^ attempt to compute `i64::MIN - 1_i64`, which would overflow | note: the lint level is defined here --> $DIR/const-eval-overflow2.rs:8:9 @@ -187,12 +175,11 @@ Future breakage diagnostic: error: any use of this value will cause an error --> $DIR/const-eval-overflow2.rs:42:6 | -LL | / const VALS_U8: (u8,) = -LL | | ( -LL | | u8::MIN - 1, - | | ^^^^^^^^^^^ attempt to compute `0_u8 - 1_u8`, which would overflow -LL | | ); - | |_______- +LL | const VALS_U8: (u8,) = + | -------------------- +LL | ( +LL | u8::MIN - 1, + | ^^^^^^^^^^^ attempt to compute `0_u8 - 1_u8`, which would overflow | note: the lint level is defined here --> $DIR/const-eval-overflow2.rs:8:9 @@ -206,11 +193,10 @@ Future breakage diagnostic: error: any use of this value will cause an error --> $DIR/const-eval-overflow2.rs:48:6 | -LL | / const VALS_U16: (u16,) = ( -LL | | u16::MIN - 1, - | | ^^^^^^^^^^^^ attempt to compute `0_u16 - 1_u16`, which would overflow -LL | | ); - | |_______- +LL | const VALS_U16: (u16,) = ( + | ---------------------- +LL | u16::MIN - 1, + | ^^^^^^^^^^^^ attempt to compute `0_u16 - 1_u16`, which would overflow | note: the lint level is defined here --> $DIR/const-eval-overflow2.rs:8:9 @@ -224,11 +210,10 @@ Future breakage diagnostic: error: any use of this value will cause an error --> $DIR/const-eval-overflow2.rs:54:6 | -LL | / const VALS_U32: (u32,) = ( -LL | | u32::MIN - 1, - | | ^^^^^^^^^^^^ attempt to compute `0_u32 - 1_u32`, which would overflow -LL | | ); - | |_______- +LL | const VALS_U32: (u32,) = ( + | ---------------------- +LL | u32::MIN - 1, + | ^^^^^^^^^^^^ attempt to compute `0_u32 - 1_u32`, which would overflow | note: the lint level is defined here --> $DIR/const-eval-overflow2.rs:8:9 @@ -242,12 +227,11 @@ Future breakage diagnostic: error: any use of this value will cause an error --> $DIR/const-eval-overflow2.rs:61:6 | -LL | / const VALS_U64: (u64,) = -LL | | ( -LL | | u64::MIN - 1, - | | ^^^^^^^^^^^^ attempt to compute `0_u64 - 1_u64`, which would overflow -LL | | ); - | |_______- +LL | const VALS_U64: (u64,) = + | ---------------------- +LL | ( +LL | u64::MIN - 1, + | ^^^^^^^^^^^^ attempt to compute `0_u64 - 1_u64`, which would overflow | note: the lint level is defined here --> $DIR/const-eval-overflow2.rs:8:9 diff --git a/src/test/ui/consts/const-eval/const-eval-overflow2b.stderr b/src/test/ui/consts/const-eval/const-eval-overflow2b.stderr index 5db6a49a98b..5fe9917437e 100644 --- a/src/test/ui/consts/const-eval/const-eval-overflow2b.stderr +++ b/src/test/ui/consts/const-eval/const-eval-overflow2b.stderr @@ -1,12 +1,11 @@ error: any use of this value will cause an error --> $DIR/const-eval-overflow2b.rs:14:6 | -LL | / const VALS_I8: (i8,) = -LL | | ( -LL | | i8::MAX + 1, - | | ^^^^^^^^^^^ attempt to compute `i8::MAX + 1_i8`, which would overflow -LL | | ); - | |_______- +LL | const VALS_I8: (i8,) = + | -------------------- +LL | ( +LL | i8::MAX + 1, + | ^^^^^^^^^^^ attempt to compute `i8::MAX + 1_i8`, which would overflow | note: the lint level is defined here --> $DIR/const-eval-overflow2b.rs:8:9 @@ -19,12 +18,11 @@ LL | #![deny(const_err)] error: any use of this value will cause an error --> $DIR/const-eval-overflow2b.rs:21:6 | -LL | / const VALS_I16: (i16,) = -LL | | ( -LL | | i16::MAX + 1, - | | ^^^^^^^^^^^^ attempt to compute `i16::MAX + 1_i16`, which would overflow -LL | | ); - | |_______- +LL | const VALS_I16: (i16,) = + | ---------------------- +LL | ( +LL | i16::MAX + 1, + | ^^^^^^^^^^^^ attempt to compute `i16::MAX + 1_i16`, which would overflow | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> @@ -32,12 +30,11 @@ LL | | ); error: any use of this value will cause an error --> $DIR/const-eval-overflow2b.rs:28:6 | -LL | / const VALS_I32: (i32,) = -LL | | ( -LL | | i32::MAX + 1, - | | ^^^^^^^^^^^^ attempt to compute `i32::MAX + 1_i32`, which would overflow -LL | | ); - | |_______- +LL | const VALS_I32: (i32,) = + | ---------------------- +LL | ( +LL | i32::MAX + 1, + | ^^^^^^^^^^^^ attempt to compute `i32::MAX + 1_i32`, which would overflow | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> @@ -45,12 +42,11 @@ LL | | ); error: any use of this value will cause an error --> $DIR/const-eval-overflow2b.rs:35:6 | -LL | / const VALS_I64: (i64,) = -LL | | ( -LL | | i64::MAX + 1, - | | ^^^^^^^^^^^^ attempt to compute `i64::MAX + 1_i64`, which would overflow -LL | | ); - | |_______- +LL | const VALS_I64: (i64,) = + | ---------------------- +LL | ( +LL | i64::MAX + 1, + | ^^^^^^^^^^^^ attempt to compute `i64::MAX + 1_i64`, which would overflow | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> @@ -58,12 +54,11 @@ LL | | ); error: any use of this value will cause an error --> $DIR/const-eval-overflow2b.rs:42:6 | -LL | / const VALS_U8: (u8,) = -LL | | ( -LL | | u8::MAX + 1, - | | ^^^^^^^^^^^ attempt to compute `u8::MAX + 1_u8`, which would overflow -LL | | ); - | |_______- +LL | const VALS_U8: (u8,) = + | -------------------- +LL | ( +LL | u8::MAX + 1, + | ^^^^^^^^^^^ attempt to compute `u8::MAX + 1_u8`, which would overflow | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> @@ -71,11 +66,10 @@ LL | | ); error: any use of this value will cause an error --> $DIR/const-eval-overflow2b.rs:48:6 | -LL | / const VALS_U16: (u16,) = ( -LL | | u16::MAX + 1, - | | ^^^^^^^^^^^^ attempt to compute `u16::MAX + 1_u16`, which would overflow -LL | | ); - | |_______- +LL | const VALS_U16: (u16,) = ( + | ---------------------- +LL | u16::MAX + 1, + | ^^^^^^^^^^^^ attempt to compute `u16::MAX + 1_u16`, which would overflow | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> @@ -83,11 +77,10 @@ LL | | ); error: any use of this value will cause an error --> $DIR/const-eval-overflow2b.rs:54:6 | -LL | / const VALS_U32: (u32,) = ( -LL | | u32::MAX + 1, - | | ^^^^^^^^^^^^ attempt to compute `u32::MAX + 1_u32`, which would overflow -LL | | ); - | |_______- +LL | const VALS_U32: (u32,) = ( + | ---------------------- +LL | u32::MAX + 1, + | ^^^^^^^^^^^^ attempt to compute `u32::MAX + 1_u32`, which would overflow | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> @@ -95,12 +88,11 @@ LL | | ); error: any use of this value will cause an error --> $DIR/const-eval-overflow2b.rs:61:6 | -LL | / const VALS_U64: (u64,) = -LL | | ( -LL | | u64::MAX + 1, - | | ^^^^^^^^^^^^ attempt to compute `u64::MAX + 1_u64`, which would overflow -LL | | ); - | |_______- +LL | const VALS_U64: (u64,) = + | ---------------------- +LL | ( +LL | u64::MAX + 1, + | ^^^^^^^^^^^^ attempt to compute `u64::MAX + 1_u64`, which would overflow | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> @@ -111,12 +103,11 @@ Future incompatibility report: Future breakage diagnostic: error: any use of this value will cause an error --> $DIR/const-eval-overflow2b.rs:14:6 | -LL | / const VALS_I8: (i8,) = -LL | | ( -LL | | i8::MAX + 1, - | | ^^^^^^^^^^^ attempt to compute `i8::MAX + 1_i8`, which would overflow -LL | | ); - | |_______- +LL | const VALS_I8: (i8,) = + | -------------------- +LL | ( +LL | i8::MAX + 1, + | ^^^^^^^^^^^ attempt to compute `i8::MAX + 1_i8`, which would overflow | note: the lint level is defined here --> $DIR/const-eval-overflow2b.rs:8:9 @@ -130,12 +121,11 @@ Future breakage diagnostic: error: any use of this value will cause an error --> $DIR/const-eval-overflow2b.rs:21:6 | -LL | / const VALS_I16: (i16,) = -LL | | ( -LL | | i16::MAX + 1, - | | ^^^^^^^^^^^^ attempt to compute `i16::MAX + 1_i16`, which would overflow -LL | | ); - | |_______- +LL | const VALS_I16: (i16,) = + | ---------------------- +LL | ( +LL | i16::MAX + 1, + | ^^^^^^^^^^^^ attempt to compute `i16::MAX + 1_i16`, which would overflow | note: the lint level is defined here --> $DIR/const-eval-overflow2b.rs:8:9 @@ -149,12 +139,11 @@ Future breakage diagnostic: error: any use of this value will cause an error --> $DIR/const-eval-overflow2b.rs:28:6 | -LL | / const VALS_I32: (i32,) = -LL | | ( -LL | | i32::MAX + 1, - | | ^^^^^^^^^^^^ attempt to compute `i32::MAX + 1_i32`, which would overflow -LL | | ); - | |_______- +LL | const VALS_I32: (i32,) = + | ---------------------- +LL | ( +LL | i32::MAX + 1, + | ^^^^^^^^^^^^ attempt to compute `i32::MAX + 1_i32`, which would overflow | note: the lint level is defined here --> $DIR/const-eval-overflow2b.rs:8:9 @@ -168,12 +157,11 @@ Future breakage diagnostic: error: any use of this value will cause an error --> $DIR/const-eval-overflow2b.rs:35:6 | -LL | / const VALS_I64: (i64,) = -LL | | ( -LL | | i64::MAX + 1, - | | ^^^^^^^^^^^^ attempt to compute `i64::MAX + 1_i64`, which would overflow -LL | | ); - | |_______- +LL | const VALS_I64: (i64,) = + | ---------------------- +LL | ( +LL | i64::MAX + 1, + | ^^^^^^^^^^^^ attempt to compute `i64::MAX + 1_i64`, which would overflow | note: the lint level is defined here --> $DIR/const-eval-overflow2b.rs:8:9 @@ -187,12 +175,11 @@ Future breakage diagnostic: error: any use of this value will cause an error --> $DIR/const-eval-overflow2b.rs:42:6 | -LL | / const VALS_U8: (u8,) = -LL | | ( -LL | | u8::MAX + 1, - | | ^^^^^^^^^^^ attempt to compute `u8::MAX + 1_u8`, which would overflow -LL | | ); - | |_______- +LL | const VALS_U8: (u8,) = + | -------------------- +LL | ( +LL | u8::MAX + 1, + | ^^^^^^^^^^^ attempt to compute `u8::MAX + 1_u8`, which would overflow | note: the lint level is defined here --> $DIR/const-eval-overflow2b.rs:8:9 @@ -206,11 +193,10 @@ Future breakage diagnostic: error: any use of this value will cause an error --> $DIR/const-eval-overflow2b.rs:48:6 | -LL | / const VALS_U16: (u16,) = ( -LL | | u16::MAX + 1, - | | ^^^^^^^^^^^^ attempt to compute `u16::MAX + 1_u16`, which would overflow -LL | | ); - | |_______- +LL | const VALS_U16: (u16,) = ( + | ---------------------- +LL | u16::MAX + 1, + | ^^^^^^^^^^^^ attempt to compute `u16::MAX + 1_u16`, which would overflow | note: the lint level is defined here --> $DIR/const-eval-overflow2b.rs:8:9 @@ -224,11 +210,10 @@ Future breakage diagnostic: error: any use of this value will cause an error --> $DIR/const-eval-overflow2b.rs:54:6 | -LL | / const VALS_U32: (u32,) = ( -LL | | u32::MAX + 1, - | | ^^^^^^^^^^^^ attempt to compute `u32::MAX + 1_u32`, which would overflow -LL | | ); - | |_______- +LL | const VALS_U32: (u32,) = ( + | ---------------------- +LL | u32::MAX + 1, + | ^^^^^^^^^^^^ attempt to compute `u32::MAX + 1_u32`, which would overflow | note: the lint level is defined here --> $DIR/const-eval-overflow2b.rs:8:9 @@ -242,12 +227,11 @@ Future breakage diagnostic: error: any use of this value will cause an error --> $DIR/const-eval-overflow2b.rs:61:6 | -LL | / const VALS_U64: (u64,) = -LL | | ( -LL | | u64::MAX + 1, - | | ^^^^^^^^^^^^ attempt to compute `u64::MAX + 1_u64`, which would overflow -LL | | ); - | |_______- +LL | const VALS_U64: (u64,) = + | ---------------------- +LL | ( +LL | u64::MAX + 1, + | ^^^^^^^^^^^^ attempt to compute `u64::MAX + 1_u64`, which would overflow | note: the lint level is defined here --> $DIR/const-eval-overflow2b.rs:8:9 diff --git a/src/test/ui/consts/const-eval/const-eval-overflow2c.stderr b/src/test/ui/consts/const-eval/const-eval-overflow2c.stderr index ec3f3c11059..d5f3a0fb1c3 100644 --- a/src/test/ui/consts/const-eval/const-eval-overflow2c.stderr +++ b/src/test/ui/consts/const-eval/const-eval-overflow2c.stderr @@ -1,12 +1,11 @@ error: any use of this value will cause an error --> $DIR/const-eval-overflow2c.rs:14:6 | -LL | / const VALS_I8: (i8,) = -LL | | ( -LL | | i8::MIN * 2, - | | ^^^^^^^^^^^ attempt to compute `i8::MIN * 2_i8`, which would overflow -LL | | ); - | |_______- +LL | const VALS_I8: (i8,) = + | -------------------- +LL | ( +LL | i8::MIN * 2, + | ^^^^^^^^^^^ attempt to compute `i8::MIN * 2_i8`, which would overflow | note: the lint level is defined here --> $DIR/const-eval-overflow2c.rs:8:9 @@ -19,12 +18,11 @@ LL | #![deny(const_err)] error: any use of this value will cause an error --> $DIR/const-eval-overflow2c.rs:21:6 | -LL | / const VALS_I16: (i16,) = -LL | | ( -LL | | i16::MIN * 2, - | | ^^^^^^^^^^^^ attempt to compute `i16::MIN * 2_i16`, which would overflow -LL | | ); - | |_______- +LL | const VALS_I16: (i16,) = + | ---------------------- +LL | ( +LL | i16::MIN * 2, + | ^^^^^^^^^^^^ attempt to compute `i16::MIN * 2_i16`, which would overflow | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> @@ -32,12 +30,11 @@ LL | | ); error: any use of this value will cause an error --> $DIR/const-eval-overflow2c.rs:28:6 | -LL | / const VALS_I32: (i32,) = -LL | | ( -LL | | i32::MIN * 2, - | | ^^^^^^^^^^^^ attempt to compute `i32::MIN * 2_i32`, which would overflow -LL | | ); - | |_______- +LL | const VALS_I32: (i32,) = + | ---------------------- +LL | ( +LL | i32::MIN * 2, + | ^^^^^^^^^^^^ attempt to compute `i32::MIN * 2_i32`, which would overflow | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> @@ -45,12 +42,11 @@ LL | | ); error: any use of this value will cause an error --> $DIR/const-eval-overflow2c.rs:35:6 | -LL | / const VALS_I64: (i64,) = -LL | | ( -LL | | i64::MIN * 2, - | | ^^^^^^^^^^^^ attempt to compute `i64::MIN * 2_i64`, which would overflow -LL | | ); - | |_______- +LL | const VALS_I64: (i64,) = + | ---------------------- +LL | ( +LL | i64::MIN * 2, + | ^^^^^^^^^^^^ attempt to compute `i64::MIN * 2_i64`, which would overflow | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> @@ -58,12 +54,11 @@ LL | | ); error: any use of this value will cause an error --> $DIR/const-eval-overflow2c.rs:42:6 | -LL | / const VALS_U8: (u8,) = -LL | | ( -LL | | u8::MAX * 2, - | | ^^^^^^^^^^^ attempt to compute `u8::MAX * 2_u8`, which would overflow -LL | | ); - | |_______- +LL | const VALS_U8: (u8,) = + | -------------------- +LL | ( +LL | u8::MAX * 2, + | ^^^^^^^^^^^ attempt to compute `u8::MAX * 2_u8`, which would overflow | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> @@ -71,11 +66,10 @@ LL | | ); error: any use of this value will cause an error --> $DIR/const-eval-overflow2c.rs:48:6 | -LL | / const VALS_U16: (u16,) = ( -LL | | u16::MAX * 2, - | | ^^^^^^^^^^^^ attempt to compute `u16::MAX * 2_u16`, which would overflow -LL | | ); - | |_______- +LL | const VALS_U16: (u16,) = ( + | ---------------------- +LL | u16::MAX * 2, + | ^^^^^^^^^^^^ attempt to compute `u16::MAX * 2_u16`, which would overflow | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> @@ -83,11 +77,10 @@ LL | | ); error: any use of this value will cause an error --> $DIR/const-eval-overflow2c.rs:54:6 | -LL | / const VALS_U32: (u32,) = ( -LL | | u32::MAX * 2, - | | ^^^^^^^^^^^^ attempt to compute `u32::MAX * 2_u32`, which would overflow -LL | | ); - | |_______- +LL | const VALS_U32: (u32,) = ( + | ---------------------- +LL | u32::MAX * 2, + | ^^^^^^^^^^^^ attempt to compute `u32::MAX * 2_u32`, which would overflow | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> @@ -95,12 +88,11 @@ LL | | ); error: any use of this value will cause an error --> $DIR/const-eval-overflow2c.rs:61:6 | -LL | / const VALS_U64: (u64,) = -LL | | ( -LL | | u64::MAX * 2, - | | ^^^^^^^^^^^^ attempt to compute `u64::MAX * 2_u64`, which would overflow -LL | | ); - | |_______- +LL | const VALS_U64: (u64,) = + | ---------------------- +LL | ( +LL | u64::MAX * 2, + | ^^^^^^^^^^^^ attempt to compute `u64::MAX * 2_u64`, which would overflow | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> @@ -111,12 +103,11 @@ Future incompatibility report: Future breakage diagnostic: error: any use of this value will cause an error --> $DIR/const-eval-overflow2c.rs:14:6 | -LL | / const VALS_I8: (i8,) = -LL | | ( -LL | | i8::MIN * 2, - | | ^^^^^^^^^^^ attempt to compute `i8::MIN * 2_i8`, which would overflow -LL | | ); - | |_______- +LL | const VALS_I8: (i8,) = + | -------------------- +LL | ( +LL | i8::MIN * 2, + | ^^^^^^^^^^^ attempt to compute `i8::MIN * 2_i8`, which would overflow | note: the lint level is defined here --> $DIR/const-eval-overflow2c.rs:8:9 @@ -130,12 +121,11 @@ Future breakage diagnostic: error: any use of this value will cause an error --> $DIR/const-eval-overflow2c.rs:21:6 | -LL | / const VALS_I16: (i16,) = -LL | | ( -LL | | i16::MIN * 2, - | | ^^^^^^^^^^^^ attempt to compute `i16::MIN * 2_i16`, which would overflow -LL | | ); - | |_______- +LL | const VALS_I16: (i16,) = + | ---------------------- +LL | ( +LL | i16::MIN * 2, + | ^^^^^^^^^^^^ attempt to compute `i16::MIN * 2_i16`, which would overflow | note: the lint level is defined here --> $DIR/const-eval-overflow2c.rs:8:9 @@ -149,12 +139,11 @@ Future breakage diagnostic: error: any use of this value will cause an error --> $DIR/const-eval-overflow2c.rs:28:6 | -LL | / const VALS_I32: (i32,) = -LL | | ( -LL | | i32::MIN * 2, - | | ^^^^^^^^^^^^ attempt to compute `i32::MIN * 2_i32`, which would overflow -LL | | ); - | |_______- +LL | const VALS_I32: (i32,) = + | ---------------------- +LL | ( +LL | i32::MIN * 2, + | ^^^^^^^^^^^^ attempt to compute `i32::MIN * 2_i32`, which would overflow | note: the lint level is defined here --> $DIR/const-eval-overflow2c.rs:8:9 @@ -168,12 +157,11 @@ Future breakage diagnostic: error: any use of this value will cause an error --> $DIR/const-eval-overflow2c.rs:35:6 | -LL | / const VALS_I64: (i64,) = -LL | | ( -LL | | i64::MIN * 2, - | | ^^^^^^^^^^^^ attempt to compute `i64::MIN * 2_i64`, which would overflow -LL | | ); - | |_______- +LL | const VALS_I64: (i64,) = + | ---------------------- +LL | ( +LL | i64::MIN * 2, + | ^^^^^^^^^^^^ attempt to compute `i64::MIN * 2_i64`, which would overflow | note: the lint level is defined here --> $DIR/const-eval-overflow2c.rs:8:9 @@ -187,12 +175,11 @@ Future breakage diagnostic: error: any use of this value will cause an error --> $DIR/const-eval-overflow2c.rs:42:6 | -LL | / const VALS_U8: (u8,) = -LL | | ( -LL | | u8::MAX * 2, - | | ^^^^^^^^^^^ attempt to compute `u8::MAX * 2_u8`, which would overflow -LL | | ); - | |_______- +LL | const VALS_U8: (u8,) = + | -------------------- +LL | ( +LL | u8::MAX * 2, + | ^^^^^^^^^^^ attempt to compute `u8::MAX * 2_u8`, which would overflow | note: the lint level is defined here --> $DIR/const-eval-overflow2c.rs:8:9 @@ -206,11 +193,10 @@ Future breakage diagnostic: error: any use of this value will cause an error --> $DIR/const-eval-overflow2c.rs:48:6 | -LL | / const VALS_U16: (u16,) = ( -LL | | u16::MAX * 2, - | | ^^^^^^^^^^^^ attempt to compute `u16::MAX * 2_u16`, which would overflow -LL | | ); - | |_______- +LL | const VALS_U16: (u16,) = ( + | ---------------------- +LL | u16::MAX * 2, + | ^^^^^^^^^^^^ attempt to compute `u16::MAX * 2_u16`, which would overflow | note: the lint level is defined here --> $DIR/const-eval-overflow2c.rs:8:9 @@ -224,11 +210,10 @@ Future breakage diagnostic: error: any use of this value will cause an error --> $DIR/const-eval-overflow2c.rs:54:6 | -LL | / const VALS_U32: (u32,) = ( -LL | | u32::MAX * 2, - | | ^^^^^^^^^^^^ attempt to compute `u32::MAX * 2_u32`, which would overflow -LL | | ); - | |_______- +LL | const VALS_U32: (u32,) = ( + | ---------------------- +LL | u32::MAX * 2, + | ^^^^^^^^^^^^ attempt to compute `u32::MAX * 2_u32`, which would overflow | note: the lint level is defined here --> $DIR/const-eval-overflow2c.rs:8:9 @@ -242,12 +227,11 @@ Future breakage diagnostic: error: any use of this value will cause an error --> $DIR/const-eval-overflow2c.rs:61:6 | -LL | / const VALS_U64: (u64,) = -LL | | ( -LL | | u64::MAX * 2, - | | ^^^^^^^^^^^^ attempt to compute `u64::MAX * 2_u64`, which would overflow -LL | | ); - | |_______- +LL | const VALS_U64: (u64,) = + | ---------------------- +LL | ( +LL | u64::MAX * 2, + | ^^^^^^^^^^^^ attempt to compute `u64::MAX * 2_u64`, which would overflow | note: the lint level is defined here --> $DIR/const-eval-overflow2c.rs:8:9 diff --git a/src/test/ui/consts/const-eval/const-eval-query-stack.stderr b/src/test/ui/consts/const-eval/const-eval-query-stack.stderr index bbec2a830e6..0ae7bfa86bc 100644 --- a/src/test/ui/consts/const-eval/const-eval-query-stack.stderr +++ b/src/test/ui/consts/const-eval/const-eval-query-stack.stderr @@ -2,9 +2,7 @@ warning: any use of this value will cause an error --> $DIR/const-eval-query-stack.rs:19:16 | LL | const X: i32 = 1 / 0; - | ---------------^^^^^- - | | - | attempt to divide `1_i32` by zero + | ------------ ^^^^^ attempt to divide `1_i32` by zero | note: the lint level is defined here --> $DIR/const-eval-query-stack.rs:18:8 @@ -40,9 +38,7 @@ warning: any use of this value will cause an error --> $DIR/const-eval-query-stack.rs:19:16 | LL | const X: i32 = 1 / 0; - | ---------------^^^^^- - | | - | attempt to divide `1_i32` by zero + | ------------ ^^^^^ attempt to divide `1_i32` by zero | note: the lint level is defined here --> $DIR/const-eval-query-stack.rs:18:8 diff --git a/src/test/ui/consts/const-eval/const-pointer-values-in-various-types.64bit.stderr b/src/test/ui/consts/const-eval/const-pointer-values-in-various-types.64bit.stderr index b004637fd83..655a7d52054 100644 --- a/src/test/ui/consts/const-eval/const-pointer-values-in-various-types.64bit.stderr +++ b/src/test/ui/consts/const-eval/const-pointer-values-in-various-types.64bit.stderr @@ -2,9 +2,7 @@ error: any use of this value will cause an error --> $DIR/const-pointer-values-in-various-types.rs:26:49 | LL | const I32_REF_USIZE_UNION: usize = unsafe { Nonsense { int_32_ref: &3 }.u }; - | --------------------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--- - | | - | unable to turn pointer into raw bytes + | -------------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | = note: `#[deny(const_err)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -14,9 +12,7 @@ error: any use of this value will cause an error --> $DIR/const-pointer-values-in-various-types.rs:30:43 | LL | const I32_REF_U8_UNION: u8 = unsafe { Nonsense { int_32_ref: &3 }.uint_8 }; - | --------------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--- - | | - | unable to turn pointer into raw bytes + | -------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> @@ -25,9 +21,7 @@ error: any use of this value will cause an error --> $DIR/const-pointer-values-in-various-types.rs:34:45 | LL | const I32_REF_U16_UNION: u16 = unsafe { Nonsense { int_32_ref: &3 }.uint_16 }; - | ----------------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--- - | | - | unable to turn pointer into raw bytes + | ---------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> @@ -36,9 +30,7 @@ error: any use of this value will cause an error --> $DIR/const-pointer-values-in-various-types.rs:38:45 | LL | const I32_REF_U32_UNION: u32 = unsafe { Nonsense { int_32_ref: &3 }.uint_32 }; - | ----------------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--- - | | - | unable to turn pointer into raw bytes + | ---------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> @@ -47,9 +39,7 @@ error: any use of this value will cause an error --> $DIR/const-pointer-values-in-various-types.rs:42:45 | LL | const I32_REF_U64_UNION: u64 = unsafe { Nonsense { int_32_ref: &3 }.uint_64 }; - | ----------------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--- - | | - | unable to turn pointer into raw bytes + | ---------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> @@ -58,7 +48,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/const-pointer-values-in-various-types.rs:46:5 | LL | const I32_REF_U128_UNION: u128 = unsafe { Nonsense { int_32_ref: &3 }.uint_128 }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered uninitialized bytes, but expected initialized bytes + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered uninitialized bytes, but expected initialized bytes | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 16, align: 8) { @@ -69,9 +59,7 @@ error: any use of this value will cause an error --> $DIR/const-pointer-values-in-various-types.rs:49:43 | LL | const I32_REF_I8_UNION: i8 = unsafe { Nonsense { int_32_ref: &3 }.int_8 }; - | --------------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--- - | | - | unable to turn pointer into raw bytes + | -------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> @@ -80,9 +68,7 @@ error: any use of this value will cause an error --> $DIR/const-pointer-values-in-various-types.rs:53:45 | LL | const I32_REF_I16_UNION: i16 = unsafe { Nonsense { int_32_ref: &3 }.int_16 }; - | ----------------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--- - | | - | unable to turn pointer into raw bytes + | ---------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> @@ -91,9 +77,7 @@ error: any use of this value will cause an error --> $DIR/const-pointer-values-in-various-types.rs:57:45 | LL | const I32_REF_I32_UNION: i32 = unsafe { Nonsense { int_32_ref: &3 }.int_32 }; - | ----------------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--- - | | - | unable to turn pointer into raw bytes + | ---------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> @@ -102,9 +86,7 @@ error: any use of this value will cause an error --> $DIR/const-pointer-values-in-various-types.rs:61:45 | LL | const I32_REF_I64_UNION: i64 = unsafe { Nonsense { int_32_ref: &3 }.int_64 }; - | ----------------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--- - | | - | unable to turn pointer into raw bytes + | ---------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> @@ -113,7 +95,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/const-pointer-values-in-various-types.rs:65:5 | LL | const I32_REF_I128_UNION: i128 = unsafe { Nonsense { int_32_ref: &3 }.int_128 }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered uninitialized bytes, but expected initialized bytes + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered uninitialized bytes, but expected initialized bytes | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 16, align: 8) { @@ -124,9 +106,7 @@ error: any use of this value will cause an error --> $DIR/const-pointer-values-in-various-types.rs:68:45 | LL | const I32_REF_F32_UNION: f32 = unsafe { Nonsense { int_32_ref: &3 }.float_32 }; - | ----------------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--- - | | - | unable to turn pointer into raw bytes + | ---------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> @@ -135,9 +115,7 @@ error: any use of this value will cause an error --> $DIR/const-pointer-values-in-various-types.rs:72:45 | LL | const I32_REF_F64_UNION: f64 = unsafe { Nonsense { int_32_ref: &3 }.float_64 }; - | ----------------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--- - | | - | unable to turn pointer into raw bytes + | ---------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> @@ -146,9 +124,7 @@ error: any use of this value will cause an error --> $DIR/const-pointer-values-in-various-types.rs:76:47 | LL | const I32_REF_BOOL_UNION: bool = unsafe { Nonsense { int_32_ref: &3 }.truthy_falsey }; - | ------------------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--- - | | - | unable to turn pointer into raw bytes + | ------------------------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> @@ -157,9 +133,7 @@ error: any use of this value will cause an error --> $DIR/const-pointer-values-in-various-types.rs:80:47 | LL | const I32_REF_CHAR_UNION: char = unsafe { Nonsense { int_32_ref: &3 }.character }; - | ------------------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--- - | | - | unable to turn pointer into raw bytes + | ------------------------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> @@ -168,9 +142,7 @@ error: any use of this value will cause an error --> $DIR/const-pointer-values-in-various-types.rs:84:39 | LL | const STR_U8_UNION: u8 = unsafe { Nonsense { stringy: "3" }.uint_8 }; - | ----------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--- - | | - | unable to turn pointer into raw bytes + | ---------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> @@ -179,9 +151,7 @@ error: any use of this value will cause an error --> $DIR/const-pointer-values-in-various-types.rs:88:41 | LL | const STR_U16_UNION: u16 = unsafe { Nonsense { stringy: "3" }.uint_16 }; - | ------------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--- - | | - | unable to turn pointer into raw bytes + | ------------------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> @@ -190,9 +160,7 @@ error: any use of this value will cause an error --> $DIR/const-pointer-values-in-various-types.rs:92:41 | LL | const STR_U32_UNION: u32 = unsafe { Nonsense { stringy: "3" }.uint_32 }; - | ------------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--- - | | - | unable to turn pointer into raw bytes + | ------------------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> @@ -201,9 +169,7 @@ error: any use of this value will cause an error --> $DIR/const-pointer-values-in-various-types.rs:96:41 | LL | const STR_U64_UNION: u64 = unsafe { Nonsense { stringy: "3" }.uint_64 }; - | ------------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--- - | | - | unable to turn pointer into raw bytes + | ------------------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> @@ -212,9 +178,7 @@ error: any use of this value will cause an error --> $DIR/const-pointer-values-in-various-types.rs:100:43 | LL | const STR_U128_UNION: u128 = unsafe { Nonsense { stringy: "3" }.uint_128 }; - | --------------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--- - | | - | unable to turn pointer into raw bytes + | -------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> @@ -223,9 +187,7 @@ error: any use of this value will cause an error --> $DIR/const-pointer-values-in-various-types.rs:104:39 | LL | const STR_I8_UNION: i8 = unsafe { Nonsense { stringy: "3" }.int_8 }; - | ----------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--- - | | - | unable to turn pointer into raw bytes + | ---------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> @@ -234,9 +196,7 @@ error: any use of this value will cause an error --> $DIR/const-pointer-values-in-various-types.rs:108:41 | LL | const STR_I16_UNION: i16 = unsafe { Nonsense { stringy: "3" }.int_16 }; - | ------------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--- - | | - | unable to turn pointer into raw bytes + | ------------------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> @@ -245,9 +205,7 @@ error: any use of this value will cause an error --> $DIR/const-pointer-values-in-various-types.rs:112:41 | LL | const STR_I32_UNION: i32 = unsafe { Nonsense { stringy: "3" }.int_32 }; - | ------------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--- - | | - | unable to turn pointer into raw bytes + | ------------------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> @@ -256,9 +214,7 @@ error: any use of this value will cause an error --> $DIR/const-pointer-values-in-various-types.rs:116:41 | LL | const STR_I64_UNION: i64 = unsafe { Nonsense { stringy: "3" }.int_64 }; - | ------------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--- - | | - | unable to turn pointer into raw bytes + | ------------------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> @@ -267,9 +223,7 @@ error: any use of this value will cause an error --> $DIR/const-pointer-values-in-various-types.rs:120:43 | LL | const STR_I128_UNION: i128 = unsafe { Nonsense { stringy: "3" }.int_128 }; - | --------------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--- - | | - | unable to turn pointer into raw bytes + | -------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> @@ -278,9 +232,7 @@ error: any use of this value will cause an error --> $DIR/const-pointer-values-in-various-types.rs:124:41 | LL | const STR_F32_UNION: f32 = unsafe { Nonsense { stringy: "3" }.float_32 }; - | ------------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--- - | | - | unable to turn pointer into raw bytes + | ------------------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> @@ -289,9 +241,7 @@ error: any use of this value will cause an error --> $DIR/const-pointer-values-in-various-types.rs:128:41 | LL | const STR_F64_UNION: f64 = unsafe { Nonsense { stringy: "3" }.float_64 }; - | ------------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--- - | | - | unable to turn pointer into raw bytes + | ------------------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> @@ -300,9 +250,7 @@ error: any use of this value will cause an error --> $DIR/const-pointer-values-in-various-types.rs:132:43 | LL | const STR_BOOL_UNION: bool = unsafe { Nonsense { stringy: "3" }.truthy_falsey }; - | --------------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--- - | | - | unable to turn pointer into raw bytes + | -------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> @@ -311,9 +259,7 @@ error: any use of this value will cause an error --> $DIR/const-pointer-values-in-various-types.rs:136:43 | LL | const STR_CHAR_UNION: char = unsafe { Nonsense { stringy: "3" }.character }; - | --------------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--- - | | - | unable to turn pointer into raw bytes + | -------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> @@ -326,9 +272,7 @@ error: any use of this value will cause an error --> $DIR/const-pointer-values-in-various-types.rs:26:49 | LL | const I32_REF_USIZE_UNION: usize = unsafe { Nonsense { int_32_ref: &3 }.u }; - | --------------------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--- - | | - | unable to turn pointer into raw bytes + | -------------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | = note: `#[deny(const_err)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -339,9 +283,7 @@ error: any use of this value will cause an error --> $DIR/const-pointer-values-in-various-types.rs:30:43 | LL | const I32_REF_U8_UNION: u8 = unsafe { Nonsense { int_32_ref: &3 }.uint_8 }; - | --------------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--- - | | - | unable to turn pointer into raw bytes + | -------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | = note: `#[deny(const_err)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -352,9 +294,7 @@ error: any use of this value will cause an error --> $DIR/const-pointer-values-in-various-types.rs:34:45 | LL | const I32_REF_U16_UNION: u16 = unsafe { Nonsense { int_32_ref: &3 }.uint_16 }; - | ----------------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--- - | | - | unable to turn pointer into raw bytes + | ---------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | = note: `#[deny(const_err)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -365,9 +305,7 @@ error: any use of this value will cause an error --> $DIR/const-pointer-values-in-various-types.rs:38:45 | LL | const I32_REF_U32_UNION: u32 = unsafe { Nonsense { int_32_ref: &3 }.uint_32 }; - | ----------------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--- - | | - | unable to turn pointer into raw bytes + | ---------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | = note: `#[deny(const_err)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -378,9 +316,7 @@ error: any use of this value will cause an error --> $DIR/const-pointer-values-in-various-types.rs:42:45 | LL | const I32_REF_U64_UNION: u64 = unsafe { Nonsense { int_32_ref: &3 }.uint_64 }; - | ----------------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--- - | | - | unable to turn pointer into raw bytes + | ---------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | = note: `#[deny(const_err)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -391,9 +327,7 @@ error: any use of this value will cause an error --> $DIR/const-pointer-values-in-various-types.rs:49:43 | LL | const I32_REF_I8_UNION: i8 = unsafe { Nonsense { int_32_ref: &3 }.int_8 }; - | --------------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--- - | | - | unable to turn pointer into raw bytes + | -------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | = note: `#[deny(const_err)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -404,9 +338,7 @@ error: any use of this value will cause an error --> $DIR/const-pointer-values-in-various-types.rs:53:45 | LL | const I32_REF_I16_UNION: i16 = unsafe { Nonsense { int_32_ref: &3 }.int_16 }; - | ----------------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--- - | | - | unable to turn pointer into raw bytes + | ---------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | = note: `#[deny(const_err)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -417,9 +349,7 @@ error: any use of this value will cause an error --> $DIR/const-pointer-values-in-various-types.rs:57:45 | LL | const I32_REF_I32_UNION: i32 = unsafe { Nonsense { int_32_ref: &3 }.int_32 }; - | ----------------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--- - | | - | unable to turn pointer into raw bytes + | ---------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | = note: `#[deny(const_err)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -430,9 +360,7 @@ error: any use of this value will cause an error --> $DIR/const-pointer-values-in-various-types.rs:61:45 | LL | const I32_REF_I64_UNION: i64 = unsafe { Nonsense { int_32_ref: &3 }.int_64 }; - | ----------------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--- - | | - | unable to turn pointer into raw bytes + | ---------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | = note: `#[deny(const_err)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -443,9 +371,7 @@ error: any use of this value will cause an error --> $DIR/const-pointer-values-in-various-types.rs:68:45 | LL | const I32_REF_F32_UNION: f32 = unsafe { Nonsense { int_32_ref: &3 }.float_32 }; - | ----------------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--- - | | - | unable to turn pointer into raw bytes + | ---------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | = note: `#[deny(const_err)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -456,9 +382,7 @@ error: any use of this value will cause an error --> $DIR/const-pointer-values-in-various-types.rs:72:45 | LL | const I32_REF_F64_UNION: f64 = unsafe { Nonsense { int_32_ref: &3 }.float_64 }; - | ----------------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--- - | | - | unable to turn pointer into raw bytes + | ---------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | = note: `#[deny(const_err)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -469,9 +393,7 @@ error: any use of this value will cause an error --> $DIR/const-pointer-values-in-various-types.rs:76:47 | LL | const I32_REF_BOOL_UNION: bool = unsafe { Nonsense { int_32_ref: &3 }.truthy_falsey }; - | ------------------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--- - | | - | unable to turn pointer into raw bytes + | ------------------------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | = note: `#[deny(const_err)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -482,9 +404,7 @@ error: any use of this value will cause an error --> $DIR/const-pointer-values-in-various-types.rs:80:47 | LL | const I32_REF_CHAR_UNION: char = unsafe { Nonsense { int_32_ref: &3 }.character }; - | ------------------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--- - | | - | unable to turn pointer into raw bytes + | ------------------------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | = note: `#[deny(const_err)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -495,9 +415,7 @@ error: any use of this value will cause an error --> $DIR/const-pointer-values-in-various-types.rs:84:39 | LL | const STR_U8_UNION: u8 = unsafe { Nonsense { stringy: "3" }.uint_8 }; - | ----------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--- - | | - | unable to turn pointer into raw bytes + | ---------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | = note: `#[deny(const_err)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -508,9 +426,7 @@ error: any use of this value will cause an error --> $DIR/const-pointer-values-in-various-types.rs:88:41 | LL | const STR_U16_UNION: u16 = unsafe { Nonsense { stringy: "3" }.uint_16 }; - | ------------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--- - | | - | unable to turn pointer into raw bytes + | ------------------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | = note: `#[deny(const_err)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -521,9 +437,7 @@ error: any use of this value will cause an error --> $DIR/const-pointer-values-in-various-types.rs:92:41 | LL | const STR_U32_UNION: u32 = unsafe { Nonsense { stringy: "3" }.uint_32 }; - | ------------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--- - | | - | unable to turn pointer into raw bytes + | ------------------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | = note: `#[deny(const_err)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -534,9 +448,7 @@ error: any use of this value will cause an error --> $DIR/const-pointer-values-in-various-types.rs:96:41 | LL | const STR_U64_UNION: u64 = unsafe { Nonsense { stringy: "3" }.uint_64 }; - | ------------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--- - | | - | unable to turn pointer into raw bytes + | ------------------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | = note: `#[deny(const_err)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -547,9 +459,7 @@ error: any use of this value will cause an error --> $DIR/const-pointer-values-in-various-types.rs:100:43 | LL | const STR_U128_UNION: u128 = unsafe { Nonsense { stringy: "3" }.uint_128 }; - | --------------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--- - | | - | unable to turn pointer into raw bytes + | -------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | = note: `#[deny(const_err)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -560,9 +470,7 @@ error: any use of this value will cause an error --> $DIR/const-pointer-values-in-various-types.rs:104:39 | LL | const STR_I8_UNION: i8 = unsafe { Nonsense { stringy: "3" }.int_8 }; - | ----------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--- - | | - | unable to turn pointer into raw bytes + | ---------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | = note: `#[deny(const_err)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -573,9 +481,7 @@ error: any use of this value will cause an error --> $DIR/const-pointer-values-in-various-types.rs:108:41 | LL | const STR_I16_UNION: i16 = unsafe { Nonsense { stringy: "3" }.int_16 }; - | ------------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--- - | | - | unable to turn pointer into raw bytes + | ------------------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | = note: `#[deny(const_err)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -586,9 +492,7 @@ error: any use of this value will cause an error --> $DIR/const-pointer-values-in-various-types.rs:112:41 | LL | const STR_I32_UNION: i32 = unsafe { Nonsense { stringy: "3" }.int_32 }; - | ------------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--- - | | - | unable to turn pointer into raw bytes + | ------------------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | = note: `#[deny(const_err)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -599,9 +503,7 @@ error: any use of this value will cause an error --> $DIR/const-pointer-values-in-various-types.rs:116:41 | LL | const STR_I64_UNION: i64 = unsafe { Nonsense { stringy: "3" }.int_64 }; - | ------------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--- - | | - | unable to turn pointer into raw bytes + | ------------------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | = note: `#[deny(const_err)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -612,9 +514,7 @@ error: any use of this value will cause an error --> $DIR/const-pointer-values-in-various-types.rs:120:43 | LL | const STR_I128_UNION: i128 = unsafe { Nonsense { stringy: "3" }.int_128 }; - | --------------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--- - | | - | unable to turn pointer into raw bytes + | -------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | = note: `#[deny(const_err)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -625,9 +525,7 @@ error: any use of this value will cause an error --> $DIR/const-pointer-values-in-various-types.rs:124:41 | LL | const STR_F32_UNION: f32 = unsafe { Nonsense { stringy: "3" }.float_32 }; - | ------------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--- - | | - | unable to turn pointer into raw bytes + | ------------------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | = note: `#[deny(const_err)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -638,9 +536,7 @@ error: any use of this value will cause an error --> $DIR/const-pointer-values-in-various-types.rs:128:41 | LL | const STR_F64_UNION: f64 = unsafe { Nonsense { stringy: "3" }.float_64 }; - | ------------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--- - | | - | unable to turn pointer into raw bytes + | ------------------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | = note: `#[deny(const_err)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -651,9 +547,7 @@ error: any use of this value will cause an error --> $DIR/const-pointer-values-in-various-types.rs:132:43 | LL | const STR_BOOL_UNION: bool = unsafe { Nonsense { stringy: "3" }.truthy_falsey }; - | --------------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--- - | | - | unable to turn pointer into raw bytes + | -------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | = note: `#[deny(const_err)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -664,9 +558,7 @@ error: any use of this value will cause an error --> $DIR/const-pointer-values-in-various-types.rs:136:43 | LL | const STR_CHAR_UNION: char = unsafe { Nonsense { stringy: "3" }.character }; - | --------------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--- - | | - | unable to turn pointer into raw bytes + | -------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | = note: `#[deny(const_err)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! diff --git a/src/test/ui/consts/const-eval/const_fn_ptr_fail2.stderr b/src/test/ui/consts/const-eval/const_fn_ptr_fail2.stderr index daf3d8927c1..f6ffa1ef296 100644 --- a/src/test/ui/consts/const-eval/const_fn_ptr_fail2.stderr +++ b/src/test/ui/consts/const-eval/const_fn_ptr_fail2.stderr @@ -33,7 +33,7 @@ LL | x(y) | inside `Y` at $DIR/const_fn_ptr_fail2.rs:15:18 ... LL | const Y: usize = bar(X, 2); // FIXME: should fail to typeck someday - | --------------------------- + | -------------- | note: the lint level is defined here --> $DIR/const_fn_ptr_fail2.rs:4:10 @@ -55,7 +55,7 @@ LL | x(y) | inside `Z` at $DIR/const_fn_ptr_fail2.rs:16:18 ... LL | const Z: usize = bar(double, 2); // FIXME: should fail to typeck someday - | -------------------------------- + | -------------- | note: the lint level is defined here --> $DIR/const_fn_ptr_fail2.rs:4:10 diff --git a/src/test/ui/consts/const-eval/erroneous-const.stderr b/src/test/ui/consts/const-eval/erroneous-const.stderr index 9057b58ded9..adfb4cc61cc 100644 --- a/src/test/ui/consts/const-eval/erroneous-const.stderr +++ b/src/test/ui/consts/const-eval/erroneous-const.stderr @@ -14,9 +14,7 @@ warning: any use of this value will cause an error --> $DIR/erroneous-const.rs:6:22 | LL | const VOID: () = [()][2]; - | -----------------^^^^^^^- - | | - | index out of bounds: the length is 1 but the index is 2 + | -------------- ^^^^^^^ index out of bounds: the length is 1 but the index is 2 | note: the lint level is defined here --> $DIR/erroneous-const.rs:2:9 @@ -46,9 +44,7 @@ warning: any use of this value will cause an error --> $DIR/erroneous-const.rs:6:22 | LL | const VOID: () = [()][2]; - | -----------------^^^^^^^- - | | - | index out of bounds: the length is 1 but the index is 2 + | -------------- ^^^^^^^ index out of bounds: the length is 1 but the index is 2 | note: the lint level is defined here --> $DIR/erroneous-const.rs:2:9 diff --git a/src/test/ui/consts/const-eval/erroneous-const2.stderr b/src/test/ui/consts/const-eval/erroneous-const2.stderr index bf6cc8410a7..e947d93e405 100644 --- a/src/test/ui/consts/const-eval/erroneous-const2.stderr +++ b/src/test/ui/consts/const-eval/erroneous-const2.stderr @@ -14,9 +14,7 @@ warning: any use of this value will cause an error --> $DIR/erroneous-const2.rs:6:22 | LL | const VOID: () = [()][2]; - | -----------------^^^^^^^- - | | - | index out of bounds: the length is 1 but the index is 2 + | -------------- ^^^^^^^ index out of bounds: the length is 1 but the index is 2 | note: the lint level is defined here --> $DIR/erroneous-const2.rs:2:9 @@ -40,9 +38,7 @@ warning: any use of this value will cause an error --> $DIR/erroneous-const2.rs:6:22 | LL | const VOID: () = [()][2]; - | -----------------^^^^^^^- - | | - | index out of bounds: the length is 1 but the index is 2 + | -------------- ^^^^^^^ index out of bounds: the length is 1 but the index is 2 | note: the lint level is defined here --> $DIR/erroneous-const2.rs:2:9 diff --git a/src/test/ui/consts/const-eval/heap/alloc_intrinsic_nontransient_fail.stderr b/src/test/ui/consts/const-eval/heap/alloc_intrinsic_nontransient_fail.stderr index adaa4716f15..00ab0dfc557 100644 --- a/src/test/ui/consts/const-eval/heap/alloc_intrinsic_nontransient_fail.stderr +++ b/src/test/ui/consts/const-eval/heap/alloc_intrinsic_nontransient_fail.stderr @@ -2,7 +2,7 @@ error: untyped pointers are not allowed in constant --> $DIR/alloc_intrinsic_nontransient_fail.rs:6:1 | LL | const FOO: *const i32 = foo(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/consts/const-eval/heap/alloc_intrinsic_uninit.32bit.stderr b/src/test/ui/consts/const-eval/heap/alloc_intrinsic_uninit.32bit.stderr index 2ec058806ce..f1a780926e7 100644 --- a/src/test/ui/consts/const-eval/heap/alloc_intrinsic_uninit.32bit.stderr +++ b/src/test/ui/consts/const-eval/heap/alloc_intrinsic_uninit.32bit.stderr @@ -2,7 +2,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/alloc_intrinsic_uninit.rs:8:1 | LL | const BAR: &i32 = unsafe { &*(intrinsics::const_allocate(4, 4) as *mut i32) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed at .<deref>: encountered uninitialized bytes, but expected initialized bytes + | ^^^^^^^^^^^^^^^ constructing invalid value at .<deref>: encountered uninitialized bytes, but expected initialized bytes | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 4, align: 4) { diff --git a/src/test/ui/consts/const-eval/heap/alloc_intrinsic_uninit.64bit.stderr b/src/test/ui/consts/const-eval/heap/alloc_intrinsic_uninit.64bit.stderr index 5144378dba2..2eb401226f8 100644 --- a/src/test/ui/consts/const-eval/heap/alloc_intrinsic_uninit.64bit.stderr +++ b/src/test/ui/consts/const-eval/heap/alloc_intrinsic_uninit.64bit.stderr @@ -2,7 +2,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/alloc_intrinsic_uninit.rs:8:1 | LL | const BAR: &i32 = unsafe { &*(intrinsics::const_allocate(4, 4) as *mut i32) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed at .<deref>: encountered uninitialized bytes, but expected initialized bytes + | ^^^^^^^^^^^^^^^ constructing invalid value at .<deref>: encountered uninitialized bytes, but expected initialized bytes | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 8, align: 8) { diff --git a/src/test/ui/consts/const-eval/heap/alloc_intrinsic_untyped.stderr b/src/test/ui/consts/const-eval/heap/alloc_intrinsic_untyped.stderr index 8f4fea96c59..36002b850b7 100644 --- a/src/test/ui/consts/const-eval/heap/alloc_intrinsic_untyped.stderr +++ b/src/test/ui/consts/const-eval/heap/alloc_intrinsic_untyped.stderr @@ -2,7 +2,7 @@ error: untyped pointers are not allowed in constant --> $DIR/alloc_intrinsic_untyped.rs:6:1 | LL | const BAR: *mut i32 = unsafe { intrinsics::const_allocate(4, 4) as *mut i32}; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/consts/const-eval/index-out-of-bounds-never-type.stderr b/src/test/ui/consts/const-eval/index-out-of-bounds-never-type.stderr index 7b3e46fccca..da4a21e08ab 100644 --- a/src/test/ui/consts/const-eval/index-out-of-bounds-never-type.stderr +++ b/src/test/ui/consts/const-eval/index-out-of-bounds-never-type.stderr @@ -2,9 +2,7 @@ warning: any use of this value will cause an error --> $DIR/index-out-of-bounds-never-type.rs:10:61 | LL | const VOID: ! = { let x = 0 * std::mem::size_of::<T>(); [][x] }; - | --------------------------------------------------------^^^^^--- - | | - | index out of bounds: the length is 0 but the index is 0 + | ------------- ^^^^^ index out of bounds: the length is 0 but the index is 0 | note: the lint level is defined here --> $DIR/index-out-of-bounds-never-type.rs:4:9 @@ -27,9 +25,7 @@ warning: any use of this value will cause an error --> $DIR/index-out-of-bounds-never-type.rs:10:61 | LL | const VOID: ! = { let x = 0 * std::mem::size_of::<T>(); [][x] }; - | --------------------------------------------------------^^^^^--- - | | - | index out of bounds: the length is 0 but the index is 0 + | ------------- ^^^^^ index out of bounds: the length is 0 but the index is 0 | note: the lint level is defined here --> $DIR/index-out-of-bounds-never-type.rs:4:9 diff --git a/src/test/ui/consts/const-eval/issue-43197.stderr b/src/test/ui/consts/const-eval/issue-43197.stderr index 53ed32638ce..91065f41682 100644 --- a/src/test/ui/consts/const-eval/issue-43197.stderr +++ b/src/test/ui/consts/const-eval/issue-43197.stderr @@ -2,9 +2,7 @@ warning: any use of this value will cause an error --> $DIR/issue-43197.rs:10:20 | LL | const X: u32 = 0 - 1; - | ---------------^^^^^- - | | - | attempt to compute `0_u32 - 1_u32`, which would overflow + | ------------ ^^^^^ attempt to compute `0_u32 - 1_u32`, which would overflow | note: the lint level is defined here --> $DIR/issue-43197.rs:3:9 @@ -18,9 +16,7 @@ warning: any use of this value will cause an error --> $DIR/issue-43197.rs:13:24 | LL | const Y: u32 = foo(0 - 1); - | -------------------^^^^^-- - | | - | attempt to compute `0_u32 - 1_u32`, which would overflow + | ------------ ^^^^^ attempt to compute `0_u32 - 1_u32`, which would overflow | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> @@ -65,9 +61,7 @@ warning: any use of this value will cause an error --> $DIR/issue-43197.rs:10:20 | LL | const X: u32 = 0 - 1; - | ---------------^^^^^- - | | - | attempt to compute `0_u32 - 1_u32`, which would overflow + | ------------ ^^^^^ attempt to compute `0_u32 - 1_u32`, which would overflow | note: the lint level is defined here --> $DIR/issue-43197.rs:3:9 @@ -82,9 +76,7 @@ warning: any use of this value will cause an error --> $DIR/issue-43197.rs:13:24 | LL | const Y: u32 = foo(0 - 1); - | -------------------^^^^^-- - | | - | attempt to compute `0_u32 - 1_u32`, which would overflow + | ------------ ^^^^^ attempt to compute `0_u32 - 1_u32`, which would overflow | note: the lint level is defined here --> $DIR/issue-43197.rs:3:9 diff --git a/src/test/ui/consts/const-eval/issue-44578.stderr b/src/test/ui/consts/const-eval/issue-44578.stderr index 5ecdb7ef556..81e563b4f54 100644 --- a/src/test/ui/consts/const-eval/issue-44578.stderr +++ b/src/test/ui/consts/const-eval/issue-44578.stderr @@ -12,9 +12,7 @@ warning: any use of this value will cause an error --> $DIR/issue-44578.rs:15:24 | LL | const AMT: usize = [A::AMT][(A::AMT > B::AMT) as usize]; - | -------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- - | | - | index out of bounds: the length is 1 but the index is 1 + | ---------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ index out of bounds: the length is 1 but the index is 1 | note: the lint level is defined here --> $DIR/issue-44578.rs:3:10 diff --git a/src/test/ui/consts/const-eval/issue-50814-2.stderr b/src/test/ui/consts/const-eval/issue-50814-2.stderr index 67af3b2b1d3..cc19caca724 100644 --- a/src/test/ui/consts/const-eval/issue-50814-2.stderr +++ b/src/test/ui/consts/const-eval/issue-50814-2.stderr @@ -2,9 +2,7 @@ error: any use of this value will cause an error --> $DIR/issue-50814-2.rs:14:24 | LL | const BAR: usize = [5, 6, 7][T::BOO]; - | -------------------^^^^^^^^^^^^^^^^^- - | | - | index out of bounds: the length is 3 but the index is 42 + | ---------------- ^^^^^^^^^^^^^^^^^ index out of bounds: the length is 3 but the index is 42 | = note: `#[deny(const_err)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -30,9 +28,7 @@ error: any use of this value will cause an error --> $DIR/issue-50814-2.rs:14:24 | LL | const BAR: usize = [5, 6, 7][T::BOO]; - | -------------------^^^^^^^^^^^^^^^^^- - | | - | index out of bounds: the length is 3 but the index is 42 + | ---------------- ^^^^^^^^^^^^^^^^^ index out of bounds: the length is 3 but the index is 42 | = note: `#[deny(const_err)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! diff --git a/src/test/ui/consts/const-eval/issue-50814.stderr b/src/test/ui/consts/const-eval/issue-50814.stderr index b82bc9ca2f8..6ceef91a042 100644 --- a/src/test/ui/consts/const-eval/issue-50814.stderr +++ b/src/test/ui/consts/const-eval/issue-50814.stderr @@ -2,9 +2,7 @@ error: any use of this value will cause an error --> $DIR/issue-50814.rs:15:21 | LL | const MAX: u8 = A::MAX + B::MAX; - | ----------------^^^^^^^^^^^^^^^- - | | - | attempt to compute `u8::MAX + u8::MAX`, which would overflow + | ------------- ^^^^^^^^^^^^^^^ attempt to compute `u8::MAX + u8::MAX`, which would overflow | = note: `#[deny(const_err)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -30,9 +28,7 @@ error: any use of this value will cause an error --> $DIR/issue-50814.rs:15:21 | LL | const MAX: u8 = A::MAX + B::MAX; - | ----------------^^^^^^^^^^^^^^^- - | | - | attempt to compute `u8::MAX + u8::MAX`, which would overflow + | ------------- ^^^^^^^^^^^^^^^ attempt to compute `u8::MAX + u8::MAX`, which would overflow | = note: `#[deny(const_err)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! diff --git a/src/test/ui/consts/const-eval/issue-85907.rs b/src/test/ui/consts/const-eval/issue-85907.rs new file mode 100644 index 00000000000..6ae40ae6ddb --- /dev/null +++ b/src/test/ui/consts/const-eval/issue-85907.rs @@ -0,0 +1,7 @@ +const fn hey() -> usize { + panic!(123); //~ ERROR argument to `panic!()` in a const context must have type `&str` +} + +fn main() { + let _: [u8; hey()] = todo!(); +} diff --git a/src/test/ui/consts/const-eval/issue-85907.stderr b/src/test/ui/consts/const-eval/issue-85907.stderr new file mode 100644 index 00000000000..381f2fd1114 --- /dev/null +++ b/src/test/ui/consts/const-eval/issue-85907.stderr @@ -0,0 +1,10 @@ +error: argument to `panic!()` in a const context must have type `&str` + --> $DIR/issue-85907.rs:2:5 + | +LL | panic!(123); + | ^^^^^^^^^^^ + | + = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: aborting due to previous error + diff --git a/src/test/ui/consts/const-eval/partial_ptr_overwrite.stderr b/src/test/ui/consts/const-eval/partial_ptr_overwrite.stderr index 1a7d3861420..b007dda246d 100644 --- a/src/test/ui/consts/const-eval/partial_ptr_overwrite.stderr +++ b/src/test/ui/consts/const-eval/partial_ptr_overwrite.stderr @@ -1,16 +1,11 @@ error: any use of this value will cause an error --> $DIR/partial_ptr_overwrite.rs:8:9 | -LL | / const PARTIAL_OVERWRITE: () = { -LL | | let mut p = &42; -LL | | unsafe { -LL | | let ptr: *mut _ = &mut p; -LL | | *(ptr as *mut u8) = 123; - | | ^^^^^^^^^^^^^^^^^^^^^^^ unable to overwrite parts of a pointer in memory at alloc4 -... | -LL | | let x = *p; -LL | | }; - | |__- +LL | const PARTIAL_OVERWRITE: () = { + | --------------------------- +... +LL | *(ptr as *mut u8) = 123; + | ^^^^^^^^^^^^^^^^^^^^^^^ unable to overwrite parts of a pointer in memory at alloc4 | = note: `#[deny(const_err)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -22,16 +17,11 @@ Future incompatibility report: Future breakage diagnostic: error: any use of this value will cause an error --> $DIR/partial_ptr_overwrite.rs:8:9 | -LL | / const PARTIAL_OVERWRITE: () = { -LL | | let mut p = &42; -LL | | unsafe { -LL | | let ptr: *mut _ = &mut p; -LL | | *(ptr as *mut u8) = 123; - | | ^^^^^^^^^^^^^^^^^^^^^^^ unable to overwrite parts of a pointer in memory at alloc4 -... | -LL | | let x = *p; -LL | | }; - | |__- +LL | const PARTIAL_OVERWRITE: () = { + | --------------------------- +... +LL | *(ptr as *mut u8) = 123; + | ^^^^^^^^^^^^^^^^^^^^^^^ unable to overwrite parts of a pointer in memory at alloc4 | = note: `#[deny(const_err)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! diff --git a/src/test/ui/consts/const-eval/promoted_errors.noopt.stderr b/src/test/ui/consts/const-eval/promoted_errors.noopt.stderr index be845339dfe..cfca8ef0746 100644 --- a/src/test/ui/consts/const-eval/promoted_errors.noopt.stderr +++ b/src/test/ui/consts/const-eval/promoted_errors.noopt.stderr @@ -43,21 +43,15 @@ LL | [1, 2, 3][4] warning: any use of this value will cause an error --> $DIR/promoted_errors.rs:15:5 | -LL | 0 - 1 - | ^^^^^ - | | - | attempt to compute `0_u32 - 1_u32`, which would overflow - | inside `overflow` at $DIR/promoted_errors.rs:15:5 - | inside `X` at $DIR/promoted_errors.rs:43:29 +LL | 0 - 1 + | ^^^^^ + | | + | attempt to compute `0_u32 - 1_u32`, which would overflow + | inside `overflow` at $DIR/promoted_errors.rs:15:5 + | inside `X` at $DIR/promoted_errors.rs:43:29 ... -LL | / const X: () = { -LL | | let _x: &'static u32 = &overflow(); -LL | | -LL | | -... | -LL | | let _x: &'static i32 = &oob(); -LL | | }; - | |__- +LL | const X: () = { + | ----------- | note: the lint level is defined here --> $DIR/promoted_errors.rs:11:9 @@ -70,15 +64,10 @@ LL | #![warn(const_err, arithmetic_overflow, unconditional_panic)] warning: any use of this value will cause an error --> $DIR/promoted_errors.rs:43:28 | -LL | / const X: () = { -LL | | let _x: &'static u32 = &overflow(); - | | ^^^^^^^^^^^ referenced constant has errors -LL | | -LL | | -... | -LL | | let _x: &'static i32 = &oob(); -LL | | }; - | |__- +LL | const X: () = { + | ----------- +LL | let _x: &'static u32 = &overflow(); + | ^^^^^^^^^^^ referenced constant has errors | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> @@ -89,21 +78,15 @@ Future incompatibility report: Future breakage diagnostic: warning: any use of this value will cause an error --> $DIR/promoted_errors.rs:15:5 | -LL | 0 - 1 - | ^^^^^ - | | - | attempt to compute `0_u32 - 1_u32`, which would overflow - | inside `overflow` at $DIR/promoted_errors.rs:15:5 - | inside `X` at $DIR/promoted_errors.rs:43:29 +LL | 0 - 1 + | ^^^^^ + | | + | attempt to compute `0_u32 - 1_u32`, which would overflow + | inside `overflow` at $DIR/promoted_errors.rs:15:5 + | inside `X` at $DIR/promoted_errors.rs:43:29 ... -LL | / const X: () = { -LL | | let _x: &'static u32 = &overflow(); -LL | | -LL | | -... | -LL | | let _x: &'static i32 = &oob(); -LL | | }; - | |__- +LL | const X: () = { + | ----------- | note: the lint level is defined here --> $DIR/promoted_errors.rs:11:9 @@ -117,15 +100,10 @@ Future breakage diagnostic: warning: any use of this value will cause an error --> $DIR/promoted_errors.rs:43:28 | -LL | / const X: () = { -LL | | let _x: &'static u32 = &overflow(); - | | ^^^^^^^^^^^ referenced constant has errors -LL | | -LL | | -... | -LL | | let _x: &'static i32 = &oob(); -LL | | }; - | |__- +LL | const X: () = { + | ----------- +LL | let _x: &'static u32 = &overflow(); + | ^^^^^^^^^^^ referenced constant has errors | note: the lint level is defined here --> $DIR/promoted_errors.rs:11:9 diff --git a/src/test/ui/consts/const-eval/promoted_errors.opt.stderr b/src/test/ui/consts/const-eval/promoted_errors.opt.stderr index c91d52336c3..984484a850f 100644 --- a/src/test/ui/consts/const-eval/promoted_errors.opt.stderr +++ b/src/test/ui/consts/const-eval/promoted_errors.opt.stderr @@ -43,21 +43,15 @@ LL | [1, 2, 3][4] warning: any use of this value will cause an error --> $DIR/promoted_errors.rs:21:5 | -LL | 1 / 0 - | ^^^^^ - | | - | attempt to divide `1_i32` by zero - | inside `div_by_zero1` at $DIR/promoted_errors.rs:21:5 - | inside `X` at $DIR/promoted_errors.rs:46:29 +LL | 1 / 0 + | ^^^^^ + | | + | attempt to divide `1_i32` by zero + | inside `div_by_zero1` at $DIR/promoted_errors.rs:21:5 + | inside `X` at $DIR/promoted_errors.rs:46:29 ... -LL | / const X: () = { -LL | | let _x: &'static u32 = &overflow(); -LL | | -LL | | -... | -LL | | let _x: &'static i32 = &oob(); -LL | | }; - | |__- +LL | const X: () = { + | ----------- | note: the lint level is defined here --> $DIR/promoted_errors.rs:11:9 @@ -70,16 +64,11 @@ LL | #![warn(const_err, arithmetic_overflow, unconditional_panic)] warning: any use of this value will cause an error --> $DIR/promoted_errors.rs:46:28 | -LL | / const X: () = { -LL | | let _x: &'static u32 = &overflow(); -LL | | -LL | | -LL | | let _x: &'static i32 = &div_by_zero1(); - | | ^^^^^^^^^^^^^^^ referenced constant has errors -... | -LL | | let _x: &'static i32 = &oob(); -LL | | }; - | |__- +LL | const X: () = { + | ----------- +... +LL | let _x: &'static i32 = &div_by_zero1(); + | ^^^^^^^^^^^^^^^ referenced constant has errors | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> @@ -90,21 +79,15 @@ Future incompatibility report: Future breakage diagnostic: warning: any use of this value will cause an error --> $DIR/promoted_errors.rs:21:5 | -LL | 1 / 0 - | ^^^^^ - | | - | attempt to divide `1_i32` by zero - | inside `div_by_zero1` at $DIR/promoted_errors.rs:21:5 - | inside `X` at $DIR/promoted_errors.rs:46:29 +LL | 1 / 0 + | ^^^^^ + | | + | attempt to divide `1_i32` by zero + | inside `div_by_zero1` at $DIR/promoted_errors.rs:21:5 + | inside `X` at $DIR/promoted_errors.rs:46:29 ... -LL | / const X: () = { -LL | | let _x: &'static u32 = &overflow(); -LL | | -LL | | -... | -LL | | let _x: &'static i32 = &oob(); -LL | | }; - | |__- +LL | const X: () = { + | ----------- | note: the lint level is defined here --> $DIR/promoted_errors.rs:11:9 @@ -118,16 +101,11 @@ Future breakage diagnostic: warning: any use of this value will cause an error --> $DIR/promoted_errors.rs:46:28 | -LL | / const X: () = { -LL | | let _x: &'static u32 = &overflow(); -LL | | -LL | | -LL | | let _x: &'static i32 = &div_by_zero1(); - | | ^^^^^^^^^^^^^^^ referenced constant has errors -... | -LL | | let _x: &'static i32 = &oob(); -LL | | }; - | |__- +LL | const X: () = { + | ----------- +... +LL | let _x: &'static i32 = &div_by_zero1(); + | ^^^^^^^^^^^^^^^ referenced constant has errors | note: the lint level is defined here --> $DIR/promoted_errors.rs:11:9 diff --git a/src/test/ui/consts/const-eval/promoted_errors.opt_with_overflow_checks.stderr b/src/test/ui/consts/const-eval/promoted_errors.opt_with_overflow_checks.stderr index be845339dfe..cfca8ef0746 100644 --- a/src/test/ui/consts/const-eval/promoted_errors.opt_with_overflow_checks.stderr +++ b/src/test/ui/consts/const-eval/promoted_errors.opt_with_overflow_checks.stderr @@ -43,21 +43,15 @@ LL | [1, 2, 3][4] warning: any use of this value will cause an error --> $DIR/promoted_errors.rs:15:5 | -LL | 0 - 1 - | ^^^^^ - | | - | attempt to compute `0_u32 - 1_u32`, which would overflow - | inside `overflow` at $DIR/promoted_errors.rs:15:5 - | inside `X` at $DIR/promoted_errors.rs:43:29 +LL | 0 - 1 + | ^^^^^ + | | + | attempt to compute `0_u32 - 1_u32`, which would overflow + | inside `overflow` at $DIR/promoted_errors.rs:15:5 + | inside `X` at $DIR/promoted_errors.rs:43:29 ... -LL | / const X: () = { -LL | | let _x: &'static u32 = &overflow(); -LL | | -LL | | -... | -LL | | let _x: &'static i32 = &oob(); -LL | | }; - | |__- +LL | const X: () = { + | ----------- | note: the lint level is defined here --> $DIR/promoted_errors.rs:11:9 @@ -70,15 +64,10 @@ LL | #![warn(const_err, arithmetic_overflow, unconditional_panic)] warning: any use of this value will cause an error --> $DIR/promoted_errors.rs:43:28 | -LL | / const X: () = { -LL | | let _x: &'static u32 = &overflow(); - | | ^^^^^^^^^^^ referenced constant has errors -LL | | -LL | | -... | -LL | | let _x: &'static i32 = &oob(); -LL | | }; - | |__- +LL | const X: () = { + | ----------- +LL | let _x: &'static u32 = &overflow(); + | ^^^^^^^^^^^ referenced constant has errors | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> @@ -89,21 +78,15 @@ Future incompatibility report: Future breakage diagnostic: warning: any use of this value will cause an error --> $DIR/promoted_errors.rs:15:5 | -LL | 0 - 1 - | ^^^^^ - | | - | attempt to compute `0_u32 - 1_u32`, which would overflow - | inside `overflow` at $DIR/promoted_errors.rs:15:5 - | inside `X` at $DIR/promoted_errors.rs:43:29 +LL | 0 - 1 + | ^^^^^ + | | + | attempt to compute `0_u32 - 1_u32`, which would overflow + | inside `overflow` at $DIR/promoted_errors.rs:15:5 + | inside `X` at $DIR/promoted_errors.rs:43:29 ... -LL | / const X: () = { -LL | | let _x: &'static u32 = &overflow(); -LL | | -LL | | -... | -LL | | let _x: &'static i32 = &oob(); -LL | | }; - | |__- +LL | const X: () = { + | ----------- | note: the lint level is defined here --> $DIR/promoted_errors.rs:11:9 @@ -117,15 +100,10 @@ Future breakage diagnostic: warning: any use of this value will cause an error --> $DIR/promoted_errors.rs:43:28 | -LL | / const X: () = { -LL | | let _x: &'static u32 = &overflow(); - | | ^^^^^^^^^^^ referenced constant has errors -LL | | -LL | | -... | -LL | | let _x: &'static i32 = &oob(); -LL | | }; - | |__- +LL | const X: () = { + | ----------- +LL | let _x: &'static u32 = &overflow(); + | ^^^^^^^^^^^ referenced constant has errors | note: the lint level is defined here --> $DIR/promoted_errors.rs:11:9 diff --git a/src/test/ui/consts/const-eval/pub_const_err.stderr b/src/test/ui/consts/const-eval/pub_const_err.stderr index 56d66827626..36197a7ab59 100644 --- a/src/test/ui/consts/const-eval/pub_const_err.stderr +++ b/src/test/ui/consts/const-eval/pub_const_err.stderr @@ -2,9 +2,7 @@ warning: any use of this value will cause an error --> $DIR/pub_const_err.rs:6:20 | LL | pub const Z: u32 = 0 - 1; - | -------------------^^^^^- - | | - | attempt to compute `0_u32 - 1_u32`, which would overflow + | ---------------- ^^^^^ attempt to compute `0_u32 - 1_u32`, which would overflow | note: the lint level is defined here --> $DIR/pub_const_err.rs:2:9 @@ -21,9 +19,7 @@ warning: any use of this value will cause an error --> $DIR/pub_const_err.rs:6:20 | LL | pub const Z: u32 = 0 - 1; - | -------------------^^^^^- - | | - | attempt to compute `0_u32 - 1_u32`, which would overflow + | ---------------- ^^^^^ attempt to compute `0_u32 - 1_u32`, which would overflow | note: the lint level is defined here --> $DIR/pub_const_err.rs:2:9 diff --git a/src/test/ui/consts/const-eval/pub_const_err_bin.stderr b/src/test/ui/consts/const-eval/pub_const_err_bin.stderr index 202ea781e97..2eef3b8f5c4 100644 --- a/src/test/ui/consts/const-eval/pub_const_err_bin.stderr +++ b/src/test/ui/consts/const-eval/pub_const_err_bin.stderr @@ -2,9 +2,7 @@ warning: any use of this value will cause an error --> $DIR/pub_const_err_bin.rs:4:20 | LL | pub const Z: u32 = 0 - 1; - | -------------------^^^^^- - | | - | attempt to compute `0_u32 - 1_u32`, which would overflow + | ---------------- ^^^^^ attempt to compute `0_u32 - 1_u32`, which would overflow | note: the lint level is defined here --> $DIR/pub_const_err_bin.rs:2:9 @@ -21,9 +19,7 @@ warning: any use of this value will cause an error --> $DIR/pub_const_err_bin.rs:4:20 | LL | pub const Z: u32 = 0 - 1; - | -------------------^^^^^- - | | - | attempt to compute `0_u32 - 1_u32`, which would overflow + | ---------------- ^^^^^ attempt to compute `0_u32 - 1_u32`, which would overflow | note: the lint level is defined here --> $DIR/pub_const_err_bin.rs:2:9 diff --git a/src/test/ui/consts/const-eval/ref_to_int_match.32bit.stderr b/src/test/ui/consts/const-eval/ref_to_int_match.32bit.stderr index a55fd8c156e..0e374358810 100644 --- a/src/test/ui/consts/const-eval/ref_to_int_match.32bit.stderr +++ b/src/test/ui/consts/const-eval/ref_to_int_match.32bit.stderr @@ -2,9 +2,7 @@ error: any use of this value will cause an error --> $DIR/ref_to_int_match.rs:25:27 | LL | const BAR: Int = unsafe { Foo { r: &42 }.f }; - | --------------------------^^^^^^^^^^^^^^^^--- - | | - | unable to turn pointer into raw bytes + | -------------- ^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | = note: `#[deny(const_err)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -29,9 +27,7 @@ error: any use of this value will cause an error --> $DIR/ref_to_int_match.rs:25:27 | LL | const BAR: Int = unsafe { Foo { r: &42 }.f }; - | --------------------------^^^^^^^^^^^^^^^^--- - | | - | unable to turn pointer into raw bytes + | -------------- ^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | = note: `#[deny(const_err)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! diff --git a/src/test/ui/consts/const-eval/ref_to_int_match.64bit.stderr b/src/test/ui/consts/const-eval/ref_to_int_match.64bit.stderr index a55fd8c156e..0e374358810 100644 --- a/src/test/ui/consts/const-eval/ref_to_int_match.64bit.stderr +++ b/src/test/ui/consts/const-eval/ref_to_int_match.64bit.stderr @@ -2,9 +2,7 @@ error: any use of this value will cause an error --> $DIR/ref_to_int_match.rs:25:27 | LL | const BAR: Int = unsafe { Foo { r: &42 }.f }; - | --------------------------^^^^^^^^^^^^^^^^--- - | | - | unable to turn pointer into raw bytes + | -------------- ^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | = note: `#[deny(const_err)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -29,9 +27,7 @@ error: any use of this value will cause an error --> $DIR/ref_to_int_match.rs:25:27 | LL | const BAR: Int = unsafe { Foo { r: &42 }.f }; - | --------------------------^^^^^^^^^^^^^^^^--- - | | - | unable to turn pointer into raw bytes + | -------------- ^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | = note: `#[deny(const_err)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! diff --git a/src/test/ui/consts/const-eval/transmute-const.32bit.stderr b/src/test/ui/consts/const-eval/transmute-const.32bit.stderr index 89c72207883..09fd7998695 100644 --- a/src/test/ui/consts/const-eval/transmute-const.32bit.stderr +++ b/src/test/ui/consts/const-eval/transmute-const.32bit.stderr @@ -2,7 +2,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/transmute-const.rs:4:1 | LL | static FOO: bool = unsafe { mem::transmute(3u8) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered 0x03, but expected a boolean + | ^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0x03, but expected a boolean | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 1, align: 1) { diff --git a/src/test/ui/consts/const-eval/transmute-const.64bit.stderr b/src/test/ui/consts/const-eval/transmute-const.64bit.stderr index 89c72207883..09fd7998695 100644 --- a/src/test/ui/consts/const-eval/transmute-const.64bit.stderr +++ b/src/test/ui/consts/const-eval/transmute-const.64bit.stderr @@ -2,7 +2,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/transmute-const.rs:4:1 | LL | static FOO: bool = unsafe { mem::transmute(3u8) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered 0x03, but expected a boolean + | ^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0x03, but expected a boolean | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 1, align: 1) { diff --git a/src/test/ui/consts/const-eval/ub-enum-overwrite.stderr b/src/test/ui/consts/const-eval/ub-enum-overwrite.stderr index d5a1f1dad61..8560112ae3b 100644 --- a/src/test/ui/consts/const-eval/ub-enum-overwrite.stderr +++ b/src/test/ui/consts/const-eval/ub-enum-overwrite.stderr @@ -1,14 +1,8 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/ub-enum-overwrite.rs:8:1 | -LL | / const _: u8 = { -LL | | -LL | | let mut e = E::A(1); -LL | | let p = if let E::A(x) = &mut e { x as *mut u8 } else { unreachable!() }; -... | -LL | | unsafe { *p } -LL | | }; - | |__^ type validation failed: encountered uninitialized bytes, but expected initialized bytes +LL | const _: u8 = { + | ^^^^^^^^^^^ constructing invalid value: encountered uninitialized bytes, but expected initialized bytes | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 1, align: 1) { diff --git a/src/test/ui/consts/const-eval/ub-enum.32bit.stderr b/src/test/ui/consts/const-eval/ub-enum.32bit.stderr index 2440cd2272c..2f8b44da0fc 100644 --- a/src/test/ui/consts/const-eval/ub-enum.32bit.stderr +++ b/src/test/ui/consts/const-eval/ub-enum.32bit.stderr @@ -2,7 +2,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/ub-enum.rs:23:1 | LL | const BAD_ENUM: Enum = unsafe { mem::transmute(1usize) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed at .<enum-tag>: encountered 0x00000001, but expected a valid enum tag + | ^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-tag>: encountered 0x00000001, but expected a valid enum tag | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 4, align: 4) { @@ -13,7 +13,7 @@ error: any use of this value will cause an error --> $DIR/ub-enum.rs:26:1 | LL | const BAD_ENUM_PTR: Enum = unsafe { mem::transmute(&1) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes + | ^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | = note: `#[deny(const_err)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -23,7 +23,7 @@ error: any use of this value will cause an error --> $DIR/ub-enum.rs:30:1 | LL | const BAD_ENUM_WRAPPED: Wrap<Enum> = unsafe { mem::transmute(&1) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> @@ -32,7 +32,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/ub-enum.rs:43:1 | LL | const BAD_ENUM2: Enum2 = unsafe { mem::transmute(0usize) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed at .<enum-tag>: encountered 0x00000000, but expected a valid enum tag + | ^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-tag>: encountered 0x00000000, but expected a valid enum tag | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 4, align: 4) { @@ -43,7 +43,7 @@ error: any use of this value will cause an error --> $DIR/ub-enum.rs:45:1 | LL | const BAD_ENUM2_PTR: Enum2 = unsafe { mem::transmute(&0) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> @@ -52,7 +52,7 @@ error: any use of this value will cause an error --> $DIR/ub-enum.rs:49:1 | LL | const BAD_ENUM2_WRAPPED: Wrap<Enum2> = unsafe { mem::transmute(&0) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> @@ -61,7 +61,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/ub-enum.rs:59:1 | LL | const BAD_ENUM2_UNDEF : Enum2 = unsafe { MaybeUninit { uninit: () }.init }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed at .<enum-tag>: encountered uninitialized bytes, but expected initialized bytes + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-tag>: encountered uninitialized bytes, but expected initialized bytes | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 4, align: 4) { @@ -72,7 +72,7 @@ error: any use of this value will cause an error --> $DIR/ub-enum.rs:63:1 | LL | const BAD_ENUM2_OPTION_PTR: Option<Enum2> = unsafe { mem::transmute(&0) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> @@ -81,7 +81,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/ub-enum.rs:81:1 | LL | const BAD_UNINHABITED_VARIANT1: UninhDiscriminant = unsafe { mem::transmute(1u8) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed at .<enum-variant(B)>.0: encountered a value of the never type `!` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-variant(B)>.0: encountered a value of the never type `!` | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 1, align: 1) { @@ -92,7 +92,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/ub-enum.rs:83:1 | LL | const BAD_UNINHABITED_VARIANT2: UninhDiscriminant = unsafe { mem::transmute(3u8) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed at .<enum-variant(D)>.0: encountered a value of uninhabited type Never + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-variant(D)>.0: encountered a value of uninhabited type Never | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 1, align: 1) { @@ -103,7 +103,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/ub-enum.rs:91:1 | LL | const BAD_OPTION_CHAR: Option<(char, char)> = Some(('x', unsafe { mem::transmute(!0u32) })); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed at .<enum-variant(Some)>.0.1: encountered 0xffffffff, but expected a valid unicode scalar value (in `0..=0x10FFFF` but not in `0xD800..=0xDFFF`) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-variant(Some)>.0.1: encountered 0xffffffff, but expected a valid unicode scalar value (in `0..=0x10FFFF` but not in `0xD800..=0xDFFF`) | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 8, align: 4) { @@ -130,7 +130,7 @@ error: any use of this value will cause an error --> $DIR/ub-enum.rs:26:1 | LL | const BAD_ENUM_PTR: Enum = unsafe { mem::transmute(&1) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes + | ^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | = note: `#[deny(const_err)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -141,7 +141,7 @@ error: any use of this value will cause an error --> $DIR/ub-enum.rs:30:1 | LL | const BAD_ENUM_WRAPPED: Wrap<Enum> = unsafe { mem::transmute(&1) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | = note: `#[deny(const_err)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -152,7 +152,7 @@ error: any use of this value will cause an error --> $DIR/ub-enum.rs:45:1 | LL | const BAD_ENUM2_PTR: Enum2 = unsafe { mem::transmute(&0) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | = note: `#[deny(const_err)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -163,7 +163,7 @@ error: any use of this value will cause an error --> $DIR/ub-enum.rs:49:1 | LL | const BAD_ENUM2_WRAPPED: Wrap<Enum2> = unsafe { mem::transmute(&0) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | = note: `#[deny(const_err)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -174,7 +174,7 @@ error: any use of this value will cause an error --> $DIR/ub-enum.rs:63:1 | LL | const BAD_ENUM2_OPTION_PTR: Option<Enum2> = unsafe { mem::transmute(&0) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | = note: `#[deny(const_err)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! diff --git a/src/test/ui/consts/const-eval/ub-enum.64bit.stderr b/src/test/ui/consts/const-eval/ub-enum.64bit.stderr index e9b4023068e..3a05a5150f1 100644 --- a/src/test/ui/consts/const-eval/ub-enum.64bit.stderr +++ b/src/test/ui/consts/const-eval/ub-enum.64bit.stderr @@ -2,7 +2,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/ub-enum.rs:23:1 | LL | const BAD_ENUM: Enum = unsafe { mem::transmute(1usize) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed at .<enum-tag>: encountered 0x0000000000000001, but expected a valid enum tag + | ^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-tag>: encountered 0x0000000000000001, but expected a valid enum tag | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 8, align: 8) { @@ -13,7 +13,7 @@ error: any use of this value will cause an error --> $DIR/ub-enum.rs:26:1 | LL | const BAD_ENUM_PTR: Enum = unsafe { mem::transmute(&1) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes + | ^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | = note: `#[deny(const_err)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -23,7 +23,7 @@ error: any use of this value will cause an error --> $DIR/ub-enum.rs:30:1 | LL | const BAD_ENUM_WRAPPED: Wrap<Enum> = unsafe { mem::transmute(&1) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> @@ -32,7 +32,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/ub-enum.rs:43:1 | LL | const BAD_ENUM2: Enum2 = unsafe { mem::transmute(0usize) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed at .<enum-tag>: encountered 0x0000000000000000, but expected a valid enum tag + | ^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-tag>: encountered 0x0000000000000000, but expected a valid enum tag | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 8, align: 8) { @@ -43,7 +43,7 @@ error: any use of this value will cause an error --> $DIR/ub-enum.rs:45:1 | LL | const BAD_ENUM2_PTR: Enum2 = unsafe { mem::transmute(&0) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> @@ -52,7 +52,7 @@ error: any use of this value will cause an error --> $DIR/ub-enum.rs:49:1 | LL | const BAD_ENUM2_WRAPPED: Wrap<Enum2> = unsafe { mem::transmute(&0) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> @@ -61,7 +61,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/ub-enum.rs:59:1 | LL | const BAD_ENUM2_UNDEF : Enum2 = unsafe { MaybeUninit { uninit: () }.init }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed at .<enum-tag>: encountered uninitialized bytes, but expected initialized bytes + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-tag>: encountered uninitialized bytes, but expected initialized bytes | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 8, align: 8) { @@ -72,7 +72,7 @@ error: any use of this value will cause an error --> $DIR/ub-enum.rs:63:1 | LL | const BAD_ENUM2_OPTION_PTR: Option<Enum2> = unsafe { mem::transmute(&0) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> @@ -81,7 +81,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/ub-enum.rs:81:1 | LL | const BAD_UNINHABITED_VARIANT1: UninhDiscriminant = unsafe { mem::transmute(1u8) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed at .<enum-variant(B)>.0: encountered a value of the never type `!` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-variant(B)>.0: encountered a value of the never type `!` | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 1, align: 1) { @@ -92,7 +92,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/ub-enum.rs:83:1 | LL | const BAD_UNINHABITED_VARIANT2: UninhDiscriminant = unsafe { mem::transmute(3u8) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed at .<enum-variant(D)>.0: encountered a value of uninhabited type Never + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-variant(D)>.0: encountered a value of uninhabited type Never | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 1, align: 1) { @@ -103,7 +103,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/ub-enum.rs:91:1 | LL | const BAD_OPTION_CHAR: Option<(char, char)> = Some(('x', unsafe { mem::transmute(!0u32) })); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed at .<enum-variant(Some)>.0.1: encountered 0xffffffff, but expected a valid unicode scalar value (in `0..=0x10FFFF` but not in `0xD800..=0xDFFF`) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-variant(Some)>.0.1: encountered 0xffffffff, but expected a valid unicode scalar value (in `0..=0x10FFFF` but not in `0xD800..=0xDFFF`) | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 8, align: 4) { @@ -130,7 +130,7 @@ error: any use of this value will cause an error --> $DIR/ub-enum.rs:26:1 | LL | const BAD_ENUM_PTR: Enum = unsafe { mem::transmute(&1) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes + | ^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | = note: `#[deny(const_err)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -141,7 +141,7 @@ error: any use of this value will cause an error --> $DIR/ub-enum.rs:30:1 | LL | const BAD_ENUM_WRAPPED: Wrap<Enum> = unsafe { mem::transmute(&1) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | = note: `#[deny(const_err)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -152,7 +152,7 @@ error: any use of this value will cause an error --> $DIR/ub-enum.rs:45:1 | LL | const BAD_ENUM2_PTR: Enum2 = unsafe { mem::transmute(&0) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | = note: `#[deny(const_err)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -163,7 +163,7 @@ error: any use of this value will cause an error --> $DIR/ub-enum.rs:49:1 | LL | const BAD_ENUM2_WRAPPED: Wrap<Enum2> = unsafe { mem::transmute(&0) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | = note: `#[deny(const_err)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -174,7 +174,7 @@ error: any use of this value will cause an error --> $DIR/ub-enum.rs:63:1 | LL | const BAD_ENUM2_OPTION_PTR: Option<Enum2> = unsafe { mem::transmute(&0) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | = note: `#[deny(const_err)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! diff --git a/src/test/ui/consts/const-eval/ub-incorrect-vtable.32bit.stderr b/src/test/ui/consts/const-eval/ub-incorrect-vtable.32bit.stderr index ffde14f894e..c6422447a4b 100644 --- a/src/test/ui/consts/const-eval/ub-incorrect-vtable.32bit.stderr +++ b/src/test/ui/consts/const-eval/ub-incorrect-vtable.32bit.stderr @@ -13,9 +13,8 @@ LL | unsafe { std::mem::transmute((&92u8, &[1usize, usize::MAX, 1usize])) }; error[E0080]: it is undefined behavior to use this value --> $DIR/ub-incorrect-vtable.rs:34:1 | -LL | / const INVALID_VTABLE_ALIGNMENT_UB: W<&dyn Trait> = -LL | | unsafe { std::mem::transmute((&92u8, &(drop_me as fn(*mut usize), 1usize, 1000usize))) }; - | |_____________________________________________________________________________________________^ type validation failed at .0: encountered invalid vtable: alignment `1000` is not a power of 2 +LL | const INVALID_VTABLE_ALIGNMENT_UB: W<&dyn Trait> = + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered invalid vtable: alignment `1000` is not a power of 2 | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 8, align: 4) { @@ -25,9 +24,8 @@ LL | | unsafe { std::mem::transmute((&92u8, &(drop_me as fn(*mut usize), 1us error[E0080]: it is undefined behavior to use this value --> $DIR/ub-incorrect-vtable.rs:39:1 | -LL | / const INVALID_VTABLE_SIZE_UB: W<&dyn Trait> = -LL | | unsafe { std::mem::transmute((&92u8, &(drop_me as fn(*mut usize), usize::MAX, 1usize))) }; - | |______________________________________________________________________________________________^ type validation failed at .0: encountered invalid vtable: size is bigger than largest supported object +LL | const INVALID_VTABLE_SIZE_UB: W<&dyn Trait> = + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered invalid vtable: size is bigger than largest supported object | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 8, align: 4) { diff --git a/src/test/ui/consts/const-eval/ub-incorrect-vtable.64bit.stderr b/src/test/ui/consts/const-eval/ub-incorrect-vtable.64bit.stderr index 2ad164a8c35..e594ad71b5b 100644 --- a/src/test/ui/consts/const-eval/ub-incorrect-vtable.64bit.stderr +++ b/src/test/ui/consts/const-eval/ub-incorrect-vtable.64bit.stderr @@ -13,9 +13,8 @@ LL | unsafe { std::mem::transmute((&92u8, &[1usize, usize::MAX, 1usize])) }; error[E0080]: it is undefined behavior to use this value --> $DIR/ub-incorrect-vtable.rs:34:1 | -LL | / const INVALID_VTABLE_ALIGNMENT_UB: W<&dyn Trait> = -LL | | unsafe { std::mem::transmute((&92u8, &(drop_me as fn(*mut usize), 1usize, 1000usize))) }; - | |_____________________________________________________________________________________________^ type validation failed at .0: encountered invalid vtable: alignment `1000` is not a power of 2 +LL | const INVALID_VTABLE_ALIGNMENT_UB: W<&dyn Trait> = + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered invalid vtable: alignment `1000` is not a power of 2 | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 16, align: 8) { @@ -25,9 +24,8 @@ LL | | unsafe { std::mem::transmute((&92u8, &(drop_me as fn(*mut usize), 1us error[E0080]: it is undefined behavior to use this value --> $DIR/ub-incorrect-vtable.rs:39:1 | -LL | / const INVALID_VTABLE_SIZE_UB: W<&dyn Trait> = -LL | | unsafe { std::mem::transmute((&92u8, &(drop_me as fn(*mut usize), usize::MAX, 1usize))) }; - | |______________________________________________________________________________________________^ type validation failed at .0: encountered invalid vtable: size is bigger than largest supported object +LL | const INVALID_VTABLE_SIZE_UB: W<&dyn Trait> = + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered invalid vtable: size is bigger than largest supported object | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 16, align: 8) { diff --git a/src/test/ui/consts/const-eval/ub-int-array.32bit.stderr b/src/test/ui/consts/const-eval/ub-int-array.32bit.stderr index df02bdaa33c..8eece9e30e4 100644 --- a/src/test/ui/consts/const-eval/ub-int-array.32bit.stderr +++ b/src/test/ui/consts/const-eval/ub-int-array.32bit.stderr @@ -1,14 +1,8 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/ub-int-array.rs:14:1 | -LL | / const UNINIT_INT_0: [u32; 3] = unsafe { -LL | | -LL | | -LL | | [ -... | -LL | | ] -LL | | }; - | |__^ type validation failed at [0]: encountered uninitialized bytes +LL | const UNINIT_INT_0: [u32; 3] = unsafe { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at [0]: encountered uninitialized bytes | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 12, align: 4) { @@ -18,14 +12,8 @@ LL | | }; error[E0080]: it is undefined behavior to use this value --> $DIR/ub-int-array.rs:23:1 | -LL | / const UNINIT_INT_1: [u32; 3] = unsafe { -LL | | -LL | | -LL | | mem::transmute( -... | -LL | | ) -LL | | }; - | |__^ type validation failed at [1]: encountered uninitialized bytes +LL | const UNINIT_INT_1: [u32; 3] = unsafe { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at [1]: encountered uninitialized bytes | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 12, align: 4) { @@ -35,14 +23,8 @@ LL | | }; error[E0080]: it is undefined behavior to use this value --> $DIR/ub-int-array.rs:43:1 | -LL | / const UNINIT_INT_2: [u32; 3] = unsafe { -LL | | -LL | | -LL | | mem::transmute( -... | -LL | | ) -LL | | }; - | |__^ type validation failed at [2]: encountered uninitialized bytes +LL | const UNINIT_INT_2: [u32; 3] = unsafe { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at [2]: encountered uninitialized bytes | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 12, align: 4) { diff --git a/src/test/ui/consts/const-eval/ub-int-array.64bit.stderr b/src/test/ui/consts/const-eval/ub-int-array.64bit.stderr index df02bdaa33c..8eece9e30e4 100644 --- a/src/test/ui/consts/const-eval/ub-int-array.64bit.stderr +++ b/src/test/ui/consts/const-eval/ub-int-array.64bit.stderr @@ -1,14 +1,8 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/ub-int-array.rs:14:1 | -LL | / const UNINIT_INT_0: [u32; 3] = unsafe { -LL | | -LL | | -LL | | [ -... | -LL | | ] -LL | | }; - | |__^ type validation failed at [0]: encountered uninitialized bytes +LL | const UNINIT_INT_0: [u32; 3] = unsafe { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at [0]: encountered uninitialized bytes | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 12, align: 4) { @@ -18,14 +12,8 @@ LL | | }; error[E0080]: it is undefined behavior to use this value --> $DIR/ub-int-array.rs:23:1 | -LL | / const UNINIT_INT_1: [u32; 3] = unsafe { -LL | | -LL | | -LL | | mem::transmute( -... | -LL | | ) -LL | | }; - | |__^ type validation failed at [1]: encountered uninitialized bytes +LL | const UNINIT_INT_1: [u32; 3] = unsafe { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at [1]: encountered uninitialized bytes | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 12, align: 4) { @@ -35,14 +23,8 @@ LL | | }; error[E0080]: it is undefined behavior to use this value --> $DIR/ub-int-array.rs:43:1 | -LL | / const UNINIT_INT_2: [u32; 3] = unsafe { -LL | | -LL | | -LL | | mem::transmute( -... | -LL | | ) -LL | | }; - | |__^ type validation failed at [2]: encountered uninitialized bytes +LL | const UNINIT_INT_2: [u32; 3] = unsafe { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at [2]: encountered uninitialized bytes | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 12, align: 4) { diff --git a/src/test/ui/consts/const-eval/ub-int-array.rs b/src/test/ui/consts/const-eval/ub-int-array.rs index 7e0fb33bc11..1221f71d1e5 100644 --- a/src/test/ui/consts/const-eval/ub-int-array.rs +++ b/src/test/ui/consts/const-eval/ub-int-array.rs @@ -13,7 +13,7 @@ union MaybeUninit<T: Copy> { const UNINIT_INT_0: [u32; 3] = unsafe { //~^ ERROR it is undefined behavior to use this value -//~| type validation failed at [0]: encountered uninitialized bytes +//~| constructing invalid value at [0]: encountered uninitialized bytes [ MaybeUninit { uninit: () }.init, 1, @@ -22,7 +22,7 @@ const UNINIT_INT_0: [u32; 3] = unsafe { }; const UNINIT_INT_1: [u32; 3] = unsafe { //~^ ERROR it is undefined behavior to use this value -//~| type validation failed at [1]: encountered uninitialized bytes +//~| constructing invalid value at [1]: encountered uninitialized bytes mem::transmute( [ 0u8, @@ -42,7 +42,7 @@ const UNINIT_INT_1: [u32; 3] = unsafe { }; const UNINIT_INT_2: [u32; 3] = unsafe { //~^ ERROR it is undefined behavior to use this value -//~| type validation failed at [2]: encountered uninitialized bytes +//~| constructing invalid value at [2]: encountered uninitialized bytes mem::transmute( [ 0u8, diff --git a/src/test/ui/consts/const-eval/ub-nonnull.32bit.stderr b/src/test/ui/consts/const-eval/ub-nonnull.32bit.stderr index e5091397e83..d450a814cfa 100644 --- a/src/test/ui/consts/const-eval/ub-nonnull.32bit.stderr +++ b/src/test/ui/consts/const-eval/ub-nonnull.32bit.stderr @@ -2,7 +2,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/ub-nonnull.rs:12:1 | LL | const NULL_PTR: NonNull<u8> = unsafe { mem::transmute(0usize) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered 0, but expected something greater or equal to 1 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0, but expected something greater or equal to 1 | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 4, align: 4) { @@ -19,7 +19,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/ub-nonnull.rs:23:1 | LL | const NULL_U8: NonZeroU8 = unsafe { mem::transmute(0u8) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered 0, but expected something greater or equal to 1 + | ^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0, but expected something greater or equal to 1 | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 1, align: 1) { @@ -30,7 +30,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/ub-nonnull.rs:25:1 | LL | const NULL_USIZE: NonZeroUsize = unsafe { mem::transmute(0usize) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered 0, but expected something greater or equal to 1 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0, but expected something greater or equal to 1 | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 4, align: 4) { @@ -41,7 +41,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/ub-nonnull.rs:33:1 | LL | const UNINIT: NonZeroU8 = unsafe { MaybeUninit { uninit: () }.init }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed at .0: encountered uninitialized bytes, but expected initialized bytes + | ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered uninitialized bytes, but expected initialized bytes | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 1, align: 1) { @@ -52,7 +52,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/ub-nonnull.rs:41:1 | LL | const BAD_RANGE1: RestrictedRange1 = unsafe { RestrictedRange1(42) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered 42, but expected something in the range 10..=30 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 42, but expected something in the range 10..=30 | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 4, align: 4) { @@ -63,7 +63,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/ub-nonnull.rs:47:1 | LL | const BAD_RANGE2: RestrictedRange2 = unsafe { RestrictedRange2(20) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered 20, but expected something less or equal to 10, or greater or equal to 30 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 20, but expected something less or equal to 10, or greater or equal to 30 | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 4, align: 4) { diff --git a/src/test/ui/consts/const-eval/ub-nonnull.64bit.stderr b/src/test/ui/consts/const-eval/ub-nonnull.64bit.stderr index 80c694fc83e..ed0d91aabd3 100644 --- a/src/test/ui/consts/const-eval/ub-nonnull.64bit.stderr +++ b/src/test/ui/consts/const-eval/ub-nonnull.64bit.stderr @@ -2,7 +2,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/ub-nonnull.rs:12:1 | LL | const NULL_PTR: NonNull<u8> = unsafe { mem::transmute(0usize) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered 0, but expected something greater or equal to 1 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0, but expected something greater or equal to 1 | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 8, align: 8) { @@ -19,7 +19,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/ub-nonnull.rs:23:1 | LL | const NULL_U8: NonZeroU8 = unsafe { mem::transmute(0u8) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered 0, but expected something greater or equal to 1 + | ^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0, but expected something greater or equal to 1 | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 1, align: 1) { @@ -30,7 +30,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/ub-nonnull.rs:25:1 | LL | const NULL_USIZE: NonZeroUsize = unsafe { mem::transmute(0usize) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered 0, but expected something greater or equal to 1 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0, but expected something greater or equal to 1 | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 8, align: 8) { @@ -41,7 +41,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/ub-nonnull.rs:33:1 | LL | const UNINIT: NonZeroU8 = unsafe { MaybeUninit { uninit: () }.init }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed at .0: encountered uninitialized bytes, but expected initialized bytes + | ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered uninitialized bytes, but expected initialized bytes | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 1, align: 1) { @@ -52,7 +52,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/ub-nonnull.rs:41:1 | LL | const BAD_RANGE1: RestrictedRange1 = unsafe { RestrictedRange1(42) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered 42, but expected something in the range 10..=30 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 42, but expected something in the range 10..=30 | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 4, align: 4) { @@ -63,7 +63,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/ub-nonnull.rs:47:1 | LL | const BAD_RANGE2: RestrictedRange2 = unsafe { RestrictedRange2(20) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered 20, but expected something less or equal to 10, or greater or equal to 30 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 20, but expected something less or equal to 10, or greater or equal to 30 | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 4, align: 4) { diff --git a/src/test/ui/consts/const-eval/ub-ref-ptr.32bit.stderr b/src/test/ui/consts/const-eval/ub-ref-ptr.32bit.stderr index 10a0ccd552b..b60e3337b44 100644 --- a/src/test/ui/consts/const-eval/ub-ref-ptr.32bit.stderr +++ b/src/test/ui/consts/const-eval/ub-ref-ptr.32bit.stderr @@ -2,7 +2,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/ub-ref-ptr.rs:13:1 | LL | const UNALIGNED: &u16 = unsafe { mem::transmute(&[0u8; 4]) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered an unaligned reference (required 2 byte alignment but found 1) + | ^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered an unaligned reference (required 2 byte alignment but found 1) | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 4, align: 4) { @@ -13,7 +13,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/ub-ref-ptr.rs:17:1 | LL | const UNALIGNED_BOX: Box<u16> = unsafe { mem::transmute(&[0u8; 4]) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered an unaligned box (required 2 byte alignment but found 1) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered an unaligned box (required 2 byte alignment but found 1) | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 4, align: 4) { @@ -24,7 +24,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/ub-ref-ptr.rs:21:1 | LL | const NULL: &u16 = unsafe { mem::transmute(0usize) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a null reference + | ^^^^^^^^^^^^^^^^ constructing invalid value: encountered a null reference | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 4, align: 4) { @@ -35,7 +35,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/ub-ref-ptr.rs:24:1 | LL | const NULL_BOX: Box<u16> = unsafe { mem::transmute(0usize) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a null box + | ^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a null box | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 4, align: 4) { @@ -46,7 +46,7 @@ error: any use of this value will cause an error --> $DIR/ub-ref-ptr.rs:31:1 | LL | const REF_AS_USIZE: usize = unsafe { mem::transmute(&0) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes + | ^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | = note: `#[deny(const_err)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -56,9 +56,7 @@ error: any use of this value will cause an error --> $DIR/ub-ref-ptr.rs:35:39 | LL | const REF_AS_USIZE_SLICE: &[usize] = &[unsafe { mem::transmute(&0) }]; - | --------------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- - | | - | unable to turn pointer into raw bytes + | ---------------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> @@ -67,9 +65,7 @@ error: any use of this value will cause an error --> $DIR/ub-ref-ptr.rs:35:38 | LL | const REF_AS_USIZE_SLICE: &[usize] = &[unsafe { mem::transmute(&0) }]; - | -------------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- - | | - | referenced constant has errors + | ---------------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> @@ -78,9 +74,7 @@ error: any use of this value will cause an error --> $DIR/ub-ref-ptr.rs:41:86 | LL | const REF_AS_USIZE_BOX_SLICE: Box<[usize]> = unsafe { mem::transmute::<&[usize], _>(&[mem::transmute(&0)]) }; - | -------------------------------------------------------------------------------------^^^^^^^^^^^^^^^^^^^^---- - | | - | unable to turn pointer into raw bytes + | ------------------------------------------ ^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> @@ -89,9 +83,7 @@ error: any use of this value will cause an error --> $DIR/ub-ref-ptr.rs:41:85 | LL | const REF_AS_USIZE_BOX_SLICE: Box<[usize]> = unsafe { mem::transmute::<&[usize], _>(&[mem::transmute(&0)]) }; - | ------------------------------------------------------------------------------------^^^^^^^^^^^^^^^^^^^^^---- - | | - | referenced constant has errors + | ------------------------------------------ ^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> @@ -100,7 +92,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/ub-ref-ptr.rs:47:1 | LL | const USIZE_AS_REF: &'static u8 = unsafe { mem::transmute(1337usize) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a dangling reference (address 0x539 is unallocated) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a dangling reference (address 0x539 is unallocated) | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 4, align: 4) { @@ -111,7 +103,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/ub-ref-ptr.rs:50:1 | LL | const USIZE_AS_BOX: Box<u8> = unsafe { mem::transmute(1337usize) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a dangling box (address 0x539 is unallocated) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a dangling box (address 0x539 is unallocated) | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 4, align: 4) { @@ -122,7 +114,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/ub-ref-ptr.rs:53:1 | LL | const UNINIT_PTR: *const i32 = unsafe { MaybeUninit { uninit: () }.init }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered uninitialized raw pointer + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered uninitialized raw pointer | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 4, align: 4) { @@ -133,7 +125,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/ub-ref-ptr.rs:56:1 | LL | const NULL_FN_PTR: fn() = unsafe { mem::transmute(0usize) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a null function pointer + | ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a null function pointer | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 4, align: 4) { @@ -144,7 +136,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/ub-ref-ptr.rs:58:1 | LL | const UNINIT_FN_PTR: fn() = unsafe { MaybeUninit { uninit: () }.init }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered uninitialized bytes, but expected a proper pointer or integer value + | ^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered uninitialized bytes, but expected a proper pointer or integer value | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 4, align: 4) { @@ -155,7 +147,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/ub-ref-ptr.rs:60:1 | LL | const DANGLING_FN_PTR: fn() = unsafe { mem::transmute(13usize) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered 0x0000000d, but expected a function pointer + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0x0000000d, but expected a function pointer | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 4, align: 4) { @@ -166,7 +158,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/ub-ref-ptr.rs:62:1 | LL | const DATA_FN_PTR: fn() = unsafe { mem::transmute(&13) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered pointer to alloc43, but expected a function pointer + | ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered pointer to alloc43, but expected a function pointer | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 4, align: 4) { @@ -181,7 +173,7 @@ error: any use of this value will cause an error --> $DIR/ub-ref-ptr.rs:31:1 | LL | const REF_AS_USIZE: usize = unsafe { mem::transmute(&0) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes + | ^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | = note: `#[deny(const_err)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -192,9 +184,7 @@ error: any use of this value will cause an error --> $DIR/ub-ref-ptr.rs:35:39 | LL | const REF_AS_USIZE_SLICE: &[usize] = &[unsafe { mem::transmute(&0) }]; - | --------------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- - | | - | unable to turn pointer into raw bytes + | ---------------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | = note: `#[deny(const_err)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -205,9 +195,7 @@ error: any use of this value will cause an error --> $DIR/ub-ref-ptr.rs:35:38 | LL | const REF_AS_USIZE_SLICE: &[usize] = &[unsafe { mem::transmute(&0) }]; - | -------------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- - | | - | referenced constant has errors + | ---------------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors | = note: `#[deny(const_err)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -218,9 +206,7 @@ error: any use of this value will cause an error --> $DIR/ub-ref-ptr.rs:41:86 | LL | const REF_AS_USIZE_BOX_SLICE: Box<[usize]> = unsafe { mem::transmute::<&[usize], _>(&[mem::transmute(&0)]) }; - | -------------------------------------------------------------------------------------^^^^^^^^^^^^^^^^^^^^---- - | | - | unable to turn pointer into raw bytes + | ------------------------------------------ ^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | = note: `#[deny(const_err)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -231,9 +217,7 @@ error: any use of this value will cause an error --> $DIR/ub-ref-ptr.rs:41:85 | LL | const REF_AS_USIZE_BOX_SLICE: Box<[usize]> = unsafe { mem::transmute::<&[usize], _>(&[mem::transmute(&0)]) }; - | ------------------------------------------------------------------------------------^^^^^^^^^^^^^^^^^^^^^---- - | | - | referenced constant has errors + | ------------------------------------------ ^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors | = note: `#[deny(const_err)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! diff --git a/src/test/ui/consts/const-eval/ub-ref-ptr.64bit.stderr b/src/test/ui/consts/const-eval/ub-ref-ptr.64bit.stderr index e9fcefe12c7..505ef2dd7d7 100644 --- a/src/test/ui/consts/const-eval/ub-ref-ptr.64bit.stderr +++ b/src/test/ui/consts/const-eval/ub-ref-ptr.64bit.stderr @@ -2,7 +2,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/ub-ref-ptr.rs:13:1 | LL | const UNALIGNED: &u16 = unsafe { mem::transmute(&[0u8; 4]) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered an unaligned reference (required 2 byte alignment but found 1) + | ^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered an unaligned reference (required 2 byte alignment but found 1) | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 8, align: 8) { @@ -13,7 +13,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/ub-ref-ptr.rs:17:1 | LL | const UNALIGNED_BOX: Box<u16> = unsafe { mem::transmute(&[0u8; 4]) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered an unaligned box (required 2 byte alignment but found 1) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered an unaligned box (required 2 byte alignment but found 1) | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 8, align: 8) { @@ -24,7 +24,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/ub-ref-ptr.rs:21:1 | LL | const NULL: &u16 = unsafe { mem::transmute(0usize) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a null reference + | ^^^^^^^^^^^^^^^^ constructing invalid value: encountered a null reference | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 8, align: 8) { @@ -35,7 +35,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/ub-ref-ptr.rs:24:1 | LL | const NULL_BOX: Box<u16> = unsafe { mem::transmute(0usize) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a null box + | ^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a null box | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 8, align: 8) { @@ -46,7 +46,7 @@ error: any use of this value will cause an error --> $DIR/ub-ref-ptr.rs:31:1 | LL | const REF_AS_USIZE: usize = unsafe { mem::transmute(&0) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes + | ^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | = note: `#[deny(const_err)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -56,9 +56,7 @@ error: any use of this value will cause an error --> $DIR/ub-ref-ptr.rs:35:39 | LL | const REF_AS_USIZE_SLICE: &[usize] = &[unsafe { mem::transmute(&0) }]; - | --------------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- - | | - | unable to turn pointer into raw bytes + | ---------------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> @@ -67,9 +65,7 @@ error: any use of this value will cause an error --> $DIR/ub-ref-ptr.rs:35:38 | LL | const REF_AS_USIZE_SLICE: &[usize] = &[unsafe { mem::transmute(&0) }]; - | -------------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- - | | - | referenced constant has errors + | ---------------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> @@ -78,9 +74,7 @@ error: any use of this value will cause an error --> $DIR/ub-ref-ptr.rs:41:86 | LL | const REF_AS_USIZE_BOX_SLICE: Box<[usize]> = unsafe { mem::transmute::<&[usize], _>(&[mem::transmute(&0)]) }; - | -------------------------------------------------------------------------------------^^^^^^^^^^^^^^^^^^^^---- - | | - | unable to turn pointer into raw bytes + | ------------------------------------------ ^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> @@ -89,9 +83,7 @@ error: any use of this value will cause an error --> $DIR/ub-ref-ptr.rs:41:85 | LL | const REF_AS_USIZE_BOX_SLICE: Box<[usize]> = unsafe { mem::transmute::<&[usize], _>(&[mem::transmute(&0)]) }; - | ------------------------------------------------------------------------------------^^^^^^^^^^^^^^^^^^^^^---- - | | - | referenced constant has errors + | ------------------------------------------ ^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> @@ -100,7 +92,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/ub-ref-ptr.rs:47:1 | LL | const USIZE_AS_REF: &'static u8 = unsafe { mem::transmute(1337usize) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a dangling reference (address 0x539 is unallocated) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a dangling reference (address 0x539 is unallocated) | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 8, align: 8) { @@ -111,7 +103,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/ub-ref-ptr.rs:50:1 | LL | const USIZE_AS_BOX: Box<u8> = unsafe { mem::transmute(1337usize) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a dangling box (address 0x539 is unallocated) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a dangling box (address 0x539 is unallocated) | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 8, align: 8) { @@ -122,7 +114,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/ub-ref-ptr.rs:53:1 | LL | const UNINIT_PTR: *const i32 = unsafe { MaybeUninit { uninit: () }.init }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered uninitialized raw pointer + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered uninitialized raw pointer | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 8, align: 8) { @@ -133,7 +125,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/ub-ref-ptr.rs:56:1 | LL | const NULL_FN_PTR: fn() = unsafe { mem::transmute(0usize) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a null function pointer + | ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a null function pointer | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 8, align: 8) { @@ -144,7 +136,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/ub-ref-ptr.rs:58:1 | LL | const UNINIT_FN_PTR: fn() = unsafe { MaybeUninit { uninit: () }.init }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered uninitialized bytes, but expected a proper pointer or integer value + | ^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered uninitialized bytes, but expected a proper pointer or integer value | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 8, align: 8) { @@ -155,7 +147,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/ub-ref-ptr.rs:60:1 | LL | const DANGLING_FN_PTR: fn() = unsafe { mem::transmute(13usize) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered 0x000000000000000d, but expected a function pointer + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0x000000000000000d, but expected a function pointer | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 8, align: 8) { @@ -166,7 +158,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/ub-ref-ptr.rs:62:1 | LL | const DATA_FN_PTR: fn() = unsafe { mem::transmute(&13) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered pointer to alloc43, but expected a function pointer + | ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered pointer to alloc43, but expected a function pointer | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 8, align: 8) { @@ -181,7 +173,7 @@ error: any use of this value will cause an error --> $DIR/ub-ref-ptr.rs:31:1 | LL | const REF_AS_USIZE: usize = unsafe { mem::transmute(&0) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes + | ^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | = note: `#[deny(const_err)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -192,9 +184,7 @@ error: any use of this value will cause an error --> $DIR/ub-ref-ptr.rs:35:39 | LL | const REF_AS_USIZE_SLICE: &[usize] = &[unsafe { mem::transmute(&0) }]; - | --------------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- - | | - | unable to turn pointer into raw bytes + | ---------------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | = note: `#[deny(const_err)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -205,9 +195,7 @@ error: any use of this value will cause an error --> $DIR/ub-ref-ptr.rs:35:38 | LL | const REF_AS_USIZE_SLICE: &[usize] = &[unsafe { mem::transmute(&0) }]; - | -------------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- - | | - | referenced constant has errors + | ---------------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors | = note: `#[deny(const_err)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -218,9 +206,7 @@ error: any use of this value will cause an error --> $DIR/ub-ref-ptr.rs:41:86 | LL | const REF_AS_USIZE_BOX_SLICE: Box<[usize]> = unsafe { mem::transmute::<&[usize], _>(&[mem::transmute(&0)]) }; - | -------------------------------------------------------------------------------------^^^^^^^^^^^^^^^^^^^^---- - | | - | unable to turn pointer into raw bytes + | ------------------------------------------ ^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | = note: `#[deny(const_err)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -231,9 +217,7 @@ error: any use of this value will cause an error --> $DIR/ub-ref-ptr.rs:41:85 | LL | const REF_AS_USIZE_BOX_SLICE: Box<[usize]> = unsafe { mem::transmute::<&[usize], _>(&[mem::transmute(&0)]) }; - | ------------------------------------------------------------------------------------^^^^^^^^^^^^^^^^^^^^^---- - | | - | referenced constant has errors + | ------------------------------------------ ^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors | = note: `#[deny(const_err)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! diff --git a/src/test/ui/consts/const-eval/ub-ref-ptr.rs b/src/test/ui/consts/const-eval/ub-ref-ptr.rs index 17b0d29c514..d0216f74668 100644 --- a/src/test/ui/consts/const-eval/ub-ref-ptr.rs +++ b/src/test/ui/consts/const-eval/ub-ref-ptr.rs @@ -12,11 +12,11 @@ union MaybeUninit<T: Copy> { const UNALIGNED: &u16 = unsafe { mem::transmute(&[0u8; 4]) }; //~^ ERROR it is undefined behavior to use this value -//~| type validation failed: encountered an unaligned reference (required 2 byte alignment but found 1) +//~| constructing invalid value: encountered an unaligned reference (required 2 byte alignment but found 1) const UNALIGNED_BOX: Box<u16> = unsafe { mem::transmute(&[0u8; 4]) }; //~^ ERROR it is undefined behavior to use this value -//~| type validation failed: encountered an unaligned box (required 2 byte alignment but found 1) +//~| constructing invalid value: encountered an unaligned box (required 2 byte alignment but found 1) const NULL: &u16 = unsafe { mem::transmute(0usize) }; //~^ ERROR it is undefined behavior to use this value diff --git a/src/test/ui/consts/const-eval/ub-uninhabit.32bit.stderr b/src/test/ui/consts/const-eval/ub-uninhabit.32bit.stderr index 7873b3463c1..7f0feb13004 100644 --- a/src/test/ui/consts/const-eval/ub-uninhabit.32bit.stderr +++ b/src/test/ui/consts/const-eval/ub-uninhabit.32bit.stderr @@ -2,7 +2,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/ub-uninhabit.rs:15:1 | LL | const BAD_BAD_BAD: Bar = unsafe { MaybeUninit { uninit: () }.init }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a value of uninhabited type Bar + | ^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a value of uninhabited type Bar | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 0, align: 1) {} @@ -11,7 +11,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/ub-uninhabit.rs:18:1 | LL | const BAD_BAD_REF: &Bar = unsafe { mem::transmute(1usize) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a reference pointing to uninhabited type Bar + | ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a reference pointing to uninhabited type Bar | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 4, align: 4) { @@ -22,7 +22,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/ub-uninhabit.rs:21:1 | LL | const BAD_BAD_ARRAY: [Bar; 1] = unsafe { MaybeUninit { uninit: () }.init }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed at [0]: encountered a value of uninhabited type Bar + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at [0]: encountered a value of uninhabited type Bar | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 0, align: 1) {} diff --git a/src/test/ui/consts/const-eval/ub-uninhabit.64bit.stderr b/src/test/ui/consts/const-eval/ub-uninhabit.64bit.stderr index 47349750111..4dcbbc2f5e4 100644 --- a/src/test/ui/consts/const-eval/ub-uninhabit.64bit.stderr +++ b/src/test/ui/consts/const-eval/ub-uninhabit.64bit.stderr @@ -2,7 +2,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/ub-uninhabit.rs:15:1 | LL | const BAD_BAD_BAD: Bar = unsafe { MaybeUninit { uninit: () }.init }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a value of uninhabited type Bar + | ^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a value of uninhabited type Bar | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 0, align: 1) {} @@ -11,7 +11,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/ub-uninhabit.rs:18:1 | LL | const BAD_BAD_REF: &Bar = unsafe { mem::transmute(1usize) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a reference pointing to uninhabited type Bar + | ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a reference pointing to uninhabited type Bar | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 8, align: 8) { @@ -22,7 +22,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/ub-uninhabit.rs:21:1 | LL | const BAD_BAD_ARRAY: [Bar; 1] = unsafe { MaybeUninit { uninit: () }.init }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed at [0]: encountered a value of uninhabited type Bar + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at [0]: encountered a value of uninhabited type Bar | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 0, align: 1) {} diff --git a/src/test/ui/consts/const-eval/ub-upvars.32bit.stderr b/src/test/ui/consts/const-eval/ub-upvars.32bit.stderr index 27b98c2547c..43f73f6ec7f 100644 --- a/src/test/ui/consts/const-eval/ub-upvars.32bit.stderr +++ b/src/test/ui/consts/const-eval/ub-upvars.32bit.stderr @@ -1,12 +1,8 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/ub-upvars.rs:6:1 | -LL | / const BAD_UPVAR: &dyn FnOnce() = &{ -LL | | let bad_ref: &'static u16 = unsafe { mem::transmute(0usize) }; -LL | | let another_var = 13; -LL | | move || { let _ = bad_ref; let _ = another_var; } -LL | | }; - | |__^ type validation failed at .<deref>.<dyn-downcast>.<captured-var(bad_ref)>: encountered a null reference +LL | const BAD_UPVAR: &dyn FnOnce() = &{ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>.<dyn-downcast>.<captured-var(bad_ref)>: encountered a null reference | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 8, align: 4) { diff --git a/src/test/ui/consts/const-eval/ub-upvars.64bit.stderr b/src/test/ui/consts/const-eval/ub-upvars.64bit.stderr index 9cc9fb59bd7..64185a06362 100644 --- a/src/test/ui/consts/const-eval/ub-upvars.64bit.stderr +++ b/src/test/ui/consts/const-eval/ub-upvars.64bit.stderr @@ -1,12 +1,8 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/ub-upvars.rs:6:1 | -LL | / const BAD_UPVAR: &dyn FnOnce() = &{ -LL | | let bad_ref: &'static u16 = unsafe { mem::transmute(0usize) }; -LL | | let another_var = 13; -LL | | move || { let _ = bad_ref; let _ = another_var; } -LL | | }; - | |__^ type validation failed at .<deref>.<dyn-downcast>.<captured-var(bad_ref)>: encountered a null reference +LL | const BAD_UPVAR: &dyn FnOnce() = &{ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>.<dyn-downcast>.<captured-var(bad_ref)>: encountered a null reference | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 16, align: 8) { diff --git a/src/test/ui/consts/const-eval/ub-wide-ptr.32bit.stderr b/src/test/ui/consts/const-eval/ub-wide-ptr.32bit.stderr index 0c398f5bfd4..74f21c7c34f 100644 --- a/src/test/ui/consts/const-eval/ub-wide-ptr.32bit.stderr +++ b/src/test/ui/consts/const-eval/ub-wide-ptr.32bit.stderr @@ -2,7 +2,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/ub-wide-ptr.rs:37:1 | LL | const STR_TOO_LONG: &str = unsafe { mem::transmute((&42u8, 999usize)) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a dangling reference (going beyond the bounds of its allocation) + | ^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a dangling reference (going beyond the bounds of its allocation) | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 8, align: 4) { @@ -13,7 +13,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/ub-wide-ptr.rs:39:1 | LL | const NESTED_STR_MUCH_TOO_LONG: (&str,) = (unsafe { mem::transmute((&42, usize::MAX)) },); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed at .0: encountered invalid reference metadata: slice is bigger than largest supported object + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered invalid reference metadata: slice is bigger than largest supported object | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 8, align: 4) { @@ -24,7 +24,7 @@ error: any use of this value will cause an error --> $DIR/ub-wide-ptr.rs:42:1 | LL | const STR_LENGTH_PTR: &str = unsafe { mem::transmute((&42u8, &3)) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | = note: `#[deny(const_err)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -34,7 +34,7 @@ error: any use of this value will cause an error --> $DIR/ub-wide-ptr.rs:46:1 | LL | const MY_STR_LENGTH_PTR: &MyStr = unsafe { mem::transmute((&42u8, &3)) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> @@ -43,7 +43,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/ub-wide-ptr.rs:49:1 | LL | const MY_STR_MUCH_TOO_LONG: &MyStr = unsafe { mem::transmute((&42u8, usize::MAX)) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered invalid reference metadata: slice is bigger than largest supported object + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered invalid reference metadata: slice is bigger than largest supported object | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 8, align: 4) { @@ -54,7 +54,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/ub-wide-ptr.rs:53:1 | LL | const STR_NO_INIT: &str = unsafe { mem::transmute::<&[_], _>(&[MaybeUninit::<u8> { uninit: () }]) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed at .<deref>: encountered uninitialized data in `str` + | ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>: encountered uninitialized data in `str` | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 8, align: 4) { @@ -65,7 +65,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/ub-wide-ptr.rs:56:1 | LL | const MYSTR_NO_INIT: &MyStr = unsafe { mem::transmute::<&[_], _>(&[MaybeUninit::<u8> { uninit: () }]) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed at .<deref>.0: encountered uninitialized data in `str` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>.0: encountered uninitialized data in `str` | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 8, align: 4) { @@ -75,12 +75,8 @@ LL | const MYSTR_NO_INIT: &MyStr = unsafe { mem::transmute::<&[_], _>(&[MaybeUni error[E0080]: it is undefined behavior to use this value --> $DIR/ub-wide-ptr.rs:63:1 | -LL | / const SLICE_LENGTH_UNINIT: &[u8] = unsafe { -LL | | -LL | | let uninit_len = MaybeUninit::<usize> { uninit: () }; -LL | | mem::transmute((42, uninit_len)) -LL | | }; - | |__^ type validation failed: encountered uninitialized reference +LL | const SLICE_LENGTH_UNINIT: &[u8] = unsafe { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered uninitialized reference | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 8, align: 4) { @@ -91,7 +87,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/ub-wide-ptr.rs:69:1 | LL | const SLICE_TOO_LONG: &[u8] = unsafe { mem::transmute((&42u8, 999usize)) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a dangling reference (going beyond the bounds of its allocation) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a dangling reference (going beyond the bounds of its allocation) | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 8, align: 4) { @@ -102,7 +98,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/ub-wide-ptr.rs:72:1 | LL | const SLICE_TOO_LONG_OVERFLOW: &[u32] = unsafe { mem::transmute((&42u32, isize::MAX)) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered invalid reference metadata: slice is bigger than largest supported object + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered invalid reference metadata: slice is bigger than largest supported object | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 8, align: 4) { @@ -113,7 +109,7 @@ error: any use of this value will cause an error --> $DIR/ub-wide-ptr.rs:75:1 | LL | const SLICE_LENGTH_PTR: &[u8] = unsafe { mem::transmute((&42u8, &3)) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> @@ -122,7 +118,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/ub-wide-ptr.rs:79:1 | LL | const SLICE_TOO_LONG_BOX: Box<[u8]> = unsafe { mem::transmute((&42u8, 999usize)) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a dangling box (going beyond the bounds of its allocation) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a dangling box (going beyond the bounds of its allocation) | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 8, align: 4) { @@ -133,7 +129,7 @@ error: any use of this value will cause an error --> $DIR/ub-wide-ptr.rs:82:1 | LL | const SLICE_LENGTH_PTR_BOX: Box<[u8]> = unsafe { mem::transmute((&42u8, &3)) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> @@ -142,7 +138,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/ub-wide-ptr.rs:87:1 | LL | const SLICE_CONTENT_INVALID: &[bool] = &[unsafe { mem::transmute(3u8) }]; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed at .<deref>[0]: encountered 0x03, but expected a boolean + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered 0x03, but expected a boolean | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 4, align: 4) { @@ -153,9 +149,7 @@ error: any use of this value will cause an error --> $DIR/ub-wide-ptr.rs:87:40 | LL | const SLICE_CONTENT_INVALID: &[bool] = &[unsafe { mem::transmute(3u8) }]; - | ---------------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- - | | - | referenced constant has errors + | ------------------------------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> @@ -164,7 +158,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/ub-wide-ptr.rs:95:1 | LL | const MYSLICE_PREFIX_BAD: &MySliceBool = &MySlice(unsafe { mem::transmute(3u8) }, [false]); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed at .<deref>.0: encountered 0x03, but expected a boolean + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>.0: encountered 0x03, but expected a boolean | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 4, align: 4) { @@ -175,9 +169,7 @@ error: any use of this value will cause an error --> $DIR/ub-wide-ptr.rs:95:42 | LL | const MYSLICE_PREFIX_BAD: &MySliceBool = &MySlice(unsafe { mem::transmute(3u8) }, [false]); - | -----------------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- - | | - | referenced constant has errors + | -------------------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> @@ -186,7 +178,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/ub-wide-ptr.rs:100:1 | LL | const MYSLICE_SUFFIX_BAD: &MySliceBool = &MySlice(true, [unsafe { mem::transmute(3u8) }]); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed at .<deref>.1[0]: encountered 0x03, but expected a boolean + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>.1[0]: encountered 0x03, but expected a boolean | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 4, align: 4) { @@ -197,9 +189,7 @@ error: any use of this value will cause an error --> $DIR/ub-wide-ptr.rs:100:42 | LL | const MYSLICE_SUFFIX_BAD: &MySliceBool = &MySlice(true, [unsafe { mem::transmute(3u8) }]); - | -----------------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- - | | - | referenced constant has errors + | -------------------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> @@ -207,12 +197,8 @@ LL | const MYSLICE_SUFFIX_BAD: &MySliceBool = &MySlice(true, [unsafe { mem::tran error[E0080]: it is undefined behavior to use this value --> $DIR/ub-wide-ptr.rs:109:1 | -LL | / const RAW_SLICE_LENGTH_UNINIT: *const [u8] = unsafe { -LL | | -LL | | let uninit_len = MaybeUninit::<usize> { uninit: () }; -LL | | mem::transmute((42, uninit_len)) -LL | | }; - | |__^ type validation failed: encountered uninitialized raw pointer +LL | const RAW_SLICE_LENGTH_UNINIT: *const [u8] = unsafe { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered uninitialized raw pointer | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 8, align: 4) { @@ -223,7 +209,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/ub-wide-ptr.rs:117:1 | LL | const TRAIT_OBJ_SHORT_VTABLE_1: W<&dyn Trait> = unsafe { mem::transmute(W((&92u8, &3u8))) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed at .0: encountered too small vtable + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered too small vtable | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 8, align: 4) { @@ -234,7 +220,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/ub-wide-ptr.rs:120:1 | LL | const TRAIT_OBJ_SHORT_VTABLE_2: W<&dyn Trait> = unsafe { mem::transmute(W((&92u8, &3u64))) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed at .0: encountered too small vtable + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered too small vtable | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 8, align: 4) { @@ -245,7 +231,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/ub-wide-ptr.rs:123:1 | LL | const TRAIT_OBJ_INT_VTABLE: W<&dyn Trait> = unsafe { mem::transmute(W((&92u8, 4usize))) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed at .0: encountered dangling vtable pointer in wide pointer + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered dangling vtable pointer in wide pointer | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 8, align: 4) { @@ -256,7 +242,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/ub-wide-ptr.rs:125:1 | LL | const TRAIT_OBJ_UNALIGNED_VTABLE: &dyn Trait = unsafe { mem::transmute((&92u8, &[0u8; 128])) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered unaligned vtable pointer in wide pointer + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered unaligned vtable pointer in wide pointer | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 8, align: 4) { @@ -267,7 +253,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/ub-wide-ptr.rs:127:1 | LL | const TRAIT_OBJ_BAD_DROP_FN_NULL: &dyn Trait = unsafe { mem::transmute((&92u8, &[0usize; 8])) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered invalid drop function pointer in vtable (not pointing to a function) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered invalid drop function pointer in vtable (not pointing to a function) | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 8, align: 4) { @@ -278,7 +264,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/ub-wide-ptr.rs:129:1 | LL | const TRAIT_OBJ_BAD_DROP_FN_INT: &dyn Trait = unsafe { mem::transmute((&92u8, &[1usize; 8])) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered invalid drop function pointer in vtable (not pointing to a function) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered invalid drop function pointer in vtable (not pointing to a function) | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 8, align: 4) { @@ -289,7 +275,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/ub-wide-ptr.rs:131:1 | LL | const TRAIT_OBJ_BAD_DROP_FN_NOT_FN_PTR: W<&dyn Trait> = unsafe { mem::transmute(W((&92u8, &[&42u8; 8]))) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed at .0: encountered invalid drop function pointer in vtable (not pointing to a function) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered invalid drop function pointer in vtable (not pointing to a function) | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 8, align: 4) { @@ -300,7 +286,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/ub-wide-ptr.rs:135:1 | LL | const TRAIT_OBJ_CONTENT_INVALID: &dyn Trait = unsafe { mem::transmute::<_, &bool>(&3u8) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed at .<deref>.<dyn-downcast>: encountered 0x03, but expected a boolean + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>.<dyn-downcast>: encountered 0x03, but expected a boolean | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 8, align: 4) { @@ -311,7 +297,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/ub-wide-ptr.rs:139:1 | LL | const RAW_TRAIT_OBJ_VTABLE_NULL: *const dyn Trait = unsafe { mem::transmute((&92u8, 0usize)) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered dangling vtable pointer in wide pointer + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered dangling vtable pointer in wide pointer | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 8, align: 4) { @@ -322,7 +308,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/ub-wide-ptr.rs:141:1 | LL | const RAW_TRAIT_OBJ_VTABLE_INVALID: *const dyn Trait = unsafe { mem::transmute((&92u8, &3u64)) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered too small vtable + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered too small vtable | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 8, align: 4) { @@ -349,7 +335,7 @@ error: any use of this value will cause an error --> $DIR/ub-wide-ptr.rs:42:1 | LL | const STR_LENGTH_PTR: &str = unsafe { mem::transmute((&42u8, &3)) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | = note: `#[deny(const_err)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -360,7 +346,7 @@ error: any use of this value will cause an error --> $DIR/ub-wide-ptr.rs:46:1 | LL | const MY_STR_LENGTH_PTR: &MyStr = unsafe { mem::transmute((&42u8, &3)) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | = note: `#[deny(const_err)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -371,7 +357,7 @@ error: any use of this value will cause an error --> $DIR/ub-wide-ptr.rs:75:1 | LL | const SLICE_LENGTH_PTR: &[u8] = unsafe { mem::transmute((&42u8, &3)) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | = note: `#[deny(const_err)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -382,7 +368,7 @@ error: any use of this value will cause an error --> $DIR/ub-wide-ptr.rs:82:1 | LL | const SLICE_LENGTH_PTR_BOX: Box<[u8]> = unsafe { mem::transmute((&42u8, &3)) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | = note: `#[deny(const_err)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -393,9 +379,7 @@ error: any use of this value will cause an error --> $DIR/ub-wide-ptr.rs:87:40 | LL | const SLICE_CONTENT_INVALID: &[bool] = &[unsafe { mem::transmute(3u8) }]; - | ---------------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- - | | - | referenced constant has errors + | ------------------------------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors | = note: `#[deny(const_err)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -406,9 +390,7 @@ error: any use of this value will cause an error --> $DIR/ub-wide-ptr.rs:95:42 | LL | const MYSLICE_PREFIX_BAD: &MySliceBool = &MySlice(unsafe { mem::transmute(3u8) }, [false]); - | -----------------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- - | | - | referenced constant has errors + | -------------------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors | = note: `#[deny(const_err)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -419,9 +401,7 @@ error: any use of this value will cause an error --> $DIR/ub-wide-ptr.rs:100:42 | LL | const MYSLICE_SUFFIX_BAD: &MySliceBool = &MySlice(true, [unsafe { mem::transmute(3u8) }]); - | -----------------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- - | | - | referenced constant has errors + | -------------------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors | = note: `#[deny(const_err)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! diff --git a/src/test/ui/consts/const-eval/ub-wide-ptr.64bit.stderr b/src/test/ui/consts/const-eval/ub-wide-ptr.64bit.stderr index bf53995d956..1775b0dc2ed 100644 --- a/src/test/ui/consts/const-eval/ub-wide-ptr.64bit.stderr +++ b/src/test/ui/consts/const-eval/ub-wide-ptr.64bit.stderr @@ -2,7 +2,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/ub-wide-ptr.rs:37:1 | LL | const STR_TOO_LONG: &str = unsafe { mem::transmute((&42u8, 999usize)) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a dangling reference (going beyond the bounds of its allocation) + | ^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a dangling reference (going beyond the bounds of its allocation) | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 16, align: 8) { @@ -13,7 +13,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/ub-wide-ptr.rs:39:1 | LL | const NESTED_STR_MUCH_TOO_LONG: (&str,) = (unsafe { mem::transmute((&42, usize::MAX)) },); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed at .0: encountered invalid reference metadata: slice is bigger than largest supported object + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered invalid reference metadata: slice is bigger than largest supported object | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 16, align: 8) { @@ -24,7 +24,7 @@ error: any use of this value will cause an error --> $DIR/ub-wide-ptr.rs:42:1 | LL | const STR_LENGTH_PTR: &str = unsafe { mem::transmute((&42u8, &3)) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | = note: `#[deny(const_err)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -34,7 +34,7 @@ error: any use of this value will cause an error --> $DIR/ub-wide-ptr.rs:46:1 | LL | const MY_STR_LENGTH_PTR: &MyStr = unsafe { mem::transmute((&42u8, &3)) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> @@ -43,7 +43,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/ub-wide-ptr.rs:49:1 | LL | const MY_STR_MUCH_TOO_LONG: &MyStr = unsafe { mem::transmute((&42u8, usize::MAX)) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered invalid reference metadata: slice is bigger than largest supported object + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered invalid reference metadata: slice is bigger than largest supported object | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 16, align: 8) { @@ -54,7 +54,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/ub-wide-ptr.rs:53:1 | LL | const STR_NO_INIT: &str = unsafe { mem::transmute::<&[_], _>(&[MaybeUninit::<u8> { uninit: () }]) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed at .<deref>: encountered uninitialized data in `str` + | ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>: encountered uninitialized data in `str` | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 16, align: 8) { @@ -65,7 +65,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/ub-wide-ptr.rs:56:1 | LL | const MYSTR_NO_INIT: &MyStr = unsafe { mem::transmute::<&[_], _>(&[MaybeUninit::<u8> { uninit: () }]) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed at .<deref>.0: encountered uninitialized data in `str` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>.0: encountered uninitialized data in `str` | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 16, align: 8) { @@ -75,12 +75,8 @@ LL | const MYSTR_NO_INIT: &MyStr = unsafe { mem::transmute::<&[_], _>(&[MaybeUni error[E0080]: it is undefined behavior to use this value --> $DIR/ub-wide-ptr.rs:63:1 | -LL | / const SLICE_LENGTH_UNINIT: &[u8] = unsafe { -LL | | -LL | | let uninit_len = MaybeUninit::<usize> { uninit: () }; -LL | | mem::transmute((42, uninit_len)) -LL | | }; - | |__^ type validation failed: encountered uninitialized reference +LL | const SLICE_LENGTH_UNINIT: &[u8] = unsafe { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered uninitialized reference | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 16, align: 8) { @@ -91,7 +87,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/ub-wide-ptr.rs:69:1 | LL | const SLICE_TOO_LONG: &[u8] = unsafe { mem::transmute((&42u8, 999usize)) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a dangling reference (going beyond the bounds of its allocation) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a dangling reference (going beyond the bounds of its allocation) | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 16, align: 8) { @@ -102,7 +98,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/ub-wide-ptr.rs:72:1 | LL | const SLICE_TOO_LONG_OVERFLOW: &[u32] = unsafe { mem::transmute((&42u32, isize::MAX)) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered invalid reference metadata: slice is bigger than largest supported object + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered invalid reference metadata: slice is bigger than largest supported object | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 16, align: 8) { @@ -113,7 +109,7 @@ error: any use of this value will cause an error --> $DIR/ub-wide-ptr.rs:75:1 | LL | const SLICE_LENGTH_PTR: &[u8] = unsafe { mem::transmute((&42u8, &3)) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> @@ -122,7 +118,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/ub-wide-ptr.rs:79:1 | LL | const SLICE_TOO_LONG_BOX: Box<[u8]> = unsafe { mem::transmute((&42u8, 999usize)) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a dangling box (going beyond the bounds of its allocation) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a dangling box (going beyond the bounds of its allocation) | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 16, align: 8) { @@ -133,7 +129,7 @@ error: any use of this value will cause an error --> $DIR/ub-wide-ptr.rs:82:1 | LL | const SLICE_LENGTH_PTR_BOX: Box<[u8]> = unsafe { mem::transmute((&42u8, &3)) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> @@ -142,7 +138,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/ub-wide-ptr.rs:87:1 | LL | const SLICE_CONTENT_INVALID: &[bool] = &[unsafe { mem::transmute(3u8) }]; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed at .<deref>[0]: encountered 0x03, but expected a boolean + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered 0x03, but expected a boolean | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 8, align: 8) { @@ -153,9 +149,7 @@ error: any use of this value will cause an error --> $DIR/ub-wide-ptr.rs:87:40 | LL | const SLICE_CONTENT_INVALID: &[bool] = &[unsafe { mem::transmute(3u8) }]; - | ---------------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- - | | - | referenced constant has errors + | ------------------------------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> @@ -164,7 +158,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/ub-wide-ptr.rs:95:1 | LL | const MYSLICE_PREFIX_BAD: &MySliceBool = &MySlice(unsafe { mem::transmute(3u8) }, [false]); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed at .<deref>.0: encountered 0x03, but expected a boolean + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>.0: encountered 0x03, but expected a boolean | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 8, align: 8) { @@ -175,9 +169,7 @@ error: any use of this value will cause an error --> $DIR/ub-wide-ptr.rs:95:42 | LL | const MYSLICE_PREFIX_BAD: &MySliceBool = &MySlice(unsafe { mem::transmute(3u8) }, [false]); - | -----------------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- - | | - | referenced constant has errors + | -------------------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> @@ -186,7 +178,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/ub-wide-ptr.rs:100:1 | LL | const MYSLICE_SUFFIX_BAD: &MySliceBool = &MySlice(true, [unsafe { mem::transmute(3u8) }]); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed at .<deref>.1[0]: encountered 0x03, but expected a boolean + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>.1[0]: encountered 0x03, but expected a boolean | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 8, align: 8) { @@ -197,9 +189,7 @@ error: any use of this value will cause an error --> $DIR/ub-wide-ptr.rs:100:42 | LL | const MYSLICE_SUFFIX_BAD: &MySliceBool = &MySlice(true, [unsafe { mem::transmute(3u8) }]); - | -----------------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- - | | - | referenced constant has errors + | -------------------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> @@ -207,12 +197,8 @@ LL | const MYSLICE_SUFFIX_BAD: &MySliceBool = &MySlice(true, [unsafe { mem::tran error[E0080]: it is undefined behavior to use this value --> $DIR/ub-wide-ptr.rs:109:1 | -LL | / const RAW_SLICE_LENGTH_UNINIT: *const [u8] = unsafe { -LL | | -LL | | let uninit_len = MaybeUninit::<usize> { uninit: () }; -LL | | mem::transmute((42, uninit_len)) -LL | | }; - | |__^ type validation failed: encountered uninitialized raw pointer +LL | const RAW_SLICE_LENGTH_UNINIT: *const [u8] = unsafe { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered uninitialized raw pointer | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 16, align: 8) { @@ -223,7 +209,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/ub-wide-ptr.rs:117:1 | LL | const TRAIT_OBJ_SHORT_VTABLE_1: W<&dyn Trait> = unsafe { mem::transmute(W((&92u8, &3u8))) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed at .0: encountered too small vtable + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered too small vtable | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 16, align: 8) { @@ -234,7 +220,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/ub-wide-ptr.rs:120:1 | LL | const TRAIT_OBJ_SHORT_VTABLE_2: W<&dyn Trait> = unsafe { mem::transmute(W((&92u8, &3u64))) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed at .0: encountered too small vtable + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered too small vtable | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 16, align: 8) { @@ -245,7 +231,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/ub-wide-ptr.rs:123:1 | LL | const TRAIT_OBJ_INT_VTABLE: W<&dyn Trait> = unsafe { mem::transmute(W((&92u8, 4usize))) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed at .0: encountered dangling vtable pointer in wide pointer + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered dangling vtable pointer in wide pointer | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 16, align: 8) { @@ -256,7 +242,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/ub-wide-ptr.rs:125:1 | LL | const TRAIT_OBJ_UNALIGNED_VTABLE: &dyn Trait = unsafe { mem::transmute((&92u8, &[0u8; 128])) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered unaligned vtable pointer in wide pointer + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered unaligned vtable pointer in wide pointer | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 16, align: 8) { @@ -267,7 +253,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/ub-wide-ptr.rs:127:1 | LL | const TRAIT_OBJ_BAD_DROP_FN_NULL: &dyn Trait = unsafe { mem::transmute((&92u8, &[0usize; 8])) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered invalid drop function pointer in vtable (not pointing to a function) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered invalid drop function pointer in vtable (not pointing to a function) | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 16, align: 8) { @@ -278,7 +264,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/ub-wide-ptr.rs:129:1 | LL | const TRAIT_OBJ_BAD_DROP_FN_INT: &dyn Trait = unsafe { mem::transmute((&92u8, &[1usize; 8])) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered invalid drop function pointer in vtable (not pointing to a function) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered invalid drop function pointer in vtable (not pointing to a function) | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 16, align: 8) { @@ -289,7 +275,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/ub-wide-ptr.rs:131:1 | LL | const TRAIT_OBJ_BAD_DROP_FN_NOT_FN_PTR: W<&dyn Trait> = unsafe { mem::transmute(W((&92u8, &[&42u8; 8]))) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed at .0: encountered invalid drop function pointer in vtable (not pointing to a function) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered invalid drop function pointer in vtable (not pointing to a function) | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 16, align: 8) { @@ -300,7 +286,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/ub-wide-ptr.rs:135:1 | LL | const TRAIT_OBJ_CONTENT_INVALID: &dyn Trait = unsafe { mem::transmute::<_, &bool>(&3u8) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed at .<deref>.<dyn-downcast>: encountered 0x03, but expected a boolean + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>.<dyn-downcast>: encountered 0x03, but expected a boolean | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 16, align: 8) { @@ -311,7 +297,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/ub-wide-ptr.rs:139:1 | LL | const RAW_TRAIT_OBJ_VTABLE_NULL: *const dyn Trait = unsafe { mem::transmute((&92u8, 0usize)) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered dangling vtable pointer in wide pointer + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered dangling vtable pointer in wide pointer | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 16, align: 8) { @@ -322,7 +308,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/ub-wide-ptr.rs:141:1 | LL | const RAW_TRAIT_OBJ_VTABLE_INVALID: *const dyn Trait = unsafe { mem::transmute((&92u8, &3u64)) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered too small vtable + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered too small vtable | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 16, align: 8) { @@ -349,7 +335,7 @@ error: any use of this value will cause an error --> $DIR/ub-wide-ptr.rs:42:1 | LL | const STR_LENGTH_PTR: &str = unsafe { mem::transmute((&42u8, &3)) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | = note: `#[deny(const_err)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -360,7 +346,7 @@ error: any use of this value will cause an error --> $DIR/ub-wide-ptr.rs:46:1 | LL | const MY_STR_LENGTH_PTR: &MyStr = unsafe { mem::transmute((&42u8, &3)) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | = note: `#[deny(const_err)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -371,7 +357,7 @@ error: any use of this value will cause an error --> $DIR/ub-wide-ptr.rs:75:1 | LL | const SLICE_LENGTH_PTR: &[u8] = unsafe { mem::transmute((&42u8, &3)) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | = note: `#[deny(const_err)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -382,7 +368,7 @@ error: any use of this value will cause an error --> $DIR/ub-wide-ptr.rs:82:1 | LL | const SLICE_LENGTH_PTR_BOX: Box<[u8]> = unsafe { mem::transmute((&42u8, &3)) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | = note: `#[deny(const_err)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -393,9 +379,7 @@ error: any use of this value will cause an error --> $DIR/ub-wide-ptr.rs:87:40 | LL | const SLICE_CONTENT_INVALID: &[bool] = &[unsafe { mem::transmute(3u8) }]; - | ---------------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- - | | - | referenced constant has errors + | ------------------------------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors | = note: `#[deny(const_err)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -406,9 +390,7 @@ error: any use of this value will cause an error --> $DIR/ub-wide-ptr.rs:95:42 | LL | const MYSLICE_PREFIX_BAD: &MySliceBool = &MySlice(unsafe { mem::transmute(3u8) }, [false]); - | -----------------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- - | | - | referenced constant has errors + | -------------------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors | = note: `#[deny(const_err)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -419,9 +401,7 @@ error: any use of this value will cause an error --> $DIR/ub-wide-ptr.rs:100:42 | LL | const MYSLICE_SUFFIX_BAD: &MySliceBool = &MySlice(true, [unsafe { mem::transmute(3u8) }]); - | -----------------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- - | | - | referenced constant has errors + | -------------------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors | = note: `#[deny(const_err)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! diff --git a/src/test/ui/consts/const-eval/union-const-eval-field.stderr b/src/test/ui/consts/const-eval/union-const-eval-field.stderr index 94ab6eeff28..c512e682504 100644 --- a/src/test/ui/consts/const-eval/union-const-eval-field.stderr +++ b/src/test/ui/consts/const-eval/union-const-eval-field.stderr @@ -2,7 +2,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/union-const-eval-field.rs:28:5 | LL | const FIELD3: Field3 = unsafe { UNION.field3 }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered uninitialized bytes, but expected initialized bytes + | ^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered uninitialized bytes, but expected initialized bytes | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 8, align: 8) { diff --git a/src/test/ui/consts/const-eval/union-ice.stderr b/src/test/ui/consts/const-eval/union-ice.stderr index 7f77f2c16ae..21a54550900 100644 --- a/src/test/ui/consts/const-eval/union-ice.stderr +++ b/src/test/ui/consts/const-eval/union-ice.stderr @@ -2,7 +2,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/union-ice.rs:14:1 | LL | const FIELD3: Field3 = unsafe { UNION.field3 }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered uninitialized bytes, but expected initialized bytes + | ^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered uninitialized bytes, but expected initialized bytes | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 8, align: 8) { @@ -12,11 +12,8 @@ LL | const FIELD3: Field3 = unsafe { UNION.field3 }; error[E0080]: it is undefined behavior to use this value --> $DIR/union-ice.rs:16:1 | -LL | / const FIELD_PATH: Struct = Struct { -LL | | a: 42, -LL | | b: unsafe { UNION.field3 }, -LL | | }; - | |__^ type validation failed at .b: encountered uninitialized bytes, but expected initialized bytes +LL | const FIELD_PATH: Struct = Struct { + | ^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .b: encountered uninitialized bytes, but expected initialized bytes | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 16, align: 8) { @@ -26,14 +23,8 @@ LL | | }; error[E0080]: it is undefined behavior to use this value --> $DIR/union-ice.rs:26:1 | -LL | / const FIELD_PATH2: Struct2 = Struct2 { -LL | | b: [ -LL | | 21, -LL | | unsafe { UNION.field3 }, -... | -LL | | a: 42, -LL | | }; - | |__^ type validation failed at .b[1]: encountered uninitialized bytes +LL | const FIELD_PATH2: Struct2 = Struct2 { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .b[1]: encountered uninitialized bytes | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 40, align: 8) { diff --git a/src/test/ui/consts/const-eval/union-ub.32bit.stderr b/src/test/ui/consts/const-eval/union-ub.32bit.stderr index d3e4bad968b..baf68259660 100644 --- a/src/test/ui/consts/const-eval/union-ub.32bit.stderr +++ b/src/test/ui/consts/const-eval/union-ub.32bit.stderr @@ -2,7 +2,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/union-ub.rs:33:1 | LL | const BAD_BOOL: bool = unsafe { DummyUnion { u8: 42 }.bool}; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered 0x2a, but expected a boolean + | ^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0x2a, but expected a boolean | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 1, align: 1) { @@ -13,7 +13,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/union-ub.rs:35:1 | LL | const UNINIT_BOOL: bool = unsafe { DummyUnion { unit: () }.bool}; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered uninitialized bytes, but expected a boolean + | ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered uninitialized bytes, but expected a boolean | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 1, align: 1) { diff --git a/src/test/ui/consts/const-eval/union-ub.64bit.stderr b/src/test/ui/consts/const-eval/union-ub.64bit.stderr index d3e4bad968b..baf68259660 100644 --- a/src/test/ui/consts/const-eval/union-ub.64bit.stderr +++ b/src/test/ui/consts/const-eval/union-ub.64bit.stderr @@ -2,7 +2,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/union-ub.rs:33:1 | LL | const BAD_BOOL: bool = unsafe { DummyUnion { u8: 42 }.bool}; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered 0x2a, but expected a boolean + | ^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0x2a, but expected a boolean | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 1, align: 1) { @@ -13,7 +13,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/union-ub.rs:35:1 | LL | const UNINIT_BOOL: bool = unsafe { DummyUnion { unit: () }.bool}; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered uninitialized bytes, but expected a boolean + | ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered uninitialized bytes, but expected a boolean | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 1, align: 1) { diff --git a/src/test/ui/consts/const-eval/unused-broken-const.stderr b/src/test/ui/consts/const-eval/unused-broken-const.stderr index bfc076aa5e6..df5bd524f27 100644 --- a/src/test/ui/consts/const-eval/unused-broken-const.stderr +++ b/src/test/ui/consts/const-eval/unused-broken-const.stderr @@ -2,9 +2,7 @@ error: any use of this value will cause an error --> $DIR/unused-broken-const.rs:5:18 | LL | const FOO: i32 = [][0]; - | -----------------^^^^^- - | | - | index out of bounds: the length is 0 but the index is 0 + | -------------- ^^^^^ index out of bounds: the length is 0 but the index is 0 | = note: `#[deny(const_err)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -17,9 +15,7 @@ error: any use of this value will cause an error --> $DIR/unused-broken-const.rs:5:18 | LL | const FOO: i32 = [][0]; - | -----------------^^^^^- - | | - | index out of bounds: the length is 0 but the index is 0 + | -------------- ^^^^^ index out of bounds: the length is 0 but the index is 0 | = note: `#[deny(const_err)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! diff --git a/src/test/ui/consts/const-eval/validate_uninhabited_zsts.32bit.stderr b/src/test/ui/consts/const-eval/validate_uninhabited_zsts.32bit.stderr index acb9bda31d1..bdaeb4a0fbe 100644 --- a/src/test/ui/consts/const-eval/validate_uninhabited_zsts.32bit.stderr +++ b/src/test/ui/consts/const-eval/validate_uninhabited_zsts.32bit.stderr @@ -26,7 +26,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/validate_uninhabited_zsts.rs:23:1 | LL | const BAR: [empty::Empty; 3] = [unsafe { std::mem::transmute(()) }; 3]; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed at [0].0: encountered a value of uninhabited type empty::Void + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at [0].0: encountered a value of uninhabited type empty::Void | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 0, align: 1) {} diff --git a/src/test/ui/consts/const-eval/validate_uninhabited_zsts.64bit.stderr b/src/test/ui/consts/const-eval/validate_uninhabited_zsts.64bit.stderr index acb9bda31d1..bdaeb4a0fbe 100644 --- a/src/test/ui/consts/const-eval/validate_uninhabited_zsts.64bit.stderr +++ b/src/test/ui/consts/const-eval/validate_uninhabited_zsts.64bit.stderr @@ -26,7 +26,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/validate_uninhabited_zsts.rs:23:1 | LL | const BAR: [empty::Empty; 3] = [unsafe { std::mem::transmute(()) }; 3]; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed at [0].0: encountered a value of uninhabited type empty::Void + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at [0].0: encountered a value of uninhabited type empty::Void | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 0, align: 1) {} diff --git a/src/test/ui/consts/const-float-bits-reject-conv.stderr b/src/test/ui/consts/const-float-bits-reject-conv.stderr index d822171df72..b77c6591d49 100644 --- a/src/test/ui/consts/const-float-bits-reject-conv.stderr +++ b/src/test/ui/consts/const-float-bits-reject-conv.stderr @@ -60,7 +60,7 @@ error: any use of this value will cause an error --> $DIR/const-float-bits-reject-conv.rs:30:34 | LL | const _: () = assert!($a); - | -------------------------- + | ----------- ... LL | const_assert!(f32::from_bits(MASKED_NAN1).is_nan()); | ^^^^^^^^^^^ referenced constant has errors @@ -73,7 +73,7 @@ error: any use of this value will cause an error --> $DIR/const-float-bits-reject-conv.rs:33:34 | LL | const _: () = assert!($a); - | -------------------------- + | ----------- ... LL | const_assert!(f32::from_bits(MASKED_NAN1).is_nan()); | ^^^^^^^^^^^ referenced constant has errors @@ -85,7 +85,7 @@ error: any use of this value will cause an error --> $DIR/const-float-bits-reject-conv.rs:41:38 | LL | const _: () = assert!($a == $b); - | -------------------------------- + | ----------- ... LL | const_assert!(f32::from_bits(MASKED_NAN1).to_bits(), MASKED_NAN1); | ^^^^^^^^^^^ referenced constant has errors @@ -97,7 +97,7 @@ error: any use of this value will cause an error --> $DIR/const-float-bits-reject-conv.rs:44:38 | LL | const _: () = assert!($a == $b); - | -------------------------------- + | ----------- ... LL | const_assert!(f32::from_bits(MASKED_NAN2).to_bits(), MASKED_NAN2); | ^^^^^^^^^^^ referenced constant has errors @@ -167,7 +167,7 @@ error: any use of this value will cause an error --> $DIR/const-float-bits-reject-conv.rs:57:34 | LL | const _: () = assert!($a); - | -------------------------- + | ----------- ... LL | const_assert!(f64::from_bits(MASKED_NAN1).is_nan()); | ^^^^^^^^^^^ referenced constant has errors @@ -179,7 +179,7 @@ error: any use of this value will cause an error --> $DIR/const-float-bits-reject-conv.rs:60:34 | LL | const _: () = assert!($a); - | -------------------------- + | ----------- ... LL | const_assert!(f64::from_bits(MASKED_NAN1).is_nan()); | ^^^^^^^^^^^ referenced constant has errors @@ -191,7 +191,7 @@ error: any use of this value will cause an error --> $DIR/const-float-bits-reject-conv.rs:66:38 | LL | const _: () = assert!($a == $b); - | -------------------------------- + | ----------- ... LL | const_assert!(f64::from_bits(MASKED_NAN1).to_bits(), MASKED_NAN1); | ^^^^^^^^^^^ referenced constant has errors @@ -203,7 +203,7 @@ error: any use of this value will cause an error --> $DIR/const-float-bits-reject-conv.rs:69:38 | LL | const _: () = assert!($a == $b); - | -------------------------------- + | ----------- ... LL | const_assert!(f64::from_bits(MASKED_NAN2).to_bits(), MASKED_NAN2); | ^^^^^^^^^^^ referenced constant has errors @@ -219,7 +219,7 @@ error: any use of this value will cause an error --> $DIR/const-float-bits-reject-conv.rs:30:34 | LL | const _: () = assert!($a); - | -------------------------- + | ----------- ... LL | const_assert!(f32::from_bits(MASKED_NAN1).is_nan()); | ^^^^^^^^^^^ referenced constant has errors @@ -233,7 +233,7 @@ error: any use of this value will cause an error --> $DIR/const-float-bits-reject-conv.rs:33:34 | LL | const _: () = assert!($a); - | -------------------------- + | ----------- ... LL | const_assert!(f32::from_bits(MASKED_NAN1).is_nan()); | ^^^^^^^^^^^ referenced constant has errors @@ -247,7 +247,7 @@ error: any use of this value will cause an error --> $DIR/const-float-bits-reject-conv.rs:41:38 | LL | const _: () = assert!($a == $b); - | -------------------------------- + | ----------- ... LL | const_assert!(f32::from_bits(MASKED_NAN1).to_bits(), MASKED_NAN1); | ^^^^^^^^^^^ referenced constant has errors @@ -261,7 +261,7 @@ error: any use of this value will cause an error --> $DIR/const-float-bits-reject-conv.rs:44:38 | LL | const _: () = assert!($a == $b); - | -------------------------------- + | ----------- ... LL | const_assert!(f32::from_bits(MASKED_NAN2).to_bits(), MASKED_NAN2); | ^^^^^^^^^^^ referenced constant has errors @@ -275,7 +275,7 @@ error: any use of this value will cause an error --> $DIR/const-float-bits-reject-conv.rs:57:34 | LL | const _: () = assert!($a); - | -------------------------- + | ----------- ... LL | const_assert!(f64::from_bits(MASKED_NAN1).is_nan()); | ^^^^^^^^^^^ referenced constant has errors @@ -289,7 +289,7 @@ error: any use of this value will cause an error --> $DIR/const-float-bits-reject-conv.rs:60:34 | LL | const _: () = assert!($a); - | -------------------------- + | ----------- ... LL | const_assert!(f64::from_bits(MASKED_NAN1).is_nan()); | ^^^^^^^^^^^ referenced constant has errors @@ -303,7 +303,7 @@ error: any use of this value will cause an error --> $DIR/const-float-bits-reject-conv.rs:66:38 | LL | const _: () = assert!($a == $b); - | -------------------------------- + | ----------- ... LL | const_assert!(f64::from_bits(MASKED_NAN1).to_bits(), MASKED_NAN1); | ^^^^^^^^^^^ referenced constant has errors @@ -317,7 +317,7 @@ error: any use of this value will cause an error --> $DIR/const-float-bits-reject-conv.rs:69:38 | LL | const _: () = assert!($a == $b); - | -------------------------------- + | ----------- ... LL | const_assert!(f64::from_bits(MASKED_NAN2).to_bits(), MASKED_NAN2); | ^^^^^^^^^^^ referenced constant has errors diff --git a/src/test/ui/consts/const-len-underflow-separate-spans.stderr b/src/test/ui/consts/const-len-underflow-separate-spans.stderr index 0c10783476a..d1bf4b92e6a 100644 --- a/src/test/ui/consts/const-len-underflow-separate-spans.stderr +++ b/src/test/ui/consts/const-len-underflow-separate-spans.stderr @@ -2,9 +2,7 @@ error: any use of this value will cause an error --> $DIR/const-len-underflow-separate-spans.rs:7:20 | LL | const LEN: usize = ONE - TWO; - | -------------------^^^^^^^^^- - | | - | attempt to compute `1_usize - 2_usize`, which would overflow + | ---------------- ^^^^^^^^^ attempt to compute `1_usize - 2_usize`, which would overflow | = note: `#[deny(const_err)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -24,9 +22,7 @@ error: any use of this value will cause an error --> $DIR/const-len-underflow-separate-spans.rs:7:20 | LL | const LEN: usize = ONE - TWO; - | -------------------^^^^^^^^^- - | | - | attempt to compute `1_usize - 2_usize`, which would overflow + | ---------------- ^^^^^^^^^ attempt to compute `1_usize - 2_usize`, which would overflow | = note: `#[deny(const_err)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! diff --git a/src/test/ui/consts/const-mut-refs/mut_ref_in_final_dynamic_check.stderr b/src/test/ui/consts/const-mut-refs/mut_ref_in_final_dynamic_check.stderr index 9c1733e827d..f2aec37a729 100644 --- a/src/test/ui/consts/const-mut-refs/mut_ref_in_final_dynamic_check.stderr +++ b/src/test/ui/consts/const-mut-refs/mut_ref_in_final_dynamic_check.stderr @@ -14,7 +14,7 @@ error: encountered dangling pointer in final constant --> $DIR/mut_ref_in_final_dynamic_check.rs:25:1 | LL | const B: Option<&mut i32> = helper2(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/consts/const-pattern-irrefutable.stderr b/src/test/ui/consts/const-pattern-irrefutable.stderr index 3e3bc1979a2..a2b8f072c6e 100644 --- a/src/test/ui/consts/const-pattern-irrefutable.stderr +++ b/src/test/ui/consts/const-pattern-irrefutable.stderr @@ -2,7 +2,7 @@ error[E0005]: refutable pattern in local binding: `0_u8..=1_u8` and `3_u8..=u8:: --> $DIR/const-pattern-irrefutable.rs:12:9 | LL | const a: u8 = 2; - | ---------------- constant defined here + | ----------- constant defined here ... LL | let a = 4; | ^ @@ -16,7 +16,7 @@ error[E0005]: refutable pattern in local binding: `0_u8..=1_u8` and `3_u8..=u8:: --> $DIR/const-pattern-irrefutable.rs:13:9 | LL | pub const b: u8 = 2; - | -------------------- constant defined here + | --------------- constant defined here ... LL | let c = 4; | ^ @@ -30,7 +30,7 @@ error[E0005]: refutable pattern in local binding: `0_u8..=1_u8` and `3_u8..=u8:: --> $DIR/const-pattern-irrefutable.rs:14:9 | LL | pub const d: u8 = 2; - | -------------------- constant defined here + | --------------- constant defined here ... LL | let d = 4; | ^ diff --git a/src/test/ui/consts/const-points-to-static.32bit.stderr b/src/test/ui/consts/const-points-to-static.32bit.stderr index 78af2c30d04..97825dd0eb5 100644 --- a/src/test/ui/consts/const-points-to-static.32bit.stderr +++ b/src/test/ui/consts/const-points-to-static.32bit.stderr @@ -2,7 +2,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/const-points-to-static.rs:6:1 | LL | const TEST: &u8 = &MY_STATIC; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a reference pointing to a static variable + | ^^^^^^^^^^^^^^^ constructing invalid value: encountered a reference pointing to a static variable | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 4, align: 4) { diff --git a/src/test/ui/consts/const-points-to-static.64bit.stderr b/src/test/ui/consts/const-points-to-static.64bit.stderr index f5a0a6b0add..0d4a5a8ce4f 100644 --- a/src/test/ui/consts/const-points-to-static.64bit.stderr +++ b/src/test/ui/consts/const-points-to-static.64bit.stderr @@ -2,7 +2,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/const-points-to-static.rs:6:1 | LL | const TEST: &u8 = &MY_STATIC; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a reference pointing to a static variable + | ^^^^^^^^^^^^^^^ constructing invalid value: encountered a reference pointing to a static variable | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 8, align: 8) { diff --git a/src/test/ui/consts/const-prop-read-static-in-const.stderr b/src/test/ui/consts/const-prop-read-static-in-const.stderr index a60cd16f05a..ea5ad24b0b1 100644 --- a/src/test/ui/consts/const-prop-read-static-in-const.stderr +++ b/src/test/ui/consts/const-prop-read-static-in-const.stderr @@ -2,9 +2,7 @@ error: any use of this value will cause an error --> $DIR/const-prop-read-static-in-const.rs:5:18 | LL | const TEST: u8 = MY_STATIC; - | -----------------^^^^^^^^^- - | | - | constant accesses static + | -------------- ^^^^^^^^^ constant accesses static | = note: `#[deny(const_err)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -25,9 +23,7 @@ error: any use of this value will cause an error --> $DIR/const-prop-read-static-in-const.rs:5:18 | LL | const TEST: u8 = MY_STATIC; - | -----------------^^^^^^^^^- - | | - | constant accesses static + | -------------- ^^^^^^^^^ constant accesses static | = note: `#[deny(const_err)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! diff --git a/src/test/ui/consts/const-size_of_val-align_of_val-extern-type.stderr b/src/test/ui/consts/const-size_of_val-align_of_val-extern-type.stderr index c6e0b321124..d19a89378ec 100644 --- a/src/test/ui/consts/const-size_of_val-align_of_val-extern-type.stderr +++ b/src/test/ui/consts/const-size_of_val-align_of_val-extern-type.stderr @@ -2,9 +2,7 @@ error: any use of this value will cause an error --> $DIR/const-size_of_val-align_of_val-extern-type.rs:11:31 | LL | const _SIZE: usize = unsafe { size_of_val(&4 as *const i32 as *const Opaque) }; - | ------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--- - | | - | `extern type` does not have known layout + | ------------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `extern type` does not have known layout | = note: `#[deny(const_err)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -14,9 +12,7 @@ error: any use of this value will cause an error --> $DIR/const-size_of_val-align_of_val-extern-type.rs:13:32 | LL | const _ALIGN: usize = unsafe { min_align_of_val(&4 as *const i32 as *const Opaque) }; - | -------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--- - | | - | `extern type` does not have known layout + | ------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `extern type` does not have known layout | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> @@ -28,9 +24,7 @@ error: any use of this value will cause an error --> $DIR/const-size_of_val-align_of_val-extern-type.rs:11:31 | LL | const _SIZE: usize = unsafe { size_of_val(&4 as *const i32 as *const Opaque) }; - | ------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--- - | | - | `extern type` does not have known layout + | ------------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `extern type` does not have known layout | = note: `#[deny(const_err)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -41,9 +35,7 @@ error: any use of this value will cause an error --> $DIR/const-size_of_val-align_of_val-extern-type.rs:13:32 | LL | const _ALIGN: usize = unsafe { min_align_of_val(&4 as *const i32 as *const Opaque) }; - | -------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--- - | | - | `extern type` does not have known layout + | ------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `extern type` does not have known layout | = note: `#[deny(const_err)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! diff --git a/src/test/ui/consts/const-slice-oob.stderr b/src/test/ui/consts/const-slice-oob.stderr index c9f949727bc..27c21e7af14 100644 --- a/src/test/ui/consts/const-slice-oob.stderr +++ b/src/test/ui/consts/const-slice-oob.stderr @@ -2,9 +2,7 @@ error: any use of this value will cause an error --> $DIR/const-slice-oob.rs:4:18 | LL | const BAR: u32 = FOO[5]; - | -----------------^^^^^^- - | | - | index out of bounds: the length is 3 but the index is 5 + | -------------- ^^^^^^ index out of bounds: the length is 3 but the index is 5 | = note: `#[deny(const_err)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -17,9 +15,7 @@ error: any use of this value will cause an error --> $DIR/const-slice-oob.rs:4:18 | LL | const BAR: u32 = FOO[5]; - | -----------------^^^^^^- - | | - | index out of bounds: the length is 3 but the index is 5 + | -------------- ^^^^^^ index out of bounds: the length is 3 but the index is 5 | = note: `#[deny(const_err)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! diff --git a/src/test/ui/consts/const_limit/const_eval_limit_reached.stderr b/src/test/ui/consts/const_limit/const_eval_limit_reached.stderr index ee95b0d5180..e450f4aa3bd 100644 --- a/src/test/ui/consts/const_limit/const_eval_limit_reached.stderr +++ b/src/test/ui/consts/const_limit/const_eval_limit_reached.stderr @@ -1,15 +1,11 @@ error: any use of this value will cause an error --> $DIR/const_eval_limit_reached.rs:6:11 | -LL | / const X: usize = { -LL | | let mut x = 0; -LL | | while x != 1000 { - | | ^^^^^^^^^ exceeded interpreter step limit (see `#[const_eval_limit]`) -LL | | -... | -LL | | x -LL | | }; - | |__- +LL | const X: usize = { + | -------------- +LL | let mut x = 0; +LL | while x != 1000 { + | ^^^^^^^^^ exceeded interpreter step limit (see `#[const_eval_limit]`) | = note: `#[deny(const_err)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -21,15 +17,11 @@ Future incompatibility report: Future breakage diagnostic: error: any use of this value will cause an error --> $DIR/const_eval_limit_reached.rs:6:11 | -LL | / const X: usize = { -LL | | let mut x = 0; -LL | | while x != 1000 { - | | ^^^^^^^^^ exceeded interpreter step limit (see `#[const_eval_limit]`) -LL | | -... | -LL | | x -LL | | }; - | |__- +LL | const X: usize = { + | -------------- +LL | let mut x = 0; +LL | while x != 1000 { + | ^^^^^^^^^ exceeded interpreter step limit (see `#[const_eval_limit]`) | = note: `#[deny(const_err)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! diff --git a/src/test/ui/consts/dangling-alloc-id-ice.stderr b/src/test/ui/consts/dangling-alloc-id-ice.stderr index 24f57449872..8410034c041 100644 --- a/src/test/ui/consts/dangling-alloc-id-ice.stderr +++ b/src/test/ui/consts/dangling-alloc-id-ice.stderr @@ -1,12 +1,8 @@ error: encountered dangling pointer in final constant --> $DIR/dangling-alloc-id-ice.rs:9:1 | -LL | / const FOO: &() = { -LL | | -LL | | let y = (); -LL | | unsafe { Foo { y: &y }.long_live_the_unit } -LL | | }; - | |__^ +LL | const FOO: &() = { + | ^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/consts/dangling_raw_ptr.stderr b/src/test/ui/consts/dangling_raw_ptr.stderr index a79ac62d5cd..bdfe1e4effe 100644 --- a/src/test/ui/consts/dangling_raw_ptr.stderr +++ b/src/test/ui/consts/dangling_raw_ptr.stderr @@ -1,11 +1,8 @@ error: encountered dangling pointer in final constant --> $DIR/dangling_raw_ptr.rs:1:1 | -LL | / const FOO: *const u32 = { -LL | | let x = 42; -LL | | &x -LL | | }; - | |__^ +LL | const FOO: *const u32 = { + | ^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/consts/invalid-union.32bit.stderr b/src/test/ui/consts/invalid-union.32bit.stderr index bd7c95342f7..7e9abc3ffa7 100644 --- a/src/test/ui/consts/invalid-union.32bit.stderr +++ b/src/test/ui/consts/invalid-union.32bit.stderr @@ -2,7 +2,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/invalid-union.rs:40:1 | LL | fn main() { - | ^^^^^^^^^ type validation failed at .<deref>.y.<enum-variant(B)>.0: encountered `UnsafeCell` in a `const` + | ^^^^^^^^^ constructing invalid value at .<deref>.y.<enum-variant(B)>.0: encountered `UnsafeCell` in a `const` | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 4, align: 4) { diff --git a/src/test/ui/consts/invalid-union.64bit.stderr b/src/test/ui/consts/invalid-union.64bit.stderr index 0d8b8ffcc16..81c10244249 100644 --- a/src/test/ui/consts/invalid-union.64bit.stderr +++ b/src/test/ui/consts/invalid-union.64bit.stderr @@ -2,7 +2,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/invalid-union.rs:40:1 | LL | fn main() { - | ^^^^^^^^^ type validation failed at .<deref>.y.<enum-variant(B)>.0: encountered `UnsafeCell` in a `const` + | ^^^^^^^^^ constructing invalid value at .<deref>.y.<enum-variant(B)>.0: encountered `UnsafeCell` in a `const` | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 8, align: 8) { diff --git a/src/test/ui/consts/issue-36163.stderr b/src/test/ui/consts/issue-36163.stderr index 9ac6c984cb0..4797d10b7a8 100644 --- a/src/test/ui/consts/issue-36163.stderr +++ b/src/test/ui/consts/issue-36163.stderr @@ -8,7 +8,7 @@ note: ...which requires const-evaluating + checking `A`... --> $DIR/issue-36163.rs:1:1 | LL | const A: isize = Foo::B as isize; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^ = note: ...which again requires const-evaluating + checking `Foo::B::{constant#0}`, completing the cycle note: cycle used when simplifying constant for the type system `Foo::B::{constant#0}` --> $DIR/issue-36163.rs:4:9 diff --git a/src/test/ui/consts/issue-50439.rs b/src/test/ui/consts/issue-50439.rs new file mode 100644 index 00000000000..0be7c405473 --- /dev/null +++ b/src/test/ui/consts/issue-50439.rs @@ -0,0 +1,29 @@ +#![feature(specialization)] +#![allow(incomplete_features)] + +pub trait ReflectDrop { + const REFLECT_DROP: bool = false; +} + +impl<T> ReflectDrop for T where T: Clone {} + +pub trait PinDropInternal { + fn is_valid() + where + Self: ReflectDrop; +} + +struct Bears<T>(T); + +default impl<T> ReflectDrop for Bears<T> {} + +impl<T: Sized> PinDropInternal for Bears<T> { + fn is_valid() + where + Self: ReflectDrop, + { + let _ = [(); 0 - !!(<Bears<T> as ReflectDrop>::REFLECT_DROP) as usize]; //~ ERROR constant expression depends on a generic parameter + } +} + +fn main() {} diff --git a/src/test/ui/consts/issue-50439.stderr b/src/test/ui/consts/issue-50439.stderr new file mode 100644 index 00000000000..3fbdf33b2d8 --- /dev/null +++ b/src/test/ui/consts/issue-50439.stderr @@ -0,0 +1,10 @@ +error: constant expression depends on a generic parameter + --> $DIR/issue-50439.rs:25:22 + | +LL | let _ = [(); 0 - !!(<Bears<T> as ReflectDrop>::REFLECT_DROP) as usize]; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: this may fail depending on what value the parameter takes + +error: aborting due to previous error + diff --git a/src/test/ui/consts/issue-63952.32bit.stderr b/src/test/ui/consts/issue-63952.32bit.stderr index 6a6097d5ec6..755c7fb7d4d 100644 --- a/src/test/ui/consts/issue-63952.32bit.stderr +++ b/src/test/ui/consts/issue-63952.32bit.stderr @@ -1,14 +1,8 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/issue-63952.rs:17:1 | -LL | / const SLICE_WAY_TOO_LONG: &[u8] = unsafe { -LL | | SliceTransmute { -LL | | repr: SliceRepr { -LL | | ptr: &42, -... | -LL | | .slice -LL | | }; - | |__^ type validation failed: encountered invalid reference metadata: slice is bigger than largest supported object +LL | const SLICE_WAY_TOO_LONG: &[u8] = unsafe { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered invalid reference metadata: slice is bigger than largest supported object | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 8, align: 4) { diff --git a/src/test/ui/consts/issue-63952.64bit.stderr b/src/test/ui/consts/issue-63952.64bit.stderr index 6547c3384da..abdb9a4f792 100644 --- a/src/test/ui/consts/issue-63952.64bit.stderr +++ b/src/test/ui/consts/issue-63952.64bit.stderr @@ -1,14 +1,8 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/issue-63952.rs:17:1 | -LL | / const SLICE_WAY_TOO_LONG: &[u8] = unsafe { -LL | | SliceTransmute { -LL | | repr: SliceRepr { -LL | | ptr: &42, -... | -LL | | .slice -LL | | }; - | |__^ type validation failed: encountered invalid reference metadata: slice is bigger than largest supported object +LL | const SLICE_WAY_TOO_LONG: &[u8] = unsafe { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered invalid reference metadata: slice is bigger than largest supported object | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 16, align: 8) { diff --git a/src/test/ui/consts/issue-79690.64bit.stderr b/src/test/ui/consts/issue-79690.64bit.stderr index bf0ef9e6dc0..c7aba555370 100644 --- a/src/test/ui/consts/issue-79690.64bit.stderr +++ b/src/test/ui/consts/issue-79690.64bit.stderr @@ -2,7 +2,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/issue-79690.rs:30:1 | LL | const G: Fat = unsafe { Transmute { t: FOO }.u }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed at .1.<deref>.size.foo: encountered (potentially part of) a pointer, but expected plain (non-pointer) bytes + | ^^^^^^^^^^^^ constructing invalid value at .1.<deref>.size.foo: encountered (potentially part of) a pointer, but expected plain (non-pointer) bytes | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 16, align: 8) { diff --git a/src/test/ui/consts/issue-83182.32bit.stderr b/src/test/ui/consts/issue-83182.32bit.stderr index a15668d4ec1..c810c8a7848 100644 --- a/src/test/ui/consts/issue-83182.32bit.stderr +++ b/src/test/ui/consts/issue-83182.32bit.stderr @@ -2,7 +2,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/issue-83182.rs:5:1 | LL | const MYSTR_NO_INIT: &MyStr = unsafe { mem::transmute::<&[_], _>(&[&()]) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed at .<deref>.0: encountered a pointer in `str` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>.0: encountered a pointer in `str` | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 8, align: 4) { diff --git a/src/test/ui/consts/issue-83182.64bit.stderr b/src/test/ui/consts/issue-83182.64bit.stderr index 5c3ade7c1de..5fc2c934474 100644 --- a/src/test/ui/consts/issue-83182.64bit.stderr +++ b/src/test/ui/consts/issue-83182.64bit.stderr @@ -2,7 +2,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/issue-83182.rs:5:1 | LL | const MYSTR_NO_INIT: &MyStr = unsafe { mem::transmute::<&[_], _>(&[&()]) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed at .<deref>.0: encountered a pointer in `str` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>.0: encountered a pointer in `str` | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 16, align: 8) { diff --git a/src/test/ui/consts/issue-83182.rs b/src/test/ui/consts/issue-83182.rs index f714fd6e8f9..29276584304 100644 --- a/src/test/ui/consts/issue-83182.rs +++ b/src/test/ui/consts/issue-83182.rs @@ -4,5 +4,5 @@ use std::mem; struct MyStr(str); const MYSTR_NO_INIT: &MyStr = unsafe { mem::transmute::<&[_], _>(&[&()]) }; //~^ ERROR: it is undefined behavior to use this value -//~| type validation failed at .<deref>.0: encountered a pointer in `str` +//~| constructing invalid value at .<deref>.0: encountered a pointer in `str` fn main() {} diff --git a/src/test/ui/consts/issue-miri-1910.stderr b/src/test/ui/consts/issue-miri-1910.stderr index e76a1f96b46..afcf11bd5f2 100644 --- a/src/test/ui/consts/issue-miri-1910.stderr +++ b/src/test/ui/consts/issue-miri-1910.stderr @@ -1,22 +1,18 @@ error: any use of this value will cause an error --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL | -LL | copy_nonoverlapping(src, tmp.as_mut_ptr(), 1); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | unable to turn pointer into raw bytes - | inside `std::ptr::read::<u8>` at $SRC_DIR/core/src/ptr/mod.rs:LL:COL - | inside `ptr::const_ptr::<impl *const u8>::read` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL - | inside `C` at $DIR/issue-miri-1910.rs:7:5 +LL | copy_nonoverlapping(src, tmp.as_mut_ptr(), 1); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | | + | unable to turn pointer into raw bytes + | inside `std::ptr::read::<u8>` at $SRC_DIR/core/src/ptr/mod.rs:LL:COL + | inside `ptr::const_ptr::<impl *const u8>::read` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL + | inside `C` at $DIR/issue-miri-1910.rs:7:5 | ::: $DIR/issue-miri-1910.rs:4:1 | -LL | / const C: () = unsafe { -LL | | let foo = Some(&42 as *const i32); -LL | | let one_and_a_half_pointers = std::mem::size_of::<*const i32>()/2*3; -LL | | (&foo as *const _ as *const u8).add(one_and_a_half_pointers).read(); -LL | | }; - | |__- +LL | const C: () = unsafe { + | ----------- | = note: `#[deny(const_err)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -28,22 +24,18 @@ Future incompatibility report: Future breakage diagnostic: error: any use of this value will cause an error --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL | -LL | copy_nonoverlapping(src, tmp.as_mut_ptr(), 1); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | unable to turn pointer into raw bytes - | inside `std::ptr::read::<u8>` at $SRC_DIR/core/src/ptr/mod.rs:LL:COL - | inside `ptr::const_ptr::<impl *const u8>::read` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL - | inside `C` at $DIR/issue-miri-1910.rs:7:5 +LL | copy_nonoverlapping(src, tmp.as_mut_ptr(), 1); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | | + | unable to turn pointer into raw bytes + | inside `std::ptr::read::<u8>` at $SRC_DIR/core/src/ptr/mod.rs:LL:COL + | inside `ptr::const_ptr::<impl *const u8>::read` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL + | inside `C` at $DIR/issue-miri-1910.rs:7:5 | ::: $DIR/issue-miri-1910.rs:4:1 | -LL | / const C: () = unsafe { -LL | | let foo = Some(&42 as *const i32); -LL | | let one_and_a_half_pointers = std::mem::size_of::<*const i32>()/2*3; -LL | | (&foo as *const _ as *const u8).add(one_and_a_half_pointers).read(); -LL | | }; - | |__- +LL | const C: () = unsafe { + | ----------- | = note: `#[deny(const_err)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! diff --git a/src/test/ui/consts/miri_unleashed/assoc_const.stderr b/src/test/ui/consts/miri_unleashed/assoc_const.stderr index 1765c9ed10a..1f82ac827ad 100644 --- a/src/test/ui/consts/miri_unleashed/assoc_const.stderr +++ b/src/test/ui/consts/miri_unleashed/assoc_const.stderr @@ -30,7 +30,7 @@ LL | pub unsafe fn drop_in_place<T: ?Sized>(to_drop: *mut T) { ::: $DIR/assoc_const.rs:14:5 | LL | const F: u32 = (U::X, 42).1; - | ---------------------------- + | ------------ | note: the lint level is defined here --> $DIR/assoc_const.rs:4:10 diff --git a/src/test/ui/consts/miri_unleashed/assoc_const_2.stderr b/src/test/ui/consts/miri_unleashed/assoc_const_2.stderr index f7be42de03f..cbf02199f5b 100644 --- a/src/test/ui/consts/miri_unleashed/assoc_const_2.stderr +++ b/src/test/ui/consts/miri_unleashed/assoc_const_2.stderr @@ -12,9 +12,7 @@ warning: any use of this value will cause an error --> $DIR/assoc_const_2.rs:12:20 | LL | const F: u32 = 100 / U::X; - | ---------------^^^^^^^^^^- - | | - | attempt to divide `100_u32` by zero + | ------------ ^^^^^^^^^^ attempt to divide `100_u32` by zero | note: the lint level is defined here --> $DIR/assoc_const_2.rs:3:10 diff --git a/src/test/ui/consts/miri_unleashed/const_refers_to_static.stderr b/src/test/ui/consts/miri_unleashed/const_refers_to_static.stderr index 98d4dff648a..fa2088124b0 100644 --- a/src/test/ui/consts/miri_unleashed/const_refers_to_static.stderr +++ b/src/test/ui/consts/miri_unleashed/const_refers_to_static.stderr @@ -51,12 +51,11 @@ Future incompatibility report: Future breakage diagnostic: warning: any use of this value will cause an error --> $DIR/const_refers_to_static.rs:13:5 | -LL | / const MUTATE_INTERIOR_MUT: usize = { -LL | | static FOO: AtomicUsize = AtomicUsize::new(0); -LL | | FOO.fetch_add(1, Ordering::Relaxed) - | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ calling non-const function `AtomicUsize::fetch_add` -LL | | }; - | |__- +LL | const MUTATE_INTERIOR_MUT: usize = { + | -------------------------------- +LL | static FOO: AtomicUsize = AtomicUsize::new(0); +LL | FOO.fetch_add(1, Ordering::Relaxed) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ calling non-const function `AtomicUsize::fetch_add` | note: the lint level is defined here --> $DIR/const_refers_to_static.rs:3:10 @@ -70,12 +69,11 @@ Future breakage diagnostic: warning: any use of this value will cause an error --> $DIR/const_refers_to_static.rs:18:14 | -LL | / const READ_INTERIOR_MUT: usize = { -LL | | static FOO: AtomicUsize = AtomicUsize::new(0); -LL | | unsafe { *(&FOO as *const _ as *const usize) } - | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constant accesses static -LL | | }; - | |__- +LL | const READ_INTERIOR_MUT: usize = { + | ------------------------------ +LL | static FOO: AtomicUsize = AtomicUsize::new(0); +LL | unsafe { *(&FOO as *const _ as *const usize) } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constant accesses static | note: the lint level is defined here --> $DIR/const_refers_to_static.rs:3:10 @@ -90,9 +88,7 @@ warning: any use of this value will cause an error --> $DIR/const_refers_to_static.rs:22:32 | LL | const READ_MUT: u32 = unsafe { MUTABLE }; - | -------------------------------^^^^^^^--- - | | - | constant accesses static + | ------------------- ^^^^^^^ constant accesses static | note: the lint level is defined here --> $DIR/const_refers_to_static.rs:3:10 diff --git a/src/test/ui/consts/miri_unleashed/const_refers_to_static2.32bit.stderr b/src/test/ui/consts/miri_unleashed/const_refers_to_static2.32bit.stderr index 039b466ee07..b3ad81e49bc 100644 --- a/src/test/ui/consts/miri_unleashed/const_refers_to_static2.32bit.stderr +++ b/src/test/ui/consts/miri_unleashed/const_refers_to_static2.32bit.stderr @@ -1,12 +1,8 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/const_refers_to_static2.rs:11:1 | -LL | / const REF_INTERIOR_MUT: &usize = { -LL | | -LL | | static FOO: AtomicUsize = AtomicUsize::new(0); -LL | | unsafe { &*(&FOO as *const _ as *const usize) } -LL | | }; - | |__^ type validation failed: encountered a reference pointing to a static variable +LL | const REF_INTERIOR_MUT: &usize = { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a reference pointing to a static variable | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 4, align: 4) { @@ -16,12 +12,8 @@ LL | | }; error[E0080]: it is undefined behavior to use this value --> $DIR/const_refers_to_static2.rs:18:1 | -LL | / const READ_IMMUT: &usize = { -LL | | -LL | | static FOO: usize = 0; -LL | | &FOO -LL | | }; - | |__^ type validation failed: encountered a reference pointing to a static variable +LL | const READ_IMMUT: &usize = { + | ^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a reference pointing to a static variable | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 4, align: 4) { diff --git a/src/test/ui/consts/miri_unleashed/const_refers_to_static2.64bit.stderr b/src/test/ui/consts/miri_unleashed/const_refers_to_static2.64bit.stderr index e0e2ec31efb..24bd0709282 100644 --- a/src/test/ui/consts/miri_unleashed/const_refers_to_static2.64bit.stderr +++ b/src/test/ui/consts/miri_unleashed/const_refers_to_static2.64bit.stderr @@ -1,12 +1,8 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/const_refers_to_static2.rs:11:1 | -LL | / const REF_INTERIOR_MUT: &usize = { -LL | | -LL | | static FOO: AtomicUsize = AtomicUsize::new(0); -LL | | unsafe { &*(&FOO as *const _ as *const usize) } -LL | | }; - | |__^ type validation failed: encountered a reference pointing to a static variable +LL | const REF_INTERIOR_MUT: &usize = { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a reference pointing to a static variable | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 8, align: 8) { @@ -16,12 +12,8 @@ LL | | }; error[E0080]: it is undefined behavior to use this value --> $DIR/const_refers_to_static2.rs:18:1 | -LL | / const READ_IMMUT: &usize = { -LL | | -LL | | static FOO: usize = 0; -LL | | &FOO -LL | | }; - | |__^ type validation failed: encountered a reference pointing to a static variable +LL | const READ_IMMUT: &usize = { + | ^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a reference pointing to a static variable | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 8, align: 8) { diff --git a/src/test/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.32bit.stderr b/src/test/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.32bit.stderr index 2a0766294d3..20a96b57f29 100644 --- a/src/test/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.32bit.stderr +++ b/src/test/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.32bit.stderr @@ -1,11 +1,8 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/const_refers_to_static_cross_crate.rs:12:1 | -LL | / const SLICE_MUT: &[u8; 1] = { -LL | | -LL | | unsafe { &static_cross_crate::ZERO } -LL | | }; - | |__^ type validation failed: encountered a reference pointing to a static variable +LL | const SLICE_MUT: &[u8; 1] = { + | ^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a reference pointing to a static variable | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 4, align: 4) { @@ -21,11 +18,8 @@ LL | SLICE_MUT => true, error[E0080]: it is undefined behavior to use this value --> $DIR/const_refers_to_static_cross_crate.rs:17:1 | -LL | / const U8_MUT: &u8 = { -LL | | -LL | | unsafe { &static_cross_crate::ZERO[0] } -LL | | }; - | |__^ type validation failed: encountered a reference pointing to a static variable +LL | const U8_MUT: &u8 = { + | ^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a reference pointing to a static variable | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 4, align: 4) { @@ -41,14 +35,10 @@ LL | U8_MUT => true, warning: any use of this value will cause an error --> $DIR/const_refers_to_static_cross_crate.rs:25:15 | -LL | / const U8_MUT2: &u8 = { -LL | | unsafe { &(*static_cross_crate::ZERO_REF)[0] } - | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constant accesses static -LL | | -LL | | -LL | | -LL | | }; - | |__- +LL | const U8_MUT2: &u8 = { + | ------------------ +LL | unsafe { &(*static_cross_crate::ZERO_REF)[0] } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constant accesses static | note: the lint level is defined here --> $DIR/const_refers_to_static_cross_crate.rs:23:8 @@ -67,14 +57,10 @@ LL | U8_MUT2 => true, warning: any use of this value will cause an error --> $DIR/const_refers_to_static_cross_crate.rs:32:20 | -LL | / const U8_MUT3: &u8 = { -LL | | unsafe { match static_cross_crate::OPT_ZERO { Some(ref u) => u, None => panic!() } } - | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constant accesses static -LL | | -LL | | -LL | | -LL | | }; - | |__- +LL | const U8_MUT3: &u8 = { + | ------------------ +LL | unsafe { match static_cross_crate::OPT_ZERO { Some(ref u) => u, None => panic!() } } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constant accesses static | note: the lint level is defined here --> $DIR/const_refers_to_static_cross_crate.rs:30:8 @@ -174,14 +160,10 @@ Future incompatibility report: Future breakage diagnostic: warning: any use of this value will cause an error --> $DIR/const_refers_to_static_cross_crate.rs:25:15 | -LL | / const U8_MUT2: &u8 = { -LL | | unsafe { &(*static_cross_crate::ZERO_REF)[0] } - | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constant accesses static -LL | | -LL | | -LL | | -LL | | }; - | |__- +LL | const U8_MUT2: &u8 = { + | ------------------ +LL | unsafe { &(*static_cross_crate::ZERO_REF)[0] } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constant accesses static | note: the lint level is defined here --> $DIR/const_refers_to_static_cross_crate.rs:23:8 @@ -195,14 +177,10 @@ Future breakage diagnostic: warning: any use of this value will cause an error --> $DIR/const_refers_to_static_cross_crate.rs:32:20 | -LL | / const U8_MUT3: &u8 = { -LL | | unsafe { match static_cross_crate::OPT_ZERO { Some(ref u) => u, None => panic!() } } - | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constant accesses static -LL | | -LL | | -LL | | -LL | | }; - | |__- +LL | const U8_MUT3: &u8 = { + | ------------------ +LL | unsafe { match static_cross_crate::OPT_ZERO { Some(ref u) => u, None => panic!() } } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constant accesses static | note: the lint level is defined here --> $DIR/const_refers_to_static_cross_crate.rs:30:8 diff --git a/src/test/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.64bit.stderr b/src/test/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.64bit.stderr index 2d4f038d914..dfa0f76baa1 100644 --- a/src/test/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.64bit.stderr +++ b/src/test/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.64bit.stderr @@ -1,11 +1,8 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/const_refers_to_static_cross_crate.rs:12:1 | -LL | / const SLICE_MUT: &[u8; 1] = { -LL | | -LL | | unsafe { &static_cross_crate::ZERO } -LL | | }; - | |__^ type validation failed: encountered a reference pointing to a static variable +LL | const SLICE_MUT: &[u8; 1] = { + | ^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a reference pointing to a static variable | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 8, align: 8) { @@ -21,11 +18,8 @@ LL | SLICE_MUT => true, error[E0080]: it is undefined behavior to use this value --> $DIR/const_refers_to_static_cross_crate.rs:17:1 | -LL | / const U8_MUT: &u8 = { -LL | | -LL | | unsafe { &static_cross_crate::ZERO[0] } -LL | | }; - | |__^ type validation failed: encountered a reference pointing to a static variable +LL | const U8_MUT: &u8 = { + | ^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a reference pointing to a static variable | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 8, align: 8) { @@ -41,14 +35,10 @@ LL | U8_MUT => true, warning: any use of this value will cause an error --> $DIR/const_refers_to_static_cross_crate.rs:25:15 | -LL | / const U8_MUT2: &u8 = { -LL | | unsafe { &(*static_cross_crate::ZERO_REF)[0] } - | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constant accesses static -LL | | -LL | | -LL | | -LL | | }; - | |__- +LL | const U8_MUT2: &u8 = { + | ------------------ +LL | unsafe { &(*static_cross_crate::ZERO_REF)[0] } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constant accesses static | note: the lint level is defined here --> $DIR/const_refers_to_static_cross_crate.rs:23:8 @@ -67,14 +57,10 @@ LL | U8_MUT2 => true, warning: any use of this value will cause an error --> $DIR/const_refers_to_static_cross_crate.rs:32:20 | -LL | / const U8_MUT3: &u8 = { -LL | | unsafe { match static_cross_crate::OPT_ZERO { Some(ref u) => u, None => panic!() } } - | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constant accesses static -LL | | -LL | | -LL | | -LL | | }; - | |__- +LL | const U8_MUT3: &u8 = { + | ------------------ +LL | unsafe { match static_cross_crate::OPT_ZERO { Some(ref u) => u, None => panic!() } } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constant accesses static | note: the lint level is defined here --> $DIR/const_refers_to_static_cross_crate.rs:30:8 @@ -174,14 +160,10 @@ Future incompatibility report: Future breakage diagnostic: warning: any use of this value will cause an error --> $DIR/const_refers_to_static_cross_crate.rs:25:15 | -LL | / const U8_MUT2: &u8 = { -LL | | unsafe { &(*static_cross_crate::ZERO_REF)[0] } - | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constant accesses static -LL | | -LL | | -LL | | -LL | | }; - | |__- +LL | const U8_MUT2: &u8 = { + | ------------------ +LL | unsafe { &(*static_cross_crate::ZERO_REF)[0] } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constant accesses static | note: the lint level is defined here --> $DIR/const_refers_to_static_cross_crate.rs:23:8 @@ -195,14 +177,10 @@ Future breakage diagnostic: warning: any use of this value will cause an error --> $DIR/const_refers_to_static_cross_crate.rs:32:20 | -LL | / const U8_MUT3: &u8 = { -LL | | unsafe { match static_cross_crate::OPT_ZERO { Some(ref u) => u, None => panic!() } } - | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constant accesses static -LL | | -LL | | -LL | | -LL | | }; - | |__- +LL | const U8_MUT3: &u8 = { + | ------------------ +LL | unsafe { match static_cross_crate::OPT_ZERO { Some(ref u) => u, None => panic!() } } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constant accesses static | note: the lint level is defined here --> $DIR/const_refers_to_static_cross_crate.rs:30:8 diff --git a/src/test/ui/consts/miri_unleashed/mutable_references_err.32bit.stderr b/src/test/ui/consts/miri_unleashed/mutable_references_err.32bit.stderr index 9d1bb2ac91c..bb8636f1225 100644 --- a/src/test/ui/consts/miri_unleashed/mutable_references_err.32bit.stderr +++ b/src/test/ui/consts/miri_unleashed/mutable_references_err.32bit.stderr @@ -1,10 +1,8 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/mutable_references_err.rs:17:1 | -LL | / const MUH: Meh = Meh { -LL | | x: &UnsafeCell::new(42), -LL | | }; - | |__^ type validation failed at .x.<deref>: encountered `UnsafeCell` in a `const` +LL | const MUH: Meh = Meh { + | ^^^^^^^^^^^^^^ constructing invalid value at .x.<deref>: encountered `UnsafeCell` in a `const` | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 4, align: 4) { @@ -15,7 +13,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/mutable_references_err.rs:27:1 | LL | const SNEAKY: &dyn Sync = &Synced { x: UnsafeCell::new(42) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed at .<deref>.<dyn-downcast>.x: encountered `UnsafeCell` in a `const` + | ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>.<dyn-downcast>.x: encountered `UnsafeCell` in a `const` | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 8, align: 4) { @@ -26,7 +24,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/mutable_references_err.rs:31:1 | LL | const BLUNT: &mut i32 = &mut 42; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered mutable reference in a `const` + | ^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered mutable reference in a `const` | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 4, align: 4) { diff --git a/src/test/ui/consts/miri_unleashed/mutable_references_err.64bit.stderr b/src/test/ui/consts/miri_unleashed/mutable_references_err.64bit.stderr index fe939c03931..f1652da922a 100644 --- a/src/test/ui/consts/miri_unleashed/mutable_references_err.64bit.stderr +++ b/src/test/ui/consts/miri_unleashed/mutable_references_err.64bit.stderr @@ -1,10 +1,8 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/mutable_references_err.rs:17:1 | -LL | / const MUH: Meh = Meh { -LL | | x: &UnsafeCell::new(42), -LL | | }; - | |__^ type validation failed at .x.<deref>: encountered `UnsafeCell` in a `const` +LL | const MUH: Meh = Meh { + | ^^^^^^^^^^^^^^ constructing invalid value at .x.<deref>: encountered `UnsafeCell` in a `const` | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 8, align: 8) { @@ -15,7 +13,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/mutable_references_err.rs:27:1 | LL | const SNEAKY: &dyn Sync = &Synced { x: UnsafeCell::new(42) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed at .<deref>.<dyn-downcast>.x: encountered `UnsafeCell` in a `const` + | ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>.<dyn-downcast>.x: encountered `UnsafeCell` in a `const` | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 16, align: 8) { @@ -26,7 +24,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/mutable_references_err.rs:31:1 | LL | const BLUNT: &mut i32 = &mut 42; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered mutable reference in a `const` + | ^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered mutable reference in a `const` | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 8, align: 8) { diff --git a/src/test/ui/consts/miri_unleashed/raw_mutable_const.stderr b/src/test/ui/consts/miri_unleashed/raw_mutable_const.stderr index b5b5a965295..e145f6dd2ef 100644 --- a/src/test/ui/consts/miri_unleashed/raw_mutable_const.stderr +++ b/src/test/ui/consts/miri_unleashed/raw_mutable_const.stderr @@ -2,7 +2,7 @@ error: untyped pointers are not allowed in constant --> $DIR/raw_mutable_const.rs:7:1 | LL | const MUTABLE_BEHIND_RAW: *mut i32 = &UnsafeCell::new(42) as *const _ as *mut _; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: skipping const checks | diff --git a/src/test/ui/consts/ptr_comparisons.stderr b/src/test/ui/consts/ptr_comparisons.stderr index 594576fe2cf..69936ee6c13 100644 --- a/src/test/ui/consts/ptr_comparisons.stderr +++ b/src/test/ui/consts/ptr_comparisons.stderr @@ -22,9 +22,7 @@ error: any use of this value will cause an error --> $DIR/ptr_comparisons.rs:65:27 | LL | const _: usize = unsafe { std::mem::transmute::<*const usize, usize>(FOO) + 4 }; - | --------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--- - | | - | unable to turn pointer into raw bytes + | -------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | = note: `#[deny(const_err)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -34,9 +32,7 @@ error: any use of this value will cause an error --> $DIR/ptr_comparisons.rs:70:27 | LL | const _: usize = unsafe { *std::mem::transmute::<&&usize, &usize>(&FOO) + 4 }; - | --------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^------- - | | - | unable to turn pointer into raw bytes + | -------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> @@ -49,9 +45,7 @@ error: any use of this value will cause an error --> $DIR/ptr_comparisons.rs:65:27 | LL | const _: usize = unsafe { std::mem::transmute::<*const usize, usize>(FOO) + 4 }; - | --------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--- - | | - | unable to turn pointer into raw bytes + | -------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | = note: `#[deny(const_err)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -62,9 +56,7 @@ error: any use of this value will cause an error --> $DIR/ptr_comparisons.rs:70:27 | LL | const _: usize = unsafe { *std::mem::transmute::<&&usize, &usize>(&FOO) + 4 }; - | --------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^------- - | | - | unable to turn pointer into raw bytes + | -------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | = note: `#[deny(const_err)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! diff --git a/src/test/ui/consts/raw-ptr-const.stderr b/src/test/ui/consts/raw-ptr-const.stderr index 974b1c3ff45..0ebe1e95ca3 100644 --- a/src/test/ui/consts/raw-ptr-const.stderr +++ b/src/test/ui/consts/raw-ptr-const.stderr @@ -2,7 +2,7 @@ error: untyped pointers are not allowed in constant --> $DIR/raw-ptr-const.rs:7:1 | LL | const CONST_RAW: *const Vec<i32> = &Vec::new() as *const _; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/consts/recursive-zst-static.default.stderr b/src/test/ui/consts/recursive-zst-static.default.stderr index 104899f4900..d68960b0972 100644 --- a/src/test/ui/consts/recursive-zst-static.default.stderr +++ b/src/test/ui/consts/recursive-zst-static.default.stderr @@ -2,7 +2,7 @@ error[E0391]: cycle detected when const-evaluating + checking `FOO` --> $DIR/recursive-zst-static.rs:10:1 | LL | static FOO: () = FOO; - | ^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^ | note: ...which requires const-evaluating + checking `FOO`... --> $DIR/recursive-zst-static.rs:10:18 diff --git a/src/test/ui/consts/recursive-zst-static.unleash.stderr b/src/test/ui/consts/recursive-zst-static.unleash.stderr index 104899f4900..d68960b0972 100644 --- a/src/test/ui/consts/recursive-zst-static.unleash.stderr +++ b/src/test/ui/consts/recursive-zst-static.unleash.stderr @@ -2,7 +2,7 @@ error[E0391]: cycle detected when const-evaluating + checking `FOO` --> $DIR/recursive-zst-static.rs:10:1 | LL | static FOO: () = FOO; - | ^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^ | note: ...which requires const-evaluating + checking `FOO`... --> $DIR/recursive-zst-static.rs:10:18 diff --git a/src/test/ui/consts/recursive.stderr b/src/test/ui/consts/recursive.stderr index 8d1e10d4176..647ed1db20b 100644 --- a/src/test/ui/consts/recursive.stderr +++ b/src/test/ui/consts/recursive.stderr @@ -21,7 +21,7 @@ LL | f(x); | inside `X` at $DIR/recursive.rs:9:15 ... LL | const X: () = f(1); - | ------------------- + | ----------- | = note: `#[deny(const_err)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -42,7 +42,7 @@ LL | f(x); | inside `X` at $DIR/recursive.rs:9:15 ... LL | const X: () = f(1); - | ------------------- + | ----------- | = note: `#[deny(const_err)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! diff --git a/src/test/ui/consts/std/alloc.32bit.stderr b/src/test/ui/consts/std/alloc.32bit.stderr index 138eb69971c..79efcd3f62e 100644 --- a/src/test/ui/consts/std/alloc.32bit.stderr +++ b/src/test/ui/consts/std/alloc.32bit.stderr @@ -2,7 +2,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/alloc.rs:9:1 | LL | const LAYOUT_INVALID_ZERO: Layout = unsafe { Layout::from_size_align_unchecked(0x1000, 0x00) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed at .align.0.<enum-tag>: encountered 0x00000000, but expected a valid enum tag + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .align.0.<enum-tag>: encountered 0x00000000, but expected a valid enum tag | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 8, align: 4) { @@ -13,7 +13,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/alloc.rs:13:1 | LL | const LAYOUT_INVALID_THREE: Layout = unsafe { Layout::from_size_align_unchecked(9, 3) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed at .align.0.<enum-tag>: encountered 0x00000003, but expected a valid enum tag + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .align.0.<enum-tag>: encountered 0x00000003, but expected a valid enum tag | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 8, align: 4) { diff --git a/src/test/ui/consts/std/alloc.64bit.stderr b/src/test/ui/consts/std/alloc.64bit.stderr index ecb08c39f3f..cb477b72b31 100644 --- a/src/test/ui/consts/std/alloc.64bit.stderr +++ b/src/test/ui/consts/std/alloc.64bit.stderr @@ -2,7 +2,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/alloc.rs:9:1 | LL | const LAYOUT_INVALID_ZERO: Layout = unsafe { Layout::from_size_align_unchecked(0x1000, 0x00) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed at .align.0.<enum-tag>: encountered 0x0000000000000000, but expected a valid enum tag + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .align.0.<enum-tag>: encountered 0x0000000000000000, but expected a valid enum tag | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 16, align: 8) { @@ -13,7 +13,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/alloc.rs:13:1 | LL | const LAYOUT_INVALID_THREE: Layout = unsafe { Layout::from_size_align_unchecked(9, 3) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed at .align.0.<enum-tag>: encountered 0x0000000000000003, but expected a valid enum tag + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .align.0.<enum-tag>: encountered 0x0000000000000003, but expected a valid enum tag | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 16, align: 8) { diff --git a/src/test/ui/consts/std/cell.stderr b/src/test/ui/consts/std/cell.stderr index 355c326f0b6..937fa7db0c8 100644 --- a/src/test/ui/consts/std/cell.stderr +++ b/src/test/ui/consts/std/cell.stderr @@ -2,25 +2,25 @@ error: encountered dangling pointer in final constant --> $DIR/cell.rs:6:1 | LL | static FOO: Wrap<*mut u32> = Wrap(Cell::new(42).as_ptr()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ error: encountered dangling pointer in final constant --> $DIR/cell.rs:8:1 | LL | const FOO_CONST: Wrap<*mut u32> = Wrap(Cell::new(42).as_ptr()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: encountered dangling pointer in final constant --> $DIR/cell.rs:22:1 | LL | const FOO4_CONST: Wrap<*mut u32> = Wrap(FOO3_CONST.0.as_ptr()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: encountered dangling pointer in final constant --> $DIR/cell.rs:27:1 | LL | const FOO2: *mut u32 = Cell::new(42).as_ptr(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^ error: aborting due to 4 previous errors diff --git a/src/test/ui/consts/uninhabited-const-issue-61744.stderr b/src/test/ui/consts/uninhabited-const-issue-61744.stderr index 17dd6131436..d3177784789 100644 --- a/src/test/ui/consts/uninhabited-const-issue-61744.stderr +++ b/src/test/ui/consts/uninhabited-const-issue-61744.stderr @@ -135,7 +135,7 @@ LL | hint_unreachable() | inside `<i32 as Const>::CONSTANT` at $DIR/uninhabited-const-issue-61744.rs:13:36 ... LL | const CONSTANT: i32 = unsafe { fake_type() }; - | --------------------------------------------- + | ------------------- | = note: `#[deny(const_err)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -288,7 +288,7 @@ LL | hint_unreachable() | inside `<i32 as Const>::CONSTANT` at $DIR/uninhabited-const-issue-61744.rs:13:36 ... LL | const CONSTANT: i32 = unsafe { fake_type() }; - | --------------------------------------------- + | ------------------- | = note: `#[deny(const_err)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! diff --git a/src/test/ui/consts/validate_never_arrays.32bit.stderr b/src/test/ui/consts/validate_never_arrays.32bit.stderr index 6280a7478e7..a5dbc718145 100644 --- a/src/test/ui/consts/validate_never_arrays.32bit.stderr +++ b/src/test/ui/consts/validate_never_arrays.32bit.stderr @@ -2,7 +2,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/validate_never_arrays.rs:4:1 | LL | const _: &[!; 1] = unsafe { &*(1_usize as *const [!; 1]) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a reference pointing to uninhabited type [!; 1] + | ^^^^^^^^^^^^^^^^ constructing invalid value: encountered a reference pointing to uninhabited type [!; 1] | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 4, align: 4) { @@ -13,7 +13,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/validate_never_arrays.rs:7:1 | LL | const _: &[!] = unsafe { &*(1_usize as *const [!; 1]) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed at .<deref>[0]: encountered a value of the never type `!` + | ^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered a value of the never type `!` | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 8, align: 4) { @@ -24,7 +24,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/validate_never_arrays.rs:8:1 | LL | const _: &[!] = unsafe { &*(1_usize as *const [!; 42]) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed at .<deref>[0]: encountered a value of the never type `!` + | ^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered a value of the never type `!` | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 8, align: 4) { diff --git a/src/test/ui/consts/validate_never_arrays.64bit.stderr b/src/test/ui/consts/validate_never_arrays.64bit.stderr index c5a71e5be51..dac4e200a89 100644 --- a/src/test/ui/consts/validate_never_arrays.64bit.stderr +++ b/src/test/ui/consts/validate_never_arrays.64bit.stderr @@ -2,7 +2,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/validate_never_arrays.rs:4:1 | LL | const _: &[!; 1] = unsafe { &*(1_usize as *const [!; 1]) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a reference pointing to uninhabited type [!; 1] + | ^^^^^^^^^^^^^^^^ constructing invalid value: encountered a reference pointing to uninhabited type [!; 1] | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 8, align: 8) { @@ -13,7 +13,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/validate_never_arrays.rs:7:1 | LL | const _: &[!] = unsafe { &*(1_usize as *const [!; 1]) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed at .<deref>[0]: encountered a value of the never type `!` + | ^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered a value of the never type `!` | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 16, align: 8) { @@ -24,7 +24,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/validate_never_arrays.rs:8:1 | LL | const _: &[!] = unsafe { &*(1_usize as *const [!; 42]) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed at .<deref>[0]: encountered a value of the never type `!` + | ^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered a value of the never type `!` | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 16, align: 8) { diff --git a/src/test/ui/consts/write-to-static-mut-in-static.stderr b/src/test/ui/consts/write-to-static-mut-in-static.stderr index 8d5113cbfd9..395b2d42f97 100644 --- a/src/test/ui/consts/write-to-static-mut-in-static.stderr +++ b/src/test/ui/consts/write-to-static-mut-in-static.stderr @@ -8,7 +8,7 @@ error[E0391]: cycle detected when const-evaluating + checking `C` --> $DIR/write-to-static-mut-in-static.rs:5:1 | LL | pub static mut C: u32 = unsafe { C = 1; 0 }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^ | note: ...which requires const-evaluating + checking `C`... --> $DIR/write-to-static-mut-in-static.rs:5:34 diff --git a/src/test/ui/custom_test_frameworks/mismatch.stderr b/src/test/ui/custom_test_frameworks/mismatch.stderr index e848ddc55b7..61061ae529d 100644 --- a/src/test/ui/custom_test_frameworks/mismatch.stderr +++ b/src/test/ui/custom_test_frameworks/mismatch.stderr @@ -6,7 +6,7 @@ LL | #[test] LL | fn wrong_kind(){} | ^^^^^^^^^^^^^^^^^ the trait `Testable` is not implemented for `TestDescAndFn` | - = note: required for the cast to the object type `dyn Testable` + = note: required for the cast from `TestDescAndFn` to the object type `dyn Testable` = note: this error originates in the attribute macro `test` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to previous error diff --git a/src/test/ui/deprecation/atomic_initializers.stderr b/src/test/ui/deprecation/atomic_initializers.stderr index eaf5c61b440..30fcc9de618 100644 --- a/src/test/ui/deprecation/atomic_initializers.stderr +++ b/src/test/ui/deprecation/atomic_initializers.stderr @@ -2,9 +2,13 @@ warning: use of deprecated constant `std::sync::atomic::ATOMIC_ISIZE_INIT`: the --> $DIR/atomic_initializers.rs:8:27 | LL | static FOO: AtomicIsize = ATOMIC_ISIZE_INIT; - | ^^^^^^^^^^^^^^^^^ help: replace the use of the deprecated constant: `AtomicIsize::new(0)` + | ^^^^^^^^^^^^^^^^^ | = note: `#[warn(deprecated)]` on by default +help: replace the use of the deprecated constant + | +LL | static FOO: AtomicIsize = AtomicIsize::new(0); + | ~~~~~~~~~~~~~~~~~~~ warning: 1 warning emitted diff --git a/src/test/ui/deprecation/issue-84637-deprecated-associated-function.stderr b/src/test/ui/deprecation/issue-84637-deprecated-associated-function.stderr index e65d21bb09b..8d4529526e3 100644 --- a/src/test/ui/deprecation/issue-84637-deprecated-associated-function.stderr +++ b/src/test/ui/deprecation/issue-84637-deprecated-associated-function.stderr @@ -2,19 +2,28 @@ error: use of deprecated associated function `core::str::<impl str>::trim_left`: --> $DIR/issue-84637-deprecated-associated-function.rs:6:21 | LL | let _foo = str::trim_left(" aoeu"); - | ^^^^^^^^^ help: replace the use of the deprecated associated function: `trim_start` + | ^^^^^^^^^ | note: the lint level is defined here --> $DIR/issue-84637-deprecated-associated-function.rs:3:9 | LL | #![deny(deprecated)] | ^^^^^^^^^^ +help: replace the use of the deprecated associated function + | +LL | let _foo = str::trim_start(" aoeu"); + | ~~~~~~~~~~ error: use of deprecated associated function `core::str::<impl str>::trim_left`: superseded by `trim_start` --> $DIR/issue-84637-deprecated-associated-function.rs:8:26 | LL | let _bar = " aoeu".trim_left(); - | ^^^^^^^^^ help: replace the use of the deprecated associated function: `trim_start` + | ^^^^^^^^^ + | +help: replace the use of the deprecated associated function + | +LL | let _bar = " aoeu".trim_start(); + | ~~~~~~~~~~ error: aborting due to 2 previous errors diff --git a/src/test/ui/deprecation/suggestion.stderr b/src/test/ui/deprecation/suggestion.stderr index 8d1e108345f..c5f2fc09125 100644 --- a/src/test/ui/deprecation/suggestion.stderr +++ b/src/test/ui/deprecation/suggestion.stderr @@ -2,19 +2,28 @@ error: use of deprecated function `bar::deprecated`: replaced by `replacement` --> $DIR/suggestion.rs:42:10 | LL | bar::deprecated(); - | ^^^^^^^^^^ help: replace the use of the deprecated function: `replacement` + | ^^^^^^^^^^ | note: the lint level is defined here --> $DIR/suggestion.rs:8:9 | LL | #![deny(deprecated)] | ^^^^^^^^^^ +help: replace the use of the deprecated function + | +LL | bar::replacement(); + | ~~~~~~~~~~~ error: use of deprecated associated function `Foo::deprecated`: replaced by `replacement` --> $DIR/suggestion.rs:40:9 | LL | foo.deprecated(); - | ^^^^^^^^^^ help: replace the use of the deprecated associated function: `replacement` + | ^^^^^^^^^^ + | +help: replace the use of the deprecated associated function + | +LL | foo.replacement(); + | ~~~~~~~~~~~ error: aborting due to 2 previous errors diff --git a/src/test/ui/derive-uninhabited-enum-38885.stderr b/src/test/ui/derive-uninhabited-enum-38885.stderr index 4feaf3ac961..bd36a25686a 100644 --- a/src/test/ui/derive-uninhabited-enum-38885.stderr +++ b/src/test/ui/derive-uninhabited-enum-38885.stderr @@ -5,7 +5,7 @@ LL | enum Foo { | --- variant in this enum LL | Bar(u8), LL | Void(Void), - | ^^^^^^^^^^ + | ^^^^ | = note: `-W dead-code` implied by `-W unused` = note: `Foo` has a derived impl for the trait `Debug`, but this is intentionally ignored during dead code analysis diff --git a/src/test/ui/derives/clone-debug-dead-code-in-the-same-struct.stderr b/src/test/ui/derives/clone-debug-dead-code-in-the-same-struct.stderr index 383e0b4b725..baf34b46d8b 100644 --- a/src/test/ui/derives/clone-debug-dead-code-in-the-same-struct.stderr +++ b/src/test/ui/derives/clone-debug-dead-code-in-the-same-struct.stderr @@ -5,13 +5,13 @@ LL | pub struct Whatever { | -------- fields in this struct LL | pub field0: (), LL | field1: (), - | ^^^^^^^^^^ + | ^^^^^^ LL | field2: (), - | ^^^^^^^^^^ + | ^^^^^^ LL | field3: (), - | ^^^^^^^^^^ + | ^^^^^^ LL | field4: (), - | ^^^^^^^^^^ + | ^^^^^^ | note: the lint level is defined here --> $DIR/clone-debug-dead-code-in-the-same-struct.rs:1:11 diff --git a/src/test/ui/derives/clone-debug-dead-code.stderr b/src/test/ui/derives/clone-debug-dead-code.stderr index 73a00251188..38be486e332 100644 --- a/src/test/ui/derives/clone-debug-dead-code.stderr +++ b/src/test/ui/derives/clone-debug-dead-code.stderr @@ -2,7 +2,7 @@ error: field `f` is never read --> $DIR/clone-debug-dead-code.rs:6:12 | LL | struct A { f: () } - | - ^^^^^ + | - ^ | | | field in this struct | @@ -16,7 +16,7 @@ error: field `f` is never read --> $DIR/clone-debug-dead-code.rs:10:12 | LL | struct B { f: () } - | - ^^^^^ + | - ^ | | | field in this struct | @@ -26,7 +26,7 @@ error: field `f` is never read --> $DIR/clone-debug-dead-code.rs:14:12 | LL | struct C { f: () } - | - ^^^^^ + | - ^ | | | field in this struct | @@ -36,7 +36,7 @@ error: field `f` is never read --> $DIR/clone-debug-dead-code.rs:18:12 | LL | struct D { f: () } - | - ^^^^^ + | - ^ | | | field in this struct | @@ -46,7 +46,7 @@ error: field `f` is never read --> $DIR/clone-debug-dead-code.rs:21:12 | LL | struct E { f: () } - | - ^^^^^ + | - ^ | | | field in this struct diff --git a/src/test/ui/derives/derive-assoc-type-not-impl.stderr b/src/test/ui/derives/derive-assoc-type-not-impl.stderr index 592cc0ae90f..55847aeec55 100644 --- a/src/test/ui/derives/derive-assoc-type-not-impl.stderr +++ b/src/test/ui/derives/derive-assoc-type-not-impl.stderr @@ -8,7 +8,7 @@ LL | struct Bar<T: Foo> { | doesn't satisfy `Bar<NotClone>: Clone` ... LL | struct NotClone; - | ---------------- doesn't satisfy `NotClone: Clone` + | --------------- doesn't satisfy `NotClone: Clone` ... LL | Bar::<NotClone> { x: 1 }.clone(); | ^^^^^ method cannot be called on `Bar<NotClone>` due to unsatisfied trait bounds diff --git a/src/test/ui/derives/derives-span-PartialEq-enum-struct-variant.stderr b/src/test/ui/derives/derives-span-PartialEq-enum-struct-variant.stderr index 19d2425ff23..f655600b760 100644 --- a/src/test/ui/derives/derives-span-PartialEq-enum-struct-variant.stderr +++ b/src/test/ui/derives/derives-span-PartialEq-enum-struct-variant.stderr @@ -11,7 +11,7 @@ note: an implementation of `PartialEq<_>` might be missing for `Error` --> $DIR/derives-span-PartialEq-enum-struct-variant.rs:4:1 | LL | struct Error; - | ^^^^^^^^^^^^^ must implement `PartialEq<_>` + | ^^^^^^^^^^^^ must implement `PartialEq<_>` = note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider annotating `Error` with `#[derive(PartialEq)]` | @@ -31,7 +31,7 @@ note: an implementation of `PartialEq<_>` might be missing for `Error` --> $DIR/derives-span-PartialEq-enum-struct-variant.rs:4:1 | LL | struct Error; - | ^^^^^^^^^^^^^ must implement `PartialEq<_>` + | ^^^^^^^^^^^^ must implement `PartialEq<_>` = note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider annotating `Error` with `#[derive(PartialEq)]` | diff --git a/src/test/ui/derives/derives-span-PartialEq-enum.stderr b/src/test/ui/derives/derives-span-PartialEq-enum.stderr index 419832817ca..ce4b00bfbf5 100644 --- a/src/test/ui/derives/derives-span-PartialEq-enum.stderr +++ b/src/test/ui/derives/derives-span-PartialEq-enum.stderr @@ -11,7 +11,7 @@ note: an implementation of `PartialEq<_>` might be missing for `Error` --> $DIR/derives-span-PartialEq-enum.rs:4:1 | LL | struct Error; - | ^^^^^^^^^^^^^ must implement `PartialEq<_>` + | ^^^^^^^^^^^^ must implement `PartialEq<_>` = note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider annotating `Error` with `#[derive(PartialEq)]` | @@ -31,7 +31,7 @@ note: an implementation of `PartialEq<_>` might be missing for `Error` --> $DIR/derives-span-PartialEq-enum.rs:4:1 | LL | struct Error; - | ^^^^^^^^^^^^^ must implement `PartialEq<_>` + | ^^^^^^^^^^^^ must implement `PartialEq<_>` = note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider annotating `Error` with `#[derive(PartialEq)]` | diff --git a/src/test/ui/derives/derives-span-PartialEq-struct.stderr b/src/test/ui/derives/derives-span-PartialEq-struct.stderr index 0000f882542..c5c8f255fb3 100644 --- a/src/test/ui/derives/derives-span-PartialEq-struct.stderr +++ b/src/test/ui/derives/derives-span-PartialEq-struct.stderr @@ -11,7 +11,7 @@ note: an implementation of `PartialEq<_>` might be missing for `Error` --> $DIR/derives-span-PartialEq-struct.rs:4:1 | LL | struct Error; - | ^^^^^^^^^^^^^ must implement `PartialEq<_>` + | ^^^^^^^^^^^^ must implement `PartialEq<_>` = note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider annotating `Error` with `#[derive(PartialEq)]` | @@ -31,7 +31,7 @@ note: an implementation of `PartialEq<_>` might be missing for `Error` --> $DIR/derives-span-PartialEq-struct.rs:4:1 | LL | struct Error; - | ^^^^^^^^^^^^^ must implement `PartialEq<_>` + | ^^^^^^^^^^^^ must implement `PartialEq<_>` = note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider annotating `Error` with `#[derive(PartialEq)]` | diff --git a/src/test/ui/derives/derives-span-PartialEq-tuple-struct.stderr b/src/test/ui/derives/derives-span-PartialEq-tuple-struct.stderr index 07fa900a8c8..f5d609cb33f 100644 --- a/src/test/ui/derives/derives-span-PartialEq-tuple-struct.stderr +++ b/src/test/ui/derives/derives-span-PartialEq-tuple-struct.stderr @@ -11,7 +11,7 @@ note: an implementation of `PartialEq<_>` might be missing for `Error` --> $DIR/derives-span-PartialEq-tuple-struct.rs:4:1 | LL | struct Error; - | ^^^^^^^^^^^^^ must implement `PartialEq<_>` + | ^^^^^^^^^^^^ must implement `PartialEq<_>` = note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider annotating `Error` with `#[derive(PartialEq)]` | @@ -31,7 +31,7 @@ note: an implementation of `PartialEq<_>` might be missing for `Error` --> $DIR/derives-span-PartialEq-tuple-struct.rs:4:1 | LL | struct Error; - | ^^^^^^^^^^^^^ must implement `PartialEq<_>` + | ^^^^^^^^^^^^ must implement `PartialEq<_>` = note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider annotating `Error` with `#[derive(PartialEq)]` | diff --git a/src/test/ui/derives/deriving-meta-unknown-trait.stderr b/src/test/ui/derives/deriving-meta-unknown-trait.stderr index bfb673f86f4..f3ff95a85da 100644 --- a/src/test/ui/derives/deriving-meta-unknown-trait.stderr +++ b/src/test/ui/derives/deriving-meta-unknown-trait.stderr @@ -7,7 +7,7 @@ LL | #[derive(Eqr)] ::: $SRC_DIR/core/src/cmp.rs:LL:COL | LL | pub macro Eq($item:item) { - | ------------------------ similarly named derive macro `Eq` defined here + | ------------ similarly named derive macro `Eq` defined here error: cannot find derive macro `Eqr` in this scope --> $DIR/deriving-meta-unknown-trait.rs:1:10 @@ -18,7 +18,7 @@ LL | #[derive(Eqr)] ::: $SRC_DIR/core/src/cmp.rs:LL:COL | LL | pub macro Eq($item:item) { - | ------------------------ similarly named derive macro `Eq` defined here + | ------------ similarly named derive macro `Eq` defined here error: aborting due to 2 previous errors diff --git a/src/test/ui/derives/deriving-no-inner-impl-error-message.stderr b/src/test/ui/derives/deriving-no-inner-impl-error-message.stderr index 451058cd0ee..7875f072356 100644 --- a/src/test/ui/derives/deriving-no-inner-impl-error-message.stderr +++ b/src/test/ui/derives/deriving-no-inner-impl-error-message.stderr @@ -11,7 +11,7 @@ note: an implementation of `PartialEq<_>` might be missing for `NoCloneOrEq` --> $DIR/deriving-no-inner-impl-error-message.rs:1:1 | LL | struct NoCloneOrEq; - | ^^^^^^^^^^^^^^^^^^^ must implement `PartialEq<_>` + | ^^^^^^^^^^^^^^^^^^ must implement `PartialEq<_>` = note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider annotating `NoCloneOrEq` with `#[derive(PartialEq)]` | @@ -31,7 +31,7 @@ note: an implementation of `PartialEq<_>` might be missing for `NoCloneOrEq` --> $DIR/deriving-no-inner-impl-error-message.rs:1:1 | LL | struct NoCloneOrEq; - | ^^^^^^^^^^^^^^^^^^^ must implement `PartialEq<_>` + | ^^^^^^^^^^^^^^^^^^ must implement `PartialEq<_>` = note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider annotating `NoCloneOrEq` with `#[derive(PartialEq)]` | diff --git a/src/test/ui/derives/issue-91492.stderr b/src/test/ui/derives/issue-91492.stderr index e479b539fec..5b4feaeb52a 100644 --- a/src/test/ui/derives/issue-91492.stderr +++ b/src/test/ui/derives/issue-91492.stderr @@ -2,7 +2,7 @@ error[E0599]: the method `extend_from_slice` exists for mutable reference `&mut --> $DIR/issue-91492.rs:4:9 | LL | pub struct NoDerives; - | --------------------- doesn't satisfy `NoDerives: Clone` + | -------------------- doesn't satisfy `NoDerives: Clone` LL | fn fun1(foo: &mut Vec<NoDerives>, bar: &[NoDerives]) { LL | foo.extend_from_slice(bar); | ^^^^^^^^^^^^^^^^^ @@ -18,7 +18,7 @@ error[E0599]: the method `extend_from_slice` exists for mutable reference `&mut --> $DIR/issue-91492.rs:12:9 | LL | pub struct SomeDerives; - | ----------------------- doesn't satisfy `SomeDerives: Clone` + | ---------------------- doesn't satisfy `SomeDerives: Clone` LL | fn fun2(foo: &mut Vec<SomeDerives>, bar: &[SomeDerives]) { LL | foo.extend_from_slice(bar); | ^^^^^^^^^^^^^^^^^ @@ -34,7 +34,7 @@ error[E0599]: the method `use_clone` exists for struct `Object<NoDerives, SomeDe --> $DIR/issue-91492.rs:22:9 | LL | pub struct NoDerives; - | --------------------- doesn't satisfy `NoDerives: Clone` + | -------------------- doesn't satisfy `NoDerives: Clone` ... LL | struct Object<T, A>(T, A); | ------ method `use_clone` not found for this struct diff --git a/src/test/ui/derives/issue-91550.stderr b/src/test/ui/derives/issue-91550.stderr index b1bec5432e3..3608052e2ff 100644 --- a/src/test/ui/derives/issue-91550.stderr +++ b/src/test/ui/derives/issue-91550.stderr @@ -2,7 +2,7 @@ error[E0599]: the method `insert` exists for struct `HashSet<Value>`, but its tr --> $DIR/issue-91550.rs:8:8 | LL | struct Value(u32); - | ------------------ + | ------------ | | | doesn't satisfy `Value: Eq` | doesn't satisfy `Value: Hash` @@ -22,7 +22,7 @@ error[E0599]: the method `use_eq` exists for struct `Object<NoDerives>`, but its --> $DIR/issue-91550.rs:26:9 | LL | pub struct NoDerives; - | --------------------- doesn't satisfy `NoDerives: Eq` + | -------------------- doesn't satisfy `NoDerives: Eq` LL | LL | struct Object<T>(T); | ------ method `use_eq` not found for this struct @@ -41,7 +41,7 @@ error[E0599]: the method `use_ord` exists for struct `Object<NoDerives>`, but it --> $DIR/issue-91550.rs:27:9 | LL | pub struct NoDerives; - | --------------------- doesn't satisfy `NoDerives: Ord` + | -------------------- doesn't satisfy `NoDerives: Ord` LL | LL | struct Object<T>(T); | ------ method `use_ord` not found for this struct @@ -60,7 +60,7 @@ error[E0599]: the method `use_ord_and_partial_ord` exists for struct `Object<NoD --> $DIR/issue-91550.rs:28:9 | LL | pub struct NoDerives; - | --------------------- + | -------------------- | | | doesn't satisfy `NoDerives: Ord` | doesn't satisfy `NoDerives: PartialOrd` diff --git a/src/test/ui/deriving/deriving-all-codegen.rs b/src/test/ui/deriving/deriving-all-codegen.rs new file mode 100644 index 00000000000..2f6ef74ac49 --- /dev/null +++ b/src/test/ui/deriving/deriving-all-codegen.rs @@ -0,0 +1,63 @@ +// check-pass +// compile-flags: -Zunpretty=expanded +// edition:2021 +// +// This test checks the code generated for all[*] the builtin derivable traits +// on a variety of structs and enums. It protects against accidental changes to +// the generated code, and makes deliberate changes to the generated code +// easier to review. +// +// [*] It excludes `Copy` in some cases, because that changes the code +// generated for `Clone`. +// +// [*] It excludes `RustcEncodable` and `RustDecodable`, which are obsolete and +// also require the `rustc_serialize` crate. + +#![crate_type = "lib"] +#![allow(dead_code)] +#![allow(deprecated)] + +// Empty struct. +#[derive(Clone, Copy, Debug, Default, Hash, PartialEq, Eq, PartialOrd, Ord)] +struct Empty; + +// A basic struct. +#[derive(Clone, Copy, Debug, Default, Hash, PartialEq, Eq, PartialOrd, Ord)] +struct Point { + x: u32, + y: u32, +} + +// A long struct. +#[derive(Clone, Debug, Default, Hash, PartialEq, Eq, PartialOrd, Ord)] +struct Big { + b1: u32, b2: u32, b3: u32, b4: u32, b5: u32, b6: u32, b7: u32, b8:u32, +} + +// A C-like, fieldless enum. +#[derive(Clone, Copy, Debug, Default, Hash, PartialEq, Eq, PartialOrd, Ord)] +enum Fieldless { + #[default] + A, + B, + C, +} + +// An enum with multiple fieldless and fielded variants. +#[derive(Clone, Copy, Debug, Default, Hash, PartialEq, Eq, PartialOrd, Ord)] +enum Mixed { + #[default] + P, + Q, + R(u32), + S { d1: u32, d2: u32 }, +} + +// An enum with no fieldless variants. Note that `Default` cannot be derived +// for this enum. +#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] +enum Fielded { + X(u32), + Y(bool), + Z(Option<i32>), +} diff --git a/src/test/ui/deriving/deriving-all-codegen.stdout b/src/test/ui/deriving/deriving-all-codegen.stdout new file mode 100644 index 00000000000..faa5a3c3ddf --- /dev/null +++ b/src/test/ui/deriving/deriving-all-codegen.stdout @@ -0,0 +1,1100 @@ +#![feature(prelude_import)] +// check-pass +// compile-flags: -Zunpretty=expanded +// edition:2021 +// +// This test checks the code generated for all[*] the builtin derivable traits +// on a variety of structs and enums. It protects against accidental changes to +// the generated code, and makes deliberate changes to the generated code +// easier to review. +// +// [*] It excludes `Copy` in some cases, because that changes the code +// generated for `Clone`. +// +// [*] It excludes `RustcEncodable` and `RustDecodable`, which are obsolete and +// also require the `rustc_serialize` crate. + +#![crate_type = "lib"] +#![allow(dead_code)] +#![allow(deprecated)] +#[prelude_import] +use std::prelude::rust_2021::*; +#[macro_use] +extern crate std; + +// Empty struct. +struct Empty; +#[automatically_derived] +#[allow(unused_qualifications)] +impl ::core::clone::Clone for Empty { + #[inline] + fn clone(&self) -> Empty { { *self } } +} +#[automatically_derived] +#[allow(unused_qualifications)] +impl ::core::marker::Copy for Empty { } +#[automatically_derived] +#[allow(unused_qualifications)] +impl ::core::fmt::Debug for Empty { + fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { + match *self { Self => ::core::fmt::Formatter::write_str(f, "Empty"), } + } +} +#[automatically_derived] +#[allow(unused_qualifications)] +impl ::core::default::Default for Empty { + #[inline] + fn default() -> Empty { Empty {} } +} +#[automatically_derived] +#[allow(unused_qualifications)] +impl ::core::hash::Hash for Empty { + fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { + match *self { Self => {} } + } +} +impl ::core::marker::StructuralPartialEq for Empty {} +#[automatically_derived] +#[allow(unused_qualifications)] +impl ::core::cmp::PartialEq for Empty { + #[inline] + fn eq(&self, other: &Empty) -> bool { + match *other { Self => match *self { Self => true, }, } + } +} +impl ::core::marker::StructuralEq for Empty {} +#[automatically_derived] +#[allow(unused_qualifications)] +impl ::core::cmp::Eq for Empty { + #[inline] + #[doc(hidden)] + #[no_coverage] + fn assert_receiver_is_total_eq(&self) -> () { {} } +} +#[automatically_derived] +#[allow(unused_qualifications)] +impl ::core::cmp::PartialOrd for Empty { + #[inline] + fn partial_cmp(&self, other: &Empty) + -> ::core::option::Option<::core::cmp::Ordering> { + match *other { + Self => + match *self { + Self => + ::core::option::Option::Some(::core::cmp::Ordering::Equal), + }, + } + } +} +#[automatically_derived] +#[allow(unused_qualifications)] +impl ::core::cmp::Ord for Empty { + #[inline] + fn cmp(&self, other: &Empty) -> ::core::cmp::Ordering { + match *other { + Self => match *self { Self => ::core::cmp::Ordering::Equal, }, + } + } +} + +// A basic struct. +struct Point { + x: u32, + y: u32, +} +#[automatically_derived] +#[allow(unused_qualifications)] +impl ::core::clone::Clone for Point { + #[inline] + fn clone(&self) -> Point { + { + let _: ::core::clone::AssertParamIsClone<u32>; + let _: ::core::clone::AssertParamIsClone<u32>; + *self + } + } +} +#[automatically_derived] +#[allow(unused_qualifications)] +impl ::core::marker::Copy for Point { } +#[automatically_derived] +#[allow(unused_qualifications)] +impl ::core::fmt::Debug for Point { + fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { + match *self { + Self { x: ref __self_0_0, y: ref __self_0_1 } => + ::core::fmt::Formatter::debug_struct_field2_finish(f, "Point", + "x", &&(*__self_0_0), "y", &&(*__self_0_1)), + } + } +} +#[automatically_derived] +#[allow(unused_qualifications)] +impl ::core::default::Default for Point { + #[inline] + fn default() -> Point { + Point { + x: ::core::default::Default::default(), + y: ::core::default::Default::default(), + } + } +} +#[automatically_derived] +#[allow(unused_qualifications)] +impl ::core::hash::Hash for Point { + fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { + match *self { + Self { x: ref __self_0_0, y: ref __self_0_1 } => { + ::core::hash::Hash::hash(&(*__self_0_0), state); + ::core::hash::Hash::hash(&(*__self_0_1), state) + } + } + } +} +impl ::core::marker::StructuralPartialEq for Point {} +#[automatically_derived] +#[allow(unused_qualifications)] +impl ::core::cmp::PartialEq for Point { + #[inline] + fn eq(&self, other: &Point) -> bool { + match *other { + Self { x: ref __self_1_0, y: ref __self_1_1 } => + match *self { + Self { x: ref __self_0_0, y: ref __self_0_1 } => + (*__self_0_0) == (*__self_1_0) && + (*__self_0_1) == (*__self_1_1), + }, + } + } + #[inline] + fn ne(&self, other: &Point) -> bool { + match *other { + Self { x: ref __self_1_0, y: ref __self_1_1 } => + match *self { + Self { x: ref __self_0_0, y: ref __self_0_1 } => + (*__self_0_0) != (*__self_1_0) || + (*__self_0_1) != (*__self_1_1), + }, + } + } +} +impl ::core::marker::StructuralEq for Point {} +#[automatically_derived] +#[allow(unused_qualifications)] +impl ::core::cmp::Eq for Point { + #[inline] + #[doc(hidden)] + #[no_coverage] + fn assert_receiver_is_total_eq(&self) -> () { + { + let _: ::core::cmp::AssertParamIsEq<u32>; + let _: ::core::cmp::AssertParamIsEq<u32>; + } + } +} +#[automatically_derived] +#[allow(unused_qualifications)] +impl ::core::cmp::PartialOrd for Point { + #[inline] + fn partial_cmp(&self, other: &Point) + -> ::core::option::Option<::core::cmp::Ordering> { + match *other { + Self { x: ref __self_1_0, y: ref __self_1_1 } => + match *self { + Self { x: ref __self_0_0, y: ref __self_0_1 } => + match ::core::cmp::PartialOrd::partial_cmp(&(*__self_0_0), + &(*__self_1_0)) { + ::core::option::Option::Some(::core::cmp::Ordering::Equal) + => + match ::core::cmp::PartialOrd::partial_cmp(&(*__self_0_1), + &(*__self_1_1)) { + ::core::option::Option::Some(::core::cmp::Ordering::Equal) + => + ::core::option::Option::Some(::core::cmp::Ordering::Equal), + cmp => cmp, + }, + cmp => cmp, + }, + }, + } + } +} +#[automatically_derived] +#[allow(unused_qualifications)] +impl ::core::cmp::Ord for Point { + #[inline] + fn cmp(&self, other: &Point) -> ::core::cmp::Ordering { + match *other { + Self { x: ref __self_1_0, y: ref __self_1_1 } => + match *self { + Self { x: ref __self_0_0, y: ref __self_0_1 } => + match ::core::cmp::Ord::cmp(&(*__self_0_0), &(*__self_1_0)) + { + ::core::cmp::Ordering::Equal => + match ::core::cmp::Ord::cmp(&(*__self_0_1), &(*__self_1_1)) + { + ::core::cmp::Ordering::Equal => + ::core::cmp::Ordering::Equal, + cmp => cmp, + }, + cmp => cmp, + }, + }, + } + } +} + +// A long struct. +struct Big { + b1: u32, + b2: u32, + b3: u32, + b4: u32, + b5: u32, + b6: u32, + b7: u32, + b8: u32, +} +#[automatically_derived] +#[allow(unused_qualifications)] +impl ::core::clone::Clone for Big { + #[inline] + fn clone(&self) -> Big { + match *self { + Self { + b1: ref __self_0_0, + b2: ref __self_0_1, + b3: ref __self_0_2, + b4: ref __self_0_3, + b5: ref __self_0_4, + b6: ref __self_0_5, + b7: ref __self_0_6, + b8: ref __self_0_7 } => + Big { + b1: ::core::clone::Clone::clone(&(*__self_0_0)), + b2: ::core::clone::Clone::clone(&(*__self_0_1)), + b3: ::core::clone::Clone::clone(&(*__self_0_2)), + b4: ::core::clone::Clone::clone(&(*__self_0_3)), + b5: ::core::clone::Clone::clone(&(*__self_0_4)), + b6: ::core::clone::Clone::clone(&(*__self_0_5)), + b7: ::core::clone::Clone::clone(&(*__self_0_6)), + b8: ::core::clone::Clone::clone(&(*__self_0_7)), + }, + } + } +} +#[automatically_derived] +#[allow(unused_qualifications)] +impl ::core::fmt::Debug for Big { + fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { + match *self { + Self { + b1: ref __self_0_0, + b2: ref __self_0_1, + b3: ref __self_0_2, + b4: ref __self_0_3, + b5: ref __self_0_4, + b6: ref __self_0_5, + b7: ref __self_0_6, + b8: ref __self_0_7 } => { + let names: &'static _ = + &["b1", "b2", "b3", "b4", "b5", "b6", "b7", "b8"]; + let values: &[&dyn ::core::fmt::Debug] = + &[&&(*__self_0_0), &&(*__self_0_1), &&(*__self_0_2), + &&(*__self_0_3), &&(*__self_0_4), &&(*__self_0_5), + &&(*__self_0_6), &&(*__self_0_7)]; + ::core::fmt::Formatter::debug_struct_fields_finish(f, "Big", + names, values) + } + } + } +} +#[automatically_derived] +#[allow(unused_qualifications)] +impl ::core::default::Default for Big { + #[inline] + fn default() -> Big { + Big { + b1: ::core::default::Default::default(), + b2: ::core::default::Default::default(), + b3: ::core::default::Default::default(), + b4: ::core::default::Default::default(), + b5: ::core::default::Default::default(), + b6: ::core::default::Default::default(), + b7: ::core::default::Default::default(), + b8: ::core::default::Default::default(), + } + } +} +#[automatically_derived] +#[allow(unused_qualifications)] +impl ::core::hash::Hash for Big { + fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { + match *self { + Self { + b1: ref __self_0_0, + b2: ref __self_0_1, + b3: ref __self_0_2, + b4: ref __self_0_3, + b5: ref __self_0_4, + b6: ref __self_0_5, + b7: ref __self_0_6, + b8: ref __self_0_7 } => { + ::core::hash::Hash::hash(&(*__self_0_0), state); + ::core::hash::Hash::hash(&(*__self_0_1), state); + ::core::hash::Hash::hash(&(*__self_0_2), state); + ::core::hash::Hash::hash(&(*__self_0_3), state); + ::core::hash::Hash::hash(&(*__self_0_4), state); + ::core::hash::Hash::hash(&(*__self_0_5), state); + ::core::hash::Hash::hash(&(*__self_0_6), state); + ::core::hash::Hash::hash(&(*__self_0_7), state) + } + } + } +} +impl ::core::marker::StructuralPartialEq for Big {} +#[automatically_derived] +#[allow(unused_qualifications)] +impl ::core::cmp::PartialEq for Big { + #[inline] + fn eq(&self, other: &Big) -> bool { + match *other { + Self { + b1: ref __self_1_0, + b2: ref __self_1_1, + b3: ref __self_1_2, + b4: ref __self_1_3, + b5: ref __self_1_4, + b6: ref __self_1_5, + b7: ref __self_1_6, + b8: ref __self_1_7 } => + match *self { + Self { + b1: ref __self_0_0, + b2: ref __self_0_1, + b3: ref __self_0_2, + b4: ref __self_0_3, + b5: ref __self_0_4, + b6: ref __self_0_5, + b7: ref __self_0_6, + b8: ref __self_0_7 } => + (*__self_0_0) == (*__self_1_0) && + (*__self_0_1) == (*__self_1_1) && + (*__self_0_2) == (*__self_1_2) && + (*__self_0_3) == (*__self_1_3) && + (*__self_0_4) == (*__self_1_4) && + (*__self_0_5) == (*__self_1_5) && + (*__self_0_6) == (*__self_1_6) && + (*__self_0_7) == (*__self_1_7), + }, + } + } + #[inline] + fn ne(&self, other: &Big) -> bool { + match *other { + Self { + b1: ref __self_1_0, + b2: ref __self_1_1, + b3: ref __self_1_2, + b4: ref __self_1_3, + b5: ref __self_1_4, + b6: ref __self_1_5, + b7: ref __self_1_6, + b8: ref __self_1_7 } => + match *self { + Self { + b1: ref __self_0_0, + b2: ref __self_0_1, + b3: ref __self_0_2, + b4: ref __self_0_3, + b5: ref __self_0_4, + b6: ref __self_0_5, + b7: ref __self_0_6, + b8: ref __self_0_7 } => + (*__self_0_0) != (*__self_1_0) || + (*__self_0_1) != (*__self_1_1) || + (*__self_0_2) != (*__self_1_2) || + (*__self_0_3) != (*__self_1_3) || + (*__self_0_4) != (*__self_1_4) || + (*__self_0_5) != (*__self_1_5) || + (*__self_0_6) != (*__self_1_6) || + (*__self_0_7) != (*__self_1_7), + }, + } + } +} +impl ::core::marker::StructuralEq for Big {} +#[automatically_derived] +#[allow(unused_qualifications)] +impl ::core::cmp::Eq for Big { + #[inline] + #[doc(hidden)] + #[no_coverage] + fn assert_receiver_is_total_eq(&self) -> () { + { + let _: ::core::cmp::AssertParamIsEq<u32>; + let _: ::core::cmp::AssertParamIsEq<u32>; + let _: ::core::cmp::AssertParamIsEq<u32>; + let _: ::core::cmp::AssertParamIsEq<u32>; + let _: ::core::cmp::AssertParamIsEq<u32>; + let _: ::core::cmp::AssertParamIsEq<u32>; + let _: ::core::cmp::AssertParamIsEq<u32>; + let _: ::core::cmp::AssertParamIsEq<u32>; + } + } +} +#[automatically_derived] +#[allow(unused_qualifications)] +impl ::core::cmp::PartialOrd for Big { + #[inline] + fn partial_cmp(&self, other: &Big) + -> ::core::option::Option<::core::cmp::Ordering> { + match *other { + Self { + b1: ref __self_1_0, + b2: ref __self_1_1, + b3: ref __self_1_2, + b4: ref __self_1_3, + b5: ref __self_1_4, + b6: ref __self_1_5, + b7: ref __self_1_6, + b8: ref __self_1_7 } => + match *self { + Self { + b1: ref __self_0_0, + b2: ref __self_0_1, + b3: ref __self_0_2, + b4: ref __self_0_3, + b5: ref __self_0_4, + b6: ref __self_0_5, + b7: ref __self_0_6, + b8: ref __self_0_7 } => + match ::core::cmp::PartialOrd::partial_cmp(&(*__self_0_0), + &(*__self_1_0)) { + ::core::option::Option::Some(::core::cmp::Ordering::Equal) + => + match ::core::cmp::PartialOrd::partial_cmp(&(*__self_0_1), + &(*__self_1_1)) { + ::core::option::Option::Some(::core::cmp::Ordering::Equal) + => + match ::core::cmp::PartialOrd::partial_cmp(&(*__self_0_2), + &(*__self_1_2)) { + ::core::option::Option::Some(::core::cmp::Ordering::Equal) + => + match ::core::cmp::PartialOrd::partial_cmp(&(*__self_0_3), + &(*__self_1_3)) { + ::core::option::Option::Some(::core::cmp::Ordering::Equal) + => + match ::core::cmp::PartialOrd::partial_cmp(&(*__self_0_4), + &(*__self_1_4)) { + ::core::option::Option::Some(::core::cmp::Ordering::Equal) + => + match ::core::cmp::PartialOrd::partial_cmp(&(*__self_0_5), + &(*__self_1_5)) { + ::core::option::Option::Some(::core::cmp::Ordering::Equal) + => + match ::core::cmp::PartialOrd::partial_cmp(&(*__self_0_6), + &(*__self_1_6)) { + ::core::option::Option::Some(::core::cmp::Ordering::Equal) + => + match ::core::cmp::PartialOrd::partial_cmp(&(*__self_0_7), + &(*__self_1_7)) { + ::core::option::Option::Some(::core::cmp::Ordering::Equal) + => + ::core::option::Option::Some(::core::cmp::Ordering::Equal), + cmp => cmp, + }, + cmp => cmp, + }, + cmp => cmp, + }, + cmp => cmp, + }, + cmp => cmp, + }, + cmp => cmp, + }, + cmp => cmp, + }, + cmp => cmp, + }, + }, + } + } +} +#[automatically_derived] +#[allow(unused_qualifications)] +impl ::core::cmp::Ord for Big { + #[inline] + fn cmp(&self, other: &Big) -> ::core::cmp::Ordering { + match *other { + Self { + b1: ref __self_1_0, + b2: ref __self_1_1, + b3: ref __self_1_2, + b4: ref __self_1_3, + b5: ref __self_1_4, + b6: ref __self_1_5, + b7: ref __self_1_6, + b8: ref __self_1_7 } => + match *self { + Self { + b1: ref __self_0_0, + b2: ref __self_0_1, + b3: ref __self_0_2, + b4: ref __self_0_3, + b5: ref __self_0_4, + b6: ref __self_0_5, + b7: ref __self_0_6, + b8: ref __self_0_7 } => + match ::core::cmp::Ord::cmp(&(*__self_0_0), &(*__self_1_0)) + { + ::core::cmp::Ordering::Equal => + match ::core::cmp::Ord::cmp(&(*__self_0_1), &(*__self_1_1)) + { + ::core::cmp::Ordering::Equal => + match ::core::cmp::Ord::cmp(&(*__self_0_2), &(*__self_1_2)) + { + ::core::cmp::Ordering::Equal => + match ::core::cmp::Ord::cmp(&(*__self_0_3), &(*__self_1_3)) + { + ::core::cmp::Ordering::Equal => + match ::core::cmp::Ord::cmp(&(*__self_0_4), &(*__self_1_4)) + { + ::core::cmp::Ordering::Equal => + match ::core::cmp::Ord::cmp(&(*__self_0_5), &(*__self_1_5)) + { + ::core::cmp::Ordering::Equal => + match ::core::cmp::Ord::cmp(&(*__self_0_6), &(*__self_1_6)) + { + ::core::cmp::Ordering::Equal => + match ::core::cmp::Ord::cmp(&(*__self_0_7), &(*__self_1_7)) + { + ::core::cmp::Ordering::Equal => + ::core::cmp::Ordering::Equal, + cmp => cmp, + }, + cmp => cmp, + }, + cmp => cmp, + }, + cmp => cmp, + }, + cmp => cmp, + }, + cmp => cmp, + }, + cmp => cmp, + }, + cmp => cmp, + }, + }, + } + } +} + +// A C-like, fieldless enum. +enum Fieldless { + + #[default] + A, + B, + C, +} +#[automatically_derived] +#[allow(unused_qualifications)] +impl ::core::clone::Clone for Fieldless { + #[inline] + fn clone(&self) -> Fieldless { { *self } } +} +#[automatically_derived] +#[allow(unused_qualifications)] +impl ::core::marker::Copy for Fieldless { } +#[automatically_derived] +#[allow(unused_qualifications)] +impl ::core::fmt::Debug for Fieldless { + fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { + match (&*self,) { + (&Fieldless::A,) => ::core::fmt::Formatter::write_str(f, "A"), + (&Fieldless::B,) => ::core::fmt::Formatter::write_str(f, "B"), + (&Fieldless::C,) => ::core::fmt::Formatter::write_str(f, "C"), + } + } +} +#[automatically_derived] +#[allow(unused_qualifications)] +impl ::core::default::Default for Fieldless { + #[inline] + fn default() -> Fieldless { Self::A } +} +#[automatically_derived] +#[allow(unused_qualifications)] +impl ::core::hash::Hash for Fieldless { + fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { + match (&*self,) { + _ => { + ::core::hash::Hash::hash(&::core::intrinsics::discriminant_value(self), + state) + } + } + } +} +impl ::core::marker::StructuralPartialEq for Fieldless {} +#[automatically_derived] +#[allow(unused_qualifications)] +impl ::core::cmp::PartialEq for Fieldless { + #[inline] + fn eq(&self, other: &Fieldless) -> bool { + { + let __self_vi = ::core::intrinsics::discriminant_value(&*self); + let __arg_1_vi = ::core::intrinsics::discriminant_value(&*other); + if __self_vi == __arg_1_vi { + match (&*self, &*other) { _ => true, } + } else { false } + } + } +} +impl ::core::marker::StructuralEq for Fieldless {} +#[automatically_derived] +#[allow(unused_qualifications)] +impl ::core::cmp::Eq for Fieldless { + #[inline] + #[doc(hidden)] + #[no_coverage] + fn assert_receiver_is_total_eq(&self) -> () { {} } +} +#[automatically_derived] +#[allow(unused_qualifications)] +impl ::core::cmp::PartialOrd for Fieldless { + #[inline] + fn partial_cmp(&self, other: &Fieldless) + -> ::core::option::Option<::core::cmp::Ordering> { + { + let __self_vi = ::core::intrinsics::discriminant_value(&*self); + let __arg_1_vi = ::core::intrinsics::discriminant_value(&*other); + if __self_vi == __arg_1_vi { + match (&*self, &*other) { + _ => + ::core::option::Option::Some(::core::cmp::Ordering::Equal), + } + } else { + ::core::cmp::PartialOrd::partial_cmp(&__self_vi, + &__arg_1_vi) + } + } + } +} +#[automatically_derived] +#[allow(unused_qualifications)] +impl ::core::cmp::Ord for Fieldless { + #[inline] + fn cmp(&self, other: &Fieldless) -> ::core::cmp::Ordering { + { + let __self_vi = ::core::intrinsics::discriminant_value(&*self); + let __arg_1_vi = ::core::intrinsics::discriminant_value(&*other); + if __self_vi == __arg_1_vi { + match (&*self, &*other) { + _ => ::core::cmp::Ordering::Equal, + } + } else { ::core::cmp::Ord::cmp(&__self_vi, &__arg_1_vi) } + } + } +} + +// An enum with multiple fieldless and fielded variants. +enum Mixed { + + #[default] + P, + Q, + R(u32), + S { + d1: u32, + d2: u32, + }, +} +#[automatically_derived] +#[allow(unused_qualifications)] +impl ::core::clone::Clone for Mixed { + #[inline] + fn clone(&self) -> Mixed { + { + let _: ::core::clone::AssertParamIsClone<u32>; + let _: ::core::clone::AssertParamIsClone<u32>; + let _: ::core::clone::AssertParamIsClone<u32>; + *self + } + } +} +#[automatically_derived] +#[allow(unused_qualifications)] +impl ::core::marker::Copy for Mixed { } +#[automatically_derived] +#[allow(unused_qualifications)] +impl ::core::fmt::Debug for Mixed { + fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { + match (&*self,) { + (&Mixed::P,) => ::core::fmt::Formatter::write_str(f, "P"), + (&Mixed::Q,) => ::core::fmt::Formatter::write_str(f, "Q"), + (&Mixed::R(ref __self_0),) => + ::core::fmt::Formatter::debug_tuple_field1_finish(f, "R", + &&(*__self_0)), + (&Mixed::S { d1: ref __self_0, d2: ref __self_1 },) => + ::core::fmt::Formatter::debug_struct_field2_finish(f, "S", + "d1", &&(*__self_0), "d2", &&(*__self_1)), + } + } +} +#[automatically_derived] +#[allow(unused_qualifications)] +impl ::core::default::Default for Mixed { + #[inline] + fn default() -> Mixed { Self::P } +} +#[automatically_derived] +#[allow(unused_qualifications)] +impl ::core::hash::Hash for Mixed { + fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { + match (&*self,) { + (&Mixed::R(ref __self_0),) => { + ::core::hash::Hash::hash(&::core::intrinsics::discriminant_value(self), + state); + ::core::hash::Hash::hash(&(*__self_0), state) + } + (&Mixed::S { d1: ref __self_0, d2: ref __self_1 },) => { + ::core::hash::Hash::hash(&::core::intrinsics::discriminant_value(self), + state); + ::core::hash::Hash::hash(&(*__self_0), state); + ::core::hash::Hash::hash(&(*__self_1), state) + } + _ => { + ::core::hash::Hash::hash(&::core::intrinsics::discriminant_value(self), + state) + } + } + } +} +impl ::core::marker::StructuralPartialEq for Mixed {} +#[automatically_derived] +#[allow(unused_qualifications)] +impl ::core::cmp::PartialEq for Mixed { + #[inline] + fn eq(&self, other: &Mixed) -> bool { + { + let __self_vi = ::core::intrinsics::discriminant_value(&*self); + let __arg_1_vi = ::core::intrinsics::discriminant_value(&*other); + if __self_vi == __arg_1_vi { + match (&*self, &*other) { + (&Mixed::R(ref __self_0), &Mixed::R(ref __arg_1_0)) => + (*__self_0) == (*__arg_1_0), + (&Mixed::S { d1: ref __self_0, d2: ref __self_1 }, + &Mixed::S { d1: ref __arg_1_0, d2: ref __arg_1_1 }) => + (*__self_0) == (*__arg_1_0) && (*__self_1) == (*__arg_1_1), + _ => true, + } + } else { false } + } + } + #[inline] + fn ne(&self, other: &Mixed) -> bool { + { + let __self_vi = ::core::intrinsics::discriminant_value(&*self); + let __arg_1_vi = ::core::intrinsics::discriminant_value(&*other); + if __self_vi == __arg_1_vi { + match (&*self, &*other) { + (&Mixed::R(ref __self_0), &Mixed::R(ref __arg_1_0)) => + (*__self_0) != (*__arg_1_0), + (&Mixed::S { d1: ref __self_0, d2: ref __self_1 }, + &Mixed::S { d1: ref __arg_1_0, d2: ref __arg_1_1 }) => + (*__self_0) != (*__arg_1_0) || (*__self_1) != (*__arg_1_1), + _ => false, + } + } else { true } + } + } +} +impl ::core::marker::StructuralEq for Mixed {} +#[automatically_derived] +#[allow(unused_qualifications)] +impl ::core::cmp::Eq for Mixed { + #[inline] + #[doc(hidden)] + #[no_coverage] + fn assert_receiver_is_total_eq(&self) -> () { + { + let _: ::core::cmp::AssertParamIsEq<u32>; + let _: ::core::cmp::AssertParamIsEq<u32>; + let _: ::core::cmp::AssertParamIsEq<u32>; + } + } +} +#[automatically_derived] +#[allow(unused_qualifications)] +impl ::core::cmp::PartialOrd for Mixed { + #[inline] + fn partial_cmp(&self, other: &Mixed) + -> ::core::option::Option<::core::cmp::Ordering> { + { + let __self_vi = ::core::intrinsics::discriminant_value(&*self); + let __arg_1_vi = ::core::intrinsics::discriminant_value(&*other); + if __self_vi == __arg_1_vi { + match (&*self, &*other) { + (&Mixed::R(ref __self_0), &Mixed::R(ref __arg_1_0)) => + match ::core::cmp::PartialOrd::partial_cmp(&(*__self_0), + &(*__arg_1_0)) { + ::core::option::Option::Some(::core::cmp::Ordering::Equal) + => + ::core::option::Option::Some(::core::cmp::Ordering::Equal), + cmp => cmp, + }, + (&Mixed::S { d1: ref __self_0, d2: ref __self_1 }, + &Mixed::S { d1: ref __arg_1_0, d2: ref __arg_1_1 }) => + match ::core::cmp::PartialOrd::partial_cmp(&(*__self_0), + &(*__arg_1_0)) { + ::core::option::Option::Some(::core::cmp::Ordering::Equal) + => + match ::core::cmp::PartialOrd::partial_cmp(&(*__self_1), + &(*__arg_1_1)) { + ::core::option::Option::Some(::core::cmp::Ordering::Equal) + => + ::core::option::Option::Some(::core::cmp::Ordering::Equal), + cmp => cmp, + }, + cmp => cmp, + }, + _ => + ::core::option::Option::Some(::core::cmp::Ordering::Equal), + } + } else { + ::core::cmp::PartialOrd::partial_cmp(&__self_vi, + &__arg_1_vi) + } + } + } +} +#[automatically_derived] +#[allow(unused_qualifications)] +impl ::core::cmp::Ord for Mixed { + #[inline] + fn cmp(&self, other: &Mixed) -> ::core::cmp::Ordering { + { + let __self_vi = ::core::intrinsics::discriminant_value(&*self); + let __arg_1_vi = ::core::intrinsics::discriminant_value(&*other); + if __self_vi == __arg_1_vi { + match (&*self, &*other) { + (&Mixed::R(ref __self_0), &Mixed::R(ref __arg_1_0)) => + match ::core::cmp::Ord::cmp(&(*__self_0), &(*__arg_1_0)) { + ::core::cmp::Ordering::Equal => + ::core::cmp::Ordering::Equal, + cmp => cmp, + }, + (&Mixed::S { d1: ref __self_0, d2: ref __self_1 }, + &Mixed::S { d1: ref __arg_1_0, d2: ref __arg_1_1 }) => + match ::core::cmp::Ord::cmp(&(*__self_0), &(*__arg_1_0)) { + ::core::cmp::Ordering::Equal => + match ::core::cmp::Ord::cmp(&(*__self_1), &(*__arg_1_1)) { + ::core::cmp::Ordering::Equal => + ::core::cmp::Ordering::Equal, + cmp => cmp, + }, + cmp => cmp, + }, + _ => ::core::cmp::Ordering::Equal, + } + } else { ::core::cmp::Ord::cmp(&__self_vi, &__arg_1_vi) } + } + } +} + +// An enum with no fieldless variants. Note that `Default` cannot be derived +// for this enum. +enum Fielded { X(u32), Y(bool), Z(Option<i32>), } +#[automatically_derived] +#[allow(unused_qualifications)] +impl ::core::clone::Clone for Fielded { + #[inline] + fn clone(&self) -> Fielded { + match (&*self,) { + (&Fielded::X(ref __self_0),) => + Fielded::X(::core::clone::Clone::clone(&(*__self_0))), + (&Fielded::Y(ref __self_0),) => + Fielded::Y(::core::clone::Clone::clone(&(*__self_0))), + (&Fielded::Z(ref __self_0),) => + Fielded::Z(::core::clone::Clone::clone(&(*__self_0))), + } + } +} +#[automatically_derived] +#[allow(unused_qualifications)] +impl ::core::fmt::Debug for Fielded { + fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { + match (&*self,) { + (&Fielded::X(ref __self_0),) => + ::core::fmt::Formatter::debug_tuple_field1_finish(f, "X", + &&(*__self_0)), + (&Fielded::Y(ref __self_0),) => + ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Y", + &&(*__self_0)), + (&Fielded::Z(ref __self_0),) => + ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Z", + &&(*__self_0)), + } + } +} +#[automatically_derived] +#[allow(unused_qualifications)] +impl ::core::hash::Hash for Fielded { + fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { + match (&*self,) { + (&Fielded::X(ref __self_0),) => { + ::core::hash::Hash::hash(&::core::intrinsics::discriminant_value(self), + state); + ::core::hash::Hash::hash(&(*__self_0), state) + } + (&Fielded::Y(ref __self_0),) => { + ::core::hash::Hash::hash(&::core::intrinsics::discriminant_value(self), + state); + ::core::hash::Hash::hash(&(*__self_0), state) + } + (&Fielded::Z(ref __self_0),) => { + ::core::hash::Hash::hash(&::core::intrinsics::discriminant_value(self), + state); + ::core::hash::Hash::hash(&(*__self_0), state) + } + } + } +} +impl ::core::marker::StructuralPartialEq for Fielded {} +#[automatically_derived] +#[allow(unused_qualifications)] +impl ::core::cmp::PartialEq for Fielded { + #[inline] + fn eq(&self, other: &Fielded) -> bool { + { + let __self_vi = ::core::intrinsics::discriminant_value(&*self); + let __arg_1_vi = ::core::intrinsics::discriminant_value(&*other); + if __self_vi == __arg_1_vi { + match (&*self, &*other) { + (&Fielded::X(ref __self_0), &Fielded::X(ref __arg_1_0)) => + (*__self_0) == (*__arg_1_0), + (&Fielded::Y(ref __self_0), &Fielded::Y(ref __arg_1_0)) => + (*__self_0) == (*__arg_1_0), + (&Fielded::Z(ref __self_0), &Fielded::Z(ref __arg_1_0)) => + (*__self_0) == (*__arg_1_0), + _ => unsafe { ::core::intrinsics::unreachable() } + } + } else { false } + } + } + #[inline] + fn ne(&self, other: &Fielded) -> bool { + { + let __self_vi = ::core::intrinsics::discriminant_value(&*self); + let __arg_1_vi = ::core::intrinsics::discriminant_value(&*other); + if __self_vi == __arg_1_vi { + match (&*self, &*other) { + (&Fielded::X(ref __self_0), &Fielded::X(ref __arg_1_0)) => + (*__self_0) != (*__arg_1_0), + (&Fielded::Y(ref __self_0), &Fielded::Y(ref __arg_1_0)) => + (*__self_0) != (*__arg_1_0), + (&Fielded::Z(ref __self_0), &Fielded::Z(ref __arg_1_0)) => + (*__self_0) != (*__arg_1_0), + _ => unsafe { ::core::intrinsics::unreachable() } + } + } else { true } + } + } +} +impl ::core::marker::StructuralEq for Fielded {} +#[automatically_derived] +#[allow(unused_qualifications)] +impl ::core::cmp::Eq for Fielded { + #[inline] + #[doc(hidden)] + #[no_coverage] + fn assert_receiver_is_total_eq(&self) -> () { + { + let _: ::core::cmp::AssertParamIsEq<u32>; + let _: ::core::cmp::AssertParamIsEq<bool>; + let _: ::core::cmp::AssertParamIsEq<Option<i32>>; + } + } +} +#[automatically_derived] +#[allow(unused_qualifications)] +impl ::core::cmp::PartialOrd for Fielded { + #[inline] + fn partial_cmp(&self, other: &Fielded) + -> ::core::option::Option<::core::cmp::Ordering> { + { + let __self_vi = ::core::intrinsics::discriminant_value(&*self); + let __arg_1_vi = ::core::intrinsics::discriminant_value(&*other); + if __self_vi == __arg_1_vi { + match (&*self, &*other) { + (&Fielded::X(ref __self_0), &Fielded::X(ref __arg_1_0)) => + match ::core::cmp::PartialOrd::partial_cmp(&(*__self_0), + &(*__arg_1_0)) { + ::core::option::Option::Some(::core::cmp::Ordering::Equal) + => + ::core::option::Option::Some(::core::cmp::Ordering::Equal), + cmp => cmp, + }, + (&Fielded::Y(ref __self_0), &Fielded::Y(ref __arg_1_0)) => + match ::core::cmp::PartialOrd::partial_cmp(&(*__self_0), + &(*__arg_1_0)) { + ::core::option::Option::Some(::core::cmp::Ordering::Equal) + => + ::core::option::Option::Some(::core::cmp::Ordering::Equal), + cmp => cmp, + }, + (&Fielded::Z(ref __self_0), &Fielded::Z(ref __arg_1_0)) => + match ::core::cmp::PartialOrd::partial_cmp(&(*__self_0), + &(*__arg_1_0)) { + ::core::option::Option::Some(::core::cmp::Ordering::Equal) + => + ::core::option::Option::Some(::core::cmp::Ordering::Equal), + cmp => cmp, + }, + _ => unsafe { ::core::intrinsics::unreachable() } + } + } else { + ::core::cmp::PartialOrd::partial_cmp(&__self_vi, + &__arg_1_vi) + } + } + } +} +#[automatically_derived] +#[allow(unused_qualifications)] +impl ::core::cmp::Ord for Fielded { + #[inline] + fn cmp(&self, other: &Fielded) -> ::core::cmp::Ordering { + { + let __self_vi = ::core::intrinsics::discriminant_value(&*self); + let __arg_1_vi = ::core::intrinsics::discriminant_value(&*other); + if __self_vi == __arg_1_vi { + match (&*self, &*other) { + (&Fielded::X(ref __self_0), &Fielded::X(ref __arg_1_0)) => + match ::core::cmp::Ord::cmp(&(*__self_0), &(*__arg_1_0)) { + ::core::cmp::Ordering::Equal => + ::core::cmp::Ordering::Equal, + cmp => cmp, + }, + (&Fielded::Y(ref __self_0), &Fielded::Y(ref __arg_1_0)) => + match ::core::cmp::Ord::cmp(&(*__self_0), &(*__arg_1_0)) { + ::core::cmp::Ordering::Equal => + ::core::cmp::Ordering::Equal, + cmp => cmp, + }, + (&Fielded::Z(ref __self_0), &Fielded::Z(ref __arg_1_0)) => + match ::core::cmp::Ord::cmp(&(*__self_0), &(*__arg_1_0)) { + ::core::cmp::Ordering::Equal => + ::core::cmp::Ordering::Equal, + cmp => cmp, + }, + _ => unsafe { ::core::intrinsics::unreachable() } + } + } else { ::core::cmp::Ord::cmp(&__self_vi, &__arg_1_vi) } + } + } +} diff --git a/src/test/ui/destructuring-assignment/note-unsupported.stderr b/src/test/ui/destructuring-assignment/note-unsupported.stderr index 3e2282743bf..e45344aa51f 100644 --- a/src/test/ui/destructuring-assignment/note-unsupported.stderr +++ b/src/test/ui/destructuring-assignment/note-unsupported.stderr @@ -52,14 +52,8 @@ LL | struct S { x: u8, y: u8 } note: the following trait must be implemented --> $SRC_DIR/core/src/ops/arith.rs:LL:COL | -LL | / pub trait AddAssign<Rhs = Self> { -LL | | /// Performs the `+=` operation. -LL | | /// -LL | | /// # Example -... | -LL | | fn add_assign(&mut self, rhs: Rhs); -LL | | } - | |_^ +LL | pub trait AddAssign<Rhs = Self> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0067]: invalid left-hand side of assignment --> $DIR/note-unsupported.rs:17:22 diff --git a/src/test/ui/did_you_mean/compatible-variants-in-pat.stderr b/src/test/ui/did_you_mean/compatible-variants-in-pat.stderr index a4c77e08efe..473468af6ee 100644 --- a/src/test/ui/did_you_mean/compatible-variants-in-pat.stderr +++ b/src/test/ui/did_you_mean/compatible-variants-in-pat.stderr @@ -15,7 +15,7 @@ error[E0308]: mismatched types --> $DIR/compatible-variants-in-pat.rs:21:9 | LL | struct S; - | --------- unit struct defined here + | -------- unit struct defined here ... LL | match s { | - this expression has type `Option<S>` @@ -40,7 +40,7 @@ error[E0308]: mismatched types --> $DIR/compatible-variants-in-pat.rs:32:9 | LL | struct S; - | --------- unit struct defined here + | -------- unit struct defined here ... LL | match s { | - this expression has type `Result<S, S>` diff --git a/src/test/ui/dropck/issue-38868.stderr b/src/test/ui/dropck/issue-38868.stderr index f267abc0bfa..ec81c2ea646 100644 --- a/src/test/ui/dropck/issue-38868.stderr +++ b/src/test/ui/dropck/issue-38868.stderr @@ -1,21 +1,15 @@ error[E0366]: `Drop` impls cannot be specialized --> $DIR/issue-38868.rs:5:1 | -LL | / impl Drop for List<i32> { -LL | | fn drop(&mut self) { -LL | | panic!() -LL | | } -LL | | } - | |_^ +LL | impl Drop for List<i32> { + | ^^^^^^^^^^^^^^^^^^^^^^^ | = note: `i32` is not a generic parameter note: use the same sequence of generic lifetime, type and const parameters as the struct definition --> $DIR/issue-38868.rs:1:1 | -LL | / pub struct List<T> { -LL | | head: T, -LL | | } - | |_^ +LL | pub struct List<T> { + | ^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/dropck/reject-specialized-drops-8142.stderr b/src/test/ui/dropck/reject-specialized-drops-8142.stderr index 7f50cf5ab15..ebd484b8800 100644 --- a/src/test/ui/dropck/reject-specialized-drops-8142.stderr +++ b/src/test/ui/dropck/reject-specialized-drops-8142.stderr @@ -8,7 +8,7 @@ note: the implementor must specify the same requirement --> $DIR/reject-specialized-drops-8142.rs:4:1 | LL | struct K<'l1,'l2> { x: &'l1 i8, y: &'l2 u8 } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^ error[E0367]: `Drop` impl requires `'adds_bnd: 'al` but the struct it is implemented for does not --> $DIR/reject-specialized-drops-8142.rs:28:67 @@ -20,33 +20,33 @@ note: the implementor must specify the same requirement --> $DIR/reject-specialized-drops-8142.rs:5:1 | LL | struct L<'l1,'l2> { x: &'l1 i8, y: &'l2 u8 } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^ error[E0366]: `Drop` impls cannot be specialized --> $DIR/reject-specialized-drops-8142.rs:34:1 | LL | impl Drop for N<'static> { fn drop(&mut self) { } } // REJECT - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `'static` is not a generic parameter note: use the same sequence of generic lifetime, type and const parameters as the struct definition --> $DIR/reject-specialized-drops-8142.rs:7:1 | LL | struct N<'n> { x: &'n i8 } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^ error[E0366]: `Drop` impls cannot be specialized --> $DIR/reject-specialized-drops-8142.rs:39:1 | LL | impl Drop for P<i8> { fn drop(&mut self) { } } // REJECT - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `i8` is not a generic parameter note: use the same sequence of generic lifetime, type and const parameters as the struct definition --> $DIR/reject-specialized-drops-8142.rs:9:1 | LL | struct P<Tp> { x: *const Tp } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^ error[E0367]: `Drop` impl requires `AddsBnd: Bound` but the struct it is implemented for does not --> $DIR/reject-specialized-drops-8142.rs:42:14 @@ -58,7 +58,7 @@ note: the implementor must specify the same requirement --> $DIR/reject-specialized-drops-8142.rs:10:1 | LL | struct Q<Tq> { x: *const Tq } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^ error[E0367]: `Drop` impl requires `AddsRBnd: 'rbnd` but the struct it is implemented for does not --> $DIR/reject-specialized-drops-8142.rs:45:21 @@ -70,59 +70,59 @@ note: the implementor must specify the same requirement --> $DIR/reject-specialized-drops-8142.rs:11:1 | LL | struct R<Tr> { x: *const Tr } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^ error[E0366]: `Drop` impls cannot be specialized --> $DIR/reject-specialized-drops-8142.rs:54:1 | LL | impl<One> Drop for V<One,One> { fn drop(&mut self) { } } // REJECT - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `One` is mentioned multiple times note: use the same sequence of generic lifetime, type and const parameters as the struct definition --> $DIR/reject-specialized-drops-8142.rs:15:1 | LL | struct V<Tva, Tvb> { x: *const Tva, y: *const Tvb } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^ error[E0366]: `Drop` impls cannot be specialized --> $DIR/reject-specialized-drops-8142.rs:57:1 | LL | impl<'lw> Drop for W<'lw,'lw> { fn drop(&mut self) { } } // REJECT - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `'lw` is mentioned multiple times note: use the same sequence of generic lifetime, type and const parameters as the struct definition --> $DIR/reject-specialized-drops-8142.rs:16:1 | LL | struct W<'l1, 'l2> { x: &'l1 i8, y: &'l2 u8 } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^ error[E0366]: `Drop` impls cannot be specialized --> $DIR/reject-specialized-drops-8142.rs:60:1 | LL | impl Drop for X<3> { fn drop(&mut self) { } } // REJECT - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `3_usize` is not a generic parameter note: use the same sequence of generic lifetime, type and const parameters as the struct definition --> $DIR/reject-specialized-drops-8142.rs:17:1 | LL | struct X<const Ca: usize>; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0366]: `Drop` impls cannot be specialized --> $DIR/reject-specialized-drops-8142.rs:63:1 | LL | impl<const Ca: usize> Drop for Y<Ca, Ca> { fn drop(&mut self) { } } // REJECT - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `Ca` is mentioned multiple times note: use the same sequence of generic lifetime, type and const parameters as the struct definition --> $DIR/reject-specialized-drops-8142.rs:18:1 | LL | struct Y<const Ca: usize, const Cb: usize>; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0367]: `Drop` impl requires `AddsBnd: Bound` but the enum it is implemented for does not --> $DIR/reject-specialized-drops-8142.rs:66:14 @@ -134,7 +134,7 @@ note: the implementor must specify the same requirement --> $DIR/reject-specialized-drops-8142.rs:20:1 | LL | enum Enum<T> { Variant(T) } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^ error[E0367]: `Drop` impl requires `AddsBnd: Bound` but the struct it is implemented for does not --> $DIR/reject-specialized-drops-8142.rs:69:14 @@ -146,7 +146,7 @@ note: the implementor must specify the same requirement --> $DIR/reject-specialized-drops-8142.rs:21:1 | LL | struct TupleStruct<T>(T); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^ error[E0367]: `Drop` impl requires `AddsBnd: Bound` but the union it is implemented for does not --> $DIR/reject-specialized-drops-8142.rs:72:21 @@ -158,7 +158,7 @@ note: the implementor must specify the same requirement --> $DIR/reject-specialized-drops-8142.rs:22:1 | LL | union Union<T: Copy> { f: T } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^ error: aborting due to 13 previous errors diff --git a/src/test/ui/dropck/relate_lt_in_type_outlives_bound.stderr b/src/test/ui/dropck/relate_lt_in_type_outlives_bound.stderr index 5176684e153..3d9685db683 100644 --- a/src/test/ui/dropck/relate_lt_in_type_outlives_bound.stderr +++ b/src/test/ui/dropck/relate_lt_in_type_outlives_bound.stderr @@ -7,10 +7,8 @@ LL | T: 'static, note: the implementor must specify the same requirement --> $DIR/relate_lt_in_type_outlives_bound.rs:1:1 | -LL | / struct Wrapper<'a, T>(&'a T) -LL | | where -LL | | T: 'a; - | |__________^ +LL | struct Wrapper<'a, T>(&'a T) + | ^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/dst/dst-bad-coerce1.stderr b/src/test/ui/dst/dst-bad-coerce1.stderr index 121c76a01a5..594acff853a 100644 --- a/src/test/ui/dst/dst-bad-coerce1.stderr +++ b/src/test/ui/dst/dst-bad-coerce1.stderr @@ -15,7 +15,7 @@ error[E0277]: the trait bound `Foo: Bar` is not satisfied LL | let f3: &Fat<dyn Bar> = f2; | ^^ the trait `Bar` is not implemented for `Foo` | - = note: required for the cast to the object type `dyn Bar` + = note: required for the cast from `Foo` to the object type `dyn Bar` error[E0308]: mismatched types --> $DIR/dst-bad-coerce1.rs:28:27 @@ -34,7 +34,7 @@ error[E0277]: the trait bound `Foo: Bar` is not satisfied LL | let f3: &(dyn Bar,) = f2; | ^^ the trait `Bar` is not implemented for `Foo` | - = note: required for the cast to the object type `dyn Bar` + = note: required for the cast from `Foo` to the object type `dyn Bar` error: aborting due to 4 previous errors diff --git a/src/test/ui/dst/dst-index.stderr b/src/test/ui/dst/dst-index.stderr index 6bcd70cbaad..d38af3f89c2 100644 --- a/src/test/ui/dst/dst-index.stderr +++ b/src/test/ui/dst/dst-index.stderr @@ -1,14 +1,14 @@ -error[E0161]: cannot move a value of type str: the size of str cannot be statically determined +error[E0161]: cannot move a value of type `str` --> $DIR/dst-index.rs:31:5 | LL | S[0]; - | ^^^^ + | ^^^^ the size of `str` cannot be statically determined -error[E0161]: cannot move a value of type dyn Debug: the size of dyn Debug cannot be statically determined +error[E0161]: cannot move a value of type `dyn Debug` --> $DIR/dst-index.rs:34:5 | LL | T[0]; - | ^^^^ + | ^^^^ the size of `dyn Debug` cannot be statically determined error[E0507]: cannot move out of index of `S` --> $DIR/dst-index.rs:31:5 diff --git a/src/test/ui/dst/dst-object-from-unsized-type.stderr b/src/test/ui/dst/dst-object-from-unsized-type.stderr index 5bd47736626..e24c96ebed6 100644 --- a/src/test/ui/dst/dst-object-from-unsized-type.stderr +++ b/src/test/ui/dst/dst-object-from-unsized-type.stderr @@ -6,7 +6,7 @@ LL | fn test1<T: ?Sized + Foo>(t: &T) { LL | let u: &dyn Foo = t; | ^ doesn't have a size known at compile-time | - = note: required for the cast to the object type `dyn Foo` + = note: required for the cast from `T` to the object type `dyn Foo` help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - fn test1<T: ?Sized + Foo>(t: &T) { @@ -21,7 +21,7 @@ LL | fn test2<T: ?Sized + Foo>(t: &T) { LL | let v: &dyn Foo = t as &dyn Foo; | ^ doesn't have a size known at compile-time | - = note: required for the cast to the object type `dyn Foo` + = note: required for the cast from `T` to the object type `dyn Foo` help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - fn test2<T: ?Sized + Foo>(t: &T) { @@ -35,7 +35,7 @@ LL | let _: &[&dyn Foo] = &["hi"]; | ^^^^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `str` - = note: required for the cast to the object type `dyn Foo` + = note: required for the cast from `str` to the object type `dyn Foo` error[E0277]: the size for values of type `[u8]` cannot be known at compilation time --> $DIR/dst-object-from-unsized-type.rs:23:23 @@ -44,7 +44,7 @@ LL | let _: &dyn Foo = x as &dyn Foo; | ^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `[u8]` - = note: required for the cast to the object type `dyn Foo` + = note: required for the cast from `[u8]` to the object type `dyn Foo` error: aborting due to 4 previous errors diff --git a/src/test/ui/duplicate/dupe-symbols-6.stderr b/src/test/ui/duplicate/dupe-symbols-6.stderr index 8d5b7fb35bf..6692a63dce8 100644 --- a/src/test/ui/duplicate/dupe-symbols-6.stderr +++ b/src/test/ui/duplicate/dupe-symbols-6.stderr @@ -2,7 +2,7 @@ error: symbol `fail` is already defined --> $DIR/dupe-symbols-6.rs:10:1 | LL | static HELLO_TWICE: u16 = 0; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/empty/empty-struct-braces-expr.stderr b/src/test/ui/empty/empty-struct-braces-expr.stderr index 48e5ea8ec86..5fc0a916a09 100644 --- a/src/test/ui/empty/empty-struct-braces-expr.stderr +++ b/src/test/ui/empty/empty-struct-braces-expr.stderr @@ -10,7 +10,7 @@ LL | let e1 = Empty1; ::: $DIR/auxiliary/empty-struct.rs:2:1 | LL | pub struct XEmpty2; - | ------------------- similarly named unit struct `XEmpty2` defined here + | ------------------ similarly named unit struct `XEmpty2` defined here | help: use struct literal syntax instead | @@ -33,7 +33,7 @@ LL | let e1 = Empty1(); ::: $DIR/auxiliary/empty-struct.rs:2:1 | LL | pub struct XEmpty2; - | ------------------- similarly named unit struct `XEmpty2` defined here + | ------------------ similarly named unit struct `XEmpty2` defined here | help: use struct literal syntax instead | @@ -73,7 +73,7 @@ LL | let xe1 = XEmpty1; LL | pub struct XEmpty1 {} | ------------------ `XEmpty1` defined here LL | pub struct XEmpty2; - | ------------------- similarly named unit struct `XEmpty2` defined here + | ------------------ similarly named unit struct `XEmpty2` defined here | help: use struct literal syntax instead | @@ -95,7 +95,7 @@ LL | let xe1 = XEmpty1(); LL | pub struct XEmpty1 {} | ------------------ `XEmpty1` defined here LL | pub struct XEmpty2; - | ------------------- similarly named unit struct `XEmpty2` defined here + | ------------------ similarly named unit struct `XEmpty2` defined here | help: use struct literal syntax instead | diff --git a/src/test/ui/empty/empty-struct-braces-pat-2.stderr b/src/test/ui/empty/empty-struct-braces-pat-2.stderr index 28191615afd..7fb5cb2034a 100644 --- a/src/test/ui/empty/empty-struct-braces-pat-2.stderr +++ b/src/test/ui/empty/empty-struct-braces-pat-2.stderr @@ -10,7 +10,7 @@ LL | Empty1() => () ::: $DIR/auxiliary/empty-struct.rs:3:1 | LL | pub struct XEmpty6(); - | --------------------- similarly named tuple struct `XEmpty6` defined here + | ------------------ similarly named tuple struct `XEmpty6` defined here | help: use struct pattern syntax instead | @@ -33,7 +33,7 @@ LL | pub struct XEmpty1 {} | ------------------ `XEmpty1` defined here LL | pub struct XEmpty2; LL | pub struct XEmpty6(); - | --------------------- similarly named tuple struct `XEmpty6` defined here + | ------------------ similarly named tuple struct `XEmpty6` defined here | help: use struct pattern syntax instead | @@ -56,7 +56,7 @@ LL | Empty1(..) => () ::: $DIR/auxiliary/empty-struct.rs:3:1 | LL | pub struct XEmpty6(); - | --------------------- similarly named tuple struct `XEmpty6` defined here + | ------------------ similarly named tuple struct `XEmpty6` defined here | help: use struct pattern syntax instead | @@ -79,7 +79,7 @@ LL | pub struct XEmpty1 {} | ------------------ `XEmpty1` defined here LL | pub struct XEmpty2; LL | pub struct XEmpty6(); - | --------------------- similarly named tuple struct `XEmpty6` defined here + | ------------------ similarly named tuple struct `XEmpty6` defined here | help: use struct pattern syntax instead | diff --git a/src/test/ui/empty/empty-struct-unit-expr.stderr b/src/test/ui/empty/empty-struct-unit-expr.stderr index c15253ba9cd..cd51274dce8 100644 --- a/src/test/ui/empty/empty-struct-unit-expr.stderr +++ b/src/test/ui/empty/empty-struct-unit-expr.stderr @@ -2,7 +2,7 @@ error[E0618]: expected function, found `Empty2` --> $DIR/empty-struct-unit-expr.rs:15:14 | LL | struct Empty2; - | -------------- `Empty2` defined here + | ------------- `Empty2` defined here ... LL | let e2 = Empty2(); | ^^^^^^-- diff --git a/src/test/ui/empty/empty-struct-unit-pat.stderr b/src/test/ui/empty/empty-struct-unit-pat.stderr index b1b253385fd..acd1070d5d6 100644 --- a/src/test/ui/empty/empty-struct-unit-pat.stderr +++ b/src/test/ui/empty/empty-struct-unit-pat.stderr @@ -10,7 +10,7 @@ LL | Empty2() => () ::: $DIR/auxiliary/empty-struct.rs:3:1 | LL | pub struct XEmpty6(); - | --------------------- similarly named tuple struct `XEmpty6` defined here + | ------------------ similarly named tuple struct `XEmpty6` defined here | help: use this syntax instead | @@ -30,9 +30,9 @@ LL | XEmpty2() => () ::: $DIR/auxiliary/empty-struct.rs:2:1 | LL | pub struct XEmpty2; - | ------------------- `XEmpty2` defined here + | ------------------ `XEmpty2` defined here LL | pub struct XEmpty6(); - | --------------------- similarly named tuple struct `XEmpty6` defined here + | ------------------ similarly named tuple struct `XEmpty6` defined here | help: use this syntax instead | @@ -55,7 +55,7 @@ LL | Empty2(..) => () ::: $DIR/auxiliary/empty-struct.rs:3:1 | LL | pub struct XEmpty6(); - | --------------------- similarly named tuple struct `XEmpty6` defined here + | ------------------ similarly named tuple struct `XEmpty6` defined here | help: use this syntax instead | @@ -75,9 +75,9 @@ LL | XEmpty2(..) => () ::: $DIR/auxiliary/empty-struct.rs:2:1 | LL | pub struct XEmpty2; - | ------------------- `XEmpty2` defined here + | ------------------ `XEmpty2` defined here LL | pub struct XEmpty6(); - | --------------------- similarly named tuple struct `XEmpty6` defined here + | ------------------ similarly named tuple struct `XEmpty6` defined here | help: use this syntax instead | diff --git a/src/test/ui/error-codes/E0004-2.stderr b/src/test/ui/error-codes/E0004-2.stderr index d4519af5408..6f5bb4309c3 100644 --- a/src/test/ui/error-codes/E0004-2.stderr +++ b/src/test/ui/error-codes/E0004-2.stderr @@ -7,17 +7,14 @@ LL | match x { } note: `Option<i32>` defined here --> $SRC_DIR/core/src/option.rs:LL:COL | -LL | / pub enum Option<T> { -LL | | /// No value. -LL | | #[lang = "None"] -LL | | #[stable(feature = "rust1", since = "1.0.0")] -LL | | None, - | | ^^^^ not covered -... | -LL | | Some(#[stable(feature = "rust1", since = "1.0.0")] T), - | | ^^^^ not covered -LL | | } - | |_- +LL | pub enum Option<T> { + | ------------------ +... +LL | None, + | ^^^^ not covered +... +LL | Some(#[stable(feature = "rust1", since = "1.0.0")] T), + | ^^^^ not covered = note: the matched value is of type `Option<i32>` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms | diff --git a/src/test/ui/error-codes/E0005.stderr b/src/test/ui/error-codes/E0005.stderr index 55b1112b5f8..f01a77bd374 100644 --- a/src/test/ui/error-codes/E0005.stderr +++ b/src/test/ui/error-codes/E0005.stderr @@ -9,16 +9,11 @@ LL | let Some(y) = x; note: `Option<i32>` defined here --> $SRC_DIR/core/src/option.rs:LL:COL | -LL | / pub enum Option<T> { -LL | | /// No value. -LL | | #[lang = "None"] -LL | | #[stable(feature = "rust1", since = "1.0.0")] -LL | | None, - | | ^^^^ not covered -... | -LL | | Some(#[stable(feature = "rust1", since = "1.0.0")] T), -LL | | } - | |_- +LL | pub enum Option<T> { + | ------------------ +... +LL | None, + | ^^^^ not covered = note: the matched value is of type `Option<i32>` help: you might want to use `if let` to ignore the variant that isn't matched | diff --git a/src/test/ui/error-codes/E0017.stderr b/src/test/ui/error-codes/E0017.stderr index 7d959b6d148..830e4db345a 100644 --- a/src/test/ui/error-codes/E0017.stderr +++ b/src/test/ui/error-codes/E0017.stderr @@ -11,7 +11,7 @@ note: `const` item defined here --> $DIR/E0017.rs:2:1 | LL | const C: i32 = 2; - | ^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^ error[E0764]: mutable references are not allowed in the final value of constants --> $DIR/E0017.rs:5:30 @@ -52,7 +52,7 @@ note: `const` item defined here --> $DIR/E0017.rs:2:1 | LL | const C: i32 = 2; - | ^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^ error[E0764]: mutable references are not allowed in the final value of statics --> $DIR/E0017.rs:11:38 diff --git a/src/test/ui/error-codes/E0057.stderr b/src/test/ui/error-codes/E0057.stderr index 3697b5fcf15..2307f52c93b 100644 --- a/src/test/ui/error-codes/E0057.stderr +++ b/src/test/ui/error-codes/E0057.stderr @@ -18,7 +18,7 @@ error[E0057]: this function takes 1 argument but 2 arguments were supplied --> $DIR/E0057.rs:5:13 | LL | let c = f(2, 3); - | ^ - argument unexpected + | ^ - argument of type `{integer}` unexpected | note: closure defined here --> $DIR/E0057.rs:2:13 diff --git a/src/test/ui/error-codes/E0075.stderr b/src/test/ui/error-codes/E0075.stderr index d8b90d0691d..3f927726a03 100644 --- a/src/test/ui/error-codes/E0075.stderr +++ b/src/test/ui/error-codes/E0075.stderr @@ -2,7 +2,7 @@ error[E0075]: SIMD vector cannot be empty --> $DIR/E0075.rs:4:1 | LL | struct Bad; - | ^^^^^^^^^^^ + | ^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0076.stderr b/src/test/ui/error-codes/E0076.stderr index 2c2842d152b..7d4ff879816 100644 --- a/src/test/ui/error-codes/E0076.stderr +++ b/src/test/ui/error-codes/E0076.stderr @@ -2,7 +2,7 @@ error[E0076]: SIMD vector should be homogeneous --> $DIR/E0076.rs:4:1 | LL | struct Bad(u16, u32, u32); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ SIMD elements must have the same type + | ^^^^^^^^^^ SIMD elements must have the same type error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0077.stderr b/src/test/ui/error-codes/E0077.stderr index 1938a9a272a..9a84b2ec406 100644 --- a/src/test/ui/error-codes/E0077.stderr +++ b/src/test/ui/error-codes/E0077.stderr @@ -2,7 +2,7 @@ error[E0077]: SIMD vector element type should be a primitive scalar (integer/flo --> $DIR/E0077.rs:4:1 | LL | struct Bad(String); - | ^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0152.stderr b/src/test/ui/error-codes/E0152.stderr index 5cdfe1cc556..29f7e4ad683 100644 --- a/src/test/ui/error-codes/E0152.stderr +++ b/src/test/ui/error-codes/E0152.stderr @@ -2,7 +2,7 @@ error[E0152]: found duplicate lang item `owned_box` --> $DIR/E0152.rs:5:1 | LL | struct Foo<T>(T); - | ^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^ | = note: the lang item is first defined in crate `alloc` (which `std` depends on) = note: first definition in `alloc` loaded from SYSROOT/liballoc-*.rlib diff --git a/src/test/ui/error-codes/E0161.base.stderr b/src/test/ui/error-codes/E0161.base.stderr index fb578cda17e..15d98b657a2 100644 --- a/src/test/ui/error-codes/E0161.base.stderr +++ b/src/test/ui/error-codes/E0161.base.stderr @@ -1,8 +1,8 @@ -error[E0161]: cannot move a value of type dyn Bar: the size of dyn Bar cannot be statically determined +error[E0161]: cannot move a value of type `dyn Bar` --> $DIR/E0161.rs:16:5 | LL | x.f(); - | ^^^^^ + | ^^^^^ the size of `dyn Bar` cannot be statically determined error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0191.stderr b/src/test/ui/error-codes/E0191.stderr index d69a14916e1..cf80c9c46ca 100644 --- a/src/test/ui/error-codes/E0191.stderr +++ b/src/test/ui/error-codes/E0191.stderr @@ -2,7 +2,7 @@ error[E0191]: the value of the associated type `Bar` (from trait `Trait`) must b --> $DIR/E0191.rs:5:16 | LL | type Bar; - | --------- `Bar` defined here + | -------- `Bar` defined here ... LL | type Foo = dyn Trait; | ^^^^^ help: specify the associated type: `Trait<Bar = Type>` diff --git a/src/test/ui/error-codes/E0201.stderr b/src/test/ui/error-codes/E0201.stderr index 89cfd402423..94e06894144 100644 --- a/src/test/ui/error-codes/E0201.stderr +++ b/src/test/ui/error-codes/E0201.stderr @@ -2,26 +2,26 @@ error[E0201]: duplicate definitions with name `bar`: --> $DIR/E0201.rs:5:5 | LL | fn bar(&self) -> bool { self.0 > 5 } - | ------------------------------------ previous definition of `bar` here + | --------------------- previous definition of `bar` here LL | fn bar() {} - | ^^^^^^^^^^^ duplicate definition + | ^^^^^^^^ duplicate definition error[E0201]: duplicate definitions with name `baz`: --> $DIR/E0201.rs:17:5 | LL | fn baz(&self) -> bool { true } - | ------------------------------ previous definition of `baz` here + | --------------------- previous definition of `baz` here LL | fn baz(&self) -> bool { self.0 > 5 } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ duplicate definition + | ^^^^^^^^^^^^^^^^^^^^^ duplicate definition error[E0201]: duplicate definitions with name `Quux`: --> $DIR/E0201.rs:18:5 | LL | type Quux = u32; - | ---------------- previous definition of `Quux` here + | --------- previous definition of `Quux` here ... LL | type Quux = u32; - | ^^^^^^^^^^^^^^^^ duplicate definition + | ^^^^^^^^^ duplicate definition error: aborting due to 3 previous errors diff --git a/src/test/ui/error-codes/E0220.stderr b/src/test/ui/error-codes/E0220.stderr index 4fa83d8bf6e..11763ce788d 100644 --- a/src/test/ui/error-codes/E0220.stderr +++ b/src/test/ui/error-codes/E0220.stderr @@ -8,7 +8,7 @@ error[E0191]: the value of the associated type `Bar` (from trait `Trait`) must b --> $DIR/E0220.rs:5:16 | LL | type Bar; - | --------- `Bar` defined here + | -------- `Bar` defined here ... LL | type Foo = dyn Trait<F=i32>; | ^^^^^^^^^^^^ help: specify the associated type: `Trait<F=i32, Bar = Type>` diff --git a/src/test/ui/error-codes/E0221.stderr b/src/test/ui/error-codes/E0221.stderr index f3dbf122de3..5414d77ad7c 100644 --- a/src/test/ui/error-codes/E0221.stderr +++ b/src/test/ui/error-codes/E0221.stderr @@ -2,10 +2,10 @@ error[E0221]: ambiguous associated type `A` in bounds of `Self` --> $DIR/E0221.rs:11:16 | LL | type A: T1; - | ----------- ambiguous `A` from `Foo` + | ---------- ambiguous `A` from `Foo` ... LL | type A: T2; - | ----------- ambiguous `A` from `Bar` + | ---------- ambiguous `A` from `Bar` LL | fn do_something() { LL | let _: Self::A; | ^^^^^^^ ambiguous associated type `A` @@ -23,7 +23,7 @@ error[E0221]: ambiguous associated type `Err` in bounds of `Self` --> $DIR/E0221.rs:21:16 | LL | type Err: T3; - | ------------- ambiguous `Err` from `My` + | ------------ ambiguous `Err` from `My` LL | fn test() { LL | let _: Self::Err; | ^^^^^^^^^ ambiguous associated type `Err` diff --git a/src/test/ui/error-codes/E0264.stderr b/src/test/ui/error-codes/E0264.stderr index 403c0aa4146..e8e35a12cbb 100644 --- a/src/test/ui/error-codes/E0264.stderr +++ b/src/test/ui/error-codes/E0264.stderr @@ -2,7 +2,7 @@ error[E0264]: unknown external lang item: `cake` --> $DIR/E0264.rs:5:5 | LL | fn cake(); - | ^^^^^^^^^^ + | ^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0297.stderr b/src/test/ui/error-codes/E0297.stderr index 95d95003c61..693b079238d 100644 --- a/src/test/ui/error-codes/E0297.stderr +++ b/src/test/ui/error-codes/E0297.stderr @@ -7,16 +7,11 @@ LL | for Some(x) in xs {} note: `Option<i32>` defined here --> $SRC_DIR/core/src/option.rs:LL:COL | -LL | / pub enum Option<T> { -LL | | /// No value. -LL | | #[lang = "None"] -LL | | #[stable(feature = "rust1", since = "1.0.0")] -LL | | None, - | | ^^^^ not covered -... | -LL | | Some(#[stable(feature = "rust1", since = "1.0.0")] T), -LL | | } - | |_- +LL | pub enum Option<T> { + | ------------------ +... +LL | None, + | ^^^^ not covered = note: the matched value is of type `Option<i32>` error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0374.stderr b/src/test/ui/error-codes/E0374.stderr index 7ab0f82fc23..68e15e6f8fe 100644 --- a/src/test/ui/error-codes/E0374.stderr +++ b/src/test/ui/error-codes/E0374.stderr @@ -1,9 +1,8 @@ error[E0374]: the trait `CoerceUnsized` may only be implemented for a coercion between structures with one field being coerced, none found --> $DIR/E0374.rs:8:1 | -LL | / impl<T, U> CoerceUnsized<Foo<U>> for Foo<T> -LL | | where T: CoerceUnsized<U> {} - | |________________________________^ +LL | impl<T, U> CoerceUnsized<Foo<U>> for Foo<T> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0376.stderr b/src/test/ui/error-codes/E0376.stderr index 015448c39ea..e91efb045c1 100644 --- a/src/test/ui/error-codes/E0376.stderr +++ b/src/test/ui/error-codes/E0376.stderr @@ -2,7 +2,7 @@ error[E0376]: the trait `CoerceUnsized` may only be implemented for a coercion b --> $DIR/E0376.rs:8:1 | LL | impl<T, U> CoerceUnsized<U> for Foo<T> {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0388.stderr b/src/test/ui/error-codes/E0388.stderr index 4886a156d2e..106efc19ac9 100644 --- a/src/test/ui/error-codes/E0388.stderr +++ b/src/test/ui/error-codes/E0388.stderr @@ -11,7 +11,7 @@ note: `const` item defined here --> $DIR/E0388.rs:2:1 | LL | const C: i32 = 2; - | ^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^ error[E0764]: mutable references are not allowed in the final value of constants --> $DIR/E0388.rs:4:30 @@ -52,7 +52,7 @@ note: `const` item defined here --> $DIR/E0388.rs:2:1 | LL | const C: i32 = 2; - | ^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^ error[E0764]: mutable references are not allowed in the final value of statics --> $DIR/E0388.rs:10:38 diff --git a/src/test/ui/error-codes/E0393.stderr b/src/test/ui/error-codes/E0393.stderr index 8aadf5c8b47..d9f70b72930 100644 --- a/src/test/ui/error-codes/E0393.stderr +++ b/src/test/ui/error-codes/E0393.stderr @@ -2,7 +2,7 @@ error[E0393]: the type parameter `T` must be explicitly specified --> $DIR/E0393.rs:3:47 | LL | trait A<T=Self> {} - | ------------------ type parameter `T` must be specified for this + | --------------- type parameter `T` must be specified for this LL | LL | fn together_we_will_rule_the_galaxy(son: &dyn A) {} | ^ help: set the type parameter to the desired type: `A<T>` diff --git a/src/test/ui/error-codes/E0445.stderr b/src/test/ui/error-codes/E0445.stderr index 1a66e0a2f97..23b7a335047 100644 --- a/src/test/ui/error-codes/E0445.stderr +++ b/src/test/ui/error-codes/E0445.stderr @@ -5,7 +5,7 @@ LL | trait Foo { | --------- `Foo` declared as private ... LL | pub trait Bar : Foo {} - | ^^^^^^^^^^^^^^^^^^^^^^ can't leak private trait + | ^^^^^^^^^^^^^^^^^^^ can't leak private trait error[E0445]: private trait `Foo` in public interface --> $DIR/E0445.rs:7:1 @@ -14,7 +14,7 @@ LL | trait Foo { | --------- `Foo` declared as private ... LL | pub struct Bar2<T: Foo>(pub T); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private trait + | ^^^^^^^^^^^^^^^^^^^^^^^ can't leak private trait error[E0445]: private trait `Foo` in public interface --> $DIR/E0445.rs:9:1 diff --git a/src/test/ui/error-codes/E0446.stderr b/src/test/ui/error-codes/E0446.stderr index 35e79e448d5..b6a195c40a9 100644 --- a/src/test/ui/error-codes/E0446.stderr +++ b/src/test/ui/error-codes/E0446.stderr @@ -2,7 +2,7 @@ error[E0446]: private type `Bar` in public interface --> $DIR/E0446.rs:4:5 | LL | struct Bar(u32); - | ---------------- `Bar` declared as private + | ---------- `Bar` declared as private LL | LL | pub fn bar() -> Bar { | ^^^^^^^^^^^^^^^^^^^ can't leak private type diff --git a/src/test/ui/error-codes/E0520.stderr b/src/test/ui/error-codes/E0520.stderr index be7b95465a5..65ebfcdbe32 100644 --- a/src/test/ui/error-codes/E0520.stderr +++ b/src/test/ui/error-codes/E0520.stderr @@ -11,13 +11,11 @@ LL | #![feature(specialization)] error[E0520]: `fly` specializes an item from a parent `impl`, but that item is not marked `default` --> $DIR/E0520.rs:17:5 | -LL | / impl<T: Clone> SpaceLlama for T { -LL | | fn fly(&self) {} -LL | | } - | |_- parent `impl` is here +LL | impl<T: Clone> SpaceLlama for T { + | ------------------------------- parent `impl` is here ... -LL | default fn fly(&self) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^ cannot specialize default item `fly` +LL | default fn fly(&self) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^ cannot specialize default item `fly` | = note: to specialize, `fly` in the parent `impl` must be marked `default` diff --git a/src/test/ui/error-festival.stderr b/src/test/ui/error-festival.stderr index 81aa268cacc..43122c13efb 100644 --- a/src/test/ui/error-festival.stderr +++ b/src/test/ui/error-festival.stderr @@ -44,14 +44,8 @@ LL | enum Question { note: the following trait must be implemented --> $SRC_DIR/core/src/ops/bit.rs:LL:COL | -LL | / pub trait Not { -LL | | /// The resulting type after applying the `!` operator. -LL | | #[stable(feature = "rust1", since = "1.0.0")] -LL | | type Output; -... | -LL | | fn not(self) -> Self::Output; -LL | | } - | |_^ +LL | pub trait Not { + | ^^^^^^^^^^^^^ error[E0604]: only `u8` can be cast as `char`, not `u32` --> $DIR/error-festival.rs:25:5 diff --git a/src/test/ui/extern/auxiliary/issue-80074-macro.rs b/src/test/ui/extern/auxiliary/issue-80074-macro.rs new file mode 100644 index 00000000000..30e0f19ab8d --- /dev/null +++ b/src/test/ui/extern/auxiliary/issue-80074-macro.rs @@ -0,0 +1,4 @@ +// edition:2018 + +macro_rules! foo_ { () => {}; } +use foo_ as foo; diff --git a/src/test/ui/extern/extern-main-issue-86110.stderr b/src/test/ui/extern/extern-main-issue-86110.stderr index cd3de227dcf..18dfddc46bd 100644 --- a/src/test/ui/extern/extern-main-issue-86110.stderr +++ b/src/test/ui/extern/extern-main-issue-86110.stderr @@ -2,7 +2,7 @@ error: the `main` function cannot be declared in an `extern` block --> $DIR/extern-main-issue-86110.rs:4:5 | LL | fn main(); - | ^^^^^^^^^^ + | ^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/extern/extern-types-distinct-types.stderr b/src/test/ui/extern/extern-types-distinct-types.stderr index f69629232ae..ca25aa64eb8 100644 --- a/src/test/ui/extern/extern-types-distinct-types.stderr +++ b/src/test/ui/extern/extern-types-distinct-types.stderr @@ -2,9 +2,9 @@ error[E0308]: mismatched types --> $DIR/extern-types-distinct-types.rs:9:5 | LL | type A; - | ------- the found foreign type + | ------ the found foreign type LL | type B; - | ------- the expected foreign type + | ------ the expected foreign type ... LL | fn foo(r: &A) -> &B { | -- expected `&B` because of return type diff --git a/src/test/ui/extern/issue-80074.rs b/src/test/ui/extern/issue-80074.rs new file mode 100644 index 00000000000..f83027d4abf --- /dev/null +++ b/src/test/ui/extern/issue-80074.rs @@ -0,0 +1,10 @@ +// edition:2018 +// build-pass +// aux-crate:issue_80074=issue-80074-macro.rs + +#[macro_use] +extern crate issue_80074; + +fn main() { + foo!(); +} diff --git a/src/test/ui/feature-gates/feature-gate-arbitrary-self-types.stderr b/src/test/ui/feature-gates/feature-gate-arbitrary-self-types.stderr index a06c4b2b483..a1c69a5afb6 100644 --- a/src/test/ui/feature-gates/feature-gate-arbitrary-self-types.stderr +++ b/src/test/ui/feature-gates/feature-gate-arbitrary-self-types.stderr @@ -1,13 +1,3 @@ -error[E0658]: `Ptr<Self>` cannot be used as the type of `self` without the `arbitrary_self_types` feature - --> $DIR/feature-gate-arbitrary-self-types.rs:16:18 - | -LL | fn foo(self: Ptr<Self>); - | ^^^^^^^^^ - | - = note: see issue #44874 <https://github.com/rust-lang/rust/issues/44874> for more information - = help: add `#![feature(arbitrary_self_types)]` to the crate attributes to enable - = help: consider changing to `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`) - error[E0658]: `Ptr<Bar>` cannot be used as the type of `self` without the `arbitrary_self_types` feature --> $DIR/feature-gate-arbitrary-self-types.rs:22:18 | @@ -28,6 +18,16 @@ LL | fn bar(self: Box<Ptr<Self>>) {} = help: add `#![feature(arbitrary_self_types)]` to the crate attributes to enable = help: consider changing to `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`) +error[E0658]: `Ptr<Self>` cannot be used as the type of `self` without the `arbitrary_self_types` feature + --> $DIR/feature-gate-arbitrary-self-types.rs:16:18 + | +LL | fn foo(self: Ptr<Self>); + | ^^^^^^^^^ + | + = note: see issue #44874 <https://github.com/rust-lang/rust/issues/44874> for more information + = help: add `#![feature(arbitrary_self_types)]` to the crate attributes to enable + = help: consider changing to `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`) + error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/feature-gates/feature-gate-arbitrary_self_types-raw-pointer.stderr b/src/test/ui/feature-gates/feature-gate-arbitrary_self_types-raw-pointer.stderr index f9c53a66c4b..a9f611b8745 100644 --- a/src/test/ui/feature-gates/feature-gate-arbitrary_self_types-raw-pointer.stderr +++ b/src/test/ui/feature-gates/feature-gate-arbitrary_self_types-raw-pointer.stderr @@ -8,20 +8,20 @@ LL | fn foo(self: *const Self) {} = help: add `#![feature(arbitrary_self_types)]` to the crate attributes to enable = help: consider changing to `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`) -error[E0658]: `*const Self` cannot be used as the type of `self` without the `arbitrary_self_types` feature - --> $DIR/feature-gate-arbitrary_self_types-raw-pointer.rs:9:18 +error[E0658]: `*const ()` cannot be used as the type of `self` without the `arbitrary_self_types` feature + --> $DIR/feature-gate-arbitrary_self_types-raw-pointer.rs:14:18 | -LL | fn bar(self: *const Self); +LL | fn bar(self: *const Self) {} | ^^^^^^^^^^^ | = note: see issue #44874 <https://github.com/rust-lang/rust/issues/44874> for more information = help: add `#![feature(arbitrary_self_types)]` to the crate attributes to enable = help: consider changing to `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`) -error[E0658]: `*const ()` cannot be used as the type of `self` without the `arbitrary_self_types` feature - --> $DIR/feature-gate-arbitrary_self_types-raw-pointer.rs:14:18 +error[E0658]: `*const Self` cannot be used as the type of `self` without the `arbitrary_self_types` feature + --> $DIR/feature-gate-arbitrary_self_types-raw-pointer.rs:9:18 | -LL | fn bar(self: *const Self) {} +LL | fn bar(self: *const Self); | ^^^^^^^^^^^ | = note: see issue #44874 <https://github.com/rust-lang/rust/issues/44874> for more information diff --git a/src/test/ui/feature-gates/feature-gate-exhaustive-patterns.stderr b/src/test/ui/feature-gates/feature-gate-exhaustive-patterns.stderr index 21180f31bbd..f8349391a0f 100644 --- a/src/test/ui/feature-gates/feature-gate-exhaustive-patterns.stderr +++ b/src/test/ui/feature-gates/feature-gate-exhaustive-patterns.stderr @@ -9,15 +9,11 @@ LL | let Ok(_x) = foo(); note: `Result<u32, !>` defined here --> $SRC_DIR/core/src/result.rs:LL:COL | -LL | / pub enum Result<T, E> { -LL | | /// Contains the success value -LL | | #[lang = "Ok"] -LL | | #[stable(feature = "rust1", since = "1.0.0")] -... | -LL | | Err(#[stable(feature = "rust1", since = "1.0.0")] E), - | | ^^^ not covered -LL | | } - | |_- +LL | pub enum Result<T, E> { + | --------------------- +... +LL | Err(#[stable(feature = "rust1", since = "1.0.0")] E), + | ^^^ not covered = note: the matched value is of type `Result<u32, !>` help: you might want to use `if let` to ignore the variant that isn't matched | diff --git a/src/test/ui/generic-associated-types/bugs/issue-80626.rs b/src/test/ui/generic-associated-types/bugs/issue-80626.rs index a637da6cf6f..14f27aff1cc 100644 --- a/src/test/ui/generic-associated-types/bugs/issue-80626.rs +++ b/src/test/ui/generic-associated-types/bugs/issue-80626.rs @@ -1,5 +1,5 @@ // check-fail -// known-bug +// known-bug: #80626 // This should pass, but it requires `Sized` to be coinductive. diff --git a/src/test/ui/generic-associated-types/bugs/issue-80626.stderr b/src/test/ui/generic-associated-types/bugs/issue-80626.stderr index 8b0cc78e999..487b83dfa3f 100644 --- a/src/test/ui/generic-associated-types/bugs/issue-80626.stderr +++ b/src/test/ui/generic-associated-types/bugs/issue-80626.stderr @@ -4,16 +4,11 @@ error[E0275]: overflow evaluating the requirement `LinkedList<A>: Sized` LL | Next(A::Allocated<Self>) | ^^^^^^^^^^^^^^^^^^ | - = note: no field of an enum variant may have a dynamically sized type - = help: change the field's type to have a statically known size -help: borrowed types always have a statically known size +note: required by a bound in `Allocator::Allocated` + --> $DIR/issue-80626.rs:9:20 | -LL | Next(&A::Allocated<Self>) - | + -help: the `Box` type always has a statically known size and allocates its contents in the heap - | -LL | Next(Box<A::Allocated<Self>>) - | ++++ + +LL | type Allocated<T>; + | ^ required by this bound in `Allocator::Allocated` error: aborting due to previous error diff --git a/src/test/ui/generic-associated-types/bugs/issue-86218.rs b/src/test/ui/generic-associated-types/bugs/issue-86218.rs index 68cd0fd7efc..fb62c10a9e3 100644 --- a/src/test/ui/generic-associated-types/bugs/issue-86218.rs +++ b/src/test/ui/generic-associated-types/bugs/issue-86218.rs @@ -1,5 +1,5 @@ // check-fail -// known-bug +// known-bug: #86218 // This should pass, but seems to run into a TAIT issue. diff --git a/src/test/ui/generic-associated-types/bugs/issue-87735.rs b/src/test/ui/generic-associated-types/bugs/issue-87735.rs index 53e3ad7fe69..0844d84c34f 100644 --- a/src/test/ui/generic-associated-types/bugs/issue-87735.rs +++ b/src/test/ui/generic-associated-types/bugs/issue-87735.rs @@ -1,5 +1,5 @@ // check-fail -// known-bug +// known-bug: #87735, #88526 // This should pass, but we need an extension of implied bounds (probably). diff --git a/src/test/ui/generic-associated-types/bugs/issue-87748.rs b/src/test/ui/generic-associated-types/bugs/issue-87748.rs index 6e7cd45bdb1..a3d00ee03b1 100644 --- a/src/test/ui/generic-associated-types/bugs/issue-87748.rs +++ b/src/test/ui/generic-associated-types/bugs/issue-87748.rs @@ -1,5 +1,5 @@ // check-fail -// known-bug +// known-bug: #87748 // This should pass, but unnormalized input args aren't treated as implied. diff --git a/src/test/ui/generic-associated-types/bugs/issue-87755.rs b/src/test/ui/generic-associated-types/bugs/issue-87755.rs index 31cea12a3e2..efa487d624f 100644 --- a/src/test/ui/generic-associated-types/bugs/issue-87755.rs +++ b/src/test/ui/generic-associated-types/bugs/issue-87755.rs @@ -1,5 +1,5 @@ // check-fail -// known-bug +// known-bug: #87755 // This should pass. diff --git a/src/test/ui/generic-associated-types/bugs/issue-87803.rs b/src/test/ui/generic-associated-types/bugs/issue-87803.rs index 57a4b028d93..a8a111c99ef 100644 --- a/src/test/ui/generic-associated-types/bugs/issue-87803.rs +++ b/src/test/ui/generic-associated-types/bugs/issue-87803.rs @@ -1,5 +1,5 @@ // check-fail -// known-bug +// known-bug: #87803 // This should pass, but using a type alias vs a reference directly // changes late-bound -> early-bound. diff --git a/src/test/ui/generic-associated-types/bugs/issue-88382.rs b/src/test/ui/generic-associated-types/bugs/issue-88382.rs index c9f34240527..5493b9b9391 100644 --- a/src/test/ui/generic-associated-types/bugs/issue-88382.rs +++ b/src/test/ui/generic-associated-types/bugs/issue-88382.rs @@ -1,5 +1,5 @@ // check-fail -// known-bug +// known-bug: #88382 // This should pass, but has a missed normalization due to HRTB. diff --git a/src/test/ui/generic-associated-types/bugs/issue-88460.rs b/src/test/ui/generic-associated-types/bugs/issue-88460.rs index b31d012d2fc..f1c3b226915 100644 --- a/src/test/ui/generic-associated-types/bugs/issue-88460.rs +++ b/src/test/ui/generic-associated-types/bugs/issue-88460.rs @@ -1,5 +1,5 @@ // check-fail -// known-bug +// known-bug: #88460 // This should pass, but has a missed normalization due to HRTB. diff --git a/src/test/ui/generic-associated-types/bugs/issue-88526.rs b/src/test/ui/generic-associated-types/bugs/issue-88526.rs index c72a450b926..15363ad04bf 100644 --- a/src/test/ui/generic-associated-types/bugs/issue-88526.rs +++ b/src/test/ui/generic-associated-types/bugs/issue-88526.rs @@ -1,5 +1,5 @@ // check-fail -// known-bug +// known-bug: #88526 // This should pass, but requires more logic. diff --git a/src/test/ui/generic-associated-types/bugs/issue-89008.rs b/src/test/ui/generic-associated-types/bugs/issue-89008.rs index 1581b7105a8..79c28b0d221 100644 --- a/src/test/ui/generic-associated-types/bugs/issue-89008.rs +++ b/src/test/ui/generic-associated-types/bugs/issue-89008.rs @@ -1,6 +1,6 @@ // check-fail // edition:2021 -// known-bug +// known-bug: #88908 // This should pass, but seems to run into a TAIT bug. diff --git a/src/test/ui/generic-associated-types/bugs/issue-89008.stderr b/src/test/ui/generic-associated-types/bugs/issue-89008.stderr index 5cbadfacc1b..50844fdc14d 100644 --- a/src/test/ui/generic-associated-types/bugs/issue-89008.stderr +++ b/src/test/ui/generic-associated-types/bugs/issue-89008.stderr @@ -1,10 +1,10 @@ error[E0271]: type mismatch resolving `<Empty<_> as Stream>::Item == Repr` - --> $DIR/issue-89008.rs:40:9 + --> $DIR/issue-89008.rs:39:43 | LL | fn line_stream<'a, Repr>(&'a self) -> Self::LineStreamFut<'a, Repr> { - | ---- this type parameter -LL | async {empty()} - | ^^^^^^^^^^^^^^^ type mismatch resolving `<Empty<_> as Stream>::Item == Repr` + | ---- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type mismatch resolving `<Empty<_> as Stream>::Item == Repr` + | | + | this type parameter | note: expected this to be `()` --> $DIR/issue-89008.rs:18:17 diff --git a/src/test/ui/generic-associated-types/generic-associated-types-where.stderr b/src/test/ui/generic-associated-types/generic-associated-types-where.stderr index 68594bba486..c7ebb9880f7 100644 --- a/src/test/ui/generic-associated-types/generic-associated-types-where.stderr +++ b/src/test/ui/generic-associated-types/generic-associated-types-where.stderr @@ -14,10 +14,10 @@ error[E0276]: impl has stricter requirements than trait --> $DIR/generic-associated-types-where.rs:22:5 | LL | type Assoc3<T>; - | --------------- definition of `Assoc3` from trait + | -------------- definition of `Assoc3` from trait ... LL | type Assoc3<T> = Vec<T> where T: Iterator; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `T: Iterator` + | ^^^^^^^^^^^^^^ impl has extra requirement `T: Iterator` error: aborting due to 2 previous errors diff --git a/src/test/ui/generic-associated-types/impl_bounds.stderr b/src/test/ui/generic-associated-types/impl_bounds.stderr index 3d90471e398..6aa52b179a3 100644 --- a/src/test/ui/generic-associated-types/impl_bounds.stderr +++ b/src/test/ui/generic-associated-types/impl_bounds.stderr @@ -2,25 +2,25 @@ error: `impl` associated type signature for `A` doesn't match `trait` associated --> $DIR/impl_bounds.rs:15:5 | LL | type A<'a> where Self: 'a; - | -------------------------- expected + | ---------- expected ... LL | type A<'a> = (&'a ()) where Self: 'static; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ found + | ^^^^^^^^^^ found error: `impl` associated type signature for `B` doesn't match `trait` associated type signature --> $DIR/impl_bounds.rs:17:5 | LL | type B<'a, 'b> where 'a: 'b; - | ---------------------------- expected + | -------------- expected ... LL | type B<'a, 'b> = (&'a(), &'b ()) where 'b: 'a; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ found + | ^^^^^^^^^^^^^^ found error[E0478]: lifetime bound not satisfied --> $DIR/impl_bounds.rs:17:22 | LL | type B<'a, 'b> where 'a: 'b; - | ---------------------------- definition of `B` from trait + | -------------- definition of `B` from trait ... LL | type B<'a, 'b> = (&'a(), &'b ()) where 'b: 'a; | ^^^^^^^^^^^^^^^ - help: try copying this clause from the trait: `, 'a: 'b` @@ -40,7 +40,7 @@ error[E0277]: the trait bound `T: Copy` is not satisfied --> $DIR/impl_bounds.rs:20:5 | LL | type C = String where Self: Copy; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `T` + | ^^^^^^ the trait `Copy` is not implemented for `T` | note: required because of the requirements on the impl of `Copy` for `Fooy<T>` --> $DIR/impl_bounds.rs:11:10 @@ -54,7 +54,7 @@ LL | trait Foo { | --- in this trait ... LL | type C where Self: Clone; - | ^^^^^^^^^^^^^^^^^^^^^^^^^ this trait associated type doesn't have the requirement `Fooy<T>: Copy` + | ^^^^^^ this trait associated type doesn't have the requirement `Fooy<T>: Copy` = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider restricting type parameter `T` | diff --git a/src/test/ui/generic-associated-types/issue-47206-where-clause.stderr b/src/test/ui/generic-associated-types/issue-47206-where-clause.stderr index 39beac38c0b..c560e2405d5 100644 --- a/src/test/ui/generic-associated-types/issue-47206-where-clause.stderr +++ b/src/test/ui/generic-associated-types/issue-47206-where-clause.stderr @@ -2,10 +2,10 @@ error[E0276]: impl has stricter requirements than trait --> $DIR/issue-47206-where-clause.rs:12:5 | LL | type Assoc3<T>; - | --------------- definition of `Assoc3` from trait + | -------------- definition of `Assoc3` from trait ... LL | type Assoc3<T> = Vec<T> where T: Iterator; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `T: Iterator` + | ^^^^^^^^^^^^^^ impl has extra requirement `T: Iterator` error: aborting due to previous error diff --git a/src/test/ui/generic-associated-types/issue-78113-lifetime-mismatch-dyn-trait-box.stderr b/src/test/ui/generic-associated-types/issue-78113-lifetime-mismatch-dyn-trait-box.stderr index c4a7d8faa41..d487f19ba74 100644 --- a/src/test/ui/generic-associated-types/issue-78113-lifetime-mismatch-dyn-trait-box.stderr +++ b/src/test/ui/generic-associated-types/issue-78113-lifetime-mismatch-dyn-trait-box.stderr @@ -45,7 +45,7 @@ note: ...does not necessarily outlive the static lifetime introduced by the comp --> $DIR/issue-78113-lifetime-mismatch-dyn-trait-box.rs:21:1 | LL | impl C for Box<dyn A + 'static> {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: incompatible lifetime on type --> $DIR/issue-78113-lifetime-mismatch-dyn-trait-box.rs:37:18 diff --git a/src/test/ui/generic-associated-types/issue-79422.extended.stderr b/src/test/ui/generic-associated-types/issue-79422.extended.stderr index 9478fc89792..9bcbd747168 100644 --- a/src/test/ui/generic-associated-types/issue-79422.extended.stderr +++ b/src/test/ui/generic-associated-types/issue-79422.extended.stderr @@ -27,7 +27,7 @@ LL | type VRefCont<'a> = &'a V where Self: 'a; | ^^^^^ = note: expected trait object `(dyn RefCont<'_, u8> + 'static)` found reference `&u8` - = note: required for the cast to the object type `dyn MapLike<u8, u8, VRefCont = (dyn RefCont<'_, u8> + 'static)>` + = note: required for the cast from `BTreeMap<u8, u8>` to the object type `dyn MapLike<u8, u8, VRefCont = (dyn RefCont<'_, u8> + 'static)>` error: aborting due to 2 previous errors diff --git a/src/test/ui/generic-associated-types/issue-90014.stderr b/src/test/ui/generic-associated-types/issue-90014.stderr index 51fe3360c7e..457c582e8c8 100644 --- a/src/test/ui/generic-associated-types/issue-90014.stderr +++ b/src/test/ui/generic-associated-types/issue-90014.stderr @@ -2,7 +2,7 @@ error[E0477]: the type `&mut ()` does not fulfill the required lifetime --> $DIR/issue-90014.rs:14:20 | LL | type Fut<'a> where Self: 'a; - | ---------------------------- definition of `Fut` from trait + | ------------ definition of `Fut` from trait ... LL | type Fut<'a> = impl Future<Output = ()>; | ^^^^^^^^^^^^^^^^^^^^^^^^- help: try copying this clause from the trait: `where Self: 'a` diff --git a/src/test/ui/generic-associated-types/issue-91883.stderr b/src/test/ui/generic-associated-types/issue-91883.stderr index ed700876e02..baf4889cc1d 100644 --- a/src/test/ui/generic-associated-types/issue-91883.stderr +++ b/src/test/ui/generic-associated-types/issue-91883.stderr @@ -1,14 +1,11 @@ error[E0478]: lifetime bound not satisfied --> $DIR/issue-91883.rs:32:24 | -LL | / type Cursor<'tx>: Cursor<'tx> -LL | | where -LL | | 'db: 'tx, -LL | | Self: 'tx; - | |__________________- definition of `Cursor` from trait +LL | type Cursor<'tx>: Cursor<'tx> + | ----------------------------- definition of `Cursor` from trait ... -LL | type Cursor<'tx> = CursorImpl<'tx>; - | ^^^^^^^^^^^^^^^- help: try copying these clauses from the trait: `where 'db: 'tx, Self: 'tx` +LL | type Cursor<'tx> = CursorImpl<'tx>; + | ^^^^^^^^^^^^^^^- help: try copying these clauses from the trait: `where 'db: 'tx, Self: 'tx` | note: lifetime parameter instantiated with the lifetime `'db` as defined here --> $DIR/issue-91883.rs:31:6 diff --git a/src/test/ui/generic-associated-types/issue-92033.stderr b/src/test/ui/generic-associated-types/issue-92033.stderr index 5b90199b809..6dd901027d7 100644 --- a/src/test/ui/generic-associated-types/issue-92033.stderr +++ b/src/test/ui/generic-associated-types/issue-92033.stderr @@ -1,13 +1,11 @@ error[E0477]: the type `&'s Texture` does not fulfill the required lifetime --> $DIR/issue-92033.rs:22:28 | -LL | / type TextureIter<'a>: Iterator<Item = &'a Texture> -LL | | where -LL | | Self: 'a; - | |_________________- definition of `TextureIter` from trait +LL | type TextureIter<'a>: Iterator<Item = &'a Texture> + | -------------------------------------------------- definition of `TextureIter` from trait ... -LL | type TextureIter<'a> = std::option::IntoIter<&'a Texture>; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- help: try copying this clause from the trait: `where Self: 'a` +LL | type TextureIter<'a> = std::option::IntoIter<&'a Texture>; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- help: try copying this clause from the trait: `where Self: 'a` | note: type must outlive the lifetime `'a` as defined here --> $DIR/issue-92033.rs:22:22 diff --git a/src/test/ui/generic-associated-types/method-unsatified-assoc-type-predicate.stderr b/src/test/ui/generic-associated-types/method-unsatified-assoc-type-predicate.stderr index 1322914797b..2804364890f 100644 --- a/src/test/ui/generic-associated-types/method-unsatified-assoc-type-predicate.stderr +++ b/src/test/ui/generic-associated-types/method-unsatified-assoc-type-predicate.stderr @@ -2,7 +2,7 @@ error[E0599]: the method `f` exists for struct `S`, but its trait bounds were no --> $DIR/method-unsatified-assoc-type-predicate.rs:30:7 | LL | struct S; - | --------- + | -------- | | | | | method `f` not found for this struct | doesn't satisfy `<S as X>::Y<i32> = i32` diff --git a/src/test/ui/generic-associated-types/missing-where-clause-on-trait.stderr b/src/test/ui/generic-associated-types/missing-where-clause-on-trait.stderr index 9e0896127a8..0256d2f20fc 100644 --- a/src/test/ui/generic-associated-types/missing-where-clause-on-trait.stderr +++ b/src/test/ui/generic-associated-types/missing-where-clause-on-trait.stderr @@ -2,10 +2,10 @@ error: `impl` associated type signature for `Assoc` doesn't match `trait` associ --> $DIR/missing-where-clause-on-trait.rs:9:5 | LL | type Assoc<'a, 'b>; - | ------------------- expected + | ------------------ expected ... LL | type Assoc<'a, 'b> = () where 'a: 'b; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ found + | ^^^^^^^^^^^^^^^^^^ found error: aborting due to previous error diff --git a/src/test/ui/generics/issue-94432-garbage-ice.rs b/src/test/ui/generics/issue-94432-garbage-ice.rs new file mode 100644 index 00000000000..d0709e2d2a4 --- /dev/null +++ b/src/test/ui/generics/issue-94432-garbage-ice.rs @@ -0,0 +1,10 @@ +// check-fail +// dont-check-compiler-stdout +// dont-check-compiler-stderr + +fn�a<e>(){fn�p(){e}} //~ ERROR unknown start of token: \u{fffd} +//~^ ERROR unknown start of token: \u{fffd} +//~^^ ERROR can't use generic parameters from outer function [E0401] +//~^^^ WARN type parameter `e` should have an upper camel case name + +fn main(){} diff --git a/src/test/ui/generics/issue-98432.rs b/src/test/ui/generics/issue-98432.rs new file mode 100644 index 00000000000..780c50d6ffa --- /dev/null +++ b/src/test/ui/generics/issue-98432.rs @@ -0,0 +1,9 @@ +struct Struct<T>(T); + +impl<T> Struct<T> { + const CONST: fn() = || { + struct _Obligation where T:; //~ ERROR can't use generic parameters from outer function + }; +} + +fn main() {} diff --git a/src/test/ui/generics/issue-98432.stderr b/src/test/ui/generics/issue-98432.stderr new file mode 100644 index 00000000000..afa67b63bd9 --- /dev/null +++ b/src/test/ui/generics/issue-98432.stderr @@ -0,0 +1,14 @@ +error[E0401]: can't use generic parameters from outer function + --> $DIR/issue-98432.rs:5:34 + | +LL | impl<T> Struct<T> { + | - type parameter from outer function +LL | const CONST: fn() = || { +LL | struct _Obligation where T:; + | ^ use of generic parameter from outer function + | + = help: try using a local generic parameter instead + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0401`. diff --git a/src/test/ui/higher-rank-trait-bounds/issue-59311.stderr b/src/test/ui/higher-rank-trait-bounds/issue-59311.stderr index 15e83ab5a34..43e609cc59e 100644 --- a/src/test/ui/higher-rank-trait-bounds/issue-59311.stderr +++ b/src/test/ui/higher-rank-trait-bounds/issue-59311.stderr @@ -4,7 +4,7 @@ error: higher-ranked lifetime error LL | v.t(|| {}); | ^^^^^^^^^^ | - = note: could not prove [closure@$DIR/issue-59311.rs:17:9: 17:14] well-formed + = note: could not prove `[closure@$DIR/issue-59311.rs:17:9: 17:14] well-formed` error: higher-ranked lifetime error --> $DIR/issue-59311.rs:17:9 @@ -12,7 +12,7 @@ error: higher-ranked lifetime error LL | v.t(|| {}); | ^^^^^ | - = note: could not prove for<'a> &'a V: 'static + = note: could not prove `for<'a> &'a V: 'static` error: aborting due to 2 previous errors diff --git a/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-89118.stderr b/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-89118.stderr index 7f45fb83cef..a6858154dfb 100644 --- a/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-89118.stderr +++ b/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-89118.stderr @@ -19,44 +19,44 @@ LL | Ctx<()>: for<'a> BufferUdpStateContext<&'a ()>, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `StackContext` error[E0277]: the trait bound `for<'a> &'a (): BufferMut` is not satisfied - --> $DIR/issue-89118.rs:22:20 + --> $DIR/issue-89118.rs:29:9 | -LL | type Handler = Ctx<C::Dispatcher>; - | ^^^^^^^^^^^^^^^^^^ the trait `for<'a> BufferMut` is not implemented for `&'a ()` +LL | impl<C> EthernetWorker<C> {} + | ^^^^^^^^^^^^^^^^^ the trait `for<'a> BufferMut` is not implemented for `&'a ()` | note: required because of the requirements on the impl of `for<'a> BufferUdpStateContext<&'a ()>` for `Ctx<()>` --> $DIR/issue-89118.rs:5:23 | LL | impl<B: BufferMut, C> BufferUdpStateContext<B> for C {} | ^^^^^^^^^^^^^^^^^^^^^^^^ ^ -note: required by a bound in `StackContext` - --> $DIR/issue-89118.rs:9:14 +note: required by a bound in `EthernetWorker` + --> $DIR/issue-89118.rs:28:14 | -LL | trait StackContext - | ------------ required by a bound in this +LL | struct EthernetWorker<C>(C) + | -------------- required by a bound in this LL | where -LL | Ctx<()>: for<'a> BufferUdpStateContext<&'a ()>, - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `StackContext` +LL | Ctx<()>: for<'a> BufferUdpStateContext<&'a ()>; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `EthernetWorker` error[E0277]: the trait bound `for<'a> &'a (): BufferMut` is not satisfied - --> $DIR/issue-89118.rs:29:9 + --> $DIR/issue-89118.rs:22:20 | -LL | impl<C> EthernetWorker<C> {} - | ^^^^^^^^^^^^^^^^^ the trait `for<'a> BufferMut` is not implemented for `&'a ()` +LL | type Handler = Ctx<C::Dispatcher>; + | ^^^^^^^^^^^^^^^^^^ the trait `for<'a> BufferMut` is not implemented for `&'a ()` | note: required because of the requirements on the impl of `for<'a> BufferUdpStateContext<&'a ()>` for `Ctx<()>` --> $DIR/issue-89118.rs:5:23 | LL | impl<B: BufferMut, C> BufferUdpStateContext<B> for C {} | ^^^^^^^^^^^^^^^^^^^^^^^^ ^ -note: required by a bound in `EthernetWorker` - --> $DIR/issue-89118.rs:28:14 +note: required by a bound in `StackContext` + --> $DIR/issue-89118.rs:9:14 | -LL | struct EthernetWorker<C>(C) - | -------------- required by a bound in this +LL | trait StackContext + | ------------ required by a bound in this LL | where -LL | Ctx<()>: for<'a> BufferUdpStateContext<&'a ()>; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `EthernetWorker` +LL | Ctx<()>: for<'a> BufferUdpStateContext<&'a ()>, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `StackContext` error: aborting due to 3 previous errors diff --git a/src/test/ui/hrtb/issue-95034.rs b/src/test/ui/hrtb/issue-95034.rs index aee6fe61ba8..d8edbe7e56b 100644 --- a/src/test/ui/hrtb/issue-95034.rs +++ b/src/test/ui/hrtb/issue-95034.rs @@ -1,4 +1,4 @@ -// known-bug +// known-bug: #95034 // failure-status: 101 // compile-flags: --edition=2021 --crate-type=lib // rustc-env:RUST_BACKTRACE=0 diff --git a/src/test/ui/impl-duplicate-methods.stderr b/src/test/ui/impl-duplicate-methods.stderr index b6dc4882fc8..c19702a5bf0 100644 --- a/src/test/ui/impl-duplicate-methods.stderr +++ b/src/test/ui/impl-duplicate-methods.stderr @@ -2,9 +2,9 @@ error[E0201]: duplicate definitions with name `orange`: --> $DIR/impl-duplicate-methods.rs:5:5 | LL | fn orange(&self) {} - | ------------------- previous definition of `orange` here + | ---------------- previous definition of `orange` here LL | fn orange(&self) {} - | ^^^^^^^^^^^^^^^^^^^ duplicate definition + | ^^^^^^^^^^^^^^^^ duplicate definition error: aborting due to previous error diff --git a/src/test/ui/impl-trait/auto-trait.stderr b/src/test/ui/impl-trait/auto-trait.stderr index 3b360f492b7..5e10272b0db 100644 --- a/src/test/ui/impl-trait/auto-trait.stderr +++ b/src/test/ui/impl-trait/auto-trait.stderr @@ -1,3 +1,12 @@ +error[E0119]: conflicting implementations of trait `AnotherTrait` for type `D<OpaqueType>` + --> $DIR/auto-trait.rs:21:1 + | +LL | impl<T: Send> AnotherTrait for T {} + | -------------------------------- first implementation here +... +LL | impl AnotherTrait for D<OpaqueType> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `D<OpaqueType>` + error: cannot implement trait on type alias impl trait --> $DIR/auto-trait.rs:21:25 | @@ -10,15 +19,6 @@ note: type alias impl trait defined here LL | type OpaqueType = impl OpaqueTrait; | ^^^^^^^^^^^^^^^^ -error[E0119]: conflicting implementations of trait `AnotherTrait` for type `D<OpaqueType>` - --> $DIR/auto-trait.rs:21:1 - | -LL | impl<T: Send> AnotherTrait for T {} - | -------------------------------- first implementation here -... -LL | impl AnotherTrait for D<OpaqueType> { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `D<OpaqueType>` - error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/impl-trait/hidden-type-is-opaque-2.stderr b/src/test/ui/impl-trait/hidden-type-is-opaque-2.stderr index 11ba5aa7867..957052feba9 100644 --- a/src/test/ui/impl-trait/hidden-type-is-opaque-2.stderr +++ b/src/test/ui/impl-trait/hidden-type-is-opaque-2.stderr @@ -3,16 +3,12 @@ error[E0282]: type annotations needed | LL | cont.reify_as(); | ^^^^ cannot infer type - | - = note: type must be known at this point error[E0282]: type annotations needed --> $DIR/hidden-type-is-opaque-2.rs:18:9 | LL | cont.reify_as(); | ^^^^ cannot infer type - | - = note: type must be known at this point error: aborting due to 2 previous errors diff --git a/src/test/ui/impl-trait/issue-55872-1.rs b/src/test/ui/impl-trait/issue-55872-1.rs index a75b9b43b3e..22ff7ffa23c 100644 --- a/src/test/ui/impl-trait/issue-55872-1.rs +++ b/src/test/ui/impl-trait/issue-55872-1.rs @@ -11,9 +11,9 @@ impl<S: Default> Bar for S { fn foo<T: Default>() -> Self::E { //~^ ERROR impl has stricter requirements than trait - (S::default(), T::default()) - //~^ ERROR the trait bound `S: Copy` is not satisfied in `(S, T)` [E0277] + //~| ERROR the trait bound `S: Copy` is not satisfied in `(S, T)` [E0277] //~| ERROR the trait bound `T: Copy` is not satisfied in `(S, T)` [E0277] + (S::default(), T::default()) } } diff --git a/src/test/ui/impl-trait/issue-55872-1.stderr b/src/test/ui/impl-trait/issue-55872-1.stderr index efc57da7461..8912cce1b4b 100644 --- a/src/test/ui/impl-trait/issue-55872-1.stderr +++ b/src/test/ui/impl-trait/issue-55872-1.stderr @@ -8,10 +8,10 @@ LL | fn foo<T: Default>() -> Self::E { | ^^^^^^^ impl has extra requirement `T: Default` error[E0277]: the trait bound `S: Copy` is not satisfied in `(S, T)` - --> $DIR/issue-55872-1.rs:14:9 + --> $DIR/issue-55872-1.rs:12:29 | -LL | (S::default(), T::default()) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ within `(S, T)`, the trait `Copy` is not implemented for `S` +LL | fn foo<T: Default>() -> Self::E { + | ^^^^^^^ within `(S, T)`, the trait `Copy` is not implemented for `S` | = note: required because it appears within the type `(S, T)` help: consider further restricting this bound @@ -20,10 +20,10 @@ LL | impl<S: Default + std::marker::Copy> Bar for S { | +++++++++++++++++++ error[E0277]: the trait bound `T: Copy` is not satisfied in `(S, T)` - --> $DIR/issue-55872-1.rs:14:9 + --> $DIR/issue-55872-1.rs:12:29 | -LL | (S::default(), T::default()) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ within `(S, T)`, the trait `Copy` is not implemented for `T` +LL | fn foo<T: Default>() -> Self::E { + | ^^^^^^^ within `(S, T)`, the trait `Copy` is not implemented for `T` | = note: required because it appears within the type `(S, T)` help: consider further restricting this bound diff --git a/src/test/ui/impl-trait/issue-55872-3.rs b/src/test/ui/impl-trait/issue-55872-3.rs index 36d9fdede10..3ffce85e61b 100644 --- a/src/test/ui/impl-trait/issue-55872-3.rs +++ b/src/test/ui/impl-trait/issue-55872-3.rs @@ -12,8 +12,8 @@ pub trait Bar { impl<S> Bar for S { type E = impl std::marker::Copy; fn foo<T>() -> Self::E { + //~^ ERROR the trait bound `impl Future<Output = ()>: Copy` is not satisfied [E0277] async {} - //~^ ERROR the trait bound `impl Future<Output = ()>: Copy` is not satisfied [E0277] } } diff --git a/src/test/ui/impl-trait/issue-55872-3.stderr b/src/test/ui/impl-trait/issue-55872-3.stderr index e7023e8127c..6ab540e8751 100644 --- a/src/test/ui/impl-trait/issue-55872-3.stderr +++ b/src/test/ui/impl-trait/issue-55872-3.stderr @@ -1,8 +1,8 @@ error[E0277]: the trait bound `impl Future<Output = ()>: Copy` is not satisfied - --> $DIR/issue-55872-3.rs:15:9 + --> $DIR/issue-55872-3.rs:14:20 | -LL | async {} - | ^^^^^^^^ the trait `Copy` is not implemented for `impl Future<Output = ()>` +LL | fn foo<T>() -> Self::E { + | ^^^^^^^ the trait `Copy` is not implemented for `impl Future<Output = ()>` error: aborting due to previous error diff --git a/src/test/ui/impl-trait/issues/issue-62742.stderr b/src/test/ui/impl-trait/issues/issue-62742.stderr index 44d775b695e..2d14faf7677 100644 --- a/src/test/ui/impl-trait/issues/issue-62742.stderr +++ b/src/test/ui/impl-trait/issues/issue-62742.stderr @@ -18,7 +18,7 @@ LL | WrongImpl::<()>::foo(0i32); | ^^^ function or associated item cannot be called on `SafeImpl<(), RawImpl<()>>` due to unsatisfied trait bounds ... LL | pub struct RawImpl<T>(PhantomData<T>); - | -------------------------------------- doesn't satisfy `RawImpl<()>: Raw<()>` + | --------------------- doesn't satisfy `RawImpl<()>: Raw<()>` ... LL | pub struct SafeImpl<T: ?Sized, A: Raw<T>>(PhantomData<(A, T)>); | -------- function or associated item `foo` not found for this struct @@ -28,10 +28,8 @@ LL | pub struct SafeImpl<T: ?Sized, A: Raw<T>>(PhantomData<(A, T)>); note: the following trait must be implemented --> $DIR/issue-62742.rs:12:1 | -LL | / pub trait Raw<T: ?Sized> { -LL | | type Value; -LL | | } - | |_^ +LL | pub trait Raw<T: ?Sized> { + | ^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `RawImpl<()>: Raw<()>` is not satisfied --> $DIR/issue-62742.rs:6:5 diff --git a/src/test/ui/impl-trait/issues/issue-70877.rs b/src/test/ui/impl-trait/issues/issue-70877.rs index 1a86fa00ed1..8169cfafac7 100644 --- a/src/test/ui/impl-trait/issues/issue-70877.rs +++ b/src/test/ui/impl-trait/issues/issue-70877.rs @@ -13,7 +13,7 @@ impl Iterator for Bar { type Item = FooItem; fn next(&mut self) -> Option<Self::Item> { - Some(Box::new(quux)) //~ ERROR mismatched types + Some(Box::new(quux)) } } diff --git a/src/test/ui/impl-trait/issues/issue-70877.stderr b/src/test/ui/impl-trait/issues/issue-70877.stderr index 7cbd58bdabf..8813bff3c35 100644 --- a/src/test/ui/impl-trait/issues/issue-70877.stderr +++ b/src/test/ui/impl-trait/issues/issue-70877.stderr @@ -1,17 +1,3 @@ -error[E0308]: mismatched types - --> $DIR/issue-70877.rs:16:9 - | -LL | type FooRet = impl std::fmt::Debug; - | -------------------- the expected opaque type -... -LL | fn next(&mut self) -> Option<Self::Item> { - | ------------------ expected `Option<Box<(dyn for<'r> Fn(&'r (dyn ToString + 'r)) -> FooRet + 'static)>>` because of return type -LL | Some(Box::new(quux)) - | ^^^^^^^^^^^^^^^^^^^^ expected trait object `dyn Fn`, found fn item - | - = note: expected enum `Option<Box<(dyn for<'r> Fn(&'r (dyn ToString + 'r)) -> FooRet + 'static)>>` - found enum `Option<Box<for<'r> fn(&'r (dyn ToString + 'r)) -> FooRet {quux}>>` - error: opaque type's hidden type cannot be another opaque type from the same scope --> $DIR/issue-70877.rs:31:12 | @@ -29,6 +15,5 @@ note: opaque type being used as hidden type LL | type FooRet = impl std::fmt::Debug; | ^^^^^^^^^^^^^^^^^^^^ -error: aborting due to 2 previous errors +error: aborting due to previous error -For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/impl-trait/issues/issue-78722.rs b/src/test/ui/impl-trait/issues/issue-78722.rs index 5498793bc28..002e4cde40a 100644 --- a/src/test/ui/impl-trait/issues/issue-78722.rs +++ b/src/test/ui/impl-trait/issues/issue-78722.rs @@ -7,7 +7,8 @@ type F = impl core::future::Future<Output = u8>; struct Bug { V1: [(); { fn concrete_use() -> F { - async {} //~ ERROR type mismatch + //~^ ERROR type mismatch + async {} } let f: F = async { 1 }; //~^ ERROR `async` blocks are not allowed in constants diff --git a/src/test/ui/impl-trait/issues/issue-78722.stderr b/src/test/ui/impl-trait/issues/issue-78722.stderr index 7a057c7f51b..690d6abc766 100644 --- a/src/test/ui/impl-trait/issues/issue-78722.stderr +++ b/src/test/ui/impl-trait/issues/issue-78722.stderr @@ -1,5 +1,5 @@ error[E0658]: `async` blocks are not allowed in constants - --> $DIR/issue-78722.rs:12:20 + --> $DIR/issue-78722.rs:13:20 | LL | let f: F = async { 1 }; | ^^^^^^^^^^^ @@ -8,7 +8,7 @@ LL | let f: F = async { 1 }; = help: add `#![feature(const_async_blocks)]` to the crate attributes to enable error[E0493]: destructors cannot be evaluated at compile-time - --> $DIR/issue-78722.rs:12:13 + --> $DIR/issue-78722.rs:13:13 | LL | let f: F = async { 1 }; | ^ constants cannot evaluate destructors @@ -17,10 +17,10 @@ LL | }], | - value is dropped here error[E0271]: type mismatch resolving `<impl Future<Output = ()> as Future>::Output == u8` - --> $DIR/issue-78722.rs:10:13 + --> $DIR/issue-78722.rs:9:30 | -LL | async {} - | ^^^^^^^^ expected `()`, found `u8` +LL | fn concrete_use() -> F { + | ^ expected `()`, found `u8` error: aborting due to 3 previous errors diff --git a/src/test/ui/impl-trait/issues/issue-83919.rs b/src/test/ui/impl-trait/issues/issue-83919.rs index 58aca77fdf1..e76443a65db 100644 --- a/src/test/ui/impl-trait/issues/issue-83919.rs +++ b/src/test/ui/impl-trait/issues/issue-83919.rs @@ -19,8 +19,9 @@ impl Foo for Implementor { type Fut = impl Future<Output=Self::Fut2>; fn get_fut(&self) -> Self::Fut { + //~^ ERROR `{integer}` is not a future async move { - 42 //~^ ERROR `{integer}` is not a future + 42 // 42 does not impl Future and rustc does actually point out the error, // but rustc used to panic. // Putting a valid Future here always worked fine. diff --git a/src/test/ui/impl-trait/issues/issue-83919.stderr b/src/test/ui/impl-trait/issues/issue-83919.stderr index ebd0130be8d..d39dcf7fbf5 100644 --- a/src/test/ui/impl-trait/issues/issue-83919.stderr +++ b/src/test/ui/impl-trait/issues/issue-83919.stderr @@ -1,13 +1,8 @@ error[E0277]: `{integer}` is not a future - --> $DIR/issue-83919.rs:22:9 + --> $DIR/issue-83919.rs:21:26 | -LL | / async move { -LL | | 42 -LL | | // 42 does not impl Future and rustc does actually point out the error, -LL | | // but rustc used to panic. -LL | | // Putting a valid Future here always worked fine. -LL | | } - | |_________^ `{integer}` is not a future +LL | fn get_fut(&self) -> Self::Fut { + | ^^^^^^^^^ `{integer}` is not a future | = help: the trait `Future` is not implemented for `{integer}` = note: {integer} must be a future or must implement `IntoFuture` to be awaited diff --git a/src/test/ui/impl-trait/negative-reasoning.stderr b/src/test/ui/impl-trait/negative-reasoning.stderr index 98f9fbd8fef..479b451855d 100644 --- a/src/test/ui/impl-trait/negative-reasoning.stderr +++ b/src/test/ui/impl-trait/negative-reasoning.stderr @@ -1,3 +1,14 @@ +error[E0119]: conflicting implementations of trait `AnotherTrait` for type `D<OpaqueType>` + --> $DIR/negative-reasoning.rs:19:1 + | +LL | impl<T: std::fmt::Debug> AnotherTrait for T {} + | ------------------------------------------- first implementation here +... +LL | impl AnotherTrait for D<OpaqueType> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `D<OpaqueType>` + | + = note: upstream crates may add a new impl of trait `std::fmt::Debug` for type `OpaqueType` in future versions + error: cannot implement trait on type alias impl trait --> $DIR/negative-reasoning.rs:19:25 | @@ -10,17 +21,6 @@ note: type alias impl trait defined here LL | type OpaqueType = impl OpaqueTrait; | ^^^^^^^^^^^^^^^^ -error[E0119]: conflicting implementations of trait `AnotherTrait` for type `D<OpaqueType>` - --> $DIR/negative-reasoning.rs:19:1 - | -LL | impl<T: std::fmt::Debug> AnotherTrait for T {} - | ------------------------------------------- first implementation here -... -LL | impl AnotherTrait for D<OpaqueType> { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `D<OpaqueType>` - | - = note: upstream crates may add a new impl of trait `std::fmt::Debug` for type `OpaqueType` in future versions - error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/impl-trait/nested-return-type2-tait2.rs b/src/test/ui/impl-trait/nested-return-type2-tait2.rs index af8e0663054..fcc077ec18e 100644 --- a/src/test/ui/impl-trait/nested-return-type2-tait2.rs +++ b/src/test/ui/impl-trait/nested-return-type2-tait2.rs @@ -24,8 +24,8 @@ type Traitable = impl Trait<Assoc = Sendable>; // var to make it uphold the `: Duh` bound on `Trait::Assoc`. The opaque // type does not implement `Duh`, even if its hidden type does. So we error out. fn foo() -> Traitable { - || 42 //~^ ERROR `Sendable: Duh` is not satisfied + || 42 } fn main() { diff --git a/src/test/ui/impl-trait/nested-return-type2-tait2.stderr b/src/test/ui/impl-trait/nested-return-type2-tait2.stderr index 42e65e69248..3e19ad7b5c6 100644 --- a/src/test/ui/impl-trait/nested-return-type2-tait2.stderr +++ b/src/test/ui/impl-trait/nested-return-type2-tait2.stderr @@ -1,11 +1,11 @@ error[E0277]: the trait bound `Sendable: Duh` is not satisfied - --> $DIR/nested-return-type2-tait2.rs:27:5 + --> $DIR/nested-return-type2-tait2.rs:26:13 | -LL | || 42 - | ^^^^^ the trait `Duh` is not implemented for `Sendable` +LL | fn foo() -> Traitable { + | ^^^^^^^^^ the trait `Duh` is not implemented for `Sendable` | = help: the trait `Duh` is implemented for `i32` -note: required because of the requirements on the impl of `Trait` for `[closure@$DIR/nested-return-type2-tait2.rs:27:5: 27:10]` +note: required because of the requirements on the impl of `Trait` for `[closure@$DIR/nested-return-type2-tait2.rs:28:5: 28:10]` --> $DIR/nested-return-type2-tait2.rs:14:31 | LL | impl<R: Duh, F: FnMut() -> R> Trait for F { diff --git a/src/test/ui/impl-trait/nested-return-type2-tait3.rs b/src/test/ui/impl-trait/nested-return-type2-tait3.rs index 74fd8a9dda0..665c7a8cab9 100644 --- a/src/test/ui/impl-trait/nested-return-type2-tait3.rs +++ b/src/test/ui/impl-trait/nested-return-type2-tait3.rs @@ -23,8 +23,8 @@ type Traitable = impl Trait<Assoc = impl Send>; // var to make it uphold the `: Duh` bound on `Trait::Assoc`. The opaque // type does not implement `Duh`, even if its hidden type does. So we error out. fn foo() -> Traitable { - || 42 //~^ ERROR `impl Send: Duh` is not satisfied + || 42 } fn main() { diff --git a/src/test/ui/impl-trait/nested-return-type2-tait3.stderr b/src/test/ui/impl-trait/nested-return-type2-tait3.stderr index 4d3691d0e07..6185e4872a5 100644 --- a/src/test/ui/impl-trait/nested-return-type2-tait3.stderr +++ b/src/test/ui/impl-trait/nested-return-type2-tait3.stderr @@ -1,11 +1,11 @@ error[E0277]: the trait bound `impl Send: Duh` is not satisfied - --> $DIR/nested-return-type2-tait3.rs:26:5 + --> $DIR/nested-return-type2-tait3.rs:25:13 | -LL | || 42 - | ^^^^^ the trait `Duh` is not implemented for `impl Send` +LL | fn foo() -> Traitable { + | ^^^^^^^^^ the trait `Duh` is not implemented for `impl Send` | = help: the trait `Duh` is implemented for `i32` -note: required because of the requirements on the impl of `Trait` for `[closure@$DIR/nested-return-type2-tait3.rs:26:5: 26:10]` +note: required because of the requirements on the impl of `Trait` for `[closure@$DIR/nested-return-type2-tait3.rs:27:5: 27:10]` --> $DIR/nested-return-type2-tait3.rs:14:31 | LL | impl<R: Duh, F: FnMut() -> R> Trait for F { diff --git a/src/test/ui/impl-trait/nested-return-type2.rs b/src/test/ui/impl-trait/nested-return-type2.rs index 39928d543e1..279641a46c3 100644 --- a/src/test/ui/impl-trait/nested-return-type2.rs +++ b/src/test/ui/impl-trait/nested-return-type2.rs @@ -1,5 +1,3 @@ -// check-pass - trait Duh {} impl Duh for i32 {} @@ -20,11 +18,9 @@ impl<R: Duh, F: FnMut() -> R> Trait for F { // the hidden type. We already have obligations registered on the inference // var to make it uphold the `: Duh` bound on `Trait::Assoc`. The opaque // type does not implement `Duh`, even if its hidden type does. -// Lazy TAIT would error out, but we inserted a hack to make it work again, -// keeping backwards compatibility. fn foo() -> impl Trait<Assoc = impl Send> { + //~^ ERROR `impl Send: Duh` is not satisfied || 42 } -fn main() { -} +fn main() {} diff --git a/src/test/ui/impl-trait/nested-return-type2.stderr b/src/test/ui/impl-trait/nested-return-type2.stderr new file mode 100644 index 00000000000..f996e99de07 --- /dev/null +++ b/src/test/ui/impl-trait/nested-return-type2.stderr @@ -0,0 +1,16 @@ +error[E0277]: the trait bound `impl Send: Duh` is not satisfied + --> $DIR/nested-return-type2.rs:21:13 + | +LL | fn foo() -> impl Trait<Assoc = impl Send> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Duh` is not implemented for `impl Send` + | + = help: the trait `Duh` is implemented for `i32` +note: required because of the requirements on the impl of `Trait` for `[closure@$DIR/nested-return-type2.rs:23:5: 23:10]` + --> $DIR/nested-return-type2.rs:12:31 + | +LL | impl<R: Duh, F: FnMut() -> R> Trait for F { + | ^^^^^ ^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/inference/cannot-infer-partial-try-return.stderr b/src/test/ui/inference/cannot-infer-partial-try-return.stderr index 220602c124c..c1e43f0b721 100644 --- a/src/test/ui/inference/cannot-infer-partial-try-return.stderr +++ b/src/test/ui/inference/cannot-infer-partial-try-return.stderr @@ -3,6 +3,9 @@ error[E0282]: type annotations needed for `Result<(), QualifiedError<_>>` | LL | let x = || -> Result<_, QualifiedError<_>> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | +LL | infallible()?; + | ------------- type must be known at this point | help: try giving this closure an explicit return type | diff --git a/src/test/ui/inference/erase-type-params-in-label.stderr b/src/test/ui/inference/erase-type-params-in-label.stderr index fd58844c238..7bb281802d2 100644 --- a/src/test/ui/inference/erase-type-params-in-label.stderr +++ b/src/test/ui/inference/erase-type-params-in-label.stderr @@ -2,7 +2,7 @@ error[E0283]: type annotations needed for `Foo<i32, &str, W, Z>` --> $DIR/erase-type-params-in-label.rs:2:9 | LL | let foo = foo(1, ""); - | ^^^ + | ^^^ --- type must be known at this point | = note: cannot satisfy `_: Default` note: required by a bound in `foo` @@ -23,7 +23,7 @@ error[E0283]: type annotations needed for `Bar<i32, &str, Z>` --> $DIR/erase-type-params-in-label.rs:5:9 | LL | let bar = bar(1, ""); - | ^^^ + | ^^^ --- type must be known at this point | = note: cannot satisfy `_: Default` note: required by a bound in `bar` diff --git a/src/test/ui/inference/issue-72616.stderr b/src/test/ui/inference/issue-72616.stderr index 3c53d8126e7..a71ce9a8ef2 100644 --- a/src/test/ui/inference/issue-72616.stderr +++ b/src/test/ui/inference/issue-72616.stderr @@ -2,7 +2,9 @@ error[E0283]: type annotations needed --> $DIR/issue-72616.rs:20:37 | LL | if String::from("a") == "a".try_into().unwrap() {} - | ^^^^^^^^ + | -- ^^^^^^^^ + | | + | type must be known at this point | = note: multiple `impl`s satisfying `String: PartialEq<_>` found in the `alloc` crate: - impl PartialEq for String; diff --git a/src/test/ui/inference/issue-72690.stderr b/src/test/ui/inference/issue-72690.stderr index 9edf14ef291..d4eeda07366 100644 --- a/src/test/ui/inference/issue-72690.stderr +++ b/src/test/ui/inference/issue-72690.stderr @@ -55,7 +55,7 @@ error[E0283]: type annotations needed for `&T` --> $DIR/issue-72690.rs:17:9 | LL | let _ = "x".as_ref(); - | ^ + | ^ ------ type must be known at this point | = note: multiple `impl`s satisfying `str: AsRef<_>` found in the following crates: `core`, `std`: - impl AsRef<OsStr> for str; diff --git a/src/test/ui/inference/issue-86162-1.stderr b/src/test/ui/inference/issue-86162-1.stderr index 6641b29b30b..e395e65fad0 100644 --- a/src/test/ui/inference/issue-86162-1.stderr +++ b/src/test/ui/inference/issue-86162-1.stderr @@ -2,7 +2,9 @@ error[E0283]: type annotations needed --> $DIR/issue-86162-1.rs:7:9 | LL | foo(gen()); //<- Do not suggest `foo::<impl Clone>()`! - | ^^^ cannot infer type of the type parameter `T` declared on the function `gen` + | --- ^^^ cannot infer type of the type parameter `T` declared on the function `gen` + | | + | type must be known at this point | = note: cannot satisfy `_: Clone` note: required by a bound in `foo` diff --git a/src/test/ui/inference/issue-86162-2.stderr b/src/test/ui/inference/issue-86162-2.stderr index d2a026a9269..30e6e10eaa2 100644 --- a/src/test/ui/inference/issue-86162-2.stderr +++ b/src/test/ui/inference/issue-86162-2.stderr @@ -2,7 +2,9 @@ error[E0283]: type annotations needed --> $DIR/issue-86162-2.rs:12:14 | LL | Foo::bar(gen()); //<- Do not suggest `Foo::bar::<impl Clone>()`! - | ^^^ cannot infer type of the type parameter `T` declared on the function `gen` + | -------- ^^^ cannot infer type of the type parameter `T` declared on the function `gen` + | | + | type must be known at this point | = note: cannot satisfy `_: Clone` note: required by a bound in `Foo::bar` diff --git a/src/test/ui/inference/need_type_info/expr-struct-type-relative-enum.rs b/src/test/ui/inference/need_type_info/expr-struct-type-relative-enum.rs new file mode 100644 index 00000000000..42af9fa8d11 --- /dev/null +++ b/src/test/ui/inference/need_type_info/expr-struct-type-relative-enum.rs @@ -0,0 +1,21 @@ +trait Foo { + type Output; + + fn baz() -> Self::Output; +} + +fn needs_infer<T>() {} + +enum Bar { + Variant {} +} + +impl Foo for u8 { + type Output = Bar; + fn baz() -> Self::Output { + needs_infer(); //~ ERROR type annotations needed + Self::Output::Variant {} + } +} + +fn main() {} diff --git a/src/test/ui/inference/need_type_info/expr-struct-type-relative-enum.stderr b/src/test/ui/inference/need_type_info/expr-struct-type-relative-enum.stderr new file mode 100644 index 00000000000..68ecb381348 --- /dev/null +++ b/src/test/ui/inference/need_type_info/expr-struct-type-relative-enum.stderr @@ -0,0 +1,14 @@ +error[E0282]: type annotations needed + --> $DIR/expr-struct-type-relative-enum.rs:16:9 + | +LL | needs_infer(); + | ^^^^^^^^^^^ cannot infer type of the type parameter `T` declared on the function `needs_infer` + | +help: consider specifying the generic argument + | +LL | needs_infer::<T>(); + | +++++ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0282`. diff --git a/src/test/ui/inference/need_type_info/expr-struct-type-relative-gat.rs b/src/test/ui/inference/need_type_info/expr-struct-type-relative-gat.rs new file mode 100644 index 00000000000..bcd29bb4e34 --- /dev/null +++ b/src/test/ui/inference/need_type_info/expr-struct-type-relative-gat.rs @@ -0,0 +1,21 @@ +#![feature(generic_associated_types)] + +trait Foo { + type Output<T>; + + fn baz(); +} + +enum Bar<T> { + Simple {}, + Generic(T), +} + +impl Foo for u8 { + type Output<T> = Bar<T>; + fn baz() { + Self::Output::Simple {}; //~ ERROR type annotations needed + } +} + +fn main() {} diff --git a/src/test/ui/inference/need_type_info/expr-struct-type-relative-gat.stderr b/src/test/ui/inference/need_type_info/expr-struct-type-relative-gat.stderr new file mode 100644 index 00000000000..65a75b68c1f --- /dev/null +++ b/src/test/ui/inference/need_type_info/expr-struct-type-relative-gat.stderr @@ -0,0 +1,9 @@ +error[E0282]: type annotations needed + --> $DIR/expr-struct-type-relative-gat.rs:17:9 + | +LL | Self::Output::Simple {}; + | ^^^^^^^^^^^^ cannot infer type for type parameter `T` declared on the associated type `Output` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0282`. diff --git a/src/test/ui/inference/need_type_info/expr-struct-type-relative.rs b/src/test/ui/inference/need_type_info/expr-struct-type-relative.rs new file mode 100644 index 00000000000..c3ece2b16cf --- /dev/null +++ b/src/test/ui/inference/need_type_info/expr-struct-type-relative.rs @@ -0,0 +1,21 @@ +// regression test for #98598 + +trait Foo { + type Output; + + fn baz() -> Self::Output; +} + +fn needs_infer<T>() {} + +struct Bar {} + +impl Foo for u8 { + type Output = Bar; + fn baz() -> Self::Output { + needs_infer(); //~ ERROR type annotations needed + Self::Output {} + } +} + +fn main() {} diff --git a/src/test/ui/inference/need_type_info/expr-struct-type-relative.stderr b/src/test/ui/inference/need_type_info/expr-struct-type-relative.stderr new file mode 100644 index 00000000000..397d8e7be04 --- /dev/null +++ b/src/test/ui/inference/need_type_info/expr-struct-type-relative.stderr @@ -0,0 +1,14 @@ +error[E0282]: type annotations needed + --> $DIR/expr-struct-type-relative.rs:16:9 + | +LL | needs_infer(); + | ^^^^^^^^^^^ cannot infer type of the type parameter `T` declared on the function `needs_infer` + | +help: consider specifying the generic argument + | +LL | needs_infer::<T>(); + | +++++ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0282`. diff --git a/src/test/ui/infinite/infinite-struct.stderr b/src/test/ui/infinite/infinite-struct.stderr index 383e13fd4b0..214be091cce 100644 --- a/src/test/ui/infinite/infinite-struct.stderr +++ b/src/test/ui/infinite/infinite-struct.stderr @@ -2,9 +2,8 @@ error[E0072]: recursive type `Take` has infinite size --> $DIR/infinite-struct.rs:1:1 | LL | struct Take(Take); - | ^^^^^^^^^^^^----^^ - | | | - | | recursive without indirection + | ^^^^^^^^^^^ ---- recursive without indirection + | | | recursive type has infinite size | help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to make `Take` representable @@ -16,7 +15,7 @@ error[E0391]: cycle detected when computing drop-check constraints for `Take` --> $DIR/infinite-struct.rs:1:1 | LL | struct Take(Take); - | ^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^ | = note: ...which immediately requires computing drop-check constraints for `Take` again = note: cycle used when computing dropck types for `Canonical { max_universe: U0, variables: [], value: ParamEnvAnd { param_env: ParamEnv { caller_bounds: [], reveal: UserFacing, constness: NotConst }, value: Take } }` diff --git a/src/test/ui/infinite/infinite-trait-alias-recursion.stderr b/src/test/ui/infinite/infinite-trait-alias-recursion.stderr index 5ecaedb3cb2..b925b3b018c 100644 --- a/src/test/ui/infinite/infinite-trait-alias-recursion.stderr +++ b/src/test/ui/infinite/infinite-trait-alias-recursion.stderr @@ -2,7 +2,7 @@ error[E0391]: cycle detected when computing the super predicates of `T1` --> $DIR/infinite-trait-alias-recursion.rs:3:1 | LL | trait T1 = T2; - | ^^^^^^^^^^^^^^ + | ^^^^^^^^ | note: ...which requires computing the super traits of `T1`... --> $DIR/infinite-trait-alias-recursion.rs:3:12 @@ -13,7 +13,7 @@ note: ...which requires computing the super predicates of `T2`... --> $DIR/infinite-trait-alias-recursion.rs:6:1 | LL | trait T2 = T3; - | ^^^^^^^^^^^^^^ + | ^^^^^^^^ note: ...which requires computing the super traits of `T2`... --> $DIR/infinite-trait-alias-recursion.rs:6:12 | @@ -23,7 +23,7 @@ note: ...which requires computing the super predicates of `T3`... --> $DIR/infinite-trait-alias-recursion.rs:8:1 | LL | trait T3 = T1 + T3; - | ^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^ note: ...which requires computing the super traits of `T3`... --> $DIR/infinite-trait-alias-recursion.rs:8:12 | diff --git a/src/test/ui/intrinsics/auxiliary/cci_intrinsic.rs b/src/test/ui/intrinsics/auxiliary/cci_intrinsic.rs index f65f359875b..f3b9d569ce3 100644 --- a/src/test/ui/intrinsics/auxiliary/cci_intrinsic.rs +++ b/src/test/ui/intrinsics/auxiliary/cci_intrinsic.rs @@ -2,13 +2,13 @@ pub mod rusti { extern "rust-intrinsic" { - pub fn atomic_xchg<T>(dst: *mut T, src: T) -> T; + pub fn atomic_xchg_seqcst<T>(dst: *mut T, src: T) -> T; } } #[inline(always)] -pub fn atomic_xchg(dst: *mut isize, src: isize) -> isize { +pub fn atomic_xchg_seqcst(dst: *mut isize, src: isize) -> isize { unsafe { - rusti::atomic_xchg(dst, src) + rusti::atomic_xchg_seqcst(dst, src) } } diff --git a/src/test/ui/intrinsics/intrinsic-atomics-cc.rs b/src/test/ui/intrinsics/intrinsic-atomics-cc.rs index 52e891da9ba..ce3fa7b0c05 100644 --- a/src/test/ui/intrinsics/intrinsic-atomics-cc.rs +++ b/src/test/ui/intrinsics/intrinsic-atomics-cc.rs @@ -3,10 +3,10 @@ extern crate cci_intrinsic; -use cci_intrinsic::atomic_xchg; +use cci_intrinsic::atomic_xchg_seqcst; pub fn main() { let mut x = 1; - atomic_xchg(&mut x, 5); + atomic_xchg_seqcst(&mut x, 5); assert_eq!(x, 5); } diff --git a/src/test/ui/intrinsics/intrinsic-atomics.rs b/src/test/ui/intrinsics/intrinsic-atomics.rs index c6e48e8b5af..b17f4347be3 100644 --- a/src/test/ui/intrinsics/intrinsic-atomics.rs +++ b/src/test/ui/intrinsics/intrinsic-atomics.rs @@ -3,31 +3,31 @@ mod rusti { extern "rust-intrinsic" { - pub fn atomic_cxchg<T>(dst: *mut T, old: T, src: T) -> (T, bool); - pub fn atomic_cxchg_acq<T>(dst: *mut T, old: T, src: T) -> (T, bool); - pub fn atomic_cxchg_rel<T>(dst: *mut T, old: T, src: T) -> (T, bool); + pub fn atomic_cxchg_seqcst_seqcst<T>(dst: *mut T, old: T, src: T) -> (T, bool); + pub fn atomic_cxchg_acquire_acquire<T>(dst: *mut T, old: T, src: T) -> (T, bool); + pub fn atomic_cxchg_release_relaxed<T>(dst: *mut T, old: T, src: T) -> (T, bool); - pub fn atomic_cxchgweak<T>(dst: *mut T, old: T, src: T) -> (T, bool); - pub fn atomic_cxchgweak_acq<T>(dst: *mut T, old: T, src: T) -> (T, bool); - pub fn atomic_cxchgweak_rel<T>(dst: *mut T, old: T, src: T) -> (T, bool); + pub fn atomic_cxchgweak_seqcst_seqcst<T>(dst: *mut T, old: T, src: T) -> (T, bool); + pub fn atomic_cxchgweak_acquire_acquire<T>(dst: *mut T, old: T, src: T) -> (T, bool); + pub fn atomic_cxchgweak_release_relaxed<T>(dst: *mut T, old: T, src: T) -> (T, bool); - pub fn atomic_load<T>(src: *const T) -> T; - pub fn atomic_load_acq<T>(src: *const T) -> T; + pub fn atomic_load_seqcst<T>(src: *const T) -> T; + pub fn atomic_load_acquire<T>(src: *const T) -> T; - pub fn atomic_store<T>(dst: *mut T, val: T); - pub fn atomic_store_rel<T>(dst: *mut T, val: T); + pub fn atomic_store_seqcst<T>(dst: *mut T, val: T); + pub fn atomic_store_release<T>(dst: *mut T, val: T); - pub fn atomic_xchg<T>(dst: *mut T, src: T) -> T; - pub fn atomic_xchg_acq<T>(dst: *mut T, src: T) -> T; - pub fn atomic_xchg_rel<T>(dst: *mut T, src: T) -> T; + pub fn atomic_xchg_seqcst<T>(dst: *mut T, src: T) -> T; + pub fn atomic_xchg_acquire<T>(dst: *mut T, src: T) -> T; + pub fn atomic_xchg_release<T>(dst: *mut T, src: T) -> T; - pub fn atomic_xadd<T>(dst: *mut T, src: T) -> T; - pub fn atomic_xadd_acq<T>(dst: *mut T, src: T) -> T; - pub fn atomic_xadd_rel<T>(dst: *mut T, src: T) -> T; + pub fn atomic_xadd_seqcst<T>(dst: *mut T, src: T) -> T; + pub fn atomic_xadd_acquire<T>(dst: *mut T, src: T) -> T; + pub fn atomic_xadd_release<T>(dst: *mut T, src: T) -> T; - pub fn atomic_xsub<T>(dst: *mut T, src: T) -> T; - pub fn atomic_xsub_acq<T>(dst: *mut T, src: T) -> T; - pub fn atomic_xsub_rel<T>(dst: *mut T, src: T) -> T; + pub fn atomic_xsub_seqcst<T>(dst: *mut T, src: T) -> T; + pub fn atomic_xsub_acquire<T>(dst: *mut T, src: T) -> T; + pub fn atomic_xsub_release<T>(dst: *mut T, src: T) -> T; } } @@ -35,45 +35,45 @@ pub fn main() { unsafe { let mut x: Box<_> = Box::new(1); - assert_eq!(rusti::atomic_load(&*x), 1); + assert_eq!(rusti::atomic_load_seqcst(&*x), 1); *x = 5; - assert_eq!(rusti::atomic_load_acq(&*x), 5); + assert_eq!(rusti::atomic_load_acquire(&*x), 5); - rusti::atomic_store(&mut *x,3); + rusti::atomic_store_seqcst(&mut *x,3); assert_eq!(*x, 3); - rusti::atomic_store_rel(&mut *x,1); + rusti::atomic_store_release(&mut *x,1); assert_eq!(*x, 1); - assert_eq!(rusti::atomic_cxchg(&mut *x, 1, 2), (1, true)); + assert_eq!(rusti::atomic_cxchg_seqcst_seqcst(&mut *x, 1, 2), (1, true)); assert_eq!(*x, 2); - assert_eq!(rusti::atomic_cxchg_acq(&mut *x, 1, 3), (2, false)); + assert_eq!(rusti::atomic_cxchg_acquire_acquire(&mut *x, 1, 3), (2, false)); assert_eq!(*x, 2); - assert_eq!(rusti::atomic_cxchg_rel(&mut *x, 2, 1), (2, true)); + assert_eq!(rusti::atomic_cxchg_release_relaxed(&mut *x, 2, 1), (2, true)); assert_eq!(*x, 1); - assert_eq!(rusti::atomic_xchg(&mut *x, 0), 1); + assert_eq!(rusti::atomic_xchg_seqcst(&mut *x, 0), 1); assert_eq!(*x, 0); - assert_eq!(rusti::atomic_xchg_acq(&mut *x, 1), 0); + assert_eq!(rusti::atomic_xchg_acquire(&mut *x, 1), 0); assert_eq!(*x, 1); - assert_eq!(rusti::atomic_xchg_rel(&mut *x, 0), 1); + assert_eq!(rusti::atomic_xchg_release(&mut *x, 0), 1); assert_eq!(*x, 0); - assert_eq!(rusti::atomic_xadd(&mut *x, 1), 0); - assert_eq!(rusti::atomic_xadd_acq(&mut *x, 1), 1); - assert_eq!(rusti::atomic_xadd_rel(&mut *x, 1), 2); + assert_eq!(rusti::atomic_xadd_seqcst(&mut *x, 1), 0); + assert_eq!(rusti::atomic_xadd_acquire(&mut *x, 1), 1); + assert_eq!(rusti::atomic_xadd_release(&mut *x, 1), 2); assert_eq!(*x, 3); - assert_eq!(rusti::atomic_xsub(&mut *x, 1), 3); - assert_eq!(rusti::atomic_xsub_acq(&mut *x, 1), 2); - assert_eq!(rusti::atomic_xsub_rel(&mut *x, 1), 1); + assert_eq!(rusti::atomic_xsub_seqcst(&mut *x, 1), 3); + assert_eq!(rusti::atomic_xsub_acquire(&mut *x, 1), 2); + assert_eq!(rusti::atomic_xsub_release(&mut *x, 1), 1); assert_eq!(*x, 0); loop { - let res = rusti::atomic_cxchgweak(&mut *x, 0, 1); + let res = rusti::atomic_cxchgweak_seqcst_seqcst(&mut *x, 0, 1); assert_eq!(res.0, 0); if res.1 { break; @@ -82,7 +82,7 @@ pub fn main() { assert_eq!(*x, 1); loop { - let res = rusti::atomic_cxchgweak_acq(&mut *x, 1, 2); + let res = rusti::atomic_cxchgweak_acquire_acquire(&mut *x, 1, 2); assert_eq!(res.0, 1); if res.1 { break; @@ -91,7 +91,7 @@ pub fn main() { assert_eq!(*x, 2); loop { - let res = rusti::atomic_cxchgweak_rel(&mut *x, 2, 3); + let res = rusti::atomic_cxchgweak_release_relaxed(&mut *x, 2, 3); assert_eq!(res.0, 2); if res.1 { break; diff --git a/src/test/ui/intrinsics/non-integer-atomic.rs b/src/test/ui/intrinsics/non-integer-atomic.rs index 00a7f368a0f..85ea81ba679 100644 --- a/src/test/ui/intrinsics/non-integer-atomic.rs +++ b/src/test/ui/intrinsics/non-integer-atomic.rs @@ -12,81 +12,81 @@ pub type Bar = &'static Fn(); pub type Quux = [u8; 100]; pub unsafe fn test_bool_load(p: &mut bool, v: bool) { - intrinsics::atomic_load(p); - //~^ ERROR `atomic_load` intrinsic: expected basic integer type, found `bool` + intrinsics::atomic_load_seqcst(p); + //~^ ERROR `atomic_load_seqcst` intrinsic: expected basic integer type, found `bool` } pub unsafe fn test_bool_store(p: &mut bool, v: bool) { - intrinsics::atomic_store(p, v); - //~^ ERROR `atomic_store` intrinsic: expected basic integer type, found `bool` + intrinsics::atomic_store_seqcst(p, v); + //~^ ERROR `atomic_store_seqcst` intrinsic: expected basic integer type, found `bool` } pub unsafe fn test_bool_xchg(p: &mut bool, v: bool) { - intrinsics::atomic_xchg(p, v); - //~^ ERROR `atomic_xchg` intrinsic: expected basic integer type, found `bool` + intrinsics::atomic_xchg_seqcst(p, v); + //~^ ERROR `atomic_xchg_seqcst` intrinsic: expected basic integer type, found `bool` } pub unsafe fn test_bool_cxchg(p: &mut bool, v: bool) { - intrinsics::atomic_cxchg(p, v, v); - //~^ ERROR `atomic_cxchg` intrinsic: expected basic integer type, found `bool` + intrinsics::atomic_cxchg_seqcst_seqcst(p, v, v); + //~^ ERROR `atomic_cxchg_seqcst_seqcst` intrinsic: expected basic integer type, found `bool` } pub unsafe fn test_Foo_load(p: &mut Foo, v: Foo) { - intrinsics::atomic_load(p); - //~^ ERROR `atomic_load` intrinsic: expected basic integer type, found `Foo` + intrinsics::atomic_load_seqcst(p); + //~^ ERROR `atomic_load_seqcst` intrinsic: expected basic integer type, found `Foo` } pub unsafe fn test_Foo_store(p: &mut Foo, v: Foo) { - intrinsics::atomic_store(p, v); - //~^ ERROR `atomic_store` intrinsic: expected basic integer type, found `Foo` + intrinsics::atomic_store_seqcst(p, v); + //~^ ERROR `atomic_store_seqcst` intrinsic: expected basic integer type, found `Foo` } pub unsafe fn test_Foo_xchg(p: &mut Foo, v: Foo) { - intrinsics::atomic_xchg(p, v); - //~^ ERROR `atomic_xchg` intrinsic: expected basic integer type, found `Foo` + intrinsics::atomic_xchg_seqcst(p, v); + //~^ ERROR `atomic_xchg_seqcst` intrinsic: expected basic integer type, found `Foo` } pub unsafe fn test_Foo_cxchg(p: &mut Foo, v: Foo) { - intrinsics::atomic_cxchg(p, v, v); - //~^ ERROR `atomic_cxchg` intrinsic: expected basic integer type, found `Foo` + intrinsics::atomic_cxchg_seqcst_seqcst(p, v, v); + //~^ ERROR `atomic_cxchg_seqcst_seqcst` intrinsic: expected basic integer type, found `Foo` } pub unsafe fn test_Bar_load(p: &mut Bar, v: Bar) { - intrinsics::atomic_load(p); + intrinsics::atomic_load_seqcst(p); //~^ ERROR expected basic integer type, found `&dyn Fn()` } pub unsafe fn test_Bar_store(p: &mut Bar, v: Bar) { - intrinsics::atomic_store(p, v); + intrinsics::atomic_store_seqcst(p, v); //~^ ERROR expected basic integer type, found `&dyn Fn()` } pub unsafe fn test_Bar_xchg(p: &mut Bar, v: Bar) { - intrinsics::atomic_xchg(p, v); + intrinsics::atomic_xchg_seqcst(p, v); //~^ ERROR expected basic integer type, found `&dyn Fn()` } pub unsafe fn test_Bar_cxchg(p: &mut Bar, v: Bar) { - intrinsics::atomic_cxchg(p, v, v); + intrinsics::atomic_cxchg_seqcst_seqcst(p, v, v); //~^ ERROR expected basic integer type, found `&dyn Fn()` } pub unsafe fn test_Quux_load(p: &mut Quux, v: Quux) { - intrinsics::atomic_load(p); - //~^ ERROR `atomic_load` intrinsic: expected basic integer type, found `[u8; 100]` + intrinsics::atomic_load_seqcst(p); + //~^ ERROR `atomic_load_seqcst` intrinsic: expected basic integer type, found `[u8; 100]` } pub unsafe fn test_Quux_store(p: &mut Quux, v: Quux) { - intrinsics::atomic_store(p, v); - //~^ ERROR `atomic_store` intrinsic: expected basic integer type, found `[u8; 100]` + intrinsics::atomic_store_seqcst(p, v); + //~^ ERROR `atomic_store_seqcst` intrinsic: expected basic integer type, found `[u8; 100]` } pub unsafe fn test_Quux_xchg(p: &mut Quux, v: Quux) { - intrinsics::atomic_xchg(p, v); - //~^ ERROR `atomic_xchg` intrinsic: expected basic integer type, found `[u8; 100]` + intrinsics::atomic_xchg_seqcst(p, v); + //~^ ERROR `atomic_xchg_seqcst` intrinsic: expected basic integer type, found `[u8; 100]` } pub unsafe fn test_Quux_cxchg(p: &mut Quux, v: Quux) { - intrinsics::atomic_cxchg(p, v, v); - //~^ ERROR `atomic_cxchg` intrinsic: expected basic integer type, found `[u8; 100]` + intrinsics::atomic_cxchg_seqcst_seqcst(p, v, v); + //~^ ERROR `atomic_cxchg_seqcst_seqcst` intrinsic: expected basic integer type, found `[u8; 100]` } diff --git a/src/test/ui/intrinsics/non-integer-atomic.stderr b/src/test/ui/intrinsics/non-integer-atomic.stderr index ee485c21cd6..32791a8e8b7 100644 --- a/src/test/ui/intrinsics/non-integer-atomic.stderr +++ b/src/test/ui/intrinsics/non-integer-atomic.stderr @@ -1,98 +1,98 @@ -error[E0511]: invalid monomorphization of `atomic_load` intrinsic: expected basic integer type, found `bool` +error[E0511]: invalid monomorphization of `atomic_load_seqcst` intrinsic: expected basic integer type, found `bool` --> $DIR/non-integer-atomic.rs:15:5 | -LL | intrinsics::atomic_load(p); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | intrinsics::atomic_load_seqcst(p); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error[E0511]: invalid monomorphization of `atomic_store` intrinsic: expected basic integer type, found `bool` +error[E0511]: invalid monomorphization of `atomic_store_seqcst` intrinsic: expected basic integer type, found `bool` --> $DIR/non-integer-atomic.rs:20:5 | -LL | intrinsics::atomic_store(p, v); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | intrinsics::atomic_store_seqcst(p, v); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error[E0511]: invalid monomorphization of `atomic_xchg` intrinsic: expected basic integer type, found `bool` +error[E0511]: invalid monomorphization of `atomic_xchg_seqcst` intrinsic: expected basic integer type, found `bool` --> $DIR/non-integer-atomic.rs:25:5 | -LL | intrinsics::atomic_xchg(p, v); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | intrinsics::atomic_xchg_seqcst(p, v); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error[E0511]: invalid monomorphization of `atomic_cxchg` intrinsic: expected basic integer type, found `bool` +error[E0511]: invalid monomorphization of `atomic_cxchg_seqcst_seqcst` intrinsic: expected basic integer type, found `bool` --> $DIR/non-integer-atomic.rs:30:5 | -LL | intrinsics::atomic_cxchg(p, v, v); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | intrinsics::atomic_cxchg_seqcst_seqcst(p, v, v); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error[E0511]: invalid monomorphization of `atomic_load` intrinsic: expected basic integer type, found `Foo` +error[E0511]: invalid monomorphization of `atomic_load_seqcst` intrinsic: expected basic integer type, found `Foo` --> $DIR/non-integer-atomic.rs:35:5 | -LL | intrinsics::atomic_load(p); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | intrinsics::atomic_load_seqcst(p); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error[E0511]: invalid monomorphization of `atomic_store` intrinsic: expected basic integer type, found `Foo` +error[E0511]: invalid monomorphization of `atomic_store_seqcst` intrinsic: expected basic integer type, found `Foo` --> $DIR/non-integer-atomic.rs:40:5 | -LL | intrinsics::atomic_store(p, v); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | intrinsics::atomic_store_seqcst(p, v); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error[E0511]: invalid monomorphization of `atomic_xchg` intrinsic: expected basic integer type, found `Foo` +error[E0511]: invalid monomorphization of `atomic_xchg_seqcst` intrinsic: expected basic integer type, found `Foo` --> $DIR/non-integer-atomic.rs:45:5 | -LL | intrinsics::atomic_xchg(p, v); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | intrinsics::atomic_xchg_seqcst(p, v); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error[E0511]: invalid monomorphization of `atomic_cxchg` intrinsic: expected basic integer type, found `Foo` +error[E0511]: invalid monomorphization of `atomic_cxchg_seqcst_seqcst` intrinsic: expected basic integer type, found `Foo` --> $DIR/non-integer-atomic.rs:50:5 | -LL | intrinsics::atomic_cxchg(p, v, v); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | intrinsics::atomic_cxchg_seqcst_seqcst(p, v, v); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error[E0511]: invalid monomorphization of `atomic_load` intrinsic: expected basic integer type, found `&dyn Fn()` +error[E0511]: invalid monomorphization of `atomic_load_seqcst` intrinsic: expected basic integer type, found `&dyn Fn()` --> $DIR/non-integer-atomic.rs:55:5 | -LL | intrinsics::atomic_load(p); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | intrinsics::atomic_load_seqcst(p); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error[E0511]: invalid monomorphization of `atomic_store` intrinsic: expected basic integer type, found `&dyn Fn()` +error[E0511]: invalid monomorphization of `atomic_store_seqcst` intrinsic: expected basic integer type, found `&dyn Fn()` --> $DIR/non-integer-atomic.rs:60:5 | -LL | intrinsics::atomic_store(p, v); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | intrinsics::atomic_store_seqcst(p, v); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error[E0511]: invalid monomorphization of `atomic_xchg` intrinsic: expected basic integer type, found `&dyn Fn()` +error[E0511]: invalid monomorphization of `atomic_xchg_seqcst` intrinsic: expected basic integer type, found `&dyn Fn()` --> $DIR/non-integer-atomic.rs:65:5 | -LL | intrinsics::atomic_xchg(p, v); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | intrinsics::atomic_xchg_seqcst(p, v); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error[E0511]: invalid monomorphization of `atomic_cxchg` intrinsic: expected basic integer type, found `&dyn Fn()` +error[E0511]: invalid monomorphization of `atomic_cxchg_seqcst_seqcst` intrinsic: expected basic integer type, found `&dyn Fn()` --> $DIR/non-integer-atomic.rs:70:5 | -LL | intrinsics::atomic_cxchg(p, v, v); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | intrinsics::atomic_cxchg_seqcst_seqcst(p, v, v); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error[E0511]: invalid monomorphization of `atomic_load` intrinsic: expected basic integer type, found `[u8; 100]` +error[E0511]: invalid monomorphization of `atomic_load_seqcst` intrinsic: expected basic integer type, found `[u8; 100]` --> $DIR/non-integer-atomic.rs:75:5 | -LL | intrinsics::atomic_load(p); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | intrinsics::atomic_load_seqcst(p); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error[E0511]: invalid monomorphization of `atomic_store` intrinsic: expected basic integer type, found `[u8; 100]` +error[E0511]: invalid monomorphization of `atomic_store_seqcst` intrinsic: expected basic integer type, found `[u8; 100]` --> $DIR/non-integer-atomic.rs:80:5 | -LL | intrinsics::atomic_store(p, v); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | intrinsics::atomic_store_seqcst(p, v); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error[E0511]: invalid monomorphization of `atomic_xchg` intrinsic: expected basic integer type, found `[u8; 100]` +error[E0511]: invalid monomorphization of `atomic_xchg_seqcst` intrinsic: expected basic integer type, found `[u8; 100]` --> $DIR/non-integer-atomic.rs:85:5 | -LL | intrinsics::atomic_xchg(p, v); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | intrinsics::atomic_xchg_seqcst(p, v); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error[E0511]: invalid monomorphization of `atomic_cxchg` intrinsic: expected basic integer type, found `[u8; 100]` +error[E0511]: invalid monomorphization of `atomic_cxchg_seqcst_seqcst` intrinsic: expected basic integer type, found `[u8; 100]` --> $DIR/non-integer-atomic.rs:90:5 | -LL | intrinsics::atomic_cxchg(p, v, v); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | intrinsics::atomic_cxchg_seqcst_seqcst(p, v, v); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 16 previous errors diff --git a/src/test/ui/invalid_dispatch_from_dyn_impls.stderr b/src/test/ui/invalid_dispatch_from_dyn_impls.stderr index 6d62d4fd071..b5b32d2f0bd 100644 --- a/src/test/ui/invalid_dispatch_from_dyn_impls.stderr +++ b/src/test/ui/invalid_dispatch_from_dyn_impls.stderr @@ -1,22 +1,16 @@ error[E0378]: the trait `DispatchFromDyn` may only be implemented for structs containing the field being coerced, ZST fields with 1 byte alignment, and nothing else --> $DIR/invalid_dispatch_from_dyn_impls.rs:10:1 | -LL | / impl<T, U> DispatchFromDyn<WrapperWithExtraField<U>> for WrapperWithExtraField<T> -LL | | where -LL | | T: DispatchFromDyn<U>, -LL | | {} - | |__^ +LL | impl<T, U> DispatchFromDyn<WrapperWithExtraField<U>> for WrapperWithExtraField<T> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: extra field `1` of type `i32` is not allowed error[E0378]: implementing the `DispatchFromDyn` trait requires multiple coercions --> $DIR/invalid_dispatch_from_dyn_impls.rs:21:1 | -LL | / impl<T: ?Sized, U: ?Sized> DispatchFromDyn<MultiplePointers<U>> for MultiplePointers<T> -LL | | where -LL | | T: Unsize<U>, -LL | | {} - | |__^ +LL | impl<T: ?Sized, U: ?Sized> DispatchFromDyn<MultiplePointers<U>> for MultiplePointers<T> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: the trait `DispatchFromDyn` may only be implemented for a coercion between structures with a single field being coerced = note: currently, 2 fields need coercions: `ptr1` (`*const T` to `*const U`), `ptr2` (`*const T` to `*const U`) @@ -25,25 +19,19 @@ error[E0378]: the trait `DispatchFromDyn` may only be implemented for a coercion --> $DIR/invalid_dispatch_from_dyn_impls.rs:31:1 | LL | impl<T: ?Sized, U: ?Sized> DispatchFromDyn<NothingToCoerce<T>> for NothingToCoerce<U> {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0378]: structs implementing `DispatchFromDyn` may not have `#[repr(packed)]` or `#[repr(C)]` --> $DIR/invalid_dispatch_from_dyn_impls.rs:37:1 | -LL | / impl<T: ?Sized, U: ?Sized> DispatchFromDyn<HasReprC<U>> for HasReprC<T> -LL | | where -LL | | T: Unsize<U>, -LL | | {} - | |__^ +LL | impl<T: ?Sized, U: ?Sized> DispatchFromDyn<HasReprC<U>> for HasReprC<T> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0378]: the trait `DispatchFromDyn` may only be implemented for structs containing the field being coerced, ZST fields with 1 byte alignment, and nothing else --> $DIR/invalid_dispatch_from_dyn_impls.rs:46:1 | -LL | / impl<T: ?Sized, U: ?Sized> DispatchFromDyn<OverAligned<U>> for OverAligned<T> -LL | | where -LL | | T: Unsize<U>, -LL | | {} - | |__^ +LL | impl<T: ?Sized, U: ?Sized> DispatchFromDyn<OverAligned<U>> for OverAligned<T> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: extra field `1` of type `OverAlignedZst` is not allowed diff --git a/src/test/ui/issues/issue-12028.stderr b/src/test/ui/issues/issue-12028.stderr index 30cb7a1df80..8d6b81c24b6 100644 --- a/src/test/ui/issues/issue-12028.stderr +++ b/src/test/ui/issues/issue-12028.stderr @@ -1,8 +1,14 @@ -error[E0284]: type annotations needed: cannot satisfy `<_ as StreamHasher>::S == <H as StreamHasher>::S` +error[E0284]: type annotations needed --> $DIR/issue-12028.rs:27:14 | LL | self.input_stream(&mut stream); - | ^^^^^^^^^^^^ cannot satisfy `<_ as StreamHasher>::S == <H as StreamHasher>::S` + | ^^^^^^^^^^^^ + | + = note: cannot satisfy `<_ as StreamHasher>::S == <H as StreamHasher>::S` +help: try using a fully qualified path to specify the expected types + | +LL | <u8 as StreamHash<H>>::input_stream(self, &mut stream); + | ++++++++++++++++++++++++++++++++++++ ~ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-14091-2.stderr b/src/test/ui/issues/issue-14091-2.stderr index fbfa6e1abb2..a191afd7980 100644 --- a/src/test/ui/issues/issue-14091-2.stderr +++ b/src/test/ui/issues/issue-14091-2.stderr @@ -8,18 +8,12 @@ note: an implementation of `Not` might be missing for `BytePos` --> $DIR/issue-14091-2.rs:6:1 | LL | pub struct BytePos(pub u32); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ must implement `Not` + | ^^^^^^^^^^^^^^^^^^ must implement `Not` note: the following trait must be implemented --> $SRC_DIR/core/src/ops/bit.rs:LL:COL | -LL | / pub trait Not { -LL | | /// The resulting type after applying the `!` operator. -LL | | #[stable(feature = "rust1", since = "1.0.0")] -LL | | type Output; -... | -LL | | fn not(self) -> Self::Output; -LL | | } - | |_^ +LL | pub trait Not { + | ^^^^^^^^^^^^^ = note: this error originates in the macro `assert` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to previous error diff --git a/src/test/ui/issues/issue-14366.stderr b/src/test/ui/issues/issue-14366.stderr index b96b07c91a1..10a73b245ac 100644 --- a/src/test/ui/issues/issue-14366.stderr +++ b/src/test/ui/issues/issue-14366.stderr @@ -5,7 +5,7 @@ LL | let _x = "test" as &dyn (::std::any::Any); | ^^^^^^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `str` - = note: required for the cast to the object type `dyn Any` + = note: required for the cast from `str` to the object type `dyn Any` help: consider borrowing the value, since `&str` can be coerced into `dyn Any` | LL | let _x = &"test" as &dyn (::std::any::Any); diff --git a/src/test/ui/issues/issue-15965.stderr b/src/test/ui/issues/issue-15965.stderr index 90377c19dee..fe06810b8df 100644 --- a/src/test/ui/issues/issue-15965.stderr +++ b/src/test/ui/issues/issue-15965.stderr @@ -5,8 +5,6 @@ LL | / { return () } LL | | LL | | () | |______^ cannot infer type - | - = note: type must be known at this point error: aborting due to previous error diff --git a/src/test/ui/issues/issue-16250.stderr b/src/test/ui/issues/issue-16250.stderr index 45f854f93ec..ae3b7f334c6 100644 --- a/src/test/ui/issues/issue-16250.stderr +++ b/src/test/ui/issues/issue-16250.stderr @@ -16,7 +16,7 @@ note: the type is defined here --> $DIR/issue-16250.rs:3:1 | LL | pub struct Foo; - | ^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-16725.stderr b/src/test/ui/issues/issue-16725.stderr index 84359803bba..5f6eae73e58 100644 --- a/src/test/ui/issues/issue-16725.stderr +++ b/src/test/ui/issues/issue-16725.stderr @@ -8,7 +8,7 @@ note: the function `bar` is defined here --> $DIR/auxiliary/issue-16725.rs:2:5 | LL | fn bar(); - | ^^^^^^^^^ + | ^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-17252.stderr b/src/test/ui/issues/issue-17252.stderr index 4856418ed60..3a629e1ebf4 100644 --- a/src/test/ui/issues/issue-17252.stderr +++ b/src/test/ui/issues/issue-17252.stderr @@ -2,7 +2,7 @@ error[E0391]: cycle detected when const-evaluating + checking `FOO` --> $DIR/issue-17252.rs:1:1 | LL | const FOO: usize = FOO; - | ^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^ | = note: ...which immediately requires const-evaluating + checking `FOO` again note: cycle used when const-evaluating + checking `main::{constant#0}` diff --git a/src/test/ui/issues/issue-17718-const-privacy.stderr b/src/test/ui/issues/issue-17718-const-privacy.stderr index d4595be7490..133a6360bf9 100644 --- a/src/test/ui/issues/issue-17718-const-privacy.stderr +++ b/src/test/ui/issues/issue-17718-const-privacy.stderr @@ -20,7 +20,7 @@ note: the constant `BAR` is defined here --> $DIR/auxiliary/issue-17718-const-privacy.rs:4:1 | LL | const BAR: usize = 3; - | ^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-17959.stderr b/src/test/ui/issues/issue-17959.stderr index f00356f602e..fb795febf79 100644 --- a/src/test/ui/issues/issue-17959.stderr +++ b/src/test/ui/issues/issue-17959.stderr @@ -7,10 +7,8 @@ LL | impl<T> Drop for G<T> { note: the implementor must specify the same requirement --> $DIR/issue-17959.rs:7:1 | -LL | / struct G<T: ?Sized> { -LL | | _ptr: *const T -LL | | } - | |_^ +LL | struct G<T: ?Sized> { + | ^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-18389.stderr b/src/test/ui/issues/issue-18389.stderr index dc476f5edc7..6ce78c45d6e 100644 --- a/src/test/ui/issues/issue-18389.stderr +++ b/src/test/ui/issues/issue-18389.stderr @@ -8,9 +8,7 @@ LL | / pub trait Public: Private< LL | | LL | | <Self as Public>::P, LL | | <Self as Public>::R -... | -LL | | fn call_inner(&self); -LL | | } +LL | | > { | |_^ can't leak private trait error: aborting due to previous error diff --git a/src/test/ui/issues/issue-19482.stderr b/src/test/ui/issues/issue-19482.stderr index 42a5a015969..d51cc1f081e 100644 --- a/src/test/ui/issues/issue-19482.stderr +++ b/src/test/ui/issues/issue-19482.stderr @@ -2,7 +2,7 @@ error[E0191]: the value of the associated type `A` (from trait `Foo`) must be sp --> $DIR/issue-19482.rs:10:16 | LL | type A; - | ------- `A` defined here + | ------ `A` defined here ... LL | fn bar(x: &dyn Foo) {} | ^^^ help: specify the associated type: `Foo<A = Type>` diff --git a/src/test/ui/issues/issue-20261.stderr b/src/test/ui/issues/issue-20261.stderr index 73468c7ca16..9ac751e4dc4 100644 --- a/src/test/ui/issues/issue-20261.stderr +++ b/src/test/ui/issues/issue-20261.stderr @@ -3,8 +3,6 @@ error[E0282]: type annotations needed | LL | i.clone(); | ^^^^^ cannot infer type - | - = note: type must be known at this point error: aborting due to previous error diff --git a/src/test/ui/issues/issue-20413.rs b/src/test/ui/issues/issue-20413.rs index a4345ccdfbe..138a235e675 100644 --- a/src/test/ui/issues/issue-20413.rs +++ b/src/test/ui/issues/issue-20413.rs @@ -1,5 +1,5 @@ trait Foo { - fn answer(self); + fn answer(self); } struct NoData<T>; @@ -7,18 +7,17 @@ struct NoData<T>; impl<T> Foo for T where NoData<T>: Foo { //~^ ERROR: overflow evaluating the requirement - //~| ERROR: overflow evaluating the requirement fn answer(self) { let val: NoData<T> = NoData; } } trait Bar { - fn answer(self); + fn answer(self); } trait Baz { - fn answer(self); + fn answer(self); } struct AlmostNoData<T>(Option<T>); @@ -27,7 +26,6 @@ struct EvenLessData<T>(Option<T>); impl<T> Bar for T where EvenLessData<T>: Baz { //~^ ERROR: overflow evaluating the requirement -//~| ERROR: overflow evaluating the requirement fn answer(self) { let val: EvenLessData<T> = EvenLessData(None); } @@ -35,7 +33,6 @@ impl<T> Bar for T where EvenLessData<T>: Baz { impl<T> Baz for T where AlmostNoData<T>: Bar { //~^ ERROR: overflow evaluating the requirement -//~| ERROR: overflow evaluating the requirement fn answer(self) { let val: NoData<T> = AlmostNoData(None); } diff --git a/src/test/ui/issues/issue-20413.stderr b/src/test/ui/issues/issue-20413.stderr index 29352141404..ea493c58a33 100644 --- a/src/test/ui/issues/issue-20413.stderr +++ b/src/test/ui/issues/issue-20413.stderr @@ -22,102 +22,47 @@ LL | impl<T> Foo for T where NoData<T>: Foo { = note: 127 redundant requirements hidden = note: required because of the requirements on the impl of `Foo` for `NoData<T>` -error[E0275]: overflow evaluating the requirement `NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<T>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>: Foo` - --> $DIR/issue-20413.rs:8:36 - | -LL | impl<T> Foo for T where NoData<T>: Foo { - | ^^^ - | - = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`issue_20413`) -note: required because of the requirements on the impl of `Foo` for `NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<T>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` - --> $DIR/issue-20413.rs:8:9 - | -LL | impl<T> Foo for T where NoData<T>: Foo { - | ^^^ ^ - = note: 127 redundant requirements hidden - = note: required because of the requirements on the impl of `Foo` for `NoData<T>` - error[E0275]: overflow evaluating the requirement `EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<T>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>: Baz` - --> $DIR/issue-20413.rs:28:42 + --> $DIR/issue-20413.rs:27:42 | LL | impl<T> Bar for T where EvenLessData<T>: Baz { | ^^^ | = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`issue_20413`) note: required because of the requirements on the impl of `Bar` for `AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<T>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` - --> $DIR/issue-20413.rs:28:9 + --> $DIR/issue-20413.rs:27:9 | LL | impl<T> Bar for T where EvenLessData<T>: Baz { | ^^^ ^ note: required because of the requirements on the impl of `Baz` for `EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<T>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` - --> $DIR/issue-20413.rs:36:9 + --> $DIR/issue-20413.rs:34:9 | LL | impl<T> Baz for T where AlmostNoData<T>: Bar { | ^^^ ^ = note: 126 redundant requirements hidden = note: required because of the requirements on the impl of `Baz` for `EvenLessData<T>` -error[E0275]: overflow evaluating the requirement `EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<T>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>: Baz` - --> $DIR/issue-20413.rs:28:42 - | -LL | impl<T> Bar for T where EvenLessData<T>: Baz { - | ^^^ - | - = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`issue_20413`) -note: required because of the requirements on the impl of `Bar` for `AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<T>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` - --> $DIR/issue-20413.rs:28:9 - | -LL | impl<T> Bar for T where EvenLessData<T>: Baz { - | ^^^ ^ -note: required because of the requirements on the impl of `Baz` for `EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<T>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` - --> $DIR/issue-20413.rs:36:9 - | -LL | impl<T> Baz for T where AlmostNoData<T>: Bar { - | ^^^ ^ - = note: 126 redundant requirements hidden - = note: required because of the requirements on the impl of `Baz` for `EvenLessData<T>` - -error[E0275]: overflow evaluating the requirement `AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<T>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>: Bar` - --> $DIR/issue-20413.rs:36:42 - | -LL | impl<T> Baz for T where AlmostNoData<T>: Bar { - | ^^^ - | - = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`issue_20413`) -note: required because of the requirements on the impl of `Baz` for `EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<T>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` - --> $DIR/issue-20413.rs:36:9 - | -LL | impl<T> Baz for T where AlmostNoData<T>: Bar { - | ^^^ ^ -note: required because of the requirements on the impl of `Bar` for `AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<T>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` - --> $DIR/issue-20413.rs:28:9 - | -LL | impl<T> Bar for T where EvenLessData<T>: Baz { - | ^^^ ^ - = note: 126 redundant requirements hidden - = note: required because of the requirements on the impl of `Bar` for `AlmostNoData<T>` - error[E0275]: overflow evaluating the requirement `AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<T>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>: Bar` - --> $DIR/issue-20413.rs:36:42 + --> $DIR/issue-20413.rs:34:42 | LL | impl<T> Baz for T where AlmostNoData<T>: Bar { | ^^^ | = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`issue_20413`) note: required because of the requirements on the impl of `Baz` for `EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<T>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` - --> $DIR/issue-20413.rs:36:9 + --> $DIR/issue-20413.rs:34:9 | LL | impl<T> Baz for T where AlmostNoData<T>: Bar { | ^^^ ^ note: required because of the requirements on the impl of `Bar` for `AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<T>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` - --> $DIR/issue-20413.rs:28:9 + --> $DIR/issue-20413.rs:27:9 | LL | impl<T> Bar for T where EvenLessData<T>: Baz { | ^^^ ^ = note: 126 redundant requirements hidden = note: required because of the requirements on the impl of `Bar` for `AlmostNoData<T>` -error: aborting due to 7 previous errors +error: aborting due to 4 previous errors Some errors have detailed explanations: E0275, E0392. For more information about an error, try `rustc --explain E0275`. diff --git a/src/test/ui/issues/issue-20714.stderr b/src/test/ui/issues/issue-20714.stderr index 456aff05750..2d88ce5e511 100644 --- a/src/test/ui/issues/issue-20714.stderr +++ b/src/test/ui/issues/issue-20714.stderr @@ -2,7 +2,7 @@ error[E0618]: expected function, found `G` --> $DIR/issue-20714.rs:4:13 | LL | struct G; - | --------- `G` defined here + | -------- `G` defined here ... LL | let g = G(); | ^-- diff --git a/src/test/ui/issues/issue-20772.stderr b/src/test/ui/issues/issue-20772.stderr index c964dc41dce..22b9f5bd4cb 100644 --- a/src/test/ui/issues/issue-20772.stderr +++ b/src/test/ui/issues/issue-20772.stderr @@ -1,19 +1,15 @@ error[E0391]: cycle detected when computing the super traits of `T` with associated type name `Item` --> $DIR/issue-20772.rs:1:1 | -LL | / trait T : Iterator<Item=Self::Item> -LL | | -LL | | {} - | |__^ +LL | trait T : Iterator<Item=Self::Item> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: ...which immediately requires computing the super traits of `T` with associated type name `Item` again note: cycle used when computing the super traits of `T` --> $DIR/issue-20772.rs:1:1 | -LL | / trait T : Iterator<Item=Self::Item> -LL | | -LL | | {} - | |__^ +LL | trait T : Iterator<Item=Self::Item> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-2151.stderr b/src/test/ui/issues/issue-2151.stderr index e0d946205ad..31a8ca5fbfa 100644 --- a/src/test/ui/issues/issue-2151.stderr +++ b/src/test/ui/issues/issue-2151.stderr @@ -3,8 +3,9 @@ error[E0282]: type annotations needed | LL | let x = panic!(); | ^ +LL | x.clone(); + | - type must be known at this point | - = note: type must be known at this point help: consider giving `x` an explicit type | LL | let x: _ = panic!(); diff --git a/src/test/ui/issues/issue-21701.stderr b/src/test/ui/issues/issue-21701.stderr index 0405ce551b0..ada6f44319d 100644 --- a/src/test/ui/issues/issue-21701.stderr +++ b/src/test/ui/issues/issue-21701.stderr @@ -12,7 +12,7 @@ error[E0618]: expected function, found `Bar` --> $DIR/issue-21701.rs:9:13 | LL | struct Bar; - | ----------- `Bar` defined here + | ---------- `Bar` defined here ... LL | let f = Bar(); | ^^^-- diff --git a/src/test/ui/issues/issue-21950.stderr b/src/test/ui/issues/issue-21950.stderr index 93c2444f884..4909398bb84 100644 --- a/src/test/ui/issues/issue-21950.stderr +++ b/src/test/ui/issues/issue-21950.stderr @@ -1,13 +1,11 @@ error[E0393]: the type parameter `Rhs` must be explicitly specified --> $DIR/issue-21950.rs:10:25 | -LL | / trait Add<Rhs=Self> { -LL | | type Output; -LL | | } - | |_- type parameter `Rhs` must be specified for this +LL | trait Add<Rhs=Self> { + | ------------------- type parameter `Rhs` must be specified for this ... -LL | let x = &10 as &dyn Add; - | ^^^ help: set the type parameter to the desired type: `Add<Rhs>` +LL | let x = &10 as &dyn Add; + | ^^^ help: set the type parameter to the desired type: `Add<Rhs>` | = note: because of the default `Self` reference, type parameters must be specified on object types @@ -15,7 +13,7 @@ error[E0191]: the value of the associated type `Output` (from trait `Add`) must --> $DIR/issue-21950.rs:10:25 | LL | type Output; - | ------------ `Output` defined here + | ----------- `Output` defined here ... LL | let x = &10 as &dyn Add; | ^^^ help: specify the associated type: `Add<Output = Type>` diff --git a/src/test/ui/issues/issue-21974.stderr b/src/test/ui/issues/issue-21974.stderr index dfabde9abc9..4e010a13653 100644 --- a/src/test/ui/issues/issue-21974.stderr +++ b/src/test/ui/issues/issue-21974.stderr @@ -1,8 +1,8 @@ -error[E0283]: type annotations needed +error[E0283]: type annotations needed: cannot satisfy `&'a T: Foo` --> $DIR/issue-21974.rs:11:19 | LL | where &'a T : Foo, - | ^^^ cannot infer type for reference `&'a T` + | ^^^ | = note: cannot satisfy `&'a T: Foo` diff --git a/src/test/ui/issues/issue-22034.stderr b/src/test/ui/issues/issue-22034.stderr index edcd21ebd6b..b32de5b24b9 100644 --- a/src/test/ui/issues/issue-22034.stderr +++ b/src/test/ui/issues/issue-22034.stderr @@ -6,7 +6,7 @@ LL | &mut *(ptr as *mut dyn Fn()) | = help: the trait `Fn<()>` is not implemented for `()` = note: wrap the `()` in a closure with no arguments: `|| { /* code */ }` - = note: required for the cast to the object type `dyn Fn()` + = note: required for the cast from `()` to the object type `dyn Fn()` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-22370.stderr b/src/test/ui/issues/issue-22370.stderr index 4da346f56ab..cd27c4e4e4e 100644 --- a/src/test/ui/issues/issue-22370.stderr +++ b/src/test/ui/issues/issue-22370.stderr @@ -2,7 +2,7 @@ error[E0393]: the type parameter `T` must be explicitly specified --> $DIR/issue-22370.rs:3:14 | LL | trait A<T=Self> {} - | ------------------ type parameter `T` must be specified for this + | --------------- type parameter `T` must be specified for this LL | LL | fn f(a: &dyn A) {} | ^ help: set the type parameter to the desired type: `A<T>` diff --git a/src/test/ui/issues/issue-22434.stderr b/src/test/ui/issues/issue-22434.stderr index 79b9d85610b..b97fa2503b8 100644 --- a/src/test/ui/issues/issue-22434.stderr +++ b/src/test/ui/issues/issue-22434.stderr @@ -2,7 +2,7 @@ error[E0191]: the value of the associated type `A` (from trait `Foo`) must be sp --> $DIR/issue-22434.rs:5:23 | LL | type A; - | ------- `A` defined here + | ------ `A` defined here ... LL | type I<'a> = &'a (dyn Foo + 'a); | ^^^ help: specify the associated type: `Foo<A = Type>` diff --git a/src/test/ui/issues/issue-22872.stderr b/src/test/ui/issues/issue-22872.stderr index cd96646d751..a84cb7d8c59 100644 --- a/src/test/ui/issues/issue-22872.stderr +++ b/src/test/ui/issues/issue-22872.stderr @@ -10,7 +10,7 @@ note: required because of the requirements on the impl of `for<'b> Wrap<'b>` for | LL | impl<'b, P> Wrap<'b> for Wrapper<P> | ^^^^^^^^ ^^^^^^^^^^ - = note: required for the cast to the object type `dyn for<'b> Wrap<'b>` + = note: required for the cast from `Wrapper<P>` to the object type `dyn for<'b> Wrap<'b>` help: consider further restricting the associated type | LL | fn push_process<P>(process: P) where P: Process<'static>, <P as Process<'_>>::Item: Iterator { diff --git a/src/test/ui/issues/issue-23302-3.stderr b/src/test/ui/issues/issue-23302-3.stderr index 1a07d4a95bc..dcb99605da0 100644 --- a/src/test/ui/issues/issue-23302-3.stderr +++ b/src/test/ui/issues/issue-23302-3.stderr @@ -2,19 +2,19 @@ error[E0391]: cycle detected when const-evaluating + checking `A` --> $DIR/issue-23302-3.rs:1:1 | LL | const A: i32 = B; - | ^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^ | note: ...which requires const-evaluating + checking `B`... --> $DIR/issue-23302-3.rs:3:1 | LL | const B: i32 = A; - | ^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^ = note: ...which again requires const-evaluating + checking `A`, completing the cycle note: cycle used when simplifying constant for the type system `A` --> $DIR/issue-23302-3.rs:1:1 | LL | const A: i32 = B; - | ^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-24424.stderr b/src/test/ui/issues/issue-24424.stderr index fa59da852f9..8f3b2ac7319 100644 --- a/src/test/ui/issues/issue-24424.stderr +++ b/src/test/ui/issues/issue-24424.stderr @@ -1,8 +1,8 @@ -error[E0283]: type annotations needed +error[E0283]: type annotations needed: cannot satisfy `T0: Trait0<'l0>` --> $DIR/issue-24424.rs:4:57 | LL | impl <'l0, 'l1, T0> Trait1<'l0, T0> for bool where T0 : Trait0<'l0>, T0 : Trait0<'l1> {} - | ^^^^^^^^^^^ cannot infer type for type parameter `T0` + | ^^^^^^^^^^^ | = note: cannot satisfy `T0: Trait0<'l0>` diff --git a/src/test/ui/issues/issue-25901.stderr b/src/test/ui/issues/issue-25901.stderr index 5c35250bc3f..e933745c44e 100644 --- a/src/test/ui/issues/issue-25901.stderr +++ b/src/test/ui/issues/issue-25901.stderr @@ -9,7 +9,7 @@ note: deref defined here --> $DIR/issue-25901.rs:10:5 | LL | type Target = B; - | ^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^ note: impl defined here, but it is not `const` --> $DIR/issue-25901.rs:9:1 | diff --git a/src/test/ui/issues/issue-26094.rs b/src/test/ui/issues/issue-26094.rs index 981c3abb4ba..df8c2f73910 100644 --- a/src/test/ui/issues/issue-26094.rs +++ b/src/test/ui/issues/issue-26094.rs @@ -1,6 +1,6 @@ macro_rules! some_macro { ($other: expr) => ({ - $other(None) //~ NOTE argument unexpected + $other(None) //~ NOTE argument of type `Option<_>` unexpected }) } diff --git a/src/test/ui/issues/issue-26094.stderr b/src/test/ui/issues/issue-26094.stderr index 1013518e1da..881a6e538ee 100644 --- a/src/test/ui/issues/issue-26094.stderr +++ b/src/test/ui/issues/issue-26094.stderr @@ -2,7 +2,7 @@ error[E0061]: this function takes 0 arguments but 1 argument was supplied --> $DIR/issue-26094.rs:10:17 | LL | $other(None) - | ---- argument unexpected + | ---- argument of type `Option<_>` unexpected ... LL | some_macro!(some_function); | ^^^^^^^^^^^^^ diff --git a/src/test/ui/issues/issue-2718-a.stderr b/src/test/ui/issues/issue-2718-a.stderr index 4aec27f9684..c6e703f4876 100644 --- a/src/test/ui/issues/issue-2718-a.stderr +++ b/src/test/ui/issues/issue-2718-a.stderr @@ -2,9 +2,8 @@ error[E0072]: recursive type `Pong` has infinite size --> $DIR/issue-2718-a.rs:8:5 | LL | pub struct Pong(SendPacket<Ping>); - | ^^^^^^^^^^^^^^^^----------------^^ - | | | - | | recursive without indirection + | ^^^^^^^^^^^^^^^ ---------------- recursive without indirection + | | | recursive type has infinite size | help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to make `Pong` representable diff --git a/src/test/ui/issues/issue-33504.stderr b/src/test/ui/issues/issue-33504.stderr index ec15525ed06..d9e7c3b16e7 100644 --- a/src/test/ui/issues/issue-33504.stderr +++ b/src/test/ui/issues/issue-33504.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/issue-33504.rs:7:13 | LL | struct Test; - | ------------ unit struct defined here + | ----------- unit struct defined here ... LL | let Test = 1; | ^^^^ - this expression has type `{integer}` diff --git a/src/test/ui/issues/issue-35241.stderr b/src/test/ui/issues/issue-35241.stderr index 319886f8783..a66289a1cf8 100644 --- a/src/test/ui/issues/issue-35241.stderr +++ b/src/test/ui/issues/issue-35241.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/issue-35241.rs:3:20 | LL | struct Foo(u32); - | ---------------- fn(u32) -> Foo {Foo} defined here + | ---------- fn(u32) -> Foo {Foo} defined here LL | LL | fn test() -> Foo { Foo } | --- ^^^ expected struct `Foo`, found fn item diff --git a/src/test/ui/issues/issue-37515.stderr b/src/test/ui/issues/issue-37515.stderr index c9bb4c10010..f1e83ca74d8 100644 --- a/src/test/ui/issues/issue-37515.stderr +++ b/src/test/ui/issues/issue-37515.stderr @@ -1,8 +1,8 @@ warning: type alias `Z` is never used - --> $DIR/issue-37515.rs:5:1 + --> $DIR/issue-37515.rs:5:6 | LL | type Z = dyn for<'x> Send; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^ | note: the lint level is defined here --> $DIR/issue-37515.rs:3:9 diff --git a/src/test/ui/issues/issue-38857.stderr b/src/test/ui/issues/issue-38857.stderr index e9d229f74e8..23090c1ed78 100644 --- a/src/test/ui/issues/issue-38857.stderr +++ b/src/test/ui/issues/issue-38857.stderr @@ -14,7 +14,7 @@ note: the module `sys` is defined here --> $SRC_DIR/std/src/lib.rs:LL:COL | LL | mod sys; - | ^^^^^^^^ + | ^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-4265.stderr b/src/test/ui/issues/issue-4265.stderr index acdf963ed3b..27e83d49574 100644 --- a/src/test/ui/issues/issue-4265.stderr +++ b/src/test/ui/issues/issue-4265.stderr @@ -1,14 +1,11 @@ error[E0201]: duplicate definitions with name `bar`: --> $DIR/issue-4265.rs:10:5 | -LL | / fn bar() { -LL | | Foo { baz: 0 }.bar(); -LL | | } - | |_____- previous definition of `bar` here -LL | -LL | / fn bar() { -LL | | } - | |_____^ duplicate definition +LL | fn bar() { + | -------- previous definition of `bar` here +... +LL | fn bar() { + | ^^^^^^^^ duplicate definition error: aborting due to previous error diff --git a/src/test/ui/issues/issue-43355.stderr b/src/test/ui/issues/issue-43355.stderr index 23d8ed1848f..531130fecab 100644 --- a/src/test/ui/issues/issue-43355.stderr +++ b/src/test/ui/issues/issue-43355.stderr @@ -2,7 +2,7 @@ error[E0119]: conflicting implementations of trait `Trait1<std::boxed::Box<_>>` --> $DIR/issue-43355.rs:13:1 | LL | impl<X, T> Trait1<X> for T where T: Trait2<X> { - | --------------------------------------------- first implementation here + | -------------------------- first implementation here ... LL | impl<X> Trait1<Box<X>> for A { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `A` diff --git a/src/test/ui/issues/issue-46771.stderr b/src/test/ui/issues/issue-46771.stderr index a37b5648959..512827b2dbd 100644 --- a/src/test/ui/issues/issue-46771.stderr +++ b/src/test/ui/issues/issue-46771.stderr @@ -2,7 +2,7 @@ error[E0618]: expected function, found `Foo` --> $DIR/issue-46771.rs:3:23 | LL | struct Foo; - | ----------- `Foo` defined here + | ---------- `Foo` defined here LL | (1 .. 2).find(|_| Foo(0) == 0); | ^^^--- | | diff --git a/src/test/ui/issues/issue-47511.rs b/src/test/ui/issues/issue-47511.rs index 98c141b6c6a..eb4860e75d7 100644 --- a/src/test/ui/issues/issue-47511.rs +++ b/src/test/ui/issues/issue-47511.rs @@ -1,5 +1,5 @@ // check-fail -// known-bug +// known-bug: #47511 // Regression test for #47511: anonymous lifetimes can appear // unconstrained in a return type, but only if they appear just once diff --git a/src/test/ui/issues/issue-4935.stderr b/src/test/ui/issues/issue-4935.stderr index b4cebe2a68b..aab19a699ac 100644 --- a/src/test/ui/issues/issue-4935.stderr +++ b/src/test/ui/issues/issue-4935.stderr @@ -2,7 +2,7 @@ error[E0061]: this function takes 1 argument but 2 arguments were supplied --> $DIR/issue-4935.rs:5:13 | LL | fn main() { foo(5, 6) } - | ^^^ - argument unexpected + | ^^^ - argument of type `{integer}` unexpected | note: function defined here --> $DIR/issue-4935.rs:3:4 diff --git a/src/test/ui/issues/issue-4968.stderr b/src/test/ui/issues/issue-4968.stderr index 57ff7fe09e5..bbaca4ed28f 100644 --- a/src/test/ui/issues/issue-4968.stderr +++ b/src/test/ui/issues/issue-4968.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/issue-4968.rs:5:16 | LL | const A: (isize,isize) = (4,2); - | ------------------------------- constant defined here + | ---------------------- constant defined here LL | fn main() { LL | match 42 { A => () } | -- ^ diff --git a/src/test/ui/issues/issue-51116.rs b/src/test/ui/issues/issue-51116.rs index c979c7b2cdd..4c21cbfc61d 100644 --- a/src/test/ui/issues/issue-51116.rs +++ b/src/test/ui/issues/issue-51116.rs @@ -5,7 +5,6 @@ fn main() { *tile = 0; //~^ ERROR type annotations needed //~| NOTE cannot infer type - //~| NOTE type must be known at this point } } diff --git a/src/test/ui/issues/issue-51116.stderr b/src/test/ui/issues/issue-51116.stderr index 399b421ab16..c07f8735eb2 100644 --- a/src/test/ui/issues/issue-51116.stderr +++ b/src/test/ui/issues/issue-51116.stderr @@ -3,8 +3,6 @@ error[E0282]: type annotations needed | LL | *tile = 0; | ^^^^^ cannot infer type - | - = note: type must be known at this point error: aborting due to previous error diff --git a/src/test/ui/issues/issue-51515.rs b/src/test/ui/issues/issue-51515.rs index 54fd176de75..797c1085d51 100644 --- a/src/test/ui/issues/issue-51515.rs +++ b/src/test/ui/issues/issue-51515.rs @@ -5,8 +5,6 @@ fn main() { *foo = 32; //~^ ERROR cannot assign to `*foo`, which is behind a `&` reference let bar = foo; - //~^ HELP consider changing this to be a mutable reference - //~| SUGGESTION &mut i32 *bar = 64; //~^ ERROR cannot assign to `*bar`, which is behind a `&` reference } diff --git a/src/test/ui/issues/issue-51515.stderr b/src/test/ui/issues/issue-51515.stderr index 62bb462faa2..067bdef8b67 100644 --- a/src/test/ui/issues/issue-51515.stderr +++ b/src/test/ui/issues/issue-51515.stderr @@ -8,11 +8,10 @@ LL | *foo = 32; | ^^^^^^^^^ `foo` is a `&` reference, so the data it refers to cannot be written error[E0594]: cannot assign to `*bar`, which is behind a `&` reference - --> $DIR/issue-51515.rs:10:5 + --> $DIR/issue-51515.rs:8:5 | LL | let bar = foo; - | --- help: consider changing this to be a mutable reference: `&mut i32` -... + | --- consider changing this binding's type to be: `&mut i32` LL | *bar = 64; | ^^^^^^^^^ `bar` is a `&` reference, so the data it refers to cannot be written diff --git a/src/test/ui/issues/issue-67552.rs b/src/test/ui/issues/issue-67552.rs index 98192dae20d..ec1997ccd5d 100644 --- a/src/test/ui/issues/issue-67552.rs +++ b/src/test/ui/issues/issue-67552.rs @@ -1,4 +1,5 @@ // build-fail +// compile-flags: -Copt-level=0 // normalize-stderr-test: ".nll/" -> "/" fn main() { diff --git a/src/test/ui/issues/issue-67552.stderr b/src/test/ui/issues/issue-67552.stderr index cf05a72e921..2968be7c71f 100644 --- a/src/test/ui/issues/issue-67552.stderr +++ b/src/test/ui/issues/issue-67552.stderr @@ -1,11 +1,11 @@ error: reached the recursion limit while instantiating `rec::<&mut &mut &mut &mut &mut &... &mut &mut &mut &mut &mut Empty>` - --> $DIR/issue-67552.rs:28:9 + --> $DIR/issue-67552.rs:29:9 | LL | rec(identity(&mut it)) | ^^^^^^^^^^^^^^^^^^^^^^ | note: `rec` defined here - --> $DIR/issue-67552.rs:21:1 + --> $DIR/issue-67552.rs:22:1 | LL | / fn rec<T>(mut it: T) LL | | where diff --git a/src/test/ui/issues/issue-69455.stderr b/src/test/ui/issues/issue-69455.stderr index 6c4eafbc8b3..9be6c2f8564 100644 --- a/src/test/ui/issues/issue-69455.stderr +++ b/src/test/ui/issues/issue-69455.stderr @@ -14,7 +14,9 @@ error[E0283]: type annotations needed --> $DIR/issue-69455.rs:29:41 | LL | println!("{}", 23u64.test(xs.iter().sum())); - | ^^^ cannot infer type of the type parameter `S` declared on the associated function `sum` + | ---- ^^^ cannot infer type of the type parameter `S` declared on the associated function `sum` + | | + | type must be known at this point | note: multiple `impl`s satisfying `u64: Test<_>` found --> $DIR/issue-69455.rs:11:1 diff --git a/src/test/ui/issues/issue-69602-type-err-during-codegen-ice.stderr b/src/test/ui/issues/issue-69602-type-err-during-codegen-ice.stderr index cb5b397849c..2c2cd5c5244 100644 --- a/src/test/ui/issues/issue-69602-type-err-during-codegen-ice.stderr +++ b/src/test/ui/issues/issue-69602-type-err-during-codegen-ice.stderr @@ -8,7 +8,7 @@ error[E0046]: not all trait items implemented, missing: `MyA` --> $DIR/issue-69602-type-err-during-codegen-ice.rs:16:1 | LL | type MyA: TraitA; - | ----------------- `MyA` from trait + | ---------------- `MyA` from trait ... LL | impl TraitB for B { | ^^^^^^^^^^^^^^^^^ missing `MyA` in implementation diff --git a/src/test/ui/issues/issue-69683.stderr b/src/test/ui/issues/issue-69683.stderr index 9c71ecffa26..193de1a35cf 100644 --- a/src/test/ui/issues/issue-69683.stderr +++ b/src/test/ui/issues/issue-69683.stderr @@ -1,8 +1,14 @@ -error[E0284]: type annotations needed: cannot satisfy `<u8 as Element<_>>::Array == [u8; 3]` +error[E0284]: type annotations needed --> $DIR/issue-69683.rs:30:10 | LL | 0u16.foo(b); - | ^^^ cannot satisfy `<u8 as Element<_>>::Array == [u8; 3]` + | ^^^ + | + = note: cannot satisfy `<u8 as Element<_>>::Array == [u8; 3]` +help: try using a fully qualified path to specify the expected types + | +LL | <u16 as Foo<I>>::foo(0u16, b); + | +++++++++++++++++++++ ~ error[E0283]: type annotations needed --> $DIR/issue-69683.rs:30:10 diff --git a/src/test/ui/issues/issue-7013.stderr b/src/test/ui/issues/issue-7013.stderr index 98ed67507b1..f6cb1cbdc11 100644 --- a/src/test/ui/issues/issue-7013.stderr +++ b/src/test/ui/issues/issue-7013.stderr @@ -11,7 +11,7 @@ note: required because it appears within the type `B` | LL | struct B { | ^ - = note: required for the cast to the object type `dyn Foo + Send` + = note: required for the cast from `B` to the object type `dyn Foo + Send` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-71584.stderr b/src/test/ui/issues/issue-71584.stderr index 1c216e64982..6ddb7657301 100644 --- a/src/test/ui/issues/issue-71584.stderr +++ b/src/test/ui/issues/issue-71584.stderr @@ -1,8 +1,16 @@ -error[E0284]: type annotations needed: cannot satisfy `<u64 as Rem<_>>::Output == u64` - --> $DIR/issue-71584.rs:4:11 +error[E0284]: type annotations needed + --> $DIR/issue-71584.rs:4:15 | LL | d = d % n.into(); - | ^ cannot satisfy `<u64 as Rem<_>>::Output == u64` + | - ^^^^ + | | + | type must be known at this point + | + = note: cannot satisfy `<u64 as Rem<_>>::Output == u64` +help: try using a fully qualified path to specify the expected types + | +LL | d = d % <u32 as Into<T>>::into(n); + | +++++++++++++++++++++++ ~ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-73112.stderr b/src/test/ui/issues/issue-73112.stderr index 5a548378c26..4b8b979665c 100644 --- a/src/test/ui/issues/issue-73112.stderr +++ b/src/test/ui/issues/issue-73112.stderr @@ -1,19 +1,14 @@ error[E0588]: packed type cannot transitively contain a `#[repr(align)]` type --> $DIR/issue-73112.rs:9:5 | -LL | / struct SomeStruct { -LL | | -LL | | page_table: PageTable, -LL | | } - | |_____^ +LL | struct SomeStruct { + | ^^^^^^^^^^^^^^^^^ | note: `PageTable` has a `#[repr(align)]` attribute --> $DIR/auxiliary/issue-73112.rs:8:1 | -LL | / pub struct PageTable { -LL | | entries: [PageTableEntry; 512], -LL | | } - | |_^ +LL | pub struct PageTable { + | ^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-76191.stderr b/src/test/ui/issues/issue-76191.stderr index fb8ed43674f..13749804796 100644 --- a/src/test/ui/issues/issue-76191.stderr +++ b/src/test/ui/issues/issue-76191.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/issue-76191.rs:13:9 | LL | const RANGE: RangeInclusive<i32> = 0..=255; - | ------------------------------------------- constant defined here + | -------------------------------- constant defined here ... LL | match n { | - this expression has type `i32` @@ -23,7 +23,7 @@ error[E0308]: mismatched types --> $DIR/issue-76191.rs:15:9 | LL | const RANGE2: RangeInclusive<i32> = panic!(); - | --------------------------------------------- constant defined here + | --------------------------------- constant defined here ... LL | match n { | - this expression has type `i32` diff --git a/src/test/ui/issues/issue-77919.stderr b/src/test/ui/issues/issue-77919.stderr index c986e47fb55..a55ac23e3ed 100644 --- a/src/test/ui/issues/issue-77919.stderr +++ b/src/test/ui/issues/issue-77919.stderr @@ -21,7 +21,7 @@ error[E0046]: not all trait items implemented, missing: `VAL` --> $DIR/issue-77919.rs:12:1 | LL | const VAL: T; - | ------------- `VAL` from trait + | ------------ `VAL` from trait ... LL | impl<N, M> TypeVal<usize> for Multiply<N, M> where N: TypeVal<VAL> {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `VAL` in implementation diff --git a/src/test/ui/issues/issue-7813.stderr b/src/test/ui/issues/issue-7813.stderr index 3aee61bd5a5..2a747f679a8 100644 --- a/src/test/ui/issues/issue-7813.stderr +++ b/src/test/ui/issues/issue-7813.stderr @@ -2,7 +2,7 @@ error[E0282]: type annotations needed for `&[_; 0]` --> $DIR/issue-7813.rs:2:9 | LL | let v = &[]; - | ^ + | ^ --- type must be known at this point | help: consider giving `v` an explicit type, where the placeholders `_` are specified | diff --git a/src/test/ui/keyword/keyword-self-as-type-param.stderr b/src/test/ui/keyword/keyword-self-as-type-param.stderr index fd101b32b4c..419652e1349 100644 --- a/src/test/ui/keyword/keyword-self-as-type-param.stderr +++ b/src/test/ui/keyword/keyword-self-as-type-param.stderr @@ -18,9 +18,8 @@ error[E0072]: recursive type `Foo` has infinite size --> $DIR/keyword-self-as-type-param.rs:3:1 | LL | struct Foo<Self>(Self); - | ^^^^^^^^^^^^^^^^^----^^ - | | | - | | recursive without indirection + | ^^^^^^^^^^^^^^^^ ---- recursive without indirection + | | | recursive type has infinite size | help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to make `Foo` representable diff --git a/src/test/ui/kindck/kindck-impl-type-params.stderr b/src/test/ui/kindck/kindck-impl-type-params.stderr index 32759d2fa0e..902349135c5 100644 --- a/src/test/ui/kindck/kindck-impl-type-params.stderr +++ b/src/test/ui/kindck/kindck-impl-type-params.stderr @@ -9,7 +9,7 @@ note: required because of the requirements on the impl of `Gettable<T>` for `S<T | LL | impl<T: Send + Copy + 'static> Gettable<T> for S<T> {} | ^^^^^^^^^^^ ^^^^ - = note: required for the cast to the object type `dyn Gettable<T>` + = note: required for the cast from `S<T>` to the object type `dyn Gettable<T>` help: consider restricting type parameter `T` | LL | fn f<T: std::marker::Send>(val: T) { @@ -26,7 +26,7 @@ note: required because of the requirements on the impl of `Gettable<T>` for `S<T | LL | impl<T: Send + Copy + 'static> Gettable<T> for S<T> {} | ^^^^^^^^^^^ ^^^^ - = note: required for the cast to the object type `dyn Gettable<T>` + = note: required for the cast from `S<T>` to the object type `dyn Gettable<T>` help: consider restricting type parameter `T` | LL | fn f<T: std::marker::Copy>(val: T) { @@ -43,7 +43,7 @@ note: required because of the requirements on the impl of `Gettable<T>` for `S<T | LL | impl<T: Send + Copy + 'static> Gettable<T> for S<T> {} | ^^^^^^^^^^^ ^^^^ - = note: required for the cast to the object type `dyn Gettable<T>` + = note: required for the cast from `S<T>` to the object type `dyn Gettable<T>` help: consider restricting type parameter `T` | LL | fn g<T: std::marker::Send>(val: T) { @@ -60,7 +60,7 @@ note: required because of the requirements on the impl of `Gettable<T>` for `S<T | LL | impl<T: Send + Copy + 'static> Gettable<T> for S<T> {} | ^^^^^^^^^^^ ^^^^ - = note: required for the cast to the object type `dyn Gettable<T>` + = note: required for the cast from `S<T>` to the object type `dyn Gettable<T>` help: consider restricting type parameter `T` | LL | fn g<T: std::marker::Copy>(val: T) { @@ -78,7 +78,7 @@ note: required because of the requirements on the impl of `Gettable<String>` for | LL | impl<T: Send + Copy + 'static> Gettable<T> for S<T> {} | ^^^^^^^^^^^ ^^^^ - = note: required for the cast to the object type `dyn Gettable<String>` + = note: required for the cast from `S<String>` to the object type `dyn Gettable<String>` error[E0277]: the trait bound `Foo: Copy` is not satisfied --> $DIR/kindck-impl-type-params.rs:43:37 @@ -92,7 +92,7 @@ note: required because of the requirements on the impl of `Gettable<Foo>` for `S | LL | impl<T: Send + Copy + 'static> Gettable<T> for S<T> {} | ^^^^^^^^^^^ ^^^^ - = note: required for the cast to the object type `dyn Gettable<Foo>` + = note: required for the cast from `S<Foo>` to the object type `dyn Gettable<Foo>` help: consider annotating `Foo` with `#[derive(Copy)]` | LL | #[derive(Copy)] diff --git a/src/test/ui/layout/debug.stderr b/src/test/ui/layout/debug.stderr index 7dbcc151855..7ba9657fcd6 100644 --- a/src/test/ui/layout/debug.stderr +++ b/src/test/ui/layout/debug.stderr @@ -84,7 +84,7 @@ error: layout_of(E) = Layout { --> $DIR/debug.rs:6:1 | LL | enum E { Foo, Bar(!, i32, i32) } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^ error: layout_of(S) = Layout { fields: Arbitrary { @@ -128,7 +128,7 @@ error: layout_of(S) = Layout { --> $DIR/debug.rs:9:1 | LL | struct S { f1: i32, f2: (), f3: i32 } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^ error: layout_of(U) = Layout { fields: Union( @@ -150,7 +150,7 @@ error: layout_of(U) = Layout { --> $DIR/debug.rs:12:1 | LL | union U { f1: (i32, i32), f3: i32 } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^ error: layout_of(std::result::Result<i32, i32>) = Layout { fields: Arbitrary { @@ -279,7 +279,7 @@ error: layout_of(std::result::Result<i32, i32>) = Layout { --> $DIR/debug.rs:15:1 | LL | type Test = Result<i32, i32>; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^ error: layout_of(i32) = Layout { fields: Primitive, @@ -305,7 +305,7 @@ error: layout_of(i32) = Layout { --> $DIR/debug.rs:18:1 | LL | type T = impl std::fmt::Debug; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^ error: aborting due to 5 previous errors diff --git a/src/test/ui/layout/hexagon-enum.stderr b/src/test/ui/layout/hexagon-enum.stderr index ba919df771f..f3123cb0ad2 100644 --- a/src/test/ui/layout/hexagon-enum.stderr +++ b/src/test/ui/layout/hexagon-enum.stderr @@ -66,7 +66,7 @@ error: layout_of(A) = Layout { --> $DIR/hexagon-enum.rs:16:1 | LL | enum A { Apple } - | ^^^^^^^^^^^^^^^^ + | ^^^^^^ error: layout_of(B) = Layout { fields: Arbitrary { @@ -136,7 +136,7 @@ error: layout_of(B) = Layout { --> $DIR/hexagon-enum.rs:20:1 | LL | enum B { Banana = 255, } - | ^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^ error: layout_of(C) = Layout { fields: Arbitrary { @@ -206,7 +206,7 @@ error: layout_of(C) = Layout { --> $DIR/hexagon-enum.rs:24:1 | LL | enum C { Chaenomeles = 256, } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^ error: layout_of(P) = Layout { fields: Arbitrary { @@ -276,7 +276,7 @@ error: layout_of(P) = Layout { --> $DIR/hexagon-enum.rs:28:1 | LL | enum P { Peach = 0x1000_0000isize, } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^ error: layout_of(T) = Layout { fields: Arbitrary { @@ -346,7 +346,7 @@ error: layout_of(T) = Layout { --> $DIR/hexagon-enum.rs:34:1 | LL | enum T { Tangerine = TANGERINE as isize } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^ error: aborting due to 5 previous errors diff --git a/src/test/ui/layout/homogeneous-aggr-zero-sized-c-struct.stderr b/src/test/ui/layout/homogeneous-aggr-zero-sized-c-struct.stderr index 6c97a09b0c6..e19216a99db 100644 --- a/src/test/ui/layout/homogeneous-aggr-zero-sized-c-struct.stderr +++ b/src/test/ui/layout/homogeneous-aggr-zero-sized-c-struct.stderr @@ -2,13 +2,13 @@ error: homogeneous_aggregate: Ok(Homogeneous(Reg { kind: Float, size: Size(4 byt --> $DIR/homogeneous-aggr-zero-sized-c-struct.rs:22:1 | LL | pub type TestMiddle = Middle; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^ error: homogeneous_aggregate: Ok(Homogeneous(Reg { kind: Float, size: Size(4 bytes) })) --> $DIR/homogeneous-aggr-zero-sized-c-struct.rs:33:1 | LL | pub type TestFinal = Final; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/layout/homogeneous-aggr-zero-sized-repr-rust.stderr b/src/test/ui/layout/homogeneous-aggr-zero-sized-repr-rust.stderr index 322948ff783..17d639da024 100644 --- a/src/test/ui/layout/homogeneous-aggr-zero-sized-repr-rust.stderr +++ b/src/test/ui/layout/homogeneous-aggr-zero-sized-repr-rust.stderr @@ -2,31 +2,31 @@ error: homogeneous_aggregate: Ok(Homogeneous(Reg { kind: Float, size: Size(4 byt --> $DIR/homogeneous-aggr-zero-sized-repr-rust.rs:53:1 | LL | pub type Test1 = BaseCase; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^ error: homogeneous_aggregate: Ok(Homogeneous(Reg { kind: Float, size: Size(4 bytes) })) --> $DIR/homogeneous-aggr-zero-sized-repr-rust.rs:57:1 | LL | pub type Test2 = WithPhantomData; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^ error: homogeneous_aggregate: Ok(Homogeneous(Reg { kind: Float, size: Size(4 bytes) })) --> $DIR/homogeneous-aggr-zero-sized-repr-rust.rs:61:1 | LL | pub type Test3 = WithEmptyRustStruct; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^ error: homogeneous_aggregate: Ok(Homogeneous(Reg { kind: Float, size: Size(4 bytes) })) --> $DIR/homogeneous-aggr-zero-sized-repr-rust.rs:65:1 | LL | pub type Test4 = WithTransitivelyEmptyRustStruct; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^ error: homogeneous_aggregate: Ok(Homogeneous(Reg { kind: Float, size: Size(4 bytes) })) --> $DIR/homogeneous-aggr-zero-sized-repr-rust.rs:69:1 | LL | pub type Test5 = WithEmptyRustEnum; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^ error: aborting due to 5 previous errors diff --git a/src/test/ui/layout/issue-96158-scalarpair-payload-might-be-uninit.stderr b/src/test/ui/layout/issue-96158-scalarpair-payload-might-be-uninit.stderr index 33dfa307c1d..84d8bc799b9 100644 --- a/src/test/ui/layout/issue-96158-scalarpair-payload-might-be-uninit.stderr +++ b/src/test/ui/layout/issue-96158-scalarpair-payload-might-be-uninit.stderr @@ -105,11 +105,8 @@ error: layout_of(MissingPayloadField) = Layout { } --> $DIR/issue-96158-scalarpair-payload-might-be-uninit.rs:16:1 | -LL | / pub enum MissingPayloadField { -LL | | Some(u8), -LL | | None -LL | | } - | |_^ +LL | pub enum MissingPayloadField { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: layout_of(CommonPayloadField) = Layout { fields: Arbitrary { @@ -237,11 +234,8 @@ error: layout_of(CommonPayloadField) = Layout { } --> $DIR/issue-96158-scalarpair-payload-might-be-uninit.rs:25:1 | -LL | / pub enum CommonPayloadField { -LL | | A(u8), -LL | | B(u8), -LL | | } - | |_^ +LL | pub enum CommonPayloadField { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: layout_of(CommonPayloadFieldIsMaybeUninit) = Layout { fields: Arbitrary { @@ -366,11 +360,8 @@ error: layout_of(CommonPayloadFieldIsMaybeUninit) = Layout { } --> $DIR/issue-96158-scalarpair-payload-might-be-uninit.rs:33:1 | -LL | / pub enum CommonPayloadFieldIsMaybeUninit { -LL | | A(u8), -LL | | B(MaybeUninit<u8>), -LL | | } - | |_^ +LL | pub enum CommonPayloadFieldIsMaybeUninit { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: layout_of(NicheFirst) = Layout { fields: Arbitrary { @@ -513,12 +504,8 @@ error: layout_of(NicheFirst) = Layout { } --> $DIR/issue-96158-scalarpair-payload-might-be-uninit.rs:41:1 | -LL | / pub enum NicheFirst { -LL | | A(HasNiche, u8), -LL | | B, -LL | | C -LL | | } - | |_^ +LL | pub enum NicheFirst { + | ^^^^^^^^^^^^^^^^^^^ error: layout_of(NicheSecond) = Layout { fields: Arbitrary { @@ -661,12 +648,8 @@ error: layout_of(NicheSecond) = Layout { } --> $DIR/issue-96158-scalarpair-payload-might-be-uninit.rs:50:1 | -LL | / pub enum NicheSecond { -LL | | A(u8, HasNiche), -LL | | B, -LL | | C, -LL | | } - | |_^ +LL | pub enum NicheSecond { + | ^^^^^^^^^^^^^^^^^^^^ error: aborting due to 5 previous errors diff --git a/src/test/ui/layout/thumb-enum.stderr b/src/test/ui/layout/thumb-enum.stderr index 9db9ad5a784..e6ed626d5f1 100644 --- a/src/test/ui/layout/thumb-enum.stderr +++ b/src/test/ui/layout/thumb-enum.stderr @@ -66,7 +66,7 @@ error: layout_of(A) = Layout { --> $DIR/thumb-enum.rs:16:1 | LL | enum A { Apple } - | ^^^^^^^^^^^^^^^^ + | ^^^^^^ error: layout_of(B) = Layout { fields: Arbitrary { @@ -136,7 +136,7 @@ error: layout_of(B) = Layout { --> $DIR/thumb-enum.rs:20:1 | LL | enum B { Banana = 255, } - | ^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^ error: layout_of(C) = Layout { fields: Arbitrary { @@ -206,7 +206,7 @@ error: layout_of(C) = Layout { --> $DIR/thumb-enum.rs:24:1 | LL | enum C { Chaenomeles = 256, } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^ error: layout_of(P) = Layout { fields: Arbitrary { @@ -276,7 +276,7 @@ error: layout_of(P) = Layout { --> $DIR/thumb-enum.rs:28:1 | LL | enum P { Peach = 0x1000_0000isize, } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^ error: layout_of(T) = Layout { fields: Arbitrary { @@ -346,7 +346,7 @@ error: layout_of(T) = Layout { --> $DIR/thumb-enum.rs:34:1 | LL | enum T { Tangerine = TANGERINE as isize } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^ error: aborting due to 5 previous errors diff --git a/src/test/ui/layout/zero-sized-array-union.stderr b/src/test/ui/layout/zero-sized-array-union.stderr index 8faf8593294..de2b863e4ca 100644 --- a/src/test/ui/layout/zero-sized-array-union.stderr +++ b/src/test/ui/layout/zero-sized-array-union.stderr @@ -2,25 +2,25 @@ error: homogeneous_aggregate: Ok(Homogeneous(Reg { kind: Float, size: Size(4 byt --> $DIR/zero-sized-array-union.rs:59:1 | LL | type TestBaz1 = Baz1; - | ^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^ error: homogeneous_aggregate: Ok(Homogeneous(Reg { kind: Float, size: Size(4 bytes) })) --> $DIR/zero-sized-array-union.rs:70:1 | LL | type TestBaz2 = Baz2; - | ^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^ error: homogeneous_aggregate: Ok(Homogeneous(Reg { kind: Float, size: Size(4 bytes) })) --> $DIR/zero-sized-array-union.rs:81:1 | LL | type TestBaz3 = Baz3; - | ^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^ error: homogeneous_aggregate: Ok(Homogeneous(Reg { kind: Float, size: Size(4 bytes) })) --> $DIR/zero-sized-array-union.rs:92:1 | LL | type TestBaz4 = Baz4; - | ^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^ error: aborting due to 4 previous errors diff --git a/src/test/ui/lazy-type-alias-impl-trait/branches.rs b/src/test/ui/lazy-type-alias-impl-trait/branches.rs index aa172f3f19b..95239e2e341 100644 --- a/src/test/ui/lazy-type-alias-impl-trait/branches.rs +++ b/src/test/ui/lazy-type-alias-impl-trait/branches.rs @@ -7,8 +7,19 @@ fn foo(b: bool) -> Foo { vec![42_i32] } else { std::iter::empty().collect() - //~^ ERROR `Foo` cannot be built from an iterator over elements of type `_` } } +type Bar = impl std::fmt::Debug; + +fn bar(b: bool) -> Bar { + let x: Bar = if b { + vec![42_i32] + } else { + std::iter::empty().collect() + //~^ ERROR a value of type `Bar` cannot be built from an iterator over elements of type `_` + }; + x +} + fn main() {} diff --git a/src/test/ui/lazy-type-alias-impl-trait/branches.stderr b/src/test/ui/lazy-type-alias-impl-trait/branches.stderr index c3902f34706..6b87da0c040 100644 --- a/src/test/ui/lazy-type-alias-impl-trait/branches.stderr +++ b/src/test/ui/lazy-type-alias-impl-trait/branches.stderr @@ -1,10 +1,10 @@ -error[E0277]: a value of type `Foo` cannot be built from an iterator over elements of type `_` - --> $DIR/branches.rs:9:28 +error[E0277]: a value of type `Bar` cannot be built from an iterator over elements of type `_` + --> $DIR/branches.rs:19:28 | LL | std::iter::empty().collect() - | ^^^^^^^ value of type `Foo` cannot be built from `std::iter::Iterator<Item=_>` + | ^^^^^^^ value of type `Bar` cannot be built from `std::iter::Iterator<Item=_>` | - = help: the trait `FromIterator<_>` is not implemented for `Foo` + = help: the trait `FromIterator<_>` is not implemented for `Bar` note: required by a bound in `collect` --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL | diff --git a/src/test/ui/lazy-type-alias-impl-trait/branches2.rs b/src/test/ui/lazy-type-alias-impl-trait/branches2.rs index af605e4d806..04218f5643d 100644 --- a/src/test/ui/lazy-type-alias-impl-trait/branches2.rs +++ b/src/test/ui/lazy-type-alias-impl-trait/branches2.rs @@ -1,6 +1,6 @@ #![feature(type_alias_impl_trait)] -// run-pass +// check-pass type Foo = impl std::iter::FromIterator<i32> + PartialEq<Vec<i32>> + std::fmt::Debug; diff --git a/src/test/ui/lazy-type-alias-impl-trait/branches3.rs b/src/test/ui/lazy-type-alias-impl-trait/branches3.rs new file mode 100644 index 00000000000..30c0af8a5dc --- /dev/null +++ b/src/test/ui/lazy-type-alias-impl-trait/branches3.rs @@ -0,0 +1,36 @@ +#![feature(type_alias_impl_trait)] + +type Foo = impl for<'a> FnOnce(&'a str) -> usize; +type Bar = impl FnOnce(&'static str) -> usize; + +fn foo() -> Foo { + if true { + |s| s.len() //~ ERROR type annotations needed + } else { + panic!() + } +} +fn bar() -> Bar { + if true { + |s| s.len() //~ ERROR type annotations needed + } else { + panic!() + } +} + +fn foo2() -> impl for<'a> FnOnce(&'a str) -> usize { + if true { + |s| s.len() //~ ERROR type annotations needed + } else { + panic!() + } +} +fn bar2() -> impl FnOnce(&'static str) -> usize { + if true { + |s| s.len() //~ ERROR type annotations needed + } else { + panic!() + } +} + +fn main() {} diff --git a/src/test/ui/lazy-type-alias-impl-trait/branches3.stderr b/src/test/ui/lazy-type-alias-impl-trait/branches3.stderr new file mode 100644 index 00000000000..420104e526d --- /dev/null +++ b/src/test/ui/lazy-type-alias-impl-trait/branches3.stderr @@ -0,0 +1,47 @@ +error[E0282]: type annotations needed + --> $DIR/branches3.rs:8:10 + | +LL | |s| s.len() + | ^ - type must be known at this point + | +help: consider giving this closure parameter an explicit type + | +LL | |s: _| s.len() + | +++ + +error[E0282]: type annotations needed + --> $DIR/branches3.rs:15:10 + | +LL | |s| s.len() + | ^ - type must be known at this point + | +help: consider giving this closure parameter an explicit type + | +LL | |s: _| s.len() + | +++ + +error[E0282]: type annotations needed + --> $DIR/branches3.rs:23:10 + | +LL | |s| s.len() + | ^ - type must be known at this point + | +help: consider giving this closure parameter an explicit type + | +LL | |s: _| s.len() + | +++ + +error[E0282]: type annotations needed + --> $DIR/branches3.rs:30:10 + | +LL | |s| s.len() + | ^ - type must be known at this point + | +help: consider giving this closure parameter an explicit type + | +LL | |s: _| s.len() + | +++ + +error: aborting due to 4 previous errors + +For more information about this error, try `rustc --explain E0282`. diff --git a/src/test/ui/lazy-type-alias-impl-trait/recursion2.rs b/src/test/ui/lazy-type-alias-impl-trait/recursion2.rs index 1cc64ea17e7..6b3d9ff4cde 100644 --- a/src/test/ui/lazy-type-alias-impl-trait/recursion2.rs +++ b/src/test/ui/lazy-type-alias-impl-trait/recursion2.rs @@ -1,5 +1,7 @@ #![feature(type_alias_impl_trait)] +// check-pass + type Foo = impl std::fmt::Debug; fn foo(b: bool) -> Foo { @@ -7,7 +9,7 @@ fn foo(b: bool) -> Foo { return vec![]; } let x: Vec<i32> = foo(false); - std::iter::empty().collect() //~ ERROR `Foo` cannot be built from an iterator + std::iter::empty().collect() } fn bar(b: bool) -> impl std::fmt::Debug { diff --git a/src/test/ui/lazy-type-alias-impl-trait/recursion2.stderr b/src/test/ui/lazy-type-alias-impl-trait/recursion2.stderr deleted file mode 100644 index 1f6201a8300..00000000000 --- a/src/test/ui/lazy-type-alias-impl-trait/recursion2.stderr +++ /dev/null @@ -1,16 +0,0 @@ -error[E0277]: a value of type `Foo` cannot be built from an iterator over elements of type `_` - --> $DIR/recursion2.rs:10:24 - | -LL | std::iter::empty().collect() - | ^^^^^^^ value of type `Foo` cannot be built from `std::iter::Iterator<Item=_>` - | - = help: the trait `FromIterator<_>` is not implemented for `Foo` -note: required by a bound in `collect` - --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL - | -LL | fn collect<B: FromIterator<Self::Item>>(self) -> B - | ^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `collect` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/lifetimes/issue-34979.stderr b/src/test/ui/lifetimes/issue-34979.stderr index 1b97f8d818a..5832c4d173c 100644 --- a/src/test/ui/lifetimes/issue-34979.stderr +++ b/src/test/ui/lifetimes/issue-34979.stderr @@ -1,8 +1,8 @@ -error[E0283]: type annotations needed +error[E0283]: type annotations needed: cannot satisfy `&'a (): Foo` --> $DIR/issue-34979.rs:6:13 | LL | &'a (): Foo, - | ^^^ cannot infer type for reference `&'a ()` + | ^^^ | = note: cannot satisfy `&'a (): Foo` diff --git a/src/test/ui/lifetimes/lifetime-doesnt-live-long-enough.stderr b/src/test/ui/lifetimes/lifetime-doesnt-live-long-enough.stderr index 33f6c498b6f..affb4e8d044 100644 --- a/src/test/ui/lifetimes/lifetime-doesnt-live-long-enough.stderr +++ b/src/test/ui/lifetimes/lifetime-doesnt-live-long-enough.stderr @@ -10,6 +10,28 @@ LL | struct Foo<T: 'static> { | +++++++++ error[E0309]: the parameter type `K` may not live long enough + --> $DIR/lifetime-doesnt-live-long-enough.rs:41:33 + | +LL | fn generic_in_parent<'a, L: X<&'a Nested<K>>>() { + | ^^^^^^^^^^^^^^^^ ...so that the reference type `&'a Nested<K>` does not outlive the data it points at + | +help: consider adding an explicit lifetime bound... + | +LL | impl<K: 'a> Nested<K> { + | ++++ + +error[E0309]: the parameter type `M` may not live long enough + --> $DIR/lifetime-doesnt-live-long-enough.rs:44:36 + | +LL | fn generic_in_child<'a, 'b, L: X<&'a Nested<M>>, M: 'b>() { + | ^^^^^^^^^^^^^^^^ ...so that the reference type `&'a Nested<M>` does not outlive the data it points at + | +help: consider adding an explicit lifetime bound... + | +LL | fn generic_in_child<'a, 'b, L: X<&'a Nested<M>>, M: 'b + 'a>() { + | ++++ + +error[E0309]: the parameter type `K` may not live long enough --> $DIR/lifetime-doesnt-live-long-enough.rs:24:19 | LL | fn foo<'a, L: X<&'a Nested<K>>>(); @@ -40,28 +62,6 @@ help: consider adding an explicit lifetime bound... LL | fn baz<'a, L: 'a, M: X<&'a Nested<L>>>() { | ++++ -error[E0309]: the parameter type `K` may not live long enough - --> $DIR/lifetime-doesnt-live-long-enough.rs:41:33 - | -LL | fn generic_in_parent<'a, L: X<&'a Nested<K>>>() { - | ^^^^^^^^^^^^^^^^ ...so that the reference type `&'a Nested<K>` does not outlive the data it points at - | -help: consider adding an explicit lifetime bound... - | -LL | impl<K: 'a> Nested<K> { - | ++++ - -error[E0309]: the parameter type `M` may not live long enough - --> $DIR/lifetime-doesnt-live-long-enough.rs:44:36 - | -LL | fn generic_in_child<'a, 'b, L: X<&'a Nested<M>>, M: 'b>() { - | ^^^^^^^^^^^^^^^^ ...so that the reference type `&'a Nested<M>` does not outlive the data it points at - | -help: consider adding an explicit lifetime bound... - | -LL | fn generic_in_child<'a, 'b, L: X<&'a Nested<M>>, M: 'b + 'a>() { - | ++++ - error: aborting due to 6 previous errors Some errors have detailed explanations: E0309, E0310. diff --git a/src/test/ui/lifetimes/re-empty-in-error.stderr b/src/test/ui/lifetimes/re-empty-in-error.stderr index 3a5ab62ab96..72bb0782f4b 100644 --- a/src/test/ui/lifetimes/re-empty-in-error.stderr +++ b/src/test/ui/lifetimes/re-empty-in-error.stderr @@ -4,7 +4,7 @@ error: higher-ranked lifetime error LL | foo(&10); | ^^^^^^^^ | - = note: could not prove for<'b, 'r> &'b (): 'r + = note: could not prove `for<'b, 'r> &'b (): 'r` error: aborting due to previous error diff --git a/src/test/ui/limits/issue-56762.stderr b/src/test/ui/limits/issue-56762.stderr index f26ef280b20..e6b9c676278 100644 --- a/src/test/ui/limits/issue-56762.stderr +++ b/src/test/ui/limits/issue-56762.stderr @@ -2,13 +2,13 @@ error[E0080]: values of the type `[u8; 2305843009213693951]` are too big for the --> $DIR/issue-56762.rs:19:1 | LL | static MY_TOO_BIG_ARRAY_1: TooBigArray = TooBigArray::new(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0080]: values of the type `[u8; 2305843009213693951]` are too big for the current architecture --> $DIR/issue-56762.rs:21:1 | LL | static MY_TOO_BIG_ARRAY_2: [u8; HUGE_SIZE] = [0x00; HUGE_SIZE]; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/linkage-attr/linkage-detect-extern-generated-name-collision.stderr b/src/test/ui/linkage-attr/linkage-detect-extern-generated-name-collision.stderr index dcb954a4bc0..06a07082263 100644 --- a/src/test/ui/linkage-attr/linkage-detect-extern-generated-name-collision.stderr +++ b/src/test/ui/linkage-attr/linkage-detect-extern-generated-name-collision.stderr @@ -2,7 +2,7 @@ error: symbol `collision` is already defined --> $DIR/auxiliary/def_colliding_external.rs:6:5 | LL | pub static collision: *const i32; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/linkage-attr/linkage-detect-local-generated-name-collision.stderr b/src/test/ui/linkage-attr/linkage-detect-local-generated-name-collision.stderr index 7e395e67378..e0be1ac2117 100644 --- a/src/test/ui/linkage-attr/linkage-detect-local-generated-name-collision.stderr +++ b/src/test/ui/linkage-attr/linkage-detect-local-generated-name-collision.stderr @@ -2,7 +2,7 @@ error: symbol `collision` is already defined --> $DIR/linkage-detect-local-generated-name-collision.rs:10:9 | LL | pub static collision: *const i32; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/linkage-attr/linkage-requires-raw-ptr.stderr b/src/test/ui/linkage-attr/linkage-requires-raw-ptr.stderr index a80b495f97f..5abbe745c6a 100644 --- a/src/test/ui/linkage-attr/linkage-requires-raw-ptr.stderr +++ b/src/test/ui/linkage-attr/linkage-requires-raw-ptr.stderr @@ -2,7 +2,7 @@ error: must have type `*const T` or `*mut T` due to `#[linkage]` attribute --> $DIR/auxiliary/def_illtyped_external.rs:5:1 | LL | pub static EXTERN: u32 = 0; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/linkage-attr/linkage2.stderr b/src/test/ui/linkage-attr/linkage2.stderr index 6ffe07170ed..a6ac0aad077 100644 --- a/src/test/ui/linkage-attr/linkage2.stderr +++ b/src/test/ui/linkage-attr/linkage2.stderr @@ -2,7 +2,7 @@ error: must have type `*const T` or `*mut T` due to `#[linkage]` attribute --> $DIR/linkage2.rs:12:5 | LL | static foo: i32; - | ^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/linkage-attr/linkage3.stderr b/src/test/ui/linkage-attr/linkage3.stderr index 0cbac28349d..f2579c6e850 100644 --- a/src/test/ui/linkage-attr/linkage3.stderr +++ b/src/test/ui/linkage-attr/linkage3.stderr @@ -2,7 +2,7 @@ error: invalid linkage specified --> $DIR/linkage3.rs:11:5 | LL | static foo: *const i32; - | ^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/lint/dead-code/impl-trait.stderr b/src/test/ui/lint/dead-code/impl-trait.stderr index 9c47c1b5355..e35e13a9ec6 100644 --- a/src/test/ui/lint/dead-code/impl-trait.stderr +++ b/src/test/ui/lint/dead-code/impl-trait.stderr @@ -1,8 +1,8 @@ error: type alias `Unused` is never used - --> $DIR/impl-trait.rs:12:1 + --> $DIR/impl-trait.rs:12:6 | LL | type Unused = (); - | ^^^^^^^^^^^^^^^^^ + | ^^^^^^ | note: the lint level is defined here --> $DIR/impl-trait.rs:1:9 diff --git a/src/test/ui/lint/dead-code/issue-85255.stderr b/src/test/ui/lint/dead-code/issue-85255.stderr index 7ebbebb1aba..3497b952fdd 100644 --- a/src/test/ui/lint/dead-code/issue-85255.stderr +++ b/src/test/ui/lint/dead-code/issue-85255.stderr @@ -4,9 +4,9 @@ warning: fields `a` and `b` are never read LL | struct Foo { | --- fields in this struct LL | a: i32, - | ^^^^^^ + | ^ LL | pub b: i32, - | ^^^^^^^^^^ + | ^ | note: the lint level is defined here --> $DIR/issue-85255.rs:4:9 @@ -14,6 +14,26 @@ note: the lint level is defined here LL | #![warn(dead_code)] | ^^^^^^^^^ +warning: fields `a` and `b` are never read + --> $DIR/issue-85255.rs:19:5 + | +LL | pub(crate) struct Foo1 { + | ---- fields in this struct +LL | a: i32, + | ^ +LL | pub b: i32, + | ^ + +warning: fields `a` and `b` are never read + --> $DIR/issue-85255.rs:31:5 + | +LL | pub(crate) struct Foo2 { + | ---- fields in this struct +LL | a: i32, + | ^ +LL | pub b: i32, + | ^ + warning: associated function `a` is never used --> $DIR/issue-85255.rs:14:8 | @@ -26,16 +46,6 @@ warning: associated function `b` is never used LL | pub fn b(&self) -> i32 { 6 } | ^ -warning: fields `a` and `b` are never read - --> $DIR/issue-85255.rs:19:5 - | -LL | pub(crate) struct Foo1 { - | ---- fields in this struct -LL | a: i32, - | ^^^^^^ -LL | pub b: i32, - | ^^^^^^^^^^ - warning: associated function `a` is never used --> $DIR/issue-85255.rs:26:8 | @@ -48,16 +58,6 @@ warning: associated function `b` is never used LL | pub fn b(&self) -> i32 { 6 } | ^ -warning: fields `a` and `b` are never read - --> $DIR/issue-85255.rs:31:5 - | -LL | pub(crate) struct Foo2 { - | ---- fields in this struct -LL | a: i32, - | ^^^^^^ -LL | pub b: i32, - | ^^^^^^^^^^ - warning: associated function `a` is never used --> $DIR/issue-85255.rs:38:8 | diff --git a/src/test/ui/lint/dead-code/lint-dead-code-1.stderr b/src/test/ui/lint/dead-code/lint-dead-code-1.stderr index 2eddc4ce21c..eb728b5b930 100644 --- a/src/test/ui/lint/dead-code/lint-dead-code-1.stderr +++ b/src/test/ui/lint/dead-code/lint-dead-code-1.stderr @@ -1,8 +1,8 @@ error: static `priv_static` is never used - --> $DIR/lint-dead-code-1.rs:20:1 + --> $DIR/lint-dead-code-1.rs:20:8 | LL | static priv_static: isize = 0; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^ | note: the lint level is defined here --> $DIR/lint-dead-code-1.rs:5:9 @@ -11,10 +11,10 @@ LL | #![deny(dead_code)] | ^^^^^^^^^ error: constant `priv_const` is never used - --> $DIR/lint-dead-code-1.rs:27:1 + --> $DIR/lint-dead-code-1.rs:27:7 | LL | const priv_const: isize = 0; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^ error: struct `PrivStruct` is never constructed --> $DIR/lint-dead-code-1.rs:35:8 diff --git a/src/test/ui/lint/dead-code/lint-dead-code-3.rs b/src/test/ui/lint/dead-code/lint-dead-code-3.rs index c3e56063dc3..293fcdbc5ee 100644 --- a/src/test/ui/lint/dead-code/lint-dead-code-3.rs +++ b/src/test/ui/lint/dead-code/lint-dead-code-3.rs @@ -73,7 +73,18 @@ mod inner { fn f() {} } +fn anon_const() -> [(); { + fn blah() {} //~ ERROR: function `blah` is never used + 1 +}] { + [(); { + fn blah() {} //~ ERROR: function `blah` is never used + 1 + }] +} + pub fn foo() { let a: &dyn inner::Trait = &1_isize; a.f(); + anon_const(); } diff --git a/src/test/ui/lint/dead-code/lint-dead-code-3.stderr b/src/test/ui/lint/dead-code/lint-dead-code-3.stderr index af59c6fec1f..26fc13bae08 100644 --- a/src/test/ui/lint/dead-code/lint-dead-code-3.stderr +++ b/src/test/ui/lint/dead-code/lint-dead-code-3.stderr @@ -10,12 +10,6 @@ note: the lint level is defined here LL | #![deny(dead_code)] | ^^^^^^^^^ -error: associated function `foo` is never used - --> $DIR/lint-dead-code-3.rs:16:8 - | -LL | fn foo(&self) { - | ^^^ - error: function `bar` is never used --> $DIR/lint-dead-code-3.rs:21:4 | @@ -28,11 +22,29 @@ error: enum `c_void` is never used LL | enum c_void {} | ^^^^^^ +error: function `blah` is never used + --> $DIR/lint-dead-code-3.rs:77:8 + | +LL | fn blah() {} + | ^^^^ + +error: function `blah` is never used + --> $DIR/lint-dead-code-3.rs:81:12 + | +LL | fn blah() {} + | ^^^^ + +error: associated function `foo` is never used + --> $DIR/lint-dead-code-3.rs:16:8 + | +LL | fn foo(&self) { + | ^^^ + error: function `free` is never used - --> $DIR/lint-dead-code-3.rs:62:5 + --> $DIR/lint-dead-code-3.rs:62:8 | LL | fn free(p: *const c_void); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^ -error: aborting due to 5 previous errors +error: aborting due to 7 previous errors diff --git a/src/test/ui/lint/dead-code/lint-dead-code-4.stderr b/src/test/ui/lint/dead-code/lint-dead-code-4.stderr index dcd810b3e48..668c1dacf95 100644 --- a/src/test/ui/lint/dead-code/lint-dead-code-4.stderr +++ b/src/test/ui/lint/dead-code/lint-dead-code-4.stderr @@ -5,7 +5,7 @@ LL | struct Foo { | --- field in this struct LL | x: usize, LL | b: bool, - | ^^^^^^^ + | ^ | note: the lint level is defined here --> $DIR/lint-dead-code-4.rs:3:9 @@ -16,16 +16,12 @@ LL | #![deny(dead_code)] error: variants `X` and `Y` are never constructed --> $DIR/lint-dead-code-4.rs:15:5 | -LL | enum XYZ { - | --- variants in this enum -LL | X, - | ^ -LL | / Y { -LL | | a: String, -LL | | b: i32, -LL | | c: i32, -LL | | }, - | |_____^ +LL | enum XYZ { + | --- variants in this enum +LL | X, + | ^ +LL | Y { + | ^ error: enum `ABC` is never used --> $DIR/lint-dead-code-4.rs:24:6 @@ -36,13 +32,13 @@ LL | enum ABC { error: fields `b` and `c` are never read --> $DIR/lint-dead-code-4.rs:39:9 | -LL | enum IJK { - | --- fields in this enum -... +LL | J { + | - fields in this variant +LL | a: String, LL | b: i32, - | ^^^^^^ + | ^ LL | c: i32, - | ^^^^^^ + | ^ error: variants `I` and `K` are never constructed --> $DIR/lint-dead-code-4.rs:36:5 @@ -61,10 +57,10 @@ error: fields `x` and `c` are never read LL | struct Bar { | --- fields in this struct LL | x: usize, - | ^^^^^^^^ + | ^ LL | b: bool, LL | c: bool, - | ^^^^^^^ + | ^ error: aborting due to 6 previous errors diff --git a/src/test/ui/lint/dead-code/lint-dead-code-5.stderr b/src/test/ui/lint/dead-code/lint-dead-code-5.stderr index 037a9be22ad..eaf43e45361 100644 --- a/src/test/ui/lint/dead-code/lint-dead-code-5.stderr +++ b/src/test/ui/lint/dead-code/lint-dead-code-5.stderr @@ -20,9 +20,9 @@ LL | enum Enum2 { | ----- variants in this enum ... LL | Variant5 { _x: isize }, - | ^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^ LL | Variant6(isize), - | ^^^^^^^^^^^^^^^ + | ^^^^^^^^ error: enum `Enum3` is never used --> $DIR/lint-dead-code-5.rs:35:6 diff --git a/src/test/ui/lint/dead-code/multiple-dead-codes-in-the-same-struct.stderr b/src/test/ui/lint/dead-code/multiple-dead-codes-in-the-same-struct.stderr index 5cc8e06c09d..c0f1ed38f6d 100644 --- a/src/test/ui/lint/dead-code/multiple-dead-codes-in-the-same-struct.stderr +++ b/src/test/ui/lint/dead-code/multiple-dead-codes-in-the-same-struct.stderr @@ -5,12 +5,12 @@ LL | struct Bar { | --- fields in this struct ... LL | d: usize, - | ^^^^^^^^ + | ^ ... LL | f: usize, - | ^^^^^^^^ + | ^ LL | g: usize, - | ^^^^^^^^ + | ^ | note: the lint level is defined here --> $DIR/multiple-dead-codes-in-the-same-struct.rs:1:9 @@ -25,10 +25,10 @@ LL | struct Bar { | --- fields in this struct ... LL | c: usize, - | ^^^^^^^^ + | ^ ... LL | e: usize, - | ^^^^^^^^ + | ^ | note: the lint level is defined here --> $DIR/multiple-dead-codes-in-the-same-struct.rs:8:12 @@ -43,7 +43,7 @@ LL | struct Bar { | --- field in this struct ... LL | b: usize, - | ^^^^^^^^ + | ^ | note: the lint level is defined here --> $DIR/multiple-dead-codes-in-the-same-struct.rs:6:14 diff --git a/src/test/ui/lint/dead-code/type-alias.stderr b/src/test/ui/lint/dead-code/type-alias.stderr index 80c6ba962b8..446447d974a 100644 --- a/src/test/ui/lint/dead-code/type-alias.stderr +++ b/src/test/ui/lint/dead-code/type-alias.stderr @@ -1,8 +1,8 @@ error: type alias `Unused` is never used - --> $DIR/type-alias.rs:4:1 + --> $DIR/type-alias.rs:4:6 | LL | type Unused = u8; - | ^^^^^^^^^^^^^^^^^ + | ^^^^^^ | note: the lint level is defined here --> $DIR/type-alias.rs:1:9 diff --git a/src/test/ui/lint/dead-code/unused-struct-variant.stderr b/src/test/ui/lint/dead-code/unused-struct-variant.stderr index b08402b671b..d26dd3aff95 100644 --- a/src/test/ui/lint/dead-code/unused-struct-variant.stderr +++ b/src/test/ui/lint/dead-code/unused-struct-variant.stderr @@ -5,7 +5,7 @@ LL | enum E { | - variant in this enum LL | Foo(F), LL | Bar(B), - | ^^^^^^ + | ^^^ | note: the lint level is defined here --> $DIR/unused-struct-variant.rs:1:9 diff --git a/src/test/ui/lint/force-warn/allowed-cli-deny-by-default-lint.stderr b/src/test/ui/lint/force-warn/allowed-cli-deny-by-default-lint.stderr index c14529a7d09..915b3b86fe8 100644 --- a/src/test/ui/lint/force-warn/allowed-cli-deny-by-default-lint.stderr +++ b/src/test/ui/lint/force-warn/allowed-cli-deny-by-default-lint.stderr @@ -2,9 +2,7 @@ warning: any use of this value will cause an error --> $DIR/allowed-cli-deny-by-default-lint.rs:6:16 | LL | const C: i32 = 1 / 0; - | ---------------^^^^^- - | | - | attempt to divide `1_i32` by zero + | ------------ ^^^^^ attempt to divide `1_i32` by zero | = note: requested on the command line with `--force-warn const-err` = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -17,9 +15,7 @@ warning: any use of this value will cause an error --> $DIR/allowed-cli-deny-by-default-lint.rs:6:16 | LL | const C: i32 = 1 / 0; - | ---------------^^^^^- - | | - | attempt to divide `1_i32` by zero + | ------------ ^^^^^ attempt to divide `1_i32` by zero | = note: requested on the command line with `--force-warn const-err` = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! diff --git a/src/test/ui/lint/force-warn/allowed-deny-by-default-lint.stderr b/src/test/ui/lint/force-warn/allowed-deny-by-default-lint.stderr index dd71a168960..3b36d1d0227 100644 --- a/src/test/ui/lint/force-warn/allowed-deny-by-default-lint.stderr +++ b/src/test/ui/lint/force-warn/allowed-deny-by-default-lint.stderr @@ -2,9 +2,7 @@ warning: any use of this value will cause an error --> $DIR/allowed-deny-by-default-lint.rs:7:16 | LL | const C: i32 = 1 / 0; - | ---------------^^^^^- - | | - | attempt to divide `1_i32` by zero + | ------------ ^^^^^ attempt to divide `1_i32` by zero | = note: requested on the command line with `--force-warn const-err` = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -17,9 +15,7 @@ warning: any use of this value will cause an error --> $DIR/allowed-deny-by-default-lint.rs:7:16 | LL | const C: i32 = 1 / 0; - | ---------------^^^^^- - | | - | attempt to divide `1_i32` by zero + | ------------ ^^^^^ attempt to divide `1_i32` by zero | = note: requested on the command line with `--force-warn const-err` = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! diff --git a/src/test/ui/lint/force-warn/deny-by-default-lint.stderr b/src/test/ui/lint/force-warn/deny-by-default-lint.stderr index d4e80584669..a2e5baa8b9d 100644 --- a/src/test/ui/lint/force-warn/deny-by-default-lint.stderr +++ b/src/test/ui/lint/force-warn/deny-by-default-lint.stderr @@ -2,9 +2,7 @@ warning: any use of this value will cause an error --> $DIR/deny-by-default-lint.rs:5:16 | LL | const C: i32 = 1 / 0; - | ---------------^^^^^- - | | - | attempt to divide `1_i32` by zero + | ------------ ^^^^^ attempt to divide `1_i32` by zero | = note: requested on the command line with `--force-warn const-err` = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -17,9 +15,7 @@ warning: any use of this value will cause an error --> $DIR/deny-by-default-lint.rs:5:16 | LL | const C: i32 = 1 / 0; - | ---------------^^^^^- - | | - | attempt to divide `1_i32` by zero + | ------------ ^^^^^ attempt to divide `1_i32` by zero | = note: requested on the command line with `--force-warn const-err` = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! diff --git a/src/test/ui/lint/issue-14309.stderr b/src/test/ui/lint/issue-14309.stderr index 799991f7ee4..a9538b5e3a4 100644 --- a/src/test/ui/lint/issue-14309.stderr +++ b/src/test/ui/lint/issue-14309.stderr @@ -14,10 +14,8 @@ LL | #![deny(improper_ctypes)] note: the type is defined here --> $DIR/issue-14309.rs:4:1 | -LL | / struct A { -LL | | x: i32 -LL | | } - | |_^ +LL | struct A { + | ^^^^^^^^ error: `extern` block uses type `A`, which is not FFI-safe --> $DIR/issue-14309.rs:31:15 @@ -30,10 +28,8 @@ LL | fn bar(x: B); note: the type is defined here --> $DIR/issue-14309.rs:4:1 | -LL | / struct A { -LL | | x: i32 -LL | | } - | |_^ +LL | struct A { + | ^^^^^^^^ error: `extern` block uses type `A`, which is not FFI-safe --> $DIR/issue-14309.rs:33:15 @@ -46,10 +42,8 @@ LL | fn qux(x: A2); note: the type is defined here --> $DIR/issue-14309.rs:4:1 | -LL | / struct A { -LL | | x: i32 -LL | | } - | |_^ +LL | struct A { + | ^^^^^^^^ error: `extern` block uses type `A`, which is not FFI-safe --> $DIR/issue-14309.rs:34:16 @@ -62,10 +56,8 @@ LL | fn quux(x: B2); note: the type is defined here --> $DIR/issue-14309.rs:4:1 | -LL | / struct A { -LL | | x: i32 -LL | | } - | |_^ +LL | struct A { + | ^^^^^^^^ error: `extern` block uses type `A`, which is not FFI-safe --> $DIR/issue-14309.rs:36:16 @@ -78,10 +70,8 @@ LL | fn fred(x: D); note: the type is defined here --> $DIR/issue-14309.rs:4:1 | -LL | / struct A { -LL | | x: i32 -LL | | } - | |_^ +LL | struct A { + | ^^^^^^^^ error: aborting due to 5 previous errors diff --git a/src/test/ui/lint/issue-17718-const-naming.stderr b/src/test/ui/lint/issue-17718-const-naming.stderr index 4c97f6d63d4..7d2aadd5f80 100644 --- a/src/test/ui/lint/issue-17718-const-naming.stderr +++ b/src/test/ui/lint/issue-17718-const-naming.stderr @@ -1,8 +1,8 @@ error: constant `foo` is never used - --> $DIR/issue-17718-const-naming.rs:4:1 + --> $DIR/issue-17718-const-naming.rs:4:7 | LL | const foo: isize = 3; - | ^^^^^^^^^^^^^^^^^^^^^ + | ^^^ | note: the lint level is defined here --> $DIR/issue-17718-const-naming.rs:2:9 diff --git a/src/test/ui/lint/lint-const-item-mutation.stderr b/src/test/ui/lint/lint-const-item-mutation.stderr index 540e076c7e4..94d876423e7 100644 --- a/src/test/ui/lint/lint-const-item-mutation.stderr +++ b/src/test/ui/lint/lint-const-item-mutation.stderr @@ -10,7 +10,7 @@ note: `const` item defined here --> $DIR/lint-const-item-mutation.rs:26:1 | LL | const ARRAY: [u8; 1] = [25]; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^ warning: attempting to modify a `const` item --> $DIR/lint-const-item-mutation.rs:38:5 @@ -23,7 +23,7 @@ note: `const` item defined here --> $DIR/lint-const-item-mutation.rs:27:1 | LL | const MY_STRUCT: MyStruct = MyStruct { field: true, inner_array: ['a'], raw_ptr: 2 as *mut u8 }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^ warning: attempting to modify a `const` item --> $DIR/lint-const-item-mutation.rs:39:5 @@ -36,7 +36,7 @@ note: `const` item defined here --> $DIR/lint-const-item-mutation.rs:27:1 | LL | const MY_STRUCT: MyStruct = MyStruct { field: true, inner_array: ['a'], raw_ptr: 2 as *mut u8 }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^ warning: taking a mutable reference to a `const` item --> $DIR/lint-const-item-mutation.rs:40:5 @@ -55,7 +55,7 @@ note: `const` item defined here --> $DIR/lint-const-item-mutation.rs:27:1 | LL | const MY_STRUCT: MyStruct = MyStruct { field: true, inner_array: ['a'], raw_ptr: 2 as *mut u8 }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^ warning: taking a mutable reference to a `const` item --> $DIR/lint-const-item-mutation.rs:41:5 @@ -69,7 +69,7 @@ note: `const` item defined here --> $DIR/lint-const-item-mutation.rs:27:1 | LL | const MY_STRUCT: MyStruct = MyStruct { field: true, inner_array: ['a'], raw_ptr: 2 as *mut u8 }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^ warning: taking a mutable reference to a `const` item --> $DIR/lint-const-item-mutation.rs:42:5 @@ -83,7 +83,7 @@ note: `const` item defined here --> $DIR/lint-const-item-mutation.rs:27:1 | LL | const MY_STRUCT: MyStruct = MyStruct { field: true, inner_array: ['a'], raw_ptr: 2 as *mut u8 }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^ warning: attempting to modify a `const` item --> $DIR/lint-const-item-mutation.rs:54:5 @@ -96,7 +96,7 @@ note: `const` item defined here --> $DIR/lint-const-item-mutation.rs:30:1 | LL | const MUTABLE2: Mutable2 = Mutable2 { msg: "", other: String::new() }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^ warning: taking a mutable reference to a `const` item --> $DIR/lint-const-item-mutation.rs:55:5 @@ -115,7 +115,7 @@ note: `const` item defined here --> $DIR/lint-const-item-mutation.rs:31:1 | LL | const VEC: Vec<i32> = Vec::new(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^ warning: 8 warnings emitted diff --git a/src/test/ui/lint/lint-ctypes-enum.stderr b/src/test/ui/lint/lint-ctypes-enum.stderr index 1601bd9d629..de532f69ac0 100644 --- a/src/test/ui/lint/lint-ctypes-enum.stderr +++ b/src/test/ui/lint/lint-ctypes-enum.stderr @@ -14,10 +14,8 @@ LL | #![deny(improper_ctypes)] note: the type is defined here --> $DIR/lint-ctypes-enum.rs:9:1 | -LL | / enum U { -LL | | A, -LL | | } - | |_^ +LL | enum U { + | ^^^^^^ error: `extern` block uses type `B`, which is not FFI-safe --> $DIR/lint-ctypes-enum.rs:61:13 @@ -30,11 +28,8 @@ LL | fn bf(x: B); note: the type is defined here --> $DIR/lint-ctypes-enum.rs:12:1 | -LL | / enum B { -LL | | C, -LL | | D, -LL | | } - | |_^ +LL | enum B { + | ^^^^^^ error: `extern` block uses type `T`, which is not FFI-safe --> $DIR/lint-ctypes-enum.rs:62:13 @@ -47,12 +42,8 @@ LL | fn tf(x: T); note: the type is defined here --> $DIR/lint-ctypes-enum.rs:16:1 | -LL | / enum T { -LL | | E, -LL | | F, -LL | | G, -LL | | } - | |_^ +LL | enum T { + | ^^^^^^ error: `extern` block uses type `u128`, which is not FFI-safe --> $DIR/lint-ctypes-enum.rs:74:23 diff --git a/src/test/ui/lint/lint-ctypes-fn.stderr b/src/test/ui/lint/lint-ctypes-fn.stderr index 740075ca7df..6f8d76411aa 100644 --- a/src/test/ui/lint/lint-ctypes-fn.stderr +++ b/src/test/ui/lint/lint-ctypes-fn.stderr @@ -100,7 +100,7 @@ note: the type is defined here --> $DIR/lint-ctypes-fn.rs:28:1 | LL | pub struct ZeroSize; - | ^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^ error: `extern` fn uses type `ZeroSizeWithPhantomData`, which is not FFI-safe --> $DIR/lint-ctypes-fn.rs:110:40 @@ -113,7 +113,7 @@ note: the type is defined here --> $DIR/lint-ctypes-fn.rs:63:1 | LL | pub struct ZeroSizeWithPhantomData(PhantomData<i32>); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: `extern` fn uses type `PhantomData<bool>`, which is not FFI-safe --> $DIR/lint-ctypes-fn.rs:113:51 diff --git a/src/test/ui/lint/lint-ctypes.stderr b/src/test/ui/lint/lint-ctypes.stderr index 342b6bfc6f8..bfec40e1955 100644 --- a/src/test/ui/lint/lint-ctypes.stderr +++ b/src/test/ui/lint/lint-ctypes.stderr @@ -15,7 +15,7 @@ note: the type is defined here --> $DIR/lint-ctypes.rs:26:1 | LL | pub struct Foo; - | ^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^ error: `extern` block uses type `Foo`, which is not FFI-safe --> $DIR/lint-ctypes.rs:49:28 @@ -29,7 +29,7 @@ note: the type is defined here --> $DIR/lint-ctypes.rs:26:1 | LL | pub struct Foo; - | ^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^ error: `extern` block uses type `((),)`, which is not FFI-safe --> $DIR/lint-ctypes.rs:51:25 @@ -139,7 +139,7 @@ note: the type is defined here --> $DIR/lint-ctypes.rs:22:1 | LL | pub struct ZeroSize; - | ^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^ error: `extern` block uses type `ZeroSizeWithPhantomData`, which is not FFI-safe --> $DIR/lint-ctypes.rs:64:33 @@ -152,7 +152,7 @@ note: the type is defined here --> $DIR/lint-ctypes.rs:45:1 | LL | pub struct ZeroSizeWithPhantomData(::std::marker::PhantomData<i32>); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: `extern` block uses type `PhantomData<bool>`, which is not FFI-safe --> $DIR/lint-ctypes.rs:67:12 diff --git a/src/test/ui/lint/lint-invalid-atomic-ordering-exchange-weak.rs b/src/test/ui/lint/lint-invalid-atomic-ordering-exchange-weak.rs index c79c1daf774..0e0d604ae04 100644 --- a/src/test/ui/lint/lint-invalid-atomic-ordering-exchange-weak.rs +++ b/src/test/ui/lint/lint-invalid-atomic-ordering-exchange-weak.rs @@ -20,43 +20,43 @@ fn main() { // AcqRel is always forbidden as a failure ordering let _ = x.compare_exchange_weak(ptr2, ptr, Ordering::Relaxed, Ordering::AcqRel); - //~^ ERROR compare_exchange_weak's failure ordering may not be `Release` or `AcqRel` + //~^ ERROR `compare_exchange_weak`'s failure ordering may not be `Release` or `AcqRel` let _ = x.compare_exchange_weak(ptr2, ptr, Ordering::Acquire, Ordering::AcqRel); - //~^ ERROR compare_exchange_weak's failure ordering may not be `Release` or `AcqRel` + //~^ ERROR `compare_exchange_weak`'s failure ordering may not be `Release` or `AcqRel` let _ = x.compare_exchange_weak(ptr2, ptr, Ordering::Release, Ordering::AcqRel); - //~^ ERROR compare_exchange_weak's failure ordering may not be `Release` or `AcqRel` + //~^ ERROR `compare_exchange_weak`'s failure ordering may not be `Release` or `AcqRel` let _ = x.compare_exchange_weak(ptr2, ptr, Ordering::AcqRel, Ordering::AcqRel); - //~^ ERROR compare_exchange_weak's failure ordering may not be `Release` or `AcqRel` + //~^ ERROR `compare_exchange_weak`'s failure ordering may not be `Release` or `AcqRel` let _ = x.compare_exchange_weak(ptr2, ptr, Ordering::SeqCst, Ordering::AcqRel); - //~^ ERROR compare_exchange_weak's failure ordering may not be `Release` or `AcqRel` + //~^ ERROR `compare_exchange_weak`'s failure ordering may not be `Release` or `AcqRel` // Release is always forbidden as a failure ordering let _ = x.compare_exchange_weak(ptr, ptr2, Ordering::Relaxed, Ordering::Release); - //~^ ERROR compare_exchange_weak's failure ordering may not be `Release` or `AcqRel` + //~^ ERROR `compare_exchange_weak`'s failure ordering may not be `Release` or `AcqRel` let _ = x.compare_exchange_weak(ptr, ptr2, Ordering::Acquire, Ordering::Release); - //~^ ERROR compare_exchange_weak's failure ordering may not be `Release` or `AcqRel` + //~^ ERROR `compare_exchange_weak`'s failure ordering may not be `Release` or `AcqRel` let _ = x.compare_exchange_weak(ptr, ptr2, Ordering::Release, Ordering::Release); - //~^ ERROR compare_exchange_weak's failure ordering may not be `Release` or `AcqRel` + //~^ ERROR `compare_exchange_weak`'s failure ordering may not be `Release` or `AcqRel` let _ = x.compare_exchange_weak(ptr, ptr2, Ordering::AcqRel, Ordering::Release); - //~^ ERROR compare_exchange_weak's failure ordering may not be `Release` or `AcqRel` + //~^ ERROR `compare_exchange_weak`'s failure ordering may not be `Release` or `AcqRel` let _ = x.compare_exchange_weak(ptr, ptr2, Ordering::SeqCst, Ordering::Release); - //~^ ERROR compare_exchange_weak's failure ordering may not be `Release` or `AcqRel` + //~^ ERROR `compare_exchange_weak`'s failure ordering may not be `Release` or `AcqRel` // Release success order forbids failure order of Acquire or SeqCst let _ = x.compare_exchange_weak(ptr2, ptr, Ordering::Release, Ordering::Acquire); - //~^ ERROR compare_exchange_weak's failure ordering may not be stronger + //~^ ERROR `compare_exchange_weak`'s success ordering must be at least as strong as let _ = x.compare_exchange_weak(ptr2, ptr, Ordering::Release, Ordering::SeqCst); - //~^ ERROR compare_exchange_weak's failure ordering may not be stronger + //~^ ERROR `compare_exchange_weak`'s success ordering must be at least as strong as // Relaxed success order also forbids failure order of Acquire or SeqCst let _ = x.compare_exchange_weak(ptr, ptr2, Ordering::Relaxed, Ordering::SeqCst); - //~^ ERROR compare_exchange_weak's failure ordering may not be stronger + //~^ ERROR `compare_exchange_weak`'s success ordering must be at least as strong as let _ = x.compare_exchange_weak(ptr, ptr2, Ordering::Relaxed, Ordering::Acquire); - //~^ ERROR compare_exchange_weak's failure ordering may not be stronger + //~^ ERROR `compare_exchange_weak`'s success ordering must be at least as strong as // Acquire/AcqRel forbids failure order of SeqCst let _ = x.compare_exchange_weak(ptr2, ptr, Ordering::Acquire, Ordering::SeqCst); - //~^ ERROR compare_exchange_weak's failure ordering may not be stronger + //~^ ERROR `compare_exchange_weak`'s success ordering must be at least as strong as let _ = x.compare_exchange_weak(ptr2, ptr, Ordering::AcqRel, Ordering::SeqCst); - //~^ ERROR compare_exchange_weak's failure ordering may not be stronger + //~^ ERROR `compare_exchange_weak`'s success ordering must be at least as strong as } diff --git a/src/test/ui/lint/lint-invalid-atomic-ordering-exchange-weak.stderr b/src/test/ui/lint/lint-invalid-atomic-ordering-exchange-weak.stderr index 13350ab0b9c..d5e53418b6f 100644 --- a/src/test/ui/lint/lint-invalid-atomic-ordering-exchange-weak.stderr +++ b/src/test/ui/lint/lint-invalid-atomic-ordering-exchange-weak.stderr @@ -1,131 +1,137 @@ -error: compare_exchange_weak's failure ordering may not be `Release` or `AcqRel` +error: `compare_exchange_weak`'s failure ordering may not be `Release` or `AcqRel`, since a failed `compare_exchange_weak` does not result in a write --> $DIR/lint-invalid-atomic-ordering-exchange-weak.rs:22:67 | LL | let _ = x.compare_exchange_weak(ptr2, ptr, Ordering::Relaxed, Ordering::AcqRel); - | ^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^ invalid failure ordering | = note: `#[deny(invalid_atomic_ordering)]` on by default - = help: consider using ordering mode `Relaxed` instead + = help: consider using `Acquire` or `Relaxed` failure ordering instead -error: compare_exchange_weak's failure ordering may not be `Release` or `AcqRel` +error: `compare_exchange_weak`'s failure ordering may not be `Release` or `AcqRel`, since a failed `compare_exchange_weak` does not result in a write --> $DIR/lint-invalid-atomic-ordering-exchange-weak.rs:24:67 | LL | let _ = x.compare_exchange_weak(ptr2, ptr, Ordering::Acquire, Ordering::AcqRel); - | ^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^ invalid failure ordering | - = help: consider using ordering modes `Acquire` or `Relaxed` instead + = help: consider using `Acquire` or `Relaxed` failure ordering instead -error: compare_exchange_weak's failure ordering may not be `Release` or `AcqRel` +error: `compare_exchange_weak`'s failure ordering may not be `Release` or `AcqRel`, since a failed `compare_exchange_weak` does not result in a write --> $DIR/lint-invalid-atomic-ordering-exchange-weak.rs:26:67 | LL | let _ = x.compare_exchange_weak(ptr2, ptr, Ordering::Release, Ordering::AcqRel); - | ^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^ invalid failure ordering | - = help: consider using ordering mode `Relaxed` instead + = help: consider using `Acquire` or `Relaxed` failure ordering instead -error: compare_exchange_weak's failure ordering may not be `Release` or `AcqRel` +error: `compare_exchange_weak`'s failure ordering may not be `Release` or `AcqRel`, since a failed `compare_exchange_weak` does not result in a write --> $DIR/lint-invalid-atomic-ordering-exchange-weak.rs:28:66 | LL | let _ = x.compare_exchange_weak(ptr2, ptr, Ordering::AcqRel, Ordering::AcqRel); - | ^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^ invalid failure ordering | - = help: consider using ordering modes `Acquire` or `Relaxed` instead + = help: consider using `Acquire` or `Relaxed` failure ordering instead -error: compare_exchange_weak's failure ordering may not be `Release` or `AcqRel` +error: `compare_exchange_weak`'s failure ordering may not be `Release` or `AcqRel`, since a failed `compare_exchange_weak` does not result in a write --> $DIR/lint-invalid-atomic-ordering-exchange-weak.rs:30:66 | LL | let _ = x.compare_exchange_weak(ptr2, ptr, Ordering::SeqCst, Ordering::AcqRel); - | ^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^ invalid failure ordering | - = help: consider using ordering modes `Acquire`, `SeqCst` or `Relaxed` instead + = help: consider using `Acquire` or `Relaxed` failure ordering instead -error: compare_exchange_weak's failure ordering may not be `Release` or `AcqRel` +error: `compare_exchange_weak`'s failure ordering may not be `Release` or `AcqRel`, since a failed `compare_exchange_weak` does not result in a write --> $DIR/lint-invalid-atomic-ordering-exchange-weak.rs:34:67 | LL | let _ = x.compare_exchange_weak(ptr, ptr2, Ordering::Relaxed, Ordering::Release); - | ^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^ invalid failure ordering | - = help: consider using ordering mode `Relaxed` instead + = help: consider using `Acquire` or `Relaxed` failure ordering instead -error: compare_exchange_weak's failure ordering may not be `Release` or `AcqRel` +error: `compare_exchange_weak`'s failure ordering may not be `Release` or `AcqRel`, since a failed `compare_exchange_weak` does not result in a write --> $DIR/lint-invalid-atomic-ordering-exchange-weak.rs:36:67 | LL | let _ = x.compare_exchange_weak(ptr, ptr2, Ordering::Acquire, Ordering::Release); - | ^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^ invalid failure ordering | - = help: consider using ordering modes `Acquire` or `Relaxed` instead + = help: consider using `Acquire` or `Relaxed` failure ordering instead -error: compare_exchange_weak's failure ordering may not be `Release` or `AcqRel` +error: `compare_exchange_weak`'s failure ordering may not be `Release` or `AcqRel`, since a failed `compare_exchange_weak` does not result in a write --> $DIR/lint-invalid-atomic-ordering-exchange-weak.rs:38:67 | LL | let _ = x.compare_exchange_weak(ptr, ptr2, Ordering::Release, Ordering::Release); - | ^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^ invalid failure ordering | - = help: consider using ordering mode `Relaxed` instead + = help: consider using `Acquire` or `Relaxed` failure ordering instead -error: compare_exchange_weak's failure ordering may not be `Release` or `AcqRel` +error: `compare_exchange_weak`'s failure ordering may not be `Release` or `AcqRel`, since a failed `compare_exchange_weak` does not result in a write --> $DIR/lint-invalid-atomic-ordering-exchange-weak.rs:40:66 | LL | let _ = x.compare_exchange_weak(ptr, ptr2, Ordering::AcqRel, Ordering::Release); - | ^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^ invalid failure ordering | - = help: consider using ordering modes `Acquire` or `Relaxed` instead + = help: consider using `Acquire` or `Relaxed` failure ordering instead -error: compare_exchange_weak's failure ordering may not be `Release` or `AcqRel` +error: `compare_exchange_weak`'s failure ordering may not be `Release` or `AcqRel`, since a failed `compare_exchange_weak` does not result in a write --> $DIR/lint-invalid-atomic-ordering-exchange-weak.rs:42:66 | LL | let _ = x.compare_exchange_weak(ptr, ptr2, Ordering::SeqCst, Ordering::Release); - | ^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^ invalid failure ordering | - = help: consider using ordering modes `Acquire`, `SeqCst` or `Relaxed` instead + = help: consider using `Acquire` or `Relaxed` failure ordering instead -error: compare_exchange_weak's failure ordering may not be stronger than the success ordering of `Release` - --> $DIR/lint-invalid-atomic-ordering-exchange-weak.rs:46:67 +error: `compare_exchange_weak`'s success ordering must be at least as strong as its failure ordering + --> $DIR/lint-invalid-atomic-ordering-exchange-weak.rs:46:48 | LL | let _ = x.compare_exchange_weak(ptr2, ptr, Ordering::Release, Ordering::Acquire); - | ^^^^^^^^^^^^^^^^^ - | - = help: consider using ordering mode `Relaxed` instead + | ^^^^^^^^^^^^^^^^^ ----------------- `Acquire` failure ordering + | | + | `Release` success ordering + | help: consider using `AcqRel` success ordering instead -error: compare_exchange_weak's failure ordering may not be stronger than the success ordering of `Release` - --> $DIR/lint-invalid-atomic-ordering-exchange-weak.rs:48:67 +error: `compare_exchange_weak`'s success ordering must be at least as strong as its failure ordering + --> $DIR/lint-invalid-atomic-ordering-exchange-weak.rs:48:48 | LL | let _ = x.compare_exchange_weak(ptr2, ptr, Ordering::Release, Ordering::SeqCst); - | ^^^^^^^^^^^^^^^^ - | - = help: consider using ordering mode `Relaxed` instead + | ^^^^^^^^^^^^^^^^^ ---------------- `SeqCst` failure ordering + | | + | `Release` success ordering + | help: consider using `SeqCst` success ordering instead -error: compare_exchange_weak's failure ordering may not be stronger than the success ordering of `Relaxed` - --> $DIR/lint-invalid-atomic-ordering-exchange-weak.rs:52:67 +error: `compare_exchange_weak`'s success ordering must be at least as strong as its failure ordering + --> $DIR/lint-invalid-atomic-ordering-exchange-weak.rs:52:48 | LL | let _ = x.compare_exchange_weak(ptr, ptr2, Ordering::Relaxed, Ordering::SeqCst); - | ^^^^^^^^^^^^^^^^ - | - = help: consider using ordering mode `Relaxed` instead + | ^^^^^^^^^^^^^^^^^ ---------------- `SeqCst` failure ordering + | | + | `Relaxed` success ordering + | help: consider using `SeqCst` success ordering instead -error: compare_exchange_weak's failure ordering may not be stronger than the success ordering of `Relaxed` - --> $DIR/lint-invalid-atomic-ordering-exchange-weak.rs:54:67 +error: `compare_exchange_weak`'s success ordering must be at least as strong as its failure ordering + --> $DIR/lint-invalid-atomic-ordering-exchange-weak.rs:54:48 | LL | let _ = x.compare_exchange_weak(ptr, ptr2, Ordering::Relaxed, Ordering::Acquire); - | ^^^^^^^^^^^^^^^^^ - | - = help: consider using ordering mode `Relaxed` instead + | ^^^^^^^^^^^^^^^^^ ----------------- `Acquire` failure ordering + | | + | `Relaxed` success ordering + | help: consider using `Acquire` success ordering instead -error: compare_exchange_weak's failure ordering may not be stronger than the success ordering of `Acquire` - --> $DIR/lint-invalid-atomic-ordering-exchange-weak.rs:58:67 +error: `compare_exchange_weak`'s success ordering must be at least as strong as its failure ordering + --> $DIR/lint-invalid-atomic-ordering-exchange-weak.rs:58:48 | LL | let _ = x.compare_exchange_weak(ptr2, ptr, Ordering::Acquire, Ordering::SeqCst); - | ^^^^^^^^^^^^^^^^ - | - = help: consider using ordering modes `Acquire` or `Relaxed` instead + | ^^^^^^^^^^^^^^^^^ ---------------- `SeqCst` failure ordering + | | + | `Acquire` success ordering + | help: consider using `SeqCst` success ordering instead -error: compare_exchange_weak's failure ordering may not be stronger than the success ordering of `AcqRel` - --> $DIR/lint-invalid-atomic-ordering-exchange-weak.rs:60:66 +error: `compare_exchange_weak`'s success ordering must be at least as strong as its failure ordering + --> $DIR/lint-invalid-atomic-ordering-exchange-weak.rs:60:48 | LL | let _ = x.compare_exchange_weak(ptr2, ptr, Ordering::AcqRel, Ordering::SeqCst); - | ^^^^^^^^^^^^^^^^ - | - = help: consider using ordering modes `Acquire` or `Relaxed` instead + | ^^^^^^^^^^^^^^^^ ---------------- `SeqCst` failure ordering + | | + | `AcqRel` success ordering + | help: consider using `SeqCst` success ordering instead error: aborting due to 16 previous errors diff --git a/src/test/ui/lint/lint-invalid-atomic-ordering-exchange.rs b/src/test/ui/lint/lint-invalid-atomic-ordering-exchange.rs index 8ef3a400cf0..da98d854262 100644 --- a/src/test/ui/lint/lint-invalid-atomic-ordering-exchange.rs +++ b/src/test/ui/lint/lint-invalid-atomic-ordering-exchange.rs @@ -18,43 +18,43 @@ fn main() { // AcqRel is always forbidden as a failure ordering let _ = x.compare_exchange(0, 0, Ordering::Relaxed, Ordering::AcqRel); - //~^ ERROR compare_exchange's failure ordering may not be `Release` or `AcqRel` + //~^ ERROR `compare_exchange`'s failure ordering may not be `Release` or `AcqRel` let _ = x.compare_exchange(0, 0, Ordering::Acquire, Ordering::AcqRel); - //~^ ERROR compare_exchange's failure ordering may not be `Release` or `AcqRel` + //~^ ERROR `compare_exchange`'s failure ordering may not be `Release` or `AcqRel` let _ = x.compare_exchange(0, 0, Ordering::Release, Ordering::AcqRel); - //~^ ERROR compare_exchange's failure ordering may not be `Release` or `AcqRel` + //~^ ERROR `compare_exchange`'s failure ordering may not be `Release` or `AcqRel` let _ = x.compare_exchange(0, 0, Ordering::AcqRel, Ordering::AcqRel); - //~^ ERROR compare_exchange's failure ordering may not be `Release` or `AcqRel` + //~^ ERROR `compare_exchange`'s failure ordering may not be `Release` or `AcqRel` let _ = x.compare_exchange(0, 0, Ordering::SeqCst, Ordering::AcqRel); - //~^ ERROR compare_exchange's failure ordering may not be `Release` or `AcqRel` + //~^ ERROR `compare_exchange`'s failure ordering may not be `Release` or `AcqRel` // Release is always forbidden as a failure ordering let _ = x.compare_exchange(0, 0, Ordering::Relaxed, Ordering::Release); - //~^ ERROR compare_exchange's failure ordering may not be `Release` or `AcqRel` + //~^ ERROR `compare_exchange`'s failure ordering may not be `Release` or `AcqRel` let _ = x.compare_exchange(0, 0, Ordering::Acquire, Ordering::Release); - //~^ ERROR compare_exchange's failure ordering may not be `Release` or `AcqRel` + //~^ ERROR `compare_exchange`'s failure ordering may not be `Release` or `AcqRel` let _ = x.compare_exchange(0, 0, Ordering::Release, Ordering::Release); - //~^ ERROR compare_exchange's failure ordering may not be `Release` or `AcqRel` + //~^ ERROR `compare_exchange`'s failure ordering may not be `Release` or `AcqRel` let _ = x.compare_exchange(0, 0, Ordering::AcqRel, Ordering::Release); - //~^ ERROR compare_exchange's failure ordering may not be `Release` or `AcqRel` + //~^ ERROR `compare_exchange`'s failure ordering may not be `Release` or `AcqRel` let _ = x.compare_exchange(0, 0, Ordering::SeqCst, Ordering::Release); - //~^ ERROR compare_exchange's failure ordering may not be `Release` or `AcqRel` + //~^ ERROR `compare_exchange`'s failure ordering may not be `Release` or `AcqRel` // Release success order forbids failure order of Acquire or SeqCst let _ = x.compare_exchange(0, 0, Ordering::Release, Ordering::Acquire); - //~^ ERROR compare_exchange's failure ordering may not be stronger + //~^ ERROR `compare_exchange`'s success ordering must be at least as strong as let _ = x.compare_exchange(0, 0, Ordering::Release, Ordering::SeqCst); - //~^ ERROR compare_exchange's failure ordering may not be stronger + //~^ ERROR `compare_exchange`'s success ordering must be at least as strong as // Relaxed success order also forbids failure order of Acquire or SeqCst let _ = x.compare_exchange(0, 0, Ordering::Relaxed, Ordering::SeqCst); - //~^ ERROR compare_exchange's failure ordering may not be stronger + //~^ ERROR `compare_exchange`'s success ordering must be at least as strong as let _ = x.compare_exchange(0, 0, Ordering::Relaxed, Ordering::Acquire); - //~^ ERROR compare_exchange's failure ordering may not be stronger + //~^ ERROR `compare_exchange`'s success ordering must be at least as strong as // Acquire/AcqRel forbids failure order of SeqCst let _ = x.compare_exchange(0, 0, Ordering::Acquire, Ordering::SeqCst); - //~^ ERROR compare_exchange's failure ordering may not be stronger + //~^ ERROR `compare_exchange`'s success ordering must be at least as strong as let _ = x.compare_exchange(0, 0, Ordering::AcqRel, Ordering::SeqCst); - //~^ ERROR compare_exchange's failure ordering may not be stronger + //~^ ERROR `compare_exchange`'s success ordering must be at least as strong as } diff --git a/src/test/ui/lint/lint-invalid-atomic-ordering-exchange.stderr b/src/test/ui/lint/lint-invalid-atomic-ordering-exchange.stderr index daedfec7430..41121a20dee 100644 --- a/src/test/ui/lint/lint-invalid-atomic-ordering-exchange.stderr +++ b/src/test/ui/lint/lint-invalid-atomic-ordering-exchange.stderr @@ -1,131 +1,137 @@ -error: compare_exchange's failure ordering may not be `Release` or `AcqRel` +error: `compare_exchange`'s failure ordering may not be `Release` or `AcqRel`, since a failed `compare_exchange` does not result in a write --> $DIR/lint-invalid-atomic-ordering-exchange.rs:20:57 | LL | let _ = x.compare_exchange(0, 0, Ordering::Relaxed, Ordering::AcqRel); - | ^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^ invalid failure ordering | = note: `#[deny(invalid_atomic_ordering)]` on by default - = help: consider using ordering mode `Relaxed` instead + = help: consider using `Acquire` or `Relaxed` failure ordering instead -error: compare_exchange's failure ordering may not be `Release` or `AcqRel` +error: `compare_exchange`'s failure ordering may not be `Release` or `AcqRel`, since a failed `compare_exchange` does not result in a write --> $DIR/lint-invalid-atomic-ordering-exchange.rs:22:57 | LL | let _ = x.compare_exchange(0, 0, Ordering::Acquire, Ordering::AcqRel); - | ^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^ invalid failure ordering | - = help: consider using ordering modes `Acquire` or `Relaxed` instead + = help: consider using `Acquire` or `Relaxed` failure ordering instead -error: compare_exchange's failure ordering may not be `Release` or `AcqRel` +error: `compare_exchange`'s failure ordering may not be `Release` or `AcqRel`, since a failed `compare_exchange` does not result in a write --> $DIR/lint-invalid-atomic-ordering-exchange.rs:24:57 | LL | let _ = x.compare_exchange(0, 0, Ordering::Release, Ordering::AcqRel); - | ^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^ invalid failure ordering | - = help: consider using ordering mode `Relaxed` instead + = help: consider using `Acquire` or `Relaxed` failure ordering instead -error: compare_exchange's failure ordering may not be `Release` or `AcqRel` +error: `compare_exchange`'s failure ordering may not be `Release` or `AcqRel`, since a failed `compare_exchange` does not result in a write --> $DIR/lint-invalid-atomic-ordering-exchange.rs:26:56 | LL | let _ = x.compare_exchange(0, 0, Ordering::AcqRel, Ordering::AcqRel); - | ^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^ invalid failure ordering | - = help: consider using ordering modes `Acquire` or `Relaxed` instead + = help: consider using `Acquire` or `Relaxed` failure ordering instead -error: compare_exchange's failure ordering may not be `Release` or `AcqRel` +error: `compare_exchange`'s failure ordering may not be `Release` or `AcqRel`, since a failed `compare_exchange` does not result in a write --> $DIR/lint-invalid-atomic-ordering-exchange.rs:28:56 | LL | let _ = x.compare_exchange(0, 0, Ordering::SeqCst, Ordering::AcqRel); - | ^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^ invalid failure ordering | - = help: consider using ordering modes `Acquire`, `SeqCst` or `Relaxed` instead + = help: consider using `Acquire` or `Relaxed` failure ordering instead -error: compare_exchange's failure ordering may not be `Release` or `AcqRel` +error: `compare_exchange`'s failure ordering may not be `Release` or `AcqRel`, since a failed `compare_exchange` does not result in a write --> $DIR/lint-invalid-atomic-ordering-exchange.rs:32:57 | LL | let _ = x.compare_exchange(0, 0, Ordering::Relaxed, Ordering::Release); - | ^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^ invalid failure ordering | - = help: consider using ordering mode `Relaxed` instead + = help: consider using `Acquire` or `Relaxed` failure ordering instead -error: compare_exchange's failure ordering may not be `Release` or `AcqRel` +error: `compare_exchange`'s failure ordering may not be `Release` or `AcqRel`, since a failed `compare_exchange` does not result in a write --> $DIR/lint-invalid-atomic-ordering-exchange.rs:34:57 | LL | let _ = x.compare_exchange(0, 0, Ordering::Acquire, Ordering::Release); - | ^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^ invalid failure ordering | - = help: consider using ordering modes `Acquire` or `Relaxed` instead + = help: consider using `Acquire` or `Relaxed` failure ordering instead -error: compare_exchange's failure ordering may not be `Release` or `AcqRel` +error: `compare_exchange`'s failure ordering may not be `Release` or `AcqRel`, since a failed `compare_exchange` does not result in a write --> $DIR/lint-invalid-atomic-ordering-exchange.rs:36:57 | LL | let _ = x.compare_exchange(0, 0, Ordering::Release, Ordering::Release); - | ^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^ invalid failure ordering | - = help: consider using ordering mode `Relaxed` instead + = help: consider using `Acquire` or `Relaxed` failure ordering instead -error: compare_exchange's failure ordering may not be `Release` or `AcqRel` +error: `compare_exchange`'s failure ordering may not be `Release` or `AcqRel`, since a failed `compare_exchange` does not result in a write --> $DIR/lint-invalid-atomic-ordering-exchange.rs:38:56 | LL | let _ = x.compare_exchange(0, 0, Ordering::AcqRel, Ordering::Release); - | ^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^ invalid failure ordering | - = help: consider using ordering modes `Acquire` or `Relaxed` instead + = help: consider using `Acquire` or `Relaxed` failure ordering instead -error: compare_exchange's failure ordering may not be `Release` or `AcqRel` +error: `compare_exchange`'s failure ordering may not be `Release` or `AcqRel`, since a failed `compare_exchange` does not result in a write --> $DIR/lint-invalid-atomic-ordering-exchange.rs:40:56 | LL | let _ = x.compare_exchange(0, 0, Ordering::SeqCst, Ordering::Release); - | ^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^ invalid failure ordering | - = help: consider using ordering modes `Acquire`, `SeqCst` or `Relaxed` instead + = help: consider using `Acquire` or `Relaxed` failure ordering instead -error: compare_exchange's failure ordering may not be stronger than the success ordering of `Release` - --> $DIR/lint-invalid-atomic-ordering-exchange.rs:44:57 +error: `compare_exchange`'s success ordering must be at least as strong as its failure ordering + --> $DIR/lint-invalid-atomic-ordering-exchange.rs:44:38 | LL | let _ = x.compare_exchange(0, 0, Ordering::Release, Ordering::Acquire); - | ^^^^^^^^^^^^^^^^^ - | - = help: consider using ordering mode `Relaxed` instead + | ^^^^^^^^^^^^^^^^^ ----------------- `Acquire` failure ordering + | | + | `Release` success ordering + | help: consider using `AcqRel` success ordering instead -error: compare_exchange's failure ordering may not be stronger than the success ordering of `Release` - --> $DIR/lint-invalid-atomic-ordering-exchange.rs:46:57 +error: `compare_exchange`'s success ordering must be at least as strong as its failure ordering + --> $DIR/lint-invalid-atomic-ordering-exchange.rs:46:38 | LL | let _ = x.compare_exchange(0, 0, Ordering::Release, Ordering::SeqCst); - | ^^^^^^^^^^^^^^^^ - | - = help: consider using ordering mode `Relaxed` instead + | ^^^^^^^^^^^^^^^^^ ---------------- `SeqCst` failure ordering + | | + | `Release` success ordering + | help: consider using `SeqCst` success ordering instead -error: compare_exchange's failure ordering may not be stronger than the success ordering of `Relaxed` - --> $DIR/lint-invalid-atomic-ordering-exchange.rs:50:57 +error: `compare_exchange`'s success ordering must be at least as strong as its failure ordering + --> $DIR/lint-invalid-atomic-ordering-exchange.rs:50:38 | LL | let _ = x.compare_exchange(0, 0, Ordering::Relaxed, Ordering::SeqCst); - | ^^^^^^^^^^^^^^^^ - | - = help: consider using ordering mode `Relaxed` instead + | ^^^^^^^^^^^^^^^^^ ---------------- `SeqCst` failure ordering + | | + | `Relaxed` success ordering + | help: consider using `SeqCst` success ordering instead -error: compare_exchange's failure ordering may not be stronger than the success ordering of `Relaxed` - --> $DIR/lint-invalid-atomic-ordering-exchange.rs:52:57 +error: `compare_exchange`'s success ordering must be at least as strong as its failure ordering + --> $DIR/lint-invalid-atomic-ordering-exchange.rs:52:38 | LL | let _ = x.compare_exchange(0, 0, Ordering::Relaxed, Ordering::Acquire); - | ^^^^^^^^^^^^^^^^^ - | - = help: consider using ordering mode `Relaxed` instead + | ^^^^^^^^^^^^^^^^^ ----------------- `Acquire` failure ordering + | | + | `Relaxed` success ordering + | help: consider using `Acquire` success ordering instead -error: compare_exchange's failure ordering may not be stronger than the success ordering of `Acquire` - --> $DIR/lint-invalid-atomic-ordering-exchange.rs:56:57 +error: `compare_exchange`'s success ordering must be at least as strong as its failure ordering + --> $DIR/lint-invalid-atomic-ordering-exchange.rs:56:38 | LL | let _ = x.compare_exchange(0, 0, Ordering::Acquire, Ordering::SeqCst); - | ^^^^^^^^^^^^^^^^ - | - = help: consider using ordering modes `Acquire` or `Relaxed` instead + | ^^^^^^^^^^^^^^^^^ ---------------- `SeqCst` failure ordering + | | + | `Acquire` success ordering + | help: consider using `SeqCst` success ordering instead -error: compare_exchange's failure ordering may not be stronger than the success ordering of `AcqRel` - --> $DIR/lint-invalid-atomic-ordering-exchange.rs:58:56 +error: `compare_exchange`'s success ordering must be at least as strong as its failure ordering + --> $DIR/lint-invalid-atomic-ordering-exchange.rs:58:38 | LL | let _ = x.compare_exchange(0, 0, Ordering::AcqRel, Ordering::SeqCst); - | ^^^^^^^^^^^^^^^^ - | - = help: consider using ordering modes `Acquire` or `Relaxed` instead + | ^^^^^^^^^^^^^^^^ ---------------- `SeqCst` failure ordering + | | + | `AcqRel` success ordering + | help: consider using `SeqCst` success ordering instead error: aborting due to 16 previous errors diff --git a/src/test/ui/lint/lint-invalid-atomic-ordering-fetch-update.rs b/src/test/ui/lint/lint-invalid-atomic-ordering-fetch-update.rs index 938ca0359f8..73eda182aa8 100644 --- a/src/test/ui/lint/lint-invalid-atomic-ordering-fetch-update.rs +++ b/src/test/ui/lint/lint-invalid-atomic-ordering-fetch-update.rs @@ -18,43 +18,43 @@ fn main() { // AcqRel is always forbidden as a failure ordering let _ = x.fetch_update(Ordering::Relaxed, Ordering::AcqRel, |old| Some(old + 1)); - //~^ ERROR fetch_update's failure ordering may not be `Release` or `AcqRel` + //~^ ERROR `fetch_update`'s failure ordering may not be `Release` or `AcqRel` let _ = x.fetch_update(Ordering::Acquire, Ordering::AcqRel, |old| Some(old + 1)); - //~^ ERROR fetch_update's failure ordering may not be `Release` or `AcqRel` + //~^ ERROR `fetch_update`'s failure ordering may not be `Release` or `AcqRel` let _ = x.fetch_update(Ordering::Release, Ordering::AcqRel, |old| Some(old + 1)); - //~^ ERROR fetch_update's failure ordering may not be `Release` or `AcqRel` + //~^ ERROR `fetch_update`'s failure ordering may not be `Release` or `AcqRel` let _ = x.fetch_update(Ordering::AcqRel, Ordering::AcqRel, |old| Some(old + 1)); - //~^ ERROR fetch_update's failure ordering may not be `Release` or `AcqRel` + //~^ ERROR `fetch_update`'s failure ordering may not be `Release` or `AcqRel` let _ = x.fetch_update(Ordering::SeqCst, Ordering::AcqRel, |old| Some(old + 1)); - //~^ ERROR fetch_update's failure ordering may not be `Release` or `AcqRel` + //~^ ERROR `fetch_update`'s failure ordering may not be `Release` or `AcqRel` // Release is always forbidden as a failure ordering let _ = x.fetch_update(Ordering::Relaxed, Ordering::Release, |old| Some(old + 1)); - //~^ ERROR fetch_update's failure ordering may not be `Release` or `AcqRel` + //~^ ERROR `fetch_update`'s failure ordering may not be `Release` or `AcqRel` let _ = x.fetch_update(Ordering::Acquire, Ordering::Release, |old| Some(old + 1)); - //~^ ERROR fetch_update's failure ordering may not be `Release` or `AcqRel` + //~^ ERROR `fetch_update`'s failure ordering may not be `Release` or `AcqRel` let _ = x.fetch_update(Ordering::Release, Ordering::Release, |old| Some(old + 1)); - //~^ ERROR fetch_update's failure ordering may not be `Release` or `AcqRel` + //~^ ERROR `fetch_update`'s failure ordering may not be `Release` or `AcqRel` let _ = x.fetch_update(Ordering::AcqRel, Ordering::Release, |old| Some(old + 1)); - //~^ ERROR fetch_update's failure ordering may not be `Release` or `AcqRel` + //~^ ERROR `fetch_update`'s failure ordering may not be `Release` or `AcqRel` let _ = x.fetch_update(Ordering::SeqCst, Ordering::Release, |old| Some(old + 1)); - //~^ ERROR fetch_update's failure ordering may not be `Release` or `AcqRel` + //~^ ERROR `fetch_update`'s failure ordering may not be `Release` or `AcqRel` // Release success order forbids failure order of Acquire or SeqCst let _ = x.fetch_update(Ordering::Release, Ordering::Acquire, |old| Some(old + 1)); - //~^ ERROR fetch_update's failure ordering may not be stronger + //~^ ERROR `fetch_update`'s success ordering must be at least as strong as let _ = x.fetch_update(Ordering::Release, Ordering::SeqCst, |old| Some(old + 1)); - //~^ ERROR fetch_update's failure ordering may not be stronger + //~^ ERROR `fetch_update`'s success ordering must be at least as strong as // Relaxed success order also forbids failure order of Acquire or SeqCst let _ = x.fetch_update(Ordering::Relaxed, Ordering::SeqCst, |old| Some(old + 1)); - //~^ ERROR fetch_update's failure ordering may not be stronger + //~^ ERROR `fetch_update`'s success ordering must be at least as strong as let _ = x.fetch_update(Ordering::Relaxed, Ordering::Acquire, |old| Some(old + 1)); - //~^ ERROR fetch_update's failure ordering may not be stronger + //~^ ERROR `fetch_update`'s success ordering must be at least as strong as // Acquire/AcqRel forbids failure order of SeqCst let _ = x.fetch_update(Ordering::Acquire, Ordering::SeqCst, |old| Some(old + 1)); - //~^ ERROR fetch_update's failure ordering may not be stronger + //~^ ERROR `fetch_update`'s success ordering must be at least as strong as let _ = x.fetch_update(Ordering::AcqRel, Ordering::SeqCst, |old| Some(old + 1)); - //~^ ERROR fetch_update's failure ordering may not be stronger + //~^ ERROR `fetch_update`'s success ordering must be at least as strong as } diff --git a/src/test/ui/lint/lint-invalid-atomic-ordering-fetch-update.stderr b/src/test/ui/lint/lint-invalid-atomic-ordering-fetch-update.stderr index dabc1da7e55..7bea56d57fb 100644 --- a/src/test/ui/lint/lint-invalid-atomic-ordering-fetch-update.stderr +++ b/src/test/ui/lint/lint-invalid-atomic-ordering-fetch-update.stderr @@ -1,131 +1,137 @@ -error: fetch_update's failure ordering may not be `Release` or `AcqRel` +error: `fetch_update`'s failure ordering may not be `Release` or `AcqRel`, since a failed `fetch_update` does not result in a write --> $DIR/lint-invalid-atomic-ordering-fetch-update.rs:20:47 | LL | let _ = x.fetch_update(Ordering::Relaxed, Ordering::AcqRel, |old| Some(old + 1)); - | ^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^ invalid failure ordering | = note: `#[deny(invalid_atomic_ordering)]` on by default - = help: consider using ordering mode `Relaxed` instead + = help: consider using `Acquire` or `Relaxed` failure ordering instead -error: fetch_update's failure ordering may not be `Release` or `AcqRel` +error: `fetch_update`'s failure ordering may not be `Release` or `AcqRel`, since a failed `fetch_update` does not result in a write --> $DIR/lint-invalid-atomic-ordering-fetch-update.rs:22:47 | LL | let _ = x.fetch_update(Ordering::Acquire, Ordering::AcqRel, |old| Some(old + 1)); - | ^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^ invalid failure ordering | - = help: consider using ordering modes `Acquire` or `Relaxed` instead + = help: consider using `Acquire` or `Relaxed` failure ordering instead -error: fetch_update's failure ordering may not be `Release` or `AcqRel` +error: `fetch_update`'s failure ordering may not be `Release` or `AcqRel`, since a failed `fetch_update` does not result in a write --> $DIR/lint-invalid-atomic-ordering-fetch-update.rs:24:47 | LL | let _ = x.fetch_update(Ordering::Release, Ordering::AcqRel, |old| Some(old + 1)); - | ^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^ invalid failure ordering | - = help: consider using ordering mode `Relaxed` instead + = help: consider using `Acquire` or `Relaxed` failure ordering instead -error: fetch_update's failure ordering may not be `Release` or `AcqRel` +error: `fetch_update`'s failure ordering may not be `Release` or `AcqRel`, since a failed `fetch_update` does not result in a write --> $DIR/lint-invalid-atomic-ordering-fetch-update.rs:26:46 | LL | let _ = x.fetch_update(Ordering::AcqRel, Ordering::AcqRel, |old| Some(old + 1)); - | ^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^ invalid failure ordering | - = help: consider using ordering modes `Acquire` or `Relaxed` instead + = help: consider using `Acquire` or `Relaxed` failure ordering instead -error: fetch_update's failure ordering may not be `Release` or `AcqRel` +error: `fetch_update`'s failure ordering may not be `Release` or `AcqRel`, since a failed `fetch_update` does not result in a write --> $DIR/lint-invalid-atomic-ordering-fetch-update.rs:28:46 | LL | let _ = x.fetch_update(Ordering::SeqCst, Ordering::AcqRel, |old| Some(old + 1)); - | ^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^ invalid failure ordering | - = help: consider using ordering modes `Acquire`, `SeqCst` or `Relaxed` instead + = help: consider using `Acquire` or `Relaxed` failure ordering instead -error: fetch_update's failure ordering may not be `Release` or `AcqRel` +error: `fetch_update`'s failure ordering may not be `Release` or `AcqRel`, since a failed `fetch_update` does not result in a write --> $DIR/lint-invalid-atomic-ordering-fetch-update.rs:32:47 | LL | let _ = x.fetch_update(Ordering::Relaxed, Ordering::Release, |old| Some(old + 1)); - | ^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^ invalid failure ordering | - = help: consider using ordering mode `Relaxed` instead + = help: consider using `Acquire` or `Relaxed` failure ordering instead -error: fetch_update's failure ordering may not be `Release` or `AcqRel` +error: `fetch_update`'s failure ordering may not be `Release` or `AcqRel`, since a failed `fetch_update` does not result in a write --> $DIR/lint-invalid-atomic-ordering-fetch-update.rs:34:47 | LL | let _ = x.fetch_update(Ordering::Acquire, Ordering::Release, |old| Some(old + 1)); - | ^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^ invalid failure ordering | - = help: consider using ordering modes `Acquire` or `Relaxed` instead + = help: consider using `Acquire` or `Relaxed` failure ordering instead -error: fetch_update's failure ordering may not be `Release` or `AcqRel` +error: `fetch_update`'s failure ordering may not be `Release` or `AcqRel`, since a failed `fetch_update` does not result in a write --> $DIR/lint-invalid-atomic-ordering-fetch-update.rs:36:47 | LL | let _ = x.fetch_update(Ordering::Release, Ordering::Release, |old| Some(old + 1)); - | ^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^ invalid failure ordering | - = help: consider using ordering mode `Relaxed` instead + = help: consider using `Acquire` or `Relaxed` failure ordering instead -error: fetch_update's failure ordering may not be `Release` or `AcqRel` +error: `fetch_update`'s failure ordering may not be `Release` or `AcqRel`, since a failed `fetch_update` does not result in a write --> $DIR/lint-invalid-atomic-ordering-fetch-update.rs:38:46 | LL | let _ = x.fetch_update(Ordering::AcqRel, Ordering::Release, |old| Some(old + 1)); - | ^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^ invalid failure ordering | - = help: consider using ordering modes `Acquire` or `Relaxed` instead + = help: consider using `Acquire` or `Relaxed` failure ordering instead -error: fetch_update's failure ordering may not be `Release` or `AcqRel` +error: `fetch_update`'s failure ordering may not be `Release` or `AcqRel`, since a failed `fetch_update` does not result in a write --> $DIR/lint-invalid-atomic-ordering-fetch-update.rs:40:46 | LL | let _ = x.fetch_update(Ordering::SeqCst, Ordering::Release, |old| Some(old + 1)); - | ^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^ invalid failure ordering | - = help: consider using ordering modes `Acquire`, `SeqCst` or `Relaxed` instead + = help: consider using `Acquire` or `Relaxed` failure ordering instead -error: fetch_update's failure ordering may not be stronger than the success ordering of `Release` - --> $DIR/lint-invalid-atomic-ordering-fetch-update.rs:44:47 +error: `fetch_update`'s success ordering must be at least as strong as its failure ordering + --> $DIR/lint-invalid-atomic-ordering-fetch-update.rs:44:28 | LL | let _ = x.fetch_update(Ordering::Release, Ordering::Acquire, |old| Some(old + 1)); - | ^^^^^^^^^^^^^^^^^ - | - = help: consider using ordering mode `Relaxed` instead + | ^^^^^^^^^^^^^^^^^ ----------------- `Acquire` failure ordering + | | + | `Release` success ordering + | help: consider using `AcqRel` success ordering instead -error: fetch_update's failure ordering may not be stronger than the success ordering of `Release` - --> $DIR/lint-invalid-atomic-ordering-fetch-update.rs:46:47 +error: `fetch_update`'s success ordering must be at least as strong as its failure ordering + --> $DIR/lint-invalid-atomic-ordering-fetch-update.rs:46:28 | LL | let _ = x.fetch_update(Ordering::Release, Ordering::SeqCst, |old| Some(old + 1)); - | ^^^^^^^^^^^^^^^^ - | - = help: consider using ordering mode `Relaxed` instead + | ^^^^^^^^^^^^^^^^^ ---------------- `SeqCst` failure ordering + | | + | `Release` success ordering + | help: consider using `SeqCst` success ordering instead -error: fetch_update's failure ordering may not be stronger than the success ordering of `Relaxed` - --> $DIR/lint-invalid-atomic-ordering-fetch-update.rs:50:47 +error: `fetch_update`'s success ordering must be at least as strong as its failure ordering + --> $DIR/lint-invalid-atomic-ordering-fetch-update.rs:50:28 | LL | let _ = x.fetch_update(Ordering::Relaxed, Ordering::SeqCst, |old| Some(old + 1)); - | ^^^^^^^^^^^^^^^^ - | - = help: consider using ordering mode `Relaxed` instead + | ^^^^^^^^^^^^^^^^^ ---------------- `SeqCst` failure ordering + | | + | `Relaxed` success ordering + | help: consider using `SeqCst` success ordering instead -error: fetch_update's failure ordering may not be stronger than the success ordering of `Relaxed` - --> $DIR/lint-invalid-atomic-ordering-fetch-update.rs:52:47 +error: `fetch_update`'s success ordering must be at least as strong as its failure ordering + --> $DIR/lint-invalid-atomic-ordering-fetch-update.rs:52:28 | LL | let _ = x.fetch_update(Ordering::Relaxed, Ordering::Acquire, |old| Some(old + 1)); - | ^^^^^^^^^^^^^^^^^ - | - = help: consider using ordering mode `Relaxed` instead + | ^^^^^^^^^^^^^^^^^ ----------------- `Acquire` failure ordering + | | + | `Relaxed` success ordering + | help: consider using `Acquire` success ordering instead -error: fetch_update's failure ordering may not be stronger than the success ordering of `Acquire` - --> $DIR/lint-invalid-atomic-ordering-fetch-update.rs:56:47 +error: `fetch_update`'s success ordering must be at least as strong as its failure ordering + --> $DIR/lint-invalid-atomic-ordering-fetch-update.rs:56:28 | LL | let _ = x.fetch_update(Ordering::Acquire, Ordering::SeqCst, |old| Some(old + 1)); - | ^^^^^^^^^^^^^^^^ - | - = help: consider using ordering modes `Acquire` or `Relaxed` instead + | ^^^^^^^^^^^^^^^^^ ---------------- `SeqCst` failure ordering + | | + | `Acquire` success ordering + | help: consider using `SeqCst` success ordering instead -error: fetch_update's failure ordering may not be stronger than the success ordering of `AcqRel` - --> $DIR/lint-invalid-atomic-ordering-fetch-update.rs:58:46 +error: `fetch_update`'s success ordering must be at least as strong as its failure ordering + --> $DIR/lint-invalid-atomic-ordering-fetch-update.rs:58:28 | LL | let _ = x.fetch_update(Ordering::AcqRel, Ordering::SeqCst, |old| Some(old + 1)); - | ^^^^^^^^^^^^^^^^ - | - = help: consider using ordering modes `Acquire` or `Relaxed` instead + | ^^^^^^^^^^^^^^^^ ---------------- `SeqCst` failure ordering + | | + | `AcqRel` success ordering + | help: consider using `SeqCst` success ordering instead error: aborting due to 16 previous errors diff --git a/src/test/ui/lint/recommend-literal.rs b/src/test/ui/lint/recommend-literal.rs index f60d3d10dce..453cbf28569 100644 --- a/src/test/ui/lint/recommend-literal.rs +++ b/src/test/ui/lint/recommend-literal.rs @@ -7,6 +7,13 @@ fn main() { let y: long = 74802374902374923; //~^ ERROR cannot find type `long` in this scope //~| HELP perhaps you intended to use this type + let v1: Boolean = true; + //~^ ERROR: cannot find type `Boolean` in this scope [E0412] + //~| HELP perhaps you intended to use this type + let v2: Bool = true; + //~^ ERROR: cannot find type `Bool` in this scope [E0412] + //~| HELP a builtin type with a similar name exists + //~| HELP perhaps you intended to use this type } fn z(a: boolean) { diff --git a/src/test/ui/lint/recommend-literal.stderr b/src/test/ui/lint/recommend-literal.stderr index 0ebcfb40dc3..424ecadd4b8 100644 --- a/src/test/ui/lint/recommend-literal.stderr +++ b/src/test/ui/lint/recommend-literal.stderr @@ -16,8 +16,32 @@ LL | let y: long = 74802374902374923; | not found in this scope | help: perhaps you intended to use this type: `i64` +error[E0412]: cannot find type `Boolean` in this scope + --> $DIR/recommend-literal.rs:10:13 + | +LL | let v1: Boolean = true; + | ^^^^^^^ + | | + | not found in this scope + | help: perhaps you intended to use this type: `bool` + +error[E0412]: cannot find type `Bool` in this scope + --> $DIR/recommend-literal.rs:13:13 + | +LL | let v2: Bool = true; + | ^^^^ + | +help: a builtin type with a similar name exists + | +LL | let v2: bool = true; + | ~~~~ +help: perhaps you intended to use this type + | +LL | let v2: bool = true; + | ~~~~ + error[E0412]: cannot find type `boolean` in this scope - --> $DIR/recommend-literal.rs:12:9 + --> $DIR/recommend-literal.rs:19:9 | LL | fn z(a: boolean) { | ^^^^^^^ @@ -26,7 +50,7 @@ LL | fn z(a: boolean) { | help: perhaps you intended to use this type: `bool` error[E0412]: cannot find type `byte` in this scope - --> $DIR/recommend-literal.rs:17:11 + --> $DIR/recommend-literal.rs:24:11 | LL | fn a() -> byte { | ^^^^ @@ -35,7 +59,7 @@ LL | fn a() -> byte { | help: perhaps you intended to use this type: `u8` error[E0412]: cannot find type `float` in this scope - --> $DIR/recommend-literal.rs:24:12 + --> $DIR/recommend-literal.rs:31:12 | LL | width: float, | ^^^^^ @@ -44,7 +68,7 @@ LL | width: float, | help: perhaps you intended to use this type: `f32` error[E0412]: cannot find type `int` in this scope - --> $DIR/recommend-literal.rs:27:19 + --> $DIR/recommend-literal.rs:34:19 | LL | depth: Option<int>, | ^^^ not found in this scope @@ -59,7 +83,7 @@ LL | struct Data<int> { | +++++ error[E0412]: cannot find type `short` in this scope - --> $DIR/recommend-literal.rs:33:16 + --> $DIR/recommend-literal.rs:40:16 | LL | impl Stuff for short {} | ^^^^^ @@ -67,6 +91,6 @@ LL | impl Stuff for short {} | not found in this scope | help: perhaps you intended to use this type: `i16` -error: aborting due to 7 previous errors +error: aborting due to 9 previous errors For more information about this error, try `rustc --explain E0412`. diff --git a/src/test/ui/lint/uninitialized-zeroed.stderr b/src/test/ui/lint/uninitialized-zeroed.stderr index b6a66f0a95a..88121a1836d 100644 --- a/src/test/ui/lint/uninitialized-zeroed.stderr +++ b/src/test/ui/lint/uninitialized-zeroed.stderr @@ -400,11 +400,8 @@ LL | let _val: Fruit = mem::uninitialized(); note: enums have to be initialized to a variant --> $DIR/uninitialized-zeroed.rs:26:1 | -LL | / enum Fruit { -LL | | Apple, -LL | | Banana, -LL | | } - | |_^ +LL | enum Fruit { + | ^^^^^^^^^^ error: the type `[bool; 2]` does not permit being left uninitialized --> $DIR/uninitialized-zeroed.rs:101:31 diff --git a/src/test/ui/lint/unused/unused-doc-comments-edge-cases.stderr b/src/test/ui/lint/unused/unused-doc-comments-edge-cases.stderr index 30a96af583a..1a022c30938 100644 --- a/src/test/ui/lint/unused/unused-doc-comments-edge-cases.stderr +++ b/src/test/ui/lint/unused/unused-doc-comments-edge-cases.stderr @@ -71,7 +71,7 @@ LL | LL | / extern "C" { LL | | fn foo(); LL | | } - | |_- rustdoc does not generate documentation for extern block + | |_- rustdoc does not generate documentation for extern blocks | = help: use `//` for a plain comment diff --git a/src/test/ui/macro_backtrace/main.-Zmacro-backtrace.stderr b/src/test/ui/macro_backtrace/main.-Zmacro-backtrace.stderr index 1d57b32d47e..bf85a2d75db 100644 --- a/src/test/ui/macro_backtrace/main.-Zmacro-backtrace.stderr +++ b/src/test/ui/macro_backtrace/main.-Zmacro-backtrace.stderr @@ -13,70 +13,60 @@ LL | pong!(); error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `error` --> $DIR/main.rs:10:20 | -LL | / macro_rules! pong { -LL | | () => { syntax error }; - | | ^^^^^ expected one of 8 possible tokens -LL | | } - | |__- in this expansion of `pong!` (#2) +LL | / macro_rules! pong { +LL | | () => { syntax error }; + | | ^^^^^ expected one of 8 possible tokens +LL | | } + | |_- in this expansion of `pong!` (#2) ... -LL | ping!(); - | ------- in this macro invocation (#1) +LL | ping!(); + | ------- in this macro invocation (#1) | ::: $DIR/auxiliary/ping.rs:5:1 | -LL | / macro_rules! ping { -LL | | () => { -LL | | pong!(); - | | ------- in this macro invocation (#2) -LL | | } -LL | | } - | |_- in this expansion of `ping!` (#1) +LL | macro_rules! ping { + | ----------------- in this expansion of `ping!` (#1) +LL | () => { +LL | pong!(); + | ------- in this macro invocation (#2) error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `error` --> $DIR/main.rs:10:20 | -LL | / macro_rules! pong { -LL | | () => { syntax error }; - | | ^^^^^ expected one of 8 possible tokens -LL | | } - | |__- in this expansion of `pong!` (#5) +LL | / macro_rules! pong { +LL | | () => { syntax error }; + | | ^^^^^ expected one of 8 possible tokens +LL | | } + | |_- in this expansion of `pong!` (#5) ... -LL | deep!(); - | ------- in this macro invocation (#1) +LL | deep!(); + | ------- in this macro invocation (#1) | ::: $DIR/auxiliary/ping.rs:5:1 | -LL | / macro_rules! ping { -LL | | () => { -LL | | pong!(); - | | ------- in this macro invocation (#5) -LL | | } -LL | | } - | |_- in this expansion of `ping!` (#4) +LL | macro_rules! ping { + | ----------------- in this expansion of `ping!` (#4) +LL | () => { +LL | pong!(); + | ------- in this macro invocation (#5) ... -LL | / macro_rules! deep { -LL | | () => { -LL | | foo!(); - | | ------ in this macro invocation (#2) -LL | | } -LL | | } - | |__- in this expansion of `deep!` (#1) +LL | macro_rules! deep { + | ----------------- in this expansion of `deep!` (#1) +LL | () => { +LL | foo!(); + | ------ in this macro invocation (#2) ... -LL | / macro_rules! foo { -LL | | () => { -LL | | bar!(); - | | ------ in this macro invocation (#3) -LL | | } -LL | | } - | |__- in this expansion of `foo!` (#2) +LL | macro_rules! foo { + | ---------------- in this expansion of `foo!` (#2) +LL | () => { +LL | bar!(); + | ------ in this macro invocation (#3) ... -LL | / macro_rules! bar { -LL | | () => { -LL | | ping!(); - | | ------- in this macro invocation (#4) -LL | | } -LL | | } - | |__- in this expansion of `bar!` (#3) +LL | macro_rules! bar { + | ---------------- in this expansion of `bar!` (#3) +LL | () => { +LL | ping!(); + | ------- in this macro invocation (#4) error: aborting due to 3 previous errors diff --git a/src/test/ui/macros/rfc-2011-nicer-assert-messages/codegen.rs b/src/test/ui/macros/rfc-2011-nicer-assert-messages/codegen.rs deleted file mode 100644 index 1db9d33c72a..00000000000 --- a/src/test/ui/macros/rfc-2011-nicer-assert-messages/codegen.rs +++ /dev/null @@ -1,9 +0,0 @@ -// check-pass -// compile-flags: -Z unpretty=expanded - -#![feature(core_intrinsics, generic_assert, generic_assert_internals)] - -fn main() { - let elem = 1i32; - assert!(elem == 1); -} diff --git a/src/test/ui/macros/rfc-2011-nicer-assert-messages/codegen.stdout b/src/test/ui/macros/rfc-2011-nicer-assert-messages/codegen.stdout deleted file mode 100644 index a590eb32232..00000000000 --- a/src/test/ui/macros/rfc-2011-nicer-assert-messages/codegen.stdout +++ /dev/null @@ -1,29 +0,0 @@ -#![feature(prelude_import)] -#![no_std] -// check-pass -// compile-flags: -Z unpretty=expanded - -#![feature(core_intrinsics, generic_assert, generic_assert_internals)] -#[prelude_import] -use ::std::prelude::rust_2015::*; -#[macro_use] -extern crate std; - -fn main() { - let elem = 1i32; - { - #[allow(unused_imports)] - use ::core::asserting::{TryCaptureGeneric, TryCapturePrintable}; - let mut __capture0 = ::core::asserting::Capture::new(); - let __local_bind0 = &elem; - if !(*{ - (&::core::asserting::Wrapper(__local_bind0)).try_capture(&mut __capture0); - __local_bind0 - } == 1) { - { - ::std::rt::panic_fmt(::core::fmt::Arguments::new_v1(&["Assertion failed: elem == 1\nWith captures:\n elem = ", - "\n"], &[::core::fmt::ArgumentV1::new_debug(&__capture0)])) - } - } - }; -} diff --git a/src/test/ui/macros/rfc-2011-nicer-assert-messages/non-consuming-methods-have-optimized-codegen.rs b/src/test/ui/macros/rfc-2011-nicer-assert-messages/non-consuming-methods-have-optimized-codegen.rs new file mode 100644 index 00000000000..5ec84b08ff8 --- /dev/null +++ b/src/test/ui/macros/rfc-2011-nicer-assert-messages/non-consuming-methods-have-optimized-codegen.rs @@ -0,0 +1,32 @@ +// check-pass +// compile-flags: -Z unpretty=expanded + +#![feature(core_intrinsics, generic_assert, generic_assert_internals)] + +fn arbitrary_consuming_method_for_demonstration_purposes() { + let elem = 1i32; + assert!(elem as usize); +} + +fn addr_of() { + let elem = 1i32; + assert!(&elem); +} + +fn binary() { + let elem = 1i32; + assert!(elem == 1); + assert!(elem >= 1); + assert!(elem > 0); + assert!(elem < 3); + assert!(elem <= 3); + assert!(elem != 3); +} + +fn unary() { + let elem = &1i32; + assert!(*elem); +} + +fn main() { +} diff --git a/src/test/ui/macros/rfc-2011-nicer-assert-messages/non-consuming-methods-have-optimized-codegen.stdout b/src/test/ui/macros/rfc-2011-nicer-assert-messages/non-consuming-methods-have-optimized-codegen.stdout new file mode 100644 index 00000000000..90f858f80e6 --- /dev/null +++ b/src/test/ui/macros/rfc-2011-nicer-assert-messages/non-consuming-methods-have-optimized-codegen.stdout @@ -0,0 +1,147 @@ +#![feature(prelude_import)] +#![no_std] +// check-pass +// compile-flags: -Z unpretty=expanded + +#![feature(core_intrinsics, generic_assert, generic_assert_internals)] +#[prelude_import] +use ::std::prelude::rust_2015::*; +#[macro_use] +extern crate std; + +fn arbitrary_consuming_method_for_demonstration_purposes() { + let elem = 1i32; + { + #[allow(unused_imports)] + use ::core::asserting::{TryCaptureGeneric, TryCapturePrintable}; + let mut __capture0 = ::core::asserting::Capture::new(); + let __local_bind0 = &elem; + if ::core::intrinsics::unlikely(!(*{ + (&::core::asserting::Wrapper(__local_bind0)).try_capture(&mut __capture0); + __local_bind0 + } as usize)) { + + + + + { + ::std::rt::panic_fmt(::core::fmt::Arguments::new_v1(&["Assertion failed: elem as usize\nWith captures:\n elem = ", + "\n"], &[::core::fmt::ArgumentV1::new_debug(&__capture0)])) + } + } + }; +} +fn addr_of() { + let elem = 1i32; + { + #[allow(unused_imports)] + use ::core::asserting::{TryCaptureGeneric, TryCapturePrintable}; + let mut __capture0 = ::core::asserting::Capture::new(); + let __local_bind0 = &elem; + if ::core::intrinsics::unlikely(!&*__local_bind0) { + (&::core::asserting::Wrapper(__local_bind0)).try_capture(&mut __capture0); + { + ::std::rt::panic_fmt(::core::fmt::Arguments::new_v1(&["Assertion failed: &elem\nWith captures:\n elem = ", + "\n"], &[::core::fmt::ArgumentV1::new_debug(&__capture0)])) + } + } + }; +} +fn binary() { + let elem = 1i32; + { + #[allow(unused_imports)] + use ::core::asserting::{TryCaptureGeneric, TryCapturePrintable}; + let mut __capture0 = ::core::asserting::Capture::new(); + let __local_bind0 = &elem; + if ::core::intrinsics::unlikely(!(*__local_bind0 == 1)) { + (&::core::asserting::Wrapper(__local_bind0)).try_capture(&mut __capture0); + { + ::std::rt::panic_fmt(::core::fmt::Arguments::new_v1(&["Assertion failed: elem == 1\nWith captures:\n elem = ", + "\n"], &[::core::fmt::ArgumentV1::new_debug(&__capture0)])) + } + } + }; + { + #[allow(unused_imports)] + use ::core::asserting::{TryCaptureGeneric, TryCapturePrintable}; + let mut __capture0 = ::core::asserting::Capture::new(); + let __local_bind0 = &elem; + if ::core::intrinsics::unlikely(!(*__local_bind0 >= 1)) { + (&::core::asserting::Wrapper(__local_bind0)).try_capture(&mut __capture0); + { + ::std::rt::panic_fmt(::core::fmt::Arguments::new_v1(&["Assertion failed: elem >= 1\nWith captures:\n elem = ", + "\n"], &[::core::fmt::ArgumentV1::new_debug(&__capture0)])) + } + } + }; + { + #[allow(unused_imports)] + use ::core::asserting::{TryCaptureGeneric, TryCapturePrintable}; + let mut __capture0 = ::core::asserting::Capture::new(); + let __local_bind0 = &elem; + if ::core::intrinsics::unlikely(!(*__local_bind0 > 0)) { + (&::core::asserting::Wrapper(__local_bind0)).try_capture(&mut __capture0); + { + ::std::rt::panic_fmt(::core::fmt::Arguments::new_v1(&["Assertion failed: elem > 0\nWith captures:\n elem = ", + "\n"], &[::core::fmt::ArgumentV1::new_debug(&__capture0)])) + } + } + }; + { + #[allow(unused_imports)] + use ::core::asserting::{TryCaptureGeneric, TryCapturePrintable}; + let mut __capture0 = ::core::asserting::Capture::new(); + let __local_bind0 = &elem; + if ::core::intrinsics::unlikely(!(*__local_bind0 < 3)) { + (&::core::asserting::Wrapper(__local_bind0)).try_capture(&mut __capture0); + { + ::std::rt::panic_fmt(::core::fmt::Arguments::new_v1(&["Assertion failed: elem < 3\nWith captures:\n elem = ", + "\n"], &[::core::fmt::ArgumentV1::new_debug(&__capture0)])) + } + } + }; + { + #[allow(unused_imports)] + use ::core::asserting::{TryCaptureGeneric, TryCapturePrintable}; + let mut __capture0 = ::core::asserting::Capture::new(); + let __local_bind0 = &elem; + if ::core::intrinsics::unlikely(!(*__local_bind0 <= 3)) { + (&::core::asserting::Wrapper(__local_bind0)).try_capture(&mut __capture0); + { + ::std::rt::panic_fmt(::core::fmt::Arguments::new_v1(&["Assertion failed: elem <= 3\nWith captures:\n elem = ", + "\n"], &[::core::fmt::ArgumentV1::new_debug(&__capture0)])) + } + } + }; + { + #[allow(unused_imports)] + use ::core::asserting::{TryCaptureGeneric, TryCapturePrintable}; + let mut __capture0 = ::core::asserting::Capture::new(); + let __local_bind0 = &elem; + if ::core::intrinsics::unlikely(!(*__local_bind0 != 3)) { + (&::core::asserting::Wrapper(__local_bind0)).try_capture(&mut __capture0); + { + ::std::rt::panic_fmt(::core::fmt::Arguments::new_v1(&["Assertion failed: elem != 3\nWith captures:\n elem = ", + "\n"], &[::core::fmt::ArgumentV1::new_debug(&__capture0)])) + } + } + }; +} +fn unary() { + let elem = &1i32; + { + #[allow(unused_imports)] + use ::core::asserting::{TryCaptureGeneric, TryCapturePrintable}; + let mut __capture0 = ::core::asserting::Capture::new(); + let __local_bind0 = &elem; + if ::core::intrinsics::unlikely(!**__local_bind0) { + (&::core::asserting::Wrapper(__local_bind0)).try_capture(&mut __capture0); + { + ::std::rt::panic_fmt(::core::fmt::Arguments::new_v1(&["Assertion failed: *elem\nWith captures:\n elem = ", + "\n"], &[::core::fmt::ArgumentV1::new_debug(&__capture0)])) + } + } + }; +} +fn main() {} diff --git a/src/test/ui/macros/unknown-builtin.stderr b/src/test/ui/macros/unknown-builtin.stderr index 7b04e05293e..8f9dba16578 100644 --- a/src/test/ui/macros/unknown-builtin.stderr +++ b/src/test/ui/macros/unknown-builtin.stderr @@ -7,12 +7,8 @@ LL | macro_rules! unknown { () => () } error[E0773]: attempted to define built-in macro more than once --> $SRC_DIR/core/src/macros/mod.rs:LL:COL | -LL | / macro_rules! line { -LL | | () => { -LL | | /* compiler built-in */ -LL | | }; -LL | | } - | |_____^ +LL | macro_rules! line { + | ^^^^^^^^^^^^^^^^^ | note: previously defined here --> $DIR/unknown-builtin.rs:9:1 diff --git a/src/test/ui/marker_trait_attr/marker-trait-with-associated-items.stderr b/src/test/ui/marker_trait_attr/marker-trait-with-associated-items.stderr index ae7d5a98b08..ac218e30b9b 100644 --- a/src/test/ui/marker_trait_attr/marker-trait-with-associated-items.stderr +++ b/src/test/ui/marker_trait_attr/marker-trait-with-associated-items.stderr @@ -2,13 +2,13 @@ error[E0714]: marker traits cannot have associated items --> $DIR/marker-trait-with-associated-items.rs:6:5 | LL | const N: usize; - | ^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^ error[E0714]: marker traits cannot have associated items --> $DIR/marker-trait-with-associated-items.rs:12:5 | LL | type Output; - | ^^^^^^^^^^^^ + | ^^^^^^^^^^^ error[E0714]: marker traits cannot have associated items --> $DIR/marker-trait-with-associated-items.rs:18:5 @@ -20,13 +20,13 @@ error[E0714]: marker traits cannot have associated items --> $DIR/marker-trait-with-associated-items.rs:24:5 | LL | const N: usize = 43; - | ^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^ error[E0714]: marker traits cannot have associated items --> $DIR/marker-trait-with-associated-items.rs:30:5 | LL | type Output = (); - | ^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^ error[E0714]: marker traits cannot have associated items --> $DIR/marker-trait-with-associated-items.rs:36:5 diff --git a/src/test/ui/marker_trait_attr/region-overlap.stderr b/src/test/ui/marker_trait_attr/region-overlap.stderr index 2eeab801e3d..6631fe987e2 100644 --- a/src/test/ui/marker_trait_attr/region-overlap.stderr +++ b/src/test/ui/marker_trait_attr/region-overlap.stderr @@ -1,8 +1,8 @@ -error[E0283]: type annotations needed +error[E0283]: type annotations needed: cannot satisfy `(&'static (), &'a ()): A` --> $DIR/region-overlap.rs:5:10 | LL | impl<'a> A for (&'static (), &'a ()) {} - | ^ cannot infer type for tuple `(&'static (), &'a ())` + | ^ | note: multiple `impl`s satisfying `(&'static (), &'a ()): A` found --> $DIR/region-overlap.rs:5:1 @@ -12,11 +12,11 @@ LL | impl<'a> A for (&'static (), &'a ()) {} LL | impl<'a> A for (&'a (), &'static ()) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error[E0283]: type annotations needed +error[E0283]: type annotations needed: cannot satisfy `(&'a (), &'static ()): A` --> $DIR/region-overlap.rs:6:10 | LL | impl<'a> A for (&'a (), &'static ()) {} - | ^ cannot infer type for tuple `(&'a (), &'static ())` + | ^ | note: multiple `impl`s satisfying `(&'a (), &'static ()): A` found --> $DIR/region-overlap.rs:5:1 diff --git a/src/test/ui/match/match_non_exhaustive.stderr b/src/test/ui/match/match_non_exhaustive.stderr index 6206dc85ea0..9d92f8fdbb4 100644 --- a/src/test/ui/match/match_non_exhaustive.stderr +++ b/src/test/ui/match/match_non_exhaustive.stderr @@ -25,7 +25,7 @@ note: `E1` defined here --> $DIR/auxiliary/match_non_exhaustive_lib.rs:2:1 | LL | pub enum E1 {} - | ^^^^^^^^^^^^^^ + | ^^^^^^^^^^^ = note: the matched value is of type `E1`, which is marked as non-exhaustive help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown | @@ -44,7 +44,7 @@ note: `E2` defined here --> $DIR/auxiliary/match_non_exhaustive_lib.rs:5:1 | LL | pub enum E2 { A, B } - | ^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^ = note: the matched value is of type `E2`, which is marked as non-exhaustive help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | diff --git a/src/test/ui/methods/method-call-err-msg.stderr b/src/test/ui/methods/method-call-err-msg.stderr index 77308a2c521..4be588fe7f9 100644 --- a/src/test/ui/methods/method-call-err-msg.stderr +++ b/src/test/ui/methods/method-call-err-msg.stderr @@ -2,7 +2,7 @@ error[E0061]: this function takes 0 arguments but 1 argument was supplied --> $DIR/method-call-err-msg.rs:13:7 | LL | x.zero(0) - | ^^^^ - argument unexpected + | ^^^^ - argument of type `{integer}` unexpected | note: associated function defined here --> $DIR/method-call-err-msg.rs:5:8 @@ -50,7 +50,7 @@ error[E0599]: `Foo` is not an iterator --> $DIR/method-call-err-msg.rs:19:7 | LL | pub struct Foo; - | --------------- + | -------------- | | | | | method `take` not found for this struct | doesn't satisfy `Foo: Iterator` @@ -64,14 +64,8 @@ LL | .take() note: the following trait must be implemented --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL | -LL | / pub trait Iterator { -LL | | /// The type of the elements being iterated over. -LL | | #[stable(feature = "rust1", since = "1.0.0")] -LL | | type Item; -... | -LL | | } -LL | | } - | |_^ +LL | pub trait Iterator { + | ^^^^^^^^^^^^^^^^^^ = help: items from traits can only be used if the trait is implemented and in scope = note: the following trait defines an item `take`, perhaps you need to implement it: candidate #1: `Iterator` diff --git a/src/test/ui/methods/method-macro-backtrace.stderr b/src/test/ui/methods/method-macro-backtrace.stderr index 7860365476a..7ae00835c96 100644 --- a/src/test/ui/methods/method-macro-backtrace.stderr +++ b/src/test/ui/methods/method-macro-backtrace.stderr @@ -2,9 +2,9 @@ error[E0201]: duplicate definitions with name `bar`: --> $DIR/method-macro-backtrace.rs:22:5 | LL | fn bar(&self) { } - | ----------------- previous definition of `bar` here + | ------------- previous definition of `bar` here LL | fn bar(&self) { } - | ^^^^^^^^^^^^^^^^^ duplicate definition + | ^^^^^^^^^^^^^ duplicate definition error: aborting due to previous error diff --git a/src/test/ui/mir/issue-67947.rs b/src/test/ui/mir/issue-67947.rs index 79e75e655ff..f73d38f8042 100644 --- a/src/test/ui/mir/issue-67947.rs +++ b/src/test/ui/mir/issue-67947.rs @@ -1,6 +1,6 @@ struct Bug { A: [(); { *"" }.len()], - //~^ ERROR: cannot move a value of type str + //~^ ERROR: cannot move a value of type `str` //~| ERROR: cannot move out of a shared reference } diff --git a/src/test/ui/mir/issue-67947.stderr b/src/test/ui/mir/issue-67947.stderr index d5262181620..7697a411eb4 100644 --- a/src/test/ui/mir/issue-67947.stderr +++ b/src/test/ui/mir/issue-67947.stderr @@ -1,8 +1,8 @@ -error[E0161]: cannot move a value of type str: the size of str cannot be statically determined +error[E0161]: cannot move a value of type `str` --> $DIR/issue-67947.rs:2:13 | LL | A: [(); { *"" }.len()], - | ^^^^^^^ + | ^^^^^^^ the size of `str` cannot be statically determined error[E0507]: cannot move out of a shared reference --> $DIR/issue-67947.rs:2:15 diff --git a/src/test/ui/mismatched_types/assignment-operator-unimplemented.stderr b/src/test/ui/mismatched_types/assignment-operator-unimplemented.stderr index 73c9f86e002..ffd95b48ac2 100644 --- a/src/test/ui/mismatched_types/assignment-operator-unimplemented.stderr +++ b/src/test/ui/mismatched_types/assignment-operator-unimplemented.stderr @@ -10,18 +10,12 @@ note: an implementation of `AddAssign<_>` might be missing for `Foo` --> $DIR/assignment-operator-unimplemented.rs:1:1 | LL | struct Foo; - | ^^^^^^^^^^^ must implement `AddAssign<_>` + | ^^^^^^^^^^ must implement `AddAssign<_>` note: the following trait must be implemented --> $SRC_DIR/core/src/ops/arith.rs:LL:COL | -LL | / pub trait AddAssign<Rhs = Self> { -LL | | /// Performs the `+=` operation. -LL | | /// -LL | | /// # Example -... | -LL | | fn add_assign(&mut self, rhs: Rhs); -LL | | } - | |_^ +LL | pub trait AddAssign<Rhs = Self> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/mismatched_types/cast-rfc0401.stderr b/src/test/ui/mismatched_types/cast-rfc0401.stderr index e63ca6e11de..eab8e8e80c4 100644 --- a/src/test/ui/mismatched_types/cast-rfc0401.stderr +++ b/src/test/ui/mismatched_types/cast-rfc0401.stderr @@ -220,7 +220,7 @@ LL | let _ = fat_v as *const dyn Foo; | ^^^^^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `[u8]` - = note: required for the cast to the object type `dyn Foo` + = note: required for the cast from `[u8]` to the object type `dyn Foo` help: consider borrowing the value, since `&[u8]` can be coerced into `dyn Foo` | LL | let _ = &fat_v as *const dyn Foo; @@ -233,7 +233,7 @@ LL | let _ = a as *const dyn Foo; | ^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `str` - = note: required for the cast to the object type `dyn Foo` + = note: required for the cast from `str` to the object type `dyn Foo` help: consider borrowing the value, since `&str` can be coerced into `dyn Foo` | LL | let _ = &a as *const dyn Foo; diff --git a/src/test/ui/mismatched_types/closure-arg-count.stderr b/src/test/ui/mismatched_types/closure-arg-count.stderr index fed47e0f174..3968774e357 100644 --- a/src/test/ui/mismatched_types/closure-arg-count.stderr +++ b/src/test/ui/mismatched_types/closure-arg-count.stderr @@ -188,7 +188,7 @@ LL | call(Foo); | required by a bound introduced by this call ... LL | struct Foo(u8); - | --------------- takes 1 argument + | ---------- takes 1 argument | note: required by a bound in `call` --> $DIR/closure-arg-count.rs:42:30 diff --git a/src/test/ui/mismatched_types/overloaded-calls-bad.stderr b/src/test/ui/mismatched_types/overloaded-calls-bad.stderr index 4000b2ba312..cb93a7ad900 100644 --- a/src/test/ui/mismatched_types/overloaded-calls-bad.stderr +++ b/src/test/ui/mismatched_types/overloaded-calls-bad.stderr @@ -32,7 +32,7 @@ error[E0057]: this function takes 1 argument but 2 arguments were supplied --> $DIR/overloaded-calls-bad.rs:31:15 | LL | let ans = s("burma", "shave"); - | ^ ------- ------- argument unexpected + | ^ ------- ------- argument of type `&'static str` unexpected | | | expected `isize`, found `&str` | diff --git a/src/test/ui/missing-trait-bounds/issue-69725.stderr b/src/test/ui/missing-trait-bounds/issue-69725.stderr index 6395bca300c..980d9dd167d 100644 --- a/src/test/ui/missing-trait-bounds/issue-69725.stderr +++ b/src/test/ui/missing-trait-bounds/issue-69725.stderr @@ -7,7 +7,7 @@ LL | let _ = Struct::<A>::new().clone(); ::: $DIR/auxiliary/issue-69725.rs:2:1 | LL | pub struct Struct<A>(A); - | ------------------------ doesn't satisfy `Struct<A>: Clone` + | -------------------- doesn't satisfy `Struct<A>: Clone` | = note: the following trait bounds were not satisfied: `A: Clone` diff --git a/src/test/ui/missing-trait-bounds/missing-trait-bounds-for-method-call.stderr b/src/test/ui/missing-trait-bounds/missing-trait-bounds-for-method-call.stderr index f3c6b39e62e..9e94aa2c7b3 100644 --- a/src/test/ui/missing-trait-bounds/missing-trait-bounds-for-method-call.stderr +++ b/src/test/ui/missing-trait-bounds/missing-trait-bounds-for-method-call.stderr @@ -30,7 +30,7 @@ error[E0599]: the method `foo` exists for reference `&Fin<T>`, but its trait bou --> $DIR/missing-trait-bounds-for-method-call.rs:27:14 | LL | struct Fin<T> where T: Bar { - | -------------------------- doesn't satisfy `Fin<T>: Bar` + | ------------- doesn't satisfy `Fin<T>: Bar` ... LL | self.foo(); | ^^^ method cannot be called on `&Fin<T>` due to unsatisfied trait bounds diff --git a/src/test/ui/moves/move-deref-coercion.stderr b/src/test/ui/moves/move-deref-coercion.stderr index e3bdf6d7832..5760f4a7fdc 100644 --- a/src/test/ui/moves/move-deref-coercion.stderr +++ b/src/test/ui/moves/move-deref-coercion.stderr @@ -12,7 +12,7 @@ note: deref defined here --> $DIR/move-deref-coercion.rs:17:5 | LL | type Target = NotCopy; - | ^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^ error[E0382]: borrow of partially moved value: `val` --> $DIR/move-deref-coercion.rs:30:5 @@ -28,7 +28,7 @@ note: deref defined here --> $DIR/move-deref-coercion.rs:17:5 | LL | type Target = NotCopy; - | ^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/namespace/namespace-mix.stderr b/src/test/ui/namespace/namespace-mix.stderr index ccdd4dd272e..fbd86bdb661 100644 --- a/src/test/ui/namespace/namespace-mix.stderr +++ b/src/test/ui/namespace/namespace-mix.stderr @@ -33,7 +33,7 @@ LL | check(xm1::S); ::: $DIR/auxiliary/namespace-mix.rs:3:5 | LL | pub struct TS(); - | ---------------- similarly named tuple struct `TS` defined here + | ------------- similarly named tuple struct `TS` defined here | = note: can't use a type alias as a constructor help: a tuple struct with a similar name exists diff --git a/src/test/ui/never_type/fallback-closure-wrap.fallback.stderr b/src/test/ui/never_type/fallback-closure-wrap.fallback.stderr index 78d1a3caf4a..6b9635d4a60 100644 --- a/src/test/ui/never_type/fallback-closure-wrap.fallback.stderr +++ b/src/test/ui/never_type/fallback-closure-wrap.fallback.stderr @@ -10,7 +10,7 @@ LL | | }) as Box<dyn FnMut()>); | = note: expected unit type `()` found type `!` - = note: required for the cast to the object type `dyn FnMut()` + = note: required for the cast from `[closure@$DIR/fallback-closure-wrap.rs:18:40: 21:6]` to the object type `dyn FnMut()` error: aborting due to previous error diff --git a/src/test/ui/never_type/impl_trait_fallback2.rs b/src/test/ui/never_type/impl_trait_fallback2.rs index f73d953bdbd..12c187b9e82 100644 --- a/src/test/ui/never_type/impl_trait_fallback2.rs +++ b/src/test/ui/never_type/impl_trait_fallback2.rs @@ -13,6 +13,7 @@ fn should_ret_unit() -> impl T { type Foo = impl T; fn a() -> Foo { + //~^ ERROR `(): T` is not satisfied panic!() } diff --git a/src/test/ui/never_type/impl_trait_fallback2.stderr b/src/test/ui/never_type/impl_trait_fallback2.stderr index 4a78e73e5f6..78cc83bdbfa 100644 --- a/src/test/ui/never_type/impl_trait_fallback2.stderr +++ b/src/test/ui/never_type/impl_trait_fallback2.stderr @@ -6,6 +6,14 @@ LL | fn should_ret_unit() -> impl T { | = help: the trait `T` is implemented for `i32` -error: aborting due to previous error +error[E0277]: the trait bound `(): T` is not satisfied + --> $DIR/impl_trait_fallback2.rs:15:11 + | +LL | fn a() -> Foo { + | ^^^ the trait `T` is not implemented for `()` + | + = help: the trait `T` is implemented for `i32` + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/never_type/impl_trait_fallback3.rs b/src/test/ui/never_type/impl_trait_fallback3.rs index 26ce9b93105..ed645b82394 100644 --- a/src/test/ui/never_type/impl_trait_fallback3.rs +++ b/src/test/ui/never_type/impl_trait_fallback3.rs @@ -7,9 +7,9 @@ trait T { } type Foo = impl T; -//~^ ERROR unconstrained opaque type fn a() -> Foo { + //~^ ERROR the trait bound `(): T` is not satisfied // This is not a defining use, it doesn't actually constrain the opaque type. panic!() } diff --git a/src/test/ui/never_type/impl_trait_fallback3.stderr b/src/test/ui/never_type/impl_trait_fallback3.stderr index 121019d5f69..5d5d216fb9b 100644 --- a/src/test/ui/never_type/impl_trait_fallback3.stderr +++ b/src/test/ui/never_type/impl_trait_fallback3.stderr @@ -1,10 +1,9 @@ -error: unconstrained opaque type - --> $DIR/impl_trait_fallback3.rs:9:12 +error[E0277]: the trait bound `(): T` is not satisfied + --> $DIR/impl_trait_fallback3.rs:11:11 | -LL | type Foo = impl T; - | ^^^^^^ - | - = note: `Foo` must be used in combination with a concrete type within the same module +LL | fn a() -> Foo { + | ^^^ the trait `T` is not implemented for `()` error: aborting due to previous error +For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/never_type/never-from-impl-is-reserved.stderr b/src/test/ui/never_type/never-from-impl-is-reserved.stderr index 871c5120528..f9f7c787ecb 100644 --- a/src/test/ui/never_type/never-from-impl-is-reserved.stderr +++ b/src/test/ui/never_type/never-from-impl-is-reserved.stderr @@ -5,7 +5,7 @@ LL | impl MyTrait for MyFoo {} | ---------------------- first implementation here LL | // This will conflict with the first impl if we impl `for<T> T: From<!>`. LL | impl<T> MyTrait for T where T: From<!> {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `MyFoo` + | ^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `MyFoo` | = note: permitting this impl would forbid us from adding `impl<T> From<!> for T` later; see rust-lang/rust#64715 for details diff --git a/src/test/ui/no-capture-arc.stderr b/src/test/ui/no-capture-arc.stderr index 7fa2090e3e6..9ae41e78c22 100644 --- a/src/test/ui/no-capture-arc.stderr +++ b/src/test/ui/no-capture-arc.stderr @@ -17,7 +17,7 @@ note: deref defined here --> $SRC_DIR/alloc/src/sync.rs:LL:COL | LL | type Target = T; - | ^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/no-reuse-move-arc.stderr b/src/test/ui/no-reuse-move-arc.stderr index bcc4506dc8d..564b0585474 100644 --- a/src/test/ui/no-reuse-move-arc.stderr +++ b/src/test/ui/no-reuse-move-arc.stderr @@ -17,7 +17,7 @@ note: deref defined here --> $SRC_DIR/alloc/src/sync.rs:LL:COL | LL | type Target = T; - | ^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/object-safety/object-safety-by-value-self-use.rs b/src/test/ui/object-safety/object-safety-by-value-self-use.rs index f903f26c090..8e93c538217 100644 --- a/src/test/ui/object-safety/object-safety-by-value-self-use.rs +++ b/src/test/ui/object-safety/object-safety-by-value-self-use.rs @@ -12,7 +12,7 @@ trait Baz { } fn use_bar(t: Box<dyn Bar>) { - t.bar() //~ ERROR cannot move a value of type dyn Bar + t.bar() //~ ERROR cannot move a value of type `dyn Bar` } fn main() { } diff --git a/src/test/ui/object-safety/object-safety-by-value-self-use.stderr b/src/test/ui/object-safety/object-safety-by-value-self-use.stderr index 7ccc0cbdd57..94fdcdf263a 100644 --- a/src/test/ui/object-safety/object-safety-by-value-self-use.stderr +++ b/src/test/ui/object-safety/object-safety-by-value-self-use.stderr @@ -1,8 +1,8 @@ -error[E0161]: cannot move a value of type dyn Bar: the size of dyn Bar cannot be statically determined +error[E0161]: cannot move a value of type `dyn Bar` --> $DIR/object-safety-by-value-self-use.rs:15:5 | LL | t.bar() - | ^^^^^^^ + | ^^^^^^^ the size of `dyn Bar` cannot be statically determined error: aborting due to previous error diff --git a/src/test/ui/or-patterns/or-patterns-syntactic-fail.stderr b/src/test/ui/or-patterns/or-patterns-syntactic-fail.stderr index c94adfe4ab3..920720a4f53 100644 --- a/src/test/ui/or-patterns/or-patterns-syntactic-fail.stderr +++ b/src/test/ui/or-patterns/or-patterns-syntactic-fail.stderr @@ -38,14 +38,8 @@ LL | enum E { A, B } note: the following trait must be implemented --> $SRC_DIR/core/src/ops/bit.rs:LL:COL | -LL | / pub trait BitOr<Rhs = Self> { -LL | | /// The resulting type after applying the `|` operator. -LL | | #[stable(feature = "rust1", since = "1.0.0")] -LL | | type Output; -... | -LL | | fn bitor(self, rhs: Rhs) -> Self::Output; -LL | | } - | |_^ +LL | pub trait BitOr<Rhs = Self> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 5 previous errors diff --git a/src/test/ui/panic-runtime/auxiliary/needs-abort.rs b/src/test/ui/panic-runtime/auxiliary/needs-abort.rs new file mode 100644 index 00000000000..8fad49b5e9d --- /dev/null +++ b/src/test/ui/panic-runtime/auxiliary/needs-abort.rs @@ -0,0 +1,5 @@ +// compile-flags:-C panic=abort +// no-prefer-dynamic + +#![crate_type = "rlib"] +#![no_std] diff --git a/src/test/ui/panic-runtime/auxiliary/needs-unwind.rs b/src/test/ui/panic-runtime/auxiliary/needs-unwind.rs new file mode 100644 index 00000000000..d555b531986 --- /dev/null +++ b/src/test/ui/panic-runtime/auxiliary/needs-unwind.rs @@ -0,0 +1,13 @@ +// compile-flags:-C panic=unwind +// no-prefer-dynamic + +#![crate_type = "rlib"] +#![no_std] +#![feature(c_unwind)] + +extern "C-unwind" fn foo() {} + +fn bar() { + let ptr: extern "C-unwind" fn() = foo; + ptr(); +} diff --git a/src/test/ui/panic-runtime/need-abort-got-unwind.rs b/src/test/ui/panic-runtime/need-abort-got-unwind.rs new file mode 100644 index 00000000000..c72fb96e357 --- /dev/null +++ b/src/test/ui/panic-runtime/need-abort-got-unwind.rs @@ -0,0 +1,9 @@ +// build-fail +// needs-unwind +// error-pattern:is incompatible with this crate's strategy of `unwind` +// aux-build:needs-abort.rs +// ignore-wasm32-bare compiled with panic=abort by default + +extern crate needs_abort; + +fn main() {} diff --git a/src/test/ui/panic-runtime/need-abort-got-unwind.stderr b/src/test/ui/panic-runtime/need-abort-got-unwind.stderr new file mode 100644 index 00000000000..d29c7875fd0 --- /dev/null +++ b/src/test/ui/panic-runtime/need-abort-got-unwind.stderr @@ -0,0 +1,4 @@ +error: the crate `needs_abort` requires panic strategy `abort` which is incompatible with this crate's strategy of `unwind` + +error: aborting due to previous error + diff --git a/src/test/ui/panic-runtime/need-unwind-got-abort.rs b/src/test/ui/panic-runtime/need-unwind-got-abort.rs new file mode 100644 index 00000000000..6752ecf90d2 --- /dev/null +++ b/src/test/ui/panic-runtime/need-unwind-got-abort.rs @@ -0,0 +1,9 @@ +// build-fail +// error-pattern:is incompatible with this crate's strategy of `abort` +// aux-build:needs-unwind.rs +// compile-flags:-C panic=abort +// no-prefer-dynamic + +extern crate needs_unwind; + +fn main() {} diff --git a/src/test/ui/panic-runtime/need-unwind-got-abort.stderr b/src/test/ui/panic-runtime/need-unwind-got-abort.stderr new file mode 100644 index 00000000000..4c71df3ebc1 --- /dev/null +++ b/src/test/ui/panic-runtime/need-unwind-got-abort.stderr @@ -0,0 +1,4 @@ +error: the crate `needs_unwind` requires panic strategy `unwind` which is incompatible with this crate's strategy of `abort` + +error: aborting due to previous error + diff --git a/src/test/ui/panic-runtime/transitive-link-a-bunch.stderr b/src/test/ui/panic-runtime/transitive-link-a-bunch.stderr index 4af754c81f9..7f4a8ed290e 100644 --- a/src/test/ui/panic-runtime/transitive-link-a-bunch.stderr +++ b/src/test/ui/panic-runtime/transitive-link-a-bunch.stderr @@ -2,9 +2,7 @@ error: cannot link together two panic runtimes: panic_runtime_unwind and panic_r error: the linked panic runtime `panic_runtime_abort` is not compiled with this crate's panic strategy `unwind` -error: the crate `wants_panic_runtime_abort` is compiled with the panic strategy `abort` which is incompatible with this crate's strategy of `unwind` +error: the crate `wants_panic_runtime_abort` requires panic strategy `abort` which is incompatible with this crate's strategy of `unwind` -error: the crate `panic_runtime_abort` is compiled with the panic strategy `abort` which is incompatible with this crate's strategy of `unwind` - -error: aborting due to 4 previous errors +error: aborting due to 3 previous errors diff --git a/src/test/ui/panic-runtime/want-unwind-got-abort.rs b/src/test/ui/panic-runtime/want-unwind-got-abort.rs index c48caaf0790..23bfea6af15 100644 --- a/src/test/ui/panic-runtime/want-unwind-got-abort.rs +++ b/src/test/ui/panic-runtime/want-unwind-got-abort.rs @@ -1,6 +1,6 @@ // build-fail // needs-unwind -// error-pattern:is incompatible with this crate's strategy of `unwind` +// error-pattern:is not compiled with this crate's panic strategy `unwind` // aux-build:panic-runtime-abort.rs // aux-build:panic-runtime-lang-items.rs // ignore-wasm32-bare compiled with panic=abort by default diff --git a/src/test/ui/panic-runtime/want-unwind-got-abort.stderr b/src/test/ui/panic-runtime/want-unwind-got-abort.stderr index d4fd2cca81f..d306ce6c5ea 100644 --- a/src/test/ui/panic-runtime/want-unwind-got-abort.stderr +++ b/src/test/ui/panic-runtime/want-unwind-got-abort.stderr @@ -1,6 +1,4 @@ error: the linked panic runtime `panic_runtime_abort` is not compiled with this crate's panic strategy `unwind` -error: the crate `panic_runtime_abort` is compiled with the panic strategy `abort` which is incompatible with this crate's strategy of `unwind` - -error: aborting due to 2 previous errors +error: aborting due to previous error diff --git a/src/test/ui/panic-runtime/want-unwind-got-abort2.stderr b/src/test/ui/panic-runtime/want-unwind-got-abort2.stderr index 364a27a24eb..014437b7f1b 100644 --- a/src/test/ui/panic-runtime/want-unwind-got-abort2.stderr +++ b/src/test/ui/panic-runtime/want-unwind-got-abort2.stderr @@ -1,8 +1,6 @@ error: the linked panic runtime `panic_runtime_abort` is not compiled with this crate's panic strategy `unwind` -error: the crate `wants_panic_runtime_abort` is compiled with the panic strategy `abort` which is incompatible with this crate's strategy of `unwind` +error: the crate `wants_panic_runtime_abort` requires panic strategy `abort` which is incompatible with this crate's strategy of `unwind` -error: the crate `panic_runtime_abort` is compiled with the panic strategy `abort` which is incompatible with this crate's strategy of `unwind` - -error: aborting due to 3 previous errors +error: aborting due to 2 previous errors diff --git a/src/test/ui/panics/location-detail-unwrap-no-file.rs b/src/test/ui/panics/location-detail-unwrap-no-file.rs index 16cf8a17ff1..5955d9a25ae 100644 --- a/src/test/ui/panics/location-detail-unwrap-no-file.rs +++ b/src/test/ui/panics/location-detail-unwrap-no-file.rs @@ -1,6 +1,6 @@ // run-fail // check-run-results -// compile-flags: -Zlocation-detail=line,column +// compile-flags: -Copt-level=0 -Zlocation-detail=line,column // exec-env:RUST_BACKTRACE=0 fn main() { diff --git a/src/test/ui/parser/fn-header-semantic-fail.stderr b/src/test/ui/parser/fn-header-semantic-fail.stderr index bd3b9181123..75d27c614e2 100644 --- a/src/test/ui/parser/fn-header-semantic-fail.stderr +++ b/src/test/ui/parser/fn-header-semantic-fail.stderr @@ -234,30 +234,30 @@ LL | const async unsafe extern "C" fn ft5(); LL | const async unsafe extern "C" fn ft5() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `(): Future` -error[E0391]: cycle detected when computing type of `main::<impl at $DIR/fn-header-semantic-fail.rs:28:5: 40:6>::ft5::{opaque#0}` +error[E0391]: cycle detected when computing type of `main::<impl at $DIR/fn-header-semantic-fail.rs:28:5: 28:17>::ft5::{opaque#0}` --> $DIR/fn-header-semantic-fail.rs:34:48 | LL | const async unsafe extern "C" fn ft5() {} | ^ | -note: ...which requires borrow-checking `main::<impl at $DIR/fn-header-semantic-fail.rs:28:5: 40:6>::ft5`... +note: ...which requires borrow-checking `main::<impl at $DIR/fn-header-semantic-fail.rs:28:5: 28:17>::ft5`... --> $DIR/fn-header-semantic-fail.rs:34:9 | LL | const async unsafe extern "C" fn ft5() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -note: ...which requires processing `main::<impl at $DIR/fn-header-semantic-fail.rs:28:5: 40:6>::ft5`... +note: ...which requires processing `main::<impl at $DIR/fn-header-semantic-fail.rs:28:5: 28:17>::ft5`... --> $DIR/fn-header-semantic-fail.rs:34:9 | LL | const async unsafe extern "C" fn ft5() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -note: ...which requires const checking `main::<impl at $DIR/fn-header-semantic-fail.rs:28:5: 40:6>::ft5`... +note: ...which requires const checking `main::<impl at $DIR/fn-header-semantic-fail.rs:28:5: 28:17>::ft5`... --> $DIR/fn-header-semantic-fail.rs:34:9 | LL | const async unsafe extern "C" fn ft5() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: ...which requires computing whether `impl core::future::future::Future<Output = ()>` is freeze... = note: ...which requires evaluating trait selection obligation `impl core::future::future::Future<Output = ()>: core::marker::Freeze`... - = note: ...which again requires computing type of `main::<impl at $DIR/fn-header-semantic-fail.rs:28:5: 40:6>::ft5::{opaque#0}`, completing the cycle + = note: ...which again requires computing type of `main::<impl at $DIR/fn-header-semantic-fail.rs:28:5: 28:17>::ft5::{opaque#0}`, completing the cycle note: cycle used when checking item types in top-level module --> $DIR/fn-header-semantic-fail.rs:5:1 | @@ -270,30 +270,30 @@ LL | | } LL | | } | |_^ -error[E0391]: cycle detected when computing type of `main::<impl at $DIR/fn-header-semantic-fail.rs:42:5: 50:6>::fi5::{opaque#0}` +error[E0391]: cycle detected when computing type of `main::<impl at $DIR/fn-header-semantic-fail.rs:42:5: 42:11>::fi5::{opaque#0}` --> $DIR/fn-header-semantic-fail.rs:47:48 | LL | const async unsafe extern "C" fn fi5() {} | ^ | -note: ...which requires borrow-checking `main::<impl at $DIR/fn-header-semantic-fail.rs:42:5: 50:6>::fi5`... +note: ...which requires borrow-checking `main::<impl at $DIR/fn-header-semantic-fail.rs:42:5: 42:11>::fi5`... --> $DIR/fn-header-semantic-fail.rs:47:9 | LL | const async unsafe extern "C" fn fi5() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -note: ...which requires processing `main::<impl at $DIR/fn-header-semantic-fail.rs:42:5: 50:6>::fi5`... +note: ...which requires processing `main::<impl at $DIR/fn-header-semantic-fail.rs:42:5: 42:11>::fi5`... --> $DIR/fn-header-semantic-fail.rs:47:9 | LL | const async unsafe extern "C" fn fi5() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -note: ...which requires const checking `main::<impl at $DIR/fn-header-semantic-fail.rs:42:5: 50:6>::fi5`... +note: ...which requires const checking `main::<impl at $DIR/fn-header-semantic-fail.rs:42:5: 42:11>::fi5`... --> $DIR/fn-header-semantic-fail.rs:47:9 | LL | const async unsafe extern "C" fn fi5() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: ...which requires computing whether `impl core::future::future::Future<Output = ()>` is freeze... = note: ...which requires evaluating trait selection obligation `impl core::future::future::Future<Output = ()>: core::marker::Freeze`... - = note: ...which again requires computing type of `main::<impl at $DIR/fn-header-semantic-fail.rs:42:5: 50:6>::fi5::{opaque#0}`, completing the cycle + = note: ...which again requires computing type of `main::<impl at $DIR/fn-header-semantic-fail.rs:42:5: 42:11>::fi5::{opaque#0}`, completing the cycle note: cycle used when checking item types in top-level module --> $DIR/fn-header-semantic-fail.rs:5:1 | diff --git a/src/test/ui/pattern/issue-88074-pat-range-type-inference-err.stderr b/src/test/ui/pattern/issue-88074-pat-range-type-inference-err.stderr index 06a279925ed..8e528f8c1db 100644 --- a/src/test/ui/pattern/issue-88074-pat-range-type-inference-err.stderr +++ b/src/test/ui/pattern/issue-88074-pat-range-type-inference-err.stderr @@ -12,8 +12,6 @@ error[E0282]: type annotations needed | LL | Zero::ZERO ..= Zero::ZERO => {}, | ^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type - | - = note: type must be known at this point error: aborting due to 2 previous errors diff --git a/src/test/ui/pattern/pat-tuple-bad-type.stderr b/src/test/ui/pattern/pat-tuple-bad-type.stderr index 11b28987848..3342b8e4002 100644 --- a/src/test/ui/pattern/pat-tuple-bad-type.stderr +++ b/src/test/ui/pattern/pat-tuple-bad-type.stderr @@ -3,8 +3,10 @@ error[E0282]: type annotations needed | LL | let x; | ^ +... +LL | (..) => {} + | ---- type must be known at this point | - = note: type must be known at this point help: consider giving `x` an explicit type | LL | let x: _; diff --git a/src/test/ui/pattern/pat-tuple-field-count-cross.stderr b/src/test/ui/pattern/pat-tuple-field-count-cross.stderr index 07b678bc873..019cd414d2e 100644 --- a/src/test/ui/pattern/pat-tuple-field-count-cross.stderr +++ b/src/test/ui/pattern/pat-tuple-field-count-cross.stderr @@ -16,9 +16,9 @@ LL | Z0() => {} ::: $DIR/auxiliary/declarations-for-tuple-field-count-errors.rs:1:1 | LL | pub struct Z0; - | -------------- `Z0` defined here + | ------------- `Z0` defined here LL | pub struct Z1(); - | ---------------- similarly named tuple struct `Z1` defined here + | ------------- similarly named tuple struct `Z1` defined here | help: use this syntax instead | @@ -38,9 +38,9 @@ LL | Z0(x) => {} ::: $DIR/auxiliary/declarations-for-tuple-field-count-errors.rs:1:1 | LL | pub struct Z0; - | -------------- `Z0` defined here + | ------------- `Z0` defined here LL | pub struct Z1(); - | ---------------- similarly named tuple struct `Z1` defined here + | ------------- similarly named tuple struct `Z1` defined here | help: use this syntax instead | @@ -126,7 +126,7 @@ LL | Z1(x) => {} ::: $DIR/auxiliary/declarations-for-tuple-field-count-errors.rs:2:1 | LL | pub struct Z1(); - | ---------------- tuple struct has 0 fields + | ------------- tuple struct has 0 fields error[E0023]: this pattern has 0 fields, but the corresponding tuple struct has 3 fields --> $DIR/pat-tuple-field-count-cross.rs:18:9 diff --git a/src/test/ui/pattern/pat-tuple-overfield.stderr b/src/test/ui/pattern/pat-tuple-overfield.stderr index 1c44f7e5f6f..9e13a2dc9fb 100644 --- a/src/test/ui/pattern/pat-tuple-overfield.stderr +++ b/src/test/ui/pattern/pat-tuple-overfield.stderr @@ -271,7 +271,7 @@ error[E0023]: this pattern has 1 field, but the corresponding tuple struct has 0 --> $DIR/pat-tuple-overfield.rs:59:12 | LL | struct Z1(); - | ------------ tuple struct has 0 fields + | --------- tuple struct has 0 fields ... LL | Z1(_) => {} | ^ expected 0 fields, found 1 @@ -280,7 +280,7 @@ error[E0023]: this pattern has 2 fields, but the corresponding tuple struct has --> $DIR/pat-tuple-overfield.rs:60:12 | LL | struct Z1(); - | ------------ tuple struct has 0 fields + | --------- tuple struct has 0 fields ... LL | Z1(_, _) => {} | ^ ^ expected 0 fields, found 2 diff --git a/src/test/ui/pattern/usefulness/doc-hidden-non-exhaustive.stderr b/src/test/ui/pattern/usefulness/doc-hidden-non-exhaustive.stderr index 296465eb818..643e734f9d4 100644 --- a/src/test/ui/pattern/usefulness/doc-hidden-non-exhaustive.stderr +++ b/src/test/ui/pattern/usefulness/doc-hidden-non-exhaustive.stderr @@ -7,13 +7,8 @@ LL | match HiddenEnum::A { note: `HiddenEnum` defined here --> $DIR/auxiliary/hidden.rs:1:1 | -LL | / pub enum HiddenEnum { -LL | | A, -LL | | B, -LL | | #[doc(hidden)] -LL | | C, -LL | | } - | |_^ +LL | pub enum HiddenEnum { + | ^^^^^^^^^^^^^^^^^^^ = note: the matched value is of type `HiddenEnum` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | @@ -30,14 +25,11 @@ LL | match HiddenEnum::A { note: `HiddenEnum` defined here --> $DIR/auxiliary/hidden.rs:3:5 | -LL | / pub enum HiddenEnum { -LL | | A, -LL | | B, - | | ^ not covered -LL | | #[doc(hidden)] -LL | | C, -LL | | } - | |_- +LL | pub enum HiddenEnum { + | ------------------- +LL | A, +LL | B, + | ^ not covered = note: the matched value is of type `HiddenEnum` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | @@ -54,14 +46,11 @@ LL | match HiddenEnum::A { note: `HiddenEnum` defined here --> $DIR/auxiliary/hidden.rs:3:5 | -LL | / pub enum HiddenEnum { -LL | | A, -LL | | B, - | | ^ not covered -LL | | #[doc(hidden)] -LL | | C, -LL | | } - | |_- +LL | pub enum HiddenEnum { + | ------------------- +LL | A, +LL | B, + | ^ not covered = note: the matched value is of type `HiddenEnum` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms | @@ -78,15 +67,11 @@ LL | match None { note: `Option<HiddenEnum>` defined here --> $SRC_DIR/core/src/option.rs:LL:COL | -LL | / pub enum Option<T> { -LL | | /// No value. -LL | | #[lang = "None"] -LL | | #[stable(feature = "rust1", since = "1.0.0")] -... | -LL | | Some(#[stable(feature = "rust1", since = "1.0.0")] T), - | | ^^^^ not covered -LL | | } - | |_- +LL | pub enum Option<T> { + | ------------------ +... +LL | Some(#[stable(feature = "rust1", since = "1.0.0")] T), + | ^^^^ not covered = note: the matched value is of type `Option<HiddenEnum>` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms | diff --git a/src/test/ui/pattern/usefulness/issue-35609.stderr b/src/test/ui/pattern/usefulness/issue-35609.stderr index 717bb53c327..2247b818d43 100644 --- a/src/test/ui/pattern/usefulness/issue-35609.stderr +++ b/src/test/ui/pattern/usefulness/issue-35609.stderr @@ -108,14 +108,8 @@ LL | match Some(A) { note: `Option<Enum>` defined here --> $SRC_DIR/core/src/option.rs:LL:COL | -LL | / pub enum Option<T> { -LL | | /// No value. -LL | | #[lang = "None"] -LL | | #[stable(feature = "rust1", since = "1.0.0")] -... | -LL | | Some(#[stable(feature = "rust1", since = "1.0.0")] T), -LL | | } - | |_^ +LL | pub enum Option<T> { + | ^^^^^^^^^^^^^^^^^^ = note: the matched value is of type `Option<Enum>` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown, or multiple match arms | diff --git a/src/test/ui/pattern/usefulness/issue-3601.stderr b/src/test/ui/pattern/usefulness/issue-3601.stderr index 4e0adcc1ba2..eb8c63919b6 100644 --- a/src/test/ui/pattern/usefulness/issue-3601.stderr +++ b/src/test/ui/pattern/usefulness/issue-3601.stderr @@ -11,7 +11,7 @@ LL | / pub struct Box< LL | | T: ?Sized, LL | | #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global, LL | | >(Unique<T>, A); - | |________________^ + | |_^ = note: the matched value is of type `Box<ElementKind>` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | diff --git a/src/test/ui/pattern/usefulness/match-arm-statics-2.stderr b/src/test/ui/pattern/usefulness/match-arm-statics-2.stderr index 3326e6b85a4..a2b66f5ed67 100644 --- a/src/test/ui/pattern/usefulness/match-arm-statics-2.stderr +++ b/src/test/ui/pattern/usefulness/match-arm-statics-2.stderr @@ -20,18 +20,14 @@ LL | match Some(Some(North)) { note: `Option<Option<Direction>>` defined here --> $SRC_DIR/core/src/option.rs:LL:COL | -LL | / pub enum Option<T> { -LL | | /// No value. -LL | | #[lang = "None"] -LL | | #[stable(feature = "rust1", since = "1.0.0")] -... | -LL | | Some(#[stable(feature = "rust1", since = "1.0.0")] T), - | | ^^^^ - | | | - | | not covered - | | not covered -LL | | } - | |_- +LL | pub enum Option<T> { + | ------------------ +... +LL | Some(#[stable(feature = "rust1", since = "1.0.0")] T), + | ^^^^ + | | + | not covered + | not covered = note: the matched value is of type `Option<Option<Direction>>` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | diff --git a/src/test/ui/pattern/usefulness/match-privately-empty.stderr b/src/test/ui/pattern/usefulness/match-privately-empty.stderr index 88178d64291..4607cfaae17 100644 --- a/src/test/ui/pattern/usefulness/match-privately-empty.stderr +++ b/src/test/ui/pattern/usefulness/match-privately-empty.stderr @@ -7,15 +7,11 @@ LL | match private::DATA { note: `Option<Private>` defined here --> $SRC_DIR/core/src/option.rs:LL:COL | -LL | / pub enum Option<T> { -LL | | /// No value. -LL | | #[lang = "None"] -LL | | #[stable(feature = "rust1", since = "1.0.0")] -... | -LL | | Some(#[stable(feature = "rust1", since = "1.0.0")] T), - | | ^^^^ not covered -LL | | } - | |_- +LL | pub enum Option<T> { + | ------------------ +... +LL | Some(#[stable(feature = "rust1", since = "1.0.0")] T), + | ^^^^ not covered = note: the matched value is of type `Option<Private>` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | diff --git a/src/test/ui/pattern/usefulness/non-exhaustive-match.stderr b/src/test/ui/pattern/usefulness/non-exhaustive-match.stderr index 89b4e06efda..f2362c316df 100644 --- a/src/test/ui/pattern/usefulness/non-exhaustive-match.stderr +++ b/src/test/ui/pattern/usefulness/non-exhaustive-match.stderr @@ -37,15 +37,11 @@ LL | match Some(10) { note: `Option<i32>` defined here --> $SRC_DIR/core/src/option.rs:LL:COL | -LL | / pub enum Option<T> { -LL | | /// No value. -LL | | #[lang = "None"] -LL | | #[stable(feature = "rust1", since = "1.0.0")] -... | -LL | | Some(#[stable(feature = "rust1", since = "1.0.0")] T), - | | ^^^^ not covered -LL | | } - | |_- +LL | pub enum Option<T> { + | ------------------ +... +LL | Some(#[stable(feature = "rust1", since = "1.0.0")] T), + | ^^^^ not covered = note: the matched value is of type `Option<i32>` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | diff --git a/src/test/ui/pattern/usefulness/stable-gated-patterns.stderr b/src/test/ui/pattern/usefulness/stable-gated-patterns.stderr index 559539178cb..98c75953add 100644 --- a/src/test/ui/pattern/usefulness/stable-gated-patterns.stderr +++ b/src/test/ui/pattern/usefulness/stable-gated-patterns.stderr @@ -7,16 +7,11 @@ LL | match UnstableEnum::Stable { note: `UnstableEnum` defined here --> $DIR/auxiliary/unstable.rs:9:5 | -LL | / pub enum UnstableEnum { -LL | | #[stable(feature = "stable_test_feature", since = "1.0.0")] -LL | | Stable, -LL | | #[stable(feature = "stable_test_feature", since = "1.0.0")] -LL | | Stable2, - | | ^^^^^^^ not covered -LL | | #[unstable(feature = "unstable_test_feature", issue = "none")] -LL | | Unstable, -LL | | } - | |_- +LL | pub enum UnstableEnum { + | --------------------- +... +LL | Stable2, + | ^^^^^^^ not covered = note: the matched value is of type `UnstableEnum` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms | @@ -33,14 +28,8 @@ LL | match UnstableEnum::Stable { note: `UnstableEnum` defined here --> $DIR/auxiliary/unstable.rs:5:1 | -LL | / pub enum UnstableEnum { -LL | | #[stable(feature = "stable_test_feature", since = "1.0.0")] -LL | | Stable, -LL | | #[stable(feature = "stable_test_feature", since = "1.0.0")] -... | -LL | | Unstable, -LL | | } - | |_^ +LL | pub enum UnstableEnum { + | ^^^^^^^^^^^^^^^^^^^^^ = note: the matched value is of type `UnstableEnum` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | diff --git a/src/test/ui/pattern/usefulness/unstable-gated-patterns.stderr b/src/test/ui/pattern/usefulness/unstable-gated-patterns.stderr index b5f1805deef..f07a25ca89b 100644 --- a/src/test/ui/pattern/usefulness/unstable-gated-patterns.stderr +++ b/src/test/ui/pattern/usefulness/unstable-gated-patterns.stderr @@ -7,15 +7,11 @@ LL | match UnstableEnum::Stable { note: `UnstableEnum` defined here --> $DIR/auxiliary/unstable.rs:11:5 | -LL | / pub enum UnstableEnum { -LL | | #[stable(feature = "stable_test_feature", since = "1.0.0")] -LL | | Stable, -LL | | #[stable(feature = "stable_test_feature", since = "1.0.0")] -... | -LL | | Unstable, - | | ^^^^^^^^ not covered -LL | | } - | |_- +LL | pub enum UnstableEnum { + | --------------------- +... +LL | Unstable, + | ^^^^^^^^ not covered = note: the matched value is of type `UnstableEnum` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | diff --git a/src/test/ui/polymorphization/generators.rs b/src/test/ui/polymorphization/generators.rs index 68ea4a026d7..779bac0ace2 100644 --- a/src/test/ui/polymorphization/generators.rs +++ b/src/test/ui/polymorphization/generators.rs @@ -1,5 +1,5 @@ // build-fail -// compile-flags:-Zpolymorphize=on +// compile-flags:-Zpolymorphize=on -Zinline-mir=off #![feature(generic_const_exprs, generators, generator_trait, rustc_attrs)] //~^ WARN the feature `generic_const_exprs` is incomplete diff --git a/src/test/ui/polymorphization/predicates.rs b/src/test/ui/polymorphization/predicates.rs index dea1e21e77f..6a5fc2e33de 100644 --- a/src/test/ui/polymorphization/predicates.rs +++ b/src/test/ui/polymorphization/predicates.rs @@ -1,5 +1,6 @@ // build-fail -// compile-flags:-Zpolymorphize=on +// compile-flags: -Copt-level=0 -Zpolymorphize=on + #![feature(rustc_attrs)] // This test checks that `T` is considered used in `foo`, because it is used in a predicate for diff --git a/src/test/ui/polymorphization/predicates.stderr b/src/test/ui/polymorphization/predicates.stderr index dc6ebceae21..6a74e63fdfe 100644 --- a/src/test/ui/polymorphization/predicates.stderr +++ b/src/test/ui/polymorphization/predicates.stderr @@ -1,17 +1,17 @@ error: item has unused generic parameters - --> $DIR/predicates.rs:14:4 + --> $DIR/predicates.rs:15:4 | LL | fn foo<I, T>(_: I) | ^^^ - generic parameter `T` is unused error: item has unused generic parameters - --> $DIR/predicates.rs:23:4 + --> $DIR/predicates.rs:24:4 | LL | fn baz<I, T>(_: I) | ^^^ - generic parameter `T` is unused error: item has unused generic parameters - --> $DIR/predicates.rs:44:19 + --> $DIR/predicates.rs:45:19 | LL | impl<'a, I, T: 'a, E> Iterator for Foo<'a, I, E> | - - generic parameter `E` is unused @@ -22,7 +22,7 @@ LL | self.find(|_| true) | ^^^^^^^^ error: item has unused generic parameters - --> $DIR/predicates.rs:58:4 + --> $DIR/predicates.rs:59:4 | LL | fn quux<A, B, C: Default>() -> usize | ^^^^ - - generic parameter `B` is unused @@ -30,19 +30,19 @@ LL | fn quux<A, B, C: Default>() -> usize | generic parameter `A` is unused error: item has unused generic parameters - --> $DIR/predicates.rs:75:4 + --> $DIR/predicates.rs:76:4 | LL | fn foobar<F, G>() -> usize | ^^^^^^ - generic parameter `F` is unused error: item has unused generic parameters - --> $DIR/predicates.rs:9:4 + --> $DIR/predicates.rs:10:4 | LL | fn bar<I>() { | ^^^ - generic parameter `I` is unused note: the above error was encountered while instantiating `fn foo::<std::slice::Iter<u32>, T>` - --> $DIR/predicates.rs:85:5 + --> $DIR/predicates.rs:86:5 | LL | foo(x.iter()); | ^^^^^^^^^^^^^ diff --git a/src/test/ui/privacy/issue-30079.stderr b/src/test/ui/privacy/issue-30079.stderr index e40b1942059..dc98cfe3bb6 100644 --- a/src/test/ui/privacy/issue-30079.stderr +++ b/src/test/ui/privacy/issue-30079.stderr @@ -12,19 +12,19 @@ error[E0446]: private type `m2::Priv` in public interface --> $DIR/issue-30079.rs:18:9 | LL | struct Priv; - | ------------ `m2::Priv` declared as private + | ----------- `m2::Priv` declared as private LL | impl ::std::ops::Deref for ::SemiPriv { LL | type Target = Priv; - | ^^^^^^^^^^^^^^^^^^^ can't leak private type + | ^^^^^^^^^^^ can't leak private type error[E0446]: private type `m3::Priv` in public interface --> $DIR/issue-30079.rs:35:9 | LL | struct Priv; - | ------------ `m3::Priv` declared as private + | ----------- `m3::Priv` declared as private LL | impl ::SemiPrivTrait for () { LL | type Assoc = Priv; - | ^^^^^^^^^^^^^^^^^^ can't leak private type + | ^^^^^^^^^^ can't leak private type error: aborting due to 2 previous errors; 1 warning emitted diff --git a/src/test/ui/privacy/privacy5.stderr b/src/test/ui/privacy/privacy5.stderr index d0c0c6b8bb5..680161272ce 100644 --- a/src/test/ui/privacy/privacy5.stderr +++ b/src/test/ui/privacy/privacy5.stderr @@ -373,7 +373,7 @@ note: the tuple struct constructor `A` is defined here --> $DIR/auxiliary/privacy_tuple_struct.rs:1:1 | LL | pub struct A(()); - | ^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^ error[E0603]: tuple struct constructor `B` is private --> $DIR/privacy5.rs:91:20 @@ -390,7 +390,7 @@ note: the tuple struct constructor `B` is defined here --> $DIR/auxiliary/privacy_tuple_struct.rs:2:1 | LL | pub struct B(isize); - | ^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^ error[E0603]: tuple struct constructor `C` is private --> $DIR/privacy5.rs:92:20 @@ -407,7 +407,7 @@ note: the tuple struct constructor `C` is defined here --> $DIR/auxiliary/privacy_tuple_struct.rs:3:1 | LL | pub struct C(pub isize, isize); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^ error[E0603]: tuple struct constructor `A` is private --> $DIR/privacy5.rs:95:16 @@ -424,7 +424,7 @@ note: the tuple struct constructor `A` is defined here --> $DIR/auxiliary/privacy_tuple_struct.rs:1:1 | LL | pub struct A(()); - | ^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^ error[E0603]: tuple struct constructor `A` is private --> $DIR/privacy5.rs:96:16 @@ -441,7 +441,7 @@ note: the tuple struct constructor `A` is defined here --> $DIR/auxiliary/privacy_tuple_struct.rs:1:1 | LL | pub struct A(()); - | ^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^ error[E0603]: tuple struct constructor `A` is private --> $DIR/privacy5.rs:97:22 @@ -458,7 +458,7 @@ note: the tuple struct constructor `A` is defined here --> $DIR/auxiliary/privacy_tuple_struct.rs:1:1 | LL | pub struct A(()); - | ^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^ error[E0603]: tuple struct constructor `A` is private --> $DIR/privacy5.rs:98:22 @@ -475,7 +475,7 @@ note: the tuple struct constructor `A` is defined here --> $DIR/auxiliary/privacy_tuple_struct.rs:1:1 | LL | pub struct A(()); - | ^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^ error[E0603]: tuple struct constructor `B` is private --> $DIR/privacy5.rs:100:16 @@ -492,7 +492,7 @@ note: the tuple struct constructor `B` is defined here --> $DIR/auxiliary/privacy_tuple_struct.rs:2:1 | LL | pub struct B(isize); - | ^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^ error[E0603]: tuple struct constructor `B` is private --> $DIR/privacy5.rs:101:16 @@ -509,7 +509,7 @@ note: the tuple struct constructor `B` is defined here --> $DIR/auxiliary/privacy_tuple_struct.rs:2:1 | LL | pub struct B(isize); - | ^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^ error[E0603]: tuple struct constructor `B` is private --> $DIR/privacy5.rs:102:22 @@ -526,7 +526,7 @@ note: the tuple struct constructor `B` is defined here --> $DIR/auxiliary/privacy_tuple_struct.rs:2:1 | LL | pub struct B(isize); - | ^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^ error[E0603]: tuple struct constructor `B` is private --> $DIR/privacy5.rs:103:22 @@ -543,7 +543,7 @@ note: the tuple struct constructor `B` is defined here --> $DIR/auxiliary/privacy_tuple_struct.rs:2:1 | LL | pub struct B(isize); - | ^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^ error[E0603]: tuple struct constructor `B` is private --> $DIR/privacy5.rs:104:22 @@ -560,7 +560,7 @@ note: the tuple struct constructor `B` is defined here --> $DIR/auxiliary/privacy_tuple_struct.rs:2:1 | LL | pub struct B(isize); - | ^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^ error[E0603]: tuple struct constructor `B` is private --> $DIR/privacy5.rs:105:16 @@ -577,7 +577,7 @@ note: the tuple struct constructor `B` is defined here --> $DIR/auxiliary/privacy_tuple_struct.rs:2:1 | LL | pub struct B(isize); - | ^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^ error[E0603]: tuple struct constructor `C` is private --> $DIR/privacy5.rs:107:16 @@ -594,7 +594,7 @@ note: the tuple struct constructor `C` is defined here --> $DIR/auxiliary/privacy_tuple_struct.rs:3:1 | LL | pub struct C(pub isize, isize); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^ error[E0603]: tuple struct constructor `C` is private --> $DIR/privacy5.rs:108:16 @@ -611,7 +611,7 @@ note: the tuple struct constructor `C` is defined here --> $DIR/auxiliary/privacy_tuple_struct.rs:3:1 | LL | pub struct C(pub isize, isize); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^ error[E0603]: tuple struct constructor `C` is private --> $DIR/privacy5.rs:109:16 @@ -628,7 +628,7 @@ note: the tuple struct constructor `C` is defined here --> $DIR/auxiliary/privacy_tuple_struct.rs:3:1 | LL | pub struct C(pub isize, isize); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^ error[E0603]: tuple struct constructor `C` is private --> $DIR/privacy5.rs:110:16 @@ -645,7 +645,7 @@ note: the tuple struct constructor `C` is defined here --> $DIR/auxiliary/privacy_tuple_struct.rs:3:1 | LL | pub struct C(pub isize, isize); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^ error[E0603]: tuple struct constructor `C` is private --> $DIR/privacy5.rs:111:22 @@ -662,7 +662,7 @@ note: the tuple struct constructor `C` is defined here --> $DIR/auxiliary/privacy_tuple_struct.rs:3:1 | LL | pub struct C(pub isize, isize); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^ error[E0603]: tuple struct constructor `C` is private --> $DIR/privacy5.rs:112:22 @@ -679,7 +679,7 @@ note: the tuple struct constructor `C` is defined here --> $DIR/auxiliary/privacy_tuple_struct.rs:3:1 | LL | pub struct C(pub isize, isize); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^ error[E0603]: tuple struct constructor `C` is private --> $DIR/privacy5.rs:113:22 @@ -696,7 +696,7 @@ note: the tuple struct constructor `C` is defined here --> $DIR/auxiliary/privacy_tuple_struct.rs:3:1 | LL | pub struct C(pub isize, isize); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^ error[E0603]: tuple struct constructor `C` is private --> $DIR/privacy5.rs:114:22 @@ -713,7 +713,7 @@ note: the tuple struct constructor `C` is defined here --> $DIR/auxiliary/privacy_tuple_struct.rs:3:1 | LL | pub struct C(pub isize, isize); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^ error[E0603]: tuple struct constructor `A` is private --> $DIR/privacy5.rs:122:21 @@ -730,7 +730,7 @@ note: the tuple struct constructor `A` is defined here --> $DIR/auxiliary/privacy_tuple_struct.rs:1:1 | LL | pub struct A(()); - | ^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^ error[E0603]: tuple struct constructor `B` is private --> $DIR/privacy5.rs:123:21 @@ -747,7 +747,7 @@ note: the tuple struct constructor `B` is defined here --> $DIR/auxiliary/privacy_tuple_struct.rs:2:1 | LL | pub struct B(isize); - | ^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^ error[E0603]: tuple struct constructor `C` is private --> $DIR/privacy5.rs:124:21 @@ -764,7 +764,7 @@ note: the tuple struct constructor `C` is defined here --> $DIR/auxiliary/privacy_tuple_struct.rs:3:1 | LL | pub struct C(pub isize, isize); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^ error: aborting due to 48 previous errors diff --git a/src/test/ui/privacy/private-in-public-assoc-ty.stderr b/src/test/ui/privacy/private-in-public-assoc-ty.stderr index ba62a228b09..1abeafe398f 100644 --- a/src/test/ui/privacy/private-in-public-assoc-ty.stderr +++ b/src/test/ui/privacy/private-in-public-assoc-ty.stderr @@ -2,16 +2,16 @@ error[E0446]: private type `Priv` in public interface --> $DIR/private-in-public-assoc-ty.rs:17:9 | LL | struct Priv; - | ------------ `Priv` declared as private + | ----------- `Priv` declared as private ... LL | type A = Priv; - | ^^^^^^^^^^^^^^ can't leak private type + | ^^^^^^ can't leak private type warning: private trait `PrivTr` in public interface (error E0445) --> $DIR/private-in-public-assoc-ty.rs:24:9 | LL | type Alias1: PrivTr; - | ^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^ | = note: `#[warn(private_in_public)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -21,7 +21,7 @@ warning: private type `Priv` in public interface (error E0446) --> $DIR/private-in-public-assoc-ty.rs:27:9 | LL | type Alias2: PubTrAux1<Priv> = u8; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537> @@ -30,7 +30,7 @@ warning: private type `Priv` in public interface (error E0446) --> $DIR/private-in-public-assoc-ty.rs:30:9 | LL | type Alias3: PubTrAux2<A = Priv> = u8; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537> @@ -39,19 +39,19 @@ error[E0446]: private type `Priv` in public interface --> $DIR/private-in-public-assoc-ty.rs:34:9 | LL | struct Priv; - | ------------ `Priv` declared as private + | ----------- `Priv` declared as private ... LL | type Alias4 = Priv; - | ^^^^^^^^^^^^^^^^^^^ can't leak private type + | ^^^^^^^^^^^ can't leak private type error[E0446]: private type `Priv` in public interface --> $DIR/private-in-public-assoc-ty.rs:41:9 | LL | struct Priv; - | ------------ `Priv` declared as private + | ----------- `Priv` declared as private ... LL | type Alias1 = Priv; - | ^^^^^^^^^^^^^^^^^^^ can't leak private type + | ^^^^^^^^^^^ can't leak private type error[E0445]: private trait `PrivTr` in public interface --> $DIR/private-in-public-assoc-ty.rs:44:9 @@ -60,7 +60,7 @@ LL | trait PrivTr {} | ------------ `PrivTr` declared as private ... LL | type Exist = impl PrivTr; - | ^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private trait + | ^^^^^^^^^^ can't leak private trait error: aborting due to 4 previous errors; 3 warnings emitted diff --git a/src/test/ui/privacy/private-in-public-lint.stderr b/src/test/ui/privacy/private-in-public-lint.stderr index dd5f5b6f8f8..1e98e3bed14 100644 --- a/src/test/ui/privacy/private-in-public-lint.stderr +++ b/src/test/ui/privacy/private-in-public-lint.stderr @@ -2,7 +2,7 @@ error[E0446]: private type `m1::Priv` in public interface --> $DIR/private-in-public-lint.rs:6:9 | LL | struct Priv; - | ------------ `m1::Priv` declared as private + | ----------- `m1::Priv` declared as private ... LL | pub fn f() -> Priv {Priv} | ^^^^^^^^^^^^^^^^^^ can't leak private type @@ -11,7 +11,7 @@ error[E0446]: private type `m2::Priv` in public interface --> $DIR/private-in-public-lint.rs:15:9 | LL | struct Priv; - | ------------ `m2::Priv` declared as private + | ----------- `m2::Priv` declared as private ... LL | pub fn f() -> Priv {Priv} | ^^^^^^^^^^^^^^^^^^ can't leak private type diff --git a/src/test/ui/privacy/private-in-public-warn.stderr b/src/test/ui/privacy/private-in-public-warn.stderr index 5f2c4935bad..f2ff6cf2fdb 100644 --- a/src/test/ui/privacy/private-in-public-warn.stderr +++ b/src/test/ui/privacy/private-in-public-warn.stderr @@ -2,7 +2,7 @@ error: private type `types::Priv` in public interface (error E0446) --> $DIR/private-in-public-warn.rs:15:5 | LL | pub type Alias = Priv; - | ^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^ | note: the lint level is defined here --> $DIR/private-in-public-warn.rs:5:9 @@ -34,7 +34,7 @@ error: private type `types::Priv` in public interface (error E0446) --> $DIR/private-in-public-warn.rs:24:9 | LL | const C: Priv = Priv; - | ^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537> @@ -43,10 +43,10 @@ error[E0446]: private type `types::Priv` in public interface --> $DIR/private-in-public-warn.rs:26:9 | LL | struct Priv; - | ------------ `types::Priv` declared as private + | ----------- `types::Priv` declared as private ... LL | type Alias = Priv; - | ^^^^^^^^^^^^^^^^^^ can't leak private type + | ^^^^^^^^^^ can't leak private type error: private type `types::Priv` in public interface (error E0446) --> $DIR/private-in-public-warn.rs:27:9 @@ -70,7 +70,7 @@ error: private type `types::Priv` in public interface (error E0446) --> $DIR/private-in-public-warn.rs:33:9 | LL | pub static ES: Priv; - | ^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537> @@ -79,7 +79,7 @@ error: private type `types::Priv` in public interface (error E0446) --> $DIR/private-in-public-warn.rs:35:9 | LL | pub fn ef1(arg: Priv); - | ^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537> @@ -88,7 +88,7 @@ error: private type `types::Priv` in public interface (error E0446) --> $DIR/private-in-public-warn.rs:37:9 | LL | pub fn ef2() -> Priv; - | ^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537> @@ -97,16 +97,16 @@ error[E0446]: private type `types::Priv` in public interface --> $DIR/private-in-public-warn.rs:41:9 | LL | struct Priv; - | ------------ `types::Priv` declared as private + | ----------- `types::Priv` declared as private ... LL | type Alias = Priv; - | ^^^^^^^^^^^^^^^^^^ can't leak private type + | ^^^^^^^^^^ can't leak private type error: private trait `traits::PrivTr` in public interface (error E0445) --> $DIR/private-in-public-warn.rs:50:5 | LL | pub type Alias<T: PrivTr> = T; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537> @@ -115,7 +115,7 @@ error: private trait `traits::PrivTr` in public interface (error E0445) --> $DIR/private-in-public-warn.rs:53:5 | LL | pub trait Tr1: PrivTr {} - | ^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537> @@ -124,7 +124,7 @@ error: private trait `traits::PrivTr` in public interface (error E0445) --> $DIR/private-in-public-warn.rs:55:5 | LL | pub trait Tr2<T: PrivTr> {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537> @@ -133,7 +133,7 @@ error: private trait `traits::PrivTr` in public interface (error E0445) --> $DIR/private-in-public-warn.rs:58:9 | LL | type Alias: PrivTr; - | ^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537> @@ -151,7 +151,7 @@ error: private trait `traits::PrivTr` in public interface (error E0445) --> $DIR/private-in-public-warn.rs:64:5 | LL | impl<T: PrivTr> Pub<T> {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537> @@ -160,7 +160,7 @@ error: private trait `traits_where::PrivTr` in public interface (error E0445) --> $DIR/private-in-public-warn.rs:74:5 | LL | pub type Alias<T> where T: PrivTr = T; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537> @@ -169,7 +169,7 @@ error: private trait `traits_where::PrivTr` in public interface (error E0445) --> $DIR/private-in-public-warn.rs:78:5 | LL | pub trait Tr2<T> where T: PrivTr {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537> @@ -187,7 +187,7 @@ error: private trait `traits_where::PrivTr` in public interface (error E0445) --> $DIR/private-in-public-warn.rs:86:5 | LL | impl<T> Pub<T> where T: PrivTr {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537> @@ -196,7 +196,7 @@ error: private trait `generics::PrivTr<generics::Pub>` in public interface (erro --> $DIR/private-in-public-warn.rs:98:5 | LL | pub trait Tr1: PrivTr<Pub> {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537> @@ -205,7 +205,7 @@ error: private type `generics::Priv` in public interface (error E0446) --> $DIR/private-in-public-warn.rs:101:5 | LL | pub trait Tr2: PubTr<Priv> {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537> @@ -214,7 +214,7 @@ error: private type `generics::Priv` in public interface (error E0446) --> $DIR/private-in-public-warn.rs:103:5 | LL | pub trait Tr3: PubTr<[Priv; 1]> {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537> @@ -223,7 +223,7 @@ error: private type `generics::Priv` in public interface (error E0446) --> $DIR/private-in-public-warn.rs:105:5 | LL | pub trait Tr4: PubTr<Pub<Priv>> {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537> @@ -232,10 +232,10 @@ error[E0446]: private type `impls::Priv` in public interface --> $DIR/private-in-public-warn.rs:132:9 | LL | struct Priv; - | ------------ `impls::Priv` declared as private + | ----------- `impls::Priv` declared as private ... LL | type Alias = Priv; - | ^^^^^^^^^^^^^^^^^^ can't leak private type + | ^^^^^^^^^^ can't leak private type error: private type `aliases_pub::Priv` in public interface (error E0446) --> $DIR/private-in-public-warn.rs:203:9 @@ -250,43 +250,43 @@ error[E0446]: private type `aliases_pub::Priv` in public interface --> $DIR/private-in-public-warn.rs:207:9 | LL | struct Priv; - | ------------ `aliases_pub::Priv` declared as private + | ----------- `aliases_pub::Priv` declared as private ... LL | type Check = Priv; - | ^^^^^^^^^^^^^^^^^^ can't leak private type + | ^^^^^^^^^^ can't leak private type error[E0446]: private type `aliases_pub::Priv` in public interface --> $DIR/private-in-public-warn.rs:210:9 | LL | struct Priv; - | ------------ `aliases_pub::Priv` declared as private + | ----------- `aliases_pub::Priv` declared as private ... LL | type Check = Priv; - | ^^^^^^^^^^^^^^^^^^ can't leak private type + | ^^^^^^^^^^ can't leak private type error[E0446]: private type `aliases_pub::Priv` in public interface --> $DIR/private-in-public-warn.rs:213:9 | LL | struct Priv; - | ------------ `aliases_pub::Priv` declared as private + | ----------- `aliases_pub::Priv` declared as private ... LL | type Check = Priv; - | ^^^^^^^^^^^^^^^^^^ can't leak private type + | ^^^^^^^^^^ can't leak private type error[E0446]: private type `aliases_pub::Priv` in public interface --> $DIR/private-in-public-warn.rs:216:9 | LL | struct Priv; - | ------------ `aliases_pub::Priv` declared as private + | ----------- `aliases_pub::Priv` declared as private ... LL | type Check = Priv; - | ^^^^^^^^^^^^^^^^^^ can't leak private type + | ^^^^^^^^^^ can't leak private type error: private trait `PrivTr1` in public interface (error E0445) --> $DIR/private-in-public-warn.rs:246:5 | LL | pub trait Tr1: PrivUseAliasTr {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537> @@ -295,7 +295,7 @@ error: private trait `PrivTr1<Priv2>` in public interface (error E0445) --> $DIR/private-in-public-warn.rs:249:5 | LL | pub trait Tr2: PrivUseAliasTr<PrivAlias> {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537> @@ -304,7 +304,7 @@ error: private type `Priv2` in public interface (error E0446) --> $DIR/private-in-public-warn.rs:249:5 | LL | pub trait Tr2: PrivUseAliasTr<PrivAlias> {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537> diff --git a/src/test/ui/privacy/private-in-public.stderr b/src/test/ui/privacy/private-in-public.stderr index e8bb2cde4be..887eebf53ef 100644 --- a/src/test/ui/privacy/private-in-public.stderr +++ b/src/test/ui/privacy/private-in-public.stderr @@ -2,25 +2,25 @@ error[E0446]: private type `types::Priv` in public interface --> $DIR/private-in-public.rs:13:5 | LL | struct Priv; - | ------------ `types::Priv` declared as private + | ----------- `types::Priv` declared as private ... LL | pub const C: Priv = Priv; - | ^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type + | ^^^^^^^^^^^^^^^^^ can't leak private type error[E0446]: private type `types::Priv` in public interface --> $DIR/private-in-public.rs:14:5 | LL | struct Priv; - | ------------ `types::Priv` declared as private + | ----------- `types::Priv` declared as private ... LL | pub static S: Priv = Priv; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type + | ^^^^^^^^^^^^^^^^^^ can't leak private type error[E0446]: private type `types::Priv` in public interface --> $DIR/private-in-public.rs:15:5 | LL | struct Priv; - | ------------ `types::Priv` declared as private + | ----------- `types::Priv` declared as private ... LL | pub fn f1(arg: Priv) {} | ^^^^^^^^^^^^^^^^^^^^ can't leak private type @@ -29,7 +29,7 @@ error[E0446]: private type `types::Priv` in public interface --> $DIR/private-in-public.rs:16:5 | LL | struct Priv; - | ------------ `types::Priv` declared as private + | ----------- `types::Priv` declared as private ... LL | pub fn f2() -> Priv { panic!() } | ^^^^^^^^^^^^^^^^^^^ can't leak private type @@ -38,7 +38,7 @@ error[E0446]: private type `types::Priv` in public interface --> $DIR/private-in-public.rs:17:19 | LL | struct Priv; - | ------------ `types::Priv` declared as private + | ----------- `types::Priv` declared as private ... LL | pub struct S1(pub Priv); | ^^^^^^^^ can't leak private type @@ -47,7 +47,7 @@ error[E0446]: private type `types::Priv` in public interface --> $DIR/private-in-public.rs:18:21 | LL | struct Priv; - | ------------ `types::Priv` declared as private + | ----------- `types::Priv` declared as private ... LL | pub struct S2 { pub field: Priv } | ^^^^^^^^^^^^^^^ can't leak private type @@ -56,16 +56,16 @@ error[E0446]: private type `types::Priv` in public interface --> $DIR/private-in-public.rs:20:9 | LL | struct Priv; - | ------------ `types::Priv` declared as private + | ----------- `types::Priv` declared as private ... LL | pub const C: Priv = Priv; - | ^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type + | ^^^^^^^^^^^^^^^^^ can't leak private type error[E0446]: private type `types::Priv` in public interface --> $DIR/private-in-public.rs:21:9 | LL | struct Priv; - | ------------ `types::Priv` declared as private + | ----------- `types::Priv` declared as private ... LL | pub fn f1(arg: Priv) {} | ^^^^^^^^^^^^^^^^^^^^ can't leak private type @@ -74,7 +74,7 @@ error[E0446]: private type `types::Priv` in public interface --> $DIR/private-in-public.rs:22:9 | LL | struct Priv; - | ------------ `types::Priv` declared as private + | ----------- `types::Priv` declared as private ... LL | pub fn f2() -> Priv { panic!() } | ^^^^^^^^^^^^^^^^^^^ can't leak private type @@ -86,7 +86,7 @@ LL | trait PrivTr {} | ------------ `traits::PrivTr` declared as private ... LL | pub enum E<T: PrivTr> { V(T) } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private trait + | ^^^^^^^^^^^^^^^^^^^^^ can't leak private trait error[E0445]: private trait `traits::PrivTr` in public interface --> $DIR/private-in-public.rs:32:5 @@ -104,18 +104,16 @@ LL | trait PrivTr {} | ------------ `traits::PrivTr` declared as private ... LL | pub struct S1<T: PrivTr>(T); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private trait + | ^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private trait error[E0445]: private trait `traits::PrivTr` in public interface --> $DIR/private-in-public.rs:34:5 | -LL | trait PrivTr {} - | ------------ `traits::PrivTr` declared as private +LL | trait PrivTr {} + | ------------ `traits::PrivTr` declared as private ... -LL | / impl<T: PrivTr> Pub<T> { -LL | | pub fn f<U: PrivTr>(arg: U) {} -LL | | } - | |_____^ can't leak private trait +LL | impl<T: PrivTr> Pub<T> { + | ^^^^^^^^^^^^^^^^^^^^^^ can't leak private trait error[E0445]: private trait `traits::PrivTr` in public interface --> $DIR/private-in-public.rs:35:9 @@ -133,7 +131,7 @@ LL | trait PrivTr {} | ------------ `traits_where::PrivTr` declared as private ... LL | pub enum E<T> where T: PrivTr { V(T) } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private trait + | ^^^^^^^^^^^^^ can't leak private trait error[E0445]: private trait `traits_where::PrivTr` in public interface --> $DIR/private-in-public.rs:46:5 @@ -151,20 +149,16 @@ LL | trait PrivTr {} | ------------ `traits_where::PrivTr` declared as private ... LL | pub struct S1<T>(T) where T: PrivTr; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private trait + | ^^^^^^^^^^^^^^^^ can't leak private trait error[E0445]: private trait `traits_where::PrivTr` in public interface --> $DIR/private-in-public.rs:50:5 | -LL | trait PrivTr {} - | ------------ `traits_where::PrivTr` declared as private +LL | trait PrivTr {} + | ------------ `traits_where::PrivTr` declared as private ... -LL | / impl<T> Pub<T> where T: PrivTr { -LL | | -LL | | pub fn f<U>(arg: U) where U: PrivTr {} -LL | | -LL | | } - | |_____^ can't leak private trait +LL | impl<T> Pub<T> where T: PrivTr { + | ^^^^^^^^^^^^^^ can't leak private trait error[E0445]: private trait `traits_where::PrivTr` in public interface --> $DIR/private-in-public.rs:52:9 @@ -179,7 +173,7 @@ error[E0446]: private type `generics::Priv` in public interface --> $DIR/private-in-public.rs:63:5 | LL | struct Priv<T = u8>(T); - | ----------------------- `generics::Priv` declared as private + | ------------------- `generics::Priv` declared as private ... LL | pub fn f1(arg: [Priv; 1]) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type @@ -188,7 +182,7 @@ error[E0446]: private type `generics::Priv` in public interface --> $DIR/private-in-public.rs:64:5 | LL | struct Priv<T = u8>(T); - | ----------------------- `generics::Priv` declared as private + | ------------------- `generics::Priv` declared as private ... LL | pub fn f2(arg: Pub<Priv>) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type @@ -197,7 +191,7 @@ error[E0446]: private type `generics::Priv<generics::Pub>` in public interface --> $DIR/private-in-public.rs:65:5 | LL | struct Priv<T = u8>(T); - | ----------------------- `generics::Priv<generics::Pub>` declared as private + | ------------------- `generics::Priv<generics::Pub>` declared as private ... LL | pub fn f3(arg: Priv<Pub>) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type @@ -206,7 +200,7 @@ error[E0446]: private type `impls::Priv` in public interface --> $DIR/private-in-public.rs:80:9 | LL | struct Priv; - | ------------ `impls::Priv` declared as private + | ----------- `impls::Priv` declared as private ... LL | pub fn f(arg: Priv) {} | ^^^^^^^^^^^^^^^^^^^ can't leak private type @@ -224,7 +218,7 @@ error[E0446]: private type `aliases_pub::Priv` in public interface --> $DIR/private-in-public.rs:104:5 | LL | struct Priv; - | ------------ `aliases_pub::Priv` declared as private + | ----------- `aliases_pub::Priv` declared as private ... LL | pub fn f3(arg: <Priv as PrivTr>::Assoc) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type @@ -233,7 +227,7 @@ error[E0446]: private type `aliases_pub::Priv` in public interface --> $DIR/private-in-public.rs:109:9 | LL | struct Priv; - | ------------ `aliases_pub::Priv` declared as private + | ----------- `aliases_pub::Priv` declared as private ... LL | pub fn f(arg: Priv) {} | ^^^^^^^^^^^^^^^^^^^ can't leak private type @@ -242,7 +236,7 @@ error[E0446]: private type `Priv1` in public interface --> $DIR/private-in-public.rs:131:5 | LL | struct Priv1; - | ------------- `Priv1` declared as private + | ------------ `Priv1` declared as private ... LL | pub fn f1(arg: PrivUseAlias) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type @@ -251,7 +245,7 @@ error[E0446]: private type `Priv2` in public interface --> $DIR/private-in-public.rs:132:5 | LL | struct Priv2; - | ------------- `Priv2` declared as private + | ------------ `Priv2` declared as private ... LL | pub fn f2(arg: PrivAlias) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type @@ -269,7 +263,7 @@ error[E0446]: private type `aliases_priv::Priv` in public interface --> $DIR/private-in-public.rs:133:5 | LL | struct Priv; - | ------------ `aliases_priv::Priv` declared as private + | ----------- `aliases_priv::Priv` declared as private ... LL | pub fn f3(arg: <Priv as PrivTr>::Assoc) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type @@ -278,7 +272,7 @@ error[E0446]: private type `aliases_params::Priv` in public interface --> $DIR/private-in-public.rs:143:5 | LL | struct Priv; - | ------------ `aliases_params::Priv` declared as private + | ----------- `aliases_params::Priv` declared as private ... LL | pub fn f2(arg: PrivAliasGeneric) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type @@ -287,7 +281,7 @@ error[E0446]: private type `aliases_params::Priv` in public interface --> $DIR/private-in-public.rs:145:5 | LL | struct Priv; - | ------------ `aliases_params::Priv` declared as private + | ----------- `aliases_params::Priv` declared as private ... LL | pub fn f3(arg: Result<u8>) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type diff --git a/src/test/ui/privacy/private-inferred-type.stderr b/src/test/ui/privacy/private-inferred-type.stderr index e7e968839b6..aecd8b58c83 100644 --- a/src/test/ui/privacy/private-inferred-type.stderr +++ b/src/test/ui/privacy/private-inferred-type.stderr @@ -2,19 +2,19 @@ error[E0446]: private type `Priv` in public interface --> $DIR/private-inferred-type.rs:61:36 | LL | struct Priv; - | ------------ `Priv` declared as private + | ----------- `Priv` declared as private ... LL | impl TraitWithAssocTy for u8 { type AssocTy = Priv; } - | ^^^^^^^^^^^^^^^^^^^^ can't leak private type + | ^^^^^^^^^^^^ can't leak private type error[E0446]: private type `S2` in public interface --> $DIR/private-inferred-type.rs:83:9 | LL | struct S2; - | ---------- `S2` declared as private + | --------- `S2` declared as private ... LL | type Target = S2Alias; - | ^^^^^^^^^^^^^^^^^^^^^^ can't leak private type + | ^^^^^^^^^^^ can't leak private type error: type `Priv` is private --> $DIR/private-inferred-type.rs:97:9 diff --git a/src/test/ui/privacy/pub-priv-dep/pub-priv1.stderr b/src/test/ui/privacy/pub-priv-dep/pub-priv1.stderr index f64b8569015..e62a440d8f5 100644 --- a/src/test/ui/privacy/pub-priv-dep/pub-priv1.stderr +++ b/src/test/ui/privacy/pub-priv-dep/pub-priv1.stderr @@ -20,7 +20,7 @@ error: trait `OtherTrait` from private dependency 'priv_dep' in public interface --> $DIR/pub-priv1.rs:35:5 | LL | type Foo: OtherTrait; - | ^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^ error: aborting due to 3 previous errors diff --git a/src/test/ui/privacy/restricted/private-in-public.stderr b/src/test/ui/privacy/restricted/private-in-public.stderr index ee9c031ebff..65d996f0f07 100644 --- a/src/test/ui/privacy/restricted/private-in-public.stderr +++ b/src/test/ui/privacy/restricted/private-in-public.stderr @@ -2,7 +2,7 @@ error[E0446]: private type `Priv` in public interface --> $DIR/private-in-public.rs:6:9 | LL | struct Priv; - | ------------ `Priv` declared as private + | ----------- `Priv` declared as private ... LL | pub(crate) fn g(_: Priv) {} | ^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type @@ -11,7 +11,7 @@ error[E0446]: private type `Priv` in public interface --> $DIR/private-in-public.rs:7:9 | LL | struct Priv; - | ------------ `Priv` declared as private + | ----------- `Priv` declared as private ... LL | pub(crate) fn h(_: Priv) {} | ^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type diff --git a/src/test/ui/privacy/restricted/test.stderr b/src/test/ui/privacy/restricted/test.stderr index c81520c35cd..1acd221b42c 100644 --- a/src/test/ui/privacy/restricted/test.stderr +++ b/src/test/ui/privacy/restricted/test.stderr @@ -34,7 +34,7 @@ note: the struct `Crate` is defined here --> $DIR/auxiliary/pub_restricted.rs:1:1 | LL | pub(crate) struct Crate; - | ^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^ error[E0603]: function `f` is private --> $DIR/test.rs:30:19 diff --git a/src/test/ui/privacy/where-priv-type.stderr b/src/test/ui/privacy/where-priv-type.stderr index 378c14810d9..7eb71346ae9 100644 --- a/src/test/ui/privacy/where-priv-type.stderr +++ b/src/test/ui/privacy/where-priv-type.stderr @@ -1,13 +1,8 @@ warning: private type `PrivTy` in public interface (error E0446) --> $DIR/where-priv-type.rs:19:1 | -LL | / pub struct S -LL | | -LL | | -LL | | where -LL | | PrivTy: -LL | | {} - | |__^ +LL | pub struct S + | ^^^^^^^^^^^^ | = note: `#[warn(private_in_public)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -16,13 +11,8 @@ LL | | {} warning: private type `PrivTy` in public interface (error E0446) --> $DIR/where-priv-type.rs:27:1 | -LL | / pub enum E -LL | | -LL | | -LL | | where -LL | | PrivTy: -LL | | {} - | |__^ +LL | pub enum E + | ^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537> @@ -43,17 +33,11 @@ LL | | PrivTy: error[E0446]: private type `PrivTy` in public interface --> $DIR/where-priv-type.rs:43:1 | -LL | struct PrivTy; - | -------------- `PrivTy` declared as private +LL | struct PrivTy; + | ------------- `PrivTy` declared as private ... -LL | / impl S -LL | | -LL | | where -LL | | PrivTy: -... | -LL | | {} -LL | | } - | |_^ can't leak private type +LL | impl S + | ^^^^^^ can't leak private type warning: private type `PrivTy` in public interface (error E0446) --> $DIR/where-priv-type.rs:48:5 @@ -72,7 +56,7 @@ error[E0446]: private type `fn(u8) -> u8 {my_const_fn}` in public interface --> $DIR/where-priv-type.rs:80:5 | LL | type AssocTy = Const<{ my_const_fn(U) }>; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type + | ^^^^^^^^^^^^ can't leak private type ... LL | const fn my_const_fn(val: u8) -> u8 { | ----------------------------------- `fn(u8) -> u8 {my_const_fn}` declared as private diff --git a/src/test/ui/privacy/where-pub-type-impls-priv-trait.stderr b/src/test/ui/privacy/where-pub-type-impls-priv-trait.stderr index 9ce7b9a139f..a433cebbbc0 100644 --- a/src/test/ui/privacy/where-pub-type-impls-priv-trait.stderr +++ b/src/test/ui/privacy/where-pub-type-impls-priv-trait.stderr @@ -1,28 +1,20 @@ error[E0445]: private trait `PrivTr` in public interface --> $DIR/where-pub-type-impls-priv-trait.rs:19:1 | -LL | trait PrivTr {} - | ------------ `PrivTr` declared as private +LL | trait PrivTr {} + | ------------ `PrivTr` declared as private ... -LL | / pub struct S -LL | | -LL | | where -LL | | PubTy: PrivTr -LL | | {} - | |__^ can't leak private trait +LL | pub struct S + | ^^^^^^^^^^^^ can't leak private trait error[E0445]: private trait `PrivTr` in public interface --> $DIR/where-pub-type-impls-priv-trait.rs:26:1 | -LL | trait PrivTr {} - | ------------ `PrivTr` declared as private +LL | trait PrivTr {} + | ------------ `PrivTr` declared as private ... -LL | / pub enum E -LL | | -LL | | where -LL | | PubTy: PrivTr -LL | | {} - | |__^ can't leak private trait +LL | pub enum E + | ^^^^^^^^^^ can't leak private trait error[E0445]: private trait `PrivTr` in public interface --> $DIR/where-pub-type-impls-priv-trait.rs:33:1 @@ -39,17 +31,11 @@ LL | | PubTy: PrivTr error[E0445]: private trait `PrivTr` in public interface --> $DIR/where-pub-type-impls-priv-trait.rs:40:1 | -LL | trait PrivTr {} - | ------------ `PrivTr` declared as private +LL | trait PrivTr {} + | ------------ `PrivTr` declared as private ... -LL | / impl S -LL | | -LL | | where -LL | | PubTy: PrivTr -... | -LL | | {} -LL | | } - | |_^ can't leak private trait +LL | impl S + | ^^^^^^ can't leak private trait error[E0445]: private trait `PrivTr` in public interface --> $DIR/where-pub-type-impls-priv-trait.rs:45:5 diff --git a/src/test/ui/proc-macro/invalid-punct-ident-1.rs b/src/test/ui/proc-macro/invalid-punct-ident-1.rs index a3133a1a790..fdf3ca2e261 100644 --- a/src/test/ui/proc-macro/invalid-punct-ident-1.rs +++ b/src/test/ui/proc-macro/invalid-punct-ident-1.rs @@ -1,17 +1,9 @@ // aux-build:invalid-punct-ident.rs -// rustc-env:RUST_BACKTRACE=0 - -// FIXME https://github.com/rust-lang/rust/issues/59998 -// normalize-stderr-test "thread.*panicked.*proc_macro_server.rs.*\n" -> "" -// normalize-stderr-test "note:.*RUST_BACKTRACE=1.*\n" -> "" -// normalize-stderr-test "\nerror: internal compiler error.*\n\n" -> "" -// normalize-stderr-test "note:.*unexpectedly panicked.*\n\n" -> "" -// normalize-stderr-test "note: we would appreciate a bug report.*\n\n" -> "" -// normalize-stderr-test "note: compiler flags.*\n\n" -> "" -// normalize-stderr-test "note: rustc.*running on.*\n\n" -> "" -// normalize-stderr-test "query stack during panic:\n" -> "" -// normalize-stderr-test "we're just showing a limited slice of the query stack\n" -> "" -// normalize-stderr-test "end of query stack\n" -> "" +// ignore-stage1 +// only-linux +// +// FIXME: This should be a normal (stage1, all platforms) test in +// src/test/ui/proc-macro once issue #59998 is fixed. #[macro_use] extern crate invalid_punct_ident; diff --git a/src/test/ui/proc-macro/invalid-punct-ident-1.stderr b/src/test/ui/proc-macro/invalid-punct-ident-1.stderr index eaf41c080fa..bb0a48cb16b 100644 --- a/src/test/ui/proc-macro/invalid-punct-ident-1.stderr +++ b/src/test/ui/proc-macro/invalid-punct-ident-1.stderr @@ -1,5 +1,5 @@ error: proc macro panicked - --> $DIR/invalid-punct-ident-1.rs:19:1 + --> $DIR/invalid-punct-ident-1.rs:11:1 | LL | invalid_punct!(); | ^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/proc-macro/resolve-error.stderr b/src/test/ui/proc-macro/resolve-error.stderr index e518c6ab800..a534b9d5377 100644 --- a/src/test/ui/proc-macro/resolve-error.stderr +++ b/src/test/ui/proc-macro/resolve-error.stderr @@ -76,7 +76,7 @@ LL | #[derive(Dlone)] ::: $SRC_DIR/core/src/clone.rs:LL:COL | LL | pub macro Clone($item:item) { - | --------------------------- similarly named derive macro `Clone` defined here + | --------------- similarly named derive macro `Clone` defined here error: cannot find derive macro `Dlone` in this scope --> $DIR/resolve-error.rs:35:10 @@ -87,7 +87,7 @@ LL | #[derive(Dlone)] ::: $SRC_DIR/core/src/clone.rs:LL:COL | LL | pub macro Clone($item:item) { - | --------------------------- similarly named derive macro `Clone` defined here + | --------------- similarly named derive macro `Clone` defined here error: cannot find attribute `FooWithLongNan` in this scope --> $DIR/resolve-error.rs:32:3 diff --git a/src/test/ui/proc-macro/signature.stderr b/src/test/ui/proc-macro/signature.stderr index 78b0beff0da..a6bd98ddb19 100644 --- a/src/test/ui/proc-macro/signature.stderr +++ b/src/test/ui/proc-macro/signature.stderr @@ -5,10 +5,7 @@ LL | / pub unsafe extern "C" fn foo(a: i32, b: u32) -> u32 { LL | | LL | | loop {} LL | | } - | | ^ - | | | - | |_call the function in a closure: `|| unsafe { /* code */ }` - | required by a bound introduced by this call + | |_^ call the function in a closure: `|| unsafe { /* code */ }` | = help: the trait `Fn<(proc_macro::TokenStream,)>` is not implemented for `unsafe extern "C" fn(i32, u32) -> u32 {foo}` = note: unsafe function cannot be called generically without an unsafe block diff --git a/src/test/ui/pub/issue-33174-restricted-type-in-public-interface.stderr b/src/test/ui/pub/issue-33174-restricted-type-in-public-interface.stderr index 29d45858ff1..39d4f5ac8d3 100644 --- a/src/test/ui/pub/issue-33174-restricted-type-in-public-interface.stderr +++ b/src/test/ui/pub/issue-33174-restricted-type-in-public-interface.stderr @@ -2,28 +2,28 @@ error[E0446]: private type `Snail` in public interface --> $DIR/issue-33174-restricted-type-in-public-interface.rs:18:1 | LL | pub(crate) struct Snail; - | ------------------------ `Snail` declared as private + | ----------------------- `Snail` declared as private ... LL | pub type Helix_pomatia = Shell<Snail>; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type + | ^^^^^^^^^^^^^^^^^^^^^^ can't leak private type error[E0446]: crate-private type `Turtle` in public interface --> $DIR/issue-33174-restricted-type-in-public-interface.rs:21:1 | LL | pub(super) struct Turtle; - | ------------------------- `Turtle` declared as crate-private + | ------------------------ `Turtle` declared as crate-private ... LL | pub type Dermochelys_coriacea = Shell<sea::Turtle>; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak crate-private type + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak crate-private type error[E0446]: private type `Tortoise` in public interface --> $DIR/issue-33174-restricted-type-in-public-interface.rs:24:1 | LL | struct Tortoise; - | ---------------- `Tortoise` declared as private + | --------------- `Tortoise` declared as private ... LL | pub type Testudo_graeca = Shell<Tortoise>; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type + | ^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type error: aborting due to 3 previous errors diff --git a/src/test/ui/recursion/issue-83150.rs b/src/test/ui/recursion/issue-83150.rs index aa3f66b2e28..e647f0ff4fb 100644 --- a/src/test/ui/recursion/issue-83150.rs +++ b/src/test/ui/recursion/issue-83150.rs @@ -1,5 +1,6 @@ // build-fail -//~^ ERROR overflow evaluating the requirement +// compile-flags: -Copt-level=0 +//~^^ ERROR overflow evaluating the requirement fn main() { let mut iter = 0u8..1; diff --git a/src/test/ui/recursion/issue-83150.stderr b/src/test/ui/recursion/issue-83150.stderr index 4c8469be626..aaa5884c60c 100644 --- a/src/test/ui/recursion/issue-83150.stderr +++ b/src/test/ui/recursion/issue-83150.stderr @@ -1,5 +1,5 @@ warning: function cannot return without recursing - --> $DIR/issue-83150.rs:9:1 + --> $DIR/issue-83150.rs:10:1 | LL | fn func<T: Iterator<Item = u8>>(iter: &mut T) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot return without recursing @@ -9,10 +9,10 @@ LL | func(&mut iter.map(|x| x + 1)) = note: `#[warn(unconditional_recursion)]` on by default = help: a `loop` may express intention better if this is on purpose -error[E0275]: overflow evaluating the requirement `Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut std::ops::Range<u8>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>: Iterator` +error[E0275]: overflow evaluating the requirement `Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut std::ops::Range<u8>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>: Iterator` | = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`issue_83150`) - = note: required because of the requirements on the impl of `Iterator` for `&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut std::ops::Range<u8>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>` + = note: required because of the requirements on the impl of `Iterator` for `&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut std::ops::Range<u8>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>` error: aborting due to previous error; 1 warning emitted diff --git a/src/test/ui/recursion/recursive-static-definition.stderr b/src/test/ui/recursion/recursive-static-definition.stderr index d4d2c8c3d9c..1359761457a 100644 --- a/src/test/ui/recursion/recursive-static-definition.stderr +++ b/src/test/ui/recursion/recursive-static-definition.stderr @@ -2,7 +2,7 @@ error[E0391]: cycle detected when const-evaluating + checking `FOO` --> $DIR/recursive-static-definition.rs:1:1 | LL | pub static FOO: u32 = FOO; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^ | note: ...which requires const-evaluating + checking `FOO`... --> $DIR/recursive-static-definition.rs:1:23 diff --git a/src/test/ui/recursion/recursive-types-are-not-uninhabited.stderr b/src/test/ui/recursion/recursive-types-are-not-uninhabited.stderr index a9159562d9d..acbd0d05984 100644 --- a/src/test/ui/recursion/recursive-types-are-not-uninhabited.stderr +++ b/src/test/ui/recursion/recursive-types-are-not-uninhabited.stderr @@ -9,15 +9,11 @@ LL | let Ok(x) = res; note: `Result<u32, &R>` defined here --> $SRC_DIR/core/src/result.rs:LL:COL | -LL | / pub enum Result<T, E> { -LL | | /// Contains the success value -LL | | #[lang = "Ok"] -LL | | #[stable(feature = "rust1", since = "1.0.0")] -... | -LL | | Err(#[stable(feature = "rust1", since = "1.0.0")] E), - | | ^^^ not covered -LL | | } - | |_- +LL | pub enum Result<T, E> { + | --------------------- +... +LL | Err(#[stable(feature = "rust1", since = "1.0.0")] E), + | ^^^ not covered = note: the matched value is of type `Result<u32, &R>` help: you might want to use `if let` to ignore the variant that isn't matched | diff --git a/src/test/ui/repr/repr-packed-contains-align.stderr b/src/test/ui/repr/repr-packed-contains-align.stderr index 32f9bb8bf33..531004e8e20 100644 --- a/src/test/ui/repr/repr-packed-contains-align.stderr +++ b/src/test/ui/repr/repr-packed-contains-align.stderr @@ -2,25 +2,25 @@ error[E0588]: packed type cannot transitively contain a `#[repr(align)]` type --> $DIR/repr-packed-contains-align.rs:19:1 | LL | struct SC(SA); - | ^^^^^^^^^^^^^^ + | ^^^^^^^^^ | note: `SA` has a `#[repr(align)]` attribute --> $DIR/repr-packed-contains-align.rs:5:1 | LL | struct SA(i32); - | ^^^^^^^^^^^^^^^ + | ^^^^^^^^^ error[E0588]: packed type cannot transitively contain a `#[repr(align)]` type --> $DIR/repr-packed-contains-align.rs:22:1 | LL | struct SD(SB); - | ^^^^^^^^^^^^^^ + | ^^^^^^^^^ | note: `SA` has a `#[repr(align)]` attribute --> $DIR/repr-packed-contains-align.rs:5:1 | LL | struct SA(i32); - | ^^^^^^^^^^^^^^^ + | ^^^^^^^^^ note: `SD` contains a field of type `SB` --> $DIR/repr-packed-contains-align.rs:22:11 | @@ -36,29 +36,25 @@ error[E0588]: packed type cannot transitively contain a `#[repr(align)]` type --> $DIR/repr-packed-contains-align.rs:25:1 | LL | struct SE(UA); - | ^^^^^^^^^^^^^^ + | ^^^^^^^^^ | note: `UA` has a `#[repr(align)]` attribute --> $DIR/repr-packed-contains-align.rs:10:1 | -LL | / union UA { -LL | | i: i32 -LL | | } - | |_^ +LL | union UA { + | ^^^^^^^^ error[E0588]: packed type cannot transitively contain a `#[repr(align)]` type --> $DIR/repr-packed-contains-align.rs:28:1 | LL | struct SF(UB); - | ^^^^^^^^^^^^^^ + | ^^^^^^^^^ | note: `UA` has a `#[repr(align)]` attribute --> $DIR/repr-packed-contains-align.rs:10:1 | -LL | / union UA { -LL | | i: i32 -LL | | } - | |_^ +LL | union UA { + | ^^^^^^^^ note: `SF` contains a field of type `UB` --> $DIR/repr-packed-contains-align.rs:28:11 | @@ -73,34 +69,26 @@ LL | a: UA error[E0588]: packed type cannot transitively contain a `#[repr(align)]` type --> $DIR/repr-packed-contains-align.rs:31:1 | -LL | / union UC { -LL | | a: UA -LL | | } - | |_^ +LL | union UC { + | ^^^^^^^^ | note: `UA` has a `#[repr(align)]` attribute --> $DIR/repr-packed-contains-align.rs:10:1 | -LL | / union UA { -LL | | i: i32 -LL | | } - | |_^ +LL | union UA { + | ^^^^^^^^ error[E0588]: packed type cannot transitively contain a `#[repr(align)]` type --> $DIR/repr-packed-contains-align.rs:36:1 | -LL | / union UD { -LL | | n: UB -LL | | } - | |_^ +LL | union UD { + | ^^^^^^^^ | note: `UA` has a `#[repr(align)]` attribute --> $DIR/repr-packed-contains-align.rs:10:1 | -LL | / union UA { -LL | | i: i32 -LL | | } - | |_^ +LL | union UA { + | ^^^^^^^^ note: `UD` contains a field of type `UB` --> $DIR/repr-packed-contains-align.rs:37:5 | @@ -115,30 +103,26 @@ LL | a: UA error[E0588]: packed type cannot transitively contain a `#[repr(align)]` type --> $DIR/repr-packed-contains-align.rs:41:1 | -LL | / union UE { -LL | | a: SA -LL | | } - | |_^ +LL | union UE { + | ^^^^^^^^ | note: `SA` has a `#[repr(align)]` attribute --> $DIR/repr-packed-contains-align.rs:5:1 | LL | struct SA(i32); - | ^^^^^^^^^^^^^^^ + | ^^^^^^^^^ error[E0588]: packed type cannot transitively contain a `#[repr(align)]` type --> $DIR/repr-packed-contains-align.rs:46:1 | -LL | / union UF { -LL | | n: SB -LL | | } - | |_^ +LL | union UF { + | ^^^^^^^^ | note: `SA` has a `#[repr(align)]` attribute --> $DIR/repr-packed-contains-align.rs:5:1 | LL | struct SA(i32); - | ^^^^^^^^^^^^^^^ + | ^^^^^^^^^ note: `UF` contains a field of type `SB` --> $DIR/repr-packed-contains-align.rs:47:5 | diff --git a/src/test/ui/repr/repr-transparent-issue-87496.stderr b/src/test/ui/repr/repr-transparent-issue-87496.stderr index c488755cc24..3dc13b1c13c 100644 --- a/src/test/ui/repr/repr-transparent-issue-87496.stderr +++ b/src/test/ui/repr/repr-transparent-issue-87496.stderr @@ -10,7 +10,7 @@ note: the type is defined here --> $DIR/repr-transparent-issue-87496.rs:6:1 | LL | struct TransparentCustomZst(()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: 1 warning emitted diff --git a/src/test/ui/repr/repr-transparent.stderr b/src/test/ui/repr/repr-transparent.stderr index 001a181881f..6ff3641bc15 100644 --- a/src/test/ui/repr/repr-transparent.stderr +++ b/src/test/ui/repr/repr-transparent.stderr @@ -2,9 +2,8 @@ error[E0690]: transparent struct needs at most one non-zero-sized field, but has --> $DIR/repr-transparent.rs:26:1 | LL | struct MultipleNonZst(u8, u8); - | ^^^^^^^^^^^^^^^^^^^^^^--^^--^^ - | | | | - | | | this field is non-zero-sized + | ^^^^^^^^^^^^^^^^^^^^^ -- -- this field is non-zero-sized + | | | | | this field is non-zero-sized | needs at most one non-zero-sized field, but has 2 @@ -12,9 +11,8 @@ error[E0690]: transparent struct needs at most one non-zero-sized field, but has --> $DIR/repr-transparent.rs:32:1 | LL | pub struct StructWithProjection(f32, <f32 as Mirror>::It); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---^^-------------------^^ - | | | | - | | | this field is non-zero-sized + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ --- ------------------- this field is non-zero-sized + | | | | | this field is non-zero-sized | needs at most one non-zero-sized field, but has 2 diff --git a/src/test/ui/resolve/issue-23305.stderr b/src/test/ui/resolve/issue-23305.stderr index 0dcf0184db1..f839bd42432 100644 --- a/src/test/ui/resolve/issue-23305.stderr +++ b/src/test/ui/resolve/issue-23305.stderr @@ -1,10 +1,10 @@ -error[E0391]: cycle detected when computing type of `<impl at $DIR/issue-23305.rs:5:1: 5:24>` +error[E0391]: cycle detected when computing type of `<impl at $DIR/issue-23305.rs:5:1: 5:21>` --> $DIR/issue-23305.rs:5:16 | LL | impl dyn ToNbt<Self> {} | ^^^^ | - = note: ...which immediately requires computing type of `<impl at $DIR/issue-23305.rs:5:1: 5:24>` again + = note: ...which immediately requires computing type of `<impl at $DIR/issue-23305.rs:5:1: 5:21>` again note: cycle used when collecting item types in top-level module --> $DIR/issue-23305.rs:1:1 | diff --git a/src/test/ui/resolve/privacy-struct-ctor.stderr b/src/test/ui/resolve/privacy-struct-ctor.stderr index ada053014ef..17a666a401c 100644 --- a/src/test/ui/resolve/privacy-struct-ctor.stderr +++ b/src/test/ui/resolve/privacy-struct-ctor.stderr @@ -114,7 +114,7 @@ note: the tuple struct constructor `S` is defined here --> $DIR/auxiliary/privacy-struct-ctor.rs:2:5 | LL | pub struct S(u8); - | ^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^ error[E0603]: tuple struct constructor `Z` is private --> $DIR/privacy-struct-ctor.rs:45:19 @@ -131,7 +131,7 @@ note: the tuple struct constructor `Z` is defined here --> $DIR/auxiliary/privacy-struct-ctor.rs:5:9 | LL | pub(in m) struct Z(pub(in m::n) u8); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^ error: aborting due to 10 previous errors diff --git a/src/test/ui/resolve/resolve-self-in-impl.stderr b/src/test/ui/resolve/resolve-self-in-impl.stderr index 7f623e47353..aa99c1a3335 100644 --- a/src/test/ui/resolve/resolve-self-in-impl.stderr +++ b/src/test/ui/resolve/resolve-self-in-impl.stderr @@ -1,10 +1,10 @@ -error[E0391]: cycle detected when computing type of `<impl at $DIR/resolve-self-in-impl.rs:14:1: 14:20>` +error[E0391]: cycle detected when computing type of `<impl at $DIR/resolve-self-in-impl.rs:14:1: 14:17>` --> $DIR/resolve-self-in-impl.rs:14:13 | LL | impl Tr for Self {} | ^^^^ | - = note: ...which immediately requires computing type of `<impl at $DIR/resolve-self-in-impl.rs:14:1: 14:20>` again + = note: ...which immediately requires computing type of `<impl at $DIR/resolve-self-in-impl.rs:14:1: 14:17>` again note: cycle used when collecting item types in top-level module --> $DIR/resolve-self-in-impl.rs:1:1 | @@ -17,13 +17,13 @@ LL | | LL | | fn main() {} | |____________^ -error[E0391]: cycle detected when computing type of `<impl at $DIR/resolve-self-in-impl.rs:15:1: 15:23>` +error[E0391]: cycle detected when computing type of `<impl at $DIR/resolve-self-in-impl.rs:15:1: 15:20>` --> $DIR/resolve-self-in-impl.rs:15:15 | LL | impl Tr for S<Self> {} | ^^^^ | - = note: ...which immediately requires computing type of `<impl at $DIR/resolve-self-in-impl.rs:15:1: 15:23>` again + = note: ...which immediately requires computing type of `<impl at $DIR/resolve-self-in-impl.rs:15:1: 15:20>` again note: cycle used when collecting item types in top-level module --> $DIR/resolve-self-in-impl.rs:1:1 | @@ -36,13 +36,13 @@ LL | | LL | | fn main() {} | |____________^ -error[E0391]: cycle detected when computing type of `<impl at $DIR/resolve-self-in-impl.rs:16:1: 16:13>` +error[E0391]: cycle detected when computing type of `<impl at $DIR/resolve-self-in-impl.rs:16:1: 16:10>` --> $DIR/resolve-self-in-impl.rs:16:6 | LL | impl Self {} | ^^^^ | - = note: ...which immediately requires computing type of `<impl at $DIR/resolve-self-in-impl.rs:16:1: 16:13>` again + = note: ...which immediately requires computing type of `<impl at $DIR/resolve-self-in-impl.rs:16:1: 16:10>` again note: cycle used when collecting item types in top-level module --> $DIR/resolve-self-in-impl.rs:1:1 | @@ -55,13 +55,13 @@ LL | | LL | | fn main() {} | |____________^ -error[E0391]: cycle detected when computing type of `<impl at $DIR/resolve-self-in-impl.rs:17:1: 17:16>` +error[E0391]: cycle detected when computing type of `<impl at $DIR/resolve-self-in-impl.rs:17:1: 17:13>` --> $DIR/resolve-self-in-impl.rs:17:8 | LL | impl S<Self> {} | ^^^^ | - = note: ...which immediately requires computing type of `<impl at $DIR/resolve-self-in-impl.rs:17:1: 17:16>` again + = note: ...which immediately requires computing type of `<impl at $DIR/resolve-self-in-impl.rs:17:1: 17:13>` again note: cycle used when collecting item types in top-level module --> $DIR/resolve-self-in-impl.rs:1:1 | @@ -74,13 +74,13 @@ LL | | LL | | fn main() {} | |____________^ -error[E0391]: cycle detected when computing trait implemented by `<impl at $DIR/resolve-self-in-impl.rs:18:1: 18:26>` +error[E0391]: cycle detected when computing trait implemented by `<impl at $DIR/resolve-self-in-impl.rs:18:1: 18:23>` --> $DIR/resolve-self-in-impl.rs:18:1 | LL | impl Tr<Self::A> for S {} | ^^^^^^^^^^^^^^^^^^^^^^ | - = note: ...which immediately requires computing trait implemented by `<impl at $DIR/resolve-self-in-impl.rs:18:1: 18:26>` again + = note: ...which immediately requires computing trait implemented by `<impl at $DIR/resolve-self-in-impl.rs:18:1: 18:23>` again note: cycle used when collecting item types in top-level module --> $DIR/resolve-self-in-impl.rs:1:1 | diff --git a/src/test/ui/rfc-2005-default-binding-mode/const.stderr b/src/test/ui/rfc-2005-default-binding-mode/const.stderr index 10d30ec1a1b..0f567125432 100644 --- a/src/test/ui/rfc-2005-default-binding-mode/const.stderr +++ b/src/test/ui/rfc-2005-default-binding-mode/const.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/const.rs:14:9 | LL | const FOO: Foo = Foo{bar: 5}; - | ----------------------------- constant defined here + | -------------- constant defined here ... LL | match &f { | -- this expression has type `&Foo` diff --git a/src/test/ui/rfc-2008-non-exhaustive/enum.stderr b/src/test/ui/rfc-2008-non-exhaustive/enum.stderr index 5ef078c2005..872cb9b8bc6 100644 --- a/src/test/ui/rfc-2008-non-exhaustive/enum.stderr +++ b/src/test/ui/rfc-2008-non-exhaustive/enum.stderr @@ -8,7 +8,7 @@ note: `EmptyNonExhaustiveEnum` defined here --> $DIR/auxiliary/enums.rs:18:1 | LL | pub enum EmptyNonExhaustiveEnum {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: the matched value is of type `EmptyNonExhaustiveEnum`, which is marked as non-exhaustive help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown | @@ -26,12 +26,8 @@ LL | match enum_unit { note: `NonExhaustiveEnum` defined here --> $DIR/auxiliary/enums.rs:4:1 | -LL | / pub enum NonExhaustiveEnum { -LL | | Unit, -LL | | Tuple(u32), -LL | | Struct { field: u32 }, -LL | | } - | |_^ +LL | pub enum NonExhaustiveEnum { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: the matched value is of type `NonExhaustiveEnum`, which is marked as non-exhaustive help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | @@ -48,12 +44,8 @@ LL | match enum_unit {}; note: `NonExhaustiveEnum` defined here --> $DIR/auxiliary/enums.rs:4:1 | -LL | / pub enum NonExhaustiveEnum { -LL | | Unit, -LL | | Tuple(u32), -LL | | Struct { field: u32 }, -LL | | } - | |_^ +LL | pub enum NonExhaustiveEnum { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: the matched value is of type `NonExhaustiveEnum`, which is marked as non-exhaustive help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | diff --git a/src/test/ui/rfc-2008-non-exhaustive/struct.stderr b/src/test/ui/rfc-2008-non-exhaustive/struct.stderr index 272b2ef6ee1..2b34d071179 100644 --- a/src/test/ui/rfc-2008-non-exhaustive/struct.stderr +++ b/src/test/ui/rfc-2008-non-exhaustive/struct.stderr @@ -25,7 +25,7 @@ note: the tuple struct constructor `TupleStruct` is defined here --> $DIR/auxiliary/structs.rs:12:1 | LL | pub struct TupleStruct(pub u16, pub u16); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^ error[E0603]: unit struct `UnitStruct` is private --> $DIR/struct.rs:32:32 @@ -37,7 +37,7 @@ note: the unit struct `UnitStruct` is defined here --> $DIR/auxiliary/structs.rs:9:1 | LL | pub struct UnitStruct; - | ^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^ error[E0639]: cannot create non-exhaustive struct using struct expression --> $DIR/struct.rs:7:14 diff --git a/src/test/ui/rfc-2008-non-exhaustive/uninhabited/indirect_match.stderr b/src/test/ui/rfc-2008-non-exhaustive/uninhabited/indirect_match.stderr index 2dc4eabb863..66e93291c72 100644 --- a/src/test/ui/rfc-2008-non-exhaustive/uninhabited/indirect_match.stderr +++ b/src/test/ui/rfc-2008-non-exhaustive/uninhabited/indirect_match.stderr @@ -8,7 +8,7 @@ note: `IndirectUninhabitedEnum` defined here --> $DIR/auxiliary/uninhabited.rs:26:1 | LL | pub struct IndirectUninhabitedEnum(UninhabitedEnum); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: the matched value is of type `IndirectUninhabitedEnum` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown | @@ -27,7 +27,7 @@ note: `IndirectUninhabitedStruct` defined here --> $DIR/auxiliary/uninhabited.rs:28:1 | LL | pub struct IndirectUninhabitedStruct(UninhabitedStruct); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: the matched value is of type `IndirectUninhabitedStruct` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown | @@ -46,7 +46,7 @@ note: `IndirectUninhabitedTupleStruct` defined here --> $DIR/auxiliary/uninhabited.rs:30:1 | LL | pub struct IndirectUninhabitedTupleStruct(UninhabitedTupleStruct); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: the matched value is of type `IndirectUninhabitedTupleStruct` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown | @@ -65,7 +65,7 @@ note: `IndirectUninhabitedVariants` defined here --> $DIR/auxiliary/uninhabited.rs:32:1 | LL | pub struct IndirectUninhabitedVariants(UninhabitedVariants); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: the matched value is of type `IndirectUninhabitedVariants` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown | diff --git a/src/test/ui/rfc-2008-non-exhaustive/uninhabited/indirect_match_with_exhaustive_patterns.stderr b/src/test/ui/rfc-2008-non-exhaustive/uninhabited/indirect_match_with_exhaustive_patterns.stderr index f0cb13de3f7..ef97c1fa17f 100644 --- a/src/test/ui/rfc-2008-non-exhaustive/uninhabited/indirect_match_with_exhaustive_patterns.stderr +++ b/src/test/ui/rfc-2008-non-exhaustive/uninhabited/indirect_match_with_exhaustive_patterns.stderr @@ -8,7 +8,7 @@ note: `IndirectUninhabitedEnum` defined here --> $DIR/auxiliary/uninhabited.rs:26:1 | LL | pub struct IndirectUninhabitedEnum(UninhabitedEnum); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: the matched value is of type `IndirectUninhabitedEnum` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown | @@ -27,7 +27,7 @@ note: `IndirectUninhabitedStruct` defined here --> $DIR/auxiliary/uninhabited.rs:28:1 | LL | pub struct IndirectUninhabitedStruct(UninhabitedStruct); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: the matched value is of type `IndirectUninhabitedStruct` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown | @@ -46,7 +46,7 @@ note: `IndirectUninhabitedTupleStruct` defined here --> $DIR/auxiliary/uninhabited.rs:30:1 | LL | pub struct IndirectUninhabitedTupleStruct(UninhabitedTupleStruct); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: the matched value is of type `IndirectUninhabitedTupleStruct` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown | @@ -65,7 +65,7 @@ note: `IndirectUninhabitedVariants` defined here --> $DIR/auxiliary/uninhabited.rs:32:1 | LL | pub struct IndirectUninhabitedVariants(UninhabitedVariants); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: the matched value is of type `IndirectUninhabitedVariants` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown | diff --git a/src/test/ui/rfc-2008-non-exhaustive/uninhabited/match.stderr b/src/test/ui/rfc-2008-non-exhaustive/uninhabited/match.stderr index 49febd9241d..32a5c07f196 100644 --- a/src/test/ui/rfc-2008-non-exhaustive/uninhabited/match.stderr +++ b/src/test/ui/rfc-2008-non-exhaustive/uninhabited/match.stderr @@ -7,9 +7,8 @@ LL | match x {} note: `UninhabitedEnum` defined here --> $DIR/auxiliary/uninhabited.rs:5:1 | -LL | / pub enum UninhabitedEnum { -LL | | } - | |_^ +LL | pub enum UninhabitedEnum { + | ^^^^^^^^^^^^^^^^^^^^^^^^ = note: the matched value is of type `UninhabitedEnum`, which is marked as non-exhaustive help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown | @@ -27,10 +26,8 @@ LL | match x {} note: `UninhabitedStruct` defined here --> $DIR/auxiliary/uninhabited.rs:9:1 | -LL | / pub struct UninhabitedStruct { -LL | | _priv: !, -LL | | } - | |_^ +LL | pub struct UninhabitedStruct { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: the matched value is of type `UninhabitedStruct` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown | @@ -49,7 +46,7 @@ note: `UninhabitedTupleStruct` defined here --> $DIR/auxiliary/uninhabited.rs:14:1 | LL | pub struct UninhabitedTupleStruct(!); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: the matched value is of type `UninhabitedTupleStruct` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown | @@ -67,13 +64,12 @@ LL | match x {} note: `UninhabitedVariants` defined here --> $DIR/auxiliary/uninhabited.rs:17:23 | -LL | / pub enum UninhabitedVariants { -LL | | #[non_exhaustive] Tuple(!), - | | ^^^^^ not covered -LL | | #[non_exhaustive] Struct { x: ! } - | | ^^^^^^ not covered -LL | | } - | |_- +LL | pub enum UninhabitedVariants { + | ---------------------------- +LL | #[non_exhaustive] Tuple(!), + | ^^^^^ not covered +LL | #[non_exhaustive] Struct { x: ! } + | ^^^^^^ not covered = note: the matched value is of type `UninhabitedVariants` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms | diff --git a/src/test/ui/rfc-2008-non-exhaustive/uninhabited/match_with_exhaustive_patterns.stderr b/src/test/ui/rfc-2008-non-exhaustive/uninhabited/match_with_exhaustive_patterns.stderr index e18c2678d32..d854ea28ff6 100644 --- a/src/test/ui/rfc-2008-non-exhaustive/uninhabited/match_with_exhaustive_patterns.stderr +++ b/src/test/ui/rfc-2008-non-exhaustive/uninhabited/match_with_exhaustive_patterns.stderr @@ -7,9 +7,8 @@ LL | match x {} note: `UninhabitedEnum` defined here --> $DIR/auxiliary/uninhabited.rs:5:1 | -LL | / pub enum UninhabitedEnum { -LL | | } - | |_^ +LL | pub enum UninhabitedEnum { + | ^^^^^^^^^^^^^^^^^^^^^^^^ = note: the matched value is of type `UninhabitedEnum`, which is marked as non-exhaustive help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown | @@ -27,10 +26,8 @@ LL | match x {} note: `UninhabitedStruct` defined here --> $DIR/auxiliary/uninhabited.rs:9:1 | -LL | / pub struct UninhabitedStruct { -LL | | _priv: !, -LL | | } - | |_^ +LL | pub struct UninhabitedStruct { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: the matched value is of type `UninhabitedStruct` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown | @@ -49,7 +46,7 @@ note: `UninhabitedTupleStruct` defined here --> $DIR/auxiliary/uninhabited.rs:14:1 | LL | pub struct UninhabitedTupleStruct(!); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: the matched value is of type `UninhabitedTupleStruct` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown | @@ -67,13 +64,12 @@ LL | match x {} note: `UninhabitedVariants` defined here --> $DIR/auxiliary/uninhabited.rs:17:23 | -LL | / pub enum UninhabitedVariants { -LL | | #[non_exhaustive] Tuple(!), - | | ^^^^^ not covered -LL | | #[non_exhaustive] Struct { x: ! } - | | ^^^^^^ not covered -LL | | } - | |_- +LL | pub enum UninhabitedVariants { + | ---------------------------- +LL | #[non_exhaustive] Tuple(!), + | ^^^^^ not covered +LL | #[non_exhaustive] Struct { x: ! } + | ^^^^^^ not covered = note: the matched value is of type `UninhabitedVariants` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms | diff --git a/src/test/ui/rfc-2093-infer-outlives/cross-crate.stderr b/src/test/ui/rfc-2093-infer-outlives/cross-crate.stderr index 1da8e648251..76300cce55c 100644 --- a/src/test/ui/rfc-2093-infer-outlives/cross-crate.stderr +++ b/src/test/ui/rfc-2093-infer-outlives/cross-crate.stderr @@ -1,10 +1,8 @@ error: rustc_outlives --> $DIR/cross-crate.rs:4:1 | -LL | / struct Foo<'a, T> { -LL | | bar: std::slice::IterMut<'a, T> -LL | | } - | |_^ +LL | struct Foo<'a, T> { + | ^^^^^^^^^^^^^^^^^ | = note: T: 'a diff --git a/src/test/ui/rfc-2093-infer-outlives/enum.stderr b/src/test/ui/rfc-2093-infer-outlives/enum.stderr index 868ca2c4587..b6ce2450e22 100644 --- a/src/test/ui/rfc-2093-infer-outlives/enum.stderr +++ b/src/test/ui/rfc-2093-infer-outlives/enum.stderr @@ -1,30 +1,24 @@ error: rustc_outlives --> $DIR/enum.rs:7:1 | -LL | / enum Foo<'a, T> { -LL | | One(Bar<'a, T>) -LL | | } - | |_^ +LL | enum Foo<'a, T> { + | ^^^^^^^^^^^^^^^ | = note: T: 'a error: rustc_outlives --> $DIR/enum.rs:13:1 | -LL | / struct Bar<'b, U> { -LL | | field2: &'b U -LL | | } - | |_^ +LL | struct Bar<'b, U> { + | ^^^^^^^^^^^^^^^^^ | = note: U: 'b error: rustc_outlives --> $DIR/enum.rs:19:1 | -LL | / enum Ying<'c, K> { -LL | | One(&'c Yang<K>) -LL | | } - | |_^ +LL | enum Ying<'c, K> { + | ^^^^^^^^^^^^^^^^ | = note: K: 'c diff --git a/src/test/ui/rfc-2093-infer-outlives/explicit-dyn.stderr b/src/test/ui/rfc-2093-infer-outlives/explicit-dyn.stderr index 4608962c7c3..595a5c28088 100644 --- a/src/test/ui/rfc-2093-infer-outlives/explicit-dyn.stderr +++ b/src/test/ui/rfc-2093-infer-outlives/explicit-dyn.stderr @@ -1,11 +1,8 @@ error: rustc_outlives --> $DIR/explicit-dyn.rs:7:1 | -LL | / struct Foo<'a, A> -LL | | { -LL | | foo: Box<dyn Trait<'a, A>> -LL | | } - | |_^ +LL | struct Foo<'a, A> + | ^^^^^^^^^^^^^^^^^ | = note: A: 'a diff --git a/src/test/ui/rfc-2093-infer-outlives/explicit-enum.stderr b/src/test/ui/rfc-2093-infer-outlives/explicit-enum.stderr index 062f5d5e9a7..3059f95aefb 100644 --- a/src/test/ui/rfc-2093-infer-outlives/explicit-enum.stderr +++ b/src/test/ui/rfc-2093-infer-outlives/explicit-enum.stderr @@ -1,10 +1,8 @@ error: rustc_outlives --> $DIR/explicit-enum.rs:4:1 | -LL | / enum Foo<'a, U> { -LL | | One(Bar<'a, U>) -LL | | } - | |_^ +LL | enum Foo<'a, U> { + | ^^^^^^^^^^^^^^^ | = note: U: 'a diff --git a/src/test/ui/rfc-2093-infer-outlives/explicit-projection.stderr b/src/test/ui/rfc-2093-infer-outlives/explicit-projection.stderr index a85aa3d7565..589e9589913 100644 --- a/src/test/ui/rfc-2093-infer-outlives/explicit-projection.stderr +++ b/src/test/ui/rfc-2093-infer-outlives/explicit-projection.stderr @@ -1,11 +1,8 @@ error: rustc_outlives --> $DIR/explicit-projection.rs:8:1 | -LL | / struct Foo<'a, A, B> where A: Trait<'a, B> -LL | | { -LL | | foo: <A as Trait<'a, B>>::Type -LL | | } - | |_^ +LL | struct Foo<'a, A, B> where A: Trait<'a, B> + | ^^^^^^^^^^^^^^^^^^^^ | = note: B: 'a diff --git a/src/test/ui/rfc-2093-infer-outlives/explicit-struct.stderr b/src/test/ui/rfc-2093-infer-outlives/explicit-struct.stderr index 309c54bb449..9912e36b29c 100644 --- a/src/test/ui/rfc-2093-infer-outlives/explicit-struct.stderr +++ b/src/test/ui/rfc-2093-infer-outlives/explicit-struct.stderr @@ -1,10 +1,8 @@ error: rustc_outlives --> $DIR/explicit-struct.rs:4:1 | -LL | / struct Foo<'b, U> { -LL | | bar: Bar<'b, U> -LL | | } - | |_^ +LL | struct Foo<'b, U> { + | ^^^^^^^^^^^^^^^^^ | = note: U: 'b diff --git a/src/test/ui/rfc-2093-infer-outlives/explicit-union.stderr b/src/test/ui/rfc-2093-infer-outlives/explicit-union.stderr index 47c283faf50..2c6d06aa8c7 100644 --- a/src/test/ui/rfc-2093-infer-outlives/explicit-union.stderr +++ b/src/test/ui/rfc-2093-infer-outlives/explicit-union.stderr @@ -1,10 +1,8 @@ error: rustc_outlives --> $DIR/explicit-union.rs:5:1 | -LL | / union Foo<'b, U: Copy> { -LL | | bar: Bar<'b, U> -LL | | } - | |_^ +LL | union Foo<'b, U: Copy> { + | ^^^^^^^^^^^^^^^^^^^^^^ | = note: U: 'b diff --git a/src/test/ui/rfc-2093-infer-outlives/nested-enum.stderr b/src/test/ui/rfc-2093-infer-outlives/nested-enum.stderr index 10387f51b1e..4350e6e8bee 100644 --- a/src/test/ui/rfc-2093-infer-outlives/nested-enum.stderr +++ b/src/test/ui/rfc-2093-infer-outlives/nested-enum.stderr @@ -1,11 +1,8 @@ error: rustc_outlives --> $DIR/nested-enum.rs:4:1 | -LL | / enum Foo<'a, T> { -LL | | -LL | | One(Bar<'a, T>) -LL | | } - | |_^ +LL | enum Foo<'a, T> { + | ^^^^^^^^^^^^^^^ | = note: T: 'a diff --git a/src/test/ui/rfc-2093-infer-outlives/nested-regions.stderr b/src/test/ui/rfc-2093-infer-outlives/nested-regions.stderr index ffdd5542bb4..c08add7eded 100644 --- a/src/test/ui/rfc-2093-infer-outlives/nested-regions.stderr +++ b/src/test/ui/rfc-2093-infer-outlives/nested-regions.stderr @@ -1,10 +1,8 @@ error: rustc_outlives --> $DIR/nested-regions.rs:4:1 | -LL | / struct Foo<'a, 'b, T> { -LL | | x: &'a &'b T -LL | | } - | |_^ +LL | struct Foo<'a, 'b, T> { + | ^^^^^^^^^^^^^^^^^^^^^ | = note: 'b: 'a = note: T: 'a diff --git a/src/test/ui/rfc-2093-infer-outlives/nested-structs.stderr b/src/test/ui/rfc-2093-infer-outlives/nested-structs.stderr index 86bcbe640e4..76955523443 100644 --- a/src/test/ui/rfc-2093-infer-outlives/nested-structs.stderr +++ b/src/test/ui/rfc-2093-infer-outlives/nested-structs.stderr @@ -1,10 +1,8 @@ error: rustc_outlives --> $DIR/nested-structs.rs:4:1 | -LL | / struct Foo<'a, T> { -LL | | field1: Bar<'a, T> -LL | | } - | |_^ +LL | struct Foo<'a, T> { + | ^^^^^^^^^^^^^^^^^ | = note: T: 'a diff --git a/src/test/ui/rfc-2093-infer-outlives/nested-union.stderr b/src/test/ui/rfc-2093-infer-outlives/nested-union.stderr index e0f248fa38a..0116a2a68ce 100644 --- a/src/test/ui/rfc-2093-infer-outlives/nested-union.stderr +++ b/src/test/ui/rfc-2093-infer-outlives/nested-union.stderr @@ -1,10 +1,8 @@ error: rustc_outlives --> $DIR/nested-union.rs:5:1 | -LL | / union Foo<'a, T: Copy> { -LL | | field1: Bar<'a, T> -LL | | } - | |_^ +LL | union Foo<'a, T: Copy> { + | ^^^^^^^^^^^^^^^^^^^^^^ | = note: T: 'a diff --git a/src/test/ui/rfc-2093-infer-outlives/projection.stderr b/src/test/ui/rfc-2093-infer-outlives/projection.stderr index 840676e7966..d9342013f55 100644 --- a/src/test/ui/rfc-2093-infer-outlives/projection.stderr +++ b/src/test/ui/rfc-2093-infer-outlives/projection.stderr @@ -1,10 +1,8 @@ error: rustc_outlives --> $DIR/projection.rs:4:1 | -LL | / struct Foo<'a, T: Iterator> { -LL | | bar: &'a T::Item -LL | | } - | |_^ +LL | struct Foo<'a, T: Iterator> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: <T as Iterator>::Item: 'a diff --git a/src/test/ui/rfc-2093-infer-outlives/reference.stderr b/src/test/ui/rfc-2093-infer-outlives/reference.stderr index d69aaf6f849..50811435781 100644 --- a/src/test/ui/rfc-2093-infer-outlives/reference.stderr +++ b/src/test/ui/rfc-2093-infer-outlives/reference.stderr @@ -1,10 +1,8 @@ error: rustc_outlives --> $DIR/reference.rs:4:1 | -LL | / struct Foo<'a, T> { -LL | | bar: &'a T, -LL | | } - | |_^ +LL | struct Foo<'a, T> { + | ^^^^^^^^^^^^^^^^^ | = note: T: 'a diff --git a/src/test/ui/rfc-2093-infer-outlives/self-dyn.stderr b/src/test/ui/rfc-2093-infer-outlives/self-dyn.stderr index 7836b3f5aab..9c836b190cf 100644 --- a/src/test/ui/rfc-2093-infer-outlives/self-dyn.stderr +++ b/src/test/ui/rfc-2093-infer-outlives/self-dyn.stderr @@ -1,11 +1,8 @@ error: rustc_outlives --> $DIR/self-dyn.rs:8:1 | -LL | / struct Foo<'a, 'b, A> -LL | | { -LL | | foo: Box<dyn Trait<'a, 'b, A>> -LL | | } - | |_^ +LL | struct Foo<'a, 'b, A> + | ^^^^^^^^^^^^^^^^^^^^^ | = note: A: 'a diff --git a/src/test/ui/rfc-2093-infer-outlives/self-structs.stderr b/src/test/ui/rfc-2093-infer-outlives/self-structs.stderr index b972ad84466..2b4625f77a5 100644 --- a/src/test/ui/rfc-2093-infer-outlives/self-structs.stderr +++ b/src/test/ui/rfc-2093-infer-outlives/self-structs.stderr @@ -1,10 +1,8 @@ error: rustc_outlives --> $DIR/self-structs.rs:4:1 | -LL | / struct Foo<'a, 'b, T> { -LL | | field1: dyn Bar<'a, 'b, T> -LL | | } - | |_^ +LL | struct Foo<'a, 'b, T> { + | ^^^^^^^^^^^^^^^^^^^^^ | = note: T: 'a diff --git a/src/test/ui/simd/type-len.stderr b/src/test/ui/simd/type-len.stderr index f122d8bb0dc..2a6bd1b0fd5 100644 --- a/src/test/ui/simd/type-len.stderr +++ b/src/test/ui/simd/type-len.stderr @@ -2,37 +2,37 @@ error[E0075]: SIMD vector cannot be empty --> $DIR/type-len.rs:6:1 | LL | struct empty; - | ^^^^^^^^^^^^^ + | ^^^^^^^^^^^^ error[E0075]: SIMD vector cannot be empty --> $DIR/type-len.rs:9:1 | LL | struct empty2([f32; 0]); - | ^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^ error[E0076]: SIMD vector should be homogeneous --> $DIR/type-len.rs:15:1 | LL | struct i64f64(i64, f64); - | ^^^^^^^^^^^^^^^^^^^^^^^^ SIMD elements must have the same type + | ^^^^^^^^^^^^^ SIMD elements must have the same type error[E0077]: SIMD vector element type should be a primitive scalar (integer/float/pointer) type --> $DIR/type-len.rs:20:1 | LL | struct FooV(Foo, Foo); - | ^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^ error[E0077]: SIMD vector element type should be a primitive scalar (integer/float/pointer) type --> $DIR/type-len.rs:23:1 | LL | struct FooV2([Foo; 2]); - | ^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^ error[E0075]: SIMD vector cannot have more than 32768 elements --> $DIR/type-len.rs:26:1 | LL | struct TooBig([f32; 65536]); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^ error: aborting due to 6 previous errors diff --git a/src/test/ui/span/drop-location-span-error-rust-2021-incompatible-closure-captures-93117.rs b/src/test/ui/span/drop-location-span-error-rust-2021-incompatible-closure-captures-93117.rs new file mode 100644 index 00000000000..b280c8ab6e2 --- /dev/null +++ b/src/test/ui/span/drop-location-span-error-rust-2021-incompatible-closure-captures-93117.rs @@ -0,0 +1,18 @@ +// compile-flags: -Wrust-2021-incompatible-closure-captures + +pub struct A {} + +impl A { + async fn create(path: impl AsRef<std::path::Path>) { //~ ERROR `async fn` is not permitted in Rust 2015 + //~^ WARN changes to closure capture in Rust 2021 will affect drop order [rust_2021_incompatible_closure_captures] + ; + crate(move || {} ).await //~ ERROR expected function, found module `crate` + } +} + +trait C{async fn new(val: T) {} //~ ERROR `async fn` is not permitted in Rust 2015 +//~^ ERROR functions in traits cannot be declared `async` +//~^^ ERROR cannot find type `T` in this scope +//~^^^ WARN changes to closure capture in Rust 2021 will affect drop order [rust_2021_incompatible_closure_captures] + +//~ ERROR this file contains an unclosed delimiter diff --git a/src/test/ui/span/drop-location-span-error-rust-2021-incompatible-closure-captures-93117.stderr b/src/test/ui/span/drop-location-span-error-rust-2021-incompatible-closure-captures-93117.stderr new file mode 100644 index 00000000000..50de2322907 --- /dev/null +++ b/src/test/ui/span/drop-location-span-error-rust-2021-incompatible-closure-captures-93117.stderr @@ -0,0 +1,93 @@ +error: this file contains an unclosed delimiter + --> $DIR/drop-location-span-error-rust-2021-incompatible-closure-captures-93117.rs:18:53 + | +LL | trait C{async fn new(val: T) {} + | - unclosed delimiter +... +LL | + | ^ + +error[E0670]: `async fn` is not permitted in Rust 2015 + --> $DIR/drop-location-span-error-rust-2021-incompatible-closure-captures-93117.rs:6:5 + | +LL | async fn create(path: impl AsRef<std::path::Path>) { + | ^^^^^ to use `async fn`, switch to Rust 2018 or later + | + = help: pass `--edition 2021` to `rustc` + = note: for more on editions, read https://doc.rust-lang.org/edition-guide + +error[E0670]: `async fn` is not permitted in Rust 2015 + --> $DIR/drop-location-span-error-rust-2021-incompatible-closure-captures-93117.rs:13:9 + | +LL | trait C{async fn new(val: T) {} + | ^^^^^ to use `async fn`, switch to Rust 2018 or later + | + = help: pass `--edition 2021` to `rustc` + = note: for more on editions, read https://doc.rust-lang.org/edition-guide + +error[E0706]: functions in traits cannot be declared `async` + --> $DIR/drop-location-span-error-rust-2021-incompatible-closure-captures-93117.rs:13:9 + | +LL | trait C{async fn new(val: T) {} + | -----^^^^^^^^^^^^^^^^^^ + | | + | `async` because of this + | + = note: `async` trait functions are not currently supported + = note: consider using the `async-trait` crate: https://crates.io/crates/async-trait + +error[E0423]: expected function, found module `crate` + --> $DIR/drop-location-span-error-rust-2021-incompatible-closure-captures-93117.rs:9:5 + | +LL | crate(move || {} ).await + | ^^^^^ not a function + +error[E0412]: cannot find type `T` in this scope + --> $DIR/drop-location-span-error-rust-2021-incompatible-closure-captures-93117.rs:13:27 + | +LL | pub struct A {} + | ------------ similarly named struct `A` defined here +... +LL | trait C{async fn new(val: T) {} + | ^ help: a struct with a similar name exists: `A` + +warning: changes to closure capture in Rust 2021 will affect drop order + --> $DIR/drop-location-span-error-rust-2021-incompatible-closure-captures-93117.rs:6:57 + | +LL | async fn create(path: impl AsRef<std::path::Path>) { + | _____________________----_____________________________-__^ + | | | | + | | | in Rust 2018, `path` is dropped here along with the closure, but in Rust 2021 `path` is not part of the closure + | | in Rust 2018, this causes the closure to capture `path`, but in Rust 2021, it has no effect +LL | | +LL | | ; +LL | | crate(move || {} ).await +LL | | } + | |_____^ + | + = note: requested on the command line with `-W rust-2021-incompatible-closure-captures` + = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/disjoint-capture-in-closures.html> +help: add a dummy let to cause `path` to be fully captured + | +LL | async fn create(path: impl AsRef<std::path::Path>) { let _ = &path; + | ++++++++++++++ + +warning: changes to closure capture in Rust 2021 will affect drop order + --> $DIR/drop-location-span-error-rust-2021-incompatible-closure-captures-93117.rs:13:30 + | +LL | trait C{async fn new(val: T) {} + | --- - ^^ + | | | + | | in Rust 2018, `val` is dropped here along with the closure, but in Rust 2021 `val` is not part of the closure + | in Rust 2018, this causes the closure to capture `val`, but in Rust 2021, it has no effect + | + = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/disjoint-capture-in-closures.html> +help: add a dummy let to cause `val` to be fully captured + | +LL | trait C{async fn new(val: T) { let _ = &val;} + | +++++++++++++ + +error: aborting due to 6 previous errors; 2 warnings emitted + +Some errors have detailed explanations: E0412, E0423, E0670, E0706. +For more information about an error, try `rustc --explain E0412`. diff --git a/src/test/ui/span/drop-location-span-error-rust-2021-incompatible-closure-captures-96258.rs b/src/test/ui/span/drop-location-span-error-rust-2021-incompatible-closure-captures-96258.rs new file mode 100644 index 00000000000..a776e508907 --- /dev/null +++ b/src/test/ui/span/drop-location-span-error-rust-2021-incompatible-closure-captures-96258.rs @@ -0,0 +1,15 @@ +// compile-flags -Wrust-2021-incompatible-closure-captures + +fn main() {} + +pub(crate) struct Numberer {} + +impl Numberer { + pub(crate) async fn new( + //~^ ERROR `async fn` is not permitted in Rust 2015 + interval: Duration, + //~^ ERROR cannot find type `Duration` in this scope + ) -> Numberer { + Numberer {} + } +} diff --git a/src/test/ui/span/drop-location-span-error-rust-2021-incompatible-closure-captures-96258.stderr b/src/test/ui/span/drop-location-span-error-rust-2021-incompatible-closure-captures-96258.stderr new file mode 100644 index 00000000000..37b2f413860 --- /dev/null +++ b/src/test/ui/span/drop-location-span-error-rust-2021-incompatible-closure-captures-96258.stderr @@ -0,0 +1,24 @@ +error[E0670]: `async fn` is not permitted in Rust 2015 + --> $DIR/drop-location-span-error-rust-2021-incompatible-closure-captures-96258.rs:8:16 + | +LL | pub(crate) async fn new( + | ^^^^^ to use `async fn`, switch to Rust 2018 or later + | + = help: pass `--edition 2021` to `rustc` + = note: for more on editions, read https://doc.rust-lang.org/edition-guide + +error[E0412]: cannot find type `Duration` in this scope + --> $DIR/drop-location-span-error-rust-2021-incompatible-closure-captures-96258.rs:10:19 + | +LL | interval: Duration, + | ^^^^^^^^ not found in this scope + | +help: consider importing this struct + | +LL | use std::time::Duration; + | + +error: aborting due to 2 previous errors + +Some errors have detailed explanations: E0412, E0670. +For more information about an error, try `rustc --explain E0412`. diff --git a/src/test/ui/span/impl-wrong-item-for-trait.stderr b/src/test/ui/span/impl-wrong-item-for-trait.stderr index 82ef13f3362..f919092f9ee 100644 --- a/src/test/ui/span/impl-wrong-item-for-trait.stderr +++ b/src/test/ui/span/impl-wrong-item-for-trait.stderr @@ -38,7 +38,7 @@ error[E0046]: not all trait items implemented, missing: `MY_CONST` --> $DIR/impl-wrong-item-for-trait.rs:19:1 | LL | const MY_CONST: u32; - | -------------------- `MY_CONST` from trait + | ------------------- `MY_CONST` from trait ... LL | impl Foo for FooMethodForConst { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `MY_CONST` in implementation diff --git a/src/test/ui/span/issue-34264.stderr b/src/test/ui/span/issue-34264.stderr index 68da9f0dc88..e676d7372e8 100644 --- a/src/test/ui/span/issue-34264.stderr +++ b/src/test/ui/span/issue-34264.stderr @@ -54,7 +54,7 @@ error[E0061]: this function takes 2 arguments but 3 arguments were supplied --> $DIR/issue-34264.rs:7:5 | LL | foo(Some(42), 2, ""); - | ^^^ -- argument unexpected + | ^^^ -- argument of type `&'static str` unexpected | note: function defined here --> $DIR/issue-34264.rs:1:4 @@ -84,7 +84,7 @@ error[E0061]: this function takes 2 arguments but 3 arguments were supplied --> $DIR/issue-34264.rs:10:5 | LL | bar(1, 2, 3); - | ^^^ - argument unexpected + | ^^^ - argument of type `{integer}` unexpected | note: function defined here --> $DIR/issue-34264.rs:3:4 diff --git a/src/test/ui/span/issue-39018.stderr b/src/test/ui/span/issue-39018.stderr index e0cfe04cf41..eea94643e0a 100644 --- a/src/test/ui/span/issue-39018.stderr +++ b/src/test/ui/span/issue-39018.stderr @@ -29,14 +29,8 @@ LL | enum World { note: the following trait must be implemented --> $SRC_DIR/core/src/ops/arith.rs:LL:COL | -LL | / pub trait Add<Rhs = Self> { -LL | | /// The resulting type after applying the `+` operator. -LL | | #[stable(feature = "rust1", since = "1.0.0")] -LL | | type Output; -... | -LL | | fn add(self, rhs: Rhs) -> Self::Output; -LL | | } - | |_^ +LL | pub trait Add<Rhs = Self> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0369]: cannot add `String` to `&str` --> $DIR/issue-39018.rs:11:22 diff --git a/src/test/ui/span/issue-42234-unknown-receiver-type.full.stderr b/src/test/ui/span/issue-42234-unknown-receiver-type.full.stderr index cd3ffdc6f9d..2b178990850 100644 --- a/src/test/ui/span/issue-42234-unknown-receiver-type.full.stderr +++ b/src/test/ui/span/issue-42234-unknown-receiver-type.full.stderr @@ -3,8 +3,9 @@ error[E0282]: type annotations needed | LL | let x: Option<_> = None; | ^^^^ cannot infer type of the type parameter `T` declared on the enum `Option` +LL | x.unwrap().method_that_could_exist_on_some_type(); + | ---------- type must be known at this point | - = note: type must be known at this point help: consider specifying the generic argument | LL | let x: Option<_> = None::<T>; @@ -16,7 +17,6 @@ error[E0282]: type annotations needed LL | .sum::<_>() | ^^^ cannot infer type of the type parameter `S` declared on the associated function `sum` | - = note: type must be known at this point help: consider specifying the generic argument | LL | .sum::<_>() diff --git a/src/test/ui/span/issue-42234-unknown-receiver-type.generic_arg.stderr b/src/test/ui/span/issue-42234-unknown-receiver-type.generic_arg.stderr index b6a3f07f571..d93d54e878b 100644 --- a/src/test/ui/span/issue-42234-unknown-receiver-type.generic_arg.stderr +++ b/src/test/ui/span/issue-42234-unknown-receiver-type.generic_arg.stderr @@ -3,8 +3,9 @@ error[E0282]: type annotations needed | LL | let x: Option<_> = None; | ^^^^ cannot infer type of the type parameter `T` declared on the enum `Option` +LL | x.unwrap().method_that_could_exist_on_some_type(); + | ---------- type must be known at this point | - = note: type must be known at this point help: consider specifying the generic argument | LL | let x: Option<_> = None::<T>; @@ -16,7 +17,6 @@ error[E0282]: type annotations needed LL | .sum::<_>() | ^^^ cannot infer type of the type parameter `S` declared on the associated function `sum` | - = note: type must be known at this point help: consider specifying the generic argument | LL | .sum::<S>() diff --git a/src/test/ui/span/macro-span-replacement.stderr b/src/test/ui/span/macro-span-replacement.stderr index 433d02dcbe7..5dd56342889 100644 --- a/src/test/ui/span/macro-span-replacement.stderr +++ b/src/test/ui/span/macro-span-replacement.stderr @@ -1,8 +1,8 @@ warning: struct `S` is never constructed - --> $DIR/macro-span-replacement.rs:7:14 + --> $DIR/macro-span-replacement.rs:7:12 | LL | $b $a; - | ^ + | ^^ ... LL | m!(S struct); | ------------ in this macro invocation diff --git a/src/test/ui/span/method-and-field-eager-resolution.stderr b/src/test/ui/span/method-and-field-eager-resolution.stderr index 2dd650f38ce..7d240589a3f 100644 --- a/src/test/ui/span/method-and-field-eager-resolution.stderr +++ b/src/test/ui/span/method-and-field-eager-resolution.stderr @@ -3,8 +3,10 @@ error[E0282]: type annotations needed | LL | let mut x = Default::default(); | ^^^^^ +LL | +LL | x.0; + | - type must be known at this point | - = note: type must be known at this point help: consider giving `x` an explicit type | LL | let mut x: _ = Default::default(); @@ -15,8 +17,10 @@ error[E0282]: type annotations needed | LL | let mut x = Default::default(); | ^^^^^ +LL | +LL | x[0]; + | - type must be known at this point | - = note: type must be known at this point help: consider giving `x` an explicit type | LL | let mut x: _ = Default::default(); diff --git a/src/test/ui/span/multiline-span-E0072.stderr b/src/test/ui/span/multiline-span-E0072.stderr index acfc60b51f3..79b13f45fd8 100644 --- a/src/test/ui/span/multiline-span-E0072.stderr +++ b/src/test/ui/span/multiline-span-E0072.stderr @@ -3,12 +3,10 @@ error[E0072]: recursive type `ListNode` has infinite size | LL | / struct LL | | ListNode -LL | | { -LL | | head: u8, -LL | | tail: Option<ListNode>, - | | ---------------- recursive without indirection -LL | | } - | |_^ recursive type has infinite size + | |________^ recursive type has infinite size +... +LL | tail: Option<ListNode>, + | ---------------- recursive without indirection | help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to make `ListNode` representable | diff --git a/src/test/ui/span/transitive-dep-span.stderr b/src/test/ui/span/transitive-dep-span.stderr index 2b3dfc5c135..4dc3e572116 100644 --- a/src/test/ui/span/transitive-dep-span.stderr +++ b/src/test/ui/span/transitive-dep-span.stderr @@ -1,19 +1,18 @@ error: expected one of `!` or `::`, found `error` --> $DIR/auxiliary/transitive_dep_three.rs:6:27 | -LL | / macro_rules! parse_error { -LL | | () => { parse error } - | | ^^^^^ expected one of `!` or `::` -LL | | } - | |_________- in this expansion of `transitive_dep_two::parse_error!` +LL | macro_rules! parse_error { + | ------------------------ in this expansion of `transitive_dep_two::parse_error!` +LL | () => { parse error } + | ^^^^^ expected one of `!` or `::` | ::: $DIR/transitive-dep-span.rs:13:1 | -LL | transitive_dep_two::parse_error!(); - | ---------------------------------- - | | - | in this macro invocation - | in this macro invocation +LL | transitive_dep_two::parse_error!(); + | ---------------------------------- + | | + | in this macro invocation + | in this macro invocation error: aborting due to previous error diff --git a/src/test/ui/span/type-annotations-needed-expr.stderr b/src/test/ui/span/type-annotations-needed-expr.stderr index e4a8f746462..9dff6c64db4 100644 --- a/src/test/ui/span/type-annotations-needed-expr.stderr +++ b/src/test/ui/span/type-annotations-needed-expr.stderr @@ -4,7 +4,6 @@ error[E0282]: type annotations needed LL | let _ = (vec![1,2,3]).into_iter().sum() as f64; | ^^^ cannot infer type of the type parameter `S` declared on the associated function `sum` | - = note: type must be known at this point help: consider specifying the generic argument | LL | let _ = (vec![1,2,3]).into_iter().sum::<S>() as f64; diff --git a/src/test/ui/specialization/defaultimpl/specialization-no-default.stderr b/src/test/ui/specialization/defaultimpl/specialization-no-default.stderr index 3f1a5495e21..360b7bc787a 100644 --- a/src/test/ui/specialization/defaultimpl/specialization-no-default.stderr +++ b/src/test/ui/specialization/defaultimpl/specialization-no-default.stderr @@ -11,67 +11,55 @@ LL | #![feature(specialization)] error[E0520]: `foo` specializes an item from a parent `impl`, but that item is not marked `default` --> $DIR/specialization-no-default.rs:20:5 | -LL | / impl<T> Foo for T { -LL | | fn foo(&self) {} -LL | | fn bar(&self) {} -LL | | } - | |_- parent `impl` is here +LL | impl<T> Foo for T { + | ----------------- parent `impl` is here ... -LL | fn foo(&self) {} - | ^^^^^^^^^^^^^^^^ cannot specialize default item `foo` +LL | fn foo(&self) {} + | ^^^^^^^^^^^^^^^^ cannot specialize default item `foo` | = note: to specialize, `foo` in the parent `impl` must be marked `default` error[E0520]: `bar` specializes an item from a parent `impl`, but that item is not marked `default` --> $DIR/specialization-no-default.rs:23:5 | -LL | / impl<T> Foo for T { -LL | | fn foo(&self) {} -LL | | fn bar(&self) {} -LL | | } - | |_- parent `impl` is here +LL | impl<T> Foo for T { + | ----------------- parent `impl` is here ... -LL | fn bar(&self) {} - | ^^^^^^^^^^^^^^^^ cannot specialize default item `bar` +LL | fn bar(&self) {} + | ^^^^^^^^^^^^^^^^ cannot specialize default item `bar` | = note: to specialize, `bar` in the parent `impl` must be marked `default` error[E0520]: `T` specializes an item from a parent `impl`, but that item is not marked `default` --> $DIR/specialization-no-default.rs:37:5 | -LL | / impl<T> Bar for T { -LL | | type T = u8; -LL | | } - | |_- parent `impl` is here +LL | impl<T> Bar for T { + | ----------------- parent `impl` is here ... -LL | type T = (); - | ^^^^^^^^^^^^ cannot specialize default item `T` +LL | type T = (); + | ^^^^^^^^^^^^ cannot specialize default item `T` | = note: to specialize, `T` in the parent `impl` must be marked `default` error[E0520]: `baz` specializes an item from a parent `impl`, but that item is not marked `default` --> $DIR/specialization-no-default.rs:55:5 | -LL | / impl<T: Clone> Baz for T { -LL | | fn baz(&self) {} -LL | | } - | |_- parent `impl` is here +LL | impl<T: Clone> Baz for T { + | ------------------------ parent `impl` is here ... -LL | fn baz(&self) {} - | ^^^^^^^^^^^^^^^^ cannot specialize default item `baz` +LL | fn baz(&self) {} + | ^^^^^^^^^^^^^^^^ cannot specialize default item `baz` | = note: to specialize, `baz` in the parent `impl` must be marked `default` error[E0520]: `redundant` specializes an item from a parent `impl`, but that item is not marked `default` --> $DIR/specialization-no-default.rs:74:5 | -LL | / impl<T: Clone> Redundant for T { -LL | | fn redundant(&self) {} -LL | | } - | |_- parent `impl` is here +LL | impl<T: Clone> Redundant for T { + | ------------------------------ parent `impl` is here ... -LL | fn redundant(&self) {} - | ^^^^^^^^^^^^^^^^^^^^^^ cannot specialize default item `redundant` +LL | fn redundant(&self) {} + | ^^^^^^^^^^^^^^^^^^^^^^ cannot specialize default item `redundant` | = note: to specialize, `redundant` in the parent `impl` must be marked `default` diff --git a/src/test/ui/specialization/defaultimpl/specialization-trait-not-implemented.stderr b/src/test/ui/specialization/defaultimpl/specialization-trait-not-implemented.stderr index d2350bc7e4f..53a22305e81 100644 --- a/src/test/ui/specialization/defaultimpl/specialization-trait-not-implemented.stderr +++ b/src/test/ui/specialization/defaultimpl/specialization-trait-not-implemented.stderr @@ -12,7 +12,7 @@ error[E0599]: the method `foo_one` exists for struct `MyStruct`, but its trait b --> $DIR/specialization-trait-not-implemented.rs:22:29 | LL | struct MyStruct; - | ---------------- + | --------------- | | | | | method `foo_one` not found for this struct | doesn't satisfy `MyStruct: Foo` @@ -21,18 +21,17 @@ LL | println!("{}", MyStruct.foo_one()); | ^^^^^^^ method cannot be called on `MyStruct` due to unsatisfied trait bounds | note: trait bound `MyStruct: Foo` was not satisfied - --> $DIR/specialization-trait-not-implemented.rs:14:17 + --> $DIR/specialization-trait-not-implemented.rs:14:1 | LL | default impl<T> Foo for T { - | ^^^ ^ + | ^^^^^^^^^^^^^^^^---^^^^^- + | | + | unsatisfied trait bound introduced here note: the following trait must be implemented --> $DIR/specialization-trait-not-implemented.rs:7:1 | -LL | / trait Foo { -LL | | fn foo_one(&self) -> &'static str; -LL | | fn foo_two(&self) -> &'static str; -LL | | } - | |_^ +LL | trait Foo { + | ^^^^^^^^^ = help: items from traits can only be used if the trait is implemented and in scope note: `Foo` defines an item `foo_one`, perhaps you need to implement it --> $DIR/specialization-trait-not-implemented.rs:7:1 diff --git a/src/test/ui/specialization/issue-50452-fail.stderr b/src/test/ui/specialization/issue-50452-fail.stderr index 8e7c5037eff..7249ad73871 100644 --- a/src/test/ui/specialization/issue-50452-fail.stderr +++ b/src/test/ui/specialization/issue-50452-fail.stderr @@ -11,13 +11,11 @@ LL | #![feature(specialization)] error[E0520]: `foo` specializes an item from a parent `impl`, but that item is not marked `default` --> $DIR/issue-50452-fail.rs:10:5 | -LL | fn foo() {} - | ^^^^^^^^^^^ cannot specialize default item `foo` +LL | fn foo() {} + | ^^^^^^^^^^^ cannot specialize default item `foo` ... -LL | / impl<T> Foo for T { -LL | | fn foo() {} -LL | | } - | |_- parent `impl` is here +LL | impl<T> Foo for T { + | ----------------- parent `impl` is here | = note: to specialize, `foo` in the parent `impl` must be marked `default` diff --git a/src/test/ui/specialization/issue-52050.stderr b/src/test/ui/specialization/issue-52050.stderr index 8732b10d8f8..6d24997a5bf 100644 --- a/src/test/ui/specialization/issue-52050.stderr +++ b/src/test/ui/specialization/issue-52050.stderr @@ -11,15 +11,11 @@ LL | #![feature(specialization)] error[E0119]: conflicting implementations of trait `IntoPyDictPointer` for type `()` --> $DIR/issue-52050.rs:28:1 | -LL | / impl<I> IntoPyDictPointer for I -LL | | where -LL | | I: Iterator, -LL | | { -LL | | } - | |_- first implementation here -LL | -LL | impl IntoPyDictPointer for () - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `()` +LL | impl<I> IntoPyDictPointer for I + | ------------------------------- first implementation here +... +LL | impl IntoPyDictPointer for () + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `()` | = note: upstream crates may add a new impl of trait `std::iter::Iterator` for type `()` in future versions diff --git a/src/test/ui/specialization/min_specialization/dyn-trait-assoc-types.stderr b/src/test/ui/specialization/min_specialization/dyn-trait-assoc-types.stderr index 6345cee2c37..db5558f16be 100644 --- a/src/test/ui/specialization/min_specialization/dyn-trait-assoc-types.stderr +++ b/src/test/ui/specialization/min_specialization/dyn-trait-assoc-types.stderr @@ -1,20 +1,14 @@ error: specializing impl repeats parameter `T` --> $DIR/dyn-trait-assoc-types.rs:22:1 | -LL | / impl<'a, T> Specializable for dyn B<T, Y = T> + 'a { -LL | | -LL | | fn f() {} -LL | | } - | |_^ +LL | impl<'a, T> Specializable for dyn B<T, Y = T> + 'a { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: specializing impl repeats parameter `T` --> $DIR/dyn-trait-assoc-types.rs:27:1 | -LL | / impl<'a, T> Specializable for dyn C<Y = (T, T)> + 'a { -LL | | -LL | | fn f() {} -LL | | } - | |_^ +LL | impl<'a, T> Specializable for dyn C<Y = (T, T)> + 'a { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/specialization/min_specialization/issue-79224.rs b/src/test/ui/specialization/min_specialization/issue-79224.rs new file mode 100644 index 00000000000..408732fe944 --- /dev/null +++ b/src/test/ui/specialization/min_specialization/issue-79224.rs @@ -0,0 +1,24 @@ +#![feature(min_specialization)] +use std::fmt::{self, Display}; + +pub enum Cow<'a, B: ?Sized + 'a, O = <B as ToOwned>::Owned> +where + B: ToOwned, +{ + Borrowed(&'a B), + Owned(O), +} + +impl ToString for Cow<'_, str> { + fn to_string(&self) -> String { + String::new() + } +} + +impl<B: ?Sized> Display for Cow<'_, B> { //~ ERROR: the trait bound `B: Clone` is not satisfied [E0277] + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { //~ ERROR: the trait bound `B: Clone` is not satisfied [E0277] + write!(f, "foo") + } +} + +fn main() {} diff --git a/src/test/ui/specialization/min_specialization/issue-79224.stderr b/src/test/ui/specialization/min_specialization/issue-79224.stderr new file mode 100644 index 00000000000..44c6ec1426b --- /dev/null +++ b/src/test/ui/specialization/min_specialization/issue-79224.stderr @@ -0,0 +1,29 @@ +error[E0277]: the trait bound `B: Clone` is not satisfied + --> $DIR/issue-79224.rs:18:17 + | +LL | impl<B: ?Sized> Display for Cow<'_, B> { + | ^^^^^^^ the trait `Clone` is not implemented for `B` + | + = note: required because of the requirements on the impl of `ToOwned` for `B` +help: consider further restricting this bound + | +LL | impl<B: ?Sized + std::clone::Clone> Display for Cow<'_, B> { + | +++++++++++++++++++ + +error[E0277]: the trait bound `B: Clone` is not satisfied + --> $DIR/issue-79224.rs:19:5 + | +LL | / fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { +LL | | write!(f, "foo") +LL | | } + | |_____^ the trait `Clone` is not implemented for `B` + | + = note: required because of the requirements on the impl of `ToOwned` for `B` +help: consider further restricting this bound + | +LL | impl<B: ?Sized + std::clone::Clone> Display for Cow<'_, B> { + | +++++++++++++++++++ + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/specialization/min_specialization/repeated_projection_type.stderr b/src/test/ui/specialization/min_specialization/repeated_projection_type.stderr index 1a7eb82c95b..450984aacc7 100644 --- a/src/test/ui/specialization/min_specialization/repeated_projection_type.stderr +++ b/src/test/ui/specialization/min_specialization/repeated_projection_type.stderr @@ -1,11 +1,8 @@ error: cannot specialize on `Binder(ProjectionPredicate(ProjectionTy { substs: [V], item_def_id: DefId(0:6 ~ repeated_projection_type[54ea]::Id::This) }, Ty((I,))), [])` --> $DIR/repeated_projection_type.rs:19:1 | -LL | / impl<I, V: Id<This = (I,)>> X for V { -LL | | -LL | | fn f() {} -LL | | } - | |_^ +LL | impl<I, V: Id<This = (I,)>> X for V { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/specialization/min_specialization/repeating_lifetimes.stderr b/src/test/ui/specialization/min_specialization/repeating_lifetimes.stderr index ce9309f7012..16dccb10b45 100644 --- a/src/test/ui/specialization/min_specialization/repeating_lifetimes.stderr +++ b/src/test/ui/specialization/min_specialization/repeating_lifetimes.stderr @@ -1,11 +1,8 @@ error: specializing impl repeats parameter `'a` --> $DIR/repeating_lifetimes.rs:14:1 | -LL | / impl<'a> X for (&'a u8, &'a u8) { -LL | | -LL | | fn f() {} -LL | | } - | |_^ +LL | impl<'a> X for (&'a u8, &'a u8) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/specialization/min_specialization/repeating_param.stderr b/src/test/ui/specialization/min_specialization/repeating_param.stderr index 8b4be1c4995..5e6adf723b5 100644 --- a/src/test/ui/specialization/min_specialization/repeating_param.stderr +++ b/src/test/ui/specialization/min_specialization/repeating_param.stderr @@ -1,11 +1,8 @@ error: specializing impl repeats parameter `T` --> $DIR/repeating_param.rs:12:1 | -LL | / impl<T> X for (T, T) { -LL | | -LL | | fn f() {} -LL | | } - | |_^ +LL | impl<T> X for (T, T) { + | ^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/specialization/min_specialization/spec-marker-supertraits.stderr b/src/test/ui/specialization/min_specialization/spec-marker-supertraits.stderr index 964109dd10f..b1ab58551e6 100644 --- a/src/test/ui/specialization/min_specialization/spec-marker-supertraits.stderr +++ b/src/test/ui/specialization/min_specialization/spec-marker-supertraits.stderr @@ -1,13 +1,8 @@ error: cannot specialize on trait `HasMethod` --> $DIR/spec-marker-supertraits.rs:22:1 | -LL | / impl<T: Marker> Spec for T { -LL | | -LL | | fn spec_me(&self) { -LL | | self.method(); -LL | | } -LL | | } - | |_^ +LL | impl<T: Marker> Spec for T { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/specialization/min_specialization/specialization_marker.stderr b/src/test/ui/specialization/min_specialization/specialization_marker.stderr index ffeced19821..b47c14f3c9f 100644 --- a/src/test/ui/specialization/min_specialization/specialization_marker.stderr +++ b/src/test/ui/specialization/min_specialization/specialization_marker.stderr @@ -8,7 +8,7 @@ error[E0714]: marker traits cannot have associated items --> $DIR/specialization_marker.rs:13:5 | LL | type X; - | ^^^^^^^ + | ^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/specialization/min_specialization/specialization_super_trait.stderr b/src/test/ui/specialization/min_specialization/specialization_super_trait.stderr index 5782ad01b39..1f2ff99d415 100644 --- a/src/test/ui/specialization/min_specialization/specialization_super_trait.stderr +++ b/src/test/ui/specialization/min_specialization/specialization_super_trait.stderr @@ -1,11 +1,8 @@ error: cannot specialize on trait `Default` --> $DIR/specialization_super_trait.rs:13:1 | -LL | / impl<T: Default> SpecMarker for T { -LL | | -LL | | fn f() {} -LL | | } - | |_^ +LL | impl<T: Default> SpecMarker for T { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/specialization/min_specialization/specialization_trait.stderr b/src/test/ui/specialization/min_specialization/specialization_trait.stderr index 8a70d6cc1bf..ecb07ba908e 100644 --- a/src/test/ui/specialization/min_specialization/specialization_trait.stderr +++ b/src/test/ui/specialization/min_specialization/specialization_trait.stderr @@ -1,29 +1,20 @@ error: cannot specialize on `'static` lifetime --> $DIR/specialization_trait.rs:11:1 | -LL | / impl SpecMarker for &'static u8 { -LL | | -LL | | fn f() {} -LL | | } - | |_^ +LL | impl SpecMarker for &'static u8 { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: specializing impl repeats parameter `T` --> $DIR/specialization_trait.rs:16:1 | -LL | / impl<T> SpecMarker for (T, T) { -LL | | -LL | | fn f() {} -LL | | } - | |_^ +LL | impl<T> SpecMarker for (T, T) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: cannot specialize on trait `Clone` --> $DIR/specialization_trait.rs:21:1 | -LL | / impl<T: Clone> SpecMarker for [T] { -LL | | -LL | | fn f() {} -LL | | } - | |_^ +LL | impl<T: Clone> SpecMarker for [T] { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 3 previous errors diff --git a/src/test/ui/specialization/min_specialization/specialize_on_static.stderr b/src/test/ui/specialization/min_specialization/specialize_on_static.stderr index d1809d6dfbb..9a16798f15c 100644 --- a/src/test/ui/specialization/min_specialization/specialize_on_static.stderr +++ b/src/test/ui/specialization/min_specialization/specialize_on_static.stderr @@ -1,11 +1,8 @@ error: cannot specialize on `'static` lifetime --> $DIR/specialize_on_static.rs:13:1 | -LL | / impl X for &'static u8 { -LL | | -LL | | fn f() {} -LL | | } - | |_^ +LL | impl X for &'static u8 { + | ^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/specialization/min_specialization/specialize_on_trait.stderr b/src/test/ui/specialization/min_specialization/specialize_on_trait.stderr index 35445fd09b9..92daddbd800 100644 --- a/src/test/ui/specialization/min_specialization/specialize_on_trait.stderr +++ b/src/test/ui/specialization/min_specialization/specialize_on_trait.stderr @@ -1,11 +1,8 @@ error: cannot specialize on trait `SpecMarker` --> $DIR/specialize_on_trait.rs:15:1 | -LL | / impl<T: SpecMarker> X for T { -LL | | -LL | | fn f() {} -LL | | } - | |_^ +LL | impl<T: SpecMarker> X for T { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/specialization/non-defaulted-item-fail.stderr b/src/test/ui/specialization/non-defaulted-item-fail.stderr index 85ccbd809b0..8b7d6797275 100644 --- a/src/test/ui/specialization/non-defaulted-item-fail.stderr +++ b/src/test/ui/specialization/non-defaulted-item-fail.stderr @@ -11,45 +11,33 @@ LL | #![feature(specialization, associated_type_defaults)] error[E0520]: `Ty` specializes an item from a parent `impl`, but that item is not marked `default` --> $DIR/non-defaulted-item-fail.rs:30:5 | -LL | / impl<T> Foo for Box<T> { -LL | | type Ty = bool; -LL | | const CONST: u8 = 0; -LL | | fn foo(&self) -> bool { false } -LL | | } - | |_- parent `impl` is here +LL | impl<T> Foo for Box<T> { + | ---------------------- parent `impl` is here ... -LL | type Ty = Vec<()>; - | ^^^^^^^^^^^^^^^^^^ cannot specialize default item `Ty` +LL | type Ty = Vec<()>; + | ^^^^^^^^^^^^^^^^^^ cannot specialize default item `Ty` | = note: to specialize, `Ty` in the parent `impl` must be marked `default` error[E0520]: `CONST` specializes an item from a parent `impl`, but that item is not marked `default` --> $DIR/non-defaulted-item-fail.rs:32:5 | -LL | / impl<T> Foo for Box<T> { -LL | | type Ty = bool; -LL | | const CONST: u8 = 0; -LL | | fn foo(&self) -> bool { false } -LL | | } - | |_- parent `impl` is here +LL | impl<T> Foo for Box<T> { + | ---------------------- parent `impl` is here ... -LL | const CONST: u8 = 42; - | ^^^^^^^^^^^^^^^^^^^^^ cannot specialize default item `CONST` +LL | const CONST: u8 = 42; + | ^^^^^^^^^^^^^^^^^^^^^ cannot specialize default item `CONST` | = note: to specialize, `CONST` in the parent `impl` must be marked `default` error[E0520]: `foo` specializes an item from a parent `impl`, but that item is not marked `default` --> $DIR/non-defaulted-item-fail.rs:34:5 | -LL | / impl<T> Foo for Box<T> { -LL | | type Ty = bool; -LL | | const CONST: u8 = 0; -LL | | fn foo(&self) -> bool { false } -LL | | } - | |_- parent `impl` is here +LL | impl<T> Foo for Box<T> { + | ---------------------- parent `impl` is here ... -LL | fn foo(&self) -> bool { true } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot specialize default item `foo` +LL | fn foo(&self) -> bool { true } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot specialize default item `foo` | = note: to specialize, `foo` in the parent `impl` must be marked `default` @@ -57,7 +45,7 @@ error[E0520]: `Ty` specializes an item from a parent `impl`, but that item is no --> $DIR/non-defaulted-item-fail.rs:46:5 | LL | impl<T> Foo for Vec<T> {} - | ------------------------- parent `impl` is here + | ---------------------- parent `impl` is here ... LL | type Ty = Vec<()>; | ^^^^^^^^^^^^^^^^^^ cannot specialize default item `Ty` @@ -68,7 +56,7 @@ error[E0520]: `CONST` specializes an item from a parent `impl`, but that item is --> $DIR/non-defaulted-item-fail.rs:48:5 | LL | impl<T> Foo for Vec<T> {} - | ------------------------- parent `impl` is here + | ---------------------- parent `impl` is here ... LL | const CONST: u8 = 42; | ^^^^^^^^^^^^^^^^^^^^^ cannot specialize default item `CONST` @@ -79,7 +67,7 @@ error[E0520]: `foo` specializes an item from a parent `impl`, but that item is n --> $DIR/non-defaulted-item-fail.rs:50:5 | LL | impl<T> Foo for Vec<T> {} - | ------------------------- parent `impl` is here + | ---------------------- parent `impl` is here ... LL | fn foo(&self) -> bool { true } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot specialize default item `foo` diff --git a/src/test/ui/specialization/specialization-no-default.stderr b/src/test/ui/specialization/specialization-no-default.stderr index 711c1fda149..28c869a7055 100644 --- a/src/test/ui/specialization/specialization-no-default.stderr +++ b/src/test/ui/specialization/specialization-no-default.stderr @@ -11,67 +11,55 @@ LL | #![feature(specialization)] error[E0520]: `foo` specializes an item from a parent `impl`, but that item is not marked `default` --> $DIR/specialization-no-default.rs:20:5 | -LL | / impl<T> Foo for T { -LL | | fn foo(&self) {} -LL | | fn bar(&self) {} -LL | | } - | |_- parent `impl` is here +LL | impl<T> Foo for T { + | ----------------- parent `impl` is here ... -LL | fn foo(&self) {} - | ^^^^^^^^^^^^^^^^ cannot specialize default item `foo` +LL | fn foo(&self) {} + | ^^^^^^^^^^^^^^^^ cannot specialize default item `foo` | = note: to specialize, `foo` in the parent `impl` must be marked `default` error[E0520]: `bar` specializes an item from a parent `impl`, but that item is not marked `default` --> $DIR/specialization-no-default.rs:23:5 | -LL | / impl<T> Foo for T { -LL | | fn foo(&self) {} -LL | | fn bar(&self) {} -LL | | } - | |_- parent `impl` is here +LL | impl<T> Foo for T { + | ----------------- parent `impl` is here ... -LL | fn bar(&self) {} - | ^^^^^^^^^^^^^^^^ cannot specialize default item `bar` +LL | fn bar(&self) {} + | ^^^^^^^^^^^^^^^^ cannot specialize default item `bar` | = note: to specialize, `bar` in the parent `impl` must be marked `default` error[E0520]: `T` specializes an item from a parent `impl`, but that item is not marked `default` --> $DIR/specialization-no-default.rs:37:5 | -LL | / impl<T> Bar for T { -LL | | type T = u8; -LL | | } - | |_- parent `impl` is here +LL | impl<T> Bar for T { + | ----------------- parent `impl` is here ... -LL | type T = (); - | ^^^^^^^^^^^^ cannot specialize default item `T` +LL | type T = (); + | ^^^^^^^^^^^^ cannot specialize default item `T` | = note: to specialize, `T` in the parent `impl` must be marked `default` error[E0520]: `baz` specializes an item from a parent `impl`, but that item is not marked `default` --> $DIR/specialization-no-default.rs:55:5 | -LL | / impl<T: Clone> Baz for T { -LL | | fn baz(&self) {} -LL | | } - | |_- parent `impl` is here +LL | impl<T: Clone> Baz for T { + | ------------------------ parent `impl` is here ... -LL | fn baz(&self) {} - | ^^^^^^^^^^^^^^^^ cannot specialize default item `baz` +LL | fn baz(&self) {} + | ^^^^^^^^^^^^^^^^ cannot specialize default item `baz` | = note: to specialize, `baz` in the parent `impl` must be marked `default` error[E0520]: `redundant` specializes an item from a parent `impl`, but that item is not marked `default` --> $DIR/specialization-no-default.rs:74:5 | -LL | / impl<T: Clone> Redundant for T { -LL | | fn redundant(&self) {} -LL | | } - | |_- parent `impl` is here +LL | impl<T: Clone> Redundant for T { + | ------------------------------ parent `impl` is here ... -LL | default fn redundant(&self) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot specialize default item `redundant` +LL | default fn redundant(&self) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot specialize default item `redundant` | = note: to specialize, `redundant` in the parent `impl` must be marked `default` diff --git a/src/test/ui/static/static-priv-by-default2.stderr b/src/test/ui/static/static-priv-by-default2.stderr index d731da79246..b14e096d62a 100644 --- a/src/test/ui/static/static-priv-by-default2.stderr +++ b/src/test/ui/static/static-priv-by-default2.stderr @@ -20,7 +20,7 @@ note: the static `private` is defined here --> $DIR/auxiliary/static_priv_by_default.rs:3:1 | LL | static private: isize = 0; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/statics/uninhabited-static.stderr b/src/test/ui/statics/uninhabited-static.stderr index 855e5dca92a..10b86bb4986 100644 --- a/src/test/ui/statics/uninhabited-static.stderr +++ b/src/test/ui/statics/uninhabited-static.stderr @@ -27,7 +27,7 @@ error: static of uninhabited type --> $DIR/uninhabited-static.rs:12:1 | LL | static VOID2: Void = unsafe { std::mem::transmute(()) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #74840 <https://github.com/rust-lang/rust/issues/74840> @@ -37,7 +37,7 @@ error: static of uninhabited type --> $DIR/uninhabited-static.rs:16:1 | LL | static NEVER2: Void = unsafe { std::mem::transmute(()) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #74840 <https://github.com/rust-lang/rust/issues/74840> diff --git a/src/test/ui/suggestions/adt-param-with-implicit-sized-bound.stderr b/src/test/ui/suggestions/adt-param-with-implicit-sized-bound.stderr index 40b4b42f742..b77c8c7fd5b 100644 --- a/src/test/ui/suggestions/adt-param-with-implicit-sized-bound.stderr +++ b/src/test/ui/suggestions/adt-param-with-implicit-sized-bound.stderr @@ -1,3 +1,29 @@ +error[E0277]: the size for values of type `T` cannot be known at compilation time + --> $DIR/adt-param-with-implicit-sized-bound.rs:25:9 + | +LL | struct Struct5<T: ?Sized>{ + | - this type parameter needs to be `std::marker::Sized` +LL | _t: X<T>, + | ^^^^ doesn't have a size known at compile-time + | +note: required by a bound in `X` + --> $DIR/adt-param-with-implicit-sized-bound.rs:18:10 + | +LL | struct X<T>(T); + | ^ required by this bound in `X` +help: you could relax the implicit `Sized` bound on `T` if it were used through indirection like `&T` or `Box<T>` + --> $DIR/adt-param-with-implicit-sized-bound.rs:18:10 + | +LL | struct X<T>(T); + | ^ - ...if indirection were used here: `Box<T>` + | | + | this could be changed to `T: ?Sized`... +help: consider removing the `?Sized` bound to make the type parameter `Sized` + | +LL - struct Struct5<T: ?Sized>{ +LL + struct Struct5<T>{ + | + error[E0277]: the size for values of type `Self` cannot be known at compilation time --> $DIR/adt-param-with-implicit-sized-bound.rs:2:19 | @@ -81,32 +107,6 @@ help: consider relaxing the implicit `Sized` restriction LL | struct Struct4<T: ?Sized>{ | ++++++++ -error[E0277]: the size for values of type `T` cannot be known at compilation time - --> $DIR/adt-param-with-implicit-sized-bound.rs:25:9 - | -LL | struct Struct5<T: ?Sized>{ - | - this type parameter needs to be `std::marker::Sized` -LL | _t: X<T>, - | ^^^^ doesn't have a size known at compile-time - | -note: required by a bound in `X` - --> $DIR/adt-param-with-implicit-sized-bound.rs:18:10 - | -LL | struct X<T>(T); - | ^ required by this bound in `X` -help: you could relax the implicit `Sized` bound on `T` if it were used through indirection like `&T` or `Box<T>` - --> $DIR/adt-param-with-implicit-sized-bound.rs:18:10 - | -LL | struct X<T>(T); - | ^ - ...if indirection were used here: `Box<T>` - | | - | this could be changed to `T: ?Sized`... -help: consider removing the `?Sized` bound to make the type parameter `Sized` - | -LL - struct Struct5<T: ?Sized>{ -LL + struct Struct5<T>{ - | - error: aborting due to 5 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/suggestions/args-instead-of-tuple-errors.stderr b/src/test/ui/suggestions/args-instead-of-tuple-errors.stderr index 3d367eca707..805c75f464c 100644 --- a/src/test/ui/suggestions/args-instead-of-tuple-errors.stderr +++ b/src/test/ui/suggestions/args-instead-of-tuple-errors.stderr @@ -2,7 +2,7 @@ error[E0061]: this enum variant takes 1 argument but 2 arguments were supplied --> $DIR/args-instead-of-tuple-errors.rs:6:34 | LL | let _: Option<(i32, bool)> = Some(1, 2); - | ^^^^ - - argument unexpected + | ^^^^ - - argument of type `{integer}` unexpected | | | expected tuple, found integer | @@ -22,7 +22,7 @@ error[E0061]: this function takes 1 argument but 2 arguments were supplied --> $DIR/args-instead-of-tuple-errors.rs:8:5 | LL | int_bool(1, 2); - | ^^^^^^^^ - - argument unexpected + | ^^^^^^^^ - - argument of type `{integer}` unexpected | | | expected tuple, found integer | diff --git a/src/test/ui/suggestions/args-instead-of-tuple.stderr b/src/test/ui/suggestions/args-instead-of-tuple.stderr index f6d158782da..2448a514965 100644 --- a/src/test/ui/suggestions/args-instead-of-tuple.stderr +++ b/src/test/ui/suggestions/args-instead-of-tuple.stderr @@ -9,7 +9,7 @@ note: tuple variant defined here | LL | Ok(#[stable(feature = "rust1", since = "1.0.0")] T), | ^^ -help: use parentheses to construct a tuple +help: wrap these arguments in parentheses to construct a tuple | LL | let _: Result<(i32, i8), ()> = Ok((1, 2)); | + + @@ -25,7 +25,7 @@ note: tuple variant defined here | LL | Some(#[stable(feature = "rust1", since = "1.0.0")] T), | ^^^^ -help: use parentheses to construct a tuple +help: wrap these arguments in parentheses to construct a tuple | LL | let _: Option<(i32, i8, &'static str)> = Some((1, 2, "hi")); | + + @@ -97,7 +97,7 @@ note: function defined here | LL | fn two_ints(_: (i32, i32)) { | ^^^^^^^^ ------------- -help: use parentheses to construct a tuple +help: wrap these arguments in parentheses to construct a tuple | LL | two_ints((1, 2)); | + + @@ -113,7 +113,7 @@ note: function defined here | LL | fn with_generic<T: Copy + Send>((a, b): (i32, T)) { | ^^^^^^^^^^^^ ---------------- -help: use parentheses to construct a tuple +help: wrap these arguments in parentheses to construct a tuple | LL | with_generic((3, 4)); | + + @@ -129,7 +129,7 @@ note: function defined here | LL | fn with_generic<T: Copy + Send>((a, b): (i32, T)) { | ^^^^^^^^^^^^ ---------------- -help: use parentheses to construct a tuple +help: wrap these arguments in parentheses to construct a tuple | LL | with_generic((a, b)); | + + diff --git a/src/test/ui/suggestions/attribute-typos.stderr b/src/test/ui/suggestions/attribute-typos.stderr index d6163a5a7cf..54122cb7360 100644 --- a/src/test/ui/suggestions/attribute-typos.stderr +++ b/src/test/ui/suggestions/attribute-typos.stderr @@ -19,7 +19,7 @@ LL | #[tests] ::: $SRC_DIR/core/src/macros/mod.rs:LL:COL | LL | pub macro test($item:item) { - | -------------------------- similarly named attribute macro `test` defined here + | -------------- similarly named attribute macro `test` defined here error: cannot find attribute `deprcated` in this scope --> $DIR/attribute-typos.rs:1:3 diff --git a/src/test/ui/suggestions/auxiliary/not-object-safe.rs b/src/test/ui/suggestions/auxiliary/not-object-safe.rs new file mode 100644 index 00000000000..7c9829b823e --- /dev/null +++ b/src/test/ui/suggestions/auxiliary/not-object-safe.rs @@ -0,0 +1,6 @@ +use std::sync::Arc; + +pub trait A { + fn f(); + fn f2(self: &Arc<Self>); +} diff --git a/src/test/ui/suggestions/const-in-struct-pat.stderr b/src/test/ui/suggestions/const-in-struct-pat.stderr index 784f1bdb6cf..c8b93f3dc48 100644 --- a/src/test/ui/suggestions/const-in-struct-pat.stderr +++ b/src/test/ui/suggestions/const-in-struct-pat.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/const-in-struct-pat.rs:8:17 | LL | struct foo; - | ----------- unit struct defined here + | ---------- unit struct defined here ... LL | let Thing { foo } = t; | ^^^ - this expression has type `Thing` diff --git a/src/test/ui/suggestions/const-pat-non-exaustive-let-new-var.stderr b/src/test/ui/suggestions/const-pat-non-exaustive-let-new-var.stderr index af64c09d5ca..618bcaca14c 100644 --- a/src/test/ui/suggestions/const-pat-non-exaustive-let-new-var.stderr +++ b/src/test/ui/suggestions/const-pat-non-exaustive-let-new-var.stderr @@ -8,7 +8,7 @@ LL | let A = 3; | help: introduce a variable instead: `a_var` ... LL | const A: i32 = 2; - | ----------------- constant defined here + | ------------ constant defined here | = note: the matched value is of type `i32` diff --git a/src/test/ui/suggestions/derive-macro-missing-bounds.stderr b/src/test/ui/suggestions/derive-macro-missing-bounds.stderr index 501d083e2bc..4186dc7cb35 100644 --- a/src/test/ui/suggestions/derive-macro-missing-bounds.stderr +++ b/src/test/ui/suggestions/derive-macro-missing-bounds.stderr @@ -33,7 +33,7 @@ LL | impl<T: Debug + Trait> Debug for Inner<T> { | ^^^^^ ^^^^^^^^ = note: 1 redundant requirement hidden = note: required because of the requirements on the impl of `Debug` for `&c::Inner<T>` - = note: required for the cast to the object type `dyn Debug` + = note: required for the cast from `&c::Inner<T>` to the object type `dyn Debug` = note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider restricting type parameter `T` | @@ -55,7 +55,7 @@ LL | impl<T> Debug for Inner<T> where T: Debug, T: Trait { | ^^^^^ ^^^^^^^^ = note: 1 redundant requirement hidden = note: required because of the requirements on the impl of `Debug` for `&d::Inner<T>` - = note: required for the cast to the object type `dyn Debug` + = note: required for the cast from `&d::Inner<T>` to the object type `dyn Debug` = note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider restricting type parameter `T` | @@ -77,7 +77,7 @@ LL | impl<T> Debug for Inner<T> where T: Debug + Trait { | ^^^^^ ^^^^^^^^ = note: 1 redundant requirement hidden = note: required because of the requirements on the impl of `Debug` for `&e::Inner<T>` - = note: required for the cast to the object type `dyn Debug` + = note: required for the cast from `&e::Inner<T>` to the object type `dyn Debug` = note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider restricting type parameter `T` | @@ -99,7 +99,7 @@ LL | impl<T: Debug> Debug for Inner<T> where T: Trait { | ^^^^^ ^^^^^^^^ = note: 1 redundant requirement hidden = note: required because of the requirements on the impl of `Debug` for `&f::Inner<T>` - = note: required for the cast to the object type `dyn Debug` + = note: required for the cast from `&f::Inner<T>` to the object type `dyn Debug` = note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider restricting type parameter `T` | diff --git a/src/test/ui/suggestions/derive-trait-for-method-call.stderr b/src/test/ui/suggestions/derive-trait-for-method-call.stderr index 65167ce4a29..0ec57fabdad 100644 --- a/src/test/ui/suggestions/derive-trait-for-method-call.stderr +++ b/src/test/ui/suggestions/derive-trait-for-method-call.stderr @@ -23,14 +23,8 @@ LL | let y = x.test(); note: the following trait must be implemented --> $SRC_DIR/core/src/default.rs:LL:COL | -LL | / pub trait Default: Sized { -LL | | /// Returns the "default value" for a type. -LL | | /// -LL | | /// Default values are often some kind of initial value, identity value, or anything else that -... | -LL | | fn default() -> Self; -LL | | } - | |_^ +LL | pub trait Default: Sized { + | ^^^^^^^^^^^^^^^^^^^^^^^^ help: consider annotating `Enum` with `#[derive(Clone)]` | LL | #[derive(Clone)] @@ -79,7 +73,7 @@ LL | let y = x.test(); ::: $SRC_DIR/std/src/time.rs:LL:COL | LL | pub struct Instant(time::Instant); - | ---------------------------------- doesn't satisfy `Instant: Default` + | ------------------ doesn't satisfy `Instant: Default` | ::: $SRC_DIR/alloc/src/vec/mod.rs:LL:COL | diff --git a/src/test/ui/suggestions/fn-or-tuple-struct-without-args.stderr b/src/test/ui/suggestions/fn-or-tuple-struct-without-args.stderr index 25ce458f6d8..505ed2ad7b3 100644 --- a/src/test/ui/suggestions/fn-or-tuple-struct-without-args.stderr +++ b/src/test/ui/suggestions/fn-or-tuple-struct-without-args.stderr @@ -40,7 +40,7 @@ error[E0308]: mismatched types --> $DIR/fn-or-tuple-struct-without-args.rs:30:16 | LL | struct S(usize, usize); - | ----------------------- fn(usize, usize) -> S {S} defined here + | -------- fn(usize, usize) -> S {S} defined here ... LL | let _: S = S; | - ^ expected struct `S`, found fn item @@ -76,7 +76,7 @@ error[E0308]: mismatched types --> $DIR/fn-or-tuple-struct-without-args.rs:32:16 | LL | struct V(); - | ----------- fn() -> V {V} defined here + | -------- fn() -> V {V} defined here ... LL | let _: V = V; | - ^ expected struct `V`, found fn item diff --git a/src/test/ui/suggestions/invalid-bin-op.stderr b/src/test/ui/suggestions/invalid-bin-op.stderr index 94bd2d41565..08502dfeb2d 100644 --- a/src/test/ui/suggestions/invalid-bin-op.stderr +++ b/src/test/ui/suggestions/invalid-bin-op.stderr @@ -10,7 +10,7 @@ note: an implementation of `PartialEq<_>` might be missing for `S<T>` --> $DIR/invalid-bin-op.rs:5:1 | LL | struct S<T>(T); - | ^^^^^^^^^^^^^^^ must implement `PartialEq<_>` + | ^^^^^^^^^^^ must implement `PartialEq<_>` help: consider annotating `S<T>` with `#[derive(PartialEq)]` | LL | #[derive(PartialEq)] diff --git a/src/test/ui/suggestions/issue-98500.rs b/src/test/ui/suggestions/issue-98500.rs new file mode 100644 index 00000000000..a2717fd9206 --- /dev/null +++ b/src/test/ui/suggestions/issue-98500.rs @@ -0,0 +1,14 @@ +// aux-build:not-object-safe.rs + +extern crate not_object_safe; + +pub trait B where + Self: not_object_safe::A, +{ + fn f2(&self); +} + +struct S(Box<dyn B>); +//~^ ERROR the trait `B` cannot be made into an object + +fn main() {} diff --git a/src/test/ui/suggestions/issue-98500.stderr b/src/test/ui/suggestions/issue-98500.stderr new file mode 100644 index 00000000000..e7251d735e3 --- /dev/null +++ b/src/test/ui/suggestions/issue-98500.stderr @@ -0,0 +1,24 @@ +error[E0038]: the trait `B` cannot be made into an object + --> $DIR/issue-98500.rs:11:14 + | +LL | struct S(Box<dyn B>); + | ^^^^^ `B` cannot be made into an object + | +note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + --> $DIR/auxiliary/not-object-safe.rs:4:8 + | +LL | fn f(); + | ^ ...because associated function `f` has no `self` parameter +LL | fn f2(self: &Arc<Self>); + | ^^ ...because method `f2`'s `self` parameter cannot be dispatched on + | + ::: $DIR/issue-98500.rs:5:11 + | +LL | pub trait B where + | - this trait cannot be made into an object... + = help: consider moving `f` to another trait + = help: consider moving `f2` to another trait + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0038`. diff --git a/src/test/ui/suggestions/missing-assoc-fn-applicable-suggestions.stderr b/src/test/ui/suggestions/missing-assoc-fn-applicable-suggestions.stderr index ee29a56f3f8..4c75fbe4c78 100644 --- a/src/test/ui/suggestions/missing-assoc-fn-applicable-suggestions.stderr +++ b/src/test/ui/suggestions/missing-assoc-fn-applicable-suggestions.stderr @@ -2,7 +2,7 @@ error[E0046]: not all trait items implemented, missing: `Type`, `bar`, `baz` --> $DIR/missing-assoc-fn-applicable-suggestions.rs:15:1 | LL | type Type; - | ---------- `Type` from trait + | --------- `Type` from trait LL | fn bar<T>(_: T) -> Self; | ------------------------ `bar` from trait LL | fn baz<T>(_: T) -> Self where T: TraitB, <T as TraitB>::Item: Copy; diff --git a/src/test/ui/suggestions/object-unsafe-trait-should-use-where-sized.fixed b/src/test/ui/suggestions/object-unsafe-trait-should-use-where-sized.fixed index 73bb6725f5a..69487c565c9 100644 --- a/src/test/ui/suggestions/object-unsafe-trait-should-use-where-sized.fixed +++ b/src/test/ui/suggestions/object-unsafe-trait-should-use-where-sized.fixed @@ -2,7 +2,7 @@ #![allow(unused_variables, dead_code)] trait Trait { - fn foo(&self) where Self: Other, Self: Sized, { } + fn foo(&self) where Self: Other, Self: Sized { } fn bar(self: &Self) {} //~ ERROR invalid `self` parameter type } diff --git a/src/test/ui/suggestions/object-unsafe-trait-should-use-where-sized.stderr b/src/test/ui/suggestions/object-unsafe-trait-should-use-where-sized.stderr index 74237e6e6c6..c0dc71df06e 100644 --- a/src/test/ui/suggestions/object-unsafe-trait-should-use-where-sized.stderr +++ b/src/test/ui/suggestions/object-unsafe-trait-should-use-where-sized.stderr @@ -1,12 +1,3 @@ -error[E0307]: invalid `self` parameter type: () - --> $DIR/object-unsafe-trait-should-use-where-sized.rs:6:18 - | -LL | fn bar(self: ()) {} - | ^^ - | - = note: type of `self` must be `Self` or a type that dereferences to it - = help: consider changing to `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`) - error[E0038]: the trait `Trait` cannot be made into an object --> $DIR/object-unsafe-trait-should-use-where-sized.rs:9:12 | @@ -28,13 +19,22 @@ LL | fn foo(&self) where Self: Other, { } | +++++ help: alternatively, consider constraining `foo` so it does not apply to trait objects | -LL | fn foo() where Self: Other, Self: Sized, { } - | +++++++++++++ +LL | fn foo() where Self: Other, Self: Sized { } + | ~~~~~~~~~~~~~ help: consider changing method `bar`'s `self` parameter to be `&self` | LL | fn bar(self: &Self) {} | ~~~~~ +error[E0307]: invalid `self` parameter type: () + --> $DIR/object-unsafe-trait-should-use-where-sized.rs:6:18 + | +LL | fn bar(self: ()) {} + | ^^ + | + = note: type of `self` must be `Self` or a type that dereferences to it + = help: consider changing to `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`) + error: aborting due to 2 previous errors Some errors have detailed explanations: E0038, E0307. diff --git a/src/test/ui/suggestions/option-content-move.stderr b/src/test/ui/suggestions/option-content-move.stderr index a9e540084e5..fccfbe1d744 100644 --- a/src/test/ui/suggestions/option-content-move.stderr +++ b/src/test/ui/suggestions/option-content-move.stderr @@ -2,23 +2,37 @@ error[E0507]: cannot move out of `selection.1` which is behind a shared referenc --> $DIR/option-content-move.rs:11:20 | LL | if selection.1.unwrap().contains(selection.0) { - | ^^^^^^^^^^^ move occurs because `selection.1` has type `Option<String>`, which does not implement the `Copy` trait + | ^^^^^^^^^^^ -------- `selection.1` moved due to this method call + | | + | move occurs because `selection.1` has type `Option<String>`, which does not implement the `Copy` trait | -help: consider borrowing the `Option`'s content +note: this function takes ownership of the receiver `self`, which moves `selection.1` + --> $SRC_DIR/core/src/option.rs:LL:COL + | +LL | pub const fn unwrap(self) -> T { + | ^^^^ +help: consider calling `.as_ref()` to borrow the type's contents | LL | if selection.1.as_ref().unwrap().contains(selection.0) { - | +++++++++ + | +++++++++ error[E0507]: cannot move out of `selection.1` which is behind a shared reference --> $DIR/option-content-move.rs:29:20 | LL | if selection.1.unwrap().contains(selection.0) { - | ^^^^^^^^^^^ move occurs because `selection.1` has type `Result<String, String>`, which does not implement the `Copy` trait + | ^^^^^^^^^^^ -------- `selection.1` moved due to this method call + | | + | move occurs because `selection.1` has type `Result<String, String>`, which does not implement the `Copy` trait + | +note: this function takes ownership of the receiver `self`, which moves `selection.1` + --> $SRC_DIR/core/src/result.rs:LL:COL | -help: consider borrowing the `Result`'s content +LL | pub fn unwrap(self) -> T + | ^^^^ +help: consider calling `.as_ref()` to borrow the type's contents | LL | if selection.1.as_ref().unwrap().contains(selection.0) { - | +++++++++ + | +++++++++ error: aborting due to 2 previous errors diff --git a/src/test/ui/suggestions/suggest-blanket-impl-local-trait.rs b/src/test/ui/suggestions/suggest-blanket-impl-local-trait.rs new file mode 100644 index 00000000000..7cf536f7966 --- /dev/null +++ b/src/test/ui/suggestions/suggest-blanket-impl-local-trait.rs @@ -0,0 +1,58 @@ +// Ensure that the compiler include the blanklet implementation suggestion +// when inside a `impl` statment are used two local traits. +// +// edition:2021 +use std::fmt; + +trait LocalTraitOne { } + +trait LocalTraitTwo { } + +trait GenericTrait<T> {} + +impl LocalTraitTwo for LocalTraitOne {} +//~^ ERROR trait objects must include the `dyn` keyword +//~| HELP add `dyn` keyword before this trait +//~| HELP alternatively use a blanket implementation to implement `LocalTraitTwo` for all types that also implement `LocalTraitOne` + +impl fmt::Display for LocalTraitOne { +//~^ ERROR trait objects must include the `dyn` keyword +//~| HELP add `dyn` keyword before this trait + fn fmt(&self, _f: &mut fmt::Formatter<'_>) -> fmt::Result { + todo!(); + } +} + +impl fmt::Display for LocalTraitTwo + Send { +//~^ ERROR trait objects must include the `dyn` keyword +//~| HELP add `dyn` keyword before this trait + fn fmt(&self, _f: &mut fmt::Formatter<'_>) -> fmt::Result { + todo!(); + } +} + +impl LocalTraitOne for fmt::Display {} +//~^ ERROR trait objects must include the `dyn` keyword +//~| HELP add `dyn` keyword before this trait +//~| HELP alternatively use a blanket implementation to implement `LocalTraitOne` for all types that also implement `fmt::Display` + + +impl LocalTraitOne for fmt::Display + Send {} +//~^ ERROR trait objects must include the `dyn` keyword +//~| HELP add `dyn` keyword before this trait +//~| HELP alternatively use a blanket implementation to implement `LocalTraitOne` for all types that also implement `fmt::Display + Send` + + +impl<E> GenericTrait<E> for LocalTraitOne {} +//~^ ERROR trait objects must include the `dyn` keyword +//~| HELP add `dyn` keyword before this trait +//~| HELP alternatively use a blanket implementation to implement `GenericTrait<E>` for all types that also implement `LocalTraitOne` + +trait GenericTraitTwo<T> {} + +impl<T, E> GenericTraitTwo<E> for GenericTrait<T> {} +//~^ ERROR trait objects must include the `dyn` keyword +//~| HELP add `dyn` keyword before this trait +//~| HELP alternatively use a blanket implementation to implement `GenericTraitTwo<E>` for all types that also implement `GenericTrait<T>` + +fn main() {} diff --git a/src/test/ui/suggestions/suggest-blanket-impl-local-trait.stderr b/src/test/ui/suggestions/suggest-blanket-impl-local-trait.stderr new file mode 100644 index 00000000000..d739a8272f1 --- /dev/null +++ b/src/test/ui/suggestions/suggest-blanket-impl-local-trait.stderr @@ -0,0 +1,107 @@ +error[E0782]: trait objects must include the `dyn` keyword + --> $DIR/suggest-blanket-impl-local-trait.rs:13:24 + | +LL | impl LocalTraitTwo for LocalTraitOne {} + | ^^^^^^^^^^^^^ + | +help: add `dyn` keyword before this trait + | +LL - impl LocalTraitTwo for LocalTraitOne {} +LL + impl LocalTraitTwo for dyn LocalTraitOne {} + | +help: alternatively use a blanket implementation to implement `LocalTraitTwo` for all types that also implement `LocalTraitOne` + | +LL | impl<T: LocalTraitOne> LocalTraitTwo for T {} + | ++++++++++++++++++ ~ + +error[E0782]: trait objects must include the `dyn` keyword + --> $DIR/suggest-blanket-impl-local-trait.rs:18:23 + | +LL | impl fmt::Display for LocalTraitOne { + | ^^^^^^^^^^^^^ + | +help: add `dyn` keyword before this trait + | +LL - impl fmt::Display for LocalTraitOne { +LL + impl fmt::Display for dyn LocalTraitOne { + | + +error[E0782]: trait objects must include the `dyn` keyword + --> $DIR/suggest-blanket-impl-local-trait.rs:26:23 + | +LL | impl fmt::Display for LocalTraitTwo + Send { + | ^^^^^^^^^^^^^^^^^^^^ + | +help: add `dyn` keyword before this trait + | +LL - impl fmt::Display for LocalTraitTwo + Send { +LL + impl fmt::Display for dyn LocalTraitTwo + Send { + | + +error[E0782]: trait objects must include the `dyn` keyword + --> $DIR/suggest-blanket-impl-local-trait.rs:34:24 + | +LL | impl LocalTraitOne for fmt::Display {} + | ^^^^^^^^^^^^ + | +help: add `dyn` keyword before this trait + | +LL - impl LocalTraitOne for fmt::Display {} +LL + impl LocalTraitOne for dyn fmt::Display {} + | +help: alternatively use a blanket implementation to implement `LocalTraitOne` for all types that also implement `fmt::Display` + | +LL | impl<T: fmt::Display> LocalTraitOne for T {} + | +++++++++++++++++ ~ + +error[E0782]: trait objects must include the `dyn` keyword + --> $DIR/suggest-blanket-impl-local-trait.rs:40:24 + | +LL | impl LocalTraitOne for fmt::Display + Send {} + | ^^^^^^^^^^^^^^^^^^^ + | +help: add `dyn` keyword before this trait + | +LL - impl LocalTraitOne for fmt::Display + Send {} +LL + impl LocalTraitOne for dyn fmt::Display + Send {} + | +help: alternatively use a blanket implementation to implement `LocalTraitOne` for all types that also implement `fmt::Display + Send` + | +LL | impl<T: fmt::Display + Send> LocalTraitOne for T {} + | ++++++++++++++++++++++++ ~ + +error[E0782]: trait objects must include the `dyn` keyword + --> $DIR/suggest-blanket-impl-local-trait.rs:46:29 + | +LL | impl<E> GenericTrait<E> for LocalTraitOne {} + | ^^^^^^^^^^^^^ + | +help: add `dyn` keyword before this trait + | +LL - impl<E> GenericTrait<E> for LocalTraitOne {} +LL + impl<E> GenericTrait<E> for dyn LocalTraitOne {} + | +help: alternatively use a blanket implementation to implement `GenericTrait<E>` for all types that also implement `LocalTraitOne` + | +LL | impl<E, T: LocalTraitOne> GenericTrait<E> for T {} + | ++++++++++++++++++ ~ + +error[E0782]: trait objects must include the `dyn` keyword + --> $DIR/suggest-blanket-impl-local-trait.rs:53:35 + | +LL | impl<T, E> GenericTraitTwo<E> for GenericTrait<T> {} + | ^^^^^^^^^^^^^^^ + | +help: add `dyn` keyword before this trait + | +LL - impl<T, E> GenericTraitTwo<E> for GenericTrait<T> {} +LL + impl<T, E> GenericTraitTwo<E> for dyn GenericTrait<T> {} + | +help: alternatively use a blanket implementation to implement `GenericTraitTwo<E>` for all types that also implement `GenericTrait<T>` + | +LL | impl<T, E, U: GenericTrait<T>> GenericTraitTwo<E> for U {} + | ++++++++++++++++++++ ~ + +error: aborting due to 7 previous errors + +For more information about this error, try `rustc --explain E0782`. diff --git a/src/test/ui/suggestions/suggest-borrow-to-dyn-object.rs b/src/test/ui/suggestions/suggest-borrow-to-dyn-object.rs new file mode 100644 index 00000000000..120fc538307 --- /dev/null +++ b/src/test/ui/suggestions/suggest-borrow-to-dyn-object.rs @@ -0,0 +1,16 @@ +use std::ffi::{OsStr, OsString}; +use std::path::Path; + +fn check(p: &dyn AsRef<Path>) { + let m = std::fs::metadata(&p); + println!("{:?}", &m); +} + +fn main() { + let s: OsString = ".".into(); + let s: &OsStr = &s; + check(s); + //~^ ERROR the size for values of type `[u8]` cannot be known at compilation time + //~| HELP within `OsStr`, the trait `Sized` is not implemented for `[u8]` + //~| HELP consider borrowing the value, since `&OsStr` can be coerced into `dyn AsRef<Path>` +} diff --git a/src/test/ui/suggestions/suggest-borrow-to-dyn-object.stderr b/src/test/ui/suggestions/suggest-borrow-to-dyn-object.stderr new file mode 100644 index 00000000000..6b6e406130e --- /dev/null +++ b/src/test/ui/suggestions/suggest-borrow-to-dyn-object.stderr @@ -0,0 +1,19 @@ +error[E0277]: the size for values of type `[u8]` cannot be known at compilation time + --> $DIR/suggest-borrow-to-dyn-object.rs:12:11 + | +LL | check(s); + | ----- ^ doesn't have a size known at compile-time + | | + | required by a bound introduced by this call + | + = help: within `OsStr`, the trait `Sized` is not implemented for `[u8]` + = note: required because it appears within the type `OsStr` + = note: required for the cast from `OsStr` to the object type `dyn AsRef<Path>` +help: consider borrowing the value, since `&OsStr` can be coerced into `dyn AsRef<Path>` + | +LL | check(&s); + | + + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/suggestions/suggest-closure-return-type-1.stderr b/src/test/ui/suggestions/suggest-closure-return-type-1.stderr index 3116211b52c..f4c2eb7ff34 100644 --- a/src/test/ui/suggestions/suggest-closure-return-type-1.stderr +++ b/src/test/ui/suggestions/suggest-closure-return-type-1.stderr @@ -2,7 +2,7 @@ error[E0282]: type annotations needed for `[_; 0]` --> $DIR/suggest-closure-return-type-1.rs:4:18 | LL | unbound_drop(|| -> _ { [] }); - | ^^^^^^^ + | ^^^^^^^ -- type must be known at this point | help: try giving this closure an explicit return type | diff --git a/src/test/ui/suggestions/suggest-closure-return-type-2.stderr b/src/test/ui/suggestions/suggest-closure-return-type-2.stderr index f368e7de467..88bf263043d 100644 --- a/src/test/ui/suggestions/suggest-closure-return-type-2.stderr +++ b/src/test/ui/suggestions/suggest-closure-return-type-2.stderr @@ -2,7 +2,7 @@ error[E0282]: type annotations needed for `[_; 0]` --> $DIR/suggest-closure-return-type-2.rs:4:18 | LL | unbound_drop(|| { [] }) - | ^^ + | ^^ -- type must be known at this point | help: try giving this closure an explicit return type | diff --git a/src/test/ui/suggestions/suggest-closure-return-type-3.stderr b/src/test/ui/suggestions/suggest-closure-return-type-3.stderr index 41769321533..bc4107528d2 100644 --- a/src/test/ui/suggestions/suggest-closure-return-type-3.stderr +++ b/src/test/ui/suggestions/suggest-closure-return-type-3.stderr @@ -2,7 +2,7 @@ error[E0282]: type annotations needed for `[_; 0]` --> $DIR/suggest-closure-return-type-3.rs:4:18 | LL | unbound_drop(|| []); - | ^^ + | ^^ -- type must be known at this point | help: try giving this closure an explicit return type | diff --git a/src/test/ui/suggestions/suggest-trait-items.stderr b/src/test/ui/suggestions/suggest-trait-items.stderr index 4abc3446610..8bc3df7b817 100644 --- a/src/test/ui/suggestions/suggest-trait-items.stderr +++ b/src/test/ui/suggestions/suggest-trait-items.stderr @@ -47,7 +47,7 @@ error[E0046]: not all trait items implemented, missing: `Type`, `foo`, `bar`, `q --> $DIR/suggest-trait-items.rs:11:1 | LL | type Type; - | ---------- `Type` from trait + | --------- `Type` from trait LL | LL | fn foo(); | --------- `foo` from trait @@ -63,7 +63,7 @@ error[E0046]: not all trait items implemented, missing: `Const` --> $DIR/suggest-trait-items.rs:40:1 | LL | const Const: i32; - | ----------------- `Const` from trait + | ---------------- `Const` from trait ... LL | impl Bar for B { | ^^^^^^^^^^^^^^ missing `Const` in implementation diff --git a/src/test/ui/suggestions/use-type-argument-instead-of-assoc-type.stderr b/src/test/ui/suggestions/use-type-argument-instead-of-assoc-type.stderr index 5409e32c436..7038a572bec 100644 --- a/src/test/ui/suggestions/use-type-argument-instead-of-assoc-type.stderr +++ b/src/test/ui/suggestions/use-type-argument-instead-of-assoc-type.stderr @@ -18,10 +18,10 @@ error[E0191]: the value of the associated types `A` (from trait `T`), `C` (from --> $DIR/use-type-argument-instead-of-assoc-type.rs:7:16 | LL | type A; - | ------- `A` defined here + | ------ `A` defined here LL | type B; LL | type C; - | ------- `C` defined here + | ------ `C` defined here ... LL | i: Box<dyn T<usize, usize, usize, usize, B=usize>>, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ associated types `A`, `C` must be specified diff --git a/src/test/ui/trait-bounds/select-param-env-instead-of-blanket.rs b/src/test/ui/trait-bounds/select-param-env-instead-of-blanket.rs deleted file mode 100644 index 288b2098b4c..00000000000 --- a/src/test/ui/trait-bounds/select-param-env-instead-of-blanket.rs +++ /dev/null @@ -1,43 +0,0 @@ -// known-bug -// build-fail -// failure-status: 101 -// compile-flags:--crate-type=lib -Zmir-opt-level=3 -// rustc-env:RUST_BACKTRACE=0 - -// normalize-stderr-test "thread 'rustc' panicked.*" -> "thread 'rustc' panicked" -// normalize-stderr-test "note:.*RUST_BACKTRACE=1.*\n" -> "" -// normalize-stderr-test "error: internal compiler error.*" -> "error: internal compiler error" -// normalize-stderr-test "encountered.*with incompatible types:" "encountered ... with incompatible types:" -// normalize-stderr-test "note:.*unexpectedly panicked.*\n\n" -> "" -// normalize-stderr-test "note: we would appreciate a bug report.*\n\n" -> "" -// normalize-stderr-test "note: compiler flags.*\n\n" -> "" -// normalize-stderr-test "note: rustc.*running on.*\n\n" -> "" -// normalize-stderr-test "query stack during panic:\n" -> "" -// normalize-stderr-test "we're just showing a limited slice of the query stack\n" -> "" -// normalize-stderr-test "end of query stack\n" -> "" -// normalize-stderr-test "#.*\n" -> "" - -// This is a known bug that @compiler-errors tried to fix in #94238, -// but the solution was probably not correct. - -pub trait Factory<T> { - type Item; -} - -pub struct IntFactory; - -impl<T> Factory<T> for IntFactory { - type Item = usize; -} - -pub fn foo<T>() -where - IntFactory: Factory<T>, -{ - let mut x: <IntFactory as Factory<T>>::Item = bar::<T>(); -} - -#[inline] -pub fn bar<T>() -> <IntFactory as Factory<T>>::Item { - 0usize -} diff --git a/src/test/ui/trait-bounds/select-param-env-instead-of-blanket.stderr b/src/test/ui/trait-bounds/select-param-env-instead-of-blanket.stderr deleted file mode 100644 index 56cc5c93c96..00000000000 --- a/src/test/ui/trait-bounds/select-param-env-instead-of-blanket.stderr +++ /dev/null @@ -1,18 +0,0 @@ -error: internal compiler error - -error: internal compiler error - encountered ... with incompatible types: - left-hand side has type: <IntFactory as Factory<T>>::Item - right-hand side has type: usize - --> $DIR/select-param-env-instead-of-blanket.rs:42:5 - | -LL | let mut x: <IntFactory as Factory<T>>::Item = bar::<T>(); - | ---------- in this inlined function call -... -LL | 0usize - | ^^^^^^ - | - = note: delayed at compiler/rustc_const_eval/src/transform/validate.rs:128:36 - -thread 'rustc' panicked - diff --git a/src/test/ui/traits/alias/issue-83613.stderr b/src/test/ui/traits/alias/issue-83613.stderr index bbc240b6aec..b9d93160192 100644 --- a/src/test/ui/traits/alias/issue-83613.stderr +++ b/src/test/ui/traits/alias/issue-83613.stderr @@ -1,3 +1,11 @@ +error[E0119]: conflicting implementations of trait `AnotherTrait` for type `OpaqueType` + --> $DIR/issue-83613.rs:10:1 + | +LL | impl<T: Send> AnotherTrait for T {} + | -------------------------------- first implementation here +LL | impl AnotherTrait for OpaqueType {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `OpaqueType` + error: cannot implement trait on type alias impl trait --> $DIR/issue-83613.rs:10:23 | @@ -10,14 +18,6 @@ note: type alias impl trait defined here LL | type OpaqueType = impl OpaqueTrait; | ^^^^^^^^^^^^^^^^ -error[E0119]: conflicting implementations of trait `AnotherTrait` for type `OpaqueType` - --> $DIR/issue-83613.rs:10:1 - | -LL | impl<T: Send> AnotherTrait for T {} - | -------------------------------- first implementation here -LL | impl AnotherTrait for OpaqueType {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `OpaqueType` - error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/traits/alias/only-maybe-bound.stderr b/src/test/ui/traits/alias/only-maybe-bound.stderr index 06c707e4332..175ec8120ec 100644 --- a/src/test/ui/traits/alias/only-maybe-bound.stderr +++ b/src/test/ui/traits/alias/only-maybe-bound.stderr @@ -2,7 +2,7 @@ error[E0224]: at least one trait is required for an object type --> $DIR/only-maybe-bound.rs:13:12 | LL | trait _1 = _0; - | -------------- this alias does not contain a trait + | -------- this alias does not contain a trait ... LL | type _T0 = dyn _1; | ^^^^^^ @@ -11,7 +11,7 @@ error[E0224]: at least one trait is required for an object type --> $DIR/only-maybe-bound.rs:19:12 | LL | trait _2 = _1 + _1; - | ------------------- this alias does not contain a trait + | -------- this alias does not contain a trait LL | LL | type _T1 = dyn _2; | ^^^^^^ diff --git a/src/test/ui/traits/bound/same-crate-name.stderr b/src/test/ui/traits/bound/same-crate-name.stderr index ef39a70066d..f66cad77fcd 100644 --- a/src/test/ui/traits/bound/same-crate-name.stderr +++ b/src/test/ui/traits/bound/same-crate-name.stderr @@ -10,7 +10,7 @@ help: trait impl with same name found --> $DIR/auxiliary/crate_a2.rs:5:1 | LL | impl Bar for Foo {} - | ^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^ = note: perhaps two different versions of crate `crate_a2` are being used? = help: the trait `main::a::Bar` is implemented for `ImplementsTraitForUsize<usize>` note: required by a bound in `try_foo` @@ -46,7 +46,7 @@ help: trait impl with same name found --> $DIR/auxiliary/crate_a2.rs:13:1 | LL | impl Bar for ImplementsWrongTraitConditionally<isize> {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: perhaps two different versions of crate `crate_a2` are being used? = help: the trait `main::a::Bar` is implemented for `ImplementsTraitForUsize<usize>` note: required by a bound in `try_foo` diff --git a/src/test/ui/traits/coercion-generic-bad.stderr b/src/test/ui/traits/coercion-generic-bad.stderr index b213ee635df..93d6770eb47 100644 --- a/src/test/ui/traits/coercion-generic-bad.stderr +++ b/src/test/ui/traits/coercion-generic-bad.stderr @@ -5,7 +5,7 @@ LL | let s: Box<dyn Trait<isize>> = Box::new(Struct { person: "Fred" }); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Trait<isize>` is not implemented for `Struct` | = help: the trait `Trait<&'static str>` is implemented for `Struct` - = note: required for the cast to the object type `dyn Trait<isize>` + = note: required for the cast from `Struct` to the object type `dyn Trait<isize>` error: aborting due to previous error diff --git a/src/test/ui/traits/copy-impl-cannot-normalize.stderr b/src/test/ui/traits/copy-impl-cannot-normalize.stderr index cc540ea905a..afdad160919 100644 --- a/src/test/ui/traits/copy-impl-cannot-normalize.stderr +++ b/src/test/ui/traits/copy-impl-cannot-normalize.stderr @@ -2,7 +2,7 @@ error[E0277]: the trait bound `T: TraitFoo` is not satisfied --> $DIR/copy-impl-cannot-normalize.rs:22:1 | LL | impl<T> Copy for Foo<T> {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `TraitFoo` is not implemented for `T` + | ^^^^^^^^^^^^^^^^^^^^^^^ the trait `TraitFoo` is not implemented for `T` | help: consider restricting type parameter `T` | diff --git a/src/test/ui/traits/issue-33140-hack-boundaries.stderr b/src/test/ui/traits/issue-33140-hack-boundaries.stderr index c87f1ff1f3f..62cfca545b2 100644 --- a/src/test/ui/traits/issue-33140-hack-boundaries.stderr +++ b/src/test/ui/traits/issue-33140-hack-boundaries.stderr @@ -60,7 +60,7 @@ error[E0119]: conflicting implementations of trait `Trait5` for type `(dyn std:: LL | impl Trait5 for dyn Send {} | ------------------------ first implementation here LL | impl Trait5 for dyn Send where u32: Copy {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(dyn std::marker::Send + 'static)` + | ^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(dyn std::marker::Send + 'static)` error: aborting due to 8 previous errors diff --git a/src/test/ui/traits/issue-65673.stderr b/src/test/ui/traits/issue-65673.stderr index 71f3a0e7c7c..8f01d7c53e7 100644 --- a/src/test/ui/traits/issue-65673.stderr +++ b/src/test/ui/traits/issue-65673.stderr @@ -2,7 +2,7 @@ error[E0224]: at least one trait is required for an object type --> $DIR/issue-65673.rs:9:16 | LL | trait Alias<T> = where T: Trait; - | -------------------------------- this alias does not contain a trait + | -------------- this alias does not contain a trait ... LL | type Ctx = dyn Alias<T>; | ^^^^^^^^^^^^ diff --git a/src/test/ui/traits/issue-71036.stderr b/src/test/ui/traits/issue-71036.stderr index db1f6946660..3ee6db40e87 100644 --- a/src/test/ui/traits/issue-71036.stderr +++ b/src/test/ui/traits/issue-71036.stderr @@ -2,7 +2,7 @@ error[E0277]: the trait bound `&'a T: Unsize<&'a U>` is not satisfied --> $DIR/issue-71036.rs:11:1 | LL | impl<'a, T: ?Sized + Unsize<U>, U: ?Sized> DispatchFromDyn<Foo<'a, U>> for Foo<'a, T> {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Unsize<&'a U>` is not implemented for `&'a T` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Unsize<&'a U>` is not implemented for `&'a T` | = note: all implementations of `Unsize` are provided automatically by the compiler, see <https://doc.rust-lang.org/stable/std/marker/trait.Unsize.html> for more information = note: required because of the requirements on the impl of `DispatchFromDyn<&'a &'a U>` for `&'a &'a T` diff --git a/src/test/ui/traits/issue-77982.stderr b/src/test/ui/traits/issue-77982.stderr index 5aa42b5b1d3..a2d23c4e9df 100644 --- a/src/test/ui/traits/issue-77982.stderr +++ b/src/test/ui/traits/issue-77982.stderr @@ -26,7 +26,9 @@ error[E0283]: type annotations needed --> $DIR/issue-77982.rs:8:10 | LL | opts.get(opt.as_ref()); - | ^^^ cannot infer type of the type parameter `Q` declared on the associated function `get` + | ^^^ ------ type must be known at this point + | | + | cannot infer type of the type parameter `Q` declared on the associated function `get` | = note: multiple `impl`s satisfying `String: AsRef<_>` found in the following crates: `alloc`, `std`: - impl AsRef<OsStr> for String; @@ -42,7 +44,9 @@ error[E0283]: type annotations needed --> $DIR/issue-77982.rs:13:59 | LL | let ips: Vec<_> = (0..100_000).map(|_| u32::from(0u32.into())).collect(); - | ^^^^ + | --------- ^^^^ + | | + | type must be known at this point | = note: multiple `impl`s satisfying `u32: From<_>` found in the following crates: `core`, `std`: - impl From<Ipv4Addr> for u32; @@ -59,7 +63,7 @@ error[E0283]: type annotations needed for `Box<T>` --> $DIR/issue-77982.rs:36:9 | LL | let _ = ().foo(); - | ^ + | ^ --- type must be known at this point | note: multiple `impl`s satisfying `(): Foo<'_, _>` found --> $DIR/issue-77982.rs:29:1 @@ -77,7 +81,7 @@ error[E0283]: type annotations needed for `Box<T>` --> $DIR/issue-77982.rs:40:9 | LL | let _ = (&()).bar(); - | ^ + | ^ --- type must be known at this point | note: multiple `impl`s satisfying `&(): Bar<'_, _>` found --> $DIR/issue-77982.rs:32:1 diff --git a/src/test/ui/traits/issue-78372.rs b/src/test/ui/traits/issue-78372.rs index 77a8c92c81c..92f9f4b467a 100644 --- a/src/test/ui/traits/issue-78372.rs +++ b/src/test/ui/traits/issue-78372.rs @@ -4,7 +4,6 @@ impl<T> DispatchFromDyn<Smaht<U, MISC>> for T {} //~ ERROR cannot find type `U` //~^ ERROR cannot find type `MISC` in this scope //~| ERROR use of unstable library feature 'dispatch_from_dyn' //~| ERROR the trait `DispatchFromDyn` may only be implemented for a coercion between structures -//~| ERROR type parameter `T` must be covered by another type when it appears before the first trait Foo: X<u32> {} trait X<T> { fn foo(self: Smaht<Self, T>); diff --git a/src/test/ui/traits/issue-78372.stderr b/src/test/ui/traits/issue-78372.stderr index 49a9f479368..7e781016e1f 100644 --- a/src/test/ui/traits/issue-78372.stderr +++ b/src/test/ui/traits/issue-78372.stderr @@ -50,22 +50,13 @@ LL | impl<T> DispatchFromDyn<Smaht<U, MISC>> for T {} | = help: add `#![feature(dispatch_from_dyn)]` to the crate attributes to enable -error[E0210]: type parameter `T` must be covered by another type when it appears before the first local type (`Smaht<[type error], [type error]>`) - --> $DIR/issue-78372.rs:3:6 - | -LL | impl<T> DispatchFromDyn<Smaht<U, MISC>> for T {} - | ^ type parameter `T` must be covered by another type when it appears before the first local type (`Smaht<[type error], [type error]>`) - | - = note: implementing a foreign trait is only possible if at least one of the types for which it is implemented is local, and no uncovered type parameters appear before that first local type - = note: in this case, 'before' refers to the following order: `impl<..> ForeignTrait<T1, ..., Tn> for T0`, where `T0` is the first and `Tn` is the last - error[E0378]: the trait `DispatchFromDyn` may only be implemented for a coercion between structures --> $DIR/issue-78372.rs:3:1 | LL | impl<T> DispatchFromDyn<Smaht<U, MISC>> for T {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: aborting due to 7 previous errors +error: aborting due to 6 previous errors -Some errors have detailed explanations: E0210, E0378, E0412, E0658. -For more information about an error, try `rustc --explain E0210`. +Some errors have detailed explanations: E0378, E0412, E0658. +For more information about an error, try `rustc --explain E0378`. diff --git a/src/test/ui/traits/issue-8153.stderr b/src/test/ui/traits/issue-8153.stderr index 4389c3dc288..b76bbc0235f 100644 --- a/src/test/ui/traits/issue-8153.stderr +++ b/src/test/ui/traits/issue-8153.stderr @@ -2,9 +2,9 @@ error[E0201]: duplicate definitions with name `bar`: --> $DIR/issue-8153.rs:11:5 | LL | fn bar(&self) -> isize {1} - | -------------------------- previous definition of `bar` here + | ---------------------- previous definition of `bar` here LL | fn bar(&self) -> isize {2} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ duplicate definition + | ^^^^^^^^^^^^^^^^^^^^^^ duplicate definition error: aborting due to previous error diff --git a/src/test/ui/traits/issue-85735.rs b/src/test/ui/traits/issue-85735.rs index 16e874ee21e..fb387a9c909 100644 --- a/src/test/ui/traits/issue-85735.rs +++ b/src/test/ui/traits/issue-85735.rs @@ -5,7 +5,7 @@ trait Foo {} impl<'a, 'b, T> Foo for T where T: FnMut(&'a ()), - //~^ ERROR: type annotations needed [E0283] + //~^ ERROR: type annotations needed T: FnMut(&'b ()), { } diff --git a/src/test/ui/traits/issue-85735.stderr b/src/test/ui/traits/issue-85735.stderr index 33b12ef09ec..fa280135beb 100644 --- a/src/test/ui/traits/issue-85735.stderr +++ b/src/test/ui/traits/issue-85735.stderr @@ -1,8 +1,8 @@ -error[E0283]: type annotations needed +error[E0283]: type annotations needed: cannot satisfy `T: FnMut<(&'a (),)>` --> $DIR/issue-85735.rs:7:8 | LL | T: FnMut(&'a ()), - | ^^^^^^^^^^^^^ cannot infer type for type parameter `T` + | ^^^^^^^^^^^^^ | = note: cannot satisfy `T: FnMut<(&'a (),)>` diff --git a/src/test/ui/traits/issue-91949-hangs-on-recursion.rs b/src/test/ui/traits/issue-91949-hangs-on-recursion.rs index cf2218fe522..499a64f2816 100644 --- a/src/test/ui/traits/issue-91949-hangs-on-recursion.rs +++ b/src/test/ui/traits/issue-91949-hangs-on-recursion.rs @@ -1,4 +1,5 @@ // build-fail +// compile-flags: -Zinline-mir=no // error-pattern: overflow evaluating the requirement `(): Sized` // error-pattern: function cannot return without recursing diff --git a/src/test/ui/traits/issue-91949-hangs-on-recursion.stderr b/src/test/ui/traits/issue-91949-hangs-on-recursion.stderr index 6c04616344f..f34e7d270f9 100644 --- a/src/test/ui/traits/issue-91949-hangs-on-recursion.stderr +++ b/src/test/ui/traits/issue-91949-hangs-on-recursion.stderr @@ -1,5 +1,5 @@ warning: function cannot return without recursing - --> $DIR/issue-91949-hangs-on-recursion.rs:21:1 + --> $DIR/issue-91949-hangs-on-recursion.rs:22:1 | LL | / fn recurse<T>(elements: T) -> Vec<char> LL | | where @@ -18,7 +18,7 @@ error[E0275]: overflow evaluating the requirement `(): Sized` = help: consider increasing the recursion limit by adding a `#![recursion_limit = "512"]` attribute to your crate (`issue_91949_hangs_on_recursion`) = note: required because of the requirements on the impl of `Iterator` for `std::iter::Empty<()>` = note: 171 redundant requirements hidden - = note: required because of the requirements on the impl of `Iterator` for `IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), std::iter::Empty<()>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:25:45: 25:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:25:45: 25:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:25:45: 25:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:25:45: 25:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:25:45: 25:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:25:45: 25:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:25:45: 25:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:25:45: 25:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:25:45: 25:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:25:45: 25:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:25:45: 25:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:25:45: 25:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:25:45: 25:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:25:45: 25:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:25:45: 25:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:25:45: 25:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:25:45: 25:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:25:45: 25:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:25:45: 25:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:25:45: 25:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:25:45: 25:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:25:45: 25:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:25:45: 25:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:25:45: 25:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:25:45: 25:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:25:45: 25:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:25:45: 25:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:25:45: 25:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:25:45: 25:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:25:45: 25:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:25:45: 25:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:25:45: 25:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:25:45: 25:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:25:45: 25:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:25:45: 25:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:25:45: 25:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:25:45: 25:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:25:45: 25:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:25:45: 25:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:25:45: 25:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:25:45: 25:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:25:45: 25:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:25:45: 25:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:25:45: 25:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:25:45: 25:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:25:45: 25:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:25:45: 25:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:25:45: 25:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:25:45: 25:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:25:45: 25:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:25:45: 25:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:25:45: 25:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:25:45: 25:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:25:45: 25:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:25:45: 25:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:25:45: 25:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:25:45: 25:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:25:45: 25:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:25:45: 25:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:25:45: 25:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:25:45: 25:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:25:45: 25:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:25:45: 25:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:25:45: 25:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:25:45: 25:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:25:45: 25:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:25:45: 25:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:25:45: 25:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:25:45: 25:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:25:45: 25:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:25:45: 25:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:25:45: 25:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:25:45: 25:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:25:45: 25:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:25:45: 25:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:25:45: 25:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:25:45: 25:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:25:45: 25:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:25:45: 25:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:25:45: 25:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:25:45: 25:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:25:45: 25:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:25:45: 25:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:25:45: 25:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:25:45: 25:52]>>` + = note: required because of the requirements on the impl of `Iterator` for `IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), std::iter::Empty<()>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:52]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:52]>>` error: aborting due to previous error; 1 warning emitted diff --git a/src/test/ui/traits/item-privacy.stderr b/src/test/ui/traits/item-privacy.stderr index a7954f7b245..06ed5ac081d 100644 --- a/src/test/ui/traits/item-privacy.stderr +++ b/src/test/ui/traits/item-privacy.stderr @@ -116,7 +116,7 @@ error[E0624]: associated constant `A` is private --> $DIR/item-privacy.rs:101:14 | LL | const A: u8 = 0; - | ---------------- private associated constant defined here + | ----------- private associated constant defined here ... LL | <dyn C>::A; | ^ private associated constant diff --git a/src/test/ui/traits/map-types.stderr b/src/test/ui/traits/map-types.stderr index a4686edb717..f685c50b07d 100644 --- a/src/test/ui/traits/map-types.stderr +++ b/src/test/ui/traits/map-types.stderr @@ -5,7 +5,7 @@ LL | let y: Box<dyn Map<usize, isize>> = Box::new(x); | ^^^^^^^^^^^ the trait `Map<usize, isize>` is not implemented for `Box<dyn Map<isize, isize>>` | = help: the trait `Map<K, V>` is implemented for `HashMap<K, V>` - = note: required for the cast to the object type `dyn Map<usize, isize>` + = note: required for the cast from `Box<dyn Map<isize, isize>>` to the object type `dyn Map<usize, isize>` error: aborting due to previous error diff --git a/src/test/ui/traits/object/with-self-in-projection-output-bad.stderr b/src/test/ui/traits/object/with-self-in-projection-output-bad.stderr index 45978a84068..641bfe23666 100644 --- a/src/test/ui/traits/object/with-self-in-projection-output-bad.stderr +++ b/src/test/ui/traits/object/with-self-in-projection-output-bad.stderr @@ -2,7 +2,7 @@ error[E0191]: the value of the associated type `Output` (from trait `Base`) must --> $DIR/with-self-in-projection-output-bad.rs:45:21 | LL | type Output; - | ------------ `Output` defined here + | ----------- `Output` defined here ... LL | let _x: Box<dyn Helper<Target=i32>> = Box::new(2u32); | ^^^^^^^^^^^^^^^^^^ help: specify the associated type: `Helper<Target=i32, Output = Type>` @@ -11,7 +11,7 @@ error[E0191]: the value of the associated type `Output` (from trait `Base`) must --> $DIR/with-self-in-projection-output-bad.rs:48:21 | LL | type Output; - | ------------ `Output` defined here + | ----------- `Output` defined here ... LL | let _y: Box<dyn NormalizableHelper<Target=i32>> = Box::new(2u32); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: specify the associated type: `NormalizableHelper<Target=i32, Output = Type>` diff --git a/src/test/ui/traits/trait-upcasting/type-checking-test-1.stderr b/src/test/ui/traits/trait-upcasting/type-checking-test-1.stderr index 44f32e0cec9..3985372119e 100644 --- a/src/test/ui/traits/trait-upcasting/type-checking-test-1.stderr +++ b/src/test/ui/traits/trait-upcasting/type-checking-test-1.stderr @@ -15,7 +15,7 @@ error[E0277]: the trait bound `&dyn Foo: Bar<_>` is not satisfied LL | let _ = x as &dyn Bar<_>; // Ambiguous | ^ the trait `Bar<_>` is not implemented for `&dyn Foo` | - = note: required for the cast to the object type `dyn Bar<_>` + = note: required for the cast from `&dyn Foo` to the object type `dyn Bar<_>` error: aborting due to 2 previous errors diff --git a/src/test/ui/traits/trait-upcasting/type-checking-test-2.stderr b/src/test/ui/traits/trait-upcasting/type-checking-test-2.stderr index 4ae4c8552c1..93c71f54eb5 100644 --- a/src/test/ui/traits/trait-upcasting/type-checking-test-2.stderr +++ b/src/test/ui/traits/trait-upcasting/type-checking-test-2.stderr @@ -15,7 +15,7 @@ error[E0277]: the trait bound `&dyn Foo<i32>: Bar<u32>` is not satisfied LL | let _ = x as &dyn Bar<u32>; // Error | ^ the trait `Bar<u32>` is not implemented for `&dyn Foo<i32>` | - = note: required for the cast to the object type `dyn Bar<u32>` + = note: required for the cast from `&dyn Foo<i32>` to the object type `dyn Bar<u32>` error[E0605]: non-primitive cast: `&dyn Foo<u32>` as `&dyn Bar<_>` --> $DIR/type-checking-test-2.rs:26:13 @@ -34,7 +34,7 @@ error[E0277]: the trait bound `&dyn Foo<u32>: Bar<_>` is not satisfied LL | let a = x as &dyn Bar<_>; // Ambiguous | ^ the trait `Bar<_>` is not implemented for `&dyn Foo<u32>` | - = note: required for the cast to the object type `dyn Bar<_>` + = note: required for the cast from `&dyn Foo<u32>` to the object type `dyn Bar<_>` error: aborting due to 4 previous errors diff --git a/src/test/ui/traits/vtable/vtable-diamond.stderr b/src/test/ui/traits/vtable/vtable-diamond.stderr index f71bed84d56..f3718c5d852 100644 --- a/src/test/ui/traits/vtable/vtable-diamond.stderr +++ b/src/test/ui/traits/vtable/vtable-diamond.stderr @@ -10,11 +10,8 @@ error: vtable entries for `<S as D>`: [ ] --> $DIR/vtable-diamond.rs:21:1 | -LL | / trait D: B + C { -LL | | -LL | | fn foo_d(&self) {} -LL | | } - | |_^ +LL | trait D: B + C { + | ^^^^^^^^^^^^^^ error: vtable entries for `<S as C>`: [ MetadataDropInPlace, @@ -25,11 +22,8 @@ error: vtable entries for `<S as C>`: [ ] --> $DIR/vtable-diamond.rs:15:1 | -LL | / trait C: A { -LL | | -LL | | fn foo_c(&self) {} -LL | | } - | |_^ +LL | trait C: A { + | ^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/traits/vtable/vtable-multi-level.stderr b/src/test/ui/traits/vtable/vtable-multi-level.stderr index 915fd701b03..d4d7a8fa3a4 100644 --- a/src/test/ui/traits/vtable/vtable-multi-level.stderr +++ b/src/test/ui/traits/vtable/vtable-multi-level.stderr @@ -31,11 +31,8 @@ error: vtable entries for `<S as O>`: [ ] --> $DIR/vtable-multi-level.rs:95:1 | -LL | / trait O: G + N { -LL | | -LL | | fn foo_o(&self) {} -LL | | } - | |_^ +LL | trait O: G + N { + | ^^^^^^^^^^^^^^ error: vtable entries for `<S as B>`: [ MetadataDropInPlace, @@ -45,11 +42,8 @@ error: vtable entries for `<S as B>`: [ ] --> $DIR/vtable-multi-level.rs:19:1 | -LL | / trait B { -LL | | -LL | | fn foo_b(&self) {} -LL | | } - | |_^ +LL | trait B { + | ^^^^^^^ error: vtable entries for `<S as D>`: [ MetadataDropInPlace, @@ -59,11 +53,8 @@ error: vtable entries for `<S as D>`: [ ] --> $DIR/vtable-multi-level.rs:30:1 | -LL | / trait D { -LL | | -LL | | fn foo_d(&self) {} -LL | | } - | |_^ +LL | trait D { + | ^^^^^^^ error: vtable entries for `<S as E>`: [ MetadataDropInPlace, @@ -73,11 +64,8 @@ error: vtable entries for `<S as E>`: [ ] --> $DIR/vtable-multi-level.rs:36:1 | -LL | / trait E { -LL | | -LL | | fn foo_e(&self) {} -LL | | } - | |_^ +LL | trait E { + | ^^^^^^^ error: vtable entries for `<S as F>`: [ MetadataDropInPlace, @@ -90,11 +78,8 @@ error: vtable entries for `<S as F>`: [ ] --> $DIR/vtable-multi-level.rs:42:1 | -LL | / trait F: D + E { -LL | | -LL | | fn foo_f(&self) {} -LL | | } - | |_^ +LL | trait F: D + E { + | ^^^^^^^^^^^^^^ error: vtable entries for `<S as H>`: [ MetadataDropInPlace, @@ -104,11 +89,8 @@ error: vtable entries for `<S as H>`: [ ] --> $DIR/vtable-multi-level.rs:53:1 | -LL | / trait H { -LL | | -LL | | fn foo_h(&self) {} -LL | | } - | |_^ +LL | trait H { + | ^^^^^^^ error: vtable entries for `<S as I>`: [ MetadataDropInPlace, @@ -118,11 +100,8 @@ error: vtable entries for `<S as I>`: [ ] --> $DIR/vtable-multi-level.rs:59:1 | -LL | / trait I { -LL | | -LL | | fn foo_i(&self) {} -LL | | } - | |_^ +LL | trait I { + | ^^^^^^^ error: vtable entries for `<S as J>`: [ MetadataDropInPlace, @@ -135,11 +114,8 @@ error: vtable entries for `<S as J>`: [ ] --> $DIR/vtable-multi-level.rs:65:1 | -LL | / trait J: H + I { -LL | | -LL | | fn foo_j(&self) {} -LL | | } - | |_^ +LL | trait J: H + I { + | ^^^^^^^^^^^^^^ error: vtable entries for `<S as K>`: [ MetadataDropInPlace, @@ -149,11 +125,8 @@ error: vtable entries for `<S as K>`: [ ] --> $DIR/vtable-multi-level.rs:71:1 | -LL | / trait K { -LL | | -LL | | fn foo_k(&self) {} -LL | | } - | |_^ +LL | trait K { + | ^^^^^^^ error: vtable entries for `<S as L>`: [ MetadataDropInPlace, @@ -163,11 +136,8 @@ error: vtable entries for `<S as L>`: [ ] --> $DIR/vtable-multi-level.rs:77:1 | -LL | / trait L { -LL | | -LL | | fn foo_l(&self) {} -LL | | } - | |_^ +LL | trait L { + | ^^^^^^^ error: vtable entries for `<S as M>`: [ MetadataDropInPlace, @@ -180,11 +150,8 @@ error: vtable entries for `<S as M>`: [ ] --> $DIR/vtable-multi-level.rs:83:1 | -LL | / trait M: K + L { -LL | | -LL | | fn foo_m(&self) {} -LL | | } - | |_^ +LL | trait M: K + L { + | ^^^^^^^^^^^^^^ error: vtable entries for `<S as N>`: [ MetadataDropInPlace, @@ -204,11 +171,8 @@ error: vtable entries for `<S as N>`: [ ] --> $DIR/vtable-multi-level.rs:89:1 | -LL | / trait N: J + M { -LL | | -LL | | fn foo_n(&self) {} -LL | | } - | |_^ +LL | trait N: J + M { + | ^^^^^^^^^^^^^^ error: aborting due to 12 previous errors diff --git a/src/test/ui/traits/vtable/vtable-multiple.stderr b/src/test/ui/traits/vtable/vtable-multiple.stderr index f1c8947f906..0dcd8443309 100644 --- a/src/test/ui/traits/vtable/vtable-multiple.stderr +++ b/src/test/ui/traits/vtable/vtable-multiple.stderr @@ -9,11 +9,8 @@ error: vtable entries for `<S as C>`: [ ] --> $DIR/vtable-multiple.rs:16:1 | -LL | / trait C: A + B { -LL | | -LL | | fn foo_c(&self) {} -LL | | } - | |_^ +LL | trait C: A + B { + | ^^^^^^^^^^^^^^ error: vtable entries for `<S as B>`: [ MetadataDropInPlace, @@ -23,11 +20,8 @@ error: vtable entries for `<S as B>`: [ ] --> $DIR/vtable-multiple.rs:10:1 | -LL | / trait B { -LL | | -LL | | fn foo_b(&self) {} -LL | | } - | |_^ +LL | trait B { + | ^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/traits/vtable/vtable-non-object-safe.stderr b/src/test/ui/traits/vtable/vtable-non-object-safe.stderr index bbfbde222f3..9345c271197 100644 --- a/src/test/ui/traits/vtable/vtable-non-object-safe.stderr +++ b/src/test/ui/traits/vtable/vtable-non-object-safe.stderr @@ -10,7 +10,7 @@ error: vtable entries for `<std::vec::IntoIter<u8> as A>`: [ --> $DIR/vtable-non-object-safe.rs:8:1 | LL | trait A: Iterator {} - | ^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/traits/vtable/vtable-vacant.stderr b/src/test/ui/traits/vtable/vtable-vacant.stderr index c8cf5839972..5346a702716 100644 --- a/src/test/ui/traits/vtable/vtable-vacant.stderr +++ b/src/test/ui/traits/vtable/vtable-vacant.stderr @@ -9,12 +9,8 @@ error: vtable entries for `<S as B>`: [ ] --> $DIR/vtable-vacant.rs:15:1 | -LL | / trait B: A { -LL | | -LL | | fn foo_b1(&self) {} -LL | | fn foo_b2(&self) where Self: Send {} -LL | | } - | |_^ +LL | trait B: A { + | ^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/tuple/add-tuple-within-arguments.rs b/src/test/ui/tuple/add-tuple-within-arguments.rs new file mode 100644 index 00000000000..089c703fda5 --- /dev/null +++ b/src/test/ui/tuple/add-tuple-within-arguments.rs @@ -0,0 +1,10 @@ +fn foo(s: &str, a: (i32, i32), s2: &str) {} + +fn bar(s: &str, a: (&str,), s2: &str) {} + +fn main() { + foo("hi", 1, 2, "hi"); + //~^ ERROR this function takes 3 arguments but 4 arguments were supplied + bar("hi", "hi", "hi"); + //~^ ERROR mismatched types +} diff --git a/src/test/ui/tuple/add-tuple-within-arguments.stderr b/src/test/ui/tuple/add-tuple-within-arguments.stderr new file mode 100644 index 00000000000..95df96ca0dd --- /dev/null +++ b/src/test/ui/tuple/add-tuple-within-arguments.stderr @@ -0,0 +1,40 @@ +error[E0061]: this function takes 3 arguments but 4 arguments were supplied + --> $DIR/add-tuple-within-arguments.rs:6:5 + | +LL | foo("hi", 1, 2, "hi"); + | ^^^ + | +note: function defined here + --> $DIR/add-tuple-within-arguments.rs:1:4 + | +LL | fn foo(s: &str, a: (i32, i32), s2: &str) {} + | ^^^ ------- ------------- -------- +help: wrap these arguments in parentheses to construct a tuple + | +LL | foo("hi", (1, 2), "hi"); + | + + + +error[E0308]: mismatched types + --> $DIR/add-tuple-within-arguments.rs:8:15 + | +LL | bar("hi", "hi", "hi"); + | --- ^^^^ expected tuple, found `&str` + | | + | arguments to this function are incorrect + | + = note: expected tuple `(&str,)` + found reference `&'static str` +note: function defined here + --> $DIR/add-tuple-within-arguments.rs:3:4 + | +LL | fn bar(s: &str, a: (&str,), s2: &str) {} + | ^^^ ------- ---------- -------- +help: use a trailing comma to create a tuple with one element + | +LL | bar("hi", ("hi",), "hi"); + | + ++ + +error: aborting due to 2 previous errors + +Some errors have detailed explanations: E0061, E0308. +For more information about an error, try `rustc --explain E0061`. diff --git a/src/test/ui/tuple/wrong_argument_ice-2.stderr b/src/test/ui/tuple/wrong_argument_ice-2.stderr index c704ae9934b..0c2a4c41461 100644 --- a/src/test/ui/tuple/wrong_argument_ice-2.stderr +++ b/src/test/ui/tuple/wrong_argument_ice-2.stderr @@ -9,7 +9,7 @@ note: function defined here | LL | fn test(t: (i32, i32)) {} | ^^^^ ------------- -help: use parentheses to construct a tuple +help: wrap these arguments in parentheses to construct a tuple | LL | test((x.qux(), x.qux())); | + + diff --git a/src/test/ui/tuple/wrong_argument_ice-3.stderr b/src/test/ui/tuple/wrong_argument_ice-3.stderr index 667b15776ef..2733fb3149b 100644 --- a/src/test/ui/tuple/wrong_argument_ice-3.stderr +++ b/src/test/ui/tuple/wrong_argument_ice-3.stderr @@ -2,7 +2,7 @@ error[E0061]: this function takes 1 argument but 2 arguments were supplied --> $DIR/wrong_argument_ice-3.rs:9:16 | LL | groups.push(new_group, vec![process]); - | ^^^^ --------- ------------- argument unexpected + | ^^^^ --------- ------------- argument of type `Vec<&Process>` unexpected | | | expected tuple, found struct `Vec` | diff --git a/src/test/ui/tuple/wrong_argument_ice-4.stderr b/src/test/ui/tuple/wrong_argument_ice-4.stderr index f8dfc4cd043..3645d11842f 100644 --- a/src/test/ui/tuple/wrong_argument_ice-4.stderr +++ b/src/test/ui/tuple/wrong_argument_ice-4.stderr @@ -6,7 +6,7 @@ LL | (|| {})(|| { LL | | LL | | let b = 1; LL | | }); - | |_____- argument unexpected + | |_____- argument of type `[closure@$DIR/wrong_argument_ice-4.rs:2:13: 5:6]` unexpected | note: closure defined here --> $DIR/wrong_argument_ice-4.rs:2:6 diff --git a/src/test/ui/tuple/wrong_argument_ice.stderr b/src/test/ui/tuple/wrong_argument_ice.stderr index 2b4cb669f5c..ec07f1e70cf 100644 --- a/src/test/ui/tuple/wrong_argument_ice.stderr +++ b/src/test/ui/tuple/wrong_argument_ice.stderr @@ -9,7 +9,7 @@ note: associated function defined here | LL | pub fn push_back(&mut self, value: T) { | ^^^^^^^^^ -help: use parentheses to construct a tuple +help: wrap these arguments in parentheses to construct a tuple | LL | self.acc.push_back((self.current_provides, self.current_requires)); | + + diff --git a/src/test/ui/type-alias-enum-variants/enum-variant-priority-lint-ambiguous_associated_items.stderr b/src/test/ui/type-alias-enum-variants/enum-variant-priority-lint-ambiguous_associated_items.stderr index f007f71a73c..aaa3159e0b0 100644 --- a/src/test/ui/type-alias-enum-variants/enum-variant-priority-lint-ambiguous_associated_items.stderr +++ b/src/test/ui/type-alias-enum-variants/enum-variant-priority-lint-ambiguous_associated_items.stderr @@ -16,7 +16,7 @@ note: `V` could also refer to the associated type defined here --> $DIR/enum-variant-priority-lint-ambiguous_associated_items.rs:26:5 | LL | type V; - | ^^^^^^^ + | ^^^^^^ error: ambiguous associated item --> $DIR/enum-variant-priority-lint-ambiguous_associated_items.rs:32:15 @@ -35,7 +35,7 @@ note: `V` could also refer to the associated type defined here --> $DIR/enum-variant-priority-lint-ambiguous_associated_items.rs:26:5 | LL | type V; - | ^^^^^^^ + | ^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/type-alias-impl-trait/closures_in_branches.rs b/src/test/ui/type-alias-impl-trait/closures_in_branches.rs index a1a9401acc2..7bb490bbec8 100644 --- a/src/test/ui/type-alias-impl-trait/closures_in_branches.rs +++ b/src/test/ui/type-alias-impl-trait/closures_in_branches.rs @@ -4,7 +4,7 @@ type Foo = impl std::ops::FnOnce(String) -> usize; fn foo(b: bool) -> Foo { if b { - |x| x.len() + |x| x.len() //~ ERROR type annotations needed } else { panic!() } diff --git a/src/test/ui/type-alias-impl-trait/closures_in_branches.stderr b/src/test/ui/type-alias-impl-trait/closures_in_branches.stderr index b3ca260894b..48b7946ea82 100644 --- a/src/test/ui/type-alias-impl-trait/closures_in_branches.stderr +++ b/src/test/ui/type-alias-impl-trait/closures_in_branches.stderr @@ -1,15 +1,25 @@ error[E0282]: type annotations needed + --> $DIR/closures_in_branches.rs:7:10 + | +LL | |x| x.len() + | ^ - type must be known at this point + | +help: consider giving this closure parameter an explicit type + | +LL | |x: _| x.len() + | +++ + +error[E0282]: type annotations needed --> $DIR/closures_in_branches.rs:21:10 | LL | |x| x.len() - | ^ + | ^ - type must be known at this point | - = note: type must be known at this point help: consider giving this closure parameter an explicit type | LL | |x: _| x.len() | +++ -error: aborting due to previous error +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0282`. diff --git a/src/test/ui/type-alias-impl-trait/cross_inference_pattern_bug_no_type.rs b/src/test/ui/type-alias-impl-trait/cross_inference_pattern_bug_no_type.rs index 179f525de52..328096d44b4 100644 --- a/src/test/ui/type-alias-impl-trait/cross_inference_pattern_bug_no_type.rs +++ b/src/test/ui/type-alias-impl-trait/cross_inference_pattern_bug_no_type.rs @@ -1,4 +1,4 @@ -// known-bug +// known-bug: #96572 // compile-flags: --edition=2021 --crate-type=lib // rustc-env:RUST_BACKTRACE=0 diff --git a/src/test/ui/type-alias-impl-trait/fallback.rs b/src/test/ui/type-alias-impl-trait/fallback.rs index d7e93335f47..d8cf7d71fef 100644 --- a/src/test/ui/type-alias-impl-trait/fallback.rs +++ b/src/test/ui/type-alias-impl-trait/fallback.rs @@ -1,7 +1,6 @@ // Tests that we correctly handle opaque types being used opaquely, // even within their defining scope. // -// check-pass #![feature(type_alias_impl_trait)] type Foo = impl Copy; @@ -23,6 +22,7 @@ fn constrained_foo() -> Foo { // constraints on it. fn unconstrained_foo() -> Wrapper<Foo> { Wrapper::Second + //~^ ERROR: type annotations needed } fn main() {} diff --git a/src/test/ui/type-alias-impl-trait/fallback.stderr b/src/test/ui/type-alias-impl-trait/fallback.stderr new file mode 100644 index 00000000000..e767bfdb08b --- /dev/null +++ b/src/test/ui/type-alias-impl-trait/fallback.stderr @@ -0,0 +1,17 @@ +error[E0283]: type annotations needed + --> $DIR/fallback.rs:24:5 + | +LL | fn unconstrained_foo() -> Wrapper<Foo> { + | ------------ type must be known at this point +LL | Wrapper::Second + | ^^^^^^^^^^^^^^^ cannot infer type of the type parameter `T` declared on the enum `Wrapper` + | + = note: cannot satisfy `_: Copy` +help: consider specifying the generic argument + | +LL | Wrapper::<T>::Second + | +++++ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0283`. diff --git a/src/test/ui/type-alias-impl-trait/issue-53092-2.stderr b/src/test/ui/type-alias-impl-trait/issue-53092-2.stderr index f4a0cdb1625..6745b8ef69c 100644 --- a/src/test/ui/type-alias-impl-trait/issue-53092-2.stderr +++ b/src/test/ui/type-alias-impl-trait/issue-53092-2.stderr @@ -8,7 +8,7 @@ note: ...which requires type-checking `CONST_BUG`... --> $DIR/issue-53092-2.rs:6:1 | LL | const CONST_BUG: Bug<u8, ()> = unsafe { std::mem::transmute(|_: u8| ()) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: ...which requires computing layout of `Bug<u8, ()>`... = note: ...which requires normalizing `Bug<u8, ()>`... = note: ...which again requires computing type of `Bug::{opaque#0}`, completing the cycle diff --git a/src/test/ui/type-alias-impl-trait/issue-53398-cyclic-types.rs b/src/test/ui/type-alias-impl-trait/issue-53398-cyclic-types.rs index 6c838f41003..377ce85e8b2 100644 --- a/src/test/ui/type-alias-impl-trait/issue-53398-cyclic-types.rs +++ b/src/test/ui/type-alias-impl-trait/issue-53398-cyclic-types.rs @@ -3,7 +3,8 @@ type Foo = impl Fn() -> Foo; fn foo() -> Foo { - foo //~ ERROR: overflow evaluating the requirement `fn() -> Foo {foo}: Sized` +//~^ ERROR: overflow evaluating the requirement `fn() -> Foo {foo}: Sized` + foo } fn main() {} diff --git a/src/test/ui/type-alias-impl-trait/issue-53398-cyclic-types.stderr b/src/test/ui/type-alias-impl-trait/issue-53398-cyclic-types.stderr index a9c2c18630c..d20b1cc6d85 100644 --- a/src/test/ui/type-alias-impl-trait/issue-53398-cyclic-types.stderr +++ b/src/test/ui/type-alias-impl-trait/issue-53398-cyclic-types.stderr @@ -1,8 +1,8 @@ error[E0275]: overflow evaluating the requirement `fn() -> Foo {foo}: Sized` - --> $DIR/issue-53398-cyclic-types.rs:6:5 + --> $DIR/issue-53398-cyclic-types.rs:5:13 | -LL | foo - | ^^^ +LL | fn foo() -> Foo { + | ^^^ | = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`issue_53398_cyclic_types`) diff --git a/src/test/ui/type-alias-impl-trait/issue-57611-trait-alias.rs b/src/test/ui/type-alias-impl-trait/issue-57611-trait-alias.rs index 9c4e6c5496f..067ed7ea1e5 100644 --- a/src/test/ui/type-alias-impl-trait/issue-57611-trait-alias.rs +++ b/src/test/ui/type-alias-impl-trait/issue-57611-trait-alias.rs @@ -1,7 +1,7 @@ // Regression test for issue #57611 // Ensures that we don't ICE // FIXME: This should compile, but it currently doesn't -// known-bug +// known-bug: unknown #![feature(trait_alias)] #![feature(type_alias_impl_trait)] diff --git a/src/test/ui/type-alias-impl-trait/issue-60371.stderr b/src/test/ui/type-alias-impl-trait/issue-60371.stderr index d0c04371bd7..082b0f0c309 100644 --- a/src/test/ui/type-alias-impl-trait/issue-60371.stderr +++ b/src/test/ui/type-alias-impl-trait/issue-60371.stderr @@ -11,7 +11,7 @@ error[E0277]: the trait bound `(): Bug` is not satisfied --> $DIR/issue-60371.rs:10:40 | LL | const FUN: fn() -> Self::Item = || (); - | ^^ the trait `Bug` is not implemented for `()` + | ^ the trait `Bug` is not implemented for `()` | = help: the trait `Bug` is implemented for `&()` diff --git a/src/test/ui/type-alias-impl-trait/issue-63279.rs b/src/test/ui/type-alias-impl-trait/issue-63279.rs index 057a908bbee..97332e16d84 100644 --- a/src/test/ui/type-alias-impl-trait/issue-63279.rs +++ b/src/test/ui/type-alias-impl-trait/issue-63279.rs @@ -5,6 +5,7 @@ type Closure = impl FnOnce(); fn c() -> Closure { + //~^ ERROR: expected a `FnOnce<()>` closure, found `()` || -> Closure { || () } //~^ ERROR: mismatched types //~| ERROR: mismatched types diff --git a/src/test/ui/type-alias-impl-trait/issue-63279.stderr b/src/test/ui/type-alias-impl-trait/issue-63279.stderr index ab39ee74be4..57fc660901c 100644 --- a/src/test/ui/type-alias-impl-trait/issue-63279.stderr +++ b/src/test/ui/type-alias-impl-trait/issue-63279.stderr @@ -1,5 +1,14 @@ error[E0277]: expected a `FnOnce<()>` closure, found `()` - --> $DIR/issue-63279.rs:8:11 + --> $DIR/issue-63279.rs:7:11 + | +LL | fn c() -> Closure { + | ^^^^^^^ expected an `FnOnce<()>` closure, found `()` + | + = help: the trait `FnOnce<()>` is not implemented for `()` + = note: wrap the `()` in a closure with no arguments: `|| { /* code */ }` + +error[E0277]: expected a `FnOnce<()>` closure, found `()` + --> $DIR/issue-63279.rs:9:11 | LL | || -> Closure { || () } | ^^^^^^^ expected an `FnOnce<()>` closure, found `()` @@ -8,33 +17,32 @@ LL | || -> Closure { || () } = note: wrap the `()` in a closure with no arguments: `|| { /* code */ }` error[E0308]: mismatched types - --> $DIR/issue-63279.rs:8:21 + --> $DIR/issue-63279.rs:9:21 | LL | || -> Closure { || () } | ^^^^^ expected `()`, found closure | = note: expected unit type `()` - found closure `[closure@$DIR/issue-63279.rs:8:21: 8:26]` + found closure `[closure@$DIR/issue-63279.rs:9:21: 9:26]` help: use parentheses to call this closure | LL | || -> Closure { (|| ())() } | + +++ error[E0308]: mismatched types - --> $DIR/issue-63279.rs:8:5 + --> $DIR/issue-63279.rs:9:5 | -LL | type Closure = impl FnOnce(); - | ------------- the expected opaque type -LL | -LL | fn c() -> Closure { - | ------- expected `Closure` because of return type LL | || -> Closure { || () } | ^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found closure | - = note: expected opaque type `Closure` - found closure `[closure@$DIR/issue-63279.rs:8:5: 8:28]` + = note: expected unit type `()` + found closure `[closure@$DIR/issue-63279.rs:9:5: 9:28]` +help: use parentheses to call this closure + | +LL | (|| -> Closure { || () })() + | + +++ -error: aborting due to 3 previous errors +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/src/test/ui/type-alias-impl-trait/issue-72793.rs b/src/test/ui/type-alias-impl-trait/issue-72793.rs new file mode 100644 index 00000000000..828c871143a --- /dev/null +++ b/src/test/ui/type-alias-impl-trait/issue-72793.rs @@ -0,0 +1,25 @@ +// check-pass +// compile-flags: -Zmir-opt-level=3 + +#![feature(type_alias_impl_trait)] + +trait T { type Item; } + +type Alias<'a> = impl T<Item = &'a ()>; + +struct S; +impl<'a> T for &'a S { + type Item = &'a (); +} + +fn filter_positive<'a>() -> Alias<'a> { + &S +} + +fn with_positive(fun: impl Fn(Alias<'_>)) { + fun(filter_positive()); +} + +fn main() { + with_positive(|_| ()); +} diff --git a/src/test/ui/type-alias-impl-trait/issue-74280.stderr b/src/test/ui/type-alias-impl-trait/issue-74280.stderr index 573e691b4cc..5ed29e0ac94 100644 --- a/src/test/ui/type-alias-impl-trait/issue-74280.stderr +++ b/src/test/ui/type-alias-impl-trait/issue-74280.stderr @@ -1,17 +1,11 @@ error[E0308]: mismatched types --> $DIR/issue-74280.rs:9:5 | -LL | type Test = impl Copy; - | --------- the expected opaque type -LL | LL | fn test() -> Test { - | ---- expected `Test` because of return type + | ---- expected `_` because of return type LL | let y = || -> Test { () }; LL | 7 | ^ expected `()`, found integer - | - = note: expected opaque type `Test` - found type `{integer}` error: aborting due to previous error diff --git a/src/test/ui/type-alias-impl-trait/issue-94429.rs b/src/test/ui/type-alias-impl-trait/issue-94429.rs index 51d69c1271e..2c965b875a0 100644 --- a/src/test/ui/type-alias-impl-trait/issue-94429.rs +++ b/src/test/ui/type-alias-impl-trait/issue-94429.rs @@ -13,7 +13,8 @@ impl Runnable for Implementor { type Gen = impl Generator<Yield = (), Return = ()>; fn run(&mut self) -> Self::Gen { - move || { //~ ERROR: type mismatch resolving + //~^ ERROR: type mismatch resolving + move || { yield 1; } } diff --git a/src/test/ui/type-alias-impl-trait/issue-94429.stderr b/src/test/ui/type-alias-impl-trait/issue-94429.stderr index 4546f82b83b..57550104087 100644 --- a/src/test/ui/type-alias-impl-trait/issue-94429.stderr +++ b/src/test/ui/type-alias-impl-trait/issue-94429.stderr @@ -1,10 +1,8 @@ -error[E0271]: type mismatch resolving `<[generator@$DIR/issue-94429.rs:16:9: 18:10] as Generator>::Yield == ()` - --> $DIR/issue-94429.rs:16:9 +error[E0271]: type mismatch resolving `<[generator@$DIR/issue-94429.rs:17:9: 19:10] as Generator>::Yield == ()` + --> $DIR/issue-94429.rs:15:26 | -LL | / move || { -LL | | yield 1; -LL | | } - | |_________^ expected integer, found `()` +LL | fn run(&mut self) -> Self::Gen { + | ^^^^^^^^^ expected integer, found `()` error: aborting due to previous error diff --git a/src/test/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn.rs b/src/test/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn.rs index 46bac5a34f5..da845e86147 100644 --- a/src/test/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn.rs +++ b/src/test/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn.rs @@ -7,8 +7,8 @@ type X<A, B> = impl Into<&'static A>; fn f<A, B: 'static>(a: &'static A, b: B) -> (X<A, B>, X<B, A>) { - (a, a) //~^ ERROR the trait bound `&'static B: From<&A>` is not satisfied + (a, a) } fn main() { diff --git a/src/test/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn.stderr b/src/test/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn.stderr index 198f3e26393..cdaae99e286 100644 --- a/src/test/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn.stderr +++ b/src/test/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn.stderr @@ -1,8 +1,8 @@ error[E0277]: the trait bound `&'static B: From<&A>` is not satisfied - --> $DIR/multiple-def-uses-in-one-fn.rs:10:9 + --> $DIR/multiple-def-uses-in-one-fn.rs:9:45 | -LL | (a, a) - | ^ the trait `From<&A>` is not implemented for `&'static B` +LL | fn f<A, B: 'static>(a: &'static A, b: B) -> (X<A, B>, X<B, A>) { + | ^^^^^^^^^^^^^^^^^^ the trait `From<&A>` is not implemented for `&'static B` | = note: required because of the requirements on the impl of `Into<&'static B>` for `&A` help: consider introducing a `where` clause, but there might be an alternative better way to express this requirement diff --git a/src/test/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn3.stderr b/src/test/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn3.stderr index db4b60461ef..bbe709dccab 100644 --- a/src/test/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn3.stderr +++ b/src/test/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn3.stderr @@ -1,9 +1,6 @@ error[E0308]: mismatched types --> $DIR/multiple-def-uses-in-one-fn3.rs:14:9 | -LL | type X<A: ToString + Clone, B: ToString + Clone> = impl ToString; - | ------------- the expected opaque type -... LL | fn g<A: ToString + Clone, B: ToString + Clone>(a: A, b: B) -> (X<A, B>, X<A, B>) { | - - found type parameter | | @@ -11,8 +8,8 @@ LL | fn g<A: ToString + Clone, B: ToString + Clone>(a: A, b: B) -> (X<A, B>, X<A LL | (a, b) | ^ expected type parameter `A`, found type parameter `B` | - = note: expected opaque type `X<A, B>` - found type parameter `B` + = note: expected type parameter `A` + found type parameter `B` = note: a type parameter was expected, but a different one was found; you might be missing a type parameter or trait bound = note: for more information, visit https://doc.rust-lang.org/book/ch10-02-traits.html#traits-as-parameters diff --git a/src/test/ui/type-alias-impl-trait/self-referential-2.rs b/src/test/ui/type-alias-impl-trait/self-referential-2.rs index dc7054da5ec..8781196c39f 100644 --- a/src/test/ui/type-alias-impl-trait/self-referential-2.rs +++ b/src/test/ui/type-alias-impl-trait/self-referential-2.rs @@ -4,7 +4,7 @@ type Foo = impl std::fmt::Debug; type Bar = impl PartialEq<Foo>; fn bar() -> Bar { - 42_i32 //~ ERROR can't compare `i32` with `Foo` + 42_i32 //~^ ERROR can't compare `i32` with `Foo` } fn main() {} diff --git a/src/test/ui/type-alias-impl-trait/self-referential-2.stderr b/src/test/ui/type-alias-impl-trait/self-referential-2.stderr index 348696f25e3..2b505d30730 100644 --- a/src/test/ui/type-alias-impl-trait/self-referential-2.stderr +++ b/src/test/ui/type-alias-impl-trait/self-referential-2.stderr @@ -1,8 +1,10 @@ error[E0277]: can't compare `i32` with `Foo` - --> $DIR/self-referential-2.rs:7:5 + --> $DIR/self-referential-2.rs:6:13 | +LL | fn bar() -> Bar { + | ^^^ no implementation for `i32 == Foo` LL | 42_i32 - | ^^^^^^ no implementation for `i32 == Foo` + | ------ return type was inferred to be `i32` here | = help: the trait `PartialEq<Foo>` is not implemented for `i32` = help: the following other types implement trait `PartialEq<Rhs>`: diff --git a/src/test/ui/type-alias-impl-trait/self-referential-4.rs b/src/test/ui/type-alias-impl-trait/self-referential-4.rs index 697ec56825a..36742c8ad57 100644 --- a/src/test/ui/type-alias-impl-trait/self-referential-4.rs +++ b/src/test/ui/type-alias-impl-trait/self-referential-4.rs @@ -3,19 +3,19 @@ type Bar<'a, 'b> = impl PartialEq<Bar<'b, 'static>> + std::fmt::Debug; fn bar<'a, 'b>(i: &'a i32) -> Bar<'a, 'b> { - i //~ ERROR can't compare `&i32` with `Bar<'b, 'static>` + i //~^ ERROR can't compare `&i32` with `Bar<'b, 'static>` } type Foo<'a, 'b> = impl PartialEq<Foo<'static, 'b>> + std::fmt::Debug; fn foo<'a, 'b>(i: &'a i32) -> Foo<'a, 'b> { - i //~ ERROR can't compare `&i32` with `Foo<'static, 'b>` + i //~^ ERROR can't compare `&i32` with `Foo<'static, 'b>` } type Moo<'a, 'b> = impl PartialEq<Moo<'static, 'a>> + std::fmt::Debug; fn moo<'a, 'b>(i: &'a i32) -> Moo<'a, 'b> { - i //~ ERROR can't compare `&i32` with `Moo<'static, 'a>` + i //~^ ERROR can't compare `&i32` with `Moo<'static, 'a>` } fn main() { diff --git a/src/test/ui/type-alias-impl-trait/self-referential-4.stderr b/src/test/ui/type-alias-impl-trait/self-referential-4.stderr index 83826479419..27880f792f4 100644 --- a/src/test/ui/type-alias-impl-trait/self-referential-4.stderr +++ b/src/test/ui/type-alias-impl-trait/self-referential-4.stderr @@ -1,8 +1,10 @@ error[E0277]: can't compare `&i32` with `Bar<'b, 'static>` - --> $DIR/self-referential-4.rs:6:5 + --> $DIR/self-referential-4.rs:5:31 | +LL | fn bar<'a, 'b>(i: &'a i32) -> Bar<'a, 'b> { + | ^^^^^^^^^^^ no implementation for `&i32 == Bar<'b, 'static>` LL | i - | ^ no implementation for `&i32 == Bar<'b, 'static>` + | - return type was inferred to be `&i32` here | = help: the trait `PartialEq<Bar<'b, 'static>>` is not implemented for `&i32` = help: the following other types implement trait `PartialEq<Rhs>`: @@ -17,10 +19,12 @@ LL | i and 6 others error[E0277]: can't compare `&i32` with `Foo<'static, 'b>` - --> $DIR/self-referential-4.rs:12:5 + --> $DIR/self-referential-4.rs:11:31 | +LL | fn foo<'a, 'b>(i: &'a i32) -> Foo<'a, 'b> { + | ^^^^^^^^^^^ no implementation for `&i32 == Foo<'static, 'b>` LL | i - | ^ no implementation for `&i32 == Foo<'static, 'b>` + | - return type was inferred to be `&i32` here | = help: the trait `PartialEq<Foo<'static, 'b>>` is not implemented for `&i32` = help: the following other types implement trait `PartialEq<Rhs>`: @@ -35,10 +39,12 @@ LL | i and 6 others error[E0277]: can't compare `&i32` with `Moo<'static, 'a>` - --> $DIR/self-referential-4.rs:18:5 + --> $DIR/self-referential-4.rs:17:31 | +LL | fn moo<'a, 'b>(i: &'a i32) -> Moo<'a, 'b> { + | ^^^^^^^^^^^ no implementation for `&i32 == Moo<'static, 'a>` LL | i - | ^ no implementation for `&i32 == Moo<'static, 'a>` + | - return type was inferred to be `&i32` here | = help: the trait `PartialEq<Moo<'static, 'a>>` is not implemented for `&i32` = help: the following other types implement trait `PartialEq<Rhs>`: diff --git a/src/test/ui/type-alias-impl-trait/self-referential.rs b/src/test/ui/type-alias-impl-trait/self-referential.rs index 4974ac72dad..3ff5406a382 100644 --- a/src/test/ui/type-alias-impl-trait/self-referential.rs +++ b/src/test/ui/type-alias-impl-trait/self-referential.rs @@ -3,19 +3,22 @@ type Bar<'a, 'b> = impl PartialEq<Bar<'b, 'a>> + std::fmt::Debug; fn bar<'a, 'b>(i: &'a i32) -> Bar<'a, 'b> { - i //~ ERROR can't compare `&i32` with `Bar<'b, 'a>` + //~^ ERROR can't compare `&i32` with `Bar<'b, 'a>` + i } type Foo<'a, 'b> = (i32, impl PartialEq<Foo<'a, 'b>> + std::fmt::Debug); fn foo<'a, 'b>(i: &'a i32) -> Foo<'a, 'b> { - (42, i) //~ ERROR can't compare `&i32` with `(i32, &i32)` + //~^ ERROR can't compare `&i32` with `(i32, &i32)` + (42, i) } type Moo<'a, 'b> = (i32, impl PartialEq<Moo<'b, 'a>> + std::fmt::Debug); fn moo<'a, 'b>(i: &'a i32) -> Moo<'a, 'b> { - (42, i) //~ ERROR can't compare `&i32` with `(i32, Moo<'b, 'a>::{opaque#0})` + //~^ ERROR can't compare `&i32` with `(i32, Moo<'b, 'a>::{opaque#0})` + (42, i) } fn main() { diff --git a/src/test/ui/type-alias-impl-trait/self-referential.stderr b/src/test/ui/type-alias-impl-trait/self-referential.stderr index 2ebb15b8803..97d510f6830 100644 --- a/src/test/ui/type-alias-impl-trait/self-referential.stderr +++ b/src/test/ui/type-alias-impl-trait/self-referential.stderr @@ -1,8 +1,11 @@ error[E0277]: can't compare `&i32` with `Bar<'b, 'a>` - --> $DIR/self-referential.rs:6:5 + --> $DIR/self-referential.rs:5:31 | +LL | fn bar<'a, 'b>(i: &'a i32) -> Bar<'a, 'b> { + | ^^^^^^^^^^^ no implementation for `&i32 == Bar<'b, 'a>` +LL | LL | i - | ^ no implementation for `&i32 == Bar<'b, 'a>` + | - return type was inferred to be `&i32` here | = help: the trait `PartialEq<Bar<'b, 'a>>` is not implemented for `&i32` = help: the following other types implement trait `PartialEq<Rhs>`: @@ -17,10 +20,13 @@ LL | i and 6 others error[E0277]: can't compare `&i32` with `(i32, &i32)` - --> $DIR/self-referential.rs:12:10 + --> $DIR/self-referential.rs:12:31 | +LL | fn foo<'a, 'b>(i: &'a i32) -> Foo<'a, 'b> { + | ^^^^^^^^^^^ no implementation for `&i32 == (i32, &i32)` +LL | LL | (42, i) - | ^ no implementation for `&i32 == (i32, &i32)` + | ------- return type was inferred to be `(i32, &i32)` here | = help: the trait `PartialEq<(i32, &i32)>` is not implemented for `&i32` = help: the following other types implement trait `PartialEq<Rhs>`: @@ -35,10 +41,13 @@ LL | (42, i) and 6 others error[E0277]: can't compare `&i32` with `(i32, Moo<'b, 'a>::{opaque#0})` - --> $DIR/self-referential.rs:18:10 + --> $DIR/self-referential.rs:19:31 | +LL | fn moo<'a, 'b>(i: &'a i32) -> Moo<'a, 'b> { + | ^^^^^^^^^^^ no implementation for `&i32 == (i32, Moo<'b, 'a>::{opaque#0})` +LL | LL | (42, i) - | ^ no implementation for `&i32 == (i32, Moo<'b, 'a>::{opaque#0})` + | ------- return type was inferred to be `(i32, &i32)` here | = help: the trait `PartialEq<(i32, Moo<'b, 'a>::{opaque#0})>` is not implemented for `&i32` = help: the following other types implement trait `PartialEq<Rhs>`: diff --git a/src/test/ui/type/type-ascription-instead-of-initializer.stderr b/src/test/ui/type/type-ascription-instead-of-initializer.stderr index 18ed4986f89..fcac6c495c4 100644 --- a/src/test/ui/type/type-ascription-instead-of-initializer.stderr +++ b/src/test/ui/type/type-ascription-instead-of-initializer.stderr @@ -11,7 +11,7 @@ error[E0061]: this function takes 1 argument but 2 arguments were supplied --> $DIR/type-ascription-instead-of-initializer.rs:2:12 | LL | let x: Vec::with_capacity(10, 20); - | ^^^^^^^^^^^^^^^^^^ -- argument unexpected + | ^^^^^^^^^^^^^^^^^^ -- argument of type `{integer}` unexpected | note: associated function defined here --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL diff --git a/src/test/ui/type/type-ascription-precedence.stderr b/src/test/ui/type/type-ascription-precedence.stderr index ebce257b278..a8139063db1 100644 --- a/src/test/ui/type/type-ascription-precedence.stderr +++ b/src/test/ui/type/type-ascription-precedence.stderr @@ -32,18 +32,12 @@ note: an implementation of `std::ops::Neg` might be missing for `Z` --> $DIR/type-ascription-precedence.rs:9:1 | LL | struct Z; - | ^^^^^^^^^ must implement `std::ops::Neg` + | ^^^^^^^^ must implement `std::ops::Neg` note: the following trait must be implemented --> $SRC_DIR/core/src/ops/arith.rs:LL:COL | -LL | / pub trait Neg { -LL | | /// The resulting type after applying the `-` operator. -LL | | #[stable(feature = "rust1", since = "1.0.0")] -LL | | type Output; -... | -LL | | fn neg(self) -> Self::Output; -LL | | } - | |_^ +LL | pub trait Neg { + | ^^^^^^^^^^^^^ error[E0308]: mismatched types --> $DIR/type-ascription-precedence.rs:45:5 diff --git a/src/test/ui/type/type-check/cannot_infer_local_or_array.stderr b/src/test/ui/type/type-check/cannot_infer_local_or_array.stderr index d68d5e5d40b..e823bad2668 100644 --- a/src/test/ui/type/type-check/cannot_infer_local_or_array.stderr +++ b/src/test/ui/type/type-check/cannot_infer_local_or_array.stderr @@ -2,7 +2,7 @@ error[E0282]: type annotations needed for `[_; 0]` --> $DIR/cannot_infer_local_or_array.rs:2:9 | LL | let x = []; - | ^ + | ^ -- type must be known at this point | help: consider giving `x` an explicit type, where the placeholders `_` are specified | diff --git a/src/test/ui/type/type-check/issue-40294.stderr b/src/test/ui/type/type-check/issue-40294.stderr index 6d1e490bcf3..75feb5698eb 100644 --- a/src/test/ui/type/type-check/issue-40294.stderr +++ b/src/test/ui/type/type-check/issue-40294.stderr @@ -1,8 +1,8 @@ -error[E0283]: type annotations needed +error[E0283]: type annotations needed: cannot satisfy `&'a T: Foo` --> $DIR/issue-40294.rs:6:19 | LL | where &'a T : Foo, - | ^^^ cannot infer type for reference `&'a T` + | ^^^ | = note: cannot satisfy `&'a T: Foo` diff --git a/src/test/ui/type/type-parameter-defaults-referencing-Self.stderr b/src/test/ui/type/type-parameter-defaults-referencing-Self.stderr index ea259cf3d37..67a4745b399 100644 --- a/src/test/ui/type/type-parameter-defaults-referencing-Self.stderr +++ b/src/test/ui/type/type-parameter-defaults-referencing-Self.stderr @@ -1,13 +1,11 @@ error[E0393]: the type parameter `T` must be explicitly specified --> $DIR/type-parameter-defaults-referencing-Self.rs:8:16 | -LL | / trait Foo<T=Self> { -LL | | fn method(&self); -LL | | } - | |_- type parameter `T` must be specified for this -LL | -LL | fn foo(x: &dyn Foo) { } - | ^^^ help: set the type parameter to the desired type: `Foo<T>` +LL | trait Foo<T=Self> { + | ----------------- type parameter `T` must be specified for this +... +LL | fn foo(x: &dyn Foo) { } + | ^^^ help: set the type parameter to the desired type: `Foo<T>` | = note: because of the default `Self` reference, type parameters must be specified on object types diff --git a/src/test/ui/type/type-params-in-different-spaces-1.stderr b/src/test/ui/type/type-params-in-different-spaces-1.stderr index eeb09a9f02e..4e73e10a301 100644 --- a/src/test/ui/type/type-params-in-different-spaces-1.stderr +++ b/src/test/ui/type/type-params-in-different-spaces-1.stderr @@ -1,16 +1,12 @@ error[E0308]: mismatched types --> $DIR/type-params-in-different-spaces-1.rs:5:17 | -LL | / trait BrokenAdd: Copy + Add<Output=Self> { -LL | | fn broken_add<T>(&self, rhs: T) -> Self { - | | - found type parameter -LL | | *self + rhs - | | ^^^ expected type parameter `Self`, found type parameter `T` -LL | | -... | -LL | | } -LL | | } - | |_- expected type parameter +LL | trait BrokenAdd: Copy + Add<Output=Self> { + | ---------------------------------------- expected type parameter +LL | fn broken_add<T>(&self, rhs: T) -> Self { + | - found type parameter +LL | *self + rhs + | ^^^ expected type parameter `Self`, found type parameter `T` | = note: expected type parameter `Self` found type parameter `T` diff --git a/src/test/ui/type/type-params-in-different-spaces-3.stderr b/src/test/ui/type/type-params-in-different-spaces-3.stderr index 880c138d287..c538d67316c 100644 --- a/src/test/ui/type/type-params-in-different-spaces-3.stderr +++ b/src/test/ui/type/type-params-in-different-spaces-3.stderr @@ -1,16 +1,14 @@ error[E0308]: mismatched types --> $DIR/type-params-in-different-spaces-3.rs:3:9 | -LL | / trait Tr : Sized { -LL | | fn test<X>(u: X) -> Self { - | | - ---- expected `Self` because of return type - | | | - | | found type parameter -LL | | u - | | ^ expected type parameter `Self`, found type parameter `X` -LL | | } -LL | | } - | |_- expected type parameter +LL | trait Tr : Sized { + | ---------------- expected type parameter +LL | fn test<X>(u: X) -> Self { + | - ---- expected `Self` because of return type + | | + | found type parameter +LL | u + | ^ expected type parameter `Self`, found type parameter `X` | = note: expected type parameter `Self` found type parameter `X` diff --git a/src/test/ui/type/type-recursive.stderr b/src/test/ui/type/type-recursive.stderr index 04392f7390d..3202710286e 100644 --- a/src/test/ui/type/type-recursive.stderr +++ b/src/test/ui/type/type-recursive.stderr @@ -42,9 +42,8 @@ error[E0072]: recursive type `T4` has infinite size --> $DIR/type-recursive.rs:16:1 | LL | struct T4(Option<T4>); - | ^^^^^^^^^^----------^^ - | | | - | | recursive without indirection + | ^^^^^^^^^ ---------- recursive without indirection + | | | recursive type has infinite size | help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to make `T4` representable diff --git a/src/test/ui/type_length_limit.rs b/src/test/ui/type_length_limit.rs index c1f3acbecf9..ce6fdf81121 100644 --- a/src/test/ui/type_length_limit.rs +++ b/src/test/ui/type_length_limit.rs @@ -1,8 +1,10 @@ // build-fail // error-pattern: reached the type-length limit while instantiating +// compile-flags: -Copt-level=0 // normalize-stderr-test: ".nll/" -> "/" // Test that the type length limit can be changed. +// The exact type depends on optimizations, so disable them. #![allow(dead_code)] #![type_length_limit="4"] diff --git a/src/test/ui/typeck/issue-65611.stderr b/src/test/ui/typeck/issue-65611.stderr index 5f831291a38..003c630790d 100644 --- a/src/test/ui/typeck/issue-65611.stderr +++ b/src/test/ui/typeck/issue-65611.stderr @@ -3,8 +3,6 @@ error[E0282]: type annotations needed | LL | let x = buffer.last().unwrap().0.clone(); | ^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type for type parameter `T` - | - = note: type must be known at this point error[E0609]: no field `0` on type `&_` --> $DIR/issue-65611.rs:59:36 diff --git a/src/test/ui/typeck/issue-98260.rs b/src/test/ui/typeck/issue-98260.rs new file mode 100644 index 00000000000..cf48294e199 --- /dev/null +++ b/src/test/ui/typeck/issue-98260.rs @@ -0,0 +1,9 @@ +fn main() {} +trait A { + fn a(aa: B) -> Result<_, B> { + //~^ ERROR: the placeholder `_` is not allowed within types on item signatures for return types [E0121] + Ok(()) + } +} + +enum B {} diff --git a/src/test/ui/typeck/issue-98260.stderr b/src/test/ui/typeck/issue-98260.stderr new file mode 100644 index 00000000000..08a1d17e244 --- /dev/null +++ b/src/test/ui/typeck/issue-98260.stderr @@ -0,0 +1,12 @@ +error[E0121]: the placeholder `_` is not allowed within types on item signatures for return types + --> $DIR/issue-98260.rs:3:27 + | +LL | fn a(aa: B) -> Result<_, B> { + | -------^---- + | | | + | | not allowed in type signatures + | help: replace with the correct return type: `Result<(), B>` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0121`. diff --git a/src/test/ui/typeck/remove-extra-argument.stderr b/src/test/ui/typeck/remove-extra-argument.stderr index 815297765c1..703032a8322 100644 --- a/src/test/ui/typeck/remove-extra-argument.stderr +++ b/src/test/ui/typeck/remove-extra-argument.stderr @@ -2,7 +2,7 @@ error[E0061]: this function takes 1 argument but 2 arguments were supplied --> $DIR/remove-extra-argument.rs:6:5 | LL | l(vec![], vec![]) - | ^ ------ argument unexpected + | ^ ------ argument of type `Vec<_>` unexpected | note: function defined here --> $DIR/remove-extra-argument.rs:3:4 diff --git a/src/test/ui/typeck/struct-enum-wrong-args.stderr b/src/test/ui/typeck/struct-enum-wrong-args.stderr index 2ea822df275..f72082d5301 100644 --- a/src/test/ui/typeck/struct-enum-wrong-args.stderr +++ b/src/test/ui/typeck/struct-enum-wrong-args.stderr @@ -2,7 +2,7 @@ error[E0061]: this enum variant takes 1 argument but 2 arguments were supplied --> $DIR/struct-enum-wrong-args.rs:6:13 | LL | let _ = Some(3, 2); - | ^^^^ - argument unexpected + | ^^^^ - argument of type `{integer}` unexpected | note: tuple variant defined here --> $SRC_DIR/core/src/option.rs:LL:COL @@ -18,9 +18,9 @@ error[E0061]: this enum variant takes 1 argument but 3 arguments were supplied --> $DIR/struct-enum-wrong-args.rs:7:13 | LL | let _ = Ok(3, 6, 2); - | ^^ - - argument unexpected + | ^^ - - argument of type `{integer}` unexpected | | - | argument unexpected + | argument of type `{integer}` unexpected | note: tuple variant defined here --> $SRC_DIR/core/src/result.rs:LL:COL @@ -68,7 +68,7 @@ error[E0061]: this struct takes 1 argument but 2 arguments were supplied --> $DIR/struct-enum-wrong-args.rs:10:13 | LL | let _ = Wrapper(5, 2); - | ^^^^^^^ - argument unexpected + | ^^^^^^^ - argument of type `{integer}` unexpected | note: tuple struct defined here --> $DIR/struct-enum-wrong-args.rs:2:8 @@ -116,7 +116,7 @@ error[E0061]: this struct takes 2 arguments but 3 arguments were supplied --> $DIR/struct-enum-wrong-args.rs:13:13 | LL | let _ = DoubleWrapper(5, 2, 7); - | ^^^^^^^^^^^^^ - argument unexpected + | ^^^^^^^^^^^^^ - argument of type `{integer}` unexpected | note: tuple struct defined here --> $DIR/struct-enum-wrong-args.rs:3:8 diff --git a/src/test/ui/unboxed-closures/unboxed-closures-failed-recursive-fn-2.stderr b/src/test/ui/unboxed-closures/unboxed-closures-failed-recursive-fn-2.stderr index 666ab79b65c..ff2a597bed0 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-failed-recursive-fn-2.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closures-failed-recursive-fn-2.stderr @@ -3,8 +3,10 @@ error[E0282]: type annotations needed for `Option<T>` | LL | let mut closure0 = None; | ^^^^^^^^^^^^ +... +LL | return c(); + | --- type must be known at this point | - = note: type must be known at this point help: consider giving `closure0` an explicit type, where the placeholders `_` are specified | LL | let mut closure0: Option<T> = None; diff --git a/src/test/ui/uninhabited/uninhabited-matches-feature-gated.stderr b/src/test/ui/uninhabited/uninhabited-matches-feature-gated.stderr index 74216d265d0..2c107b1f7a4 100644 --- a/src/test/ui/uninhabited/uninhabited-matches-feature-gated.stderr +++ b/src/test/ui/uninhabited/uninhabited-matches-feature-gated.stderr @@ -7,15 +7,11 @@ LL | let _ = match x { note: `Result<u32, &Void>` defined here --> $SRC_DIR/core/src/result.rs:LL:COL | -LL | / pub enum Result<T, E> { -LL | | /// Contains the success value -LL | | #[lang = "Ok"] -LL | | #[stable(feature = "rust1", since = "1.0.0")] -... | -LL | | Err(#[stable(feature = "rust1", since = "1.0.0")] E), - | | ^^^ not covered -LL | | } - | |_- +LL | pub enum Result<T, E> { + | --------------------- +... +LL | Err(#[stable(feature = "rust1", since = "1.0.0")] E), + | ^^^ not covered = note: the matched value is of type `Result<u32, &Void>` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | @@ -93,15 +89,11 @@ LL | let _ = match x { note: `Result<u32, Void>` defined here --> $SRC_DIR/core/src/result.rs:LL:COL | -LL | / pub enum Result<T, E> { -LL | | /// Contains the success value -LL | | #[lang = "Ok"] -LL | | #[stable(feature = "rust1", since = "1.0.0")] -... | -LL | | Err(#[stable(feature = "rust1", since = "1.0.0")] E), - | | ^^^ not covered -LL | | } - | |_- +LL | pub enum Result<T, E> { + | --------------------- +... +LL | Err(#[stable(feature = "rust1", since = "1.0.0")] E), + | ^^^ not covered = note: the matched value is of type `Result<u32, Void>` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | @@ -120,15 +112,11 @@ LL | let Ok(x) = x; note: `Result<u32, Void>` defined here --> $SRC_DIR/core/src/result.rs:LL:COL | -LL | / pub enum Result<T, E> { -LL | | /// Contains the success value -LL | | #[lang = "Ok"] -LL | | #[stable(feature = "rust1", since = "1.0.0")] -... | -LL | | Err(#[stable(feature = "rust1", since = "1.0.0")] E), - | | ^^^ not covered -LL | | } - | |_- +LL | pub enum Result<T, E> { + | --------------------- +... +LL | Err(#[stable(feature = "rust1", since = "1.0.0")] E), + | ^^^ not covered = note: the matched value is of type `Result<u32, Void>` help: you might want to use `if let` to ignore the variant that isn't matched | diff --git a/src/test/ui/union/issue-81199.stderr b/src/test/ui/union/issue-81199.stderr index f26bfe3a0b0..5bb98675361 100644 --- a/src/test/ui/union/issue-81199.stderr +++ b/src/test/ui/union/issue-81199.stderr @@ -1,28 +1,18 @@ -error[E0277]: the trait bound `T: Pointee` is not satisfied in `PtrComponents<T>` +error[E0277]: the trait bound `T: Pointee` is not satisfied --> $DIR/issue-81199.rs:5:17 | LL | components: PtrComponents<T>, - | ^^^^^^^^^^^^^^^^ within `PtrComponents<T>`, the trait `Pointee` is not implemented for `T` + | ^^^^^^^^^^^^^^^^ the trait `Pointee` is not implemented for `T` | -note: required because it appears within the type `PtrComponents<T>` - --> $DIR/issue-81199.rs:10:8 +note: required by a bound in `PtrComponents` + --> $DIR/issue-81199.rs:10:25 | LL | struct PtrComponents<T: Pointee + ?Sized> { - | ^^^^^^^^^^^^^ - = note: no field of a union may have a dynamically sized type - = help: change the field's type to have a statically known size + | ^^^^^^^ required by this bound in `PtrComponents` help: consider further restricting this bound | LL | union PtrRepr<T: ?Sized + Pointee> { | +++++++++ -help: borrowed types always have a statically known size - | -LL | components: &PtrComponents<T>, - | + -help: the `Box` type always has a statically known size and allocates its contents in the heap - | -LL | components: Box<PtrComponents<T>>, - | ++++ + error: aborting due to previous error diff --git a/src/test/ui/union/union-derive-clone.mirunsafeck.stderr b/src/test/ui/union/union-derive-clone.mirunsafeck.stderr index b5c72aa5247..c277d5b761d 100644 --- a/src/test/ui/union/union-derive-clone.mirunsafeck.stderr +++ b/src/test/ui/union/union-derive-clone.mirunsafeck.stderr @@ -8,7 +8,7 @@ LL | union U5<T> { | doesn't satisfy `U5<CloneNoCopy>: Clone` ... LL | struct CloneNoCopy; - | ------------------- doesn't satisfy `CloneNoCopy: Copy` + | ------------------ doesn't satisfy `CloneNoCopy: Copy` ... LL | let w = u.clone(); | ^^^^^ method cannot be called on `U5<CloneNoCopy>` due to unsatisfied trait bounds diff --git a/src/test/ui/union/union-derive-clone.thirunsafeck.stderr b/src/test/ui/union/union-derive-clone.thirunsafeck.stderr index b5c72aa5247..c277d5b761d 100644 --- a/src/test/ui/union/union-derive-clone.thirunsafeck.stderr +++ b/src/test/ui/union/union-derive-clone.thirunsafeck.stderr @@ -8,7 +8,7 @@ LL | union U5<T> { | doesn't satisfy `U5<CloneNoCopy>: Clone` ... LL | struct CloneNoCopy; - | ------------------- doesn't satisfy `CloneNoCopy: Copy` + | ------------------ doesn't satisfy `CloneNoCopy: Copy` ... LL | let w = u.clone(); | ^^^^^ method cannot be called on `U5<CloneNoCopy>` due to unsatisfied trait bounds diff --git a/src/test/ui/union/union-fields-1.mirunsafeck.stderr b/src/test/ui/union/union-fields-1.mirunsafeck.stderr index 5b932b9626c..0c9981c69fc 100644 --- a/src/test/ui/union/union-fields-1.mirunsafeck.stderr +++ b/src/test/ui/union/union-fields-1.mirunsafeck.stderr @@ -5,7 +5,7 @@ LL | union U1 { | -- field in this union ... LL | c: u8, - | ^^^^^ + | ^ | note: the lint level is defined here --> $DIR/union-fields-1.rs:4:9 @@ -19,13 +19,13 @@ error: field `a` is never read LL | union U2 { | -- field in this union LL | a: u8, - | ^^^^^ + | ^ error: field `a` is never read --> $DIR/union-fields-1.rs:16:20 | LL | union NoDropLike { a: u8 } - | ---------- ^^^^^ + | ---------- ^ | | | field in this union @@ -36,7 +36,7 @@ LL | union U { | - field in this union ... LL | c: u8, - | ^^^^^ + | ^ error: aborting due to 4 previous errors diff --git a/src/test/ui/union/union-fields-1.thirunsafeck.stderr b/src/test/ui/union/union-fields-1.thirunsafeck.stderr index 5b932b9626c..0c9981c69fc 100644 --- a/src/test/ui/union/union-fields-1.thirunsafeck.stderr +++ b/src/test/ui/union/union-fields-1.thirunsafeck.stderr @@ -5,7 +5,7 @@ LL | union U1 { | -- field in this union ... LL | c: u8, - | ^^^^^ + | ^ | note: the lint level is defined here --> $DIR/union-fields-1.rs:4:9 @@ -19,13 +19,13 @@ error: field `a` is never read LL | union U2 { | -- field in this union LL | a: u8, - | ^^^^^ + | ^ error: field `a` is never read --> $DIR/union-fields-1.rs:16:20 | LL | union NoDropLike { a: u8 } - | ---------- ^^^^^ + | ---------- ^ | | | field in this union @@ -36,7 +36,7 @@ LL | union U { | - field in this union ... LL | c: u8, - | ^^^^^ + | ^ error: aborting due to 4 previous errors diff --git a/src/test/ui/union/union-lint-dead-code.mirunsafeck.stderr b/src/test/ui/union/union-lint-dead-code.mirunsafeck.stderr index f6e515f8400..6e21584c37c 100644 --- a/src/test/ui/union/union-lint-dead-code.mirunsafeck.stderr +++ b/src/test/ui/union/union-lint-dead-code.mirunsafeck.stderr @@ -5,7 +5,7 @@ LL | union Foo { | --- field in this union LL | x: usize, LL | b: bool, - | ^^^^^^^ + | ^ | note: the lint level is defined here --> $DIR/union-lint-dead-code.rs:4:9 diff --git a/src/test/ui/union/union-lint-dead-code.thirunsafeck.stderr b/src/test/ui/union/union-lint-dead-code.thirunsafeck.stderr index f6e515f8400..6e21584c37c 100644 --- a/src/test/ui/union/union-lint-dead-code.thirunsafeck.stderr +++ b/src/test/ui/union/union-lint-dead-code.thirunsafeck.stderr @@ -5,7 +5,7 @@ LL | union Foo { | --- field in this union LL | x: usize, LL | b: bool, - | ^^^^^^^ + | ^ | note: the lint level is defined here --> $DIR/union-lint-dead-code.rs:4:9 diff --git a/src/test/ui/union/union-repr-c.stderr b/src/test/ui/union/union-repr-c.stderr index ae84cc7811b..9abf440f735 100644 --- a/src/test/ui/union/union-repr-c.stderr +++ b/src/test/ui/union/union-repr-c.stderr @@ -14,10 +14,8 @@ LL | #![deny(improper_ctypes)] note: the type is defined here --> $DIR/union-repr-c.rs:9:1 | -LL | / union W { -LL | | a: u8, -LL | | } - | |_^ +LL | union W { + | ^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/unique-object-noncopyable.stderr b/src/test/ui/unique-object-noncopyable.stderr index 5c40787febf..98a9bd07ed2 100644 --- a/src/test/ui/unique-object-noncopyable.stderr +++ b/src/test/ui/unique-object-noncopyable.stderr @@ -16,7 +16,7 @@ LL | / pub struct Box< LL | | T: ?Sized, LL | | #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global, LL | | >(Unique<T>, A); - | |________________- doesn't satisfy `Box<dyn Foo>: Clone` + | |_- doesn't satisfy `Box<dyn Foo>: Clone` | = note: the following trait bounds were not satisfied: `dyn Foo: Sized` diff --git a/src/test/ui/unique-pinned-nocopy.stderr b/src/test/ui/unique-pinned-nocopy.stderr index 02ce371c8d5..7af9c684b72 100644 --- a/src/test/ui/unique-pinned-nocopy.stderr +++ b/src/test/ui/unique-pinned-nocopy.stderr @@ -13,7 +13,7 @@ LL | / pub struct Box< LL | | T: ?Sized, LL | | #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global, LL | | >(Unique<T>, A); - | |________________- doesn't satisfy `Box<R>: Clone` + | |_- doesn't satisfy `Box<R>: Clone` | = note: the following trait bounds were not satisfied: `R: Clone` diff --git a/src/test/ui/unop-move-semantics.stderr b/src/test/ui/unop-move-semantics.stderr index 14052486cbb..65d866c716e 100644 --- a/src/test/ui/unop-move-semantics.stderr +++ b/src/test/ui/unop-move-semantics.stderr @@ -46,13 +46,25 @@ error[E0507]: cannot move out of `*m` which is behind a mutable reference --> $DIR/unop-move-semantics.rs:24:6 | LL | !*m; - | ^^ move occurs because `*m` has type `T`, which does not implement the `Copy` trait + | -^^ + | || + | |move occurs because `*m` has type `T`, which does not implement the `Copy` trait + | `*m` moved due to usage in operator + | +note: calling this operator moves the left-hand side + --> $SRC_DIR/core/src/ops/bit.rs:LL:COL + | +LL | fn not(self) -> Self::Output; + | ^^^^ error[E0507]: cannot move out of `*n` which is behind a shared reference --> $DIR/unop-move-semantics.rs:26:6 | LL | !*n; - | ^^ move occurs because `*n` has type `T`, which does not implement the `Copy` trait + | -^^ + | || + | |move occurs because `*n` has type `T`, which does not implement the `Copy` trait + | `*n` moved due to usage in operator error: aborting due to 5 previous errors diff --git a/src/test/ui/unsized/return-unsized-from-trait-method.rs b/src/test/ui/unsized/return-unsized-from-trait-method.rs index ebe6edd1010..f053f4b0af8 100644 --- a/src/test/ui/unsized/return-unsized-from-trait-method.rs +++ b/src/test/ui/unsized/return-unsized-from-trait-method.rs @@ -7,7 +7,7 @@ trait Foo { fn foo(f: Option<&dyn Foo>) { if let Some(f) = f { let _ = f.foo(); - //~^ ERROR cannot move a value of type [u8]: the size of [u8] cannot be statically determined + //~^ ERROR cannot move a value of type `[u8]` } } diff --git a/src/test/ui/unsized/return-unsized-from-trait-method.stderr b/src/test/ui/unsized/return-unsized-from-trait-method.stderr index 4dd7cf5e02f..671d409937c 100644 --- a/src/test/ui/unsized/return-unsized-from-trait-method.stderr +++ b/src/test/ui/unsized/return-unsized-from-trait-method.stderr @@ -1,8 +1,8 @@ -error[E0161]: cannot move a value of type [u8]: the size of [u8] cannot be statically determined +error[E0161]: cannot move a value of type `[u8]` --> $DIR/return-unsized-from-trait-method.rs:9:17 | LL | let _ = f.foo(); - | ^^^^^^^ + | ^^^^^^^ the size of `[u8]` cannot be statically determined error: aborting due to previous error diff --git a/src/test/ui/unsized/unsized-fn-param.stderr b/src/test/ui/unsized/unsized-fn-param.stderr index 3eecca0fa09..0221ef16b49 100644 --- a/src/test/ui/unsized/unsized-fn-param.stderr +++ b/src/test/ui/unsized/unsized-fn-param.stderr @@ -2,10 +2,12 @@ error[E0277]: the size for values of type `str` cannot be known at compilation t --> $DIR/unsized-fn-param.rs:11:11 | LL | foo11("bar", &"baz"); - | ^^^^^ doesn't have a size known at compile-time + | ----- ^^^^^ doesn't have a size known at compile-time + | | + | required by a bound introduced by this call | = help: the trait `Sized` is not implemented for `str` - = note: required for the cast to the object type `dyn AsRef<Path>` + = note: required for the cast from `str` to the object type `dyn AsRef<Path>` help: consider borrowing the value, since `&str` can be coerced into `dyn AsRef<Path>` | LL | foo11(&"bar", &"baz"); @@ -15,10 +17,12 @@ error[E0277]: the size for values of type `str` cannot be known at compilation t --> $DIR/unsized-fn-param.rs:13:19 | LL | foo12(&"bar", "baz"); - | ^^^^^ doesn't have a size known at compile-time + | ----- ^^^^^ doesn't have a size known at compile-time + | | + | required by a bound introduced by this call | = help: the trait `Sized` is not implemented for `str` - = note: required for the cast to the object type `dyn AsRef<Path>` + = note: required for the cast from `str` to the object type `dyn AsRef<Path>` help: consider borrowing the value, since `&str` can be coerced into `dyn AsRef<Path>` | LL | foo12(&"bar", &"baz"); @@ -28,10 +32,12 @@ error[E0277]: the size for values of type `str` cannot be known at compilation t --> $DIR/unsized-fn-param.rs:16:11 | LL | foo21("bar", &"baz"); - | ^^^^^ doesn't have a size known at compile-time + | ----- ^^^^^ doesn't have a size known at compile-time + | | + | required by a bound introduced by this call | = help: the trait `Sized` is not implemented for `str` - = note: required for the cast to the object type `dyn AsRef<str>` + = note: required for the cast from `str` to the object type `dyn AsRef<str>` help: consider borrowing the value, since `&str` can be coerced into `dyn AsRef<str>` | LL | foo21(&"bar", &"baz"); @@ -41,10 +47,12 @@ error[E0277]: the size for values of type `str` cannot be known at compilation t --> $DIR/unsized-fn-param.rs:18:19 | LL | foo22(&"bar", "baz"); - | ^^^^^ doesn't have a size known at compile-time + | ----- ^^^^^ doesn't have a size known at compile-time + | | + | required by a bound introduced by this call | = help: the trait `Sized` is not implemented for `str` - = note: required for the cast to the object type `dyn AsRef<str>` + = note: required for the cast from `str` to the object type `dyn AsRef<str>` help: consider borrowing the value, since `&str` can be coerced into `dyn AsRef<str>` | LL | foo22(&"bar", &"baz"); diff --git a/src/test/ui/unsized/unsized3.rs b/src/test/ui/unsized/unsized3.rs index 39b6583bc4e..af76aca2c29 100644 --- a/src/test/ui/unsized/unsized3.rs +++ b/src/test/ui/unsized/unsized3.rs @@ -44,6 +44,7 @@ fn f9<X: ?Sized>(x1: Box<S<X>>) { fn f10<X: ?Sized>(x1: Box<S<X>>) { f5(&(32, *x1)); //~^ ERROR the size for values of type + //~| ERROR the size for values of type } pub fn main() {} diff --git a/src/test/ui/unsized/unsized3.stderr b/src/test/ui/unsized/unsized3.stderr index 65bdc4c2ea3..d64091b15eb 100644 --- a/src/test/ui/unsized/unsized3.stderr +++ b/src/test/ui/unsized/unsized3.stderr @@ -101,6 +101,29 @@ LL + fn f9<X>(x1: Box<S<X>>) { | error[E0277]: the size for values of type `X` cannot be known at compilation time + --> $DIR/unsized3.rs:45:9 + | +LL | fn f10<X: ?Sized>(x1: Box<S<X>>) { + | - this type parameter needs to be `std::marker::Sized` +LL | f5(&(32, *x1)); + | -- ^^^^^^^^^ doesn't have a size known at compile-time + | | + | required by a bound introduced by this call + | +note: required because it appears within the type `S<X>` + --> $DIR/unsized3.rs:28:8 + | +LL | struct S<X: ?Sized> { + | ^ + = note: required because it appears within the type `({integer}, S<X>)` + = note: tuples must have a statically known size to be initialized +help: consider removing the `?Sized` bound to make the type parameter `Sized` + | +LL - fn f10<X: ?Sized>(x1: Box<S<X>>) { +LL + fn f10<X>(x1: Box<S<X>>) { + | + +error[E0277]: the size for values of type `X` cannot be known at compilation time --> $DIR/unsized3.rs:45:8 | LL | fn f10<X: ?Sized>(x1: Box<S<X>>) { @@ -116,13 +139,21 @@ note: required because it appears within the type `S<X>` LL | struct S<X: ?Sized> { | ^ = note: required because it appears within the type `({integer}, S<X>)` - = note: tuples must have a statically known size to be initialized +note: required by a bound in `f5` + --> $DIR/unsized3.rs:24:7 + | +LL | fn f5<Y>(x: &Y) {} + | ^ required by this bound in `f5` help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - fn f10<X: ?Sized>(x1: Box<S<X>>) { LL + fn f10<X>(x1: Box<S<X>>) { | +help: consider relaxing the implicit `Sized` restriction + | +LL | fn f5<Y: ?Sized>(x: &Y) {} + | ++++++++ -error: aborting due to 5 previous errors +error: aborting due to 6 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/unspecified-self-in-trait-ref.stderr b/src/test/ui/unspecified-self-in-trait-ref.stderr index 2ba92187157..7869176bb3a 100644 --- a/src/test/ui/unspecified-self-in-trait-ref.stderr +++ b/src/test/ui/unspecified-self-in-trait-ref.stderr @@ -91,13 +91,11 @@ LL | let e = <dyn Bar::<usize>>::lol(); error[E0393]: the type parameter `A` must be explicitly specified --> $DIR/unspecified-self-in-trait-ref.rs:26:13 | -LL | / pub trait Bar<X=usize, A=Self> { -LL | | fn foo(&self); -LL | | } - | |_- type parameter `A` must be specified for this +LL | pub trait Bar<X=usize, A=Self> { + | ------------------------------ type parameter `A` must be specified for this ... -LL | let e = Bar::<usize>::lol(); - | ^^^^^^^^^^^^ missing reference to `A` +LL | let e = Bar::<usize>::lol(); + | ^^^^^^^^^^^^ missing reference to `A` | = note: because of the default `Self` reference, type parameters must be specified on object types diff --git a/src/test/ui/unwind-abis/feature-gate-c-unwind.rs b/src/test/ui/unwind-abis/feature-gate-c-unwind.rs index f02a368d4e0..ba72f74f20c 100644 --- a/src/test/ui/unwind-abis/feature-gate-c-unwind.rs +++ b/src/test/ui/unwind-abis/feature-gate-c-unwind.rs @@ -1,6 +1,10 @@ // Test that the "C-unwind" ABI is feature-gated, and cannot be used when the // `c_unwind` feature gate is not used. +#![allow(ffi_unwind_calls)] +//~^ WARNING unknown lint: `ffi_unwind_calls` +//~| WARNING unknown lint: `ffi_unwind_calls` + extern "C-unwind" fn f() {} //~^ ERROR C-unwind ABI is experimental and subject to change [E0658] diff --git a/src/test/ui/unwind-abis/feature-gate-c-unwind.stderr b/src/test/ui/unwind-abis/feature-gate-c-unwind.stderr index f4c785a235f..a67f46cd2e3 100644 --- a/src/test/ui/unwind-abis/feature-gate-c-unwind.stderr +++ b/src/test/ui/unwind-abis/feature-gate-c-unwind.stderr @@ -1,5 +1,16 @@ +warning: unknown lint: `ffi_unwind_calls` + --> $DIR/feature-gate-c-unwind.rs:4:1 + | +LL | #![allow(ffi_unwind_calls)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: `#[warn(unknown_lints)]` on by default + = note: the `ffi_unwind_calls` lint is unstable + = note: see issue #74990 <https://github.com/rust-lang/rust/issues/74990> for more information + = help: add `#![feature(c_unwind)]` to the crate attributes to enable + error[E0658]: C-unwind ABI is experimental and subject to change - --> $DIR/feature-gate-c-unwind.rs:4:8 + --> $DIR/feature-gate-c-unwind.rs:8:8 | LL | extern "C-unwind" fn f() {} | ^^^^^^^^^^ @@ -7,6 +18,16 @@ LL | extern "C-unwind" fn f() {} = note: see issue #74990 <https://github.com/rust-lang/rust/issues/74990> for more information = help: add `#![feature(c_unwind)]` to the crate attributes to enable -error: aborting due to previous error +warning: unknown lint: `ffi_unwind_calls` + --> $DIR/feature-gate-c-unwind.rs:4:1 + | +LL | #![allow(ffi_unwind_calls)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: the `ffi_unwind_calls` lint is unstable + = note: see issue #74990 <https://github.com/rust-lang/rust/issues/74990> for more information + = help: add `#![feature(c_unwind)]` to the crate attributes to enable + +error: aborting due to previous error; 2 warnings emitted For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/unwind-abis/ffi-unwind-calls-lint.rs b/src/test/ui/unwind-abis/ffi-unwind-calls-lint.rs new file mode 100644 index 00000000000..dadf4b12187 --- /dev/null +++ b/src/test/ui/unwind-abis/ffi-unwind-calls-lint.rs @@ -0,0 +1,27 @@ +// build-pass +// needs-unwind +// ignore-wasm32-bare compiled with panic=abort by default + +#![feature(c_unwind)] +#![warn(ffi_unwind_calls)] + +mod foo { + #[no_mangle] + pub extern "C-unwind" fn foo() {} +} + +extern "C-unwind" { + fn foo(); +} + +fn main() { + // Call to Rust function is fine. + foo::foo(); + // Call to foreign function should warn. + unsafe { foo(); } + //~^ WARNING call to foreign function with FFI-unwind ABI + let ptr: extern "C-unwind" fn() = foo::foo; + // Call to function pointer should also warn. + ptr(); + //~^ WARNING call to function pointer with FFI-unwind ABI +} diff --git a/src/test/ui/unwind-abis/ffi-unwind-calls-lint.stderr b/src/test/ui/unwind-abis/ffi-unwind-calls-lint.stderr new file mode 100644 index 00000000000..ed41cb74623 --- /dev/null +++ b/src/test/ui/unwind-abis/ffi-unwind-calls-lint.stderr @@ -0,0 +1,20 @@ +warning: call to foreign function with FFI-unwind ABI + --> $DIR/ffi-unwind-calls-lint.rs:21:14 + | +LL | unsafe { foo(); } + | ^^^^^ call to foreign function with FFI-unwind ABI + | +note: the lint level is defined here + --> $DIR/ffi-unwind-calls-lint.rs:6:9 + | +LL | #![warn(ffi_unwind_calls)] + | ^^^^^^^^^^^^^^^^ + +warning: call to function pointer with FFI-unwind ABI + --> $DIR/ffi-unwind-calls-lint.rs:25:5 + | +LL | ptr(); + | ^^^^^ call to function pointer with FFI-unwind ABI + +warning: 2 warnings emitted + diff --git a/src/test/ui/use/use-from-trait-xc.stderr b/src/test/ui/use/use-from-trait-xc.stderr index 14523afbdac..4c4c2f6225f 100644 --- a/src/test/ui/use/use-from-trait-xc.stderr +++ b/src/test/ui/use/use-from-trait-xc.stderr @@ -50,7 +50,7 @@ note: the struct `Foo` is defined here --> $DIR/auxiliary/use-from-trait-xc.rs:9:1 | LL | struct Foo; - | ^^^^^^^^^^^ + | ^^^^^^^^^^ error[E0603]: struct `Foo` is private --> $DIR/use-from-trait-xc.rs:17:24 @@ -62,7 +62,7 @@ note: the struct `Foo` is defined here --> $DIR/auxiliary/use-from-trait-xc.rs:9:1 | LL | struct Foo; - | ^^^^^^^^^^^ + | ^^^^^^^^^^ error: aborting due to 9 previous errors diff --git a/src/test/ui/variance/variance-associated-consts.stderr b/src/test/ui/variance/variance-associated-consts.stderr index d1bf34781df..219f5bca9e3 100644 --- a/src/test/ui/variance/variance-associated-consts.stderr +++ b/src/test/ui/variance/variance-associated-consts.stderr @@ -1,10 +1,8 @@ error[E0208]: [o] --> $DIR/variance-associated-consts.rs:13:1 | -LL | / struct Foo<T: Trait> { -LL | | field: [u8; <T as Trait>::Const] -LL | | } - | |_^ +LL | struct Foo<T: Trait> { + | ^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/variance/variance-associated-types.stderr b/src/test/ui/variance/variance-associated-types.stderr index b9aa9695f62..94f770eda33 100644 --- a/src/test/ui/variance/variance-associated-types.stderr +++ b/src/test/ui/variance/variance-associated-types.stderr @@ -1,18 +1,14 @@ error[E0208]: [-, +] --> $DIR/variance-associated-types.rs:13:1 | -LL | / struct Foo<'a, T : Trait<'a>> { -LL | | field: (T, &'a ()) -LL | | } - | |_^ +LL | struct Foo<'a, T : Trait<'a>> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0208]: [o, o] --> $DIR/variance-associated-types.rs:18:1 | -LL | / struct Bar<'a, T : Trait<'a>> { -LL | | field: <T as Trait<'a>>::Type -LL | | } - | |_^ +LL | struct Bar<'a, T : Trait<'a>> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/variance/variance-object-types.stderr b/src/test/ui/variance/variance-object-types.stderr index 2a5d8f91e1e..ceee53aff10 100644 --- a/src/test/ui/variance/variance-object-types.stderr +++ b/src/test/ui/variance/variance-object-types.stderr @@ -1,10 +1,8 @@ error[E0208]: [o] --> $DIR/variance-object-types.rs:7:1 | -LL | / struct Foo<'a> { -LL | | x: Box<dyn Fn(i32) -> &'a i32 + 'static> -LL | | } - | |_^ +LL | struct Foo<'a> { + | ^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/variance/variance-regions-direct.stderr b/src/test/ui/variance/variance-regions-direct.stderr index 8c9c89955bd..25fb2273215 100644 --- a/src/test/ui/variance/variance-regions-direct.stderr +++ b/src/test/ui/variance/variance-regions-direct.stderr @@ -1,64 +1,44 @@ error[E0208]: [-, -, -] --> $DIR/variance-regions-direct.rs:9:1 | -LL | / struct Test2<'a, 'b, 'c> { -LL | | x: &'a isize, -LL | | y: &'b [isize], -LL | | c: &'c str -LL | | } - | |_^ +LL | struct Test2<'a, 'b, 'c> { + | ^^^^^^^^^^^^^^^^^^^^^^^^ error[E0208]: [+, +, +] --> $DIR/variance-regions-direct.rs:18:1 | -LL | / struct Test3<'a, 'b, 'c> { -LL | | x: extern "Rust" fn(&'a isize), -LL | | y: extern "Rust" fn(&'b [isize]), -LL | | c: extern "Rust" fn(&'c str), -LL | | } - | |_^ +LL | struct Test3<'a, 'b, 'c> { + | ^^^^^^^^^^^^^^^^^^^^^^^^ error[E0208]: [-, o] --> $DIR/variance-regions-direct.rs:27:1 | -LL | / struct Test4<'a, 'b:'a> { -LL | | x: &'a mut &'b isize, -LL | | } - | |_^ +LL | struct Test4<'a, 'b:'a> { + | ^^^^^^^^^^^^^^^^^^^^^^^ error[E0208]: [+, o] --> $DIR/variance-regions-direct.rs:35:1 | -LL | / struct Test5<'a, 'b:'a> { -LL | | x: extern "Rust" fn(&'a mut &'b isize), -LL | | } - | |_^ +LL | struct Test5<'a, 'b:'a> { + | ^^^^^^^^^^^^^^^^^^^^^^^ error[E0208]: [-, o] --> $DIR/variance-regions-direct.rs:45:1 | -LL | / struct Test6<'a, 'b:'a> { -LL | | x: &'a mut extern "Rust" fn(&'b isize), -LL | | } - | |_^ +LL | struct Test6<'a, 'b:'a> { + | ^^^^^^^^^^^^^^^^^^^^^^^ error[E0208]: [*] --> $DIR/variance-regions-direct.rs:52:1 | -LL | / struct Test7<'a> { -LL | | x: isize -LL | | } - | |_^ +LL | struct Test7<'a> { + | ^^^^^^^^^^^^^^^^ error[E0208]: [+, -, o] --> $DIR/variance-regions-direct.rs:59:1 | -LL | / enum Test8<'a, 'b, 'c:'b> { -LL | | Test8A(extern "Rust" fn(&'a isize)), -LL | | Test8B(&'b [isize]), -LL | | Test8C(&'b mut &'c str), -LL | | } - | |_^ +LL | enum Test8<'a, 'b, 'c:'b> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 7 previous errors diff --git a/src/test/ui/variance/variance-regions-indirect.stderr b/src/test/ui/variance/variance-regions-indirect.stderr index 17efc6231d5..fc52492d7ef 100644 --- a/src/test/ui/variance/variance-regions-indirect.stderr +++ b/src/test/ui/variance/variance-regions-indirect.stderr @@ -1,44 +1,32 @@ error[E0208]: [+, -, o, *] --> $DIR/variance-regions-indirect.rs:8:1 | -LL | / enum Base<'a, 'b, 'c:'b, 'd> { -LL | | Test8A(extern "Rust" fn(&'a isize)), -LL | | Test8B(&'b [isize]), -LL | | Test8C(&'b mut &'c str), -LL | | } - | |_^ +LL | enum Base<'a, 'b, 'c:'b, 'd> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0208]: [*, o, -, +] --> $DIR/variance-regions-indirect.rs:15:1 | -LL | / struct Derived1<'w, 'x:'y, 'y, 'z> { -LL | | f: Base<'z, 'y, 'x, 'w> -LL | | } - | |_^ +LL | struct Derived1<'w, 'x:'y, 'y, 'z> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0208]: [o, o, *] --> $DIR/variance-regions-indirect.rs:20:1 | -LL | / struct Derived2<'a, 'b:'a, 'c> { -LL | | f: Base<'a, 'a, 'b, 'c> -LL | | } - | |_^ +LL | struct Derived2<'a, 'b:'a, 'c> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0208]: [o, -, *] --> $DIR/variance-regions-indirect.rs:25:1 | -LL | / struct Derived3<'a:'b, 'b, 'c> { -LL | | f: Base<'a, 'b, 'a, 'c> -LL | | } - | |_^ +LL | struct Derived3<'a:'b, 'b, 'c> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0208]: [+, -, o] --> $DIR/variance-regions-indirect.rs:30:1 | -LL | / struct Derived4<'a, 'b, 'c:'b> { -LL | | f: Base<'a, 'b, 'c, 'a> -LL | | } - | |_^ +LL | struct Derived4<'a, 'b, 'c:'b> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 5 previous errors diff --git a/src/test/ui/variance/variance-trait-bounds.stderr b/src/test/ui/variance/variance-trait-bounds.stderr index 98bc1b003c3..e3ef339f423 100644 --- a/src/test/ui/variance/variance-trait-bounds.stderr +++ b/src/test/ui/variance/variance-trait-bounds.stderr @@ -1,34 +1,26 @@ error[E0208]: [+, +] --> $DIR/variance-trait-bounds.rs:16:1 | -LL | / struct TestStruct<U,T:Setter<U>> { -LL | | t: T, u: U -LL | | } - | |_^ +LL | struct TestStruct<U,T:Setter<U>> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0208]: [*, +] --> $DIR/variance-trait-bounds.rs:21:1 | -LL | / enum TestEnum<U,T:Setter<U>> { -LL | | Foo(T) -LL | | } - | |_^ +LL | enum TestEnum<U,T:Setter<U>> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0208]: [*, +] --> $DIR/variance-trait-bounds.rs:26:1 | -LL | / struct TestContraStruct<U,T:Setter<U>> { -LL | | t: T -LL | | } - | |_^ +LL | struct TestContraStruct<U,T:Setter<U>> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0208]: [*, +] --> $DIR/variance-trait-bounds.rs:31:1 | -LL | / struct TestBox<U,T:Getter<U>+Setter<U>> { -LL | | t: T -LL | | } - | |_^ +LL | struct TestBox<U,T:Getter<U>+Setter<U>> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 4 previous errors diff --git a/src/test/ui/variance/variance-trait-object-bound.stderr b/src/test/ui/variance/variance-trait-object-bound.stderr index fb0fab1950c..c86cf1f82b4 100644 --- a/src/test/ui/variance/variance-trait-object-bound.stderr +++ b/src/test/ui/variance/variance-trait-object-bound.stderr @@ -1,10 +1,8 @@ error[E0208]: [-] --> $DIR/variance-trait-object-bound.rs:14:1 | -LL | / struct TOption<'a> { -LL | | v: Option<Box<dyn T + 'a>>, -LL | | } - | |_^ +LL | struct TOption<'a> { + | ^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/variance/variance-types-bounds.stderr b/src/test/ui/variance/variance-types-bounds.stderr index 5cffdffc7f2..dbe8af75d51 100644 --- a/src/test/ui/variance/variance-types-bounds.stderr +++ b/src/test/ui/variance/variance-types-bounds.stderr @@ -1,46 +1,32 @@ error[E0208]: [+, +] --> $DIR/variance-types-bounds.rs:7:1 | -LL | / struct TestImm<A, B> { -LL | | x: A, -LL | | y: B, -LL | | } - | |_^ +LL | struct TestImm<A, B> { + | ^^^^^^^^^^^^^^^^^^^^ error[E0208]: [+, o] --> $DIR/variance-types-bounds.rs:13:1 | -LL | / struct TestMut<A, B:'static> { -LL | | x: A, -LL | | y: &'static mut B, -LL | | } - | |_^ +LL | struct TestMut<A, B:'static> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0208]: [+, o] --> $DIR/variance-types-bounds.rs:19:1 | -LL | / struct TestIndirect<A:'static, B:'static> { -LL | | m: TestMut<A, B> -LL | | } - | |_^ +LL | struct TestIndirect<A:'static, B:'static> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0208]: [o, o] --> $DIR/variance-types-bounds.rs:24:1 | -LL | / struct TestIndirect2<A:'static, B:'static> { -LL | | n: TestMut<A, B>, -LL | | m: TestMut<B, A> -LL | | } - | |_^ +LL | struct TestIndirect2<A:'static, B:'static> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0208]: [o, o] --> $DIR/variance-types-bounds.rs:38:1 | -LL | / struct TestObject<A, R> { -LL | | n: Box<dyn Setter<A>+Send>, -LL | | m: Box<dyn Getter<R>+Send>, -LL | | } - | |_^ +LL | struct TestObject<A, R> { + | ^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 5 previous errors diff --git a/src/test/ui/variance/variance-types.stderr b/src/test/ui/variance/variance-types.stderr index 05bd4747cf1..8358b18b73c 100644 --- a/src/test/ui/variance/variance-types.stderr +++ b/src/test/ui/variance/variance-types.stderr @@ -1,52 +1,38 @@ error[E0208]: [-, o, o] --> $DIR/variance-types.rs:10:1 | -LL | / struct InvariantMut<'a,A:'a,B:'a> { -LL | | t: &'a mut (A,B) -LL | | } - | |_^ +LL | struct InvariantMut<'a,A:'a,B:'a> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0208]: [o] --> $DIR/variance-types.rs:15:1 | -LL | / struct InvariantCell<A> { -LL | | t: Cell<A> -LL | | } - | |_^ +LL | struct InvariantCell<A> { + | ^^^^^^^^^^^^^^^^^^^^^^^ error[E0208]: [o] --> $DIR/variance-types.rs:20:1 | -LL | / struct InvariantIndirect<A> { -LL | | t: InvariantCell<A> -LL | | } - | |_^ +LL | struct InvariantIndirect<A> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0208]: [+] --> $DIR/variance-types.rs:25:1 | -LL | / struct Covariant<A> { -LL | | t: A, u: fn() -> A -LL | | } - | |_^ +LL | struct Covariant<A> { + | ^^^^^^^^^^^^^^^^^^^ error[E0208]: [-] --> $DIR/variance-types.rs:30:1 | -LL | / struct Contravariant<A> { -LL | | t: fn(A) -LL | | } - | |_^ +LL | struct Contravariant<A> { + | ^^^^^^^^^^^^^^^^^^^^^^^ error[E0208]: [+, -, o] --> $DIR/variance-types.rs:35:1 | -LL | / enum Enum<A,B,C> { -LL | | Foo(Covariant<A>), -LL | | Bar(Contravariant<B>), -LL | | Zed(Covariant<C>,Contravariant<C>) -LL | | } - | |_^ +LL | enum Enum<A,B,C> { + | ^^^^^^^^^^^^^^^^ error: aborting due to 6 previous errors diff --git a/src/test/ui/wasm-custom-section-relocations.stderr b/src/test/ui/wasm-custom-section-relocations.stderr index eb8ab2644a3..a37edc51d19 100644 --- a/src/test/ui/wasm-custom-section-relocations.stderr +++ b/src/test/ui/wasm-custom-section-relocations.stderr @@ -2,13 +2,13 @@ error: statics with a custom `#[link_section]` must be a simple list of bytes on --> $DIR/wasm-custom-section-relocations.rs:4:1 | LL | pub static A: &[u8] = &[1]; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^ error: statics with a custom `#[link_section]` must be a simple list of bytes on the wasm target with no extra levels of indirection such as references --> $DIR/wasm-custom-section-relocations.rs:13:1 | LL | pub static D: &usize = &C; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/wf/issue-96810.rs b/src/test/ui/wf/issue-96810.rs new file mode 100644 index 00000000000..c2948086b20 --- /dev/null +++ b/src/test/ui/wf/issue-96810.rs @@ -0,0 +1,12 @@ +struct S<T: Tr>(T::Assoc); + +trait Tr { + type Assoc; +} + +struct Hoge<K> { + s: S<K>, //~ ERROR the trait bound `K: Tr` is not satisfied + a: u32, +} + +fn main() {} diff --git a/src/test/ui/wf/issue-96810.stderr b/src/test/ui/wf/issue-96810.stderr new file mode 100644 index 00000000000..1407e62b1e1 --- /dev/null +++ b/src/test/ui/wf/issue-96810.stderr @@ -0,0 +1,19 @@ +error[E0277]: the trait bound `K: Tr` is not satisfied + --> $DIR/issue-96810.rs:8:8 + | +LL | s: S<K>, + | ^^^^ the trait `Tr` is not implemented for `K` + | +note: required by a bound in `S` + --> $DIR/issue-96810.rs:1:13 + | +LL | struct S<T: Tr>(T::Assoc); + | ^^ required by this bound in `S` +help: consider restricting type parameter `K` + | +LL | struct Hoge<K: Tr> { + | ++++ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/wf/wf-in-foreign-fn-decls-issue-80468.stderr b/src/test/ui/wf/wf-in-foreign-fn-decls-issue-80468.stderr index 16d19872552..f976466841c 100644 --- a/src/test/ui/wf/wf-in-foreign-fn-decls-issue-80468.stderr +++ b/src/test/ui/wf/wf-in-foreign-fn-decls-issue-80468.stderr @@ -25,12 +25,12 @@ note: the anonymous lifetime #1 defined here... --> $DIR/wf-in-foreign-fn-decls-issue-80468.rs:16:5 | LL | pub fn repro(_: Wrapper<Ref>); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ note: ...does not necessarily outlive the static lifetime introduced by the compatible `impl` --> $DIR/wf-in-foreign-fn-decls-issue-80468.rs:13:1 | LL | impl Trait for Ref {} - | ^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/xcrate/xcrate-private-by-default.stderr b/src/test/ui/xcrate/xcrate-private-by-default.stderr index a97f55de5f8..0bdd4002f40 100644 --- a/src/test/ui/xcrate/xcrate-private-by-default.stderr +++ b/src/test/ui/xcrate/xcrate-private-by-default.stderr @@ -8,7 +8,7 @@ note: the static `j` is defined here --> $DIR/auxiliary/static_priv_by_default.rs:47:1 | LL | static j: isize = 0; - | ^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^ error[E0603]: function `k` is private --> $DIR/xcrate-private-by-default.rs:25:29 @@ -32,7 +32,7 @@ note: the unit struct `l` is defined here --> $DIR/auxiliary/static_priv_by_default.rs:49:1 | LL | struct l; - | ^^^^^^^^^ + | ^^^^^^^^ error[E0603]: enum `m` is private --> $DIR/xcrate-private-by-default.rs:29:35 @@ -56,7 +56,7 @@ note: the type alias `n` is defined here --> $DIR/auxiliary/static_priv_by_default.rs:51:1 | LL | type n = isize; - | ^^^^^^^^^^^^^^^ + | ^^^^^^ error[E0603]: module `foo` is private --> $DIR/xcrate-private-by-default.rs:35:29 |
