diff options
Diffstat (limited to 'src/test')
448 files changed, 5848 insertions, 2674 deletions
diff --git a/src/test/assembly/asm/mips-types.rs b/src/test/assembly/asm/mips-types.rs index 60cfebdd992..9ec7ba83c42 100644 --- a/src/test/assembly/asm/mips-types.rs +++ b/src/test/assembly/asm/mips-types.rs @@ -2,8 +2,9 @@ // revisions: mips32 mips64 // assembly-output: emit-asm //[mips32] compile-flags: --target mips-unknown-linux-gnu +//[mips32] needs-llvm-components: mips //[mips64] compile-flags: --target mips64-unknown-linux-gnuabi64 -// needs-llvm-components: mips +//[mips64] needs-llvm-components: mips #![feature(no_core, lang_items, rustc_attrs, repr_simd)] #![crate_type = "rlib"] diff --git a/src/test/assembly/asm/powerpc-types.rs b/src/test/assembly/asm/powerpc-types.rs index 742e4ddaed6..1e263649e86 100644 --- a/src/test/assembly/asm/powerpc-types.rs +++ b/src/test/assembly/asm/powerpc-types.rs @@ -2,8 +2,9 @@ // revisions: powerpc powerpc64 // assembly-output: emit-asm //[powerpc] compile-flags: --target powerpc-unknown-linux-gnu +//[powerpc] needs-llvm-components: powerpc //[powerpc64] compile-flags: --target powerpc64-unknown-linux-gnu -// needs-llvm-components: powerpc +//[powerpc64] needs-llvm-components: powerpc #![feature(no_core, lang_items, rustc_attrs, repr_simd)] #![crate_type = "rlib"] diff --git a/src/test/assembly/asm/riscv-types.rs b/src/test/assembly/asm/riscv-types.rs index 1ba73fcac9d..e62a6197b9a 100644 --- a/src/test/assembly/asm/riscv-types.rs +++ b/src/test/assembly/asm/riscv-types.rs @@ -2,9 +2,10 @@ // revisions: riscv64 riscv32 // assembly-output: emit-asm //[riscv64] compile-flags: --target riscv64imac-unknown-none-elf +//[riscv64] needs-llvm-components: riscv //[riscv32] compile-flags: --target riscv32imac-unknown-none-elf +//[riscv32] needs-llvm-components: riscv // compile-flags: -C target-feature=+d -// needs-llvm-components: riscv // min-system-llvm-version: 12.0 #![feature(no_core, lang_items, rustc_attrs)] diff --git a/src/test/assembly/asm/x86-modifiers.rs b/src/test/assembly/asm/x86-modifiers.rs index da2dc51d69e..c926fd7b3f5 100644 --- a/src/test/assembly/asm/x86-modifiers.rs +++ b/src/test/assembly/asm/x86-modifiers.rs @@ -3,7 +3,9 @@ // assembly-output: emit-asm // compile-flags: -O //[x86_64] compile-flags: --target x86_64-unknown-linux-gnu +//[x86_64] needs-llvm-components: x86 //[i686] compile-flags: --target i686-unknown-linux-gnu +//[i686] needs-llvm-components: x86 // compile-flags: -C llvm-args=--x86-asm-syntax=intel // compile-flags: -C target-feature=+avx512bw diff --git a/src/test/assembly/asm/x86-types.rs b/src/test/assembly/asm/x86-types.rs index b65b727d225..d25f3a03777 100644 --- a/src/test/assembly/asm/x86-types.rs +++ b/src/test/assembly/asm/x86-types.rs @@ -2,7 +2,9 @@ // revisions: x86_64 i686 // assembly-output: emit-asm //[x86_64] compile-flags: --target x86_64-unknown-linux-gnu +//[x86_64] needs-llvm-components: x86 //[i686] compile-flags: --target i686-unknown-linux-gnu +//[i686] needs-llvm-components: x86 // compile-flags: -C llvm-args=--x86-asm-syntax=intel // compile-flags: -C target-feature=+avx512bw diff --git a/src/test/assembly/static-relocation-model.rs b/src/test/assembly/static-relocation-model.rs index 2cd74a01c84..b331d45668a 100644 --- a/src/test/assembly/static-relocation-model.rs +++ b/src/test/assembly/static-relocation-model.rs @@ -1,10 +1,12 @@ // min-llvm-version: 12.0.0 -// needs-llvm-components: aarch64 x86 powerpc // revisions: x64 A64 ppc64le // assembly-output: emit-asm // [x64] compile-flags: --target x86_64-unknown-linux-gnu -Crelocation-model=static +// [x64] needs-llvm-components: x86 // [A64] compile-flags: --target aarch64-unknown-linux-gnu -Crelocation-model=static +// [A64] needs-llvm-components: aarch64 // [ppc64le] compile-flags: --target powerpc64le-unknown-linux-gnu -Crelocation-model=static +// [ppc64le] needs-llvm-components: powerpc #![feature(no_core, lang_items)] #![no_core] diff --git a/src/test/codegen/abi-efiapi.rs b/src/test/codegen/abi-efiapi.rs index 613b0bf50e5..b4fda5f8c84 100644 --- a/src/test/codegen/abi-efiapi.rs +++ b/src/test/codegen/abi-efiapi.rs @@ -1,13 +1,16 @@ // Checks if the correct annotation for the efiapi ABI is passed to llvm. // revisions:x86_64 i686 aarch64 arm riscv -// needs-llvm-components: aarch64 arm riscv - //[x86_64] compile-flags: --target x86_64-unknown-uefi +//[x86_64] needs-llvm-components: aarch64 arm riscv //[i686] compile-flags: --target i686-unknown-linux-musl +//[i686] needs-llvm-components: aarch64 arm riscv //[aarch64] compile-flags: --target aarch64-unknown-none +//[aarch64] needs-llvm-components: aarch64 arm riscv //[arm] compile-flags: --target armv7r-none-eabi +//[arm] needs-llvm-components: aarch64 arm riscv //[riscv] compile-flags: --target riscv64gc-unknown-none-elf +//[riscv] needs-llvm-components: aarch64 arm riscv // compile-flags: -C no-prepopulate-passes #![crate_type = "lib"] diff --git a/src/test/codegen/asm-options.rs b/src/test/codegen/asm-options.rs index 70391661b0c..28df0f9b852 100644 --- a/src/test/codegen/asm-options.rs +++ b/src/test/codegen/asm-options.rs @@ -94,3 +94,10 @@ pub unsafe fn dont_remove_nonpure() { asm!("", options(nomem)); asm!("", options(readonly)); } + +// CHECK-LABEL: @raw +// CHECK: call void asm sideeffect inteldialect "{} {}", ""() +#[no_mangle] +pub unsafe fn raw() { + asm!("{} {}", options(nostack, nomem, preserves_flags, raw)); +} diff --git a/src/test/codegen/asm-sanitize-llvm.rs b/src/test/codegen/asm-sanitize-llvm.rs index fe09caa6973..135177016bf 100644 --- a/src/test/codegen/asm-sanitize-llvm.rs +++ b/src/test/codegen/asm-sanitize-llvm.rs @@ -1,5 +1,6 @@ -// FIXME(nagisa): remove the flags here once all targets support `asm!`. +// FIXME(nagisa): remove the flags below once all targets support `asm!`. // compile-flags: --target x86_64-unknown-linux-gnu +// needs-llvm-components: x86 // Verify we sanitize the special tokens for the LLVM inline-assembly, ensuring people won't // inadvertently rely on the LLVM-specific syntax and features. diff --git a/src/test/codegen/default-requires-uwtable.rs b/src/test/codegen/default-requires-uwtable.rs index d4c4200c5d2..5d77d3f14bb 100644 --- a/src/test/codegen/default-requires-uwtable.rs +++ b/src/test/codegen/default-requires-uwtable.rs @@ -1,8 +1,9 @@ // revisions: WINDOWS ANDROID -// needs-llvm-components: x86 arm // compile-flags: -C panic=abort // [WINDOWS] compile-flags: --target=x86_64-pc-windows-msvc +// [WINDOWS] needs-llvm-components: x86 // [ANDROID] compile-flags: --target=armv7-linux-androideabi +// [ANDROID] needs-llvm-components: arm #![feature(no_core, lang_items)] #![crate_type = "lib"] diff --git a/src/test/codegen/i686-macosx-deployment-target.rs b/src/test/codegen/i686-macosx-deployment-target.rs index dad376d6677..17258a264a5 100644 --- a/src/test/codegen/i686-macosx-deployment-target.rs +++ b/src/test/codegen/i686-macosx-deployment-target.rs @@ -3,6 +3,7 @@ // See issue #60235. // compile-flags: -O --target=i686-apple-darwin --crate-type=rlib +// needs-llvm-components: x86 // rustc-env:MACOSX_DEPLOYMENT_TARGET=10.9 #![feature(no_core, lang_items)] #![no_core] diff --git a/src/test/codegen/i686-no-macosx-deployment-target.rs b/src/test/codegen/i686-no-macosx-deployment-target.rs index 1cebc49236f..043040a95e3 100644 --- a/src/test/codegen/i686-no-macosx-deployment-target.rs +++ b/src/test/codegen/i686-no-macosx-deployment-target.rs @@ -3,6 +3,7 @@ // See issue #60235. // compile-flags: -O --target=i686-apple-darwin --crate-type=rlib +// needs-llvm-components: x86 // unset-rustc-env:MACOSX_DEPLOYMENT_TARGET #![feature(no_core, lang_items)] #![no_core] diff --git a/src/test/codegen/sparc-struct-abi.rs b/src/test/codegen/sparc-struct-abi.rs index 78e5b14a212..f228d7c5500 100644 --- a/src/test/codegen/sparc-struct-abi.rs +++ b/src/test/codegen/sparc-struct-abi.rs @@ -1,9 +1,8 @@ -// // Checks that we correctly codegen extern "C" functions returning structs. // See issue #52638. -// only-sparc64 // compile-flags: -O --target=sparc64-unknown-linux-gnu --crate-type=rlib +// needs-llvm-components: sparc #![feature(no_core, lang_items)] #![no_core] diff --git a/src/test/codegen/x86_64-macosx-deployment-target.rs b/src/test/codegen/x86_64-macosx-deployment-target.rs index 8e291b7b298..8e673d11d98 100644 --- a/src/test/codegen/x86_64-macosx-deployment-target.rs +++ b/src/test/codegen/x86_64-macosx-deployment-target.rs @@ -3,6 +3,7 @@ // See issue #60235. // compile-flags: -O --target=x86_64-apple-darwin --crate-type=rlib +// needs-llvm-components: x86 // rustc-env:MACOSX_DEPLOYMENT_TARGET=10.9 #![feature(no_core, lang_items)] #![no_core] diff --git a/src/test/codegen/x86_64-no-macosx-deployment-target.rs b/src/test/codegen/x86_64-no-macosx-deployment-target.rs index c5ac73b54e1..25ae6924de0 100644 --- a/src/test/codegen/x86_64-no-macosx-deployment-target.rs +++ b/src/test/codegen/x86_64-no-macosx-deployment-target.rs @@ -3,6 +3,7 @@ // See issue #60235. // compile-flags: -O --target=x86_64-apple-darwin --crate-type=rlib +// needs-llvm-components: x86 // unset-rustc-env:MACOSX_DEPLOYMENT_TARGET #![feature(no_core, lang_items)] #![no_core] diff --git a/src/test/debuginfo/fixed-sized-array.rs b/src/test/debuginfo/fixed-sized-array.rs new file mode 100644 index 00000000000..d8899224d28 --- /dev/null +++ b/src/test/debuginfo/fixed-sized-array.rs @@ -0,0 +1,39 @@ +// Testing the display of fixed sized arrays in cdb. + +// cdb-only +// min-cdb-version: 10.0.18317.1001 +// compile-flags:-g + +// === CDB TESTS ================================================================================== + +// cdb-command: g + +// cdb-command: dx xs,d +// cdb-check:xs,d [Type: int [5]] +// cdb-check: [0] : 1 [Type: int] +// cdb-check: [1] : 2 [Type: int] +// cdb-check: [2] : 3 [Type: int] +// cdb-check: [3] : 4 [Type: int] +// cdb-check: [4] : 5 [Type: int] + +// cdb-command: dx ys,d +// cdb-check:ys,d [Type: int [3]] +// cdb-check: [0] : 0 [Type: int] +// cdb-check: [1] : 0 [Type: int] +// cdb-check: [2] : 0 [Type: int] + +fn main() { + // Fixed-size array (type signature is superfluous) + let xs: [i32; 5] = [1, 2, 3, 4, 5]; + + // All elements can be initialized to the same value + let ys: [i32; 3] = [0; 3]; + + // Indexing starts at 0 + println!("first element of the array: {}", xs[0]); + println!("second element of the array: {}", xs[1]); + + zzz(); // #break +} + +fn zzz() { () } diff --git a/src/test/debuginfo/mutable-locs.rs b/src/test/debuginfo/mutable-locs.rs new file mode 100644 index 00000000000..428a7e8d9c0 --- /dev/null +++ b/src/test/debuginfo/mutable-locs.rs @@ -0,0 +1,51 @@ +// Testing the display of Cell, RefCell, and RefMut in cdb. + +// cdb-only +// min-cdb-version: 10.0.18317.1001 +// compile-flags:-g + +// === CDB TESTS ================================================================================== + +// cdb-command: g + +// cdb-command:dx static_c,d +// cdb-check:static_c,d [Type: core::cell::Cell<i32>] +// cdb-check: [...] value [Type: core::cell::UnsafeCell<i32>] + +// cdb-command: dx static_c.value,d +// cdb-check:static_c.value,d [Type: core::cell::UnsafeCell<i32>] +// cdb-check: [...] value : 10 [Type: int] + +// cdb-command: dx dynamic_c,d +// cdb-check:dynamic_c,d [Type: core::cell::RefCell<i32>] +// cdb-check: [...] borrow [Type: core::cell::Cell<isize>] +// cdb-check: [...] value [Type: core::cell::UnsafeCell<i32>] + +// cdb-command: dx dynamic_c.value,d +// cdb-check:dynamic_c.value,d [Type: core::cell::UnsafeCell<i32>] +// cdb-check: [...] value : 15 [Type: int] + +// cdb-command: dx b,d +// cdb-check:b,d [Type: core::cell::RefMut<i32>] +// cdb-check: [...] value : [...] : 42 [Type: int *] +// cdb-check: [...] borrow [Type: core::cell::BorrowRefMut] + +#![allow(unused_variables)] + +use std::cell::{Cell, RefCell}; + +fn main() { + let static_c = Cell::new(5); + static_c.set(10); + + let dynamic_c = RefCell::new(5); + dynamic_c.replace(15); + + let dynamic_c_0 = RefCell::new(15); + let mut b = dynamic_c_0.borrow_mut(); + *b = 42; + + zzz(); // #break +} + +fn zzz() {()} diff --git a/src/test/debuginfo/mutex.rs b/src/test/debuginfo/mutex.rs new file mode 100644 index 00000000000..969099359ab --- /dev/null +++ b/src/test/debuginfo/mutex.rs @@ -0,0 +1,39 @@ +// Testing the display of Mutex and MutexGuard in cdb. + +// cdb-only +// min-cdb-version: 10.0.21287.1005 +// compile-flags:-g +// ignore-tidy-linelength + +// === CDB TESTS ================================================================================== +// +// cdb-command:g +// +// cdb-command:dx m,d +// cdb-check:m,d [Type: std::sync::mutex::Mutex<i32>] +// cdb-check: [...] inner [Type: std::sys_common::mutex::MovableMutex] +// cdb-check: [...] poison [Type: std::sync::poison::Flag] +// cdb-check: [...] data [Type: core::cell::UnsafeCell<i32>] + +// +// cdb-command:dx m.data,d +// cdb-check:m.data,d [Type: core::cell::UnsafeCell<i32>] +// cdb-check: [...] value : 0 [Type: int] + +// +// cdb-command:dx lock,d +// cdb-check:lock,d : Ok [Type: enum$<core::result::Result<std::sync::mutex::MutexGuard<i32>, enum$<std::sync::poison::TryLockError<std::sync::mutex::MutexGuard<i32>>, 0, 1, Poisoned>>>] +// cdb-check: [...] variant$ : Ok (0) [Type: core::result::Result] +// cdb-check: [...] __0 [Type: std::sync::mutex::MutexGuard<i32>] + +use std::sync::Mutex; + +#[allow(unused_variables)] +fn main() +{ + let m = Mutex::new(0); + let lock = m.try_lock(); + zzz(); // #break +} + +fn zzz() {} diff --git a/src/test/debuginfo/pretty-std.rs b/src/test/debuginfo/pretty-std.rs index 68e73b5f38d..aeee1e6258d 100644 --- a/src/test/debuginfo/pretty-std.rs +++ b/src/test/debuginfo/pretty-std.rs @@ -5,6 +5,7 @@ // compile-flags:-g // min-gdb-version: 7.7 // min-lldb-version: 310 +// min-cdb-version: 10.0.18317.1001 // === GDB TESTS =================================================================================== @@ -71,8 +72,12 @@ // cdb-command: g // cdb-command: dx slice,d -// cdb-check:slice,d [...] -// NOTE: While slices have a .natvis entry that works in VS & VS Code, it fails in CDB 10.0.18362.1 +// cdb-check:slice,d : { len=4 } [Type: slice<i32>] +// cdb-check: [len] : 4 [Type: [...]] +// cdb-check: [0] : 0 [Type: int] +// cdb-check: [1] : 1 [Type: int] +// cdb-check: [2] : 2 [Type: int] +// cdb-check: [3] : 3 [Type: int] // cdb-command: dx vec,d // cdb-check:vec,d [...] : { len=4 } [Type: [...]::Vec<u64, alloc::alloc::Global>] @@ -84,8 +89,7 @@ // cdb-check: [3] : 7 [Type: unsigned __int64] // cdb-command: dx str_slice -// cdb-check:str_slice [...] -// NOTE: While string slices have a .natvis entry that works in VS & VS Code, it fails in CDB +// cdb-check:str_slice : "IAMA string slice!" [Type: str] // cdb-command: dx string // cdb-check:string : "IAMA string!" [Type: [...]::String] @@ -113,9 +117,15 @@ // cdb-command: dx some // cdb-check:some : Some [Type: enum$<core::option::Option<i16>>] +// cdb-check: [...] variant$ : Some (0x1) [Type: core::option::Option] +// cdb-check: [...] __0 : 8 [Type: short] + // cdb-command: dx none // cdb-check:none : None [Type: enum$<core::option::Option<i64>>] +// cdb-check: [...] variant$ : None (0x0) [Type: core::option::Option] + // cdb-command: dx some_string +// NOTE: cdb fails to interpret debug info of Option enums on i686. // cdb-check:some_string [Type: enum$<core::option::Option<alloc::string::String>, 1, [...], Some>] #![allow(unused_variables)] diff --git a/src/test/debuginfo/range-types.rs b/src/test/debuginfo/range-types.rs new file mode 100644 index 00000000000..c0288b6ba80 --- /dev/null +++ b/src/test/debuginfo/range-types.rs @@ -0,0 +1,47 @@ +// Testing the display of range types in cdb. + +// cdb-only +// min-cdb-version: 10.0.18317.1001 +// compile-flags:-g + +// === CDB TESTS ================================================================================== + +// cdb-command: g + +// cdb-command: dx r1,d +// cdb-check:r1,d [Type: core::ops::range::Range<i32>] +// cdb-check: [...] start : 3 [Type: int] +// cdb-check: [...] end : 5 [Type: int] + +// cdb-command: dx r2,d +// cdb-check:r2,d [Type: core::ops::range::RangeFrom<i32>] +// cdb-check: [...] start : 2 [Type: int] + +// cdb-command: dx r3,d +// cdb-check:r3,d [Type: core::ops::range::RangeInclusive<i32>] +// cdb-check: [...] start : 1 [Type: int] +// cdb-check: [...] end : 4 [Type: int] +// cdb-check: [...] exhausted : false [Type: bool] + +// cdb-command: dx r4,d +// cdb-check:r4,d [Type: core::ops::range::RangeToInclusive<i32>] +// cdb-check: [...] end : 3 [Type: int] + +// cdb-command: dx r5,d +// cdb-check:r5,d [Type: core::ops::range::RangeFull] + +#[allow(unused_variables)] + +use std::ops::{Range, RangeFrom, RangeFull, RangeInclusive, RangeToInclusive}; + +fn main() +{ + let r1 = Range{start: 3, end: 5}; + let r2 = RangeFrom{start: 2}; + let r3 = RangeInclusive::new(1, 4); + let r4 = RangeToInclusive{end: 3}; + let r5 = RangeFull{}; + zzz(); // #break +} + +fn zzz() { () } diff --git a/src/test/debuginfo/rc_arc.rs b/src/test/debuginfo/rc_arc.rs index 87bc79ea794..9f1e856ab42 100644 --- a/src/test/debuginfo/rc_arc.rs +++ b/src/test/debuginfo/rc_arc.rs @@ -1,7 +1,9 @@ -// ignore-windows pretty-printers are not loaded +// pretty-printers are not loaded // compile-flags:-g +// ignore-tidy-linelength // min-gdb-version: 8.1 +// min-cdb-version: 10.0.18317.1001 // === GDB TESTS ================================================================================== @@ -22,6 +24,29 @@ // lldb-command:print a // lldb-check:[...]$1 = strong=2, weak=1 { data = 42 } +// === CDB TESTS ================================================================================== + +// cdb-command:g + +// cdb-command:dx r,d +// cdb-check:r,d : 42 [Type: alloc::rc::Rc<i32>] + +// cdb-command:dx r1,d +// cdb-check:r1,d : 42 [Type: alloc::rc::Rc<i32>] + +// cdb-command:dx w1,d +// cdb-check:w1,d [Type: alloc::rc::Weak<i32>] +// cdb-check: [...] ptr : [...] [Type: core::ptr::non_null::NonNull<alloc::rc::RcBox<i32>>] + +// cdb-command:dx a,d +// cdb-check:a,d : 42 [Type: alloc::sync::Arc<i32>] + +// cdb-command:dx a1,d +// cdb-check:a1,d : 42 [Type: alloc::sync::Arc<i32>] + +// cdb-command:dx w2,d +// cdb-check:w2,d : 42 [Type: alloc::sync::Weak<i32>] + use std::rc::Rc; use std::sync::Arc; diff --git a/src/test/debuginfo/result-types.rs b/src/test/debuginfo/result-types.rs new file mode 100644 index 00000000000..18eae7f301f --- /dev/null +++ b/src/test/debuginfo/result-types.rs @@ -0,0 +1,28 @@ +// cdb-only +// min-cdb-version: 10.0.18317.1001 +// compile-flags:-g + +// === CDB TESTS ================================================================================== + +// cdb-command: g + +// cdb-command: dx x,d +// cdb-check:x,d : Ok [Type: enum$<core::result::Result<i32, str>>] +// cdb-check: [...] __0 : -3 [Type: int] + +// cdb-command: dx y +// cdb-check:y : Err [Type: enum$<core::result::Result<i32, str>>] +// cdb-check: [...] __0 : "Some error message" [Type: str] + +fn main() +{ + let x: Result<i32, &str> = Ok(-3); + assert_eq!(x.is_ok(), true); + + let y: Result<i32, &str> = Err("Some error message"); + assert_eq!(y.is_ok(), false); + + zzz(); // #break. +} + +fn zzz() { () } diff --git a/src/test/debuginfo/rwlock-read.rs b/src/test/debuginfo/rwlock-read.rs new file mode 100644 index 00000000000..ac652c8ccf4 --- /dev/null +++ b/src/test/debuginfo/rwlock-read.rs @@ -0,0 +1,35 @@ +// Testing the display of RwLock and RwLockReadGuard in cdb. + +// cdb-only +// min-cdb-version: 10.0.18317.1001 +// compile-flags:-g + +// === CDB TESTS ================================================================================== +// +// cdb-command:g +// +// cdb-command:dx l +// cdb-check:l [Type: std::sync::rwlock::RwLock<i32>] +// cdb-check: [...] poison [Type: std::sync::poison::Flag] +// cdb-check: [...] data [Type: core::cell::UnsafeCell<i32>] +// +// cdb-command:dx r +// cdb-check:r [Type: std::sync::rwlock::RwLockReadGuard<i32>] +// cdb-check: [...] lock : [...] [Type: std::sync::rwlock::RwLock<i32> *] +// +// cdb-command:dx r.lock->data,d +// cdb-check:r.lock->data,d [Type: core::cell::UnsafeCell<i32>] +// cdb-check: [...] value : 0 [Type: int] + +#[allow(unused_variables)] + +use std::sync::RwLock; + +fn main() +{ + let l = RwLock::new(0); + let r = l.read().unwrap(); + zzz(); // #break +} + +fn zzz() {} diff --git a/src/test/debuginfo/rwlock-write.rs b/src/test/debuginfo/rwlock-write.rs new file mode 100644 index 00000000000..8decf54c177 --- /dev/null +++ b/src/test/debuginfo/rwlock-write.rs @@ -0,0 +1,27 @@ +// Testing the display of RwLockWriteGuard. + +// cdb-only +// min-cdb-version: 10.0.18317.1001 +// compile-flags:-g + +// === CDB TESTS ================================================================================== +// +// cdb-command:g +// +// cdb-command:dx w +// cdb-check:w [Type: std::sync::rwlock::RwLockWriteGuard<i32>] +// cdb-check: [...] lock : [...] [Type: std::sync::rwlock::RwLock<i32> *] +// cdb-check: [...] poison [Type: std::sync::poison::Guard] + +#[allow(unused_variables)] + +use std::sync::RwLock; + +fn main() +{ + let l = RwLock::new(0); + let w = l.write().unwrap(); + zzz(); // #break +} + +fn zzz() {} diff --git a/src/test/debuginfo/thread.rs b/src/test/debuginfo/thread.rs new file mode 100644 index 00000000000..af35ad6af07 --- /dev/null +++ b/src/test/debuginfo/thread.rs @@ -0,0 +1,31 @@ +// Testing the the display of JoinHandle and Thread in cdb. + +// cdb-only +// min-cdb-version: 10.0.18317.1001 +// compile-flags:-g + +// === CDB TESTS ================================================================================== +// +// cdb-command:g +// +// cdb-command:dx join_handle,d +// cdb-check:join_handle,d [Type: std::thread::JoinHandle<tuple<>>] +// cdb-check: [...] __0 [Type: std::thread::JoinInner<tuple<>>] +// +// cdb-command:dx t,d +// cdb-check:t,d : [...] [Type: std::thread::Thread *] +// cdb-check: [...] inner : {...} [Type: alloc::sync::Arc<std::thread::Inner>] + +use std::thread; + +#[allow(unused_variables)] +fn main() +{ + let join_handle = thread::spawn(|| { + println!("Initialize a thread"); + }); + let t = join_handle.thread(); + zzz(); // #break +} + +fn zzz() {} diff --git a/src/test/mir-opt/const_prop/checked_add.main.ConstProp.diff b/src/test/mir-opt/const_prop/checked_add.main.ConstProp.diff index bccfa9da615..77ff8ef4e49 100644 --- a/src/test/mir-opt/const_prop/checked_add.main.ConstProp.diff +++ b/src/test/mir-opt/const_prop/checked_add.main.ConstProp.diff @@ -14,9 +14,6 @@ - _2 = CheckedAdd(const 1_u32, const 1_u32); // scope 0 at $DIR/checked_add.rs:5:18: 5:23 - assert(!move (_2.1: bool), "attempt to compute `{} + {}`, which would overflow", const 1_u32, const 1_u32) -> bb1; // scope 0 at $DIR/checked_add.rs:5:18: 5:23 + _2 = const (2_u32, false); // scope 0 at $DIR/checked_add.rs:5:18: 5:23 -+ // mir::Constant -+ // + span: $DIR/checked_add.rs:5:18: 5:23 -+ // + literal: Const { ty: (u32, bool), val: Value(ByRef { alloc: Allocation { bytes: [2, 0, 0, 0, 0, 0, 0, 0], relocations: Relocations(SortedMap { data: [] }), init_mask: InitMask { blocks: [31], len: Size { raw: 8 } }, align: Align { pow2: 2 }, mutability: Not, extra: () }, offset: Size { raw: 0 } }) } + assert(!const false, "attempt to compute `{} + {}`, which would overflow", const 1_u32, const 1_u32) -> bb1; // scope 0 at $DIR/checked_add.rs:5:18: 5:23 } diff --git a/src/test/mir-opt/const_prop/indirect.main.ConstProp.diff b/src/test/mir-opt/const_prop/indirect.main.ConstProp.diff index 57a00ba12b0..8dd55235ef3 100644 --- a/src/test/mir-opt/const_prop/indirect.main.ConstProp.diff +++ b/src/test/mir-opt/const_prop/indirect.main.ConstProp.diff @@ -18,9 +18,6 @@ - assert(!move (_3.1: bool), "attempt to compute `{} + {}`, which would overflow", move _2, const 1_u8) -> bb1; // scope 0 at $DIR/indirect.rs:5:13: 5:29 + _2 = const 2_u8; // scope 0 at $DIR/indirect.rs:5:13: 5:25 + _3 = const (3_u8, false); // scope 0 at $DIR/indirect.rs:5:13: 5:29 -+ // mir::Constant -+ // + span: $DIR/indirect.rs:5:13: 5:29 -+ // + literal: Const { ty: (u8, bool), val: Value(ByRef { alloc: Allocation { bytes: [3, 0], relocations: Relocations(SortedMap { data: [] }), init_mask: InitMask { blocks: [3], len: Size { raw: 2 } }, align: Align { pow2: 0 }, mutability: Not, extra: () }, offset: Size { raw: 0 } }) } + assert(!const false, "attempt to compute `{} + {}`, which would overflow", const 2_u8, const 1_u8) -> bb1; // scope 0 at $DIR/indirect.rs:5:13: 5:29 } diff --git a/src/test/mir-opt/const_prop/issue_67019.main.ConstProp.diff b/src/test/mir-opt/const_prop/issue_67019.main.ConstProp.diff index 518974e24b3..2d3289f7ce5 100644 --- a/src/test/mir-opt/const_prop/issue_67019.main.ConstProp.diff +++ b/src/test/mir-opt/const_prop/issue_67019.main.ConstProp.diff @@ -15,9 +15,6 @@ (_3.1: u8) = const 2_u8; // scope 0 at $DIR/issue-67019.rs:11:11: 11:17 - (_2.0: (u8, u8)) = move _3; // scope 0 at $DIR/issue-67019.rs:11:10: 11:19 + (_2.0: (u8, u8)) = const (1_u8, 2_u8); // scope 0 at $DIR/issue-67019.rs:11:10: 11:19 -+ // mir::Constant -+ // + span: $DIR/issue-67019.rs:11:10: 11:19 -+ // + literal: Const { ty: (u8, u8), val: Value(ByRef { alloc: Allocation { bytes: [1, 2], relocations: Relocations(SortedMap { data: [] }), init_mask: InitMask { blocks: [3], len: Size { raw: 2 } }, align: Align { pow2: 0 }, mutability: Not, extra: () }, offset: Size { raw: 0 } }) } StorageDead(_3); // scope 0 at $DIR/issue-67019.rs:11:18: 11:19 _1 = test(move _2) -> bb1; // scope 0 at $DIR/issue-67019.rs:11:5: 11:20 // mir::Constant diff --git a/src/test/mir-opt/const_prop/mutable_variable_aggregate.main.ConstProp.diff b/src/test/mir-opt/const_prop/mutable_variable_aggregate.main.ConstProp.diff index d94c4f6fb26..a044d1dcfe1 100644 --- a/src/test/mir-opt/const_prop/mutable_variable_aggregate.main.ConstProp.diff +++ b/src/test/mir-opt/const_prop/mutable_variable_aggregate.main.ConstProp.diff @@ -20,9 +20,6 @@ StorageLive(_2); // scope 1 at $DIR/mutable_variable_aggregate.rs:7:9: 7:10 - _2 = _1; // scope 1 at $DIR/mutable_variable_aggregate.rs:7:13: 7:14 + _2 = const (42_i32, 99_i32); // scope 1 at $DIR/mutable_variable_aggregate.rs:7:13: 7:14 -+ // mir::Constant -+ // + span: $DIR/mutable_variable_aggregate.rs:7:13: 7:14 -+ // + literal: Const { ty: (i32, i32), val: Value(ByRef { alloc: Allocation { bytes: [42, 0, 0, 0, 99, 0, 0, 0], relocations: Relocations(SortedMap { data: [] }), init_mask: InitMask { blocks: [255], len: Size { raw: 8 } }, align: Align { pow2: 2 }, mutability: Not, extra: () }, offset: Size { raw: 0 } }) } nop; // scope 0 at $DIR/mutable_variable_aggregate.rs:4:11: 8:2 StorageDead(_2); // scope 1 at $DIR/mutable_variable_aggregate.rs:8:1: 8:2 StorageDead(_1); // scope 0 at $DIR/mutable_variable_aggregate.rs:8:1: 8:2 diff --git a/src/test/mir-opt/const_prop/optimizes_into_variable.main.ConstProp.32bit.diff b/src/test/mir-opt/const_prop/optimizes_into_variable.main.ConstProp.32bit.diff index 537f1b6253c..4c3f66cd090 100644 --- a/src/test/mir-opt/const_prop/optimizes_into_variable.main.ConstProp.32bit.diff +++ b/src/test/mir-opt/const_prop/optimizes_into_variable.main.ConstProp.32bit.diff @@ -27,9 +27,6 @@ - _2 = CheckedAdd(const 2_i32, const 2_i32); // scope 0 at $DIR/optimizes_into_variable.rs:12:13: 12:18 - assert(!move (_2.1: bool), "attempt to compute `{} + {}`, which would overflow", const 2_i32, const 2_i32) -> bb1; // scope 0 at $DIR/optimizes_into_variable.rs:12:13: 12:18 + _2 = const (4_i32, false); // scope 0 at $DIR/optimizes_into_variable.rs:12:13: 12:18 -+ // mir::Constant -+ // + span: $DIR/optimizes_into_variable.rs:12:13: 12:18 -+ // + literal: Const { ty: (i32, bool), val: Value(ByRef { alloc: Allocation { bytes: [4, 0, 0, 0, 0, 0, 0, 0], relocations: Relocations(SortedMap { data: [] }), init_mask: InitMask { blocks: [31], len: Size { raw: 8 } }, align: Align { pow2: 2 }, mutability: Not, extra: () }, offset: Size { raw: 0 } }) } + assert(!const false, "attempt to compute `{} + {}`, which would overflow", const 2_i32, const 2_i32) -> bb1; // scope 0 at $DIR/optimizes_into_variable.rs:12:13: 12:18 } diff --git a/src/test/mir-opt/const_prop/optimizes_into_variable.main.ConstProp.64bit.diff b/src/test/mir-opt/const_prop/optimizes_into_variable.main.ConstProp.64bit.diff index 537f1b6253c..4c3f66cd090 100644 --- a/src/test/mir-opt/const_prop/optimizes_into_variable.main.ConstProp.64bit.diff +++ b/src/test/mir-opt/const_prop/optimizes_into_variable.main.ConstProp.64bit.diff @@ -27,9 +27,6 @@ - _2 = CheckedAdd(const 2_i32, const 2_i32); // scope 0 at $DIR/optimizes_into_variable.rs:12:13: 12:18 - assert(!move (_2.1: bool), "attempt to compute `{} + {}`, which would overflow", const 2_i32, const 2_i32) -> bb1; // scope 0 at $DIR/optimizes_into_variable.rs:12:13: 12:18 + _2 = const (4_i32, false); // scope 0 at $DIR/optimizes_into_variable.rs:12:13: 12:18 -+ // mir::Constant -+ // + span: $DIR/optimizes_into_variable.rs:12:13: 12:18 -+ // + literal: Const { ty: (i32, bool), val: Value(ByRef { alloc: Allocation { bytes: [4, 0, 0, 0, 0, 0, 0, 0], relocations: Relocations(SortedMap { data: [] }), init_mask: InitMask { blocks: [31], len: Size { raw: 8 } }, align: Align { pow2: 2 }, mutability: Not, extra: () }, offset: Size { raw: 0 } }) } + assert(!const false, "attempt to compute `{} + {}`, which would overflow", const 2_i32, const 2_i32) -> bb1; // scope 0 at $DIR/optimizes_into_variable.rs:12:13: 12:18 } diff --git a/src/test/mir-opt/const_prop/return_place.add.ConstProp.diff b/src/test/mir-opt/const_prop/return_place.add.ConstProp.diff index 97808246dd4..c6ac8d6fb13 100644 --- a/src/test/mir-opt/const_prop/return_place.add.ConstProp.diff +++ b/src/test/mir-opt/const_prop/return_place.add.ConstProp.diff @@ -9,9 +9,6 @@ - _1 = CheckedAdd(const 2_u32, const 2_u32); // scope 0 at $DIR/return_place.rs:6:5: 6:10 - assert(!move (_1.1: bool), "attempt to compute `{} + {}`, which would overflow", const 2_u32, const 2_u32) -> bb1; // scope 0 at $DIR/return_place.rs:6:5: 6:10 + _1 = const (4_u32, false); // scope 0 at $DIR/return_place.rs:6:5: 6:10 -+ // mir::Constant -+ // + span: $DIR/return_place.rs:6:5: 6:10 -+ // + literal: Const { ty: (u32, bool), val: Value(ByRef { alloc: Allocation { bytes: [4, 0, 0, 0, 0, 0, 0, 0], relocations: Relocations(SortedMap { data: [] }), init_mask: InitMask { blocks: [31], len: Size { raw: 8 } }, align: Align { pow2: 2 }, mutability: Not, extra: () }, offset: Size { raw: 0 } }) } + assert(!const false, "attempt to compute `{} + {}`, which would overflow", const 2_u32, const 2_u32) -> bb1; // scope 0 at $DIR/return_place.rs:6:5: 6:10 } diff --git a/src/test/mir-opt/const_prop/tuple_literal_propagation.main.ConstProp.diff b/src/test/mir-opt/const_prop/tuple_literal_propagation.main.ConstProp.diff index b8f9cd34c99..15253a364e9 100644 --- a/src/test/mir-opt/const_prop/tuple_literal_propagation.main.ConstProp.diff +++ b/src/test/mir-opt/const_prop/tuple_literal_propagation.main.ConstProp.diff @@ -18,9 +18,6 @@ StorageLive(_3); // scope 1 at $DIR/tuple_literal_propagation.rs:5:13: 5:14 - _3 = _1; // scope 1 at $DIR/tuple_literal_propagation.rs:5:13: 5:14 + _3 = const (1_u32, 2_u32); // scope 1 at $DIR/tuple_literal_propagation.rs:5:13: 5:14 -+ // mir::Constant -+ // + span: $DIR/tuple_literal_propagation.rs:5:13: 5:14 -+ // + literal: Const { ty: (u32, u32), val: Value(ByRef { alloc: Allocation { bytes: [1, 0, 0, 0, 2, 0, 0, 0], relocations: Relocations(SortedMap { data: [] }), init_mask: InitMask { blocks: [255], len: Size { raw: 8 } }, align: Align { pow2: 2 }, mutability: Not, extra: () }, offset: Size { raw: 0 } }) } _2 = consume(move _3) -> bb1; // scope 1 at $DIR/tuple_literal_propagation.rs:5:5: 5:15 // mir::Constant // + span: $DIR/tuple_literal_propagation.rs:5:5: 5:12 diff --git a/src/test/mir-opt/deaggregator_test.bar.Deaggregator.diff b/src/test/mir-opt/deaggregator_test.bar.Deaggregator.diff index e60a1f3e75f..d3c7136c647 100644 --- a/src/test/mir-opt/deaggregator_test.bar.Deaggregator.diff +++ b/src/test/mir-opt/deaggregator_test.bar.Deaggregator.diff @@ -12,9 +12,6 @@ - _0 = Baz { x: move _2, y: const 0f32, z: const false }; // scope 0 at $DIR/deaggregator_test.rs:9:5: 9:35 + (_0.0: usize) = move _2; // scope 0 at $DIR/deaggregator_test.rs:9:5: 9:35 + (_0.1: f32) = const 0f32; // scope 0 at $DIR/deaggregator_test.rs:9:5: 9:35 - // mir::Constant - // + span: $DIR/deaggregator_test.rs:9:20: 9:23 - // + literal: Const { ty: f32, val: Value(Scalar(0x00000000)) } + (_0.2: bool) = const false; // scope 0 at $DIR/deaggregator_test.rs:9:5: 9:35 StorageDead(_2); // scope 0 at $DIR/deaggregator_test.rs:9:34: 9:35 return; // scope 0 at $DIR/deaggregator_test.rs:10:2: 10:2 diff --git a/src/test/mir-opt/if_condition_int.dont_opt_floats.SimplifyComparisonIntegral.diff b/src/test/mir-opt/if_condition_int.dont_opt_floats.SimplifyComparisonIntegral.diff index 2c4952402a4..64a3f52f3a0 100644 --- a/src/test/mir-opt/if_condition_int.dont_opt_floats.SimplifyComparisonIntegral.diff +++ b/src/test/mir-opt/if_condition_int.dont_opt_floats.SimplifyComparisonIntegral.diff @@ -12,9 +12,6 @@ StorageLive(_3); // scope 0 at $DIR/if-condition-int.rs:53:8: 53:9 _3 = _1; // scope 0 at $DIR/if-condition-int.rs:53:8: 53:9 _2 = Eq(move _3, const -42f32); // scope 0 at $DIR/if-condition-int.rs:53:8: 53:18 - // mir::Constant - // + span: $DIR/if-condition-int.rs:53:13: 53:18 - // + literal: Const { ty: f32, val: Value(Scalar(0xc2280000)) } StorageDead(_3); // scope 0 at $DIR/if-condition-int.rs:53:17: 53:18 switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/if-condition-int.rs:53:5: 53:35 } diff --git a/src/test/mir-opt/lower_slice_len.bound.LowerSliceLenCalls.diff b/src/test/mir-opt/lower_slice_len.bound.LowerSliceLenCalls.diff new file mode 100644 index 00000000000..d2056ac13a7 --- /dev/null +++ b/src/test/mir-opt/lower_slice_len.bound.LowerSliceLenCalls.diff @@ -0,0 +1,63 @@ +- // MIR for `bound` before LowerSliceLenCalls ++ // MIR for `bound` after LowerSliceLenCalls + + fn bound(_1: usize, _2: &[u8]) -> u8 { + debug index => _1; // in scope 0 at $DIR/lower_slice_len.rs:4:14: 4:19 + debug slice => _2; // in scope 0 at $DIR/lower_slice_len.rs:4:28: 4:33 + let mut _0: u8; // return place in scope 0 at $DIR/lower_slice_len.rs:4:45: 4:47 + let mut _3: bool; // in scope 0 at $DIR/lower_slice_len.rs:5:8: 5:27 + let mut _4: usize; // in scope 0 at $DIR/lower_slice_len.rs:5:8: 5:13 + let mut _5: usize; // in scope 0 at $DIR/lower_slice_len.rs:5:16: 5:27 + let mut _6: &[u8]; // in scope 0 at $DIR/lower_slice_len.rs:5:16: 5:21 + let _7: usize; // in scope 0 at $DIR/lower_slice_len.rs:6:15: 6:20 + let mut _8: usize; // in scope 0 at $DIR/lower_slice_len.rs:6:9: 6:21 + let mut _9: bool; // in scope 0 at $DIR/lower_slice_len.rs:6:9: 6:21 + + bb0: { + StorageLive(_3); // scope 0 at $DIR/lower_slice_len.rs:5:8: 5:27 + StorageLive(_4); // scope 0 at $DIR/lower_slice_len.rs:5:8: 5:13 + _4 = _1; // scope 0 at $DIR/lower_slice_len.rs:5:8: 5:13 + StorageLive(_5); // scope 0 at $DIR/lower_slice_len.rs:5:16: 5:27 + StorageLive(_6); // scope 0 at $DIR/lower_slice_len.rs:5:16: 5:21 + _6 = &(*_2); // scope 0 at $DIR/lower_slice_len.rs:5:16: 5:21 +- _5 = core::slice::<impl [u8]>::len(move _6) -> bb1; // scope 0 at $DIR/lower_slice_len.rs:5:16: 5:27 +- // mir::Constant +- // + span: $DIR/lower_slice_len.rs:5:22: 5:25 +- // + literal: Const { ty: for<'r> fn(&'r [u8]) -> usize {core::slice::<impl [u8]>::len}, val: Value(Scalar(<ZST>)) } ++ _5 = Len((*_6)); // scope 0 at $DIR/lower_slice_len.rs:5:16: 5:27 ++ goto -> bb1; // scope 0 at $DIR/lower_slice_len.rs:5:16: 5:27 + } + + bb1: { + StorageDead(_6); // scope 0 at $DIR/lower_slice_len.rs:5:26: 5:27 + _3 = Lt(move _4, move _5); // scope 0 at $DIR/lower_slice_len.rs:5:8: 5:27 + StorageDead(_5); // scope 0 at $DIR/lower_slice_len.rs:5:26: 5:27 + StorageDead(_4); // scope 0 at $DIR/lower_slice_len.rs:5:26: 5:27 + switchInt(move _3) -> [false: bb3, otherwise: bb2]; // scope 0 at $DIR/lower_slice_len.rs:5:5: 9:6 + } + + bb2: { + StorageLive(_7); // scope 0 at $DIR/lower_slice_len.rs:6:15: 6:20 + _7 = _1; // scope 0 at $DIR/lower_slice_len.rs:6:15: 6:20 + _8 = Len((*_2)); // scope 0 at $DIR/lower_slice_len.rs:6:9: 6:21 + _9 = Lt(_7, _8); // scope 0 at $DIR/lower_slice_len.rs:6:9: 6:21 + assert(move _9, "index out of bounds: the length is {} but the index is {}", move _8, _7) -> bb4; // scope 0 at $DIR/lower_slice_len.rs:6:9: 6:21 + } + + bb3: { + _0 = const 42_u8; // scope 0 at $DIR/lower_slice_len.rs:8:9: 8:11 + goto -> bb5; // scope 0 at $DIR/lower_slice_len.rs:5:5: 9:6 + } + + bb4: { + _0 = (*_2)[_7]; // scope 0 at $DIR/lower_slice_len.rs:6:9: 6:21 + StorageDead(_7); // scope 0 at $DIR/lower_slice_len.rs:7:5: 7:6 + goto -> bb5; // scope 0 at $DIR/lower_slice_len.rs:5:5: 9:6 + } + + bb5: { + StorageDead(_3); // scope 0 at $DIR/lower_slice_len.rs:9:5: 9:6 + return; // scope 0 at $DIR/lower_slice_len.rs:10:2: 10:2 + } + } + diff --git a/src/test/mir-opt/lower_slice_len.rs b/src/test/mir-opt/lower_slice_len.rs new file mode 100644 index 00000000000..f2438e69749 --- /dev/null +++ b/src/test/mir-opt/lower_slice_len.rs @@ -0,0 +1,14 @@ +// compile-flags: -Z mir-opt-level=3 + +// EMIT_MIR lower_slice_len.bound.LowerSliceLenCalls.diff +pub fn bound(index: usize, slice: &[u8]) -> u8 { + if index < slice.len() { + slice[index] + } else { + 42 + } +} + +fn main() { + let _ = bound(1, &[1, 2, 3]); +} diff --git a/src/test/mir-opt/simplify_locals_removes_unused_consts.main.SimplifyLocals.diff b/src/test/mir-opt/simplify_locals_removes_unused_consts.main.SimplifyLocals.diff index a698d8abcdb..598e8247efc 100644 --- a/src/test/mir-opt/simplify_locals_removes_unused_consts.main.SimplifyLocals.diff +++ b/src/test/mir-opt/simplify_locals_removes_unused_consts.main.SimplifyLocals.diff @@ -38,9 +38,6 @@ // mir::Constant // + span: $DIR/simplify-locals-removes-unused-consts.rs:14:5: 14:12 // + literal: Const { ty: fn(((), ())) {use_zst}, val: Value(Scalar(<ZST>)) } - // mir::Constant - // + span: $DIR/simplify-locals-removes-unused-consts.rs:14:5: 14:22 - // + literal: Const { ty: ((), ()), val: Value(Scalar(<ZST>)) } } bb1: { diff --git a/src/test/mir-opt/uninhabited_enum_branching2.main.SimplifyCfg-after-uninhabited-enum-branching.after.mir b/src/test/mir-opt/uninhabited_enum_branching2.main.SimplifyCfg-after-uninhabited-enum-branching.after.mir new file mode 100644 index 00000000000..373be9f174b --- /dev/null +++ b/src/test/mir-opt/uninhabited_enum_branching2.main.SimplifyCfg-after-uninhabited-enum-branching.after.mir @@ -0,0 +1,106 @@ +// MIR for `main` after SimplifyCfg-after-uninhabited-enum-branching + +fn main() -> () { + let mut _0: (); // return place in scope 0 at $DIR/uninhabited_enum_branching2.rs:18:11: 18:11 + let _1: Plop; // in scope 0 at $DIR/uninhabited_enum_branching2.rs:19:9: 19:13 + let mut _2: Test1; // in scope 0 at $DIR/uninhabited_enum_branching2.rs:19:38: 19:46 + let _3: &str; // in scope 0 at $DIR/uninhabited_enum_branching2.rs:21:5: 26:6 + let mut _4: &Test1; // in scope 0 at $DIR/uninhabited_enum_branching2.rs:21:11: 21:22 + let mut _5: isize; // in scope 0 at $DIR/uninhabited_enum_branching2.rs:22:9: 22:20 + let _6: &str; // in scope 0 at $DIR/uninhabited_enum_branching2.rs:23:24: 23:34 + let _7: &str; // in scope 0 at $DIR/uninhabited_enum_branching2.rs:24:21: 24:24 + let _8: &str; // in scope 0 at $DIR/uninhabited_enum_branching2.rs:25:21: 25:24 + let _9: &str; // in scope 0 at $DIR/uninhabited_enum_branching2.rs:28:5: 33:6 + let mut _10: isize; // in scope 0 at $DIR/uninhabited_enum_branching2.rs:29:9: 29:20 + let _11: &str; // in scope 0 at $DIR/uninhabited_enum_branching2.rs:30:24: 30:34 + let _12: &str; // in scope 0 at $DIR/uninhabited_enum_branching2.rs:31:21: 31:24 + let _13: &str; // in scope 0 at $DIR/uninhabited_enum_branching2.rs:32:21: 32:24 + scope 1 { + debug plop => _1; // in scope 1 at $DIR/uninhabited_enum_branching2.rs:19:9: 19:13 + } + + bb0: { + StorageLive(_1); // scope 0 at $DIR/uninhabited_enum_branching2.rs:19:9: 19:13 + StorageLive(_2); // scope 0 at $DIR/uninhabited_enum_branching2.rs:19:38: 19:46 + discriminant(_2) = 2; // scope 0 at $DIR/uninhabited_enum_branching2.rs:19:38: 19:46 + (_1.0: u32) = const 51_u32; // scope 0 at $DIR/uninhabited_enum_branching2.rs:19:16: 19:48 + (_1.1: Test1) = move _2; // scope 0 at $DIR/uninhabited_enum_branching2.rs:19:16: 19:48 + StorageDead(_2); // scope 0 at $DIR/uninhabited_enum_branching2.rs:19:47: 19:48 + StorageLive(_3); // scope 1 at $DIR/uninhabited_enum_branching2.rs:21:5: 26:6 + StorageLive(_4); // scope 1 at $DIR/uninhabited_enum_branching2.rs:21:11: 21:22 + _4 = &(_1.1: Test1); // scope 1 at $DIR/uninhabited_enum_branching2.rs:21:11: 21:22 + _5 = discriminant((*_4)); // scope 1 at $DIR/uninhabited_enum_branching2.rs:22:9: 22:20 + switchInt(move _5) -> [2_isize: bb2, otherwise: bb1]; // scope 1 at $DIR/uninhabited_enum_branching2.rs:22:9: 22:20 + } + + bb1: { + StorageLive(_8); // scope 1 at $DIR/uninhabited_enum_branching2.rs:25:21: 25:24 + _8 = const "D"; // scope 1 at $DIR/uninhabited_enum_branching2.rs:25:21: 25:24 + // ty::Const + // + ty: &str + // + val: Value(Slice { data: Allocation { bytes: [68], relocations: Relocations(SortedMap { data: [] }), init_mask: InitMask { blocks: [1], len: Size { raw: 1 } }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 1 }) + // mir::Constant + // + span: $DIR/uninhabited_enum_branching2.rs:25:21: 25:24 + // + literal: Const { ty: &str, val: Value(Slice { data: Allocation { bytes: [68], relocations: Relocations(SortedMap { data: [] }), init_mask: InitMask { blocks: [1], len: Size { raw: 1 } }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 1 }) } + _3 = &(*_8); // scope 1 at $DIR/uninhabited_enum_branching2.rs:25:21: 25:24 + StorageDead(_8); // scope 1 at $DIR/uninhabited_enum_branching2.rs:25:23: 25:24 + goto -> bb3; // scope 1 at $DIR/uninhabited_enum_branching2.rs:21:5: 26:6 + } + + bb2: { + StorageLive(_7); // scope 1 at $DIR/uninhabited_enum_branching2.rs:24:21: 24:24 + _7 = const "C"; // scope 1 at $DIR/uninhabited_enum_branching2.rs:24:21: 24:24 + // ty::Const + // + ty: &str + // + val: Value(Slice { data: Allocation { bytes: [67], relocations: Relocations(SortedMap { data: [] }), init_mask: InitMask { blocks: [1], len: Size { raw: 1 } }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 1 }) + // mir::Constant + // + span: $DIR/uninhabited_enum_branching2.rs:24:21: 24:24 + // + literal: Const { ty: &str, val: Value(Slice { data: Allocation { bytes: [67], relocations: Relocations(SortedMap { data: [] }), init_mask: InitMask { blocks: [1], len: Size { raw: 1 } }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 1 }) } + _3 = &(*_7); // scope 1 at $DIR/uninhabited_enum_branching2.rs:24:21: 24:24 + StorageDead(_7); // scope 1 at $DIR/uninhabited_enum_branching2.rs:24:23: 24:24 + goto -> bb3; // scope 1 at $DIR/uninhabited_enum_branching2.rs:21:5: 26:6 + } + + bb3: { + StorageDead(_4); // scope 1 at $DIR/uninhabited_enum_branching2.rs:26:6: 26:7 + StorageDead(_3); // scope 1 at $DIR/uninhabited_enum_branching2.rs:26:6: 26:7 + StorageLive(_9); // scope 1 at $DIR/uninhabited_enum_branching2.rs:28:5: 33:6 + _10 = discriminant((_1.1: Test1)); // scope 1 at $DIR/uninhabited_enum_branching2.rs:29:9: 29:20 + switchInt(move _10) -> [2_isize: bb5, otherwise: bb4]; // scope 1 at $DIR/uninhabited_enum_branching2.rs:29:9: 29:20 + } + + bb4: { + StorageLive(_13); // scope 1 at $DIR/uninhabited_enum_branching2.rs:32:21: 32:24 + _13 = const "D"; // scope 1 at $DIR/uninhabited_enum_branching2.rs:32:21: 32:24 + // ty::Const + // + ty: &str + // + val: Value(Slice { data: Allocation { bytes: [68], relocations: Relocations(SortedMap { data: [] }), init_mask: InitMask { blocks: [1], len: Size { raw: 1 } }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 1 }) + // mir::Constant + // + span: $DIR/uninhabited_enum_branching2.rs:32:21: 32:24 + // + literal: Const { ty: &str, val: Value(Slice { data: Allocation { bytes: [68], relocations: Relocations(SortedMap { data: [] }), init_mask: InitMask { blocks: [1], len: Size { raw: 1 } }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 1 }) } + _9 = &(*_13); // scope 1 at $DIR/uninhabited_enum_branching2.rs:32:21: 32:24 + StorageDead(_13); // scope 1 at $DIR/uninhabited_enum_branching2.rs:32:23: 32:24 + goto -> bb6; // scope 1 at $DIR/uninhabited_enum_branching2.rs:28:5: 33:6 + } + + bb5: { + StorageLive(_12); // scope 1 at $DIR/uninhabited_enum_branching2.rs:31:21: 31:24 + _12 = const "C"; // scope 1 at $DIR/uninhabited_enum_branching2.rs:31:21: 31:24 + // ty::Const + // + ty: &str + // + val: Value(Slice { data: Allocation { bytes: [67], relocations: Relocations(SortedMap { data: [] }), init_mask: InitMask { blocks: [1], len: Size { raw: 1 } }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 1 }) + // mir::Constant + // + span: $DIR/uninhabited_enum_branching2.rs:31:21: 31:24 + // + literal: Const { ty: &str, val: Value(Slice { data: Allocation { bytes: [67], relocations: Relocations(SortedMap { data: [] }), init_mask: InitMask { blocks: [1], len: Size { raw: 1 } }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 1 }) } + _9 = &(*_12); // scope 1 at $DIR/uninhabited_enum_branching2.rs:31:21: 31:24 + StorageDead(_12); // scope 1 at $DIR/uninhabited_enum_branching2.rs:31:23: 31:24 + goto -> bb6; // scope 1 at $DIR/uninhabited_enum_branching2.rs:28:5: 33:6 + } + + bb6: { + StorageDead(_9); // scope 1 at $DIR/uninhabited_enum_branching2.rs:33:6: 33:7 + _0 = const (); // scope 0 at $DIR/uninhabited_enum_branching2.rs:18:11: 34:2 + StorageDead(_1); // scope 0 at $DIR/uninhabited_enum_branching2.rs:34:1: 34:2 + return; // scope 0 at $DIR/uninhabited_enum_branching2.rs:34:2: 34:2 + } +} diff --git a/src/test/mir-opt/uninhabited_enum_branching2.main.UninhabitedEnumBranching.diff b/src/test/mir-opt/uninhabited_enum_branching2.main.UninhabitedEnumBranching.diff new file mode 100644 index 00000000000..f9488bae4c8 --- /dev/null +++ b/src/test/mir-opt/uninhabited_enum_branching2.main.UninhabitedEnumBranching.diff @@ -0,0 +1,160 @@ +- // MIR for `main` before UninhabitedEnumBranching ++ // MIR for `main` after UninhabitedEnumBranching + + fn main() -> () { + let mut _0: (); // return place in scope 0 at $DIR/uninhabited_enum_branching2.rs:18:11: 18:11 + let _1: Plop; // in scope 0 at $DIR/uninhabited_enum_branching2.rs:19:9: 19:13 + let mut _2: Test1; // in scope 0 at $DIR/uninhabited_enum_branching2.rs:19:38: 19:46 + let _3: &str; // in scope 0 at $DIR/uninhabited_enum_branching2.rs:21:5: 26:6 + let mut _4: &Test1; // in scope 0 at $DIR/uninhabited_enum_branching2.rs:21:11: 21:22 + let mut _5: isize; // in scope 0 at $DIR/uninhabited_enum_branching2.rs:22:9: 22:20 + let _6: &str; // in scope 0 at $DIR/uninhabited_enum_branching2.rs:23:24: 23:34 + let _7: &str; // in scope 0 at $DIR/uninhabited_enum_branching2.rs:24:21: 24:24 + let _8: &str; // in scope 0 at $DIR/uninhabited_enum_branching2.rs:25:21: 25:24 + let _9: &str; // in scope 0 at $DIR/uninhabited_enum_branching2.rs:28:5: 33:6 + let mut _10: isize; // in scope 0 at $DIR/uninhabited_enum_branching2.rs:29:9: 29:20 + let _11: &str; // in scope 0 at $DIR/uninhabited_enum_branching2.rs:30:24: 30:34 + let _12: &str; // in scope 0 at $DIR/uninhabited_enum_branching2.rs:31:21: 31:24 + let _13: &str; // in scope 0 at $DIR/uninhabited_enum_branching2.rs:32:21: 32:24 + scope 1 { + debug plop => _1; // in scope 1 at $DIR/uninhabited_enum_branching2.rs:19:9: 19:13 + } + + bb0: { + StorageLive(_1); // scope 0 at $DIR/uninhabited_enum_branching2.rs:19:9: 19:13 + StorageLive(_2); // scope 0 at $DIR/uninhabited_enum_branching2.rs:19:38: 19:46 + discriminant(_2) = 2; // scope 0 at $DIR/uninhabited_enum_branching2.rs:19:38: 19:46 + (_1.0: u32) = const 51_u32; // scope 0 at $DIR/uninhabited_enum_branching2.rs:19:16: 19:48 + (_1.1: Test1) = move _2; // scope 0 at $DIR/uninhabited_enum_branching2.rs:19:16: 19:48 + StorageDead(_2); // scope 0 at $DIR/uninhabited_enum_branching2.rs:19:47: 19:48 + StorageLive(_3); // scope 1 at $DIR/uninhabited_enum_branching2.rs:21:5: 26:6 + StorageLive(_4); // scope 1 at $DIR/uninhabited_enum_branching2.rs:21:11: 21:22 + _4 = &(_1.1: Test1); // scope 1 at $DIR/uninhabited_enum_branching2.rs:21:11: 21:22 + _5 = discriminant((*_4)); // scope 1 at $DIR/uninhabited_enum_branching2.rs:22:9: 22:20 +- switchInt(move _5) -> [0_isize: bb2, 1_isize: bb3, 2_isize: bb4, otherwise: bb1]; // scope 1 at $DIR/uninhabited_enum_branching2.rs:22:9: 22:20 ++ switchInt(move _5) -> [2_isize: bb4, otherwise: bb1]; // scope 1 at $DIR/uninhabited_enum_branching2.rs:22:9: 22:20 + } + + bb1: { + StorageLive(_8); // scope 1 at $DIR/uninhabited_enum_branching2.rs:25:21: 25:24 + _8 = const "D"; // scope 1 at $DIR/uninhabited_enum_branching2.rs:25:21: 25:24 + // ty::Const + // + ty: &str + // + val: Value(Slice { data: Allocation { bytes: [68], relocations: Relocations(SortedMap { data: [] }), init_mask: InitMask { blocks: [1], len: Size { raw: 1 } }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 1 }) + // mir::Constant + // + span: $DIR/uninhabited_enum_branching2.rs:25:21: 25:24 + // + literal: Const { ty: &str, val: Value(Slice { data: Allocation { bytes: [68], relocations: Relocations(SortedMap { data: [] }), init_mask: InitMask { blocks: [1], len: Size { raw: 1 } }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 1 }) } + _3 = &(*_8); // scope 1 at $DIR/uninhabited_enum_branching2.rs:25:21: 25:24 + StorageDead(_8); // scope 1 at $DIR/uninhabited_enum_branching2.rs:25:23: 25:24 + goto -> bb5; // scope 1 at $DIR/uninhabited_enum_branching2.rs:21:5: 26:6 + } + + bb2: { + _3 = const "A(Empty)"; // scope 1 at $DIR/uninhabited_enum_branching2.rs:22:24: 22:34 + // ty::Const + // + ty: &str + // + val: Value(Slice { data: Allocation { bytes: [65, 40, 69, 109, 112, 116, 121, 41], relocations: Relocations(SortedMap { data: [] }), init_mask: InitMask { blocks: [255], len: Size { raw: 8 } }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 8 }) + // mir::Constant + // + span: $DIR/uninhabited_enum_branching2.rs:22:24: 22:34 + // + literal: Const { ty: &str, val: Value(Slice { data: Allocation { bytes: [65, 40, 69, 109, 112, 116, 121, 41], relocations: Relocations(SortedMap { data: [] }), init_mask: InitMask { blocks: [255], len: Size { raw: 8 } }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 8 }) } + goto -> bb5; // scope 1 at $DIR/uninhabited_enum_branching2.rs:21:5: 26:6 + } + + bb3: { + StorageLive(_6); // scope 1 at $DIR/uninhabited_enum_branching2.rs:23:24: 23:34 + _6 = const "B(Empty)"; // scope 1 at $DIR/uninhabited_enum_branching2.rs:23:24: 23:34 + // ty::Const + // + ty: &str + // + val: Value(Slice { data: Allocation { bytes: [66, 40, 69, 109, 112, 116, 121, 41], relocations: Relocations(SortedMap { data: [] }), init_mask: InitMask { blocks: [255], len: Size { raw: 8 } }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 8 }) + // mir::Constant + // + span: $DIR/uninhabited_enum_branching2.rs:23:24: 23:34 + // + literal: Const { ty: &str, val: Value(Slice { data: Allocation { bytes: [66, 40, 69, 109, 112, 116, 121, 41], relocations: Relocations(SortedMap { data: [] }), init_mask: InitMask { blocks: [255], len: Size { raw: 8 } }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 8 }) } + _3 = &(*_6); // scope 1 at $DIR/uninhabited_enum_branching2.rs:23:24: 23:34 + StorageDead(_6); // scope 1 at $DIR/uninhabited_enum_branching2.rs:23:33: 23:34 + goto -> bb5; // scope 1 at $DIR/uninhabited_enum_branching2.rs:21:5: 26:6 + } + + bb4: { + StorageLive(_7); // scope 1 at $DIR/uninhabited_enum_branching2.rs:24:21: 24:24 + _7 = const "C"; // scope 1 at $DIR/uninhabited_enum_branching2.rs:24:21: 24:24 + // ty::Const + // + ty: &str + // + val: Value(Slice { data: Allocation { bytes: [67], relocations: Relocations(SortedMap { data: [] }), init_mask: InitMask { blocks: [1], len: Size { raw: 1 } }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 1 }) + // mir::Constant + // + span: $DIR/uninhabited_enum_branching2.rs:24:21: 24:24 + // + literal: Const { ty: &str, val: Value(Slice { data: Allocation { bytes: [67], relocations: Relocations(SortedMap { data: [] }), init_mask: InitMask { blocks: [1], len: Size { raw: 1 } }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 1 }) } + _3 = &(*_7); // scope 1 at $DIR/uninhabited_enum_branching2.rs:24:21: 24:24 + StorageDead(_7); // scope 1 at $DIR/uninhabited_enum_branching2.rs:24:23: 24:24 + goto -> bb5; // scope 1 at $DIR/uninhabited_enum_branching2.rs:21:5: 26:6 + } + + bb5: { + StorageDead(_4); // scope 1 at $DIR/uninhabited_enum_branching2.rs:26:6: 26:7 + StorageDead(_3); // scope 1 at $DIR/uninhabited_enum_branching2.rs:26:6: 26:7 + StorageLive(_9); // scope 1 at $DIR/uninhabited_enum_branching2.rs:28:5: 33:6 + _10 = discriminant((_1.1: Test1)); // scope 1 at $DIR/uninhabited_enum_branching2.rs:29:9: 29:20 +- switchInt(move _10) -> [0_isize: bb7, 1_isize: bb8, 2_isize: bb9, otherwise: bb6]; // scope 1 at $DIR/uninhabited_enum_branching2.rs:29:9: 29:20 ++ switchInt(move _10) -> [2_isize: bb9, otherwise: bb6]; // scope 1 at $DIR/uninhabited_enum_branching2.rs:29:9: 29:20 + } + + bb6: { + StorageLive(_13); // scope 1 at $DIR/uninhabited_enum_branching2.rs:32:21: 32:24 + _13 = const "D"; // scope 1 at $DIR/uninhabited_enum_branching2.rs:32:21: 32:24 + // ty::Const + // + ty: &str + // + val: Value(Slice { data: Allocation { bytes: [68], relocations: Relocations(SortedMap { data: [] }), init_mask: InitMask { blocks: [1], len: Size { raw: 1 } }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 1 }) + // mir::Constant + // + span: $DIR/uninhabited_enum_branching2.rs:32:21: 32:24 + // + literal: Const { ty: &str, val: Value(Slice { data: Allocation { bytes: [68], relocations: Relocations(SortedMap { data: [] }), init_mask: InitMask { blocks: [1], len: Size { raw: 1 } }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 1 }) } + _9 = &(*_13); // scope 1 at $DIR/uninhabited_enum_branching2.rs:32:21: 32:24 + StorageDead(_13); // scope 1 at $DIR/uninhabited_enum_branching2.rs:32:23: 32:24 + goto -> bb10; // scope 1 at $DIR/uninhabited_enum_branching2.rs:28:5: 33:6 + } + + bb7: { + _9 = const "A(Empty)"; // scope 1 at $DIR/uninhabited_enum_branching2.rs:29:24: 29:34 + // ty::Const + // + ty: &str + // + val: Value(Slice { data: Allocation { bytes: [65, 40, 69, 109, 112, 116, 121, 41], relocations: Relocations(SortedMap { data: [] }), init_mask: InitMask { blocks: [255], len: Size { raw: 8 } }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 8 }) + // mir::Constant + // + span: $DIR/uninhabited_enum_branching2.rs:29:24: 29:34 + // + literal: Const { ty: &str, val: Value(Slice { data: Allocation { bytes: [65, 40, 69, 109, 112, 116, 121, 41], relocations: Relocations(SortedMap { data: [] }), init_mask: InitMask { blocks: [255], len: Size { raw: 8 } }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 8 }) } + goto -> bb10; // scope 1 at $DIR/uninhabited_enum_branching2.rs:28:5: 33:6 + } + + bb8: { + StorageLive(_11); // scope 1 at $DIR/uninhabited_enum_branching2.rs:30:24: 30:34 + _11 = const "B(Empty)"; // scope 1 at $DIR/uninhabited_enum_branching2.rs:30:24: 30:34 + // ty::Const + // + ty: &str + // + val: Value(Slice { data: Allocation { bytes: [66, 40, 69, 109, 112, 116, 121, 41], relocations: Relocations(SortedMap { data: [] }), init_mask: InitMask { blocks: [255], len: Size { raw: 8 } }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 8 }) + // mir::Constant + // + span: $DIR/uninhabited_enum_branching2.rs:30:24: 30:34 + // + literal: Const { ty: &str, val: Value(Slice { data: Allocation { bytes: [66, 40, 69, 109, 112, 116, 121, 41], relocations: Relocations(SortedMap { data: [] }), init_mask: InitMask { blocks: [255], len: Size { raw: 8 } }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 8 }) } + _9 = &(*_11); // scope 1 at $DIR/uninhabited_enum_branching2.rs:30:24: 30:34 + StorageDead(_11); // scope 1 at $DIR/uninhabited_enum_branching2.rs:30:33: 30:34 + goto -> bb10; // scope 1 at $DIR/uninhabited_enum_branching2.rs:28:5: 33:6 + } + + bb9: { + StorageLive(_12); // scope 1 at $DIR/uninhabited_enum_branching2.rs:31:21: 31:24 + _12 = const "C"; // scope 1 at $DIR/uninhabited_enum_branching2.rs:31:21: 31:24 + // ty::Const + // + ty: &str + // + val: Value(Slice { data: Allocation { bytes: [67], relocations: Relocations(SortedMap { data: [] }), init_mask: InitMask { blocks: [1], len: Size { raw: 1 } }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 1 }) + // mir::Constant + // + span: $DIR/uninhabited_enum_branching2.rs:31:21: 31:24 + // + literal: Const { ty: &str, val: Value(Slice { data: Allocation { bytes: [67], relocations: Relocations(SortedMap { data: [] }), init_mask: InitMask { blocks: [1], len: Size { raw: 1 } }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 1 }) } + _9 = &(*_12); // scope 1 at $DIR/uninhabited_enum_branching2.rs:31:21: 31:24 + StorageDead(_12); // scope 1 at $DIR/uninhabited_enum_branching2.rs:31:23: 31:24 + goto -> bb10; // scope 1 at $DIR/uninhabited_enum_branching2.rs:28:5: 33:6 + } + + bb10: { + StorageDead(_9); // scope 1 at $DIR/uninhabited_enum_branching2.rs:33:6: 33:7 + _0 = const (); // scope 0 at $DIR/uninhabited_enum_branching2.rs:18:11: 34:2 + StorageDead(_1); // scope 0 at $DIR/uninhabited_enum_branching2.rs:34:1: 34:2 + return; // scope 0 at $DIR/uninhabited_enum_branching2.rs:34:2: 34:2 + } + } + diff --git a/src/test/mir-opt/uninhabited_enum_branching2.rs b/src/test/mir-opt/uninhabited_enum_branching2.rs new file mode 100644 index 00000000000..e22e94314d9 --- /dev/null +++ b/src/test/mir-opt/uninhabited_enum_branching2.rs @@ -0,0 +1,34 @@ +enum Empty { } + +// test matching an enum with uninhabited variants +enum Test1 { + A(Empty), + B(Empty), + C, + D, +} + +struct Plop { + xx: u32, + test1: Test1, +} + +// EMIT_MIR uninhabited_enum_branching2.main.UninhabitedEnumBranching.diff +// EMIT_MIR uninhabited_enum_branching2.main.SimplifyCfg-after-uninhabited-enum-branching.after.mir +fn main() { + let plop = Plop { xx: 51, test1: Test1::C }; + + match &plop.test1 { + Test1::A(_) => "A(Empty)", + Test1::B(_) => "B(Empty)", + Test1::C => "C", + Test1::D => "D", + }; + + match plop.test1 { + Test1::A(_) => "A(Empty)", + Test1::B(_) => "B(Empty)", + Test1::C => "C", + Test1::D => "D", + }; +} diff --git a/src/test/pretty/ast-stmt-expr-attr.rs b/src/test/pretty/ast-stmt-expr-attr.rs index 0c9ccfcf278..32d1da390c5 100644 --- a/src/test/pretty/ast-stmt-expr-attr.rs +++ b/src/test/pretty/ast-stmt-expr-attr.rs @@ -43,10 +43,10 @@ fn syntax() { #![attr] }; let _ = - #[attr] match true - { - #[attr] - _ => false, + #[attr] match true { + #![attr] + #[attr] + _ => false, }; let _ = #[attr] || #[attr] foo; let _ = #[attr] move || #[attr] foo; diff --git a/src/test/pretty/block-comment-wchar.pp b/src/test/pretty/block-comment-wchar.pp index 2bfcdd75e15..2d0a10d4c27 100644 --- a/src/test/pretty/block-comment-wchar.pp +++ b/src/test/pretty/block-comment-wchar.pp @@ -90,7 +90,7 @@ fn f() { } fn main() { - // Taken from http://www.unicode.org/Public/UNIDATA/PropList.txt + // Taken from https://www.unicode.org/Public/UNIDATA/PropList.txt let chars = ['\x0A', '\x0B', '\x0C', '\x0D', '\x20', '\u{85}', '\u{A0}', '\u{1680}', '\u{2000}', '\u{2001}', '\u{2002}', '\u{2003}', diff --git a/src/test/pretty/block-comment-wchar.rs b/src/test/pretty/block-comment-wchar.rs index 93373c5da65..075230196e3 100644 --- a/src/test/pretty/block-comment-wchar.rs +++ b/src/test/pretty/block-comment-wchar.rs @@ -86,7 +86,7 @@ fn f() { } fn main() { - // Taken from http://www.unicode.org/Public/UNIDATA/PropList.txt + // Taken from https://www.unicode.org/Public/UNIDATA/PropList.txt let chars = ['\x0A', '\x0B', '\x0C', '\x0D', '\x20', '\u{85}', '\u{A0}', '\u{1680}', '\u{2000}', '\u{2001}', '\u{2002}', '\u{2003}', diff --git a/src/test/pretty/stmt_expr_attributes.rs b/src/test/pretty/stmt_expr_attributes.rs index 87692905f51..e4a3acade87 100644 --- a/src/test/pretty/stmt_expr_attributes.rs +++ b/src/test/pretty/stmt_expr_attributes.rs @@ -41,9 +41,16 @@ fn _3() { fn _4() { #[rustc_dummy] - match () { _ => (), } + match () { + #![rustc_dummy] + _ => (), + } - let _ = #[rustc_dummy] match () { () => (), }; + let _ = + #[rustc_dummy] match () { + #![rustc_dummy] + () => (), + }; } fn _5() { @@ -163,7 +170,11 @@ fn _11() { #[rustc_dummy] loop { #![rustc_dummy] }; - let _ = #[rustc_dummy] match false { _ => (), }; + let _ = + #[rustc_dummy] match false { + #![rustc_dummy] + _ => (), + }; let _ = #[rustc_dummy] || #[rustc_dummy] (); let _ = #[rustc_dummy] move || #[rustc_dummy] (); let _ = diff --git a/src/test/run-make-fulldeps/extern-fn-with-packed-struct/test.c b/src/test/run-make-fulldeps/extern-fn-with-packed-struct/test.c index 52af3dceb10..c89f8272b1e 100644 --- a/src/test/run-make-fulldeps/extern-fn-with-packed-struct/test.c +++ b/src/test/run-make-fulldeps/extern-fn-with-packed-struct/test.c @@ -1,4 +1,4 @@ -// Pragma needed cause of gcc bug on windows: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52991 +// Pragma needed cause of gcc bug on windows: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52991 #include <assert.h> diff --git a/src/test/run-make/emit-path-unhashed/Makefile b/src/test/run-make/emit-path-unhashed/Makefile new file mode 100644 index 00000000000..b6b2d8af648 --- /dev/null +++ b/src/test/run-make/emit-path-unhashed/Makefile @@ -0,0 +1,37 @@ +-include ../../run-make-fulldeps/tools.mk + +OUT=$(TMPDIR)/emit + +# --emit KIND=PATH should not affect crate hash vs --emit KIND +all: $(OUT)/a/libfoo.rlib $(OUT)/b/libfoo.rlib $(OUT)/c/libfoo.rlib \ + $(TMPDIR)/libfoo.rlib + $(RUSTC) -Zls $(TMPDIR)/libfoo.rlib > $(TMPDIR)/base.txt + $(RUSTC) -Zls $(OUT)/a/libfoo.rlib > $(TMPDIR)/a.txt + $(RUSTC) -Zls $(OUT)/b/libfoo.rlib > $(TMPDIR)/b.txt + $(RUSTC) -Zls $(OUT)/c/libfoo.rlib > $(TMPDIR)/c.txt + + diff $(TMPDIR)/base.txt $(TMPDIR)/a.txt + diff $(TMPDIR)/base.txt $(TMPDIR)/b.txt + + # Different KIND parameters do affect hash. + # diff exits 1 on difference, 2 on trouble + diff $(TMPDIR)/base.txt $(TMPDIR)/c.txt ; test "$$?" -eq 1 + +# Default output name +$(TMPDIR)/libfoo.rlib: foo.rs + $(RUSTC) --emit link foo.rs + +# Output named with -o +$(OUT)/a/libfoo.rlib: foo.rs + mkdir -p $(OUT)/a + $(RUSTC) --emit link -o $@ foo.rs + +# Output named with KIND=PATH +$(OUT)/b/libfoo.rlib: foo.rs + mkdir -p $(OUT)/b + $(RUSTC) --emit link=$@ foo.rs + +# Output multiple kinds +$(OUT)/c/libfoo.rlib: foo.rs + mkdir -p $(OUT)/c + $(RUSTC) --emit link=$@,metadata foo.rs diff --git a/src/test/run-make/emit-path-unhashed/foo.rs b/src/test/run-make/emit-path-unhashed/foo.rs new file mode 100644 index 00000000000..c1bfaa6cab5 --- /dev/null +++ b/src/test/run-make/emit-path-unhashed/foo.rs @@ -0,0 +1 @@ +#![crate_type = "rlib"] diff --git a/src/test/rustdoc-gui/README.md b/src/test/rustdoc-gui/README.md index 499a98a3d22..8efe7a578b8 100644 --- a/src/test/rustdoc-gui/README.md +++ b/src/test/rustdoc-gui/README.md @@ -8,5 +8,17 @@ test what's being currently displayed in the web page. You can find more information and its documentation in its [repository][browser-ui-test]. +If you need to have more information on the tests run, you can use `--test-args`: + +```bash +$ ./x.py test src/test/rustdoc-gui --stage 1 --jobs 8 --test-args --debug +``` + +There are three options supported: + + * `--debug`: allows to see puppeteer commands. + * `--no-headless`: disable headless mode so you can see what's going on. + * `--show-text`: by default, text isn't rendered because of issues with fonts, it enables it back. + [browser-ui-test]: https://github.com/GuillaumeGomez/browser-UI-test/ [puppeteer]: https://pptr.dev/ diff --git a/src/test/rustdoc-gui/basic-code.goml b/src/test/rustdoc-gui/basic-code.goml index d014ed60eb0..27deb2c989c 100644 --- a/src/test/rustdoc-gui/basic-code.goml +++ b/src/test/rustdoc-gui/basic-code.goml @@ -1,3 +1,3 @@ goto: file://|DOC_PATH|/test_docs/index.html click: ".srclink" -assert: (".line-numbers", 1) +assert-count: (".line-numbers", 1) diff --git a/src/test/rustdoc-gui/check_info_sign_position.goml b/src/test/rustdoc-gui/check_info_sign_position.goml index d64ee026137..94e3fe79c94 100644 --- a/src/test/rustdoc-gui/check_info_sign_position.goml +++ b/src/test/rustdoc-gui/check_info_sign_position.goml @@ -2,8 +2,8 @@ goto: file://|DOC_PATH|/test_docs/index.html goto: ./fn.check_list_code_block.html // If the codeblock is the first element of the docblock, the information tooltip must have // have some top margin to avoid going over the toggle (the "[+]"). -assert: (".docblock > .information > .compile_fail", { "margin-top": "16px" }) +assert-css: (".docblock > .information > .compile_fail", { "margin-top": "16px" }) // Checks that the other codeblocks don't have this top margin. -assert: ("ol > li > .information > .compile_fail", { "margin-top": "0px" }) -assert: ("ol > li > .information > .ignore", { "margin-top": "0px" }) -assert: (".docblock > .information > .ignore", { "margin-top": "0px" }) +assert-css: ("ol > li > .information > .compile_fail", { "margin-top": "0px" }) +assert-css: ("ol > li > .information > .ignore", { "margin-top": "0px" }) +assert-css: (".docblock > .information > .ignore", { "margin-top": "0px" }) diff --git a/src/test/rustdoc-gui/code-sidebar-toggle.goml b/src/test/rustdoc-gui/code-sidebar-toggle.goml index 7e7003d4340..00326e9bbc4 100644 --- a/src/test/rustdoc-gui/code-sidebar-toggle.goml +++ b/src/test/rustdoc-gui/code-sidebar-toggle.goml @@ -3,4 +3,4 @@ click: ".srclink" click: "#sidebar-toggle" wait-for: 500 fail: true -assert: ("#source-sidebar", { "left": "-300px" }) +assert-css: ("#source-sidebar", { "left": "-300px" }) diff --git a/src/test/rustdoc-gui/escape-key.goml b/src/test/rustdoc-gui/escape-key.goml index ec034f52c97..5cf8a5e136e 100644 --- a/src/test/rustdoc-gui/escape-key.goml +++ b/src/test/rustdoc-gui/escape-key.goml @@ -2,25 +2,25 @@ goto: file://|DOC_PATH|/test_docs/index.html // First, we check that the search results are hidden when the Escape key is pressed. write: (".search-input", "test") wait-for: "#search > h1" // The search element is empty before the first search -assert: ("#search", "class", "content") -assert: ("#main", "class", "content hidden") +assert-attribute: ("#search", {"class": "content"}) +assert-attribute: ("#main", {"class": "content hidden"}) press-key: "Escape" -assert: ("#search", "class", "content hidden") -assert: ("#main", "class", "content") +assert-attribute: ("#search", {"class": "content hidden"}) +assert-attribute: ("#main", {"class": "content"}) // Check that focusing the search input brings back the search results focus: ".search-input" -assert: ("#search", "class", "content") -assert: ("#main", "class", "content hidden") +assert-attribute: ("#search", {"class": "content"}) +assert-attribute: ("#main", {"class": "content hidden"}) // Now let's check that when the help popup is displayed and we press Escape, it doesn't // hide the search results too. click: "#help-button" -assert: ("#help", "class", "") +assert-attribute: ("#help", {"class": ""}) press-key: "Escape" -assert: ("#help", "class", "hidden") -assert: ("#search", "class", "content") -assert: ("#main", "class", "content hidden") +assert-attribute: ("#help", {"class": "hidden"}) +assert-attribute: ("#search", {"class": "content"}) +assert-attribute: ("#main", {"class": "content hidden"}) // Check that Escape hides the search results when a search result is focused. focus: ".search-input" @@ -29,6 +29,6 @@ press-key: "ArrowDown" assert-false: ".search-input:focus" assert: "#results a:focus" press-key: "Escape" -assert: ("#help", "class", "hidden") -assert: ("#search", "class", "content hidden") -assert: ("#main", "class", "content") +assert-attribute: ("#help", {"class": "hidden"}) +assert-attribute: ("#search", {"class": "content hidden"}) +assert-attribute: ("#main", {"class": "content"}) diff --git a/src/test/rustdoc-gui/font-weight.goml b/src/test/rustdoc-gui/font-weight.goml index d8ad6c2e3f5..80618112103 100644 --- a/src/test/rustdoc-gui/font-weight.goml +++ b/src/test/rustdoc-gui/font-weight.goml @@ -1,7 +1,7 @@ goto: file://|DOC_PATH|/lib2/struct.Foo.html // This test checks that the font weight is correctly applied. -assert: ("//*[@class='docblock type-decl']//a[text()='Alias']", {"font-weight": "400"}) -assert: ("//*[@class='structfield small-section-header']//a[text()='Alias']", {"font-weight": "400"}) -assert: ("#method\.a_method > code", {"font-weight": "600"}) -assert: ("#associatedtype\.X > code", {"font-weight": "600"}) -assert: ("#associatedconstant\.Y > code", {"font-weight": "600"}) +assert-css: ("//*[@class='docblock type-decl']//a[text()='Alias']", {"font-weight": "400"}) +assert-css: ("//*[@class='structfield small-section-header']//a[text()='Alias']", {"font-weight": "400"}) +assert-css: ("#method\.a_method > code", {"font-weight": "600"}) +assert-css: ("#associatedtype\.X > code", {"font-weight": "600"}) +assert-css: ("#associatedconstant\.Y > code", {"font-weight": "600"}) diff --git a/src/test/rustdoc-gui/hash-item-expansion.goml b/src/test/rustdoc-gui/hash-item-expansion.goml index 1248d11200e..42bc1c10020 100644 --- a/src/test/rustdoc-gui/hash-item-expansion.goml +++ b/src/test/rustdoc-gui/hash-item-expansion.goml @@ -1,18 +1,15 @@ // This test ensures that the element corresponding to the hash is displayed. goto: file://|DOC_PATH|/test_docs/struct.Foo.html#method.borrow // In the blanket implementations list, "Borrow" is the second one, hence the ":nth(2)". -assert: ("#blanket-implementations-list > details:nth-child(2)", "open", "") -// Please note the "\" below is needed because otherwise ".borrow" would be interpreted as -// a class selector. -assert: ("#method\.borrow", {"display": "flex"}) +assert-attribute: ("#blanket-implementations-list > details:nth-child(2)", {"open": ""}) // We first check that the impl block is open by default. -assert: ("#implementations + details", "open", "") +assert-attribute: ("#implementations + details", {"open": ""}) // We collapse it. click: "#implementations + details > summary" // We check that it was collapsed as expected. -assert-false: ("#implementations + details", "open", "") +assert-attribute-false: ("#implementations + details", {"open": ""}) // To ensure that we will click on the currently hidden method. -assert: (".sidebar-links > a", "must_use") +assert-text: (".sidebar-links > a", "must_use") click: ".sidebar-links > a" // We check that the impl block was opened as expected so that we can see the method. -assert: ("#implementations + details", "open", "") +assert-attribute: ("#implementations + details", {"open": ""}) diff --git a/src/test/rustdoc-gui/impl-default-expansion.goml b/src/test/rustdoc-gui/impl-default-expansion.goml index 3f1e7ec4a78..b268ec68d42 100644 --- a/src/test/rustdoc-gui/impl-default-expansion.goml +++ b/src/test/rustdoc-gui/impl-default-expansion.goml @@ -1,3 +1,3 @@ // This test ensures that the impl blocks are open by default. goto: file://|DOC_PATH|/test_docs/struct.Foo.html -assert: ("#main > details.implementors-toggle", "open", "") +assert-attribute: ("#main > details.implementors-toggle", {"open": ""}) diff --git a/src/test/rustdoc-gui/search-filter.goml b/src/test/rustdoc-gui/search-filter.goml new file mode 100644 index 00000000000..a098dbd9f12 --- /dev/null +++ b/src/test/rustdoc-gui/search-filter.goml @@ -0,0 +1,17 @@ +goto: file://|DOC_PATH|/test_docs/index.html +write: (".search-input", "test") +// Waiting for the search results to appear... +wait-for: "#titles" +assert-text: ("#results .externcrate", "test_docs") +text: (".search-input", "") +// We now want to change the crate filter. +click: "#crate-search" +// We select "lib2" option then press enter to change the filter. +press-key: "ArrowDown" +press-key: "Enter" +// We now make the search again. +write: (".search-input", "test") +// Waiting for the search results to appear... +wait-for: "#titles" +// We check that there is no more "test_docs" appearing. +assert-false: "#results .externcrate" diff --git a/src/test/rustdoc-gui/search-result-colors.goml b/src/test/rustdoc-gui/search-result-colors.goml index 25a01512159..6ed62006151 100644 --- a/src/test/rustdoc-gui/search-result-colors.goml +++ b/src/test/rustdoc-gui/search-result-colors.goml @@ -10,5 +10,5 @@ write: (".search-input", "thisisanalias") // Waiting for the search results to appear... wait-for: "#titles" // Checking that the colors for the alias element are the ones expected. -assert: (".result-name > .alias", {"color": "rgb(255, 255, 255)"}) -assert: (".result-name > .alias > .grey", {"color": "rgb(204, 204, 204)"}) +assert-css: (".result-name > .alias", {"color": "rgb(255, 255, 255)"}) +assert-css: (".result-name > .alias > .grey", {"color": "rgb(204, 204, 204)"}) diff --git a/src/test/rustdoc-gui/search-result-description.goml b/src/test/rustdoc-gui/search-result-description.goml index a50d03cf489..d8cb6ee5731 100644 --- a/src/test/rustdoc-gui/search-result-description.goml +++ b/src/test/rustdoc-gui/search-result-description.goml @@ -2,4 +2,4 @@ goto: file://|DOC_PATH|/test_docs/index.html?search=some_more_function // Waiting for the search results to appear... wait-for: "#titles" -assert: (".search-results .desc code", "format!") +assert-text: (".search-results .desc code", "format!") diff --git a/src/test/rustdoc-gui/search-result-display.goml b/src/test/rustdoc-gui/search-result-display.goml index 96d15c624f1..ea94e5640fb 100644 --- a/src/test/rustdoc-gui/search-result-display.goml +++ b/src/test/rustdoc-gui/search-result-display.goml @@ -5,8 +5,8 @@ write: (".search-input", "test") wait-for: "#titles" // The width is returned by "getComputedStyle" which returns the exact number instead of the // CSS rule which is "50%"... -assert: (".search-results div.desc", {"width": "320px"}) +assert-css: (".search-results div.desc", {"width": "320px"}) size: (600, 100) // As counter-intuitive as it may seem, in this width, the width is "100%", which is why // when computed it's larger. -assert: (".search-results div.desc", {"width": "570px"}) +assert-css: (".search-results div.desc", {"width": "570px"}) diff --git a/src/test/rustdoc-gui/search-result-keyword.goml b/src/test/rustdoc-gui/search-result-keyword.goml index e7612d66371..5342d431d99 100644 --- a/src/test/rustdoc-gui/search-result-keyword.goml +++ b/src/test/rustdoc-gui/search-result-keyword.goml @@ -6,5 +6,5 @@ wait-for: "#titles" // less good. // // Checking that the CSS is displaying " (keyword)" in italic. -assert: (".result-name span.keyword > i", "(keyword)") -assert: (".result-name span.keyword", "CookieMonster (keyword)") +assert-text: (".result-name span.keyword > i", "(keyword)") +assert-text: (".result-name span.keyword", "CookieMonster (keyword)") diff --git a/src/test/rustdoc-gui/search-tab-selection-if-current-is-empty.goml b/src/test/rustdoc-gui/search-tab-selection-if-current-is-empty.goml index c828c72e910..a61ec672ae6 100644 --- a/src/test/rustdoc-gui/search-tab-selection-if-current-is-empty.goml +++ b/src/test/rustdoc-gui/search-tab-selection-if-current-is-empty.goml @@ -2,7 +2,7 @@ goto: file://|DOC_PATH|/test_docs/index.html write: (".search-input", "Foo") // Waiting for the search results to appear... wait-for: "#titles" -assert: ("#titles > button:nth-of-type(1)", "class", "selected") +assert-attribute: ("#titles > button:nth-of-type(1)", {"class": "selected"}) // To go back to the original "state" goto: file://|DOC_PATH|/test_docs/index.html @@ -10,7 +10,7 @@ write: (".search-input", "-> String") // Waiting for the search results to appear... wait-for: "#titles" // With this search, only the last tab shouldn't be empty so it should be selected. -assert: ("#titles > button:nth-of-type(3)", "class", "selected") +assert-attribute: ("#titles > button:nth-of-type(3)", {"class": "selected"}) // To go back to the original "state" goto: file://|DOC_PATH|/test_docs/index.html @@ -18,4 +18,4 @@ write: (".search-input", "-> Something") // Waiting for the search results to appear... wait-for: "#titles" // With this search, all the tabs are empty so the first one should remain selected. -assert: ("#titles > button:nth-of-type(1)", "class", "selected") +assert-attribute: ("#titles > button:nth-of-type(1)", {"class": "selected"}) diff --git a/src/test/rustdoc-gui/shortcuts.goml b/src/test/rustdoc-gui/shortcuts.goml index 884c38d85fb..42d945d0eb8 100644 --- a/src/test/rustdoc-gui/shortcuts.goml +++ b/src/test/rustdoc-gui/shortcuts.goml @@ -8,19 +8,19 @@ press-key: "Escape" assert-false: "input.search-input:focus" // We now check for the help popup. press-key: "?" -assert: ("#help", {"display": "flex"}) +assert-css: ("#help", {"display": "flex"}) assert-false: "#help.hidden" press-key: "Escape" -assert: ("#help.hidden", {"display": "none"}) +assert-css: ("#help.hidden", {"display": "none"}) // Check for the themes list. -assert: ("#theme-choices", {"display": "none"}) +assert-css: ("#theme-choices", {"display": "none"}) press-key: "t" -assert: ("#theme-choices", {"display": "block"}) +assert-css: ("#theme-choices", {"display": "block"}) press-key: "t" // We ensure that 't' hides back the menu. -assert: ("#theme-choices", {"display": "none"}) +assert-css: ("#theme-choices", {"display": "none"}) press-key: "t" -assert: ("#theme-choices", {"display": "block"}) +assert-css: ("#theme-choices", {"display": "block"}) press-key: "Escape" // We ensure that 'Escape' hides the menu too. -assert: ("#theme-choices", {"display": "none"}) +assert-css: ("#theme-choices", {"display": "none"}) diff --git a/src/test/rustdoc-gui/sidebar.goml b/src/test/rustdoc-gui/sidebar.goml index e0e6d19cace..c8ebb8c56f5 100644 --- a/src/test/rustdoc-gui/sidebar.goml +++ b/src/test/rustdoc-gui/sidebar.goml @@ -1,23 +1,23 @@ goto: file://|DOC_PATH|/test_docs/index.html -assert: (".sidebar > .location", "Crate test_docs") +assert-text: (".sidebar > .location", "Crate test_docs") // In modules, we only have one "location" element. -assert: (".sidebar .location", 1) -assert: (".sidebar-elems > #all-types", "See all test_docs's items") +assert-count: (".sidebar .location", 1) +assert-text: (".sidebar-elems > #all-types", "See all test_docs's items") // We check that we have the crates list and that the "current" on is "test_docs". -assert: (".sidebar-elems > .crate > ul > li > a.current", "test_docs") +assert-text: (".sidebar-elems > .crate > ul > li > a.current", "test_docs") // And we're also supposed to have the list of items in the current module. -assert: (".sidebar-elems > .items > ul > li:nth-child(1)", "Modules") -assert: (".sidebar-elems > .items > ul > li:nth-child(2)", "Structs") -assert: (".sidebar-elems > .items > ul > li:nth-child(3)", "Enums") -assert: (".sidebar-elems > .items > ul > li:nth-child(4)", "Traits") -assert: (".sidebar-elems > .items > ul > li:nth-child(5)", "Functions") -assert: (".sidebar-elems > .items > ul > li:nth-child(6)", "Type Definitions") -assert: (".sidebar-elems > .items > ul > li:nth-child(7)", "Keywords") -assert: ("#structs + table td > a", "Foo") -click: "#structs + table td > a" +assert-text: (".sidebar-elems > .items > ul > li:nth-child(1)", "Modules") +assert-text: (".sidebar-elems > .items > ul > li:nth-child(2)", "Structs") +assert-text: (".sidebar-elems > .items > ul > li:nth-child(3)", "Enums") +assert-text: (".sidebar-elems > .items > ul > li:nth-child(4)", "Traits") +assert-text: (".sidebar-elems > .items > ul > li:nth-child(5)", "Functions") +assert-text: (".sidebar-elems > .items > ul > li:nth-child(6)", "Type Definitions") +assert-text: (".sidebar-elems > .items > ul > li:nth-child(7)", "Keywords") +assert-text: ("#structs + .item-table .item-left > a", "Foo") +click: "#structs + .item-table .item-left > a" // PAGE: struct.Foo.html -assert: (".sidebar .location", 2) +assert-count: (".sidebar .location", 2) // We check that there is no crate listed outside of the top level. assert-false: ".sidebar-elems > .crate" // We now go back to the crate page to click on the "lib2" crate link. @@ -26,35 +26,35 @@ click: ".sidebar-elems > .crate > ul > li:first-child > a" // PAGE: lib2/index.html goto: file://|DOC_PATH|/lib2/index.html -assert: (".sidebar > .location", "Crate lib2") +assert-text: (".sidebar > .location", "Crate lib2") // We check that we have the crates list and that the "current" on is now "lib2". -assert: (".sidebar-elems > .crate > ul > li > a.current", "lib2") +assert-text: (".sidebar-elems > .crate > ul > li > a.current", "lib2") // We now go to the "foobar" function page. -assert: (".sidebar-elems > .items > ul > li:nth-child(1)", "Modules") -assert: (".sidebar-elems > .items > ul > li:nth-child(2)", "Structs") -assert: (".sidebar-elems > .items > ul > li:nth-child(3)", "Traits") -assert: (".sidebar-elems > .items > ul > li:nth-child(4)", "Functions") -assert: (".sidebar-elems > .items > ul > li:nth-child(5)", "Type Definitions") -assert: ("#functions + table td > a", "foobar") -click: "#functions + table td > a" +assert-text: (".sidebar-elems > .items > ul > li:nth-child(1)", "Modules") +assert-text: (".sidebar-elems > .items > ul > li:nth-child(2)", "Structs") +assert-text: (".sidebar-elems > .items > ul > li:nth-child(3)", "Traits") +assert-text: (".sidebar-elems > .items > ul > li:nth-child(4)", "Functions") +assert-text: (".sidebar-elems > .items > ul > li:nth-child(5)", "Type Definitions") +assert-text: ("#functions + .item-table .item-left > a", "foobar") +click: "#functions + .item-table .item-left > a" // PAGE: fn.foobar.html // In items containing no items (like functions or constants) and in modules, we have one // "location" elements. -assert: (".sidebar .location", 1) +assert-count: (".sidebar .location", 1) // There is a "<br>" tag between "in" and "lib2", but it doesn't count as a space. -assert: (".sidebar .sidebar-elems .location", "Other items inlib2") +assert-text: (".sidebar .sidebar-elems .location", "Other items inlib2") // We check that we don't have the crate list. assert-false: ".sidebar-elems > .crate" goto: ./module/index.html -assert: (".sidebar > .location", "Module module") +assert-text: (".sidebar > .location", "Module module") // We check that we don't have the crate list. assert-false: ".sidebar-elems > .crate" goto: ./sub_module/sub_sub_module/index.html -assert: (".sidebar > .location", "Module sub_sub_module") +assert-text: (".sidebar > .location", "Module sub_sub_module") // We check that we don't have the crate list. assert-false: ".sidebar-elems > .crate" -assert: (".sidebar-elems > .items > ul > li:nth-child(1)", "Functions") -assert: ("#functions + table td > a", "foo") +assert-text: (".sidebar-elems > .items > ul > li:nth-child(1)", "Functions") +assert-text: ("#functions + .item-table .item-left > a", "foo") diff --git a/src/test/rustdoc-gui/source-code-page.goml b/src/test/rustdoc-gui/source-code-page.goml index ff33a541a18..d7bae93c211 100644 --- a/src/test/rustdoc-gui/source-code-page.goml +++ b/src/test/rustdoc-gui/source-code-page.goml @@ -3,11 +3,13 @@ goto: file://|DOC_PATH|/src/test_docs/lib.rs.html click: (40, 224) // This is the position of the span for line 4. // Unfortunately, "#4" isn't a valid query selector, so we have to go around that limitation // by instead getting the nth span. -assert: (".line-numbers > span:nth-child(4)", "class", "line-highlighted") +assert-attribute: (".line-numbers > span:nth-child(4)", {"class": "line-highlighted"}) // We now check that the good spans are highlighted goto: file://|DOC_PATH|/src/test_docs/lib.rs.html#4-6 -assert-false: (".line-numbers > span:nth-child(3)", "class", "line-highlighted") -assert: (".line-numbers > span:nth-child(4)", "class", "line-highlighted") -assert: (".line-numbers > span:nth-child(5)", "class", "line-highlighted") -assert: (".line-numbers > span:nth-child(6)", "class", "line-highlighted") -assert-false: (".line-numbers > span:nth-child(7)", "class", "line-highlighted") +assert-attribute-false: (".line-numbers > span:nth-child(3)", {"class": "line-highlighted"}) +assert-attribute: (".line-numbers > span:nth-child(4)", {"class": "line-highlighted"}) +assert-attribute: (".line-numbers > span:nth-child(5)", {"class": "line-highlighted"}) +assert-attribute: (".line-numbers > span:nth-child(6)", {"class": "line-highlighted"}) +assert-attribute-false: (".line-numbers > span:nth-child(7)", {"class": "line-highlighted"}) +// This is to ensure that the content is correctly align with the line numbers. +compare-elements-position: ("//*[@id='1']", ".rust > span", ("y")) diff --git a/src/test/rustdoc-gui/theme-change.goml b/src/test/rustdoc-gui/theme-change.goml index bc9063edd1e..5221cda2f1f 100644 --- a/src/test/rustdoc-gui/theme-change.goml +++ b/src/test/rustdoc-gui/theme-change.goml @@ -3,8 +3,8 @@ click: "#theme-picker" click: "#theme-choices > button:first-child" wait-for: 500 // should be the ayu theme so let's check the color -assert: ("body", { "background-color": "rgb(15, 20, 25)" }) +assert-css: ("body", { "background-color": "rgb(15, 20, 25)" }) click: "#theme-choices > button:last-child" wait-for: 500 // should be the light theme so let's check the color -assert: ("body", { "background-color": "rgb(255, 255, 255)" }) +assert-css: ("body", { "background-color": "rgb(255, 255, 255)" }) diff --git a/src/test/rustdoc-gui/toggle-docs-mobile.goml b/src/test/rustdoc-gui/toggle-docs-mobile.goml index fcdfc0344db..471d88701d4 100644 --- a/src/test/rustdoc-gui/toggle-docs-mobile.goml +++ b/src/test/rustdoc-gui/toggle-docs-mobile.goml @@ -1,21 +1,21 @@ goto: file://|DOC_PATH|/test_docs/struct.Foo.html size: (433, 600) -assert: (".top-doc", "open", "") +assert-attribute: (".top-doc", {"open": ""}) click: (4, 280) // This is the position of the top doc comment toggle -assert-false: (".top-doc", "open", "") +assert-attribute-false: (".top-doc", {"open": ""}) click: (4, 280) -assert: (".top-doc", "open", "") +assert-attribute: (".top-doc", {"open": ""}) // To ensure that the toggle isn't over the text, we check that the toggle isn't clicked. click: (3, 280) -assert: (".top-doc", "open", "") +assert-attribute: (".top-doc", {"open": ""}) // Now we do the same but with a little bigger width size: (600, 600) -assert: (".top-doc", "open", "") +assert-attribute: (".top-doc", {"open": ""}) click: (4, 240) // New Y position since all search elements are back on one line. -assert-false: (".top-doc", "open", "") +assert-attribute-false: (".top-doc", {"open": ""}) click: (4, 240) -assert: (".top-doc", "open", "") +assert-attribute: (".top-doc", {"open": ""}) // To ensure that the toggle isn't over the text, we check that the toggle isn't clicked. click: (3, 240) -assert: (".top-doc", "open", "") +assert-attribute: (".top-doc", {"open": ""}) diff --git a/src/test/rustdoc-gui/toggle-docs.goml b/src/test/rustdoc-gui/toggle-docs.goml index 062bc7d51e5..136868f3175 100644 --- a/src/test/rustdoc-gui/toggle-docs.goml +++ b/src/test/rustdoc-gui/toggle-docs.goml @@ -1,10 +1,10 @@ goto: file://|DOC_PATH|/test_docs/index.html -assert: ("#main > details.top-doc", "open", "") +assert-attribute: ("#main > details.top-doc", {"open": ""}) click: "#toggle-all-docs" wait-for: 1000 // This is now collapsed so there shouldn't be the "open" attribute on details. -assert-false: ("#main > details.top-doc", "open", "") +assert-attribute-false: ("#main > details.top-doc", {"open": ""}) click: "#toggle-all-docs" wait-for: 1000 // Not collapsed anymore so the "open" attribute should be back. -assert: ("#main > details.top-doc", "open", "") +assert-attribute: ("#main > details.top-doc", {"open": ""}) diff --git a/src/test/rustdoc-gui/toggled-open-implementations.goml b/src/test/rustdoc-gui/toggled-open-implementations.goml new file mode 100644 index 00000000000..bc97b38c867 --- /dev/null +++ b/src/test/rustdoc-gui/toggled-open-implementations.goml @@ -0,0 +1,5 @@ +// This tests that the "implementations" section on struct/enum pages +// has all the implementations toggled open by default, so users can +// find method names in those implementations with Ctrl-F. +goto: file://|DOC_PATH|/test_docs/struct.Foo.html +assert-attribute: (".rustdoc-toggle.implementors-toggle", {"open": ""}) diff --git a/src/test/rustdoc-gui/trait-sidebar-item-order.goml b/src/test/rustdoc-gui/trait-sidebar-item-order.goml index 2e9f85336ec..739745792c2 100644 --- a/src/test/rustdoc-gui/trait-sidebar-item-order.goml +++ b/src/test/rustdoc-gui/trait-sidebar-item-order.goml @@ -1,7 +1,7 @@ goto: file://|DOC_PATH|/test_docs/trait.AnotherOne.html -assert: (".sidebar-links a:nth-of-type(1)", "another") -assert: (".sidebar-links a:nth-of-type(2)", "func1") -assert: (".sidebar-links a:nth-of-type(3)", "func2") -assert: (".sidebar-links a:nth-of-type(4)", "func3") -assert: (".sidebar-links a:nth-of-type(5)", "hello") -assert: (".sidebar-links a:nth-of-type(6)", "why_not") +assert-text: (".sidebar-links a:nth-of-type(1)", "another") +assert-text: (".sidebar-links a:nth-of-type(2)", "func1") +assert-text: (".sidebar-links a:nth-of-type(3)", "func2") +assert-text: (".sidebar-links a:nth-of-type(4)", "func3") +assert-text: (".sidebar-links a:nth-of-type(5)", "hello") +assert-text: (".sidebar-links a:nth-of-type(6)", "why_not") diff --git a/src/test/rustdoc-js/summaries.js b/src/test/rustdoc-js/summaries.js index f175e47342d..dfb11e80414 100644 --- a/src/test/rustdoc-js/summaries.js +++ b/src/test/rustdoc-js/summaries.js @@ -5,7 +5,7 @@ const QUERY = ['summaries', 'summaries::Sidebar', 'summaries::Sidebar2']; const EXPECTED = [ { 'others': [ - { 'path': '', 'name': 'summaries', 'desc': 'This <em>summary</em> has a link and <code>code</code>.' }, + { 'path': '', 'name': 'summaries', 'desc': 'This <em>summary</em> has a link, [<code>code</code>], and <code>Sidebar2</code> intra-doc.' }, ], }, { diff --git a/src/test/rustdoc-js/summaries.rs b/src/test/rustdoc-js/summaries.rs index beb91e286b6..418c9f8d0ed 100644 --- a/src/test/rustdoc-js/summaries.rs +++ b/src/test/rustdoc-js/summaries.rs @@ -1,9 +1,11 @@ #![crate_type = "lib"] #![crate_name = "summaries"] -//! This *summary* has a [link] and `code`. +//! This *summary* has a [link], [`code`], and [`Sidebar2`] intra-doc. //! -//! This is the second paragraph. +//! This is the second paragraph. It should not be rendered. +//! To test that intra-doc links are resolved properly, [`code`] should render +//! the square brackets, and [`Sidebar2`] should not. //! //! [link]: https://example.com diff --git a/src/test/rustdoc/auxiliary/cross-crate-hidden-impl-parameter.rs b/src/test/rustdoc/auxiliary/cross-crate-hidden-impl-parameter.rs new file mode 100644 index 00000000000..15953122280 --- /dev/null +++ b/src/test/rustdoc/auxiliary/cross-crate-hidden-impl-parameter.rs @@ -0,0 +1,5 @@ +#[doc(hidden)] +pub enum HiddenType {} + +#[doc(hidden)] +pub trait HiddenTrait {} diff --git a/src/test/rustdoc/auxiliary/issue-85454.rs b/src/test/rustdoc/auxiliary/issue-85454.rs new file mode 100644 index 00000000000..45664dfc382 --- /dev/null +++ b/src/test/rustdoc/auxiliary/issue-85454.rs @@ -0,0 +1,17 @@ +// @has issue_85454/trait.FromResidual.html +// @has - '//pre[@class="rust trait"]' 'pub trait FromResidual<R = <Self as Try>::Residual> { fn from_residual(residual: R) -> Self; }' +pub trait FromResidual<R = <Self as Try>::Residual> { + fn from_residual(residual: R) -> Self; +} + +pub trait Try: FromResidual { + type Output; + type Residual; + fn from_output(output: Self::Output) -> Self; + fn branch(self) -> ControlFlow<Self::Residual, Self::Output>; +} + +pub enum ControlFlow<B, C = ()> { + Continue(C), + Break(B), +} diff --git a/src/test/rustdoc/const-display.rs b/src/test/rustdoc/const-display.rs index 2761f92ef57..8c995b9426b 100644 --- a/src/test/rustdoc/const-display.rs +++ b/src/test/rustdoc/const-display.rs @@ -7,12 +7,20 @@ #![feature(foo, foo2)] #![feature(staged_api)] -// @has 'foo/fn.foo.html' '//pre' 'pub unsafe fn foo() -> u32' +// @has 'foo/fn.foo.html' '//pre' 'pub fn foo() -> u32' +// @has - '//span[@class="since"]' '1.0.0 (const: unstable)' #[stable(feature = "rust1", since = "1.0.0")] #[rustc_const_unstable(feature="foo", issue = "none")] -pub const unsafe fn foo() -> u32 { 42 } +pub const fn foo() -> u32 { 42 } + +// @has 'foo/fn.foo_unsafe.html' '//pre' 'pub unsafe fn foo_unsafe() -> u32' +// @has - '//span[@class="since"]' '1.0.0 (const: unstable)' +#[stable(feature = "rust1", since = "1.0.0")] +#[rustc_const_unstable(feature="foo", issue = "none")] +pub const unsafe fn foo_unsafe() -> u32 { 42 } // @has 'foo/fn.foo2.html' '//pre' 'pub const fn foo2() -> u32' +// @!has - '//span[@class="since"]' #[unstable(feature = "humans", issue = "none")] pub const fn foo2() -> u32 { 42 } @@ -22,7 +30,9 @@ pub const fn foo2() -> u32 { 42 } #[rustc_const_stable(feature = "rust1", since = "1.0.0")] pub const fn bar2() -> u32 { 42 } + // @has 'foo/fn.foo2_gated.html' '//pre' 'pub const unsafe fn foo2_gated() -> u32' +// @!has - '//span[@class="since"]' #[unstable(feature = "foo2", issue = "none")] pub const unsafe fn foo2_gated() -> u32 { 42 } @@ -33,15 +43,23 @@ pub const unsafe fn foo2_gated() -> u32 { 42 } pub const unsafe fn bar2_gated() -> u32 { 42 } // @has 'foo/fn.bar_not_gated.html' '//pre' 'pub const unsafe fn bar_not_gated() -> u32' +// @!has - '//span[@class="since"]' pub const unsafe fn bar_not_gated() -> u32 { 42 } pub struct Foo; impl Foo { - // @has 'foo/struct.Foo.html' '//div[@id="method.gated"]/code' 'pub unsafe fn gated() -> u32' + // @has 'foo/struct.Foo.html' '//div[@id="method.gated"]/code' 'pub fn gated() -> u32' + // @has - '//span[@class="since"]' '1.0.0 (const: unstable)' + #[stable(feature = "rust1", since = "1.0.0")] + #[rustc_const_unstable(feature="foo", issue = "none")] + pub const fn gated() -> u32 { 42 } + + // @has 'foo/struct.Foo.html' '//div[@id="method.gated_unsafe"]/code' 'pub unsafe fn gated_unsafe() -> u32' + // @has - '//span[@class="since"]' '1.0.0 (const: unstable)' #[stable(feature = "rust1", since = "1.0.0")] #[rustc_const_unstable(feature="foo", issue = "none")] - pub const unsafe fn gated() -> u32 { 42 } + pub const unsafe fn gated_unsafe() -> u32 { 42 } // @has 'foo/struct.Foo.html' '//div[@id="method.stable_impl"]/code' 'pub const fn stable_impl() -> u32' // @has - '//span[@class="since"]' '1.0.0 (const: 1.2.0)' diff --git a/src/test/rustdoc/cross-crate-hidden-impl-parameter.rs b/src/test/rustdoc/cross-crate-hidden-impl-parameter.rs new file mode 100644 index 00000000000..eb2ced2f7f4 --- /dev/null +++ b/src/test/rustdoc/cross-crate-hidden-impl-parameter.rs @@ -0,0 +1,35 @@ +// Issue #86448: test for cross-crate `doc(hidden)` +#![crate_name = "foo"] + +// aux-build:cross-crate-hidden-impl-parameter.rs +extern crate cross_crate_hidden_impl_parameter; + +pub use ::cross_crate_hidden_impl_parameter::{HiddenType, HiddenTrait}; // OK, not re-exported + +pub enum MyLibType {} + +// @!has foo/enum.MyLibType.html '//*[@id="impl-From%3CHiddenType%3E"]' 'impl From<HiddenType> for MyLibType' +impl From<HiddenType> for MyLibType { + fn from(it: HiddenType) -> MyLibType { + match it {} + } +} + +pub struct T<T>(T); + +// @!has foo/enum.MyLibType.html '//*[@id="impl-From%3CT%3CT%3CT%3CT%3CHiddenType%3E%3E%3E%3E%3E"]' 'impl From<T<T<T<T<HiddenType>>>>> for MyLibType' +impl From<T<T<T<T<HiddenType>>>>> for MyLibType { + fn from(it: T<T<T<T<HiddenType>>>>) -> MyLibType { + todo!() + } +} + +// @!has foo/enum.MyLibType.html '//*[@id="impl-HiddenTrait"]' 'impl HiddenTrait for MyLibType' +impl HiddenTrait for MyLibType {} + +// @!has foo/struct.T.html '//*[@id="impl-From%3CMyLibType%3E"]' 'impl From<MyLibType> for T<T<T<T<HiddenType>>>>' +impl From<MyLibType> for T<T<T<T<HiddenType>>>> { + fn from(it: MyLibType) -> T<T<T<T<HiddenType>>>> { + match it {} + } +} diff --git a/src/test/rustdoc/deprecated.rs b/src/test/rustdoc/deprecated.rs index a286856b2c3..444624b034c 100644 --- a/src/test/rustdoc/deprecated.rs +++ b/src/test/rustdoc/deprecated.rs @@ -1,6 +1,6 @@ -// @has deprecated/index.html '//*[@class="docblock-short"]/span[@class="stab deprecated"]' \ +// @has deprecated/index.html '//*[@class="item-right docblock-short"]/span[@class="stab deprecated"]' \ // 'Deprecated' -// @has - '//*[@class="docblock-short"]' 'Deprecated docs' +// @has - '//*[@class="item-right docblock-short"]' 'Deprecated docs' // @has deprecated/struct.S.html '//*[@class="stab deprecated"]' \ // 'Deprecated since 1.0.0: text' @@ -8,7 +8,7 @@ #[deprecated(since = "1.0.0", note = "text")] pub struct S; -// @matches deprecated/index.html '//*[@class="docblock-short"]' '^Docs' +// @matches deprecated/index.html '//*[@class="item-right docblock-short"]' '^Docs' /// Docs pub struct T; diff --git a/src/test/rustdoc/doc-cfg.rs b/src/test/rustdoc/doc-cfg.rs index 1fc80b3e76c..bd47ae4438d 100644 --- a/src/test/rustdoc/doc-cfg.rs +++ b/src/test/rustdoc/doc-cfg.rs @@ -12,7 +12,7 @@ pub struct Portable; // @has doc_cfg/unix_only/index.html \ // '//*[@id="main"]/*[@class="item-info"]/*[@class="stab portability"]' \ // 'This is supported on Unix only.' -// @matches - '//*[@class="module-item"]//*[@class="stab portability"]' '\AARM\Z' +// @matches - '//*[@class="item-right docblock-short"]//*[@class="stab portability"]' '\AARM\Z' // @count - '//*[@class="stab portability"]' 2 #[doc(cfg(unix))] pub mod unix_only { @@ -42,7 +42,7 @@ pub mod unix_only { // @has doc_cfg/wasi_only/index.html \ // '//*[@id="main"]/*[@class="item-info"]/*[@class="stab portability"]' \ // 'This is supported on WASI only.' -// @matches - '//*[@class="module-item"]//*[@class="stab portability"]' '\AWebAssembly\Z' +// @matches - '//*[@class="item-right docblock-short"]//*[@class="stab portability"]' '\AWebAssembly\Z' // @count - '//*[@class="stab portability"]' 2 #[doc(cfg(target_os = "wasi"))] pub mod wasi_only { @@ -74,7 +74,7 @@ pub mod wasi_only { // the portability header is different on the module view versus the full view // @has doc_cfg/index.html -// @matches - '//*[@class="module-item"]//*[@class="stab portability"]' '\Aavx\Z' +// @matches - '//*[@class="item-right docblock-short"]//*[@class="stab portability"]' '\Aavx\Z' // @has doc_cfg/fn.uses_target_feature.html // @has - '//*[@id="main"]/*[@class="item-info"]/*[@class="stab portability"]' \ diff --git a/src/test/rustdoc/duplicate-cfg.rs b/src/test/rustdoc/duplicate-cfg.rs index cec504ea151..e3241a8746e 100644 --- a/src/test/rustdoc/duplicate-cfg.rs +++ b/src/test/rustdoc/duplicate-cfg.rs @@ -2,8 +2,8 @@ #![feature(doc_cfg)] // @has 'foo/index.html' -// @matches '-' '//*[@class="module-item"]//*[@class="stab portability"]' '^sync$' -// @has '-' '//*[@class="module-item"]//*[@class="stab portability"]/@title' 'This is supported on crate feature `sync` only' +// @matches '-' '//*[@class="item-right docblock-short"]//*[@class="stab portability"]' '^sync$' +// @has '-' '//*[@class="item-right docblock-short"]//*[@class="stab portability"]/@title' 'This is supported on crate feature `sync` only' // @has 'foo/struct.Foo.html' // @has '-' '//*[@class="stab portability"]' 'sync' diff --git a/src/test/rustdoc/ensure-src-link.rs b/src/test/rustdoc/ensure-src-link.rs index 4b6270b26da..6189acb7254 100644 --- a/src/test/rustdoc/ensure-src-link.rs +++ b/src/test/rustdoc/ensure-src-link.rs @@ -2,5 +2,5 @@ // This test ensures that the [src] link is present on traits items. -// @has foo/trait.Iterator.html '//div[@id="method.zip"]/a[@class="srclink"]' "[src]" +// @has foo/trait.Iterator.html '//div[@id="method.zip"]//a[@class="srclink"]' "[src]" pub use std::iter::Iterator; diff --git a/src/test/rustdoc/for-lifetime.rs b/src/test/rustdoc/for-lifetime.rs deleted file mode 100644 index 34a7eae31c7..00000000000 --- a/src/test/rustdoc/for-lifetime.rs +++ /dev/null @@ -1,12 +0,0 @@ -#![crate_name = "foo"] -#![crate_type = "lib"] - -pub struct Foo { - pub some_func: for<'a> fn(val: &'a i32) -> i32, - pub some_trait: dyn for<'a> Trait<'a>, -} - -// @has foo/struct.Foo.html '//span[@id="structfield.some_func"]' "some_func: for<'a> fn(val: &'a i32) -> i32" -// @has foo/struct.Foo.html '//span[@id="structfield.some_trait"]' "some_trait: dyn Trait<'a>" - -pub trait Trait<'a> {} diff --git a/src/test/rustdoc/higher-ranked-trait-bounds.rs b/src/test/rustdoc/higher-ranked-trait-bounds.rs new file mode 100644 index 00000000000..41940b0884e --- /dev/null +++ b/src/test/rustdoc/higher-ranked-trait-bounds.rs @@ -0,0 +1,61 @@ +#![crate_name = "foo"] + +// @has foo/trait.Trait.html +pub trait Trait<'x> {} + +// @has foo/fn.test1.html +// @has - '//pre' "pub fn test1<T>() where for<'a> &'a T: Iterator," +pub fn test1<T>() +where + for<'a> &'a T: Iterator, +{ +} + +// @has foo/fn.test2.html +// @has - '//pre' "pub fn test2<T>() where for<'a, 'b> &'a T: Trait<'b>," +pub fn test2<T>() +where + for<'a, 'b> &'a T: Trait<'b>, +{ +} + +// @has foo/fn.test3.html +// @has - '//pre' "pub fn test3<F>() where F: for<'a, 'b> Fn(&'a u8, &'b u8)," +pub fn test3<F>() +where + F: for<'a, 'b> Fn(&'a u8, &'b u8), +{ +} + +// @has foo/struct.Foo.html +pub struct Foo<'a> { + _x: &'a u8, + pub some_trait: &'a dyn for<'b> Trait<'b>, + pub some_func: for<'c> fn(val: &'c i32) -> i32, +} + +// @has - '//span[@id="structfield.some_func"]' "some_func: for<'c> fn(val: &'c i32) -> i32" +// @has - '//span[@id="structfield.some_trait"]' "some_trait: &'a dyn for<'b> Trait<'b>" + +impl<'a> Foo<'a> { + // @has - '//code' "pub fn bar<T>() where T: Trait<'a>," + pub fn bar<T>() + where + T: Trait<'a>, + { + } +} + +// @has foo/trait.B.html +pub trait B<'x> {} + +// @has - '//code[@class="in-band"]' "impl<'a> B<'a> for dyn for<'b> Trait<'b>" +impl<'a> B<'a> for dyn for<'b> Trait<'b> {} + +// @has foo/struct.Bar.html +// @has - '//span[@id="structfield.bar"]' "bar: &'a (dyn for<'b> Trait<'b> + Unpin)" +// @has - '//span[@id="structfield.baz"]' "baz: &'a (dyn Unpin + for<'b> Trait<'b>)" +pub struct Bar<'a> { + pub bar: &'a (dyn for<'b> Trait<'b> + Unpin), + pub baz: &'a (dyn Unpin + for<'b> Trait<'b>), +} diff --git a/src/test/rustdoc/inline_cross/macros.rs b/src/test/rustdoc/inline_cross/macros.rs index f9bf982659e..601797fd64c 100644 --- a/src/test/rustdoc/inline_cross/macros.rs +++ b/src/test/rustdoc/inline_cross/macros.rs @@ -7,8 +7,8 @@ extern crate macros; -// @has foo/index.html '//*[@class="docblock-short"]/span[@class="stab deprecated"]' Deprecated -// @has - '//*[@class="docblock-short"]/span[@class="stab unstable"]' Experimental +// @has foo/index.html '//*[@class="item-right docblock-short"]/span[@class="stab deprecated"]' Deprecated +// @has - '//*[@class="item-right docblock-short"]/span[@class="stab unstable"]' Experimental // @has foo/macro.my_macro.html // @has - '//*[@class="docblock"]' 'docs for my_macro' diff --git a/src/test/rustdoc/internal.rs b/src/test/rustdoc/internal.rs index a1e322fb9a3..f316eb24a48 100644 --- a/src/test/rustdoc/internal.rs +++ b/src/test/rustdoc/internal.rs @@ -2,9 +2,11 @@ // Check that the unstable marker is not added for "rustc_private". -// @!matches internal/index.html '//*[@class="docblock-short"]/span[@class="stab unstable"]' -// @!matches internal/index.html '//*[@class="docblock-short"]/span[@class="stab internal"]' -// @matches - '//*[@class="docblock-short"]' 'Docs' +// @!matches internal/index.html \ +// '//*[@class="item-right docblock-short"]/span[@class="stab unstable"]' +// @!matches internal/index.html \ +// '//*[@class="item-right docblock-short"]/span[@class="stab internal"]' +// @matches - '//*[@class="item-right docblock-short"]' 'Docs' // @!has internal/struct.S.html '//*[@class="stab unstable"]' // @!has internal/struct.S.html '//*[@class="stab internal"]' diff --git a/src/test/rustdoc/intra-doc/macros-disambiguators.rs b/src/test/rustdoc/intra-doc/macros-disambiguators.rs new file mode 100644 index 00000000000..cd4caa6a894 --- /dev/null +++ b/src/test/rustdoc/intra-doc/macros-disambiguators.rs @@ -0,0 +1,25 @@ +#![crate_name = "foo"] +#![deny(rustdoc::broken_intra_doc_links)] + +//! [foo!()] +// @has foo/index.html '//a[@href="macro.foo.html"]' 'foo!()' + +//! [foo!{}] +// @has - '//a[@href="macro.foo.html"]' 'foo!{}' + +//! [foo![]](foo![]) +// @has - '//a[@href="macro.foo.html"]' 'foo![]' + +//! [foo1](foo!()) +// @has - '//a[@href="macro.foo.html"]' 'foo1' + +//! [foo2](foo!{}) +// @has - '//a[@href="macro.foo.html"]' 'foo2' + +//! [foo3](foo![]) +// @has - '//a[@href="macro.foo.html"]' 'foo3' + +#[macro_export] +macro_rules! foo { + () => {}; +} diff --git a/src/test/rustdoc/intra-doc/type-alias.rs b/src/test/rustdoc/intra-doc/type-alias.rs new file mode 100644 index 00000000000..f3609ccd0a1 --- /dev/null +++ b/src/test/rustdoc/intra-doc/type-alias.rs @@ -0,0 +1,19 @@ +// Regression test for issue #86120. + +#![deny(broken_intra_doc_links)] +#![crate_name = "foo"] + +pub struct Foo; + +/// You should really try [`Self::bar`]! +pub type Bar = Foo; + +impl Bar { + pub fn bar() {} +} + +/// The minimum is [`Self::MIN`]. +pub type Int = i32; + +// @has foo/type.Bar.html '//a[@href="struct.Foo.html#method.bar"]' 'Self::bar' +// @has foo/type.Int.html '//a[@href="{{channel}}/std/primitive.i32.html#associatedconstant.MIN"]' 'Self::MIN' diff --git a/src/test/rustdoc/issue-19055.rs b/src/test/rustdoc/issue-19055.rs deleted file mode 100644 index dbaf744dc47..00000000000 --- a/src/test/rustdoc/issue-19055.rs +++ /dev/null @@ -1,20 +0,0 @@ -// @has issue_19055/trait.Any.html -pub trait Any {} - -impl<'any> Any + 'any { - // @has - '//*[@id="method.is"]' 'fn is' - pub fn is<T: 'static>(&self) -> bool { loop {} } - - // @has - '//*[@id="method.downcast_ref"]' 'fn downcast_ref' - pub fn downcast_ref<T: 'static>(&self) -> Option<&T> { loop {} } - - // @has - '//*[@id="method.downcast_mut"]' 'fn downcast_mut' - pub fn downcast_mut<T: 'static>(&mut self) -> Option<&mut T> { loop {} } -} - -pub trait Foo { - fn foo(&self) {} -} - -// @has - '//*[@id="method.foo"]' 'fn foo' -impl Foo for Any {} diff --git a/src/test/rustdoc/issue-32374.rs b/src/test/rustdoc/issue-32374.rs index 11caa34d4b1..604451eb7e8 100644 --- a/src/test/rustdoc/issue-32374.rs +++ b/src/test/rustdoc/issue-32374.rs @@ -1,17 +1,17 @@ #![feature(staged_api)] -#![doc(issue_tracker_base_url = "http://issue_url/")] +#![doc(issue_tracker_base_url = "https://issue_url/")] #![unstable(feature="test", issue = "32374")] -// @matches issue_32374/index.html '//*[@class="docblock-short"]/span[@class="stab deprecated"]' \ +// @matches issue_32374/index.html '//*[@class="item-right docblock-short"]/span[@class="stab deprecated"]' \ // 'Deprecated' -// @matches issue_32374/index.html '//*[@class="docblock-short"]/span[@class="stab unstable"]' \ +// @matches issue_32374/index.html '//*[@class="item-right docblock-short"]/span[@class="stab unstable"]' \ // 'Experimental' -// @matches issue_32374/index.html '//*[@class="docblock-short"]/text()' 'Docs' +// @matches issue_32374/index.html '//*[@class="item-right docblock-short"]/text()' 'Docs' // @has issue_32374/struct.T.html '//*[@class="stab deprecated"]' \ // '👎 Deprecated since 1.0.0: text' -// @has - '<code>test</code> <a href="http://issue_url/32374">#32374</a>' +// @has - '<code>test</code> <a href="https://issue_url/32374">#32374</a>' // @matches issue_32374/struct.T.html '//*[@class="stab unstable"]' \ // '🔬 This is a nightly-only experimental API. \(test\s#32374\)$' /// Docs diff --git a/src/test/rustdoc/issue-46377.rs b/src/test/rustdoc/issue-46377.rs index 236afb20be5..4489f038c59 100644 --- a/src/test/rustdoc/issue-46377.rs +++ b/src/test/rustdoc/issue-46377.rs @@ -1,3 +1,3 @@ -// @has 'issue_46377/index.html' '//*[@class="docblock-short"]' 'Check out this struct!' +// @has 'issue_46377/index.html' '//*[@class="item-right docblock-short"]' 'Check out this struct!' /// # Check out this struct! pub struct SomeStruct; diff --git a/src/test/rustdoc/issue-55364.rs b/src/test/rustdoc/issue-55364.rs index bc0ad14be03..70aa10767b2 100644 --- a/src/test/rustdoc/issue-55364.rs +++ b/src/test/rustdoc/issue-55364.rs @@ -29,8 +29,8 @@ pub mod subone { // @has - '//section[@id="main"]/details/div[@class="docblock"]//a[@href="../fn.foo.html"]' 'foo' // @has - '//section[@id="main"]/details/div[@class="docblock"]//a[@href="../fn.bar.html"]' 'bar' // Though there should be such links later -// @has - '//section[@id="main"]/table//tr[@class="module-item"]/td/a[@class="fn"][@href="fn.foo.html"]' 'foo' -// @has - '//section[@id="main"]/table//tr[@class="module-item"]/td/a[@class="fn"][@href="fn.bar.html"]' 'bar' +// @has - '//section[@id="main"]/div[@class="item-table"]//div[@class="item-left module-item"]/a[@class="fn"][@href="fn.foo.html"]' 'foo' +// @has - '//section[@id="main"]/div[@class="item-table"]//div[@class="item-left module-item"]/a[@class="fn"][@href="fn.bar.html"]' 'bar' /// See either [foo] or [bar]. pub mod subtwo { @@ -68,8 +68,8 @@ pub mod subthree { // Next we go *deeper* - In order to ensure it's not just "this or parent" // we test `crate::` and a `super::super::...` chain // @has issue_55364/subfour/subfive/subsix/subseven/subeight/index.html -// @has - '//section[@id="main"]/table//tr[@class="module-item"]/td[@class="docblock-short"]//a[@href="../../../../../subone/fn.foo.html"]' 'other foo' -// @has - '//section[@id="main"]/table//tr[@class="module-item"]/td[@class="docblock-short"]//a[@href="../../../../../subtwo/fn.bar.html"]' 'other bar' +// @has - '//section[@id="main"]/div[@class="item-table"]//div[@class="item-right docblock-short"]//a[@href="../../../../../subone/fn.foo.html"]' 'other foo' +// @has - '//section[@id="main"]/div[@class="item-table"]//div[@class="item-right docblock-short"]//a[@href="../../../../../subtwo/fn.bar.html"]' 'other bar' pub mod subfour { pub mod subfive { pub mod subsix { diff --git a/src/test/rustdoc/issue-85454.rs b/src/test/rustdoc/issue-85454.rs index 45664dfc382..3351b5c8350 100644 --- a/src/test/rustdoc/issue-85454.rs +++ b/src/test/rustdoc/issue-85454.rs @@ -1,4 +1,10 @@ -// @has issue_85454/trait.FromResidual.html +// aux-build:issue-85454.rs +// build-aux-docs +#![crate_name = "foo"] + +extern crate issue_85454; + +// @has foo/trait.FromResidual.html // @has - '//pre[@class="rust trait"]' 'pub trait FromResidual<R = <Self as Try>::Residual> { fn from_residual(residual: R) -> Self; }' pub trait FromResidual<R = <Self as Try>::Residual> { fn from_residual(residual: R) -> Self; @@ -15,3 +21,9 @@ pub enum ControlFlow<B, C = ()> { Continue(C), Break(B), } + +pub mod reexport { + // @has foo/reexport/trait.FromResidual.html + // @has - '//pre[@class="rust trait"]' 'pub trait FromResidual<R = <Self as Try>::Residual> { fn from_residual(residual: R) -> Self; }' + pub use issue_85454::*; +} diff --git a/src/test/rustdoc/recursive-deref-sidebar.rs b/src/test/rustdoc/recursive-deref-sidebar.rs new file mode 100644 index 00000000000..fcb636ade8f --- /dev/null +++ b/src/test/rustdoc/recursive-deref-sidebar.rs @@ -0,0 +1,22 @@ +use std::ops::Deref; + +pub struct A {} +impl A { pub fn foo_a(&self) {} } + +pub struct B {} +impl B { pub fn foo_b(&self) {} } + +pub struct C {} +impl C { pub fn foo_c(&self) {} } + +// @has recursive_deref_sidebar/struct.A.html '//div[@class="sidebar-links"]' 'foo_b' +impl Deref for A { + type Target = B; + fn deref(&self) -> &B { todo!() } +} + +// @!has recursive_deref_sidebar/struct.A.html '//div[@class="sidebar-links"]' 'foo_c' +impl Deref for B { + type Target = C; + fn deref(&self) -> &C { todo!() } +} diff --git a/src/test/rustdoc/recursive-deref.rs b/src/test/rustdoc/recursive-deref.rs new file mode 100644 index 00000000000..91db01177c5 --- /dev/null +++ b/src/test/rustdoc/recursive-deref.rs @@ -0,0 +1,22 @@ +use std::ops::Deref; + +pub struct A; +pub struct B; + +// @has recursive_deref/struct.A.html '//code' 'impl Deref for A' +impl Deref for A { + type Target = B; + + fn deref(&self) -> &Self::Target { + panic!() + } +} + +// @has recursive_deref/struct.B.html '//code' 'impl Deref for B' +impl Deref for B { + type Target = A; + + fn deref(&self) -> &Self::Target { + panic!() + } +} diff --git a/src/test/rustdoc/reexport-check.rs b/src/test/rustdoc/reexport-check.rs index 9a22903a94c..db1f90c6999 100644 --- a/src/test/rustdoc/reexport-check.rs +++ b/src/test/rustdoc/reexport-check.rs @@ -4,15 +4,15 @@ extern crate reexport_check; // @!has 'foo/index.html' '//code' 'pub use self::i32;' -// @has 'foo/index.html' '//tr[@class="deprecated module-item"]' 'i32' +// @has 'foo/index.html' '//div[@class="item-left deprecated module-item"]' 'i32' // @has 'foo/i32/index.html' #[allow(deprecated, deprecated_in_future)] pub use std::i32; // @!has 'foo/index.html' '//code' 'pub use self::string::String;' -// @has 'foo/index.html' '//tr[@class="module-item"]' 'String' +// @has 'foo/index.html' '//div[@class="item-left module-item"]' 'String' pub use std::string::String; -// @has 'foo/index.html' '//td[@class="docblock-short"]' 'Docs in original' +// @has 'foo/index.html' '//div[@class="item-right docblock-short"]' 'Docs in original' // this is a no-op, but shows what happens if there's an attribute that isn't a doc-comment #[doc(inline)] pub use reexport_check::S; diff --git a/src/test/rustdoc/same-crate-hidden-impl-parameter.rs b/src/test/rustdoc/same-crate-hidden-impl-parameter.rs new file mode 100644 index 00000000000..d55393af859 --- /dev/null +++ b/src/test/rustdoc/same-crate-hidden-impl-parameter.rs @@ -0,0 +1,36 @@ +// test for `doc(hidden)` with impl parameters in the same crate. +#![crate_name = "foo"] + +#[doc(hidden)] +pub enum HiddenType {} + +#[doc(hidden)] +pub trait HiddenTrait {} + +pub enum MyLibType {} + +// @!has foo/enum.MyLibType.html '//*[@id="impl-From%3CHiddenType%3E"]' 'impl From<HiddenType> for MyLibType' +impl From<HiddenType> for MyLibType { + fn from(it: HiddenType) -> MyLibType { + match it {} + } +} + +pub struct T<T>(T); + +// @!has foo/enum.MyLibType.html '//*[@id="impl-From%3CT%3CT%3CT%3CT%3CHiddenType%3E%3E%3E%3E%3E"]' 'impl From<T<T<T<T<HiddenType>>>>> for MyLibType' +impl From<T<T<T<T<HiddenType>>>>> for MyLibType { + fn from(it: T<T<T<T<HiddenType>>>>) -> MyLibType { + todo!() + } +} + +// @!has foo/enum.MyLibType.html '//*[@id="impl-HiddenTrait"]' 'impl HiddenTrait for MyLibType' +impl HiddenTrait for MyLibType {} + +// @!has foo/struct.T.html '//*[@id="impl-From%3CMyLibType%3E"]' 'impl From<MyLibType> for T<T<T<T<HiddenType>>>>' +impl From<MyLibType> for T<T<T<T<HiddenType>>>> { + fn from(it: MyLibType) -> T<T<T<T<HiddenType>>>> { + match it {} + } +} diff --git a/src/test/rustdoc/short-docblock-codeblock.rs b/src/test/rustdoc/short-docblock-codeblock.rs index fc8d53ccf35..c6b318b0677 100644 --- a/src/test/rustdoc/short-docblock-codeblock.rs +++ b/src/test/rustdoc/short-docblock-codeblock.rs @@ -1,8 +1,8 @@ #![crate_name = "foo"] -// @has foo/index.html '//*[@class="module-item"]//td[@class="docblock-short"]' "" -// @!has foo/index.html '//*[@id="module-item"]//td[@class="docblock-short"]' "Some text." -// @!has foo/index.html '//*[@id="module-item"]//td[@class="docblock-short"]' "let x = 12;" +// @has foo/index.html '//*[@class="item-right docblock-short"]' "" +// @!has foo/index.html '//*[@class="item-right docblock-short"]' "Some text." +// @!has foo/index.html '//*[@class="item-right docblock-short"]' "let x = 12;" /// ``` /// let x = 12; diff --git a/src/test/rustdoc/short-docblock.rs b/src/test/rustdoc/short-docblock.rs new file mode 100644 index 00000000000..74fa783174d --- /dev/null +++ b/src/test/rustdoc/short-docblock.rs @@ -0,0 +1,25 @@ +#![crate_name = "foo"] + +// @has foo/index.html '//*[@class="item-right docblock-short"]/p' 'fooo' +// @!has foo/index.html '//*[@class="item-right docblock-short"]/p/h1' 'fooo' +// @has foo/fn.foo.html '//h1[@id="fooo"]/a[@href="#fooo"]' 'fooo' + +/// # fooo +/// +/// foo +pub fn foo() {} + +// @has foo/index.html '//*[@class="item-right docblock-short"]/p' 'mooood' +// @!has foo/index.html '//*[@class="item-right docblock-short"]/p/h2' 'mooood' +// @has foo/foo/index.html '//h2[@id="mooood"]/a[@href="#mooood"]' 'mooood' + +/// ## mooood +/// +/// foo mod +pub mod foo {} + +// @has foo/index.html '//*[@class="item-right docblock-short"]/p/a[@href=\ +// "https://nougat.world"]/code' 'nougat' + +/// [`nougat`](https://nougat.world) +pub struct Bar; diff --git a/src/test/rustdoc/short-dockblock.rs b/src/test/rustdoc/short-dockblock.rs deleted file mode 100644 index 5493bca54c5..00000000000 --- a/src/test/rustdoc/short-dockblock.rs +++ /dev/null @@ -1,25 +0,0 @@ -#![crate_name = "foo"] - -// @has foo/index.html '//*[@class="docblock-short"]/p' 'fooo' -// @!has foo/index.html '//*[@class="docblock-short"]/p/h1' 'fooo' -// @has foo/fn.foo.html '//h1[@id="fooo"]/a[@href="#fooo"]' 'fooo' - -/// # fooo -/// -/// foo -pub fn foo() {} - -// @has foo/index.html '//*[@class="docblock-short"]/p' 'mooood' -// @!has foo/index.html '//*[@class="docblock-short"]/p/h2' 'mooood' -// @has foo/foo/index.html '//h2[@id="mooood"]/a[@href="#mooood"]' 'mooood' - -/// ## mooood -/// -/// foo mod -pub mod foo {} - -// @has foo/index.html '//*[@class="docblock-short"]/p/a[@href=\ -// "https://nougat.world"]/code' 'nougat' - -/// [`nougat`](https://nougat.world) -pub struct Bar; diff --git a/src/test/rustdoc/src-links-auto-impls.rs b/src/test/rustdoc/src-links-auto-impls.rs index 6f609e080d3..1952f723465 100644 --- a/src/test/rustdoc/src-links-auto-impls.rs +++ b/src/test/rustdoc/src-links-auto-impls.rs @@ -2,11 +2,11 @@ // @has foo/struct.Unsized.html // @has - '//div[@id="impl-Sized"]/code' 'impl !Sized for Unsized' -// @!has - '//div[@id="impl-Sized"]/a[@class="srclink"]' '[src]' +// @!has - '//div[@id="impl-Sized"]//a[@class="srclink"]' '[src]' // @has - '//div[@id="impl-Sync"]/code' 'impl Sync for Unsized' -// @!has - '//div[@id="impl-Sync"]/a[@class="srclink"]' '[src]' +// @!has - '//div[@id="impl-Sync"]//a[@class="srclink"]' '[src]' // @has - '//div[@id="impl-Any"]/code' 'impl<T> Any for T' -// @has - '//div[@id="impl-Any"]/a[@class="srclink"]' '[src]' +// @has - '//div[@id="impl-Any"]//a[@class="srclink"]' '[src]' pub struct Unsized { data: [u8], } diff --git a/src/test/rustdoc/trait-impl-items-links-and-anchors.rs b/src/test/rustdoc/trait-impl-items-links-and-anchors.rs index 5b7c04c0d44..ddbe93febdc 100644 --- a/src/test/rustdoc/trait-impl-items-links-and-anchors.rs +++ b/src/test/rustdoc/trait-impl-items-links-and-anchors.rs @@ -38,23 +38,15 @@ impl MyTrait for Vec<u8> { } impl MyTrait for MyStruct { - // @has trait_impl_items_links_and_anchors/trait.MyTrait.html '//div[@id="associatedtype.Assoc-3"]//a[@class="type"]/@href' #associatedtype.Assoc - // @has trait_impl_items_links_and_anchors/trait.MyTrait.html '//div[@id="associatedtype.Assoc-3"]//a[@class="anchor"]/@href' #associatedtype.Assoc-3 // @has trait_impl_items_links_and_anchors/struct.MyStruct.html '//div[@id="associatedtype.Assoc"]//a[@class="type"]/@href' trait.MyTrait.html#associatedtype.Assoc // @has trait_impl_items_links_and_anchors/struct.MyStruct.html '//div[@id="associatedtype.Assoc"]//a[@class="anchor"]/@href' #associatedtype.Assoc type Assoc = bool; - // @has trait_impl_items_links_and_anchors/trait.MyTrait.html '//div[@id="associatedconstant.VALUE-3"]//a[@class="constant"]/@href' #associatedconstant.VALUE - // @has trait_impl_items_links_and_anchors/trait.MyTrait.html '//div[@id="associatedconstant.VALUE-3"]//a[@class="anchor"]/@href' #associatedconstant.VALUE-3 // @has trait_impl_items_links_and_anchors/struct.MyStruct.html '//div[@id="associatedconstant.VALUE"]//a[@class="constant"]/@href' trait.MyTrait.html#associatedconstant.VALUE // @has trait_impl_items_links_and_anchors/struct.MyStruct.html '//div[@id="associatedconstant.VALUE"]//a[@class="anchor"]/@href' #associatedconstant.VALUE const VALUE: u32 = 20; - // @has trait_impl_items_links_and_anchors/trait.MyTrait.html '//div[@id="method.trait_function-2"]//a[@class="fnname"]/@href' #tymethod.trait_function - // @has trait_impl_items_links_and_anchors/trait.MyTrait.html '//div[@id="method.trait_function-2"]//a[@class="anchor"]/@href' #method.trait_function-2 // @has trait_impl_items_links_and_anchors/struct.MyStruct.html '//div[@id="method.trait_function"]//a[@class="fnname"]/@href' trait.MyTrait.html#tymethod.trait_function // @has trait_impl_items_links_and_anchors/struct.MyStruct.html '//div[@id="method.trait_function"]//a[@class="anchor"]/@href' #method.trait_function fn trait_function(&self) {} - // @has trait_impl_items_links_and_anchors/trait.MyTrait.html '//div[@id="method.defaulted_override-3"]//a[@class="fnname"]/@href' #method.defaulted_override - // @has trait_impl_items_links_and_anchors/trait.MyTrait.html '//div[@id="method.defaulted_override-3"]//a[@class="anchor"]/@href' #method.defaulted_override-3 // @has trait_impl_items_links_and_anchors/struct.MyStruct.html '//div[@id="method.defaulted_override"]//a[@class="fnname"]/@href' trait.MyTrait.html#method.defaulted_override // @has trait_impl_items_links_and_anchors/struct.MyStruct.html '//div[@id="method.defaulted_override"]//a[@class="anchor"]/@href' #method.defaulted_override fn defaulted_override(&self) {} diff --git a/src/test/ui/anon-params/anon-params-deprecated.fixed b/src/test/ui/anon-params/anon-params-deprecated.fixed index d288bba5957..c09e2077084 100644 --- a/src/test/ui/anon-params/anon-params-deprecated.fixed +++ b/src/test/ui/anon-params/anon-params-deprecated.fixed @@ -7,13 +7,13 @@ trait T { fn foo(_: i32); //~ WARNING anonymous parameters are deprecated - //~| WARNING hard error + //~| WARNING this is accepted in the current edition fn bar_with_default_impl(_: String, _: String) {} //~^ WARNING anonymous parameters are deprecated - //~| WARNING hard error + //~| WARNING this is accepted in the current edition //~| WARNING anonymous parameters are deprecated - //~| WARNING hard error + //~| WARNING this is accepted in the current edition } fn main() {} diff --git a/src/test/ui/anon-params/anon-params-deprecated.rs b/src/test/ui/anon-params/anon-params-deprecated.rs index d677e0c32b0..6f7385da040 100644 --- a/src/test/ui/anon-params/anon-params-deprecated.rs +++ b/src/test/ui/anon-params/anon-params-deprecated.rs @@ -7,13 +7,13 @@ trait T { fn foo(i32); //~ WARNING anonymous parameters are deprecated - //~| WARNING hard error + //~| WARNING this is accepted in the current edition fn bar_with_default_impl(String, String) {} //~^ WARNING anonymous parameters are deprecated - //~| WARNING hard error + //~| WARNING this is accepted in the current edition //~| WARNING anonymous parameters are deprecated - //~| WARNING hard error + //~| WARNING this is accepted in the current edition } fn main() {} diff --git a/src/test/ui/anon-params/anon-params-deprecated.stderr b/src/test/ui/anon-params/anon-params-deprecated.stderr index c1bf5f690ec..98d52d659a9 100644 --- a/src/test/ui/anon-params/anon-params-deprecated.stderr +++ b/src/test/ui/anon-params/anon-params-deprecated.stderr @@ -9,7 +9,7 @@ note: the lint level is defined here | LL | #![warn(anonymous_parameters)] | ^^^^^^^^^^^^^^^^^^^^ - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2018 edition! + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #41686 <https://github.com/rust-lang/rust/issues/41686> warning: anonymous parameters are deprecated and will be removed in the next edition. @@ -18,7 +18,7 @@ warning: anonymous parameters are deprecated and will be removed in the next edi LL | fn bar_with_default_impl(String, String) {} | ^^^^^^ help: try naming the parameter or explicitly ignoring it: `_: String` | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2018 edition! + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #41686 <https://github.com/rust-lang/rust/issues/41686> warning: anonymous parameters are deprecated and will be removed in the next edition. @@ -27,7 +27,7 @@ warning: anonymous parameters are deprecated and will be removed in the next edi LL | fn bar_with_default_impl(String, String) {} | ^^^^^^ help: try naming the parameter or explicitly ignoring it: `_: String` | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2018 edition! + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #41686 <https://github.com/rust-lang/rust/issues/41686> warning: 3 warnings emitted diff --git a/src/test/ui/array-slice-vec/slice-panic-1.rs b/src/test/ui/array-slice-vec/slice-panic-1.rs index 8b27d055e2b..4134c623778 100644 --- a/src/test/ui/array-slice-vec/slice-panic-1.rs +++ b/src/test/ui/array-slice-vec/slice-panic-1.rs @@ -17,7 +17,7 @@ impl Drop for Foo { fn foo() { let x: &[_] = &[Foo, Foo]; - &x[3..4]; + let _ = &x[3..4]; } fn main() { diff --git a/src/test/ui/array-slice-vec/slice-panic-2.rs b/src/test/ui/array-slice-vec/slice-panic-2.rs index 2ee564cadb3..2f7178fb3e1 100644 --- a/src/test/ui/array-slice-vec/slice-panic-2.rs +++ b/src/test/ui/array-slice-vec/slice-panic-2.rs @@ -21,7 +21,7 @@ fn bar() -> usize { fn foo() { let x: &[_] = &[Foo, Foo]; - &x[3..bar()]; + let _ = &x[3..bar()]; } fn main() { diff --git a/src/test/ui/array-slice-vec/slice.rs b/src/test/ui/array-slice-vec/slice.rs index 14e1ddf52eb..a514e202773 100644 --- a/src/test/ui/array-slice-vec/slice.rs +++ b/src/test/ui/array-slice-vec/slice.rs @@ -67,14 +67,14 @@ impl IndexMut<RangeFull> for Foo { fn main() { let mut x = Foo; - &x[..]; - &x[Foo..]; - &x[..Foo]; - &x[Foo..Foo]; - &mut x[..]; - &mut x[Foo..]; - &mut x[..Foo]; - &mut x[Foo..Foo]; + let _ = &x[..]; + let _ = &x[Foo..]; + let _ = &x[..Foo]; + let _ = &x[Foo..Foo]; + let _ = &mut x[..]; + let _ = &mut x[Foo..]; + let _ = &mut x[..Foo]; + let _ = &mut x[Foo..Foo]; unsafe { assert_eq!(COUNT, 8); } diff --git a/src/test/ui/asm/bad-options.stderr b/src/test/ui/asm/bad-options.stderr index 4e27a6e2cb5..9039483be4b 100644 --- a/src/test/ui/asm/bad-options.stderr +++ b/src/test/ui/asm/bad-options.stderr @@ -28,41 +28,41 @@ error: asm outputs are not allowed with the `noreturn` option LL | asm!("{}", out(reg) foo, options(noreturn)); | ^^^^^^^^^^^^ -error: expected one of `)` or `att_syntax`, found `nomem` +error: expected one of `)`, `att_syntax`, or `raw`, found `nomem` --> $DIR/bad-options.rs:20:25 | LL | global_asm!("", options(nomem)); - | ^^^^^ expected one of `)` or `att_syntax` + | ^^^^^ expected one of `)`, `att_syntax`, or `raw` -error: expected one of `)` or `att_syntax`, found `readonly` +error: expected one of `)`, `att_syntax`, or `raw`, found `readonly` --> $DIR/bad-options.rs:22:25 | LL | global_asm!("", options(readonly)); - | ^^^^^^^^ expected one of `)` or `att_syntax` + | ^^^^^^^^ expected one of `)`, `att_syntax`, or `raw` -error: expected one of `)` or `att_syntax`, found `noreturn` +error: expected one of `)`, `att_syntax`, or `raw`, found `noreturn` --> $DIR/bad-options.rs:24:25 | LL | global_asm!("", options(noreturn)); - | ^^^^^^^^ expected one of `)` or `att_syntax` + | ^^^^^^^^ expected one of `)`, `att_syntax`, or `raw` -error: expected one of `)` or `att_syntax`, found `pure` +error: expected one of `)`, `att_syntax`, or `raw`, found `pure` --> $DIR/bad-options.rs:26:25 | LL | global_asm!("", options(pure)); - | ^^^^ expected one of `)` or `att_syntax` + | ^^^^ expected one of `)`, `att_syntax`, or `raw` -error: expected one of `)` or `att_syntax`, found `nostack` +error: expected one of `)`, `att_syntax`, or `raw`, found `nostack` --> $DIR/bad-options.rs:28:25 | LL | global_asm!("", options(nostack)); - | ^^^^^^^ expected one of `)` or `att_syntax` + | ^^^^^^^ expected one of `)`, `att_syntax`, or `raw` -error: expected one of `)` or `att_syntax`, found `preserves_flags` +error: expected one of `)`, `att_syntax`, or `raw`, found `preserves_flags` --> $DIR/bad-options.rs:30:25 | LL | global_asm!("", options(preserves_flags)); - | ^^^^^^^^^^^^^^^ expected one of `)` or `att_syntax` + | ^^^^^^^^^^^^^^^ expected one of `)`, `att_syntax`, or `raw` error: aborting due to 11 previous errors diff --git a/src/test/ui/asm/inline-syntax.arm.stderr b/src/test/ui/asm/inline-syntax.arm.stderr index b1685bd4e02..bf6ea6b67f9 100644 --- a/src/test/ui/asm/inline-syntax.arm.stderr +++ b/src/test/ui/asm/inline-syntax.arm.stderr @@ -13,7 +13,7 @@ LL | .intel_syntax noprefix | ^ error: unknown directive - --> $DIR/inline-syntax.rs:29:15 + --> $DIR/inline-syntax.rs:31:15 | LL | asm!(".intel_syntax noprefix", "nop"); | ^ @@ -25,7 +25,7 @@ LL | .intel_syntax noprefix | ^ error: unknown directive - --> $DIR/inline-syntax.rs:32:15 + --> $DIR/inline-syntax.rs:34:15 | LL | asm!(".intel_syntax aaa noprefix", "nop"); | ^ @@ -37,7 +37,7 @@ LL | .intel_syntax aaa noprefix | ^ error: unknown directive - --> $DIR/inline-syntax.rs:35:15 + --> $DIR/inline-syntax.rs:37:15 | LL | asm!(".att_syntax noprefix", "nop"); | ^ @@ -49,7 +49,7 @@ LL | .att_syntax noprefix | ^ error: unknown directive - --> $DIR/inline-syntax.rs:38:15 + --> $DIR/inline-syntax.rs:40:15 | LL | asm!(".att_syntax bbb noprefix", "nop"); | ^ @@ -61,7 +61,7 @@ LL | .att_syntax bbb noprefix | ^ error: unknown directive - --> $DIR/inline-syntax.rs:41:15 + --> $DIR/inline-syntax.rs:43:15 | LL | asm!(".intel_syntax noprefix; nop"); | ^ @@ -73,7 +73,7 @@ LL | .intel_syntax noprefix; nop | ^ error: unknown directive - --> $DIR/inline-syntax.rs:47:13 + --> $DIR/inline-syntax.rs:49:13 | LL | .intel_syntax noprefix | ^ diff --git a/src/test/ui/asm/inline-syntax.rs b/src/test/ui/asm/inline-syntax.rs index 2d54ef7bd6b..481990398f4 100644 --- a/src/test/ui/asm/inline-syntax.rs +++ b/src/test/ui/asm/inline-syntax.rs @@ -1,11 +1,13 @@ -// needs-llvm-components: arm // revisions: x86_64 arm //[x86_64] compile-flags: --target x86_64-unknown-linux-gnu //[x86_64] check-pass +//[x86_64] needs-llvm-components: x86 //[x86_64_allowed] compile-flags: --target x86_64-unknown-linux-gnu //[x86_64_allowed] check-pass +//[x86_64_allowed] needs-llvm-components: x86 //[arm] compile-flags: --target armv7-unknown-linux-gnueabihf //[arm] build-fail +//[arm] needs-llvm-components: arm #![feature(no_core, lang_items, rustc_attrs)] #![crate_type = "rlib"] diff --git a/src/test/ui/asm/inline-syntax.x86_64.stderr b/src/test/ui/asm/inline-syntax.x86_64.stderr index 59c95194322..dcbc17bb260 100644 --- a/src/test/ui/asm/inline-syntax.x86_64.stderr +++ b/src/test/ui/asm/inline-syntax.x86_64.stderr @@ -1,5 +1,5 @@ warning: avoid using `.intel_syntax`, Intel syntax is the default - --> $DIR/inline-syntax.rs:55:14 + --> $DIR/inline-syntax.rs:57:14 | LL | global_asm!(".intel_syntax noprefix", "nop"); | ^^^^^^^^^^^^^^^^^^^^^^ @@ -7,37 +7,37 @@ LL | global_asm!(".intel_syntax noprefix", "nop"); = note: `#[warn(bad_asm_style)]` on by default warning: avoid using `.intel_syntax`, Intel syntax is the default - --> $DIR/inline-syntax.rs:29:15 + --> $DIR/inline-syntax.rs:31:15 | LL | asm!(".intel_syntax noprefix", "nop"); | ^^^^^^^^^^^^^^^^^^^^^^ warning: avoid using `.intel_syntax`, Intel syntax is the default - --> $DIR/inline-syntax.rs:32:15 + --> $DIR/inline-syntax.rs:34:15 | LL | asm!(".intel_syntax aaa noprefix", "nop"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: avoid using `.att_syntax`, prefer using `options(att_syntax)` instead - --> $DIR/inline-syntax.rs:35:15 + --> $DIR/inline-syntax.rs:37:15 | LL | asm!(".att_syntax noprefix", "nop"); | ^^^^^^^^^^^^^^^^^^^^ warning: avoid using `.att_syntax`, prefer using `options(att_syntax)` instead - --> $DIR/inline-syntax.rs:38:15 + --> $DIR/inline-syntax.rs:40:15 | LL | asm!(".att_syntax bbb noprefix", "nop"); | ^^^^^^^^^^^^^^^^^^^^^^^^ warning: avoid using `.intel_syntax`, Intel syntax is the default - --> $DIR/inline-syntax.rs:41:15 + --> $DIR/inline-syntax.rs:43:15 | LL | asm!(".intel_syntax noprefix; nop"); | ^^^^^^^^^^^^^^^^^^^^^^ warning: avoid using `.intel_syntax`, Intel syntax is the default - --> $DIR/inline-syntax.rs:47:13 + --> $DIR/inline-syntax.rs:49:13 | LL | .intel_syntax noprefix | ^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/asm/parse-error.stderr b/src/test/ui/asm/parse-error.stderr index afd262b851c..33dca61dc8e 100644 --- a/src/test/ui/asm/parse-error.stderr +++ b/src/test/ui/asm/parse-error.stderr @@ -64,11 +64,11 @@ error: argument to `sym` must be a path expression LL | asm!("{}", sym foo + bar); | ^^^^^^^^^ -error: expected one of `)`, `att_syntax`, `nomem`, `noreturn`, `nostack`, `preserves_flags`, `pure`, or `readonly`, found `foo` +error: expected one of `)`, `att_syntax`, `nomem`, `noreturn`, `nostack`, `preserves_flags`, `pure`, `raw`, or `readonly`, found `foo` --> $DIR/parse-error.rs:31:26 | LL | asm!("", options(foo)); - | ^^^ expected one of 8 possible tokens + | ^^^ expected one of 9 possible tokens error: expected one of `)` or `,`, found `foo` --> $DIR/parse-error.rs:33:32 @@ -76,11 +76,11 @@ error: expected one of `)` or `,`, found `foo` LL | asm!("", options(nomem foo)); | ^^^ expected one of `)` or `,` -error: expected one of `)`, `att_syntax`, `nomem`, `noreturn`, `nostack`, `preserves_flags`, `pure`, or `readonly`, found `foo` +error: expected one of `)`, `att_syntax`, `nomem`, `noreturn`, `nostack`, `preserves_flags`, `pure`, `raw`, or `readonly`, found `foo` --> $DIR/parse-error.rs:35:33 | LL | asm!("", options(nomem, foo)); - | ^^^ expected one of 8 possible tokens + | ^^^ expected one of 9 possible tokens error: arguments are not allowed after options --> $DIR/parse-error.rs:37:31 @@ -200,23 +200,23 @@ error: expected one of `,`, `.`, `?`, or an operator, found `FOO` LL | global_asm!("{}", const(reg) FOO); | ^^^ expected one of `,`, `.`, `?`, or an operator -error: expected one of `)` or `att_syntax`, found `FOO` +error: expected one of `)`, `att_syntax`, or `raw`, found `FOO` --> $DIR/parse-error.rs:81:25 | LL | global_asm!("", options(FOO)); - | ^^^ expected one of `)` or `att_syntax` + | ^^^ expected one of `)`, `att_syntax`, or `raw` -error: expected one of `)` or `att_syntax`, found `nomem` +error: expected one of `)`, `att_syntax`, or `raw`, found `nomem` --> $DIR/parse-error.rs:83:25 | LL | global_asm!("", options(nomem FOO)); - | ^^^^^ expected one of `)` or `att_syntax` + | ^^^^^ expected one of `)`, `att_syntax`, or `raw` -error: expected one of `)` or `att_syntax`, found `nomem` +error: expected one of `)`, `att_syntax`, or `raw`, found `nomem` --> $DIR/parse-error.rs:85:25 | LL | global_asm!("", options(nomem, FOO)); - | ^^^^^ expected one of `)` or `att_syntax` + | ^^^^^ expected one of `)`, `att_syntax`, or `raw` error: arguments are not allowed after options --> $DIR/parse-error.rs:87:30 diff --git a/src/test/ui/async-await/await-keyword/2015-edition-error-various-positions.rs b/src/test/ui/async-await/await-keyword/2015-edition-error-various-positions.rs index a3a20cb97e1..50c1639996e 100644 --- a/src/test/ui/async-await/await-keyword/2015-edition-error-various-positions.rs +++ b/src/test/ui/async-await/await-keyword/2015-edition-error-various-positions.rs @@ -3,36 +3,36 @@ mod outer_mod { pub mod await { //~ ERROR `await` is a keyword in the 2018 edition - //~^ WARN this was previously accepted by the compiler + //~^ WARN this is accepted in the current edition pub struct await; //~ ERROR `await` is a keyword in the 2018 edition - //~^ WARN this was previously accepted by the compiler + //~^ WARN this is accepted in the current edition } } use outer_mod::await::await; //~ ERROR `await` is a keyword in the 2018 edition //~^ ERROR `await` is a keyword in the 2018 edition -//~^^ WARN this was previously accepted by the compiler -//~^^^ WARN this was previously accepted by the compiler +//~^^ WARN this is accepted in the current edition +//~^^^ WARN this is accepted in the current edition struct Foo { await: () } //~^ ERROR `await` is a keyword in the 2018 edition -//~^^ WARN this was previously accepted by the compiler +//~^^ WARN this is accepted in the current edition impl Foo { fn await() {} } //~^ ERROR `await` is a keyword in the 2018 edition -//~^^ WARN this was previously accepted by the compiler +//~^^ WARN this is accepted in the current edition macro_rules! await { //~^ ERROR `await` is a keyword in the 2018 edition -//~^^ WARN this was previously accepted by the compiler +//~^^ WARN this is accepted in the current edition () => {} } fn main() { await!(); //~ ERROR `await` is a keyword in the 2018 edition - //~^ WARN this was previously accepted by the compiler + //~^ WARN this is accepted in the current edition match await { await => {} } //~ ERROR `await` is a keyword in the 2018 edition //~^ ERROR `await` is a keyword in the 2018 edition - //~^^ WARN this was previously accepted by the compiler - //~^^^ WARN this was previously accepted by the compiler + //~^^ WARN this is accepted in the current edition + //~^^^ WARN this is accepted in the current edition } diff --git a/src/test/ui/async-await/await-keyword/2015-edition-error-various-positions.stderr b/src/test/ui/async-await/await-keyword/2015-edition-error-various-positions.stderr index 474c09d79df..50a82c08c3f 100644 --- a/src/test/ui/async-await/await-keyword/2015-edition-error-various-positions.stderr +++ b/src/test/ui/async-await/await-keyword/2015-edition-error-various-positions.stderr @@ -9,7 +9,7 @@ note: the lint level is defined here | LL | #![deny(keyword_idents)] | ^^^^^^^^^^^^^^ - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2018 edition! + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716> error: `await` is a keyword in the 2018 edition @@ -18,7 +18,7 @@ error: `await` is a keyword in the 2018 edition LL | pub struct await; | ^^^^^ help: you can use a raw identifier to stay compatible: `r#await` | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2018 edition! + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716> error: `await` is a keyword in the 2018 edition @@ -27,7 +27,7 @@ error: `await` is a keyword in the 2018 edition LL | use outer_mod::await::await; | ^^^^^ help: you can use a raw identifier to stay compatible: `r#await` | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2018 edition! + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716> error: `await` is a keyword in the 2018 edition @@ -36,7 +36,7 @@ error: `await` is a keyword in the 2018 edition LL | use outer_mod::await::await; | ^^^^^ help: you can use a raw identifier to stay compatible: `r#await` | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2018 edition! + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716> error: `await` is a keyword in the 2018 edition @@ -45,7 +45,7 @@ error: `await` is a keyword in the 2018 edition LL | struct Foo { await: () } | ^^^^^ help: you can use a raw identifier to stay compatible: `r#await` | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2018 edition! + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716> error: `await` is a keyword in the 2018 edition @@ -54,7 +54,7 @@ error: `await` is a keyword in the 2018 edition LL | impl Foo { fn await() {} } | ^^^^^ help: you can use a raw identifier to stay compatible: `r#await` | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2018 edition! + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716> error: `await` is a keyword in the 2018 edition @@ -63,7 +63,7 @@ error: `await` is a keyword in the 2018 edition LL | macro_rules! await { | ^^^^^ help: you can use a raw identifier to stay compatible: `r#await` | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2018 edition! + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716> error: `await` is a keyword in the 2018 edition @@ -72,7 +72,7 @@ error: `await` is a keyword in the 2018 edition LL | await!(); | ^^^^^ help: you can use a raw identifier to stay compatible: `r#await` | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2018 edition! + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716> error: `await` is a keyword in the 2018 edition @@ -81,7 +81,7 @@ error: `await` is a keyword in the 2018 edition LL | match await { await => {} } | ^^^^^ help: you can use a raw identifier to stay compatible: `r#await` | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2018 edition! + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716> error: `await` is a keyword in the 2018 edition @@ -90,7 +90,7 @@ error: `await` is a keyword in the 2018 edition LL | match await { await => {} } | ^^^^^ help: you can use a raw identifier to stay compatible: `r#await` | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2018 edition! + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716> error: aborting due to 10 previous errors diff --git a/src/test/ui/async-await/await-keyword/2015-edition-warning.fixed b/src/test/ui/async-await/await-keyword/2015-edition-warning.fixed index c58496c91f5..117495e130f 100644 --- a/src/test/ui/async-await/await-keyword/2015-edition-warning.fixed +++ b/src/test/ui/async-await/await-keyword/2015-edition-warning.fixed @@ -6,22 +6,22 @@ mod outer_mod { pub mod r#await { //~^ ERROR `await` is a keyword -//~| WARN was previously accepted +//~| WARN this is accepted in the current edition pub struct r#await; //~^ ERROR `await` is a keyword -//~| WARN was previously accepted +//~| WARN this is accepted in the current edition } } use outer_mod::r#await::r#await; //~^ ERROR `await` is a keyword //~| ERROR `await` is a keyword -//~| WARN was previously accepted -//~| WARN was previously accepted +//~| WARN this is accepted in the current edition +//~| WARN this is accepted in the current edition fn main() { match r#await { r#await => {} } //~^ ERROR `await` is a keyword //~| ERROR `await` is a keyword -//~| WARN was previously accepted -//~| WARN was previously accepted +//~| WARN this is accepted in the current edition +//~| WARN this is accepted in the current edition } diff --git a/src/test/ui/async-await/await-keyword/2015-edition-warning.rs b/src/test/ui/async-await/await-keyword/2015-edition-warning.rs index a7543a14325..b3c64895c6d 100644 --- a/src/test/ui/async-await/await-keyword/2015-edition-warning.rs +++ b/src/test/ui/async-await/await-keyword/2015-edition-warning.rs @@ -6,22 +6,22 @@ mod outer_mod { pub mod await { //~^ ERROR `await` is a keyword -//~| WARN was previously accepted +//~| WARN this is accepted in the current edition pub struct await; //~^ ERROR `await` is a keyword -//~| WARN was previously accepted +//~| WARN this is accepted in the current edition } } use outer_mod::await::await; //~^ ERROR `await` is a keyword //~| ERROR `await` is a keyword -//~| WARN was previously accepted -//~| WARN was previously accepted +//~| WARN this is accepted in the current edition +//~| WARN this is accepted in the current edition fn main() { match await { await => {} } //~^ ERROR `await` is a keyword //~| ERROR `await` is a keyword -//~| WARN was previously accepted -//~| WARN was previously accepted +//~| WARN this is accepted in the current edition +//~| WARN this is accepted in the current edition } diff --git a/src/test/ui/async-await/await-keyword/2015-edition-warning.stderr b/src/test/ui/async-await/await-keyword/2015-edition-warning.stderr index 0c558eb12f0..1c4c19ea45f 100644 --- a/src/test/ui/async-await/await-keyword/2015-edition-warning.stderr +++ b/src/test/ui/async-await/await-keyword/2015-edition-warning.stderr @@ -9,7 +9,7 @@ note: the lint level is defined here | LL | #![deny(keyword_idents)] | ^^^^^^^^^^^^^^ - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2018 edition! + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716> error: `await` is a keyword in the 2018 edition @@ -18,7 +18,7 @@ error: `await` is a keyword in the 2018 edition LL | pub struct await; | ^^^^^ help: you can use a raw identifier to stay compatible: `r#await` | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2018 edition! + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716> error: `await` is a keyword in the 2018 edition @@ -27,7 +27,7 @@ error: `await` is a keyword in the 2018 edition LL | use outer_mod::await::await; | ^^^^^ help: you can use a raw identifier to stay compatible: `r#await` | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2018 edition! + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716> error: `await` is a keyword in the 2018 edition @@ -36,7 +36,7 @@ error: `await` is a keyword in the 2018 edition LL | use outer_mod::await::await; | ^^^^^ help: you can use a raw identifier to stay compatible: `r#await` | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2018 edition! + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716> error: `await` is a keyword in the 2018 edition @@ -45,7 +45,7 @@ error: `await` is a keyword in the 2018 edition LL | match await { await => {} } | ^^^^^ help: you can use a raw identifier to stay compatible: `r#await` | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2018 edition! + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716> error: `await` is a keyword in the 2018 edition @@ -54,7 +54,7 @@ error: `await` is a keyword in the 2018 edition LL | match await { await => {} } | ^^^^^ help: you can use a raw identifier to stay compatible: `r#await` | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2018 edition! + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716> error: aborting due to 6 previous errors diff --git a/src/test/ui/binop/issue-77910-1.stderr b/src/test/ui/binop/issue-77910-1.stderr index fa967ccb9d0..ed71b99da0f 100644 --- a/src/test/ui/binop/issue-77910-1.stderr +++ b/src/test/ui/binop/issue-77910-1.stderr @@ -14,11 +14,6 @@ error[E0277]: `for<'r> fn(&'r i32) -> &'r i32 {foo}` doesn't implement `Debug` | LL | assert_eq!(foo, y); | ^^^^^^^^^^^^^^^^^^^ `for<'r> fn(&'r i32) -> &'r i32 {foo}` cannot be formatted using `{:?}` because it doesn't implement `Debug` - | - ::: $SRC_DIR/core/src/panicking.rs:LL:COL - | -LL | T: fmt::Debug + ?Sized, - | ---------- required by this bound in `core::panicking::assert_failed` | = help: the trait `Debug` is not implemented for `for<'r> fn(&'r i32) -> &'r i32 {foo}` = note: this error originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/src/test/ui/borrowck/issue-85581.rs b/src/test/ui/borrowck/issue-85581.rs new file mode 100644 index 00000000000..ccc120c5421 --- /dev/null +++ b/src/test/ui/borrowck/issue-85581.rs @@ -0,0 +1,15 @@ +// Regression test of #85581. +// Checks not to suggest to add `;` when the second mutable borrow +// is in the first's scope. + +use std::collections::BinaryHeap; + +fn foo(heap: &mut BinaryHeap<i32>) { + match heap.peek_mut() { + Some(_) => { heap.pop(); }, + //~^ ERROR: cannot borrow `*heap` as mutable more than once at a time + None => (), + } +} + +fn main() {} diff --git a/src/test/ui/borrowck/issue-85581.stderr b/src/test/ui/borrowck/issue-85581.stderr new file mode 100644 index 00000000000..29c0429f2a0 --- /dev/null +++ b/src/test/ui/borrowck/issue-85581.stderr @@ -0,0 +1,17 @@ +error[E0499]: cannot borrow `*heap` as mutable more than once at a time + --> $DIR/issue-85581.rs:9:22 + | +LL | match heap.peek_mut() { + | --------------- + | | + | first mutable borrow occurs here + | a temporary with access to the first borrow is created here ... +LL | Some(_) => { heap.pop(); }, + | ^^^^ second mutable borrow occurs here +... +LL | } + | - ... and the first borrow might be used here, when that temporary is dropped and runs the destructor for type `Option<PeekMut<'_, i32>>` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0499`. diff --git a/src/test/ui/borrowck/two-phase-reservation-sharing-interference.rs b/src/test/ui/borrowck/two-phase-reservation-sharing-interference.rs index f7392bfeaab..50248a55838 100644 --- a/src/test/ui/borrowck/two-phase-reservation-sharing-interference.rs +++ b/src/test/ui/borrowck/two-phase-reservation-sharing-interference.rs @@ -1,8 +1,8 @@ // revisions: nll_target -// The following revisions are disabled due to missing support from two-phase beyond autorefs +// The nll_beyond revision is disabled due to missing support from two-phase beyond autorefs //[nll_beyond]compile-flags: -Z borrowck=mir -Z two-phase-beyond-autoref -//[nll_beyond] should-fail +//[nll_beyond]should-fail //[nll_target]compile-flags: -Z borrowck=mir diff --git a/src/test/ui/bound-suggestions.stderr b/src/test/ui/bound-suggestions.stderr index a3177903162..78f62592960 100644 --- a/src/test/ui/bound-suggestions.stderr +++ b/src/test/ui/bound-suggestions.stderr @@ -4,7 +4,6 @@ error[E0277]: `impl Sized` doesn't implement `Debug` LL | println!("{:?}", t); | ^ `impl Sized` cannot be formatted using `{:?}` because it doesn't implement `Debug` | - = note: required by `std::fmt::Debug::fmt` = note: this error originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider further restricting this bound | @@ -17,7 +16,6 @@ error[E0277]: `T` doesn't implement `Debug` LL | println!("{:?}", t); | ^ `T` cannot be formatted using `{:?}` because it doesn't implement `Debug` | - = note: required by `std::fmt::Debug::fmt` = note: this error originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider restricting type parameter `T` | @@ -30,7 +28,6 @@ error[E0277]: `T` doesn't implement `Debug` LL | println!("{:?}", t); | ^ `T` cannot be formatted using `{:?}` because it doesn't implement `Debug` | - = note: required by `std::fmt::Debug::fmt` = note: this error originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider further restricting this bound | @@ -43,7 +40,6 @@ error[E0277]: `Y` doesn't implement `Debug` LL | println!("{:?} {:?}", x, y); | ^ `Y` cannot be formatted using `{:?}` because it doesn't implement `Debug` | - = note: required by `std::fmt::Debug::fmt` = note: this error originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider further restricting type parameter `Y` | @@ -56,7 +52,6 @@ error[E0277]: `X` doesn't implement `Debug` LL | println!("{:?}", x); | ^ `X` cannot be formatted using `{:?}` because it doesn't implement `Debug` | - = note: required by `std::fmt::Debug::fmt` = note: this error originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider further restricting this bound | @@ -69,7 +64,6 @@ error[E0277]: `X` doesn't implement `Debug` LL | println!("{:?}", x); | ^ `X` cannot be formatted using `{:?}` because it doesn't implement `Debug` | - = note: required by `std::fmt::Debug::fmt` = note: this error originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider further restricting type parameter `X` | diff --git a/src/test/ui/c-variadic/issue-86053-1.rs b/src/test/ui/c-variadic/issue-86053-1.rs new file mode 100644 index 00000000000..b30548e19f9 --- /dev/null +++ b/src/test/ui/c-variadic/issue-86053-1.rs @@ -0,0 +1,12 @@ +// Regression test for the ICE described in issue #86053. +// error-pattern:unexpected `self` parameter in function +// error-pattern:`...` must be the last argument of a C-variadic function +// error-pattern:cannot find type `F` in this scope +// error-pattern:in type `&'a &'b usize`, reference has a longer lifetime than the data it references + +#![feature(c_variadic)] +#![crate_type="lib"] + +fn ordering4 < 'a , 'b > ( a : , self , self , self , + self , ... , self , self , ... ) where F : FnOnce ( & 'a & 'b usize ) { +} diff --git a/src/test/ui/c-variadic/issue-86053-1.stderr b/src/test/ui/c-variadic/issue-86053-1.stderr new file mode 100644 index 00000000000..ec7ee74aef2 --- /dev/null +++ b/src/test/ui/c-variadic/issue-86053-1.stderr @@ -0,0 +1,101 @@ +error: expected type, found `,` + --> $DIR/issue-86053-1.rs:10:47 + | +LL | fn ordering4 < 'a , 'b > ( a : , self , self , self , + | ^ expected type + +error: unexpected `self` parameter in function + --> $DIR/issue-86053-1.rs:10:51 + | +LL | fn ordering4 < 'a , 'b > ( a : , self , self , self , + | ^^^^ must be the first parameter of an associated function + +error: unexpected `self` parameter in function + --> $DIR/issue-86053-1.rs:10:58 + | +LL | fn ordering4 < 'a , 'b > ( a : , self , self , self , + | ^^^^ must be the first parameter of an associated function + +error: unexpected `self` parameter in function + --> $DIR/issue-86053-1.rs:10:67 + | +LL | fn ordering4 < 'a , 'b > ( a : , self , self , self , + | ^^^^ must be the first parameter of an associated function + +error: unexpected `self` parameter in function + --> $DIR/issue-86053-1.rs:11:5 + | +LL | self , ... , self , self , ... ) where F : FnOnce ( & 'a & 'b usize ) { + | ^^^^ must be the first parameter of an associated function + +error: unexpected `self` parameter in function + --> $DIR/issue-86053-1.rs:11:20 + | +LL | self , ... , self , self , ... ) where F : FnOnce ( & 'a & 'b usize ) { + | ^^^^ must be the first parameter of an associated function + +error: unexpected `self` parameter in function + --> $DIR/issue-86053-1.rs:11:29 + | +LL | self , ... , self , self , ... ) where F : FnOnce ( & 'a & 'b usize ) { + | ^^^^ must be the first parameter of an associated function + +error: `...` must be the last argument of a C-variadic function + --> $DIR/issue-86053-1.rs:11:12 + | +LL | self , ... , self , self , ... ) where F : FnOnce ( & 'a & 'b usize ) { + | ^^^^ + +error: only foreign or `unsafe extern "C"` functions may be C-variadic + --> $DIR/issue-86053-1.rs:11:12 + | +LL | self , ... , self , self , ... ) where F : FnOnce ( & 'a & 'b usize ) { + | ^^^^ + +error: only foreign or `unsafe extern "C"` functions may be C-variadic + --> $DIR/issue-86053-1.rs:11:36 + | +LL | self , ... , self , self , ... ) where F : FnOnce ( & 'a & 'b usize ) { + | ^^^^ + +error[E0412]: cannot find type `F` in this scope + --> $DIR/issue-86053-1.rs:11:48 + | +LL | self , ... , self , self , ... ) where F : FnOnce ( & 'a & 'b usize ) { + | ^ + | + ::: $SRC_DIR/core/src/ops/function.rs:LL:COL + | +LL | pub trait Fn<Args>: FnMut<Args> { + | ------------------------------- similarly named trait `Fn` defined here + | +help: a trait with a similar name exists + | +LL | self , ... , self , self , ... ) where Fn : FnOnce ( & 'a & 'b usize ) { + | ^^ +help: you might be missing a type parameter + | +LL | fn ordering4 < 'a , 'b, F > ( a : , self , self , self , + | ^^^ + +error[E0491]: in type `&'a &'b usize`, reference has a longer lifetime than the data it references + --> $DIR/issue-86053-1.rs:11:52 + | +LL | self , ... , self , self , ... ) where F : FnOnce ( & 'a & 'b usize ) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +note: the pointer is valid for the lifetime `'a` as defined on the function body at 10:16 + --> $DIR/issue-86053-1.rs:10:16 + | +LL | fn ordering4 < 'a , 'b > ( a : , self , self , self , + | ^^ +note: but the referenced data is only valid for the lifetime `'b` as defined on the function body at 10:21 + --> $DIR/issue-86053-1.rs:10:21 + | +LL | fn ordering4 < 'a , 'b > ( a : , self , self , self , + | ^^ + +error: aborting due to 12 previous errors + +Some errors have detailed explanations: E0412, E0491. +For more information about an error, try `rustc --explain E0412`. diff --git a/src/test/ui/c-variadic/issue-86053-2.rs b/src/test/ui/c-variadic/issue-86053-2.rs new file mode 100644 index 00000000000..c545831f717 --- /dev/null +++ b/src/test/ui/c-variadic/issue-86053-2.rs @@ -0,0 +1,11 @@ +// Regression test for the ICE caused by the example in +// https://github.com/rust-lang/rust/issues/86053#issuecomment-855672258 + +#![feature(c_variadic)] + +trait H<T> {} + +unsafe extern "C" fn ordering4<'a, F: H<&'static &'a ()>>(_: (), ...) {} +//~^ ERROR: in type `&'static &'a ()`, reference has a longer lifetime than the data it references [E0491] + +fn main() {} diff --git a/src/test/ui/c-variadic/issue-86053-2.stderr b/src/test/ui/c-variadic/issue-86053-2.stderr new file mode 100644 index 00000000000..4fc5e6315e4 --- /dev/null +++ b/src/test/ui/c-variadic/issue-86053-2.stderr @@ -0,0 +1,16 @@ +error[E0491]: in type `&'static &'a ()`, reference has a longer lifetime than the data it references + --> $DIR/issue-86053-2.rs:8:39 + | +LL | unsafe extern "C" fn ordering4<'a, F: H<&'static &'a ()>>(_: (), ...) {} + | ^^^^^^^^^^^^^^^^^^ + | + = note: the pointer is valid for the static lifetime +note: but the referenced data is only valid for the lifetime `'a` as defined on the function body at 8:32 + --> $DIR/issue-86053-2.rs:8:32 + | +LL | unsafe extern "C" fn ordering4<'a, F: H<&'static &'a ()>>(_: (), ...) {} + | ^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0491`. diff --git a/src/test/ui/closures/2229_closure_analysis/move_closure.rs b/src/test/ui/closures/2229_closure_analysis/move_closure.rs index 1c574da5f48..f96370eb203 100644 --- a/src/test/ui/closures/2229_closure_analysis/move_closure.rs +++ b/src/test/ui/closures/2229_closure_analysis/move_closure.rs @@ -114,8 +114,9 @@ fn struct_contains_ref_to_another_struct_3() { fn truncate_box_derefs() { struct S(i32); - let b = Box::new(S(10)); + // Content within the box is moved within the closure + let b = Box::new(S(10)); let c = #[rustc_capture_analysis] //~^ ERROR: attributes on expressions are experimental //~| NOTE: see issue #15701 <https://github.com/rust-lang/rust/issues/15701> @@ -129,6 +130,37 @@ fn truncate_box_derefs() { }; c(); + + // Content within the box is used by a shared ref and the box is the root variable + let b = Box::new(S(10)); + + let c = #[rustc_capture_analysis] + //~^ ERROR: attributes on expressions are experimental + //~| NOTE: see issue #15701 <https://github.com/rust-lang/rust/issues/15701> + move || { + //~^ ERROR: First Pass analysis includes: + //~| ERROR: Min Capture analysis includes: + println!("{}", b.0); + //~^ NOTE: Capturing b[Deref,(0, 0)] -> ByValue + //~| NOTE: Min Capture b[] -> ByValue + }; + + c(); + + // Content within the box is used by a shared ref and the box is not the root variable + let b = Box::new(S(10)); + let t = (0, b); + + let c = #[rustc_capture_analysis] + //~^ ERROR: attributes on expressions are experimental + //~| NOTE: see issue #15701 <https://github.com/rust-lang/rust/issues/15701> + move || { + //~^ ERROR: First Pass analysis includes: + //~| ERROR: Min Capture analysis includes: + println!("{}", t.1.0); + //~^ NOTE: Capturing t[(1, 0),Deref,(0, 0)] -> ByValue + //~| NOTE: Min Capture t[(1, 0)] -> ByValue + }; } fn main() { diff --git a/src/test/ui/closures/2229_closure_analysis/move_closure.stderr b/src/test/ui/closures/2229_closure_analysis/move_closure.stderr index b91ef4dd85c..82aa7ab8912 100644 --- a/src/test/ui/closures/2229_closure_analysis/move_closure.stderr +++ b/src/test/ui/closures/2229_closure_analysis/move_closure.stderr @@ -44,7 +44,25 @@ LL | let mut c = #[rustc_capture_analysis] = help: add `#![feature(stmt_expr_attributes)]` to the crate attributes to enable error[E0658]: attributes on expressions are experimental - --> $DIR/move_closure.rs:119:13 + --> $DIR/move_closure.rs:120:13 + | +LL | let c = #[rustc_capture_analysis] + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #15701 <https://github.com/rust-lang/rust/issues/15701> for more information + = help: add `#![feature(stmt_expr_attributes)]` to the crate attributes to enable + +error[E0658]: attributes on expressions are experimental + --> $DIR/move_closure.rs:137:13 + | +LL | let c = #[rustc_capture_analysis] + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #15701 <https://github.com/rust-lang/rust/issues/15701> for more information + = help: add `#![feature(stmt_expr_attributes)]` to the crate attributes to enable + +error[E0658]: attributes on expressions are experimental + --> $DIR/move_closure.rs:154:13 | LL | let c = #[rustc_capture_analysis] | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -247,7 +265,7 @@ LL | let _t = t.0.0; | ^^^^^ error: First Pass analysis includes: - --> $DIR/move_closure.rs:122:5 + --> $DIR/move_closure.rs:123:5 | LL | / move || { LL | | @@ -259,18 +277,18 @@ LL | | }; | |_____^ | note: Capturing b[Deref,(0, 0)] -> ByValue - --> $DIR/move_closure.rs:125:18 + --> $DIR/move_closure.rs:126:18 | LL | let _t = b.0; | ^^^ note: Capturing b[] -> ByValue - --> $DIR/move_closure.rs:125:18 + --> $DIR/move_closure.rs:126:18 | LL | let _t = b.0; | ^^^ error: Min Capture analysis includes: - --> $DIR/move_closure.rs:122:5 + --> $DIR/move_closure.rs:123:5 | LL | / move || { LL | | @@ -282,11 +300,83 @@ LL | | }; | |_____^ | note: Min Capture b[] -> ByValue - --> $DIR/move_closure.rs:125:18 + --> $DIR/move_closure.rs:126:18 | LL | let _t = b.0; | ^^^ -error: aborting due to 18 previous errors; 1 warning emitted +error: First Pass analysis includes: + --> $DIR/move_closure.rs:140:5 + | +LL | / move || { +LL | | +LL | | +LL | | println!("{}", b.0); +LL | | +LL | | +LL | | }; + | |_____^ + | +note: Capturing b[Deref,(0, 0)] -> ByValue + --> $DIR/move_closure.rs:143:24 + | +LL | println!("{}", b.0); + | ^^^ + +error: Min Capture analysis includes: + --> $DIR/move_closure.rs:140:5 + | +LL | / move || { +LL | | +LL | | +LL | | println!("{}", b.0); +LL | | +LL | | +LL | | }; + | |_____^ + | +note: Min Capture b[] -> ByValue + --> $DIR/move_closure.rs:143:24 + | +LL | println!("{}", b.0); + | ^^^ + +error: First Pass analysis includes: + --> $DIR/move_closure.rs:157:5 + | +LL | / move || { +LL | | +LL | | +LL | | println!("{}", t.1.0); +LL | | +LL | | +LL | | }; + | |_____^ + | +note: Capturing t[(1, 0),Deref,(0, 0)] -> ByValue + --> $DIR/move_closure.rs:160:24 + | +LL | println!("{}", t.1.0); + | ^^^^^ + +error: Min Capture analysis includes: + --> $DIR/move_closure.rs:157:5 + | +LL | / move || { +LL | | +LL | | +LL | | println!("{}", t.1.0); +LL | | +LL | | +LL | | }; + | |_____^ + | +note: Min Capture t[(1, 0)] -> ByValue + --> $DIR/move_closure.rs:160:24 + | +LL | println!("{}", t.1.0); + | ^^^^^ + +error: aborting due to 24 previous errors; 1 warning emitted For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/closures/2229_closure_analysis/run_pass/edition.rs b/src/test/ui/closures/2229_closure_analysis/run_pass/edition.rs new file mode 100644 index 00000000000..20bbe1d89e4 --- /dev/null +++ b/src/test/ui/closures/2229_closure_analysis/run_pass/edition.rs @@ -0,0 +1,23 @@ +// edition:2021 +// run-pass + +// Test that edition 2021 enables disjoint capture by default. + +struct Point { + x: i32, + y: i32, +} + +fn main() { + let mut p = Point { x: 10, y: 10 }; + + let c = || { + println!("{}", p.x); + }; + + // `c` should only capture `p.x`, therefore mutating `p.y` is allowed. + let py = &mut p.y; + + c(); + *py = 20; +} diff --git a/src/test/ui/cmse-nonsecure/cmse-nonsecure-call/params-on-registers.rs b/src/test/ui/cmse-nonsecure/cmse-nonsecure-call/params-on-registers.rs index b09ea06c8f3..9e4521df8c3 100644 --- a/src/test/ui/cmse-nonsecure/cmse-nonsecure-call/params-on-registers.rs +++ b/src/test/ui/cmse-nonsecure/cmse-nonsecure-call/params-on-registers.rs @@ -1,13 +1,21 @@ // build-pass // compile-flags: --target thumbv8m.main-none-eabi --crate-type lib -// only-thumbv8m.main-none-eabi -#![feature(abi_c_cmse_nonsecure_call)] -#![no_std] +// needs-llvm-components: arm +#![feature(abi_c_cmse_nonsecure_call, no_core, lang_items, intrinsics)] +#![no_core] +#[lang="sized"] +pub trait Sized { } +#[lang="copy"] +pub trait Copy { } + +extern "rust-intrinsic" { + pub fn transmute<T, U>(e: T) -> U; +} #[no_mangle] pub fn test(a: u32, b: u32, c: u32, d: u32) -> u32 { let non_secure_function = unsafe { - core::mem::transmute::<usize, extern "C-cmse-nonsecure-call" fn(u32, u32, u32, u32) -> u32>( + transmute::<usize, extern "C-cmse-nonsecure-call" fn(u32, u32, u32, u32) -> u32>( 0x10000004, ) }; diff --git a/src/test/ui/cmse-nonsecure/cmse-nonsecure-call/params-on-stack.rs b/src/test/ui/cmse-nonsecure/cmse-nonsecure-call/params-on-stack.rs index cfdce4f4e92..9697146d5c3 100644 --- a/src/test/ui/cmse-nonsecure/cmse-nonsecure-call/params-on-stack.rs +++ b/src/test/ui/cmse-nonsecure/cmse-nonsecure-call/params-on-stack.rs @@ -1,12 +1,22 @@ +// build-fail // compile-flags: --target thumbv8m.main-none-eabi --crate-type lib -// only-thumbv8m.main-none-eabi -#![feature(abi_c_cmse_nonsecure_call)] -#![no_std] +// needs-llvm-components: arm +// min-llvm-version: 11.0 +#![feature(abi_c_cmse_nonsecure_call, no_core, lang_items, intrinsics)] +#![no_core] +#[lang="sized"] +pub trait Sized { } +#[lang="copy"] +pub trait Copy { } + +extern "rust-intrinsic" { + pub fn transmute<T, U>(e: T) -> U; +} #[no_mangle] pub fn test(a: u32, b: u32, c: u32, d: u32, e: u32) -> u32 { let non_secure_function = unsafe { - core::mem::transmute::< + transmute::< usize, extern "C-cmse-nonsecure-call" fn(u32, u32, u32, u32, u32) -> u32> ( diff --git a/src/test/ui/cmse-nonsecure/cmse-nonsecure-call/wrong-abi-location-1.rs b/src/test/ui/cmse-nonsecure/cmse-nonsecure-call/wrong-abi-location-1.rs index 17117301fef..f32b3709002 100644 --- a/src/test/ui/cmse-nonsecure/cmse-nonsecure-call/wrong-abi-location-1.rs +++ b/src/test/ui/cmse-nonsecure/cmse-nonsecure-call/wrong-abi-location-1.rs @@ -1,6 +1,8 @@ // compile-flags: --target thumbv8m.main-none-eabi --crate-type lib -// only-thumbv8m.main-none-eabi -#![feature(abi_c_cmse_nonsecure_call)] -#![no_std] +// needs-llvm-components: arm +#![feature(abi_c_cmse_nonsecure_call, lang_items, no_core)] +#![no_core] +#[lang="sized"] +trait Sized { } pub extern "C-cmse-nonsecure-call" fn test() {} //~ ERROR [E0781] diff --git a/src/test/ui/cmse-nonsecure/cmse-nonsecure-call/wrong-abi-location-1.stderr b/src/test/ui/cmse-nonsecure/cmse-nonsecure-call/wrong-abi-location-1.stderr index 78490bf8f68..3564ab4b6cd 100644 --- a/src/test/ui/cmse-nonsecure/cmse-nonsecure-call/wrong-abi-location-1.stderr +++ b/src/test/ui/cmse-nonsecure/cmse-nonsecure-call/wrong-abi-location-1.stderr @@ -1,8 +1,8 @@ -error[E0781]: the `"cmse-nonsecure-call"` ABI is only allowed on function pointers. - --> $DIR/wrong-abi-location-1.rs:6:1 +error[E0781]: the `"C-cmse-nonsecure-call"` ABI is only allowed on function pointers. + --> $DIR/wrong-abi-location-1.rs:8:1 | -LL | pub extern "C-cmse-nonsecure-call" fn test() {} //~ ERROR [E0781] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | pub extern "C-cmse-nonsecure-call" fn test() {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/cmse-nonsecure/cmse-nonsecure-call/wrong-abi-location-2.rs b/src/test/ui/cmse-nonsecure/cmse-nonsecure-call/wrong-abi-location-2.rs index 78f553d747c..6f8bb24aa69 100644 --- a/src/test/ui/cmse-nonsecure/cmse-nonsecure-call/wrong-abi-location-2.rs +++ b/src/test/ui/cmse-nonsecure/cmse-nonsecure-call/wrong-abi-location-2.rs @@ -1,7 +1,9 @@ // compile-flags: --target thumbv8m.main-none-eabi --crate-type lib -// only-thumbv8m.main-none-eabi -#![feature(abi_c_cmse_nonsecure_call)] -#![no_std] +// needs-llvm-components: arm +#![feature(abi_c_cmse_nonsecure_call, lang_items, no_core)] +#![no_core] +#[lang="sized"] +trait Sized { } extern "C-cmse-nonsecure-call" { //~ ERROR [E0781] fn test(); diff --git a/src/test/ui/cmse-nonsecure/cmse-nonsecure-call/wrong-abi-location-2.stderr b/src/test/ui/cmse-nonsecure/cmse-nonsecure-call/wrong-abi-location-2.stderr index 5c148e2cd6f..76073f54884 100644 --- a/src/test/ui/cmse-nonsecure/cmse-nonsecure-call/wrong-abi-location-2.stderr +++ b/src/test/ui/cmse-nonsecure/cmse-nonsecure-call/wrong-abi-location-2.stderr @@ -1,8 +1,8 @@ error[E0781]: the `"C-cmse-nonsecure-call"` ABI is only allowed on function pointers. - --> $DIR/wrong-abi-location-2.rs:6:1 + --> $DIR/wrong-abi-location-2.rs:8:1 | LL | / extern "C-cmse-nonsecure-call" { -LL | | fn test(); //~ ERROR [E0781] +LL | | fn test(); LL | | } | |_^ diff --git a/src/test/ui/cmse-nonsecure/cmse-nonsecure-entry/issue-83475.rs b/src/test/ui/cmse-nonsecure/cmse-nonsecure-entry/issue-83475.rs new file mode 100644 index 00000000000..a839406cd0a --- /dev/null +++ b/src/test/ui/cmse-nonsecure/cmse-nonsecure-entry/issue-83475.rs @@ -0,0 +1,9 @@ +// Regression test for the ICE described in #83475. + +#![crate_type="lib"] + +#![feature(cmse_nonsecure_entry)] +#[cmse_nonsecure_entry] +//~^ ERROR: attribute should be applied to a function definition +struct XEmpty2; +//~^ NOTE: not a function definition diff --git a/src/test/ui/cmse-nonsecure/cmse-nonsecure-entry/issue-83475.stderr b/src/test/ui/cmse-nonsecure/cmse-nonsecure-entry/issue-83475.stderr new file mode 100644 index 00000000000..426d82d8d07 --- /dev/null +++ b/src/test/ui/cmse-nonsecure/cmse-nonsecure-entry/issue-83475.stderr @@ -0,0 +1,11 @@ +error: attribute should be applied to a function definition + --> $DIR/issue-83475.rs:6:1 + | +LL | #[cmse_nonsecure_entry] + | ^^^^^^^^^^^^^^^^^^^^^^^ +LL | +LL | struct XEmpty2; + | --------------- not a function definition + +error: aborting due to previous error + diff --git a/src/test/ui/cmse-nonsecure/cmse-nonsecure-entry/params-on-registers.rs b/src/test/ui/cmse-nonsecure/cmse-nonsecure-entry/params-on-registers.rs index a723eb73473..8cde9ba58b9 100644 --- a/src/test/ui/cmse-nonsecure/cmse-nonsecure-entry/params-on-registers.rs +++ b/src/test/ui/cmse-nonsecure/cmse-nonsecure-entry/params-on-registers.rs @@ -1,11 +1,15 @@ // build-pass // compile-flags: --target thumbv8m.main-none-eabi --crate-type lib -// only-thumbv8m.main-none-eabi -#![feature(cmse_nonsecure_entry)] -#![no_std] +// needs-llvm-components: arm +#![feature(cmse_nonsecure_entry, no_core, lang_items)] +#![no_core] +#[lang="sized"] +trait Sized { } +#[lang="copy"] +trait Copy { } #[no_mangle] #[cmse_nonsecure_entry] -pub extern "C" fn entry_function(a: u32, b: u32, c: u32, d: u32) -> u32 { - a + b + c + d +pub extern "C" fn entry_function(_: u32, _: u32, _: u32, d: u32) -> u32 { + d } diff --git a/src/test/ui/cmse-nonsecure/cmse-nonsecure-entry/params-on-stack.rs b/src/test/ui/cmse-nonsecure/cmse-nonsecure-entry/params-on-stack.rs index 553d3a8cb0b..74321fdfdde 100644 --- a/src/test/ui/cmse-nonsecure/cmse-nonsecure-entry/params-on-stack.rs +++ b/src/test/ui/cmse-nonsecure/cmse-nonsecure-entry/params-on-stack.rs @@ -1,10 +1,16 @@ +// build-fail // compile-flags: --target thumbv8m.main-none-eabi --crate-type lib -// only-thumbv8m.main-none-eabi -#![feature(cmse_nonsecure_entry)] -#![no_std] +// needs-llvm-components: arm +// min-llvm-version: 11.0 +#![feature(cmse_nonsecure_entry, no_core, lang_items)] +#![no_core] +#[lang="sized"] +trait Sized { } +#[lang="copy"] +trait Copy { } #[no_mangle] #[cmse_nonsecure_entry] -pub extern "C" fn entry_function(a: u32, b: u32, c: u32, d: u32, e: u32) -> u32 { //~ ERROR - a + b + c + d + e +pub extern "C" fn entry_function(_: u32, _: u32, _: u32, _: u32, e: u32) -> u32 { + e } diff --git a/src/test/ui/cmse-nonsecure/cmse-nonsecure-entry/wrong-abi.rs b/src/test/ui/cmse-nonsecure/cmse-nonsecure-entry/wrong-abi.rs index 611c8643dcb..6320d296373 100644 --- a/src/test/ui/cmse-nonsecure/cmse-nonsecure-entry/wrong-abi.rs +++ b/src/test/ui/cmse-nonsecure/cmse-nonsecure-entry/wrong-abi.rs @@ -1,10 +1,13 @@ // compile-flags: --target thumbv8m.main-none-eabi --crate-type lib -// only-thumbv8m.main-none-eabi -#![feature(cmse_nonsecure_entry)] -#![no_std] +// needs-llvm-components: arm +#![feature(cmse_nonsecure_entry, no_core, lang_items)] +#![no_core] +#[lang="sized"] +trait Sized { } #[no_mangle] #[cmse_nonsecure_entry] -pub fn entry_function(a: u32, b: u32, c: u32, d: u32) -> u32 { //~ ERROR [E0776] - a + b + c + d +//~^ ERROR `#[cmse_nonsecure_entry]` requires C ABI [E0776] +pub fn entry_function(_: u32, _: u32, _: u32, d: u32) -> u32 { + d } diff --git a/src/test/ui/cmse-nonsecure/cmse-nonsecure-entry/wrong-abi.stderr b/src/test/ui/cmse-nonsecure/cmse-nonsecure-entry/wrong-abi.stderr index d6967a11e6b..36d76c9674a 100644 --- a/src/test/ui/cmse-nonsecure/cmse-nonsecure-entry/wrong-abi.stderr +++ b/src/test/ui/cmse-nonsecure/cmse-nonsecure-entry/wrong-abi.stderr @@ -1,5 +1,5 @@ -error[E0776]: `#[cmse_nonsecure_entry]` functions require C ABI - --> $DIR/wrong-abi.rs:7:1 +error[E0776]: `#[cmse_nonsecure_entry]` requires C ABI + --> $DIR/wrong-abi.rs:9:1 | LL | #[cmse_nonsecure_entry] | ^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/const-generics/issues/issue-61432.rs b/src/test/ui/const-generics/issues/issue-61432.rs index 0e228126d77..97ab07dacce 100644 --- a/src/test/ui/const-generics/issues/issue-61432.rs +++ b/src/test/ui/const-generics/issues/issue-61432.rs @@ -6,9 +6,9 @@ fn promote<const N: i32>() { // works: // // let n = N; - // &n; + // let _ = &n; - &N; + let _ = &N; } fn main() { diff --git a/src/test/ui/const-generics/min_const_generics/const-expression-suggest-missing-braces.rs b/src/test/ui/const-generics/min_const_generics/const-expression-suggest-missing-braces.rs index d845e00694a..ae8863c567d 100644 --- a/src/test/ui/const-generics/min_const_generics/const-expression-suggest-missing-braces.rs +++ b/src/test/ui/const-generics/min_const_generics/const-expression-suggest-missing-braces.rs @@ -13,7 +13,7 @@ fn b() { //~| ERROR expected trait, found constant `BAR` //~| ERROR type provided when a constant was expected //~| WARN trait objects without an explicit `dyn` are deprecated - //~| WARN this was previously accepted by the compiler + //~| WARN this is accepted in the current edition } fn c() { foo::<3 + 3>(); //~ ERROR expressions must be enclosed in braces diff --git a/src/test/ui/const-generics/min_const_generics/const-expression-suggest-missing-braces.stderr b/src/test/ui/const-generics/min_const_generics/const-expression-suggest-missing-braces.stderr index 857498a1111..b93bd6c6fa0 100644 --- a/src/test/ui/const-generics/min_const_generics/const-expression-suggest-missing-braces.stderr +++ b/src/test/ui/const-generics/min_const_generics/const-expression-suggest-missing-braces.stderr @@ -138,7 +138,7 @@ LL | foo::<BAR + BAR>(); | ^^^^^^^^^ help: use `dyn`: `dyn BAR + BAR` | = note: `#[warn(bare_trait_objects)]` on by default - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2021 edition! + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! = note: for more information, see issue #80165 <https://github.com/rust-lang/rust/issues/80165> error[E0747]: type provided when a constant was expected diff --git a/src/test/ui/const-ptr/out_of_bounds_read.rs b/src/test/ui/const-ptr/out_of_bounds_read.rs new file mode 100644 index 00000000000..c45198cc39b --- /dev/null +++ b/src/test/ui/const-ptr/out_of_bounds_read.rs @@ -0,0 +1,16 @@ +// error-pattern: evaluation of constant value failed + +#![feature(const_ptr_read)] +#![feature(const_ptr_offset)] + +fn main() { + use std::ptr; + + const DATA: [u32; 1] = [42]; + + const PAST_END_PTR: *const u32 = unsafe { DATA.as_ptr().add(1) }; + + const _READ: u32 = unsafe { ptr::read(PAST_END_PTR) }; + const _CONST_READ: u32 = unsafe { PAST_END_PTR.read() }; + const _MUT_READ: u32 = unsafe { (PAST_END_PTR as *mut u32).read() }; +} diff --git a/src/test/ui/const-ptr/out_of_bounds_read.stderr b/src/test/ui/const-ptr/out_of_bounds_read.stderr new file mode 100644 index 00000000000..67175d5d1f5 --- /dev/null +++ b/src/test/ui/const-ptr/out_of_bounds_read.stderr @@ -0,0 +1,70 @@ +error[E0080]: evaluation of constant value failed + --> $SRC_DIR/core/src/intrinsics.rs:LL:COL + | +LL | unsafe { copy_nonoverlapping(src, dst, count) } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | | + | memory access failed: pointer must be in-bounds at offset 8, but is outside bounds of alloc6 which has size 4 + | inside `copy_nonoverlapping::<u32>` at $SRC_DIR/core/src/intrinsics.rs:LL:COL + | + ::: $SRC_DIR/core/src/ptr/mod.rs:LL:COL + | +LL | copy_nonoverlapping(src, tmp.as_mut_ptr(), 1); + | --------------------------------------------- inside `std::ptr::read::<u32>` at $SRC_DIR/core/src/ptr/mod.rs:LL:COL + | + ::: $DIR/out_of_bounds_read.rs:13:33 + | +LL | const _READ: u32 = unsafe { ptr::read(PAST_END_PTR) }; + | ----------------------- inside `_READ` at $DIR/out_of_bounds_read.rs:13:33 + +error[E0080]: evaluation of constant value failed + --> $SRC_DIR/core/src/intrinsics.rs:LL:COL + | +LL | unsafe { copy_nonoverlapping(src, dst, count) } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | | + | memory access failed: pointer must be in-bounds at offset 8, but is outside bounds of alloc6 which has size 4 + | inside `copy_nonoverlapping::<u32>` at $SRC_DIR/core/src/intrinsics.rs:LL:COL + | + ::: $SRC_DIR/core/src/ptr/mod.rs:LL:COL + | +LL | copy_nonoverlapping(src, tmp.as_mut_ptr(), 1); + | --------------------------------------------- inside `std::ptr::read::<u32>` at $SRC_DIR/core/src/ptr/mod.rs:LL:COL + | + ::: $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL + | +LL | unsafe { read(self) } + | ---------- inside `ptr::const_ptr::<impl *const u32>::read` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL + | + ::: $DIR/out_of_bounds_read.rs:14:39 + | +LL | const _CONST_READ: u32 = unsafe { PAST_END_PTR.read() }; + | ------------------- inside `_CONST_READ` at $DIR/out_of_bounds_read.rs:14:39 + +error[E0080]: evaluation of constant value failed + --> $SRC_DIR/core/src/intrinsics.rs:LL:COL + | +LL | unsafe { copy_nonoverlapping(src, dst, count) } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | | + | memory access failed: pointer must be in-bounds at offset 8, but is outside bounds of alloc6 which has size 4 + | inside `copy_nonoverlapping::<u32>` at $SRC_DIR/core/src/intrinsics.rs:LL:COL + | + ::: $SRC_DIR/core/src/ptr/mod.rs:LL:COL + | +LL | copy_nonoverlapping(src, tmp.as_mut_ptr(), 1); + | --------------------------------------------- inside `std::ptr::read::<u32>` at $SRC_DIR/core/src/ptr/mod.rs:LL:COL + | + ::: $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + | +LL | unsafe { read(self) } + | ---------- inside `ptr::mut_ptr::<impl *mut u32>::read` at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + | + ::: $DIR/out_of_bounds_read.rs:15:37 + | +LL | const _MUT_READ: u32 = unsafe { (PAST_END_PTR as *mut u32).read() }; + | --------------------------------- inside `_MUT_READ` at $DIR/out_of_bounds_read.rs:15:37 + +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0080`. diff --git a/src/test/ui/consts/const-eval/const_panic.rs b/src/test/ui/consts/const-eval/const_panic.rs index b33b1475a22..5807c5659b6 100644 --- a/src/test/ui/consts/const-eval/const_panic.rs +++ b/src/test/ui/consts/const-eval/const_panic.rs @@ -5,31 +5,31 @@ const MSG: &str = "hello"; const Z: () = std::panic!("cheese"); -//~^ ERROR any use of this value will cause an error +//~^ ERROR evaluation of constant value failed const Z2: () = std::panic!(); -//~^ ERROR any use of this value will cause an error +//~^ ERROR evaluation of constant value failed const Y: () = std::unreachable!(); -//~^ ERROR any use of this value will cause an error +//~^ ERROR evaluation of constant value failed const X: () = std::unimplemented!(); -//~^ ERROR any use of this value will cause an error +//~^ ERROR evaluation of constant value failed // const W: () = std::panic!(MSG); -//~^ ERROR any use of this value will cause an error +//~^ ERROR evaluation of constant value failed const Z_CORE: () = core::panic!("cheese"); -//~^ ERROR any use of this value will cause an error +//~^ ERROR evaluation of constant value failed const Z2_CORE: () = core::panic!(); -//~^ ERROR any use of this value will cause an error +//~^ ERROR evaluation of constant value failed const Y_CORE: () = core::unreachable!(); -//~^ ERROR any use of this value will cause an error +//~^ ERROR evaluation of constant value failed const X_CORE: () = core::unimplemented!(); -//~^ ERROR any use of this value will cause an error +//~^ ERROR evaluation of constant value failed const W_CORE: () = core::panic!(MSG); -//~^ ERROR any use of this value will cause an error +//~^ ERROR evaluation of constant value failed diff --git a/src/test/ui/consts/const-eval/const_panic.stderr b/src/test/ui/consts/const-eval/const_panic.stderr index 3c890f78af7..c0c749ede56 100644 --- a/src/test/ui/consts/const-eval/const_panic.stderr +++ b/src/test/ui/consts/const-eval/const_panic.stderr @@ -1,100 +1,80 @@ -error[E0080]: any use of this value will cause an error +error[E0080]: evaluation of constant value failed --> $DIR/const_panic.rs:7:15 | LL | const Z: () = std::panic!("cheese"); - | --------------^^^^^^^^^^^^^^^^^^^^^- - | | - | the evaluated program panicked at 'cheese', $DIR/const_panic.rs:7:15 + | ^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'cheese', $DIR/const_panic.rs:7:15 | = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) -error[E0080]: any use of this value will cause an error +error[E0080]: evaluation of constant value failed --> $DIR/const_panic.rs:10:16 | LL | const Z2: () = std::panic!(); - | ---------------^^^^^^^^^^^^^- - | | - | the evaluated program panicked at 'explicit panic', $DIR/const_panic.rs:10:16 + | ^^^^^^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/const_panic.rs:10:16 | = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) -error[E0080]: any use of this value will cause an error +error[E0080]: evaluation of constant value failed --> $DIR/const_panic.rs:13:15 | LL | const Y: () = std::unreachable!(); - | --------------^^^^^^^^^^^^^^^^^^^- - | | - | the evaluated program panicked at 'internal error: entered unreachable code', $DIR/const_panic.rs:13:15 + | ^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'internal error: entered unreachable code', $DIR/const_panic.rs:13:15 | = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) -error[E0080]: any use of this value will cause an error +error[E0080]: evaluation of constant value failed --> $DIR/const_panic.rs:16:15 | LL | const X: () = std::unimplemented!(); - | --------------^^^^^^^^^^^^^^^^^^^^^- - | | - | the evaluated program panicked at 'not implemented', $DIR/const_panic.rs:16:15 + | ^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'not implemented', $DIR/const_panic.rs:16:15 | = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) -error[E0080]: any use of this value will cause an error +error[E0080]: evaluation of constant value failed --> $DIR/const_panic.rs:19:15 | LL | const W: () = std::panic!(MSG); - | --------------^^^^^^^^^^^^^^^^- - | | - | the evaluated program panicked at 'hello', $DIR/const_panic.rs:19:15 + | ^^^^^^^^^^^^^^^^ the evaluated program panicked at 'hello', $DIR/const_panic.rs:19:15 | = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) -error[E0080]: any use of this value will cause an error +error[E0080]: evaluation of constant value failed --> $DIR/const_panic.rs:22:20 | LL | const Z_CORE: () = core::panic!("cheese"); - | -------------------^^^^^^^^^^^^^^^^^^^^^^- - | | - | the evaluated program panicked at 'cheese', $DIR/const_panic.rs:22:20 + | ^^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'cheese', $DIR/const_panic.rs:22:20 | = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) -error[E0080]: any use of this value will cause an error +error[E0080]: evaluation of constant value failed --> $DIR/const_panic.rs:25:21 | LL | const Z2_CORE: () = core::panic!(); - | --------------------^^^^^^^^^^^^^^- - | | - | the evaluated program panicked at 'explicit panic', $DIR/const_panic.rs:25:21 + | ^^^^^^^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/const_panic.rs:25:21 | = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) -error[E0080]: any use of this value will cause an error +error[E0080]: evaluation of constant value failed --> $DIR/const_panic.rs:28:20 | LL | const Y_CORE: () = core::unreachable!(); - | -------------------^^^^^^^^^^^^^^^^^^^^- - | | - | the evaluated program panicked at 'internal error: entered unreachable code', $DIR/const_panic.rs:28:20 + | ^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'internal error: entered unreachable code', $DIR/const_panic.rs:28:20 | = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) -error[E0080]: any use of this value will cause an error +error[E0080]: evaluation of constant value failed --> $DIR/const_panic.rs:31:20 | LL | const X_CORE: () = core::unimplemented!(); - | -------------------^^^^^^^^^^^^^^^^^^^^^^- - | | - | the evaluated program panicked at 'not implemented', $DIR/const_panic.rs:31:20 + | ^^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'not implemented', $DIR/const_panic.rs:31:20 | = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) -error[E0080]: any use of this value will cause an error +error[E0080]: evaluation of constant value failed --> $DIR/const_panic.rs:34:20 | LL | const W_CORE: () = core::panic!(MSG); - | -------------------^^^^^^^^^^^^^^^^^- - | | - | the evaluated program panicked at 'hello', $DIR/const_panic.rs:34:20 + | ^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'hello', $DIR/const_panic.rs:34:20 | = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/src/test/ui/consts/const-eval/const_panic_libcore_bin.rs b/src/test/ui/consts/const-eval/const_panic_libcore_bin.rs index 6b03e847def..1ea0845c968 100644 --- a/src/test/ui/consts/const-eval/const_panic_libcore_bin.rs +++ b/src/test/ui/consts/const-eval/const_panic_libcore_bin.rs @@ -7,13 +7,13 @@ use core::panic::PanicInfo; const Z: () = panic!("cheese"); -//~^ ERROR any use of this value will cause an error +//~^ ERROR evaluation of constant value failed const Y: () = unreachable!(); -//~^ ERROR any use of this value will cause an error +//~^ ERROR evaluation of constant value failed const X: () = unimplemented!(); -//~^ ERROR any use of this value will cause an error +//~^ ERROR evaluation of constant value failed #[lang = "eh_personality"] fn eh() {} diff --git a/src/test/ui/consts/const-eval/const_panic_libcore_bin.stderr b/src/test/ui/consts/const-eval/const_panic_libcore_bin.stderr index 2a3ad3ca180..9abf8a20b8a 100644 --- a/src/test/ui/consts/const-eval/const_panic_libcore_bin.stderr +++ b/src/test/ui/consts/const-eval/const_panic_libcore_bin.stderr @@ -1,30 +1,24 @@ -error[E0080]: any use of this value will cause an error +error[E0080]: evaluation of constant value failed --> $DIR/const_panic_libcore_bin.rs:9:15 | LL | const Z: () = panic!("cheese"); - | --------------^^^^^^^^^^^^^^^^- - | | - | the evaluated program panicked at 'cheese', $DIR/const_panic_libcore_bin.rs:9:15 + | ^^^^^^^^^^^^^^^^ the evaluated program panicked at 'cheese', $DIR/const_panic_libcore_bin.rs:9:15 | = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) -error[E0080]: any use of this value will cause an error +error[E0080]: evaluation of constant value failed --> $DIR/const_panic_libcore_bin.rs:12:15 | LL | const Y: () = unreachable!(); - | --------------^^^^^^^^^^^^^^- - | | - | the evaluated program panicked at 'internal error: entered unreachable code', $DIR/const_panic_libcore_bin.rs:12:15 + | ^^^^^^^^^^^^^^ the evaluated program panicked at 'internal error: entered unreachable code', $DIR/const_panic_libcore_bin.rs:12:15 | = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) -error[E0080]: any use of this value will cause an error +error[E0080]: evaluation of constant value failed --> $DIR/const_panic_libcore_bin.rs:15:15 | LL | const X: () = unimplemented!(); - | --------------^^^^^^^^^^^^^^^^- - | | - | the evaluated program panicked at 'not implemented', $DIR/const_panic_libcore_bin.rs:15:15 + | ^^^^^^^^^^^^^^^^ the evaluated program panicked at 'not implemented', $DIR/const_panic_libcore_bin.rs:15:15 | = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/src/test/ui/consts/const-eval/dangling.rs b/src/test/ui/consts/const-eval/dangling.rs index 45c429c7eb0..610531c7b4c 100644 --- a/src/test/ui/consts/const-eval/dangling.rs +++ b/src/test/ui/consts/const-eval/dangling.rs @@ -5,9 +5,8 @@ use std::mem; // Make sure we error with the right kind of error on a too large slice. const TEST: () = { unsafe { let slice: *const [u8] = mem::transmute((1usize, usize::MAX)); - let _val = &*slice; //~ ERROR: any use of this value will cause an error + let _val = &*slice; //~ ERROR: evaluation of constant value failed //~| slice is bigger than largest supported object - //~| WARN this was previously accepted by the compiler but is being phased out } }; fn main() {} diff --git a/src/test/ui/consts/const-eval/dangling.stderr b/src/test/ui/consts/const-eval/dangling.stderr index 224fbb62a46..5665a9c3e05 100644 --- a/src/test/ui/consts/const-eval/dangling.stderr +++ b/src/test/ui/consts/const-eval/dangling.stderr @@ -1,18 +1,9 @@ -error: any use of this value will cause an error +error[E0080]: evaluation of constant value failed --> $DIR/dangling.rs:8:16 | -LL | / const TEST: () = { unsafe { -LL | | let slice: *const [u8] = mem::transmute((1usize, usize::MAX)); -LL | | let _val = &*slice; - | | ^^^^^^^ invalid metadata in wide pointer: slice is bigger than largest supported object -LL | | -LL | | -LL | | } }; - | |____- - | - = 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! - = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> +LL | let _val = &*slice; + | ^^^^^^^ invalid metadata in wide pointer: slice is bigger than largest supported object error: aborting due to previous error +For more information about this error, try `rustc --explain E0080`. diff --git a/src/test/ui/consts/const-eval/heap/alloc_intrinsic_errors.rs b/src/test/ui/consts/const-eval/heap/alloc_intrinsic_errors.rs index 43d79badd72..4df541eeeb4 100644 --- a/src/test/ui/consts/const-eval/heap/alloc_intrinsic_errors.rs +++ b/src/test/ui/consts/const-eval/heap/alloc_intrinsic_errors.rs @@ -8,8 +8,7 @@ const FOO: i32 = foo(); const fn foo() -> i32 { unsafe { let _ = intrinsics::const_allocate(4, 3) as * mut i32; - //~^ error: any use of this value will cause an error [const_err] - //~| WARN this was previously accepted by the compiler but is being phased out + //~^ error: evaluation of constant value failed } 1 diff --git a/src/test/ui/consts/const-eval/heap/alloc_intrinsic_errors.stderr b/src/test/ui/consts/const-eval/heap/alloc_intrinsic_errors.stderr index 3d529ab4ca6..327e2911205 100644 --- a/src/test/ui/consts/const-eval/heap/alloc_intrinsic_errors.stderr +++ b/src/test/ui/consts/const-eval/heap/alloc_intrinsic_errors.stderr @@ -1,19 +1,15 @@ -error: any use of this value will cause an error +error[E0080]: evaluation of constant value failed --> $DIR/alloc_intrinsic_errors.rs:10:17 | LL | const FOO: i32 = foo(); - | ----------------------- + | ----- inside `FOO` at $DIR/alloc_intrinsic_errors.rs:7:18 ... LL | let _ = intrinsics::const_allocate(4, 3) as * mut i32; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | | align has to be a power of 2, `3` is not a power of 2 | inside `foo` at $DIR/alloc_intrinsic_errors.rs:10:17 - | inside `FOO` at $DIR/alloc_intrinsic_errors.rs:7:18 - | - = 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! - = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> error: aborting due to previous error +For more information about this error, try `rustc --explain E0080`. diff --git a/src/test/ui/consts/const-eval/issue-49296.rs b/src/test/ui/consts/const-eval/issue-49296.rs index f2d9758b8dc..baa1848e9c3 100644 --- a/src/test/ui/consts/const-eval/issue-49296.rs +++ b/src/test/ui/consts/const-eval/issue-49296.rs @@ -17,8 +17,7 @@ const fn wat(x: u64) -> &'static u64 { unsafe { transmute(&x) } } const X: u64 = *wat(42); -//~^ ERROR any use of this value will cause an error -//~| WARN this was previously accepted by the compiler but is being phased out +//~^ ERROR evaluation of constant value failed fn main() { println!("{}", X); diff --git a/src/test/ui/consts/const-eval/issue-49296.stderr b/src/test/ui/consts/const-eval/issue-49296.stderr index 0389471edb5..49ec9eb047b 100644 --- a/src/test/ui/consts/const-eval/issue-49296.stderr +++ b/src/test/ui/consts/const-eval/issue-49296.stderr @@ -1,14 +1,9 @@ -error: any use of this value will cause an error +error[E0080]: evaluation of constant value failed --> $DIR/issue-49296.rs:19:16 | LL | const X: u64 = *wat(42); - | ---------------^^^^^^^^- - | | - | pointer to alloc1 was dereferenced after this allocation got freed - | - = 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! - = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> + | ^^^^^^^^ pointer to alloc1 was dereferenced after this allocation got freed error: aborting due to previous error +For more information about this error, try `rustc --explain E0080`. diff --git a/src/test/ui/consts/const-eval/panic-assoc-never-type.rs b/src/test/ui/consts/const-eval/panic-assoc-never-type.rs index dd18a98035b..78cf25308ff 100644 --- a/src/test/ui/consts/const-eval/panic-assoc-never-type.rs +++ b/src/test/ui/consts/const-eval/panic-assoc-never-type.rs @@ -9,7 +9,7 @@ struct PrintName; impl PrintName { const VOID: ! = panic!(); - //~^ ERROR any use of this value will cause an error + //~^ ERROR evaluation of constant value failed } fn main() { diff --git a/src/test/ui/consts/const-eval/panic-assoc-never-type.stderr b/src/test/ui/consts/const-eval/panic-assoc-never-type.stderr index e186240f53a..08560948309 100644 --- a/src/test/ui/consts/const-eval/panic-assoc-never-type.stderr +++ b/src/test/ui/consts/const-eval/panic-assoc-never-type.stderr @@ -1,10 +1,8 @@ -error[E0080]: any use of this value will cause an error +error[E0080]: evaluation of constant value failed --> $DIR/panic-assoc-never-type.rs:11:21 | LL | const VOID: ! = panic!(); - | ----------------^^^^^^^^- - | | - | the evaluated program panicked at 'explicit panic', $DIR/panic-assoc-never-type.rs:11:21 + | ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/panic-assoc-never-type.rs:11:21 | = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/src/test/ui/consts/const-eval/panic-never-type.rs b/src/test/ui/consts/const-eval/panic-never-type.rs index 71b489d828c..dd875768b16 100644 --- a/src/test/ui/consts/const-eval/panic-never-type.rs +++ b/src/test/ui/consts/const-eval/panic-never-type.rs @@ -4,7 +4,7 @@ #![feature(never_type)] const VOID: ! = panic!(); -//~^ ERROR any use of this value will cause an error +//~^ ERROR evaluation of constant value failed fn main() { let _ = VOID; diff --git a/src/test/ui/consts/const-eval/panic-never-type.stderr b/src/test/ui/consts/const-eval/panic-never-type.stderr index 2254c3dcfdf..9b7f2181c16 100644 --- a/src/test/ui/consts/const-eval/panic-never-type.stderr +++ b/src/test/ui/consts/const-eval/panic-never-type.stderr @@ -1,10 +1,8 @@ -error[E0080]: any use of this value will cause an error +error[E0080]: evaluation of constant value failed --> $DIR/panic-never-type.rs:6:17 | LL | const VOID: ! = panic!(); - | ----------------^^^^^^^^- - | | - | the evaluated program panicked at 'explicit panic', $DIR/panic-never-type.rs:6:17 + | ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/panic-never-type.rs:6:17 | = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) 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 941f08bfd8d..ffde14f894e 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 @@ -1,30 +1,17 @@ -error: any use of this value will cause an error +error[E0080]: evaluation of constant value failed --> $DIR/ub-incorrect-vtable.rs:19:14 | -LL | / const INVALID_VTABLE_ALIGNMENT: &dyn Trait = -LL | | unsafe { std::mem::transmute((&92u8, &[0usize, 1usize, 1000usize])) }; - | |______________^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^__- - | | - | invalid vtable: alignment `1000` is not a power of 2 - | - = 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! - = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> +LL | unsafe { std::mem::transmute((&92u8, &[0usize, 1usize, 1000usize])) }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ invalid vtable: alignment `1000` is not a power of 2 -error: any use of this value will cause an error - --> $DIR/ub-incorrect-vtable.rs:25:14 - | -LL | / const INVALID_VTABLE_SIZE: &dyn Trait = -LL | | unsafe { std::mem::transmute((&92u8, &[1usize, usize::MAX, 1usize])) }; - | |______________^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^__- - | | - | invalid vtable: size is bigger than largest supported object +error[E0080]: evaluation of constant value failed + --> $DIR/ub-incorrect-vtable.rs:24:14 | - = 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> +LL | unsafe { std::mem::transmute((&92u8, &[1usize, usize::MAX, 1usize])) }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ invalid vtable: size is bigger than largest supported object error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-incorrect-vtable.rs:36:1 + --> $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))) }; @@ -36,7 +23,7 @@ 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:41:1 + --> $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))) }; 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 ceed6f8268d..2ad164a8c35 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 @@ -1,30 +1,17 @@ -error: any use of this value will cause an error +error[E0080]: evaluation of constant value failed --> $DIR/ub-incorrect-vtable.rs:19:14 | -LL | / const INVALID_VTABLE_ALIGNMENT: &dyn Trait = -LL | | unsafe { std::mem::transmute((&92u8, &[0usize, 1usize, 1000usize])) }; - | |______________^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^__- - | | - | invalid vtable: alignment `1000` is not a power of 2 - | - = 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! - = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> +LL | unsafe { std::mem::transmute((&92u8, &[0usize, 1usize, 1000usize])) }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ invalid vtable: alignment `1000` is not a power of 2 -error: any use of this value will cause an error - --> $DIR/ub-incorrect-vtable.rs:25:14 - | -LL | / const INVALID_VTABLE_SIZE: &dyn Trait = -LL | | unsafe { std::mem::transmute((&92u8, &[1usize, usize::MAX, 1usize])) }; - | |______________^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^__- - | | - | invalid vtable: size is bigger than largest supported object +error[E0080]: evaluation of constant value failed + --> $DIR/ub-incorrect-vtable.rs:24:14 | - = 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> +LL | unsafe { std::mem::transmute((&92u8, &[1usize, usize::MAX, 1usize])) }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ invalid vtable: size is bigger than largest supported object error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-incorrect-vtable.rs:36:1 + --> $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))) }; @@ -36,7 +23,7 @@ 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:41:1 + --> $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))) }; diff --git a/src/test/ui/consts/const-eval/ub-incorrect-vtable.rs b/src/test/ui/consts/const-eval/ub-incorrect-vtable.rs index 7c514e804e0..4ec853576c9 100644 --- a/src/test/ui/consts/const-eval/ub-incorrect-vtable.rs +++ b/src/test/ui/consts/const-eval/ub-incorrect-vtable.rs @@ -17,14 +17,12 @@ trait Trait {} const INVALID_VTABLE_ALIGNMENT: &dyn Trait = unsafe { std::mem::transmute((&92u8, &[0usize, 1usize, 1000usize])) }; -//~^ ERROR any use of this value will cause an error -//~| WARNING this was previously accepted by the compiler +//~^ ERROR evaluation of constant value failed //~| invalid vtable: alignment `1000` is not a power of 2 const INVALID_VTABLE_SIZE: &dyn Trait = unsafe { std::mem::transmute((&92u8, &[1usize, usize::MAX, 1usize])) }; -//~^ ERROR any use of this value will cause an error -//~| WARNING this was previously accepted by the compiler +//~^ ERROR evaluation of constant value failed //~| invalid vtable: size is bigger than largest supported object #[repr(transparent)] 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 b68b9d6a180..9d3b88e803e 100644 --- a/src/test/ui/consts/const-eval/ub-nonnull.32bit.stderr +++ b/src/test/ui/consts/const-eval/ub-nonnull.32bit.stderr @@ -9,29 +9,14 @@ LL | const NULL_PTR: NonNull<u8> = unsafe { mem::transmute(0usize) }; 00 00 00 00 │ .... } -error: any use of this value will cause an error +error[E0080]: evaluation of constant value failed --> $DIR/ub-nonnull.rs:19:30 | -LL | / const OUT_OF_BOUNDS_PTR: NonNull<u8> = { unsafe { -LL | | let ptr: &[u8; 256] = mem::transmute(&0u8); // &0 gets promoted so it does not dangle -LL | | // Use address-of-element for pointer arithmetic. This could wrap around to null! -LL | | let out_of_bounds_ptr = &ptr[255]; - | | ^^^^^^^^ memory access failed: pointer must be in-bounds at offset 256, but is outside bounds of alloc10 which has size 1 -LL | | -LL | | mem::transmute(out_of_bounds_ptr) -LL | | } }; - | |____- - | -note: the lint level is defined here - --> $DIR/ub-nonnull.rs:15:8 - | -LL | #[deny(const_err)] // this triggers a `const_err` so validation does not even happen - | ^^^^^^^^^ - = 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> +LL | let out_of_bounds_ptr = &ptr[255]; + | ^^^^^^^^ memory access failed: pointer must be in-bounds at offset 256, but is outside bounds of alloc10 which has size 1 error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-nonnull.rs:24:1 + --> $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 @@ -42,7 +27,7 @@ LL | const NULL_U8: NonZeroU8 = unsafe { mem::transmute(0u8) }; } error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-nonnull.rs:26:1 + --> $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 @@ -53,7 +38,7 @@ LL | const NULL_USIZE: NonZeroUsize = unsafe { mem::transmute(0usize) }; } error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-nonnull.rs:34:1 + --> $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 plain (non-pointer) bytes @@ -64,7 +49,7 @@ LL | const UNINIT: NonZeroU8 = unsafe { MaybeUninit { uninit: () }.init }; } error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-nonnull.rs:42:1 + --> $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 @@ -75,7 +60,7 @@ LL | const BAD_RANGE1: RestrictedRange1 = unsafe { RestrictedRange1(42) }; } error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-nonnull.rs:48:1 + --> $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 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 687d96a1831..bc230374ebf 100644 --- a/src/test/ui/consts/const-eval/ub-nonnull.64bit.stderr +++ b/src/test/ui/consts/const-eval/ub-nonnull.64bit.stderr @@ -9,29 +9,14 @@ LL | const NULL_PTR: NonNull<u8> = unsafe { mem::transmute(0usize) }; 00 00 00 00 00 00 00 00 │ ........ } -error: any use of this value will cause an error +error[E0080]: evaluation of constant value failed --> $DIR/ub-nonnull.rs:19:30 | -LL | / const OUT_OF_BOUNDS_PTR: NonNull<u8> = { unsafe { -LL | | let ptr: &[u8; 256] = mem::transmute(&0u8); // &0 gets promoted so it does not dangle -LL | | // Use address-of-element for pointer arithmetic. This could wrap around to null! -LL | | let out_of_bounds_ptr = &ptr[255]; - | | ^^^^^^^^ memory access failed: pointer must be in-bounds at offset 256, but is outside bounds of alloc10 which has size 1 -LL | | -LL | | mem::transmute(out_of_bounds_ptr) -LL | | } }; - | |____- - | -note: the lint level is defined here - --> $DIR/ub-nonnull.rs:15:8 - | -LL | #[deny(const_err)] // this triggers a `const_err` so validation does not even happen - | ^^^^^^^^^ - = 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> +LL | let out_of_bounds_ptr = &ptr[255]; + | ^^^^^^^^ memory access failed: pointer must be in-bounds at offset 256, but is outside bounds of alloc10 which has size 1 error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-nonnull.rs:24:1 + --> $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 @@ -42,7 +27,7 @@ LL | const NULL_U8: NonZeroU8 = unsafe { mem::transmute(0u8) }; } error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-nonnull.rs:26:1 + --> $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 @@ -53,7 +38,7 @@ LL | const NULL_USIZE: NonZeroUsize = unsafe { mem::transmute(0usize) }; } error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-nonnull.rs:34:1 + --> $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 plain (non-pointer) bytes @@ -64,7 +49,7 @@ LL | const UNINIT: NonZeroU8 = unsafe { MaybeUninit { uninit: () }.init }; } error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-nonnull.rs:42:1 + --> $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 @@ -75,7 +60,7 @@ LL | const BAD_RANGE1: RestrictedRange1 = unsafe { RestrictedRange1(42) }; } error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-nonnull.rs:48:1 + --> $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 diff --git a/src/test/ui/consts/const-eval/ub-nonnull.rs b/src/test/ui/consts/const-eval/ub-nonnull.rs index 75c02a8da19..259707b8028 100644 --- a/src/test/ui/consts/const-eval/ub-nonnull.rs +++ b/src/test/ui/consts/const-eval/ub-nonnull.rs @@ -16,8 +16,7 @@ const NULL_PTR: NonNull<u8> = unsafe { mem::transmute(0usize) }; const OUT_OF_BOUNDS_PTR: NonNull<u8> = { unsafe { let ptr: &[u8; 256] = mem::transmute(&0u8); // &0 gets promoted so it does not dangle // Use address-of-element for pointer arithmetic. This could wrap around to null! - let out_of_bounds_ptr = &ptr[255]; //~ ERROR any use of this value will cause an error - //~| WARN this was previously accepted by the compiler but is being phased out + let out_of_bounds_ptr = &ptr[255]; //~ ERROR evaluation of constant value failed mem::transmute(out_of_bounds_ptr) } }; diff --git a/src/test/ui/consts/const-eval/unwind-abort.rs b/src/test/ui/consts/const-eval/unwind-abort.rs index 9bc63d9328c..766a0c49be6 100644 --- a/src/test/ui/consts/const-eval/unwind-abort.rs +++ b/src/test/ui/consts/const-eval/unwind-abort.rs @@ -2,7 +2,7 @@ #[unwind(aborts)] const fn foo() { - panic!() //~ ERROR any use of this value will cause an error + panic!() //~ ERROR evaluation of constant value failed } const _: () = foo(); diff --git a/src/test/ui/consts/const-eval/unwind-abort.stderr b/src/test/ui/consts/const-eval/unwind-abort.stderr index b41d786169b..e3b871ee529 100644 --- a/src/test/ui/consts/const-eval/unwind-abort.stderr +++ b/src/test/ui/consts/const-eval/unwind-abort.stderr @@ -1,4 +1,4 @@ -error[E0080]: any use of this value will cause an error +error[E0080]: evaluation of constant value failed --> $DIR/unwind-abort.rs:5:5 | LL | panic!() @@ -6,10 +6,9 @@ LL | panic!() | | | the evaluated program panicked at 'explicit panic', $DIR/unwind-abort.rs:5:5 | inside `foo` at $SRC_DIR/std/src/panic.rs:LL:COL - | inside `_` at $DIR/unwind-abort.rs:8:15 ... LL | const _: () = foo(); - | -------------------- + | ----- inside `_` at $DIR/unwind-abort.rs:8:15 | = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) 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 ae9b9bfd281..0022d19e953 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 @@ -1,4 +1,4 @@ -warning: any use of this value will cause an error +error[E0080]: evaluation of constant value failed --> $DIR/validate_uninhabited_zsts.rs:5:14 | LL | unsafe { std::mem::transmute(()) } @@ -6,21 +6,12 @@ LL | unsafe { std::mem::transmute(()) } | | | transmuting to uninhabited type | inside `foo` at $DIR/validate_uninhabited_zsts.rs:5:14 - | inside `FOO` at $DIR/validate_uninhabited_zsts.rs:15:26 ... LL | const FOO: [Empty; 3] = [foo(); 3]; - | ----------------------------------- - | -note: the lint level is defined here - --> $DIR/validate_uninhabited_zsts.rs:14:8 - | -LL | #[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! - = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> + | ----- inside `FOO` at $DIR/validate_uninhabited_zsts.rs:14:26 error[E0080]: it is undefined behavior to use this value - --> $DIR/validate_uninhabited_zsts.rs:18:1 + --> $DIR/validate_uninhabited_zsts.rs:17:1 | LL | const BAR: [Empty; 3] = [unsafe { std::mem::transmute(()) }; 3]; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed at [0]: encountered a value of uninhabited type Empty @@ -41,7 +32,7 @@ LL | unsafe { std::mem::transmute(()) } = note: the `!` type has no valid value warning: the type `Empty` does not permit zero-initialization - --> $DIR/validate_uninhabited_zsts.rs:18:35 + --> $DIR/validate_uninhabited_zsts.rs:17:35 | LL | const BAR: [Empty; 3] = [unsafe { std::mem::transmute(()) }; 3]; | ^^^^^^^^^^^^^^^^^^^^^^^ @@ -51,6 +42,6 @@ LL | const BAR: [Empty; 3] = [unsafe { std::mem::transmute(()) }; 3]; | = note: enums with no variants have no valid value -error: aborting due to previous error; 3 warnings emitted +error: aborting due to 2 previous errors; 2 warnings emitted For more information about this error, try `rustc --explain E0080`. 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 ae9b9bfd281..0022d19e953 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 @@ -1,4 +1,4 @@ -warning: any use of this value will cause an error +error[E0080]: evaluation of constant value failed --> $DIR/validate_uninhabited_zsts.rs:5:14 | LL | unsafe { std::mem::transmute(()) } @@ -6,21 +6,12 @@ LL | unsafe { std::mem::transmute(()) } | | | transmuting to uninhabited type | inside `foo` at $DIR/validate_uninhabited_zsts.rs:5:14 - | inside `FOO` at $DIR/validate_uninhabited_zsts.rs:15:26 ... LL | const FOO: [Empty; 3] = [foo(); 3]; - | ----------------------------------- - | -note: the lint level is defined here - --> $DIR/validate_uninhabited_zsts.rs:14:8 - | -LL | #[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! - = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> + | ----- inside `FOO` at $DIR/validate_uninhabited_zsts.rs:14:26 error[E0080]: it is undefined behavior to use this value - --> $DIR/validate_uninhabited_zsts.rs:18:1 + --> $DIR/validate_uninhabited_zsts.rs:17:1 | LL | const BAR: [Empty; 3] = [unsafe { std::mem::transmute(()) }; 3]; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed at [0]: encountered a value of uninhabited type Empty @@ -41,7 +32,7 @@ LL | unsafe { std::mem::transmute(()) } = note: the `!` type has no valid value warning: the type `Empty` does not permit zero-initialization - --> $DIR/validate_uninhabited_zsts.rs:18:35 + --> $DIR/validate_uninhabited_zsts.rs:17:35 | LL | const BAR: [Empty; 3] = [unsafe { std::mem::transmute(()) }; 3]; | ^^^^^^^^^^^^^^^^^^^^^^^ @@ -51,6 +42,6 @@ LL | const BAR: [Empty; 3] = [unsafe { std::mem::transmute(()) }; 3]; | = note: enums with no variants have no valid value -error: aborting due to previous error; 3 warnings emitted +error: aborting due to 2 previous errors; 2 warnings emitted For more information about this error, try `rustc --explain E0080`. diff --git a/src/test/ui/consts/const-eval/validate_uninhabited_zsts.rs b/src/test/ui/consts/const-eval/validate_uninhabited_zsts.rs index 112ace5e97f..f6b6a1f53eb 100644 --- a/src/test/ui/consts/const-eval/validate_uninhabited_zsts.rs +++ b/src/test/ui/consts/const-eval/validate_uninhabited_zsts.rs @@ -3,9 +3,8 @@ const fn foo() -> ! { unsafe { std::mem::transmute(()) } - //~^ WARN any use of this value will cause an error [const_err] + //~^ ERROR evaluation of constant value failed //~| WARN the type `!` does not permit zero-initialization [invalid_value] - //~| WARN this was previously accepted by the compiler but is being phased out } #[derive(Clone, Copy)] diff --git a/src/test/ui/consts/const-int-unchecked.rs b/src/test/ui/consts/const-int-unchecked.rs index 2ccc5d27bbb..902a668488b 100644 --- a/src/test/ui/consts/const-int-unchecked.rs +++ b/src/test/ui/consts/const-int-unchecked.rs @@ -13,186 +13,137 @@ use std::intrinsics; // unsigned types: const SHL_U8: u8 = unsafe { intrinsics::unchecked_shl(5_u8, 8) }; -//~^ ERROR any use of this value will cause an error -//~| WARN this was previously accepted by the compiler but is being phased out +//~^ ERROR evaluation of constant value failed const SHL_U16: u16 = unsafe { intrinsics::unchecked_shl(5_u16, 16) }; -//~^ ERROR any use of this value will cause an error -//~| WARN this was previously accepted by the compiler but is being phased out +//~^ ERROR evaluation of constant value failed const SHL_U32: u32 = unsafe { intrinsics::unchecked_shl(5_u32, 32) }; -//~^ ERROR any use of this value will cause an error -//~| WARN this was previously accepted by the compiler but is being phased out +//~^ ERROR evaluation of constant value failed const SHL_U64: u64 = unsafe { intrinsics::unchecked_shl(5_u64, 64) }; -//~^ ERROR any use of this value will cause an error -//~| WARN this was previously accepted by the compiler but is being phased out +//~^ ERROR evaluation of constant value failed const SHL_U128: u128 = unsafe { intrinsics::unchecked_shl(5_u128, 128) }; -//~^ ERROR any use of this value will cause an error -//~| WARN this was previously accepted by the compiler but is being phased out +//~^ ERROR evaluation of constant value failed // signed types: const SHL_I8: i8 = unsafe { intrinsics::unchecked_shl(5_i8, 8) }; -//~^ ERROR any use of this value will cause an error -//~| WARN this was previously accepted by the compiler but is being phased out +//~^ ERROR evaluation of constant value failed const SHL_I16: i16 = unsafe { intrinsics::unchecked_shl(5_16, 16) }; -//~^ ERROR any use of this value will cause an error -//~| WARN this was previously accepted by the compiler but is being phased out +//~^ ERROR evaluation of constant value failed const SHL_I32: i32 = unsafe { intrinsics::unchecked_shl(5_i32, 32) }; -//~^ ERROR any use of this value will cause an error -//~| WARN this was previously accepted by the compiler but is being phased out +//~^ ERROR evaluation of constant value failed const SHL_I64: i64 = unsafe { intrinsics::unchecked_shl(5_i64, 64) }; -//~^ ERROR any use of this value will cause an error -//~| WARN this was previously accepted by the compiler but is being phased out +//~^ ERROR evaluation of constant value failed const SHL_I128: i128 = unsafe { intrinsics::unchecked_shl(5_i128, 128) }; -//~^ ERROR any use of this value will cause an error -//~| WARN this was previously accepted by the compiler but is being phased out +//~^ ERROR evaluation of constant value failed // and make sure we capture y < 0: const SHL_I8_NEG: i8 = unsafe { intrinsics::unchecked_shl(5_i8, -1) }; -//~^ ERROR any use of this value will cause an error -//~| WARN this was previously accepted by the compiler but is being phased out +//~^ ERROR evaluation of constant value failed const SHL_I16_NEG: i16 = unsafe { intrinsics::unchecked_shl(5_16, -1) }; -//~^ ERROR any use of this value will cause an error -//~| WARN this was previously accepted by the compiler but is being phased out +//~^ ERROR evaluation of constant value failed const SHL_I32_NEG: i32 = unsafe { intrinsics::unchecked_shl(5_i32, -1) }; -//~^ ERROR any use of this value will cause an error -//~| WARN this was previously accepted by the compiler but is being phased out +//~^ ERROR evaluation of constant value failed const SHL_I64_NEG: i64 = unsafe { intrinsics::unchecked_shl(5_i64, -1) }; -//~^ ERROR any use of this value will cause an error -//~| WARN this was previously accepted by the compiler but is being phased out +//~^ ERROR evaluation of constant value failed const SHL_I128_NEG: i128 = unsafe { intrinsics::unchecked_shl(5_i128, -1) }; -//~^ ERROR any use of this value will cause an error -//~| WARN this was previously accepted by the compiler but is being phased out +//~^ ERROR evaluation of constant value failed // and that there's no special relation to the value -1 by picking some // negative values at random: const SHL_I8_NEG_RANDOM: i8 = unsafe { intrinsics::unchecked_shl(5_i8, -6) }; -//~^ ERROR any use of this value will cause an error -//~| WARN this was previously accepted by the compiler but is being phased out +//~^ ERROR evaluation of constant value failed const SHL_I16_NEG_RANDOM: i16 = unsafe { intrinsics::unchecked_shl(5_16, -13) }; -//~^ ERROR any use of this value will cause an error -//~| WARN this was previously accepted by the compiler but is being phased out +//~^ ERROR evaluation of constant value failed const SHL_I32_NEG_RANDOM: i32 = unsafe { intrinsics::unchecked_shl(5_i32, -25) }; -//~^ ERROR any use of this value will cause an error -//~| WARN this was previously accepted by the compiler but is being phased out +//~^ ERROR evaluation of constant value failed const SHL_I64_NEG_RANDOM: i64 = unsafe { intrinsics::unchecked_shl(5_i64, -30) }; -//~^ ERROR any use of this value will cause an error -//~| WARN this was previously accepted by the compiler but is being phased out +//~^ ERROR evaluation of constant value failed const SHL_I128_NEG_RANDOM: i128 = unsafe { intrinsics::unchecked_shl(5_i128, -93) }; -//~^ ERROR any use of this value will cause an error -//~| WARN this was previously accepted by the compiler but is being phased out +//~^ ERROR evaluation of constant value failed // Repeat it all over for `unchecked_shr` // unsigned types: const SHR_U8: u8 = unsafe { intrinsics::unchecked_shr(5_u8, 8) }; -//~^ ERROR any use of this value will cause an error -//~| WARN this was previously accepted by the compiler but is being phased out +//~^ ERROR evaluation of constant value failed const SHR_U16: u16 = unsafe { intrinsics::unchecked_shr(5_u16, 16) }; -//~^ ERROR any use of this value will cause an error -//~| WARN this was previously accepted by the compiler but is being phased out +//~^ ERROR evaluation of constant value failed const SHR_U32: u32 = unsafe { intrinsics::unchecked_shr(5_u32, 32) }; -//~^ ERROR any use of this value will cause an error -//~| WARN this was previously accepted by the compiler but is being phased out +//~^ ERROR evaluation of constant value failed const SHR_U64: u64 = unsafe { intrinsics::unchecked_shr(5_u64, 64) }; -//~^ ERROR any use of this value will cause an error -//~| WARN this was previously accepted by the compiler but is being phased out +//~^ ERROR evaluation of constant value failed const SHR_U128: u128 = unsafe { intrinsics::unchecked_shr(5_u128, 128) }; -//~^ ERROR any use of this value will cause an error -//~| WARN this was previously accepted by the compiler but is being phased out +//~^ ERROR evaluation of constant value failed // signed types: const SHR_I8: i8 = unsafe { intrinsics::unchecked_shr(5_i8, 8) }; -//~^ ERROR any use of this value will cause an error -//~| WARN this was previously accepted by the compiler but is being phased out +//~^ ERROR evaluation of constant value failed const SHR_I16: i16 = unsafe { intrinsics::unchecked_shr(5_16, 16) }; -//~^ ERROR any use of this value will cause an error -//~| WARN this was previously accepted by the compiler but is being phased out +//~^ ERROR evaluation of constant value failed const SHR_I32: i32 = unsafe { intrinsics::unchecked_shr(5_i32, 32) }; -//~^ ERROR any use of this value will cause an error -//~| WARN this was previously accepted by the compiler but is being phased out +//~^ ERROR evaluation of constant value failed const SHR_I64: i64 = unsafe { intrinsics::unchecked_shr(5_i64, 64) }; -//~^ ERROR any use of this value will cause an error -//~| WARN this was previously accepted by the compiler but is being phased out +//~^ ERROR evaluation of constant value failed const SHR_I128: i128 = unsafe { intrinsics::unchecked_shr(5_i128, 128) }; -//~^ ERROR any use of this value will cause an error -//~| WARN this was previously accepted by the compiler but is being phased out +//~^ ERROR evaluation of constant value failed // and make sure we capture y < 0: const SHR_I8_NEG: i8 = unsafe { intrinsics::unchecked_shr(5_i8, -1) }; -//~^ ERROR any use of this value will cause an error -//~| WARN this was previously accepted by the compiler but is being phased out +//~^ ERROR evaluation of constant value failed const SHR_I16_NEG: i16 = unsafe { intrinsics::unchecked_shr(5_16, -1) }; -//~^ ERROR any use of this value will cause an error -//~| WARN this was previously accepted by the compiler but is being phased out +//~^ ERROR evaluation of constant value failed const SHR_I32_NEG: i32 = unsafe { intrinsics::unchecked_shr(5_i32, -1) }; -//~^ ERROR any use of this value will cause an error -//~| WARN this was previously accepted by the compiler but is being phased out +//~^ ERROR evaluation of constant value failed const SHR_I64_NEG: i64 = unsafe { intrinsics::unchecked_shr(5_i64, -1) }; -//~^ ERROR any use of this value will cause an error -//~| WARN this was previously accepted by the compiler but is being phased out +//~^ ERROR evaluation of constant value failed const SHR_I128_NEG: i128 = unsafe { intrinsics::unchecked_shr(5_i128, -1) }; -//~^ ERROR any use of this value will cause an error -//~| WARN this was previously accepted by the compiler but is being phased out +//~^ ERROR evaluation of constant value failed // and that there's no special relation to the value -1 by picking some // negative values at random: const SHR_I8_NEG_RANDOM: i8 = unsafe { intrinsics::unchecked_shr(5_i8, -6) }; -//~^ ERROR any use of this value will cause an error -//~| WARN this was previously accepted by the compiler but is being phased out +//~^ ERROR evaluation of constant value failed const SHR_I16_NEG_RANDOM: i16 = unsafe { intrinsics::unchecked_shr(5_16, -13) }; -//~^ ERROR any use of this value will cause an error -//~| WARN this was previously accepted by the compiler but is being phased out +//~^ ERROR evaluation of constant value failed const SHR_I32_NEG_RANDOM: i32 = unsafe { intrinsics::unchecked_shr(5_i32, -25) }; -//~^ ERROR any use of this value will cause an error -//~| WARN this was previously accepted by the compiler but is being phased out +//~^ ERROR evaluation of constant value failed const SHR_I64_NEG_RANDOM: i64 = unsafe { intrinsics::unchecked_shr(5_i64, -30) }; -//~^ ERROR any use of this value will cause an error -//~| WARN this was previously accepted by the compiler but is being phased out +//~^ ERROR evaluation of constant value failed const SHR_I128_NEG_RANDOM: i128 = unsafe { intrinsics::unchecked_shr(5_i128, -93) }; -//~^ ERROR any use of this value will cause an error -//~| WARN this was previously accepted by the compiler but is being phased out +//~^ ERROR evaluation of constant value failed // Other arithmetic functions: const _: u16 = unsafe { std::intrinsics::unchecked_add(40000u16, 30000) }; -//~^ ERROR any use of this value will cause an error -//~| WARN this was previously accepted by the compiler but is being phased out +//~^ ERROR evaluation of constant value failed const _: u32 = unsafe { std::intrinsics::unchecked_sub(14u32, 22) }; -//~^ ERROR any use of this value will cause an error -//~| WARN this was previously accepted by the compiler but is being phased out +//~^ ERROR evaluation of constant value failed const _: u16 = unsafe { std::intrinsics::unchecked_mul(300u16, 250u16) }; -//~^ ERROR any use of this value will cause an error -//~| WARN this was previously accepted by the compiler but is being phased out +//~^ ERROR evaluation of constant value failed const _: i32 = unsafe { std::intrinsics::unchecked_div(1, 0) }; -//~^ ERROR any use of this value will cause an error -//~| WARN this was previously accepted by the compiler but is being phased out +//~^ ERROR evaluation of constant value failed const _: i32 = unsafe { std::intrinsics::unchecked_div(i32::MIN, -1) }; -//~^ ERROR any use of this value will cause an error -//~| WARN this was previously accepted by the compiler but is being phased out +//~^ ERROR evaluation of constant value failed const _: i32 = unsafe { std::intrinsics::unchecked_rem(1, 0) }; -//~^ ERROR any use of this value will cause an error -//~| WARN this was previously accepted by the compiler but is being phased out +//~^ ERROR evaluation of constant value failed const _: i32 = unsafe { std::intrinsics::unchecked_rem(i32::MIN, -1) }; -//~^ ERROR any use of this value will cause an error -//~| WARN this was previously accepted by the compiler but is being phased out +//~^ ERROR evaluation of constant value failed // capture fault with zero value const _: u32 = unsafe { std::intrinsics::ctlz_nonzero(0) }; -//~^ ERROR any use of this value will cause an error -//~| WARN this was previously accepted by the compiler but is being phased out +//~^ ERROR evaluation of constant value failed const _: u32 = unsafe { std::intrinsics::cttz_nonzero(0) }; -//~^ ERROR any use of this value will cause an error -//~| WARN this was previously accepted by the compiler but is being phased out +//~^ ERROR evaluation of constant value failed fn main() {} diff --git a/src/test/ui/consts/const-int-unchecked.stderr b/src/test/ui/consts/const-int-unchecked.stderr index 999b26543e2..22e8c8dabc9 100644 --- a/src/test/ui/consts/const-int-unchecked.stderr +++ b/src/test/ui/consts/const-int-unchecked.stderr @@ -1,542 +1,297 @@ -error: any use of this value will cause an error +error[E0080]: evaluation of constant value failed --> $DIR/const-int-unchecked.rs:15:29 | LL | const SHL_U8: u8 = unsafe { intrinsics::unchecked_shl(5_u8, 8) }; - | ----------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--- - | | - | overflowing shift by 8 in `unchecked_shl` - | - = 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! - = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflowing shift by 8 in `unchecked_shl` -error: any use of this value will cause an error - --> $DIR/const-int-unchecked.rs:18:31 +error[E0080]: evaluation of constant value failed + --> $DIR/const-int-unchecked.rs:17:31 | LL | const SHL_U16: u16 = unsafe { intrinsics::unchecked_shl(5_u16, 16) }; - | ------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--- - | | - | overflowing shift by 16 in `unchecked_shl` - | - = 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> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflowing shift by 16 in `unchecked_shl` -error: any use of this value will cause an error - --> $DIR/const-int-unchecked.rs:21:31 +error[E0080]: evaluation of constant value failed + --> $DIR/const-int-unchecked.rs:19:31 | LL | const SHL_U32: u32 = unsafe { intrinsics::unchecked_shl(5_u32, 32) }; - | ------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--- - | | - | overflowing shift by 32 in `unchecked_shl` - | - = 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> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflowing shift by 32 in `unchecked_shl` -error: any use of this value will cause an error - --> $DIR/const-int-unchecked.rs:24:31 +error[E0080]: evaluation of constant value failed + --> $DIR/const-int-unchecked.rs:21:31 | LL | const SHL_U64: u64 = unsafe { intrinsics::unchecked_shl(5_u64, 64) }; - | ------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--- - | | - | overflowing shift by 64 in `unchecked_shl` - | - = 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> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflowing shift by 64 in `unchecked_shl` -error: any use of this value will cause an error - --> $DIR/const-int-unchecked.rs:27:33 +error[E0080]: evaluation of constant value failed + --> $DIR/const-int-unchecked.rs:23:33 | LL | const SHL_U128: u128 = unsafe { intrinsics::unchecked_shl(5_u128, 128) }; - | --------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--- - | | - | overflowing shift by 128 in `unchecked_shl` - | - = 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> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflowing shift by 128 in `unchecked_shl` -error: any use of this value will cause an error - --> $DIR/const-int-unchecked.rs:33:29 +error[E0080]: evaluation of constant value failed + --> $DIR/const-int-unchecked.rs:28:29 | LL | const SHL_I8: i8 = unsafe { intrinsics::unchecked_shl(5_i8, 8) }; - | ----------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--- - | | - | overflowing shift by 8 in `unchecked_shl` - | - = 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> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflowing shift by 8 in `unchecked_shl` -error: any use of this value will cause an error - --> $DIR/const-int-unchecked.rs:36:31 +error[E0080]: evaluation of constant value failed + --> $DIR/const-int-unchecked.rs:30:31 | LL | const SHL_I16: i16 = unsafe { intrinsics::unchecked_shl(5_16, 16) }; - | ------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--- - | | - | overflowing shift by 16 in `unchecked_shl` - | - = 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> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflowing shift by 16 in `unchecked_shl` -error: any use of this value will cause an error - --> $DIR/const-int-unchecked.rs:39:31 +error[E0080]: evaluation of constant value failed + --> $DIR/const-int-unchecked.rs:32:31 | LL | const SHL_I32: i32 = unsafe { intrinsics::unchecked_shl(5_i32, 32) }; - | ------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--- - | | - | overflowing shift by 32 in `unchecked_shl` - | - = 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> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflowing shift by 32 in `unchecked_shl` -error: any use of this value will cause an error - --> $DIR/const-int-unchecked.rs:42:31 +error[E0080]: evaluation of constant value failed + --> $DIR/const-int-unchecked.rs:34:31 | LL | const SHL_I64: i64 = unsafe { intrinsics::unchecked_shl(5_i64, 64) }; - | ------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--- - | | - | overflowing shift by 64 in `unchecked_shl` - | - = 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> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflowing shift by 64 in `unchecked_shl` -error: any use of this value will cause an error - --> $DIR/const-int-unchecked.rs:45:33 +error[E0080]: evaluation of constant value failed + --> $DIR/const-int-unchecked.rs:36:33 | LL | const SHL_I128: i128 = unsafe { intrinsics::unchecked_shl(5_i128, 128) }; - | --------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--- - | | - | overflowing shift by 128 in `unchecked_shl` - | - = 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> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflowing shift by 128 in `unchecked_shl` -error: any use of this value will cause an error - --> $DIR/const-int-unchecked.rs:51:33 +error[E0080]: evaluation of constant value failed + --> $DIR/const-int-unchecked.rs:41:33 | LL | const SHL_I8_NEG: i8 = unsafe { intrinsics::unchecked_shl(5_i8, -1) }; - | --------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--- - | | - | overflowing shift by 255 in `unchecked_shl` - | - = 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> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflowing shift by 255 in `unchecked_shl` -error: any use of this value will cause an error - --> $DIR/const-int-unchecked.rs:54:35 +error[E0080]: evaluation of constant value failed + --> $DIR/const-int-unchecked.rs:43:35 | LL | const SHL_I16_NEG: i16 = unsafe { intrinsics::unchecked_shl(5_16, -1) }; - | ----------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--- - | | - | overflowing shift by 65535 in `unchecked_shl` - | - = 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> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflowing shift by 65535 in `unchecked_shl` -error: any use of this value will cause an error - --> $DIR/const-int-unchecked.rs:57:35 +error[E0080]: evaluation of constant value failed + --> $DIR/const-int-unchecked.rs:45:35 | LL | const SHL_I32_NEG: i32 = unsafe { intrinsics::unchecked_shl(5_i32, -1) }; - | ----------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--- - | | - | overflowing shift by 4294967295 in `unchecked_shl` - | - = 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> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflowing shift by 4294967295 in `unchecked_shl` -error: any use of this value will cause an error - --> $DIR/const-int-unchecked.rs:60:35 +error[E0080]: evaluation of constant value failed + --> $DIR/const-int-unchecked.rs:47:35 | LL | const SHL_I64_NEG: i64 = unsafe { intrinsics::unchecked_shl(5_i64, -1) }; - | ----------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--- - | | - | overflowing shift by 18446744073709551615 in `unchecked_shl` - | - = 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> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflowing shift by 18446744073709551615 in `unchecked_shl` -error: any use of this value will cause an error - --> $DIR/const-int-unchecked.rs:63:37 +error[E0080]: evaluation of constant value failed + --> $DIR/const-int-unchecked.rs:49:37 | LL | const SHL_I128_NEG: i128 = unsafe { intrinsics::unchecked_shl(5_i128, -1) }; - | ------------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--- - | | - | overflowing shift by 340282366920938463463374607431768211455 in `unchecked_shl` - | - = 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> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflowing shift by 340282366920938463463374607431768211455 in `unchecked_shl` -error: any use of this value will cause an error - --> $DIR/const-int-unchecked.rs:70:40 +error[E0080]: evaluation of constant value failed + --> $DIR/const-int-unchecked.rs:55:40 | LL | const SHL_I8_NEG_RANDOM: i8 = unsafe { intrinsics::unchecked_shl(5_i8, -6) }; - | ---------------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--- - | | - | overflowing shift by 250 in `unchecked_shl` - | - = 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> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflowing shift by 250 in `unchecked_shl` -error: any use of this value will cause an error - --> $DIR/const-int-unchecked.rs:73:42 +error[E0080]: evaluation of constant value failed + --> $DIR/const-int-unchecked.rs:57:42 | LL | const SHL_I16_NEG_RANDOM: i16 = unsafe { intrinsics::unchecked_shl(5_16, -13) }; - | -----------------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--- - | | - | overflowing shift by 65523 in `unchecked_shl` - | - = 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> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflowing shift by 65523 in `unchecked_shl` -error: any use of this value will cause an error - --> $DIR/const-int-unchecked.rs:76:42 +error[E0080]: evaluation of constant value failed + --> $DIR/const-int-unchecked.rs:59:42 | LL | const SHL_I32_NEG_RANDOM: i32 = unsafe { intrinsics::unchecked_shl(5_i32, -25) }; - | -----------------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--- - | | - | overflowing shift by 4294967271 in `unchecked_shl` - | - = 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> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflowing shift by 4294967271 in `unchecked_shl` -error: any use of this value will cause an error - --> $DIR/const-int-unchecked.rs:79:42 +error[E0080]: evaluation of constant value failed + --> $DIR/const-int-unchecked.rs:61:42 | LL | const SHL_I64_NEG_RANDOM: i64 = unsafe { intrinsics::unchecked_shl(5_i64, -30) }; - | -----------------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--- - | | - | overflowing shift by 18446744073709551586 in `unchecked_shl` - | - = 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> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflowing shift by 18446744073709551586 in `unchecked_shl` -error: any use of this value will cause an error - --> $DIR/const-int-unchecked.rs:82:44 +error[E0080]: evaluation of constant value failed + --> $DIR/const-int-unchecked.rs:63:44 | LL | const SHL_I128_NEG_RANDOM: i128 = unsafe { intrinsics::unchecked_shl(5_i128, -93) }; - | -------------------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--- - | | - | overflowing shift by 340282366920938463463374607431768211363 in `unchecked_shl` - | - = 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> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflowing shift by 340282366920938463463374607431768211363 in `unchecked_shl` -error: any use of this value will cause an error - --> $DIR/const-int-unchecked.rs:90:29 +error[E0080]: evaluation of constant value failed + --> $DIR/const-int-unchecked.rs:70:29 | LL | const SHR_U8: u8 = unsafe { intrinsics::unchecked_shr(5_u8, 8) }; - | ----------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--- - | | - | overflowing shift by 8 in `unchecked_shr` - | - = 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> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflowing shift by 8 in `unchecked_shr` -error: any use of this value will cause an error - --> $DIR/const-int-unchecked.rs:93:31 +error[E0080]: evaluation of constant value failed + --> $DIR/const-int-unchecked.rs:72:31 | LL | const SHR_U16: u16 = unsafe { intrinsics::unchecked_shr(5_u16, 16) }; - | ------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--- - | | - | overflowing shift by 16 in `unchecked_shr` - | - = 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> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflowing shift by 16 in `unchecked_shr` -error: any use of this value will cause an error - --> $DIR/const-int-unchecked.rs:96:31 +error[E0080]: evaluation of constant value failed + --> $DIR/const-int-unchecked.rs:74:31 | LL | const SHR_U32: u32 = unsafe { intrinsics::unchecked_shr(5_u32, 32) }; - | ------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--- - | | - | overflowing shift by 32 in `unchecked_shr` - | - = 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> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflowing shift by 32 in `unchecked_shr` -error: any use of this value will cause an error - --> $DIR/const-int-unchecked.rs:99:31 +error[E0080]: evaluation of constant value failed + --> $DIR/const-int-unchecked.rs:76:31 | LL | const SHR_U64: u64 = unsafe { intrinsics::unchecked_shr(5_u64, 64) }; - | ------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--- - | | - | overflowing shift by 64 in `unchecked_shr` - | - = 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> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflowing shift by 64 in `unchecked_shr` -error: any use of this value will cause an error - --> $DIR/const-int-unchecked.rs:102:33 +error[E0080]: evaluation of constant value failed + --> $DIR/const-int-unchecked.rs:78:33 | LL | const SHR_U128: u128 = unsafe { intrinsics::unchecked_shr(5_u128, 128) }; - | --------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--- - | | - | overflowing shift by 128 in `unchecked_shr` - | - = 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> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflowing shift by 128 in `unchecked_shr` -error: any use of this value will cause an error - --> $DIR/const-int-unchecked.rs:108:29 +error[E0080]: evaluation of constant value failed + --> $DIR/const-int-unchecked.rs:83:29 | LL | const SHR_I8: i8 = unsafe { intrinsics::unchecked_shr(5_i8, 8) }; - | ----------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--- - | | - | overflowing shift by 8 in `unchecked_shr` - | - = 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> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflowing shift by 8 in `unchecked_shr` -error: any use of this value will cause an error - --> $DIR/const-int-unchecked.rs:111:31 +error[E0080]: evaluation of constant value failed + --> $DIR/const-int-unchecked.rs:85:31 | LL | const SHR_I16: i16 = unsafe { intrinsics::unchecked_shr(5_16, 16) }; - | ------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--- - | | - | overflowing shift by 16 in `unchecked_shr` - | - = 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> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflowing shift by 16 in `unchecked_shr` -error: any use of this value will cause an error - --> $DIR/const-int-unchecked.rs:114:31 +error[E0080]: evaluation of constant value failed + --> $DIR/const-int-unchecked.rs:87:31 | LL | const SHR_I32: i32 = unsafe { intrinsics::unchecked_shr(5_i32, 32) }; - | ------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--- - | | - | overflowing shift by 32 in `unchecked_shr` - | - = 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> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflowing shift by 32 in `unchecked_shr` -error: any use of this value will cause an error - --> $DIR/const-int-unchecked.rs:117:31 +error[E0080]: evaluation of constant value failed + --> $DIR/const-int-unchecked.rs:89:31 | LL | const SHR_I64: i64 = unsafe { intrinsics::unchecked_shr(5_i64, 64) }; - | ------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--- - | | - | overflowing shift by 64 in `unchecked_shr` - | - = 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> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflowing shift by 64 in `unchecked_shr` -error: any use of this value will cause an error - --> $DIR/const-int-unchecked.rs:120:33 +error[E0080]: evaluation of constant value failed + --> $DIR/const-int-unchecked.rs:91:33 | LL | const SHR_I128: i128 = unsafe { intrinsics::unchecked_shr(5_i128, 128) }; - | --------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--- - | | - | overflowing shift by 128 in `unchecked_shr` - | - = 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> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflowing shift by 128 in `unchecked_shr` -error: any use of this value will cause an error - --> $DIR/const-int-unchecked.rs:126:33 +error[E0080]: evaluation of constant value failed + --> $DIR/const-int-unchecked.rs:96:33 | LL | const SHR_I8_NEG: i8 = unsafe { intrinsics::unchecked_shr(5_i8, -1) }; - | --------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--- - | | - | overflowing shift by 255 in `unchecked_shr` - | - = 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> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflowing shift by 255 in `unchecked_shr` -error: any use of this value will cause an error - --> $DIR/const-int-unchecked.rs:129:35 +error[E0080]: evaluation of constant value failed + --> $DIR/const-int-unchecked.rs:98:35 | LL | const SHR_I16_NEG: i16 = unsafe { intrinsics::unchecked_shr(5_16, -1) }; - | ----------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--- - | | - | overflowing shift by 65535 in `unchecked_shr` - | - = 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> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflowing shift by 65535 in `unchecked_shr` -error: any use of this value will cause an error - --> $DIR/const-int-unchecked.rs:132:35 +error[E0080]: evaluation of constant value failed + --> $DIR/const-int-unchecked.rs:100:35 | LL | const SHR_I32_NEG: i32 = unsafe { intrinsics::unchecked_shr(5_i32, -1) }; - | ----------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--- - | | - | overflowing shift by 4294967295 in `unchecked_shr` - | - = 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> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflowing shift by 4294967295 in `unchecked_shr` -error: any use of this value will cause an error - --> $DIR/const-int-unchecked.rs:135:35 +error[E0080]: evaluation of constant value failed + --> $DIR/const-int-unchecked.rs:102:35 | LL | const SHR_I64_NEG: i64 = unsafe { intrinsics::unchecked_shr(5_i64, -1) }; - | ----------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--- - | | - | overflowing shift by 18446744073709551615 in `unchecked_shr` - | - = 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> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflowing shift by 18446744073709551615 in `unchecked_shr` -error: any use of this value will cause an error - --> $DIR/const-int-unchecked.rs:138:37 +error[E0080]: evaluation of constant value failed + --> $DIR/const-int-unchecked.rs:104:37 | LL | const SHR_I128_NEG: i128 = unsafe { intrinsics::unchecked_shr(5_i128, -1) }; - | ------------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--- - | | - | overflowing shift by 340282366920938463463374607431768211455 in `unchecked_shr` - | - = 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> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflowing shift by 340282366920938463463374607431768211455 in `unchecked_shr` -error: any use of this value will cause an error - --> $DIR/const-int-unchecked.rs:145:40 +error[E0080]: evaluation of constant value failed + --> $DIR/const-int-unchecked.rs:110:40 | LL | const SHR_I8_NEG_RANDOM: i8 = unsafe { intrinsics::unchecked_shr(5_i8, -6) }; - | ---------------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--- - | | - | overflowing shift by 250 in `unchecked_shr` - | - = 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> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflowing shift by 250 in `unchecked_shr` -error: any use of this value will cause an error - --> $DIR/const-int-unchecked.rs:148:42 +error[E0080]: evaluation of constant value failed + --> $DIR/const-int-unchecked.rs:112:42 | LL | const SHR_I16_NEG_RANDOM: i16 = unsafe { intrinsics::unchecked_shr(5_16, -13) }; - | -----------------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--- - | | - | overflowing shift by 65523 in `unchecked_shr` - | - = 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> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflowing shift by 65523 in `unchecked_shr` -error: any use of this value will cause an error - --> $DIR/const-int-unchecked.rs:151:42 +error[E0080]: evaluation of constant value failed + --> $DIR/const-int-unchecked.rs:114:42 | LL | const SHR_I32_NEG_RANDOM: i32 = unsafe { intrinsics::unchecked_shr(5_i32, -25) }; - | -----------------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--- - | | - | overflowing shift by 4294967271 in `unchecked_shr` - | - = 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> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflowing shift by 4294967271 in `unchecked_shr` -error: any use of this value will cause an error - --> $DIR/const-int-unchecked.rs:154:42 +error[E0080]: evaluation of constant value failed + --> $DIR/const-int-unchecked.rs:116:42 | LL | const SHR_I64_NEG_RANDOM: i64 = unsafe { intrinsics::unchecked_shr(5_i64, -30) }; - | -----------------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--- - | | - | overflowing shift by 18446744073709551586 in `unchecked_shr` - | - = 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> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflowing shift by 18446744073709551586 in `unchecked_shr` -error: any use of this value will cause an error - --> $DIR/const-int-unchecked.rs:157:44 +error[E0080]: evaluation of constant value failed + --> $DIR/const-int-unchecked.rs:118:44 | LL | const SHR_I128_NEG_RANDOM: i128 = unsafe { intrinsics::unchecked_shr(5_i128, -93) }; - | -------------------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--- - | | - | overflowing shift by 340282366920938463463374607431768211363 in `unchecked_shr` - | - = 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> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflowing shift by 340282366920938463463374607431768211363 in `unchecked_shr` -error: any use of this value will cause an error - --> $DIR/const-int-unchecked.rs:163:25 +error[E0080]: evaluation of constant value failed + --> $DIR/const-int-unchecked.rs:123:25 | LL | const _: u16 = unsafe { std::intrinsics::unchecked_add(40000u16, 30000) }; - | ------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--- - | | - | overflow executing `unchecked_add` - | - = 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> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflow executing `unchecked_add` -error: any use of this value will cause an error - --> $DIR/const-int-unchecked.rs:167:25 +error[E0080]: evaluation of constant value failed + --> $DIR/const-int-unchecked.rs:126:25 | LL | const _: u32 = unsafe { std::intrinsics::unchecked_sub(14u32, 22) }; - | ------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--- - | | - | overflow executing `unchecked_sub` - | - = 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> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflow executing `unchecked_sub` -error: any use of this value will cause an error - --> $DIR/const-int-unchecked.rs:171:25 +error[E0080]: evaluation of constant value failed + --> $DIR/const-int-unchecked.rs:129:25 | LL | const _: u16 = unsafe { std::intrinsics::unchecked_mul(300u16, 250u16) }; - | ------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--- - | | - | overflow executing `unchecked_mul` - | - = 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> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflow executing `unchecked_mul` -error: any use of this value will cause an error - --> $DIR/const-int-unchecked.rs:175:25 +error[E0080]: evaluation of constant value failed + --> $DIR/const-int-unchecked.rs:132:25 | LL | const _: i32 = unsafe { std::intrinsics::unchecked_div(1, 0) }; - | ------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--- - | | - | dividing by zero - | - = 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> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ dividing by zero -error: any use of this value will cause an error - --> $DIR/const-int-unchecked.rs:178:25 +error[E0080]: evaluation of constant value failed + --> $DIR/const-int-unchecked.rs:134:25 | LL | const _: i32 = unsafe { std::intrinsics::unchecked_div(i32::MIN, -1) }; - | ------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--- - | | - | overflow executing `unchecked_div` - | - = 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> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflow executing `unchecked_div` -error: any use of this value will cause an error - --> $DIR/const-int-unchecked.rs:182:25 +error[E0080]: evaluation of constant value failed + --> $DIR/const-int-unchecked.rs:137:25 | LL | const _: i32 = unsafe { std::intrinsics::unchecked_rem(1, 0) }; - | ------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--- - | | - | calculating the remainder with a divisor of zero - | - = 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> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ calculating the remainder with a divisor of zero -error: any use of this value will cause an error - --> $DIR/const-int-unchecked.rs:185:25 +error[E0080]: evaluation of constant value failed + --> $DIR/const-int-unchecked.rs:139:25 | LL | const _: i32 = unsafe { std::intrinsics::unchecked_rem(i32::MIN, -1) }; - | ------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--- - | | - | overflow executing `unchecked_rem` - | - = 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> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflow executing `unchecked_rem` -error: any use of this value will cause an error - --> $DIR/const-int-unchecked.rs:191:25 +error[E0080]: evaluation of constant value failed + --> $DIR/const-int-unchecked.rs:144:25 | LL | const _: u32 = unsafe { std::intrinsics::ctlz_nonzero(0) }; - | ------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--- - | | - | `ctlz_nonzero` called on 0 - | - = 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> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `ctlz_nonzero` called on 0 -error: any use of this value will cause an error - --> $DIR/const-int-unchecked.rs:194:25 +error[E0080]: evaluation of constant value failed + --> $DIR/const-int-unchecked.rs:146:25 | LL | const _: u32 = unsafe { std::intrinsics::cttz_nonzero(0) }; - | ------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--- - | | - | `cttz_nonzero` called on 0 - | - = 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> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `cttz_nonzero` called on 0 error: aborting due to 49 previous errors +For more information about this error, try `rustc --explain E0080`. diff --git a/src/test/ui/consts/const-unwrap.stderr b/src/test/ui/consts/const-unwrap.stderr index 95f4711cb65..9a820ff7217 100644 --- a/src/test/ui/consts/const-unwrap.stderr +++ b/src/test/ui/consts/const-unwrap.stderr @@ -1,4 +1,4 @@ -error[E0080]: any use of this value will cause an error +error[E0080]: evaluation of constant value failed --> $SRC_DIR/core/src/option.rs:LL:COL | LL | None => panic!("called `Option::unwrap()` on a `None` value"), @@ -6,12 +6,11 @@ LL | None => panic!("called `Option::unwrap()` on a `None` value"), | | | the evaluated program panicked at 'called `Option::unwrap()` on a `None` value', $DIR/const-unwrap.rs:9:38 | inside `Option::<i32>::unwrap` at $SRC_DIR/core/src/panic.rs:LL:COL - | inside `BAR` at $DIR/const-unwrap.rs:9:18 | - ::: $DIR/const-unwrap.rs:9:1 + ::: $DIR/const-unwrap.rs:9:18 | LL | const BAR: i32 = Option::<i32>::None.unwrap(); - | ---------------------------------------------- + | ---------------------------- inside `BAR` at $DIR/const-unwrap.rs:9:18 | = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/src/test/ui/consts/const_unsafe_unreachable_ub.rs b/src/test/ui/consts/const_unsafe_unreachable_ub.rs index 4ae3a88c451..8cee5b50651 100644 --- a/src/test/ui/consts/const_unsafe_unreachable_ub.rs +++ b/src/test/ui/consts/const_unsafe_unreachable_ub.rs @@ -1,5 +1,4 @@ -// build-fail - +// error-pattern: evaluation of constant value failed #![feature(const_unreachable_unchecked)] const unsafe fn foo(x: bool) -> bool { @@ -9,12 +8,8 @@ const unsafe fn foo(x: bool) -> bool { } } -#[warn(const_err)] const BAR: bool = unsafe { foo(false) }; fn main() { assert_eq!(BAR, true); - //~^ ERROR E0080 - //~| ERROR erroneous constant - //~| WARN this was previously accepted by the compiler but is being phased out } diff --git a/src/test/ui/consts/const_unsafe_unreachable_ub.stderr b/src/test/ui/consts/const_unsafe_unreachable_ub.stderr index fc7a53e2774..ecdd0ca3f54 100644 --- a/src/test/ui/consts/const_unsafe_unreachable_ub.stderr +++ b/src/test/ui/consts/const_unsafe_unreachable_ub.stderr @@ -1,4 +1,4 @@ -warning: any use of this value will cause an error +error[E0080]: evaluation of constant value failed --> $SRC_DIR/core/src/hint.rs:LL:COL | LL | unsafe { intrinsics::unreachable() } @@ -6,39 +6,15 @@ LL | unsafe { intrinsics::unreachable() } | | | entering unreachable code | inside `unreachable_unchecked` at $SRC_DIR/core/src/hint.rs:LL:COL - | inside `foo` at $DIR/const_unsafe_unreachable_ub.rs:8:18 - | inside `BAR` at $DIR/const_unsafe_unreachable_ub.rs:13:28 | - ::: $DIR/const_unsafe_unreachable_ub.rs:13:1 + ::: $DIR/const_unsafe_unreachable_ub.rs:7:18 | +LL | false => std::hint::unreachable_unchecked(), + | ---------------------------------- inside `foo` at $DIR/const_unsafe_unreachable_ub.rs:7:18 +... LL | const BAR: bool = unsafe { foo(false) }; - | ---------------------------------------- - | -note: the lint level is defined here - --> $DIR/const_unsafe_unreachable_ub.rs:12:8 - | -LL | #[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! - = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> - -error[E0080]: evaluation of constant value failed - --> $DIR/const_unsafe_unreachable_ub.rs:16:14 - | -LL | assert_eq!(BAR, true); - | ^^^ referenced constant has errors - -error: erroneous constant used - --> $DIR/const_unsafe_unreachable_ub.rs:16:3 - | -LL | assert_eq!(BAR, true); - | ^^^^^^^^^^^^^^^^^^^^^^ 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! - = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> - = note: this error originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info) + | ---------- inside `BAR` at $DIR/const_unsafe_unreachable_ub.rs:11:28 -error: aborting due to 2 previous errors; 1 warning emitted +error: aborting due to previous error For more information about this error, try `rustc --explain E0080`. diff --git a/src/test/ui/consts/control-flow/assert.const_panic.stderr b/src/test/ui/consts/control-flow/assert.const_panic.stderr index 8e1a2b5eb46..1deaa937edb 100644 --- a/src/test/ui/consts/control-flow/assert.const_panic.stderr +++ b/src/test/ui/consts/control-flow/assert.const_panic.stderr @@ -1,10 +1,8 @@ -error[E0080]: any use of this value will cause an error +error[E0080]: evaluation of constant value failed --> $DIR/assert.rs:10:15 | LL | const _: () = assert!(false); - | --------------^^^^^^^^^^^^^^- - | | - | the evaluated program panicked at 'assertion failed: false', $DIR/assert.rs:10:15 + | ^^^^^^^^^^^^^^ the evaluated program panicked at 'assertion failed: false', $DIR/assert.rs:10:15 | = note: this error originates in the macro `assert` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/src/test/ui/consts/control-flow/assert.rs b/src/test/ui/consts/control-flow/assert.rs index 90017fee193..b311cb140cc 100644 --- a/src/test/ui/consts/control-flow/assert.rs +++ b/src/test/ui/consts/control-flow/assert.rs @@ -9,6 +9,6 @@ const _: () = assert!(true); const _: () = assert!(false); //[stock]~^ ERROR panicking in constants is unstable -//[const_panic]~^^ ERROR any use of this value will cause an error +//[const_panic]~^^ ERROR evaluation of constant value failed fn main() {} diff --git a/src/test/ui/consts/copy-intrinsic.rs b/src/test/ui/consts/copy-intrinsic.rs new file mode 100644 index 00000000000..48d128b10e8 --- /dev/null +++ b/src/test/ui/consts/copy-intrinsic.rs @@ -0,0 +1,51 @@ +#![stable(feature = "dummy", since = "1.0.0")] + +// ignore-tidy-linelength +#![feature(intrinsics, staged_api)] +#![feature(const_mut_refs, const_intrinsic_copy, const_ptr_offset)] +use std::mem; + +extern "rust-intrinsic" { + #[rustc_const_unstable(feature = "const_intrinsic_copy", issue = "80697")] + fn copy_nonoverlapping<T>(src: *const T, dst: *mut T, count: usize); + + #[rustc_const_unstable(feature = "const_intrinsic_copy", issue = "80697")] + fn copy<T>(src: *const T, dst: *mut T, count: usize); +} + +const COPY_ZERO: () = unsafe { + // Since we are not copying anything, this should be allowed. + let src = (); + let mut dst = (); + copy_nonoverlapping(&src as *const _ as *const i32, &mut dst as *mut _ as *mut i32, 0); +}; + +const COPY_OOB_1: () = unsafe { + let mut x = 0i32; + let dangle = (&mut x as *mut i32).wrapping_add(10); + // Even if the first ptr is an int ptr and this is a ZST copy, we should detect dangling 2nd ptrs. + copy_nonoverlapping(0x100 as *const i32, dangle, 0); //~ evaluation of constant value failed [E0080] +}; +const COPY_OOB_2: () = unsafe { + let x = 0i32; + let dangle = (&x as *const i32).wrapping_add(10); + // Even if the second ptr is an int ptr and this is a ZST copy, we should detect dangling 1st ptrs. + copy_nonoverlapping(dangle, 0x100 as *mut i32, 0); //~ evaluation of constant value failed [E0080] + //~| memory access failed: pointer must be in-bounds +}; + +const COPY_SIZE_OVERFLOW: () = unsafe { + let x = 0; + let mut y = 0; + copy(&x, &mut y, 1usize << (mem::size_of::<usize>() * 8 - 1)); //~ evaluation of constant value failed [E0080] + //~| overflow computing total size of `copy` +}; +const COPY_NONOVERLAPPING_SIZE_OVERFLOW: () = unsafe { + let x = 0; + let mut y = 0; + copy_nonoverlapping(&x, &mut y, 1usize << (mem::size_of::<usize>() * 8 - 1)); //~ evaluation of constant value failed [E0080] + //~| overflow computing total size of `copy_nonoverlapping` +}; + +fn main() { +} diff --git a/src/test/ui/consts/copy-intrinsic.stderr b/src/test/ui/consts/copy-intrinsic.stderr new file mode 100644 index 00000000000..c1779743e8e --- /dev/null +++ b/src/test/ui/consts/copy-intrinsic.stderr @@ -0,0 +1,27 @@ +error[E0080]: evaluation of constant value failed + --> $DIR/copy-intrinsic.rs:27:5 + | +LL | copy_nonoverlapping(0x100 as *const i32, dangle, 0); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ memory access failed: pointer must be in-bounds at offset 40, but is outside bounds of alloc4 which has size 4 + +error[E0080]: evaluation of constant value failed + --> $DIR/copy-intrinsic.rs:33:5 + | +LL | copy_nonoverlapping(dangle, 0x100 as *mut i32, 0); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ memory access failed: pointer must be in-bounds at offset 40, but is outside bounds of alloc6 which has size 4 + +error[E0080]: evaluation of constant value failed + --> $DIR/copy-intrinsic.rs:40:5 + | +LL | copy(&x, &mut y, 1usize << (mem::size_of::<usize>() * 8 - 1)); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflow computing total size of `copy` + +error[E0080]: evaluation of constant value failed + --> $DIR/copy-intrinsic.rs:46:5 + | +LL | copy_nonoverlapping(&x, &mut y, 1usize << (mem::size_of::<usize>() * 8 - 1)); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflow computing total size of `copy_nonoverlapping` + +error: aborting due to 4 previous errors + +For more information about this error, try `rustc --explain E0080`. diff --git a/src/test/ui/consts/issue-39161-bogus-error.rs b/src/test/ui/consts/issue-39161-bogus-error.rs new file mode 100644 index 00000000000..a954385da41 --- /dev/null +++ b/src/test/ui/consts/issue-39161-bogus-error.rs @@ -0,0 +1,13 @@ +// check-pass + +pub struct X { + pub a: i32, + pub b: i32, +} + +fn main() { + const DX: X = X { a: 0, b: 0 }; + const _X1: X = X { a: 1, ..DX }; + let _x2 = X { a: 1, b: 2, ..DX }; + const _X3: X = X { a: 1, b: 2, ..DX }; +} diff --git a/src/test/ui/consts/offset_from_ub.rs b/src/test/ui/consts/offset_from_ub.rs index b73191d56a6..f8fa2c5f177 100644 --- a/src/test/ui/consts/offset_from_ub.rs +++ b/src/test/ui/consts/offset_from_ub.rs @@ -1,5 +1,8 @@ #![feature(const_raw_ptr_deref)] #![feature(const_ptr_offset_from)] +#![feature(core_intrinsics)] + +use std::intrinsics::ptr_offset_from; #[repr(C)] struct Struct { @@ -8,39 +11,38 @@ struct Struct { } pub const DIFFERENT_ALLOC: usize = { - //~^ NOTE let uninit = std::mem::MaybeUninit::<Struct>::uninit(); let base_ptr: *const Struct = &uninit as *const _ as *const Struct; let uninit2 = std::mem::MaybeUninit::<Struct>::uninit(); let field_ptr: *const Struct = &uninit2 as *const _ as *const Struct; - let offset = unsafe { field_ptr.offset_from(base_ptr) }; + let offset = unsafe { ptr_offset_from(field_ptr, base_ptr) }; //~ERROR evaluation of constant value failed + //~| cannot compute offset of pointers into different allocations. offset as usize }; pub const NOT_PTR: usize = { - //~^ NOTE unsafe { (42 as *const u8).offset_from(&5u8) as usize } }; pub const NOT_MULTIPLE_OF_SIZE: isize = { - //~^ NOTE let data = [5u8, 6, 7]; let base_ptr = data.as_ptr(); let field_ptr = &data[1] as *const u8 as *const u16; - unsafe { field_ptr.offset_from(base_ptr as *const u16) } + unsafe { ptr_offset_from(field_ptr, base_ptr as *const u16) } //~ERROR evaluation of constant value failed + //~| 1_isize cannot be divided by 2_isize without remainder }; pub const OFFSET_FROM_NULL: isize = { - //~^ NOTE let ptr = 0 as *const u8; - unsafe { ptr.offset_from(ptr) } + unsafe { ptr_offset_from(ptr, ptr) } //~ERROR evaluation of constant value failed + //~| null pointer is not a valid pointer }; pub const DIFFERENT_INT: isize = { // offset_from with two different integers: like DIFFERENT_ALLOC - //~^ NOTE let ptr1 = 8 as *const u8; let ptr2 = 16 as *const u8; - unsafe { ptr2.offset_from(ptr1) } + unsafe { ptr_offset_from(ptr2, ptr1) } //~ERROR any use of this value will cause an error + //~| WARN previously accepted }; fn main() {} diff --git a/src/test/ui/consts/offset_from_ub.stderr b/src/test/ui/consts/offset_from_ub.stderr index 4254cda2a00..4c2ba9297d8 100644 --- a/src/test/ui/consts/offset_from_ub.stderr +++ b/src/test/ui/consts/offset_from_ub.stderr @@ -1,27 +1,8 @@ -error: any use of this value will cause an error - --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL - | -LL | unsafe { intrinsics::ptr_offset_from(self, origin) } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | ptr_offset_from cannot compute offset of pointers into different allocations. - | inside `ptr::const_ptr::<impl *const Struct>::offset_from` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL - | inside `DIFFERENT_ALLOC` at $DIR/offset_from_ub.rs:16:27 - | - ::: $DIR/offset_from_ub.rs:10:1 +error[E0080]: evaluation of constant value failed + --> $DIR/offset_from_ub.rs:18:27 | -LL | / pub const DIFFERENT_ALLOC: usize = { -LL | | -LL | | let uninit = std::mem::MaybeUninit::<Struct>::uninit(); -LL | | let base_ptr: *const Struct = &uninit as *const _ as *const Struct; -... | -LL | | offset as usize -LL | | }; - | |__- - | - = 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! - = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> +LL | let offset = unsafe { ptr_offset_from(field_ptr, base_ptr) }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ptr_offset_from cannot compute offset of pointers into different allocations. error: any use of this value will cause an error --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL @@ -31,82 +12,40 @@ LL | unsafe { intrinsics::ptr_offset_from(self, origin) } | | | unable to turn bytes into a pointer | inside `ptr::const_ptr::<impl *const u8>::offset_from` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL - | inside `NOT_PTR` at $DIR/offset_from_ub.rs:22:14 + | inside `NOT_PTR` at $DIR/offset_from_ub.rs:24:14 | - ::: $DIR/offset_from_ub.rs:20:1 + ::: $DIR/offset_from_ub.rs:23:1 | LL | / pub const NOT_PTR: usize = { -LL | | LL | | unsafe { (42 as *const u8).offset_from(&5u8) as usize } LL | | }; | |__- | + = 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! = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> -error: any use of this value will cause an error - --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL - | -LL | unsafe { intrinsics::ptr_offset_from(self, origin) } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | exact_div: 1_isize cannot be divided by 2_isize without remainder - | inside `ptr::const_ptr::<impl *const u16>::offset_from` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL - | inside `NOT_MULTIPLE_OF_SIZE` at $DIR/offset_from_ub.rs:30:14 - | - ::: $DIR/offset_from_ub.rs:25:1 - | -LL | / pub const NOT_MULTIPLE_OF_SIZE: isize = { -LL | | -LL | | let data = [5u8, 6, 7]; -LL | | let base_ptr = data.as_ptr(); -LL | | let field_ptr = &data[1] as *const u8 as *const u16; -LL | | unsafe { field_ptr.offset_from(base_ptr as *const u16) } -LL | | }; - | |__- +error[E0080]: evaluation of constant value failed + --> $DIR/offset_from_ub.rs:31:14 | - = 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> +LL | unsafe { ptr_offset_from(field_ptr, base_ptr as *const u16) } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ exact_div: 1_isize cannot be divided by 2_isize without remainder -error: any use of this value will cause an error - --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL - | -LL | unsafe { intrinsics::ptr_offset_from(self, origin) } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | null pointer is not a valid pointer for this operation - | inside `ptr::const_ptr::<impl *const u8>::offset_from` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL - | inside `OFFSET_FROM_NULL` at $DIR/offset_from_ub.rs:36:14 - | - ::: $DIR/offset_from_ub.rs:33:1 - | -LL | / pub const OFFSET_FROM_NULL: isize = { -LL | | -LL | | let ptr = 0 as *const u8; -LL | | unsafe { ptr.offset_from(ptr) } -LL | | }; - | |__- +error[E0080]: evaluation of constant value failed + --> $DIR/offset_from_ub.rs:37:14 | - = 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> +LL | unsafe { ptr_offset_from(ptr, ptr) } + | ^^^^^^^^^^^^^^^^^^^^^^^^^ null pointer is not a valid pointer for this operation error: any use of this value will cause an error - --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL - | -LL | unsafe { intrinsics::ptr_offset_from(self, origin) } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | unable to turn bytes into a pointer - | inside `ptr::const_ptr::<impl *const u8>::offset_from` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL - | inside `DIFFERENT_INT` at $DIR/offset_from_ub.rs:43:14 - | - ::: $DIR/offset_from_ub.rs:39:1 + --> $DIR/offset_from_ub.rs:44:14 | LL | / pub const DIFFERENT_INT: isize = { // offset_from with two different integers: like DIFFERENT_ALLOC -LL | | LL | | let ptr1 = 8 as *const u8; LL | | let ptr2 = 16 as *const u8; -LL | | unsafe { ptr2.offset_from(ptr1) } +LL | | unsafe { ptr_offset_from(ptr2, ptr1) } + | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn bytes into a pointer +LL | | LL | | }; | |__- | @@ -115,3 +54,4 @@ LL | | }; error: aborting due to 5 previous errors +For more information about this error, try `rustc --explain E0080`. diff --git a/src/test/ui/consts/offset_ub.stderr b/src/test/ui/consts/offset_ub.stderr index 45203d3e271..e25bef0624d 100644 --- a/src/test/ui/consts/offset_ub.stderr +++ b/src/test/ui/consts/offset_ub.stderr @@ -1,4 +1,4 @@ -error: any use of this value will cause an error +error[E0080]: evaluation of constant value failed --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL | LL | unsafe { intrinsics::offset(self, count) } @@ -6,18 +6,13 @@ LL | unsafe { intrinsics::offset(self, count) } | | | overflowing in-bounds pointer arithmetic | inside `ptr::const_ptr::<impl *const u8>::offset` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL - | inside `BEFORE_START` at $DIR/offset_ub.rs:6:46 | - ::: $DIR/offset_ub.rs:6:1 + ::: $DIR/offset_ub.rs:6:46 | LL | pub const BEFORE_START: *const u8 = unsafe { (&0u8 as *const u8).offset(-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! - = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> + | ------------------------------ inside `BEFORE_START` at $DIR/offset_ub.rs:6:46 -error: any use of this value will cause an error +error[E0080]: evaluation of constant value failed --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL | LL | unsafe { intrinsics::offset(self, count) } @@ -25,17 +20,13 @@ LL | unsafe { intrinsics::offset(self, count) } | | | pointer arithmetic failed: pointer must be in-bounds at offset 2, but is outside bounds of allocN which has size 1 | inside `ptr::const_ptr::<impl *const u8>::offset` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL - | inside `AFTER_END` at $DIR/offset_ub.rs:7:43 | - ::: $DIR/offset_ub.rs:7:1 + ::: $DIR/offset_ub.rs:7:43 | LL | pub const AFTER_END: *const u8 = unsafe { (&0u8 as *const u8).offset(2) }; - | -------------------------------------------------------------------------- - | - = 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> + | ----------------------------- inside `AFTER_END` at $DIR/offset_ub.rs:7:43 -error: any use of this value will cause an error +error[E0080]: evaluation of constant value failed --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL | LL | unsafe { intrinsics::offset(self, count) } @@ -43,17 +34,13 @@ LL | unsafe { intrinsics::offset(self, count) } | | | pointer arithmetic failed: pointer must be in-bounds at offset 101, but is outside bounds of allocN which has size 100 | inside `ptr::const_ptr::<impl *const u8>::offset` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL - | inside `AFTER_ARRAY` at $DIR/offset_ub.rs:8:45 | - ::: $DIR/offset_ub.rs:8:1 + ::: $DIR/offset_ub.rs:8:45 | LL | pub const AFTER_ARRAY: *const u8 = unsafe { [0u8; 100].as_ptr().offset(101) }; - | ------------------------------------------------------------------------------ - | - = 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> + | ------------------------------- inside `AFTER_ARRAY` at $DIR/offset_ub.rs:8:45 -error: any use of this value will cause an error +error[E0080]: evaluation of constant value failed --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL | LL | unsafe { intrinsics::offset(self, count) } @@ -61,17 +48,13 @@ LL | unsafe { intrinsics::offset(self, count) } | | | overflowing in-bounds pointer arithmetic | inside `ptr::const_ptr::<impl *const u16>::offset` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL - | inside `OVERFLOW` at $DIR/offset_ub.rs:10:43 | - ::: $DIR/offset_ub.rs:10:1 + ::: $DIR/offset_ub.rs:10:43 | LL | pub const OVERFLOW: *const u16 = unsafe { [0u16; 1].as_ptr().offset(isize::MAX) }; - | ---------------------------------------------------------------------------------- - | - = 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> + | ------------------------------------- inside `OVERFLOW` at $DIR/offset_ub.rs:10:43 -error: any use of this value will cause an error +error[E0080]: evaluation of constant value failed --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL | LL | unsafe { intrinsics::offset(self, count) } @@ -79,17 +62,13 @@ LL | unsafe { intrinsics::offset(self, count) } | | | overflowing in-bounds pointer arithmetic | inside `ptr::const_ptr::<impl *const u16>::offset` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL - | inside `UNDERFLOW` at $DIR/offset_ub.rs:11:44 | - ::: $DIR/offset_ub.rs:11:1 + ::: $DIR/offset_ub.rs:11:44 | LL | pub const UNDERFLOW: *const u16 = unsafe { [0u16; 1].as_ptr().offset(isize::MIN) }; - | ----------------------------------------------------------------------------------- - | - = 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> + | ------------------------------------- inside `UNDERFLOW` at $DIR/offset_ub.rs:11:44 -error: any use of this value will cause an error +error[E0080]: evaluation of constant value failed --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL | LL | unsafe { intrinsics::offset(self, count) } @@ -97,17 +76,13 @@ LL | unsafe { intrinsics::offset(self, count) } | | | overflowing in-bounds pointer arithmetic | inside `ptr::const_ptr::<impl *const u8>::offset` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL - | inside `OVERFLOW_ADDRESS_SPACE` at $DIR/offset_ub.rs:12:56 | - ::: $DIR/offset_ub.rs:12:1 + ::: $DIR/offset_ub.rs:12:56 | LL | pub const OVERFLOW_ADDRESS_SPACE: *const u8 = unsafe { (usize::MAX as *const u8).offset(2) }; - | --------------------------------------------------------------------------------------------- - | - = 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> + | ----------------------------------- inside `OVERFLOW_ADDRESS_SPACE` at $DIR/offset_ub.rs:12:56 -error: any use of this value will cause an error +error[E0080]: evaluation of constant value failed --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL | LL | unsafe { intrinsics::offset(self, count) } @@ -115,17 +90,13 @@ LL | unsafe { intrinsics::offset(self, count) } | | | overflowing in-bounds pointer arithmetic | inside `ptr::const_ptr::<impl *const u8>::offset` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL - | inside `UNDERFLOW_ADDRESS_SPACE` at $DIR/offset_ub.rs:13:57 | - ::: $DIR/offset_ub.rs:13:1 + ::: $DIR/offset_ub.rs:13:57 | LL | pub const UNDERFLOW_ADDRESS_SPACE: *const u8 = unsafe { (1 as *const u8).offset(-2) }; - | -------------------------------------------------------------------------------------- - | - = 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> + | --------------------------- inside `UNDERFLOW_ADDRESS_SPACE` at $DIR/offset_ub.rs:13:57 -error: any use of this value will cause an error +error[E0080]: evaluation of constant value failed --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL | LL | unsafe { intrinsics::offset(self, count) } @@ -133,15 +104,11 @@ LL | unsafe { intrinsics::offset(self, count) } | | | pointer arithmetic failed: pointer must be in-bounds at offset 1, but is outside bounds of allocN which has size 0 | inside `ptr::const_ptr::<impl *const u8>::offset` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL - | inside `ZERO_SIZED_ALLOC` at $DIR/offset_ub.rs:15:50 | - ::: $DIR/offset_ub.rs:15:1 + ::: $DIR/offset_ub.rs:15:50 | LL | pub const ZERO_SIZED_ALLOC: *const u8 = unsafe { [0u8; 0].as_ptr().offset(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> + | --------------------------- inside `ZERO_SIZED_ALLOC` at $DIR/offset_ub.rs:15:50 error: any use of this value will cause an error --> $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL @@ -158,10 +125,11 @@ LL | unsafe { intrinsics::offset(self, count) as *mut T } LL | pub const DANGLING: *const u8 = unsafe { ptr::NonNull::<u8>::dangling().as_ptr().offset(4) }; | --------------------------------------------------------------------------------------------- | + = 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! = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> -error: any use of this value will cause an error +error[E0080]: evaluation of constant value failed --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL | LL | unsafe { intrinsics::offset(self, count) } @@ -169,15 +137,11 @@ LL | unsafe { intrinsics::offset(self, count) } | | | pointer arithmetic failed: 0x0 is not a valid pointer | inside `ptr::const_ptr::<impl *const u8>::offset` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL - | inside `NULL_OFFSET_ZERO` at $DIR/offset_ub.rs:19:50 | - ::: $DIR/offset_ub.rs:19:1 + ::: $DIR/offset_ub.rs:19:50 | LL | pub const NULL_OFFSET_ZERO: *const u8 = unsafe { ptr::null::<u8>().offset(0) }; - | ------------------------------------------------------------------------------- - | - = 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> + | --------------------------- inside `NULL_OFFSET_ZERO` at $DIR/offset_ub.rs:19:50 error: any use of this value will cause an error --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL @@ -199,3 +163,4 @@ LL | pub const UNDERFLOW_ABS: *const u8 = unsafe { (usize::MAX as *const u8).off error: aborting due to 11 previous errors +For more information about this error, try `rustc --explain E0080`. diff --git a/src/test/ui/consts/ptr_comparisons.rs b/src/test/ui/consts/ptr_comparisons.rs index 0306a55af4e..aa8f511e072 100644 --- a/src/test/ui/consts/ptr_comparisons.rs +++ b/src/test/ui/consts/ptr_comparisons.rs @@ -62,8 +62,8 @@ const _: *const usize = unsafe { (FOO as *const usize).offset(2) }; const _: *const u8 = unsafe { std::ptr::addr_of!((*(FOO as *const usize as *const [u8; 1000]))[999]) }; -//~^ ERROR any use of this value will cause an error -//~| WARN this was previously accepted by the compiler but is being phased out +//~^ ERROR evaluation of constant value failed +//~| pointer must be in-bounds const _: usize = unsafe { std::mem::transmute::<*const usize, usize>(FOO) + 4 }; //~^ ERROR any use of this value will cause an error diff --git a/src/test/ui/consts/ptr_comparisons.stderr b/src/test/ui/consts/ptr_comparisons.stderr index 943de47879b..f00f40b3254 100644 --- a/src/test/ui/consts/ptr_comparisons.stderr +++ b/src/test/ui/consts/ptr_comparisons.stderr @@ -1,4 +1,4 @@ -error: any use of this value will cause an error +error[E0080]: evaluation of constant value failed --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL | LL | unsafe { intrinsics::offset(self, count) } @@ -6,28 +6,17 @@ LL | unsafe { intrinsics::offset(self, count) } | | | pointer arithmetic failed: pointer must be in-bounds at offset $TWO_WORDS, but is outside bounds of alloc2 which has size $WORD | inside `ptr::const_ptr::<impl *const usize>::offset` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL - | inside `_` at $DIR/ptr_comparisons.rs:61:34 | - ::: $DIR/ptr_comparisons.rs:61:1 + ::: $DIR/ptr_comparisons.rs:61:34 | LL | const _: *const usize = unsafe { (FOO as *const usize).offset(2) }; - | ------------------------------------------------------------------- - | - = 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! - = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> + | ------------------------------- inside `_` at $DIR/ptr_comparisons.rs:61:34 -error: any use of this value will cause an error +error[E0080]: evaluation of constant value failed --> $DIR/ptr_comparisons.rs:64:33 | -LL | / const _: *const u8 = -LL | | unsafe { std::ptr::addr_of!((*(FOO as *const usize as *const [u8; 1000]))[999]) }; - | |_________________________________^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^___- - | | - | memory access failed: pointer must be in-bounds at offset 1000, but is outside bounds of alloc2 which has size $WORD - | - = 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> +LL | unsafe { std::ptr::addr_of!((*(FOO as *const usize as *const [u8; 1000]))[999]) }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ memory access failed: pointer must be in-bounds at offset 1000, but is outside bounds of alloc2 which has size $WORD error: any use of this value will cause an error --> $DIR/ptr_comparisons.rs:68:27 @@ -37,6 +26,7 @@ LL | const _: usize = unsafe { std::mem::transmute::<*const usize, usize>(FOO) + | | | cannot cast pointer to integer because it was not created by cast from integer | + = 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! = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> @@ -53,3 +43,4 @@ LL | const _: usize = unsafe { *std::mem::transmute::<&&usize, &usize>(&FOO) + 4 error: aborting due to 4 previous errors +For more information about this error, try `rustc --explain E0080`. diff --git a/src/test/ui/crate-loading/missing-std.rs b/src/test/ui/crate-loading/missing-std.rs index 442a7c01e5a..de4ccc18560 100644 --- a/src/test/ui/crate-loading/missing-std.rs +++ b/src/test/ui/crate-loading/missing-std.rs @@ -1,4 +1,5 @@ // compile-flags: --target x86_64-unknown-uefi +// needs-llvm-components: x86 // rustc-env:CARGO=/usr/bin/cargo // rustc-env:RUSTUP_HOME=/home/bors/.rustup #![no_core] diff --git a/src/test/ui/crate-loading/missing-std.stderr b/src/test/ui/crate-loading/missing-std.stderr index 25808efdfa6..e61486fdc6f 100644 --- a/src/test/ui/crate-loading/missing-std.stderr +++ b/src/test/ui/crate-loading/missing-std.stderr @@ -1,5 +1,5 @@ error[E0463]: can't find crate for `core` - --> $DIR/missing-std.rs:5:1 + --> $DIR/missing-std.rs:6:1 | LL | extern crate core; | ^^^^^^^^^^^^^^^^^^ can't find crate diff --git a/src/test/ui/derives/derives-span-Debug-enum-struct-variant.stderr b/src/test/ui/derives/derives-span-Debug-enum-struct-variant.stderr index 2151335992f..4ec89fe729f 100644 --- a/src/test/ui/derives/derives-span-Debug-enum-struct-variant.stderr +++ b/src/test/ui/derives/derives-span-Debug-enum-struct-variant.stderr @@ -5,9 +5,7 @@ LL | x: Error | ^^^^^^^^ `Error` cannot be formatted using `{:?}` | = help: the trait `Debug` is not implemented for `Error` - = note: add `#[derive(Debug)]` or manually implement `Debug` - = note: required because of the requirements on the impl of `Debug` for `&Error` - = note: required for the cast to the object type `dyn Debug` + = note: add `#[derive(Debug)]` to `Error` or manually `impl Debug for Error` = note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to previous error diff --git a/src/test/ui/derives/derives-span-Debug-enum.stderr b/src/test/ui/derives/derives-span-Debug-enum.stderr index 99e618b40ec..d564b6ad76b 100644 --- a/src/test/ui/derives/derives-span-Debug-enum.stderr +++ b/src/test/ui/derives/derives-span-Debug-enum.stderr @@ -5,9 +5,7 @@ LL | Error | ^^^^^ `Error` cannot be formatted using `{:?}` | = help: the trait `Debug` is not implemented for `Error` - = note: add `#[derive(Debug)]` or manually implement `Debug` - = note: required because of the requirements on the impl of `Debug` for `&Error` - = note: required for the cast to the object type `dyn Debug` + = note: add `#[derive(Debug)]` to `Error` or manually `impl Debug for Error` = note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to previous error diff --git a/src/test/ui/derives/derives-span-Debug-struct.stderr b/src/test/ui/derives/derives-span-Debug-struct.stderr index 0086642c557..352141c7e33 100644 --- a/src/test/ui/derives/derives-span-Debug-struct.stderr +++ b/src/test/ui/derives/derives-span-Debug-struct.stderr @@ -5,9 +5,7 @@ LL | x: Error | ^^^^^^^^ `Error` cannot be formatted using `{:?}` | = help: the trait `Debug` is not implemented for `Error` - = note: add `#[derive(Debug)]` or manually implement `Debug` - = note: required because of the requirements on the impl of `Debug` for `&Error` - = note: required for the cast to the object type `dyn Debug` + = note: add `#[derive(Debug)]` to `Error` or manually `impl Debug for Error` = note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to previous error diff --git a/src/test/ui/derives/derives-span-Debug-tuple-struct.stderr b/src/test/ui/derives/derives-span-Debug-tuple-struct.stderr index 0b74908d1ee..65765490183 100644 --- a/src/test/ui/derives/derives-span-Debug-tuple-struct.stderr +++ b/src/test/ui/derives/derives-span-Debug-tuple-struct.stderr @@ -5,9 +5,7 @@ LL | Error | ^^^^^ `Error` cannot be formatted using `{:?}` | = help: the trait `Debug` is not implemented for `Error` - = note: add `#[derive(Debug)]` or manually implement `Debug` - = note: required because of the requirements on the impl of `Debug` for `&Error` - = note: required for the cast to the object type `dyn Debug` + = note: add `#[derive(Debug)]` to `Error` or manually `impl Debug for Error` = note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to previous error diff --git a/src/test/ui/did_you_mean/bad-assoc-ty.rs b/src/test/ui/did_you_mean/bad-assoc-ty.rs index 99ebe84cd9d..1b6bcfbb9fc 100644 --- a/src/test/ui/did_you_mean/bad-assoc-ty.rs +++ b/src/test/ui/did_you_mean/bad-assoc-ty.rs @@ -16,7 +16,7 @@ type D = (u8, u8)::AssocTy; type E = _::AssocTy; //~^ ERROR missing angle brackets in associated item path -//~| ERROR the type placeholder `_` is not allowed within types on item signatures +//~| ERROR the type placeholder `_` is not allowed within types on item signatures for type aliases type F = &'static (u8)::AssocTy; //~^ ERROR missing angle brackets in associated item path @@ -47,37 +47,37 @@ type I = ty!()::AssocTy; trait K<A, B> {} fn foo<X: K<_, _>>(x: X) {} -//~^ ERROR the type placeholder `_` is not allowed within types on item signatures +//~^ ERROR the type placeholder `_` is not allowed within types on item signatures for functions fn bar<F>(_: F) where F: Fn() -> _ {} -//~^ ERROR the type placeholder `_` is not allowed within types on item signatures +//~^ ERROR the type placeholder `_` is not allowed within types on item signatures for functions fn baz<F: Fn() -> _>(_: F) {} -//~^ ERROR the type placeholder `_` is not allowed within types on item signatures +//~^ ERROR the type placeholder `_` is not allowed within types on item signatures for functions struct L<F>(F) where F: Fn() -> _; -//~^ ERROR the type placeholder `_` is not allowed within types on item signatures +//~^ ERROR the type placeholder `_` is not allowed within types on item signatures for structs struct M<F> where F: Fn() -> _ { -//~^ ERROR the type placeholder `_` is not allowed within types on item signatures +//~^ ERROR the type placeholder `_` is not allowed within types on item signatures for structs a: F, } enum N<F> where F: Fn() -> _ { -//~^ ERROR the type placeholder `_` is not allowed within types on item signatures +//~^ ERROR the type placeholder `_` is not allowed within types on item signatures for enums Foo(F), } union O<F> where F: Fn() -> _ { -//~^ ERROR the type placeholder `_` is not allowed within types on item signatures +//~^ ERROR the type placeholder `_` is not allowed within types on item signatures for unions foo: F, } trait P<F> where F: Fn() -> _ { -//~^ ERROR the type placeholder `_` is not allowed within types on item signatures +//~^ ERROR the type placeholder `_` is not allowed within types on item signatures for traits } trait Q { fn foo<F>(_: F) where F: Fn() -> _ {} - //~^ ERROR the type placeholder `_` is not allowed within types on item signatures + //~^ ERROR the type placeholder `_` is not allowed within types on item signatures for functions } fn main() {} diff --git a/src/test/ui/did_you_mean/bad-assoc-ty.stderr b/src/test/ui/did_you_mean/bad-assoc-ty.stderr index fc5f218c04f..8db9652b1ea 100644 --- a/src/test/ui/did_you_mean/bad-assoc-ty.stderr +++ b/src/test/ui/did_you_mean/bad-assoc-ty.stderr @@ -81,7 +81,7 @@ error[E0223]: ambiguous associated type LL | type D = (u8, u8)::AssocTy; | ^^^^^^^^^^^^^^^^^ help: use fully-qualified syntax: `<(u8, u8) as Trait>::AssocTy` -error[E0121]: the type placeholder `_` is not allowed within types on item signatures +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for type aliases --> $DIR/bad-assoc-ty.rs:17:10 | LL | type E = _::AssocTy; @@ -122,7 +122,7 @@ error[E0223]: ambiguous associated type LL | type I = ty!()::AssocTy; | ^^^^^^^^^^^^^^ help: use fully-qualified syntax: `<u8 as Trait>::AssocTy` -error[E0121]: the type placeholder `_` is not allowed within types on item signatures +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for functions --> $DIR/bad-assoc-ty.rs:49:13 | LL | fn foo<X: K<_, _>>(x: X) {} @@ -135,7 +135,7 @@ help: use type parameters instead LL | fn foo<X: K<T, T>, T>(x: X) {} | ^ ^ ^^^ -error[E0121]: the type placeholder `_` is not allowed within types on item signatures +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for functions --> $DIR/bad-assoc-ty.rs:52:34 | LL | fn bar<F>(_: F) where F: Fn() -> _ {} @@ -146,7 +146,7 @@ help: use type parameters instead LL | fn bar<F, T>(_: F) where F: Fn() -> T {} | ^^^ ^ -error[E0121]: the type placeholder `_` is not allowed within types on item signatures +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for functions --> $DIR/bad-assoc-ty.rs:55:19 | LL | fn baz<F: Fn() -> _>(_: F) {} @@ -157,7 +157,7 @@ help: use type parameters instead LL | fn baz<F: Fn() -> T, T>(_: F) {} | ^^^^ -error[E0121]: the type placeholder `_` is not allowed within types on item signatures +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for structs --> $DIR/bad-assoc-ty.rs:58:33 | LL | struct L<F>(F) where F: Fn() -> _; @@ -168,7 +168,7 @@ help: use type parameters instead LL | struct L<F, T>(F) where F: Fn() -> T; | ^^^ ^ -error[E0121]: the type placeholder `_` is not allowed within types on item signatures +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for structs --> $DIR/bad-assoc-ty.rs:60:30 | LL | struct M<F> where F: Fn() -> _ { @@ -179,7 +179,7 @@ help: use type parameters instead LL | struct M<F, T> where F: Fn() -> T { | ^^^ ^ -error[E0121]: the type placeholder `_` is not allowed within types on item signatures +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for enums --> $DIR/bad-assoc-ty.rs:64:28 | LL | enum N<F> where F: Fn() -> _ { @@ -190,7 +190,7 @@ help: use type parameters instead LL | enum N<F, T> where F: Fn() -> T { | ^^^ ^ -error[E0121]: the type placeholder `_` is not allowed within types on item signatures +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for unions --> $DIR/bad-assoc-ty.rs:69:29 | LL | union O<F> where F: Fn() -> _ { @@ -201,7 +201,7 @@ help: use type parameters instead LL | union O<F, T> where F: Fn() -> T { | ^^^ ^ -error[E0121]: the type placeholder `_` is not allowed within types on item signatures +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for traits --> $DIR/bad-assoc-ty.rs:74:29 | LL | trait P<F> where F: Fn() -> _ { @@ -212,7 +212,7 @@ help: use type parameters instead LL | trait P<F, T> where F: Fn() -> T { | ^^^ ^ -error[E0121]: the type placeholder `_` is not allowed within types on item signatures +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for functions --> $DIR/bad-assoc-ty.rs:79:38 | LL | fn foo<F>(_: F) where F: Fn() -> _ {} diff --git a/src/test/ui/dyn-keyword/dyn-2015-edition-keyword-ident-lint.fixed b/src/test/ui/dyn-keyword/dyn-2015-edition-keyword-ident-lint.fixed index 003736208ed..c815080fc4a 100644 --- a/src/test/ui/dyn-keyword/dyn-2015-edition-keyword-ident-lint.fixed +++ b/src/test/ui/dyn-keyword/dyn-2015-edition-keyword-ident-lint.fixed @@ -3,7 +3,8 @@ // to detect or fix uses of `dyn` under a macro. Since we are testing // this file via `rustfix`, we want the rustfix output to be // compilable; so the macros here carefully use `dyn` "correctly." - +// +// edition:2015 // run-rustfix #![allow(non_camel_case_types)] @@ -12,27 +13,27 @@ mod outer_mod { pub mod r#dyn { //~^ ERROR `dyn` is a keyword -//~| WARN was previously accepted +//~| WARN this is accepted in the current edition pub struct r#dyn; //~^ ERROR `dyn` is a keyword -//~| WARN was previously accepted +//~| WARN this is accepted in the current edition } } use outer_mod::r#dyn::r#dyn; //~^ ERROR `dyn` is a keyword -//~| WARN was previously accepted +//~| WARN this is accepted in the current edition //~| ERROR `dyn` is a keyword -//~| WARN was previously accepted +//~| WARN this is accepted in the current edition fn main() { match r#dyn { r#dyn => {} } //~^ ERROR `dyn` is a keyword -//~| WARN was previously accepted +//~| WARN this is accepted in the current edition //~| ERROR `dyn` is a keyword -//~| WARN was previously accepted +//~| WARN this is accepted in the current edition macro_defn::r#dyn(); //~^ ERROR `dyn` is a keyword -//~| WARN was previously accepted +//~| WARN this is accepted in the current edition macro_defn::boxed(); } @@ -42,7 +43,7 @@ mod macro_defn { macro_rules! r#dyn { //~^ ERROR `dyn` is a keyword -//~| WARN was previously accepted +//~| WARN this is accepted in the current edition // Note that we do not lint nor fix occurrences under macros ($dyn:tt) => { (Box<dyn Trait>, Box<$dyn Trait>) } @@ -50,23 +51,23 @@ mod macro_defn { pub fn r#dyn() -> ::outer_mod::r#dyn::r#dyn { //~^ ERROR `dyn` is a keyword -//~| WARN was previously accepted +//~| WARN this is accepted in the current edition //~| ERROR `dyn` is a keyword -//~| WARN was previously accepted +//~| WARN this is accepted in the current edition //~| ERROR `dyn` is a keyword -//~| WARN was previously accepted +//~| WARN this is accepted in the current edition ::outer_mod::r#dyn::r#dyn //~^ ERROR `dyn` is a keyword -//~| WARN was previously accepted +//~| WARN this is accepted in the current edition //~| ERROR `dyn` is a keyword -//~| WARN was previously accepted +//~| WARN this is accepted in the current edition } pub fn boxed() -> r#dyn!( //~^ ERROR `dyn` is a keyword - //~| WARN was previously accepted + //~| WARN this is accepted in the current edition // Note that we do not lint nor fix occurrences under macros dyn diff --git a/src/test/ui/dyn-keyword/dyn-2015-edition-keyword-ident-lint.rs b/src/test/ui/dyn-keyword/dyn-2015-edition-keyword-ident-lint.rs index 0e5c39fc501..6cdc7071494 100644 --- a/src/test/ui/dyn-keyword/dyn-2015-edition-keyword-ident-lint.rs +++ b/src/test/ui/dyn-keyword/dyn-2015-edition-keyword-ident-lint.rs @@ -3,7 +3,8 @@ // to detect or fix uses of `dyn` under a macro. Since we are testing // this file via `rustfix`, we want the rustfix output to be // compilable; so the macros here carefully use `dyn` "correctly." - +// +// edition:2015 // run-rustfix #![allow(non_camel_case_types)] @@ -12,27 +13,27 @@ mod outer_mod { pub mod dyn { //~^ ERROR `dyn` is a keyword -//~| WARN was previously accepted +//~| WARN this is accepted in the current edition pub struct dyn; //~^ ERROR `dyn` is a keyword -//~| WARN was previously accepted +//~| WARN this is accepted in the current edition } } use outer_mod::dyn::dyn; //~^ ERROR `dyn` is a keyword -//~| WARN was previously accepted +//~| WARN this is accepted in the current edition //~| ERROR `dyn` is a keyword -//~| WARN was previously accepted +//~| WARN this is accepted in the current edition fn main() { match dyn { dyn => {} } //~^ ERROR `dyn` is a keyword -//~| WARN was previously accepted +//~| WARN this is accepted in the current edition //~| ERROR `dyn` is a keyword -//~| WARN was previously accepted +//~| WARN this is accepted in the current edition macro_defn::dyn(); //~^ ERROR `dyn` is a keyword -//~| WARN was previously accepted +//~| WARN this is accepted in the current edition macro_defn::boxed(); } @@ -42,7 +43,7 @@ mod macro_defn { macro_rules! dyn { //~^ ERROR `dyn` is a keyword -//~| WARN was previously accepted +//~| WARN this is accepted in the current edition // Note that we do not lint nor fix occurrences under macros ($dyn:tt) => { (Box<dyn Trait>, Box<$dyn Trait>) } @@ -50,23 +51,23 @@ mod macro_defn { pub fn dyn() -> ::outer_mod::dyn::dyn { //~^ ERROR `dyn` is a keyword -//~| WARN was previously accepted +//~| WARN this is accepted in the current edition //~| ERROR `dyn` is a keyword -//~| WARN was previously accepted +//~| WARN this is accepted in the current edition //~| ERROR `dyn` is a keyword -//~| WARN was previously accepted +//~| WARN this is accepted in the current edition ::outer_mod::dyn::dyn //~^ ERROR `dyn` is a keyword -//~| WARN was previously accepted +//~| WARN this is accepted in the current edition //~| ERROR `dyn` is a keyword -//~| WARN was previously accepted +//~| WARN this is accepted in the current edition } pub fn boxed() -> dyn!( //~^ ERROR `dyn` is a keyword - //~| WARN was previously accepted + //~| WARN this is accepted in the current edition // Note that we do not lint nor fix occurrences under macros dyn diff --git a/src/test/ui/dyn-keyword/dyn-2015-edition-keyword-ident-lint.stderr b/src/test/ui/dyn-keyword/dyn-2015-edition-keyword-ident-lint.stderr index 32f06b62bb4..3eb5bb7b26d 100644 --- a/src/test/ui/dyn-keyword/dyn-2015-edition-keyword-ident-lint.stderr +++ b/src/test/ui/dyn-keyword/dyn-2015-edition-keyword-ident-lint.stderr @@ -1,132 +1,132 @@ error: `dyn` is a keyword in the 2018 edition - --> $DIR/dyn-2015-edition-keyword-ident-lint.rs:13:13 + --> $DIR/dyn-2015-edition-keyword-ident-lint.rs:14:13 | LL | pub mod dyn { | ^^^ help: you can use a raw identifier to stay compatible: `r#dyn` | note: the lint level is defined here - --> $DIR/dyn-2015-edition-keyword-ident-lint.rs:10:9 + --> $DIR/dyn-2015-edition-keyword-ident-lint.rs:11:9 | LL | #![deny(keyword_idents)] | ^^^^^^^^^^^^^^ - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2018 edition! + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716> error: `dyn` is a keyword in the 2018 edition - --> $DIR/dyn-2015-edition-keyword-ident-lint.rs:16:20 + --> $DIR/dyn-2015-edition-keyword-ident-lint.rs:17:20 | LL | pub struct dyn; | ^^^ help: you can use a raw identifier to stay compatible: `r#dyn` | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2018 edition! + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716> error: `dyn` is a keyword in the 2018 edition - --> $DIR/dyn-2015-edition-keyword-ident-lint.rs:21:16 + --> $DIR/dyn-2015-edition-keyword-ident-lint.rs:22:16 | LL | use outer_mod::dyn::dyn; | ^^^ help: you can use a raw identifier to stay compatible: `r#dyn` | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2018 edition! + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716> error: `dyn` is a keyword in the 2018 edition - --> $DIR/dyn-2015-edition-keyword-ident-lint.rs:21:21 + --> $DIR/dyn-2015-edition-keyword-ident-lint.rs:22:21 | LL | use outer_mod::dyn::dyn; | ^^^ help: you can use a raw identifier to stay compatible: `r#dyn` | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2018 edition! + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716> error: `dyn` is a keyword in the 2018 edition - --> $DIR/dyn-2015-edition-keyword-ident-lint.rs:28:11 + --> $DIR/dyn-2015-edition-keyword-ident-lint.rs:29:11 | LL | match dyn { dyn => {} } | ^^^ help: you can use a raw identifier to stay compatible: `r#dyn` | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2018 edition! + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716> error: `dyn` is a keyword in the 2018 edition - --> $DIR/dyn-2015-edition-keyword-ident-lint.rs:28:17 + --> $DIR/dyn-2015-edition-keyword-ident-lint.rs:29:17 | LL | match dyn { dyn => {} } | ^^^ help: you can use a raw identifier to stay compatible: `r#dyn` | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2018 edition! + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716> error: `dyn` is a keyword in the 2018 edition - --> $DIR/dyn-2015-edition-keyword-ident-lint.rs:33:17 + --> $DIR/dyn-2015-edition-keyword-ident-lint.rs:34:17 | LL | macro_defn::dyn(); | ^^^ help: you can use a raw identifier to stay compatible: `r#dyn` | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2018 edition! + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716> error: `dyn` is a keyword in the 2018 edition - --> $DIR/dyn-2015-edition-keyword-ident-lint.rs:43:18 + --> $DIR/dyn-2015-edition-keyword-ident-lint.rs:44:18 | LL | macro_rules! dyn { | ^^^ help: you can use a raw identifier to stay compatible: `r#dyn` | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2018 edition! + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716> error: `dyn` is a keyword in the 2018 edition - --> $DIR/dyn-2015-edition-keyword-ident-lint.rs:51:12 + --> $DIR/dyn-2015-edition-keyword-ident-lint.rs:52:12 | LL | pub fn dyn() -> ::outer_mod::dyn::dyn { | ^^^ help: you can use a raw identifier to stay compatible: `r#dyn` | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2018 edition! + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716> error: `dyn` is a keyword in the 2018 edition - --> $DIR/dyn-2015-edition-keyword-ident-lint.rs:51:34 + --> $DIR/dyn-2015-edition-keyword-ident-lint.rs:52:34 | LL | pub fn dyn() -> ::outer_mod::dyn::dyn { | ^^^ help: you can use a raw identifier to stay compatible: `r#dyn` | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2018 edition! + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716> error: `dyn` is a keyword in the 2018 edition - --> $DIR/dyn-2015-edition-keyword-ident-lint.rs:51:39 + --> $DIR/dyn-2015-edition-keyword-ident-lint.rs:52:39 | LL | pub fn dyn() -> ::outer_mod::dyn::dyn { | ^^^ help: you can use a raw identifier to stay compatible: `r#dyn` | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2018 edition! + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716> error: `dyn` is a keyword in the 2018 edition - --> $DIR/dyn-2015-edition-keyword-ident-lint.rs:58:22 + --> $DIR/dyn-2015-edition-keyword-ident-lint.rs:59:22 | LL | ::outer_mod::dyn::dyn | ^^^ help: you can use a raw identifier to stay compatible: `r#dyn` | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2018 edition! + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716> error: `dyn` is a keyword in the 2018 edition - --> $DIR/dyn-2015-edition-keyword-ident-lint.rs:58:27 + --> $DIR/dyn-2015-edition-keyword-ident-lint.rs:59:27 | LL | ::outer_mod::dyn::dyn | ^^^ help: you can use a raw identifier to stay compatible: `r#dyn` | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2018 edition! + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716> error: `dyn` is a keyword in the 2018 edition - --> $DIR/dyn-2015-edition-keyword-ident-lint.rs:67:23 + --> $DIR/dyn-2015-edition-keyword-ident-lint.rs:68:23 | LL | pub fn boxed() -> dyn!( | ^^^ help: you can use a raw identifier to stay compatible: `r#dyn` | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2018 edition! + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716> error: aborting due to 14 previous errors diff --git a/src/test/ui/dyn-keyword/dyn-2015-idents-in-decl-macros-unlinted.rs b/src/test/ui/dyn-keyword/dyn-2015-idents-in-decl-macros-unlinted.rs index cf14aef7900..bda2ed17ecf 100644 --- a/src/test/ui/dyn-keyword/dyn-2015-idents-in-decl-macros-unlinted.rs +++ b/src/test/ui/dyn-keyword/dyn-2015-idents-in-decl-macros-unlinted.rs @@ -1,11 +1,12 @@ -// build-pass (FIXME(62277): could be check-pass?) - // Under the 2015 edition with the keyword_idents lint, `dyn` is // not entirely acceptable as an identifier. // // We currently do not attempt to detect or fix uses of `dyn` as an // identifier under a macro, including under the declarative `macro` // forms from macros 1.2 and macros 2.0. +// +// check-pass +// edition:2015 #![feature(decl_macro)] #![allow(non_camel_case_types)] diff --git a/src/test/ui/dyn-keyword/dyn-2015-idents-in-macros-unlinted.rs b/src/test/ui/dyn-keyword/dyn-2015-idents-in-macros-unlinted.rs index 0d85b87dee5..472f6b5c8e5 100644 --- a/src/test/ui/dyn-keyword/dyn-2015-idents-in-macros-unlinted.rs +++ b/src/test/ui/dyn-keyword/dyn-2015-idents-in-macros-unlinted.rs @@ -1,10 +1,11 @@ -// build-pass (FIXME(62277): could be check-pass?) - // Under the 2015 edition with the keyword_idents lint, `dyn` is // not entirely acceptable as an identifier. // // We currently do not attempt to detect or fix uses of `dyn` as an // identifier under a macro. +// +// check-pass +// edition:2015 #![allow(non_camel_case_types)] #![deny(keyword_idents)] diff --git a/src/test/ui/dyn-keyword/dyn-2015-no-warnings-without-lints.rs b/src/test/ui/dyn-keyword/dyn-2015-no-warnings-without-lints.rs index 2a8b6b24831..d6a33c08d19 100644 --- a/src/test/ui/dyn-keyword/dyn-2015-no-warnings-without-lints.rs +++ b/src/test/ui/dyn-keyword/dyn-2015-no-warnings-without-lints.rs @@ -1,7 +1,8 @@ // Under the 2015 edition without the keyword_idents lint, `dyn` is // entirely acceptable as an identifier. - -// build-pass (FIXME(62277): could be check-pass?) +// +// check-pass +// edition:2015 #![allow(non_camel_case_types)] diff --git a/src/test/ui/dyn-keyword/dyn-2018-edition-lint.rs b/src/test/ui/dyn-keyword/dyn-2018-edition-lint.rs index 7c2babaf7ab..23ca36b71e0 100644 --- a/src/test/ui/dyn-keyword/dyn-2018-edition-lint.rs +++ b/src/test/ui/dyn-keyword/dyn-2018-edition-lint.rs @@ -3,12 +3,12 @@ fn function(x: &SomeTrait, y: Box<SomeTrait>) { //~^ ERROR trait objects without an explicit `dyn` are deprecated - //~| WARN this was previously accepted + //~| WARN this is accepted in the current edition //~| ERROR trait objects without an explicit `dyn` are deprecated - //~| WARN this was previously accepted + //~| WARN this is accepted in the current edition let _x: &SomeTrait = todo!(); //~^ ERROR trait objects without an explicit `dyn` are deprecated - //~| WARN this was previously accepted + //~| WARN this is accepted in the current edition } trait SomeTrait {} diff --git a/src/test/ui/dyn-keyword/dyn-2018-edition-lint.stderr b/src/test/ui/dyn-keyword/dyn-2018-edition-lint.stderr index ea73e56d843..30f09e22792 100644 --- a/src/test/ui/dyn-keyword/dyn-2018-edition-lint.stderr +++ b/src/test/ui/dyn-keyword/dyn-2018-edition-lint.stderr @@ -9,7 +9,7 @@ note: the lint level is defined here | LL | #[deny(bare_trait_objects)] | ^^^^^^^^^^^^^^^^^^ - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2021 edition! + = warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021! = note: for more information, see issue #80165 <https://github.com/rust-lang/rust/issues/80165> error: trait objects without an explicit `dyn` are deprecated @@ -18,7 +18,7 @@ error: trait objects without an explicit `dyn` are deprecated LL | fn function(x: &SomeTrait, y: Box<SomeTrait>) { | ^^^^^^^^^ help: use `dyn`: `dyn SomeTrait` | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2021 edition! + = warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021! = note: for more information, see issue #80165 <https://github.com/rust-lang/rust/issues/80165> error: trait objects without an explicit `dyn` are deprecated @@ -27,7 +27,7 @@ error: trait objects without an explicit `dyn` are deprecated LL | let _x: &SomeTrait = todo!(); | ^^^^^^^^^ help: use `dyn`: `dyn SomeTrait` | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2021 edition! + = warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021! = note: for more information, see issue #80165 <https://github.com/rust-lang/rust/issues/80165> error: aborting due to 3 previous errors diff --git a/src/test/ui/dyn-keyword/issue-56327-dyn-trait-in-macro-is-okay.rs b/src/test/ui/dyn-keyword/issue-56327-dyn-trait-in-macro-is-okay.rs index 4cb9bd1975a..2b46f57c2e2 100644 --- a/src/test/ui/dyn-keyword/issue-56327-dyn-trait-in-macro-is-okay.rs +++ b/src/test/ui/dyn-keyword/issue-56327-dyn-trait-in-macro-is-okay.rs @@ -1,5 +1,6 @@ // check-pass - +// edition:2015 +// // rust-lang/rust#56327: Some occurrences of `dyn` within a macro are // not instances of identifiers, and thus should *not* be caught by the // keyword_ident lint. diff --git a/src/test/ui/dynamically-sized-types/dst-index.rs b/src/test/ui/dynamically-sized-types/dst-index.rs index 980d99a6d6c..8aa65bbfdc9 100644 --- a/src/test/ui/dynamically-sized-types/dst-index.rs +++ b/src/test/ui/dynamically-sized-types/dst-index.rs @@ -29,6 +29,6 @@ impl Index<usize> for T { fn main() { assert_eq!(&S[0], "hello"); - &T[0]; + let _ = &T[0]; // let x = &x as &Debug; } diff --git a/src/test/ui/editions/edition-feature-ok.rs b/src/test/ui/editions/edition-feature-ok.rs index 12642132694..69242fd715c 100644 --- a/src/test/ui/editions/edition-feature-ok.rs +++ b/src/test/ui/editions/edition-feature-ok.rs @@ -1,4 +1,4 @@ -// build-pass (FIXME(62277): could be check-pass?) +// check-pass #![feature(rust_2018_preview)] diff --git a/src/test/ui/editions/edition-imports-virtual-2015-ambiguity.rs b/src/test/ui/editions/edition-imports-virtual-2015-ambiguity.rs index 310bff21d18..3fffb30c612 100644 --- a/src/test/ui/editions/edition-imports-virtual-2015-ambiguity.rs +++ b/src/test/ui/editions/edition-imports-virtual-2015-ambiguity.rs @@ -1,4 +1,4 @@ -// build-pass (FIXME(62277): could be check-pass?) +// check-pass // edition:2018 // compile-flags:--extern edition_imports_2015 // aux-build:edition-imports-2015.rs diff --git a/src/test/ui/editions/edition-keywords-2015-2015-expansion.rs b/src/test/ui/editions/edition-keywords-2015-2015-expansion.rs index 9c3beb1ce58..b2695bea5c3 100644 --- a/src/test/ui/editions/edition-keywords-2015-2015-expansion.rs +++ b/src/test/ui/editions/edition-keywords-2015-2015-expansion.rs @@ -1,6 +1,6 @@ // edition:2015 // aux-build:edition-kw-macro-2015.rs -// build-pass (FIXME(62277): could be check-pass?) +// check-pass #![allow(keyword_idents)] diff --git a/src/test/ui/editions/edition-keywords-2018-2015-expansion.rs b/src/test/ui/editions/edition-keywords-2018-2015-expansion.rs index 619e6424db4..707d8e95c14 100644 --- a/src/test/ui/editions/edition-keywords-2018-2015-expansion.rs +++ b/src/test/ui/editions/edition-keywords-2018-2015-expansion.rs @@ -1,6 +1,6 @@ // edition:2018 // aux-build:edition-kw-macro-2015.rs -// build-pass (FIXME(62277): could be check-pass?) +// check-pass #![allow(keyword_idents)] diff --git a/src/test/ui/editions/edition-raw-pointer-method-2015.rs b/src/test/ui/editions/edition-raw-pointer-method-2015.rs index 3631415fc5f..fcfe493c1a2 100644 --- a/src/test/ui/editions/edition-raw-pointer-method-2015.rs +++ b/src/test/ui/editions/edition-raw-pointer-method-2015.rs @@ -8,5 +8,5 @@ fn main() { let y = &x as *const _; let _ = y.is_null(); //~^ error: type annotations needed [tyvar_behind_raw_pointer] - //~^^ warning: this was previously accepted + //~^^ warning: this is accepted in the current edition } diff --git a/src/test/ui/editions/edition-raw-pointer-method-2015.stderr b/src/test/ui/editions/edition-raw-pointer-method-2015.stderr index 1df582ee06c..417daf36fca 100644 --- a/src/test/ui/editions/edition-raw-pointer-method-2015.stderr +++ b/src/test/ui/editions/edition-raw-pointer-method-2015.stderr @@ -10,7 +10,7 @@ note: the lint level is defined here LL | #[deny(warnings)] | ^^^^^^^^ = note: `#[deny(tyvar_behind_raw_pointer)]` implied by `#[deny(warnings)]` - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2018 edition! + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #46906 <https://github.com/rust-lang/rust/issues/46906> error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0121.rs b/src/test/ui/error-codes/E0121.rs index f8b4d61b323..98cd6d54c1f 100644 --- a/src/test/ui/error-codes/E0121.rs +++ b/src/test/ui/error-codes/E0121.rs @@ -2,5 +2,4 @@ fn foo() -> _ { 5 } //~ ERROR E0121 static BAR: _ = "test"; //~ ERROR E0121 -fn main() { -} +fn main() {} diff --git a/src/test/ui/error-codes/E0121.stderr b/src/test/ui/error-codes/E0121.stderr index 246f69558ff..cc0c2df72ea 100644 --- a/src/test/ui/error-codes/E0121.stderr +++ b/src/test/ui/error-codes/E0121.stderr @@ -1,4 +1,4 @@ -error[E0121]: the type placeholder `_` is not allowed within types on item signatures +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for return types --> $DIR/E0121.rs:1:13 | LL | fn foo() -> _ { 5 } @@ -7,7 +7,7 @@ LL | fn foo() -> _ { 5 } | not allowed in type signatures | help: replace with the correct return type: `i32` -error[E0121]: the type placeholder `_` is not allowed within types on item signatures +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for static variables --> $DIR/E0121.rs:3:13 | LL | static BAR: _ = "test"; diff --git a/src/test/ui/fmt/format-concat-span.rs b/src/test/ui/fmt/format-concat-span.rs new file mode 100644 index 00000000000..ce92df0ad92 --- /dev/null +++ b/src/test/ui/fmt/format-concat-span.rs @@ -0,0 +1,15 @@ +// If the format string is another macro invocation, rustc would previously +// compute nonsensical spans, such as: +// +// error: invalid format string: unmatched `}` found +// --> test.rs:2:17 +// | +// 2 | format!(concat!("abc}")); +// | ^ unmatched `}` in format string +// +// This test checks that this behavior has been fixed. + +fn main() { + format!(concat!("abc}")); + //~^ ERROR: invalid format string: unmatched `}` found +} diff --git a/src/test/ui/fmt/format-concat-span.stderr b/src/test/ui/fmt/format-concat-span.stderr new file mode 100644 index 00000000000..da46f40abcb --- /dev/null +++ b/src/test/ui/fmt/format-concat-span.stderr @@ -0,0 +1,11 @@ +error: invalid format string: unmatched `}` found + --> $DIR/format-concat-span.rs:13:13 + | +LL | format!(concat!("abc}")); + | ^^^^^^^^^^^^^^^ unmatched `}` in format string + | + = note: if you intended to print `}`, you can escape it using `}}` + = note: this error originates in the macro `concat` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: aborting due to previous error + diff --git a/src/test/ui/fmt/issue-86085.rs b/src/test/ui/fmt/issue-86085.rs new file mode 100644 index 00000000000..63d42b76969 --- /dev/null +++ b/src/test/ui/fmt/issue-86085.rs @@ -0,0 +1,6 @@ +// Tests for an ICE with the fuzzed input below. + +fn main ( ) { +format ! ( concat ! ( r#"lJÆ�.�"# , "r} {}" ) ) ; +//~^ ERROR: invalid format string: unmatched `}` found +} diff --git a/src/test/ui/fmt/issue-86085.stderr b/src/test/ui/fmt/issue-86085.stderr new file mode 100644 index 00000000000..ee7d8a5cc23 --- /dev/null +++ b/src/test/ui/fmt/issue-86085.stderr @@ -0,0 +1,11 @@ +error: invalid format string: unmatched `}` found + --> $DIR/issue-86085.rs:4:12 + | +LL | format ! ( concat ! ( r#"lJÆ�.�"# , "r} {}" ) ) ; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unmatched `}` in format string + | + = note: if you intended to print `}`, you can escape it using `}}` + = note: this error originates in the macro `concat` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: aborting due to previous error + diff --git a/src/test/ui/fn/issue-80179.rs b/src/test/ui/fn/issue-80179.rs index 7609b1525cc..550974bf778 100644 --- a/src/test/ui/fn/issue-80179.rs +++ b/src/test/ui/fn/issue-80179.rs @@ -8,7 +8,7 @@ fn returns_i32() -> i32 { } fn returns_fn_ptr() -> _ { -//~^ ERROR the type placeholder `_` is not allowed within types on item signatures [E0121] +//~^ ERROR the type placeholder `_` is not allowed within types on item signatures for return types [E0121] //~| NOTE not allowed in type signatures //~| HELP replace with the correct return type //~| SUGGESTION fn() -> i32 @@ -16,7 +16,7 @@ fn returns_fn_ptr() -> _ { } fn returns_closure() -> _ { -//~^ ERROR the type placeholder `_` is not allowed within types on item signatures [E0121] +//~^ ERROR the type placeholder `_` is not allowed within types on item signatures for return types [E0121] //~| NOTE not allowed in type signatures //~| HELP consider using an `Fn`, `FnMut`, or `FnOnce` trait bound //~| NOTE for more information on `Fn` traits and closure types, see diff --git a/src/test/ui/fn/issue-80179.stderr b/src/test/ui/fn/issue-80179.stderr index 63571e71b34..96d0f02b01a 100644 --- a/src/test/ui/fn/issue-80179.stderr +++ b/src/test/ui/fn/issue-80179.stderr @@ -1,4 +1,4 @@ -error[E0121]: the type placeholder `_` is not allowed within types on item signatures +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for return types --> $DIR/issue-80179.rs:10:24 | LL | fn returns_fn_ptr() -> _ { @@ -7,7 +7,7 @@ LL | fn returns_fn_ptr() -> _ { | not allowed in type signatures | help: replace with the correct return type: `fn() -> i32` -error[E0121]: the type placeholder `_` is not allowed within types on item signatures +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for return types --> $DIR/issue-80179.rs:18:25 | LL | fn returns_closure() -> _ { diff --git a/src/test/ui/function-pointer/function-pointer-comparison-issue-54685.rs b/src/test/ui/function-pointer/function-pointer-comparison-issue-54685.rs new file mode 100644 index 00000000000..a036d10e639 --- /dev/null +++ b/src/test/ui/function-pointer/function-pointer-comparison-issue-54685.rs @@ -0,0 +1,31 @@ +// min-llvm-version: 12.0 +// compile-flags: -C opt-level=3 +// run-pass + +fn foo(_i: i32) -> i32 { + 1 +} +fn bar(_i: i32) -> i32 { + 1 +} + +fn main() { + let x: fn(i32) -> i32 = foo; + let y: fn(i32) -> i32 = bar; + + let s1; + if x == y { + s1 = "same".to_string(); + } else { + s1 = format!("{:?}, {:?}", x, y); + } + + let s2; + if x == y { + s2 = "same".to_string(); + } else { + s2 = format!("{:?}, {:?}", x, y); + } + + assert_eq!(s1, s2); +} diff --git a/src/test/ui/future-incompatible-lint-group.rs b/src/test/ui/future-incompatible-lint-group.rs index 3630f08c937..ce158043e54 100644 --- a/src/test/ui/future-incompatible-lint-group.rs +++ b/src/test/ui/future-incompatible-lint-group.rs @@ -2,7 +2,7 @@ trait Tr { fn f(u8) {} //~ ERROR anonymous parameters are deprecated - //~^ WARN this was previously accepted + //~^ WARN this is accepted in the current edition } fn main() {} diff --git a/src/test/ui/future-incompatible-lint-group.stderr b/src/test/ui/future-incompatible-lint-group.stderr index a19051e8bc0..16028261eb1 100644 --- a/src/test/ui/future-incompatible-lint-group.stderr +++ b/src/test/ui/future-incompatible-lint-group.stderr @@ -10,7 +10,7 @@ note: the lint level is defined here LL | #![deny(future_incompatible)] | ^^^^^^^^^^^^^^^^^^^ = note: `#[deny(anonymous_parameters)]` implied by `#[deny(future_incompatible)]` - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2018 edition! + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #41686 <https://github.com/rust-lang/rust/issues/41686> error: aborting due to previous error diff --git a/src/test/ui/generator/too-live-local-in-immovable-gen.rs b/src/test/ui/generator/too-live-local-in-immovable-gen.rs index 7f118c88e5e..e0b856db7a5 100644 --- a/src/test/ui/generator/too-live-local-in-immovable-gen.rs +++ b/src/test/ui/generator/too-live-local-in-immovable-gen.rs @@ -15,7 +15,7 @@ fn main() { yield (); 4i32 }; - &a; + let _ = &a; }; } } diff --git a/src/test/ui/generator/too-live-local-in-immovable-gen.stderr b/src/test/ui/generator/too-live-local-in-immovable-gen.stderr index 88dacff7b55..72a2bd4ebc5 100644 --- a/src/test/ui/generator/too-live-local-in-immovable-gen.stderr +++ b/src/test/ui/generator/too-live-local-in-immovable-gen.stderr @@ -6,7 +6,7 @@ LL | | // Tests that the generator transformation finds out that `a` LL | | // during the yield expression. Type checking will also compute liveness LL | | // and it should also find out that `a` is not live. ... | -LL | | &a; +LL | | let _ = &a; LL | | }; | |__________^ | diff --git a/src/test/ui/generator/yield-in-initializer.rs b/src/test/ui/generator/yield-in-initializer.rs index 2f8754c9571..0cab36e5f28 100644 --- a/src/test/ui/generator/yield-in-initializer.rs +++ b/src/test/ui/generator/yield-in-initializer.rs @@ -11,7 +11,7 @@ fn main() { yield; true }; - &opt; + let _ = &opt; } }; } diff --git a/src/test/ui/generic-associated-types/collections-project-default.rs b/src/test/ui/generic-associated-types/collections-project-default.rs index 5fbae02573c..65541fc3ae6 100644 --- a/src/test/ui/generic-associated-types/collections-project-default.rs +++ b/src/test/ui/generic-associated-types/collections-project-default.rs @@ -3,7 +3,7 @@ #![feature(associated_type_defaults)] // A Collection trait and collection families. Based on -// http://smallcultfollowing.com/babysteps/blog/2016/11/03/ +// https://smallcultfollowing.com/babysteps/blog/2016/11/03/ // associated-type-constructors-part-2-family-traits/ // check that we don't normalize with trait defaults. diff --git a/src/test/ui/generic-associated-types/collections.rs b/src/test/ui/generic-associated-types/collections.rs index 1b5b9c181fb..4e8f593c1fd 100644 --- a/src/test/ui/generic-associated-types/collections.rs +++ b/src/test/ui/generic-associated-types/collections.rs @@ -3,7 +3,7 @@ #![feature(associated_type_defaults)] // A Collection trait and collection families. Based on -// http://smallcultfollowing.com/babysteps/blog/2016/11/03/ +// https://smallcultfollowing.com/babysteps/blog/2016/11/03/ // associated-type-constructors-part-2-family-traits/ // run-pass diff --git a/src/test/ui/generic-associated-types/gat-trait-path-parenthesised-args.rs b/src/test/ui/generic-associated-types/gat-trait-path-parenthesised-args.rs index f1af6860284..b656382bced 100644 --- a/src/test/ui/generic-associated-types/gat-trait-path-parenthesised-args.rs +++ b/src/test/ui/generic-associated-types/gat-trait-path-parenthesised-args.rs @@ -11,6 +11,6 @@ fn foo<'a>(arg: Box<dyn X<Y('a) = &'a ()>>) {} //~| ERROR this associated type takes 0 generic arguments but 1 generic argument //~| ERROR this associated type takes 1 lifetime argument but 0 lifetime arguments //~| WARNING: trait objects without an explicit `dyn` are deprecated - //~| WARNING: this was previously accepted by the compiler + //~| WARNING: this is accepted in the current edition fn main() {} diff --git a/src/test/ui/generic-associated-types/gat-trait-path-parenthesised-args.stderr b/src/test/ui/generic-associated-types/gat-trait-path-parenthesised-args.stderr index 400600a086c..34554d38520 100644 --- a/src/test/ui/generic-associated-types/gat-trait-path-parenthesised-args.stderr +++ b/src/test/ui/generic-associated-types/gat-trait-path-parenthesised-args.stderr @@ -26,7 +26,7 @@ LL | fn foo<'a>(arg: Box<dyn X<Y('a) = &'a ()>>) {} | ^^ help: use `dyn`: `dyn 'a` | = note: `#[warn(bare_trait_objects)]` on by default - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2021 edition! + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! = note: for more information, see issue #80165 <https://github.com/rust-lang/rust/issues/80165> error[E0107]: this associated type takes 1 lifetime argument but 0 lifetime arguments were supplied diff --git a/src/test/ui/generic-associated-types/issue-86483.rs b/src/test/ui/generic-associated-types/issue-86483.rs new file mode 100644 index 00000000000..9d03c9dab8d --- /dev/null +++ b/src/test/ui/generic-associated-types/issue-86483.rs @@ -0,0 +1,15 @@ +// Regression test of #86483. + +#![feature(generic_associated_types)] +#![allow(incomplete_features)] + +pub trait IceIce<T> //~ ERROR: the parameter type `T` may not live long enough +where + for<'a> T: 'a, +{ + type Ice<'v>: IntoIterator<Item = &'v T>; + //~^ ERROR: the parameter type `T` may not live long enough + //~| ERROR: the parameter type `T` may not live long enough +} + +fn main() {} diff --git a/src/test/ui/generic-associated-types/issue-86483.stderr b/src/test/ui/generic-associated-types/issue-86483.stderr new file mode 100644 index 00000000000..c8efc2ed882 --- /dev/null +++ b/src/test/ui/generic-associated-types/issue-86483.stderr @@ -0,0 +1,36 @@ +error[E0311]: the parameter type `T` may not live long enough + --> $DIR/issue-86483.rs:6:1 + | +LL | pub trait IceIce<T> + | ^ - help: consider adding an explicit lifetime bound...: `T: 'a` + | _| + | | +LL | | where +LL | | for<'a> T: 'a, +LL | | { +... | +LL | | +LL | | } + | |_^ ...so that the type `T` will meet its required lifetime bounds + +error[E0311]: the parameter type `T` may not live long enough + --> $DIR/issue-86483.rs:10:5 + | +LL | pub trait IceIce<T> + | - help: consider adding an explicit lifetime bound...: `T: 'a` +... +LL | type Ice<'v>: IntoIterator<Item = &'v T>; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds + +error[E0309]: the parameter type `T` may not live long enough + --> $DIR/issue-86483.rs:10:32 + | +LL | pub trait IceIce<T> + | - help: consider adding an explicit lifetime bound...: `T: 'v` +... +LL | type Ice<'v>: IntoIterator<Item = &'v T>; + | ^^^^^^^^^^^^ ...so that the reference type `&'v T` does not outlive the data it points at + +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0309`. diff --git a/src/test/ui/include-macros/auxiliary/same-file-in-two-crates-aux.rs b/src/test/ui/include-macros/auxiliary/same-file-in-two-crates-aux.rs new file mode 100644 index 00000000000..7b680bce49e --- /dev/null +++ b/src/test/ui/include-macros/auxiliary/same-file-in-two-crates-aux.rs @@ -0,0 +1,4 @@ +#[inline] +pub fn some_function() -> u32 { + 1 +} diff --git a/src/test/ui/include-macros/same-file-in-two-crates.rs b/src/test/ui/include-macros/same-file-in-two-crates.rs new file mode 100644 index 00000000000..f49efa2cf8a --- /dev/null +++ b/src/test/ui/include-macros/same-file-in-two-crates.rs @@ -0,0 +1,21 @@ +// This test makes sure that the compiler can handle the same source file to be +// part of the local crate *and* an upstream crate. This can happen, for example, +// when there is some auto-generated code that is part of both a library and an +// accompanying integration test. +// +// The test uses include!() to include a source file that is also part of +// an upstream crate. +// +// This is a regression test for https://github.com/rust-lang/rust/issues/85955. + +// check-pass +// compile-flags: --crate-type=rlib +// aux-build:same-file-in-two-crates-aux.rs +extern crate same_file_in_two_crates_aux; + +pub fn foo() -> u32 { + same_file_in_two_crates_aux::some_function() + + some_function() +} + +include!("./auxiliary/same-file-in-two-crates-aux.rs"); diff --git a/src/test/ui/inference/inference-variable-behind-raw-pointer.rs b/src/test/ui/inference/inference-variable-behind-raw-pointer.rs index 1d508e8e820..6662e46b1c7 100644 --- a/src/test/ui/inference/inference-variable-behind-raw-pointer.rs +++ b/src/test/ui/inference/inference-variable-behind-raw-pointer.rs @@ -7,5 +7,5 @@ fn main() { let _ = &data as *const *const (); if data.is_null() {} //~^ WARNING type annotations needed - //~| WARNING this was previously accepted by the compiler but is being phased out + //~| WARNING this is accepted in the current edition } diff --git a/src/test/ui/inference/inference-variable-behind-raw-pointer.stderr b/src/test/ui/inference/inference-variable-behind-raw-pointer.stderr index 12848982b8d..c38f57912ad 100644 --- a/src/test/ui/inference/inference-variable-behind-raw-pointer.stderr +++ b/src/test/ui/inference/inference-variable-behind-raw-pointer.stderr @@ -5,7 +5,7 @@ LL | if data.is_null() {} | ^^^^^^^ | = note: `#[warn(tyvar_behind_raw_pointer)]` on by default - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2018 edition! + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #46906 <https://github.com/rust-lang/rust/issues/46906> warning: 1 warning emitted diff --git a/src/test/ui/issues/issue-20644.rs b/src/test/ui/issues/issue-20644.rs index 71c6746e0e0..1b90727fbc0 100644 --- a/src/test/ui/issues/issue-20644.rs +++ b/src/test/ui/issues/issue-20644.rs @@ -19,9 +19,7 @@ use std::path::Path; pub fn parse_summary<R: Read>(_: R, _: &Path) { let path_from_root = Path::new(""); - Path::new(&iter::repeat("../") - .take(path_from_root.components().count() - 1) - .collect::<String>()); + Path::new(&"../".repeat(path_from_root.components().count() - 1)); } fn foo() { diff --git a/src/test/ui/issues/issue-27895.rs b/src/test/ui/issues/issue-27895.rs deleted file mode 100644 index 0018ac1bdf1..00000000000 --- a/src/test/ui/issues/issue-27895.rs +++ /dev/null @@ -1,10 +0,0 @@ -fn main() { - let i = 5; - let index = 6; - - match i { - 0..=index => println!("winner"), - //~^ ERROR runtime values cannot be referenced in patterns - _ => println!("hello"), - } -} diff --git a/src/test/ui/issues/issue-27895.stderr b/src/test/ui/issues/issue-27895.stderr deleted file mode 100644 index 55bd938b0bf..00000000000 --- a/src/test/ui/issues/issue-27895.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0080]: runtime values cannot be referenced in patterns - --> $DIR/issue-27895.rs:6:13 - | -LL | 0..=index => println!("winner"), - | ^^^^^ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0080`. diff --git a/src/test/ui/issues/issue-43205.rs b/src/test/ui/issues/issue-43205.rs index 894a61f3eff..f47d5a347bb 100644 --- a/src/test/ui/issues/issue-43205.rs +++ b/src/test/ui/issues/issue-43205.rs @@ -1,5 +1,5 @@ // run-pass fn main() { - &&[()][0]; + let _ = &&[()][0]; println!("{:?}", &[(),()][1]); } diff --git a/src/test/ui/issues/issue-51714.rs b/src/test/ui/issues/issue-51714.rs index 0dc588d75c6..8716524d6f4 100644 --- a/src/test/ui/issues/issue-51714.rs +++ b/src/test/ui/issues/issue-51714.rs @@ -1,13 +1,21 @@ fn main() { +//~^ NOTE: not the enclosing function body +//~| NOTE: not the enclosing function body +//~| NOTE: not the enclosing function body +//~| NOTE: not the enclosing function body |_: [_; return || {}] | {}; - //~^ ERROR return statement outside of function body + //~^ ERROR: return statement outside of function body [E0572] + //~| NOTE: the return is part of this body... [(); return || {}]; - //~^ ERROR return statement outside of function body + //~^ ERROR: return statement outside of function body [E0572] + //~| NOTE: the return is part of this body... [(); return |ice| {}]; - //~^ ERROR return statement outside of function body + //~^ ERROR: return statement outside of function body [E0572] + //~| NOTE: the return is part of this body... [(); return while let Some(n) = Some(0) {}]; - //~^ ERROR return statement outside of function body + //~^ ERROR: return statement outside of function body [E0572] + //~| NOTE: the return is part of this body... } diff --git a/src/test/ui/issues/issue-51714.stderr b/src/test/ui/issues/issue-51714.stderr index 023d9013ab4..514d69c1c7d 100644 --- a/src/test/ui/issues/issue-51714.stderr +++ b/src/test/ui/issues/issue-51714.stderr @@ -1,26 +1,62 @@ error[E0572]: return statement outside of function body - --> $DIR/issue-51714.rs:2:14 + --> $DIR/issue-51714.rs:6:14 | -LL | |_: [_; return || {}] | {}; - | ^^^^^^^^^^^^ +LL | / fn main() { +LL | | +LL | | +LL | | +LL | | +LL | | |_: [_; return || {}] | {}; + | | ^^^^^^^^^^^^ the return is part of this body... +... | +LL | | +LL | | } + | |_- ...not the enclosing function body error[E0572]: return statement outside of function body - --> $DIR/issue-51714.rs:5:10 + --> $DIR/issue-51714.rs:10:10 | -LL | [(); return || {}]; - | ^^^^^^^^^^^^ +LL | / fn main() { +LL | | +LL | | +LL | | +... | +LL | | [(); return || {}]; + | | ^^^^^^^^^^^^ the return is part of this body... +... | +LL | | +LL | | } + | |_- ...not the enclosing function body error[E0572]: return statement outside of function body - --> $DIR/issue-51714.rs:8:10 + --> $DIR/issue-51714.rs:14:10 | -LL | [(); return |ice| {}]; - | ^^^^^^^^^^^^^^^ +LL | / fn main() { +LL | | +LL | | +LL | | +... | +LL | | [(); return |ice| {}]; + | | ^^^^^^^^^^^^^^^ the return is part of this body... +... | +LL | | +LL | | } + | |_- ...not the enclosing function body error[E0572]: return statement outside of function body - --> $DIR/issue-51714.rs:11:10 + --> $DIR/issue-51714.rs:18:10 | -LL | [(); return while let Some(n) = Some(0) {}]; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | / fn main() { +LL | | +LL | | +LL | | +... | +LL | | [(); return while let Some(n) = Some(0) {}]; + | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the return is part of this body... +LL | | +LL | | +LL | | } + | |_- ...not the enclosing function body error: aborting due to 4 previous errors diff --git a/src/test/ui/issues/issue-5280.rs b/src/test/ui/issues/issue-5280.rs index 3c97dad6b14..5c5ce6c987a 100644 --- a/src/test/ui/issues/issue-5280.rs +++ b/src/test/ui/issues/issue-5280.rs @@ -9,7 +9,7 @@ trait FontTableTagConversions { impl FontTableTagConversions for FontTableTag { fn tag_to_string(self) { - &self; + let _ = &self; } } diff --git a/src/test/ui/issues/issue-54696.rs b/src/test/ui/issues/issue-54696.rs index d8408ed8549..15355d30db6 100644 --- a/src/test/ui/issues/issue-54696.rs +++ b/src/test/ui/issues/issue-54696.rs @@ -2,7 +2,7 @@ fn main() { // We shouldn't promote this - &(main as fn() == main as fn()); + let _ = &(main as fn() == main as fn()); // Also check nested case - &(&(main as fn()) == &(main as fn())); + let _ = &(&(main as fn()) == &(main as fn())); } diff --git a/src/test/ui/issues/issue-59488.stderr b/src/test/ui/issues/issue-59488.stderr index 93d2f3001f8..46d1f992411 100644 --- a/src/test/ui/issues/issue-59488.stderr +++ b/src/test/ui/issues/issue-59488.stderr @@ -84,11 +84,6 @@ error[E0277]: `fn(usize) -> Foo {Foo::Bar}` doesn't implement `Debug` | LL | assert_eq!(Foo::Bar, i); | ^^^^^^^^^^^^^^^^^^^^^^^^ `fn(usize) -> Foo {Foo::Bar}` cannot be formatted using `{:?}` because it doesn't implement `Debug` - | - ::: $SRC_DIR/core/src/panicking.rs:LL:COL - | -LL | T: fmt::Debug + ?Sized, - | ---------- required by this bound in `core::panicking::assert_failed` | = help: the trait `Debug` is not implemented for `fn(usize) -> Foo {Foo::Bar}` = note: this error originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/src/test/ui/issues/issue-69396-const-no-type-in-macro.rs b/src/test/ui/issues/issue-69396-const-no-type-in-macro.rs index 69fc0c1cbb9..6880e1a4629 100644 --- a/src/test/ui/issues/issue-69396-const-no-type-in-macro.rs +++ b/src/test/ui/issues/issue-69396-const-no-type-in-macro.rs @@ -4,7 +4,7 @@ macro_rules! suite { const A = "A".$fn(); //~^ ERROR the name `A` is defined multiple times //~| ERROR missing type for `const` item - //~| ERROR the type placeholder `_` is not allowed within types + //~| ERROR the type placeholder `_` is not allowed within types on item signatures for constants )* } } diff --git a/src/test/ui/issues/issue-69396-const-no-type-in-macro.stderr b/src/test/ui/issues/issue-69396-const-no-type-in-macro.stderr index a84c048fab9..34c2073db04 100644 --- a/src/test/ui/issues/issue-69396-const-no-type-in-macro.stderr +++ b/src/test/ui/issues/issue-69396-const-no-type-in-macro.stderr @@ -20,7 +20,7 @@ error: missing type for `const` item --> $DIR/issue-69396-const-no-type-in-macro.rs:4:19 | LL | const A = "A".$fn(); - | ^ help: provide a type for the item: `A: usize` + | ^ help: provide a type for the constant: `A: usize` ... LL | / suite! { LL | | len; @@ -30,7 +30,7 @@ LL | | } | = note: this error originates in the macro `suite` (in Nightly builds, run with -Z macro-backtrace for more info) -error[E0121]: the type placeholder `_` is not allowed within types on item signatures +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for constants --> $DIR/issue-69396-const-no-type-in-macro.rs:4:19 | LL | const A = "A".$fn(); diff --git a/src/test/ui/issues/issue-70724-add_type_neq_err_label-unwrap.stderr b/src/test/ui/issues/issue-70724-add_type_neq_err_label-unwrap.stderr index 0f095f5a77b..f074a99e5ec 100644 --- a/src/test/ui/issues/issue-70724-add_type_neq_err_label-unwrap.stderr +++ b/src/test/ui/issues/issue-70724-add_type_neq_err_label-unwrap.stderr @@ -28,11 +28,6 @@ LL | fn a() -> i32 { ... LL | assert_eq!(a, 0); | ^^^^^^^^^^^^^^^^^ `fn() -> i32 {a}` cannot be formatted using `{:?}` because it doesn't implement `Debug` - | - ::: $SRC_DIR/core/src/panicking.rs:LL:COL - | -LL | T: fmt::Debug + ?Sized, - | ---------- required by this bound in `core::panicking::assert_failed` | = help: the trait `Debug` is not implemented for `fn() -> i32 {a}` = help: use parentheses to call the function: `a()` diff --git a/src/test/ui/iterators/into-iter-on-arrays-2018.rs b/src/test/ui/iterators/into-iter-on-arrays-2018.rs index 5661397b3c1..e56c2956a69 100644 --- a/src/test/ui/iterators/into-iter-on-arrays-2018.rs +++ b/src/test/ui/iterators/into-iter-on-arrays-2018.rs @@ -12,12 +12,12 @@ fn main() { // Before 2021, the method dispatched to `IntoIterator for &[T; N]`, // which we continue to support for compatibility. let _: Iter<'_, i32> = array.into_iter(); - //~^ WARNING this method call currently resolves to `<&[T; N] as IntoIterator>::into_iter` - //~| WARNING this was previously accepted by the compiler but is being phased out + //~^ WARNING this method call resolves to `<&[T; N] as IntoIterator>::into_iter` + //~| WARNING this changes meaning let _: Iter<'_, i32> = Box::new(array).into_iter(); - //~^ WARNING this method call currently resolves to `<&[T; N] as IntoIterator>::into_iter` - //~| WARNING this was previously accepted by the compiler but is being phased out + //~^ WARNING this method call resolves to `<&[T; N] as IntoIterator>::into_iter` + //~| WARNING this changes meaning // The `array_into_iter` lint doesn't cover other wrappers that deref to an array. let _: Iter<'_, i32> = Rc::new(array).into_iter(); @@ -25,6 +25,10 @@ fn main() { // But you can always use the trait method explicitly as an array. let _: IntoIter<i32, 10> = IntoIterator::into_iter(array); + + for _ in [1, 2, 3].into_iter() {} + //~^ WARNING this method call resolves to `<&[T; N] as IntoIterator>::into_iter` + //~| WARNING this changes meaning } /// User type that dereferences to an array. diff --git a/src/test/ui/iterators/into-iter-on-arrays-2018.stderr b/src/test/ui/iterators/into-iter-on-arrays-2018.stderr index b43338382f2..3bd3ca6e875 100644 --- a/src/test/ui/iterators/into-iter-on-arrays-2018.stderr +++ b/src/test/ui/iterators/into-iter-on-arrays-2018.stderr @@ -1,42 +1,54 @@ -warning: this method call currently resolves to `<&[T; N] as IntoIterator>::into_iter` (due to autoref coercions), but that might change in the future when `IntoIterator` impls for arrays are added. +warning: this method call resolves to `<&[T; N] as IntoIterator>::into_iter` (due to backwards compatibility), but will resolve to <[T; N] as IntoIterator>::into_iter in Rust 2021. --> $DIR/into-iter-on-arrays-2018.rs:14:34 | LL | let _: Iter<'_, i32> = array.into_iter(); - | ^^^^^^^^^ help: use `.iter()` instead of `.into_iter()` to avoid ambiguity: `iter` + | ^^^^^^^^^ | = note: `#[warn(array_into_iter)]` 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! + = warning: this changes meaning in Rust 2021 = note: for more information, see issue #66145 <https://github.com/rust-lang/rust/issues/66145> +help: use `.iter()` instead of `.into_iter()` to avoid ambiguity + | +LL | let _: Iter<'_, i32> = array.iter(); + | ^^^^ +help: or use `IntoIterator::into_iter(..)` instead of `.into_iter()` to explicitly iterate by value + | +LL | let _: Iter<'_, i32> = IntoIterator::into_iter(array); + | ^^^^^^^^^^^^^^^^^^^^^^^^ ^ -warning: this method call currently resolves to `<&[T; N] as IntoIterator>::into_iter` (due to autoref coercions), but that might change in the future when `IntoIterator` impls for arrays are added. +warning: this method call resolves to `<&[T; N] as IntoIterator>::into_iter` (due to backwards compatibility), but will resolve to <[T; N] as IntoIterator>::into_iter in Rust 2021. --> $DIR/into-iter-on-arrays-2018.rs:18:44 | LL | let _: Iter<'_, i32> = Box::new(array).into_iter(); - | ^^^^^^^^^ help: use `.iter()` instead of `.into_iter()` to avoid ambiguity: `iter` + | ^^^^^^^^^ | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = warning: this changes meaning in Rust 2021 = note: for more information, see issue #66145 <https://github.com/rust-lang/rust/issues/66145> - -warning: 2 warnings emitted - -Future incompatibility report: Future breakage date: None, diagnostic: -warning: this method call currently resolves to `<&[T; N] as IntoIterator>::into_iter` (due to autoref coercions), but that might change in the future when `IntoIterator` impls for arrays are added. - --> $DIR/into-iter-on-arrays-2018.rs:14:34 +help: use `.iter()` instead of `.into_iter()` to avoid ambiguity | -LL | let _: Iter<'_, i32> = array.into_iter(); - | ^^^^^^^^^ help: use `.iter()` instead of `.into_iter()` to avoid ambiguity: `iter` +LL | let _: Iter<'_, i32> = Box::new(array).iter(); + | ^^^^ +help: or use `IntoIterator::into_iter(..)` instead of `.into_iter()` to explicitly iterate by value | - = note: `#[warn(array_into_iter)]` 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! - = note: for more information, see issue #66145 <https://github.com/rust-lang/rust/issues/66145> +LL | let _: Iter<'_, i32> = IntoIterator::into_iter(Box::new(array)); + | ^^^^^^^^^^^^^^^^^^^^^^^^ ^ -Future breakage date: None, diagnostic: -warning: this method call currently resolves to `<&[T; N] as IntoIterator>::into_iter` (due to autoref coercions), but that might change in the future when `IntoIterator` impls for arrays are added. - --> $DIR/into-iter-on-arrays-2018.rs:18:44 +warning: this method call resolves to `<&[T; N] as IntoIterator>::into_iter` (due to backwards compatibility), but will resolve to <[T; N] as IntoIterator>::into_iter in Rust 2021. + --> $DIR/into-iter-on-arrays-2018.rs:29:24 | -LL | let _: Iter<'_, i32> = Box::new(array).into_iter(); - | ^^^^^^^^^ help: use `.iter()` instead of `.into_iter()` to avoid ambiguity: `iter` +LL | for _ in [1, 2, 3].into_iter() {} + | ^^^^^^^^^ | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = warning: this changes meaning in Rust 2021 = note: for more information, see issue #66145 <https://github.com/rust-lang/rust/issues/66145> +help: use `.iter()` instead of `.into_iter()` to avoid ambiguity + | +LL | for _ in [1, 2, 3].iter() {} + | ^^^^ +help: or remove `.into_iter()` to iterate by value + | +LL | for _ in [1, 2, 3] {} + | -- + +warning: 3 warnings emitted diff --git a/src/test/ui/iterators/into-iter-on-arrays-lint.fixed b/src/test/ui/iterators/into-iter-on-arrays-lint.fixed index 7f511bde3cb..0055758a6a4 100644 --- a/src/test/ui/iterators/into-iter-on-arrays-lint.fixed +++ b/src/test/ui/iterators/into-iter-on-arrays-lint.fixed @@ -1,5 +1,6 @@ // run-pass // run-rustfix +// rustfix-only-machine-applicable fn main() { let small = [1, 2]; @@ -7,43 +8,43 @@ fn main() { // Expressions that should trigger the lint small.iter(); - //~^ WARNING this method call currently resolves to `<&[T; N] as IntoIterator>::into_iter` - //~| WARNING this was previously accepted by the compiler but is being phased out + //~^ WARNING this method call resolves to `<&[T; N] as IntoIterator>::into_iter` + //~| WARNING this changes meaning [1, 2].iter(); - //~^ WARNING this method call currently resolves to `<&[T; N] as IntoIterator>::into_iter` - //~| WARNING this was previously accepted by the compiler but is being phased out + //~^ WARNING this method call resolves to `<&[T; N] as IntoIterator>::into_iter` + //~| WARNING this changes meaning big.iter(); - //~^ WARNING this method call currently resolves to `<&[T; N] as IntoIterator>::into_iter` - //~| WARNING this was previously accepted by the compiler but is being phased out + //~^ WARNING this method call resolves to `<&[T; N] as IntoIterator>::into_iter` + //~| WARNING this changes meaning [0u8; 33].iter(); - //~^ WARNING this method call currently resolves to `<&[T; N] as IntoIterator>::into_iter` - //~| WARNING this was previously accepted by the compiler but is being phased out + //~^ WARNING this method call resolves to `<&[T; N] as IntoIterator>::into_iter` + //~| WARNING this changes meaning Box::new(small).iter(); - //~^ WARNING this method call currently resolves to `<&[T; N] as IntoIterator>::into_iter` - //~| WARNING this was previously accepted by the compiler but is being phased out + //~^ WARNING this method call resolves to `<&[T; N] as IntoIterator>::into_iter` + //~| WARNING this changes meaning Box::new([1, 2]).iter(); - //~^ WARNING this method call currently resolves to `<&[T; N] as IntoIterator>::into_iter` - //~| WARNING this was previously accepted by the compiler but is being phased out + //~^ WARNING this method call resolves to `<&[T; N] as IntoIterator>::into_iter` + //~| WARNING this changes meaning Box::new(big).iter(); - //~^ WARNING this method call currently resolves to `<&[T; N] as IntoIterator>::into_iter` - //~| WARNING this was previously accepted by the compiler but is being phased out + //~^ WARNING this method call resolves to `<&[T; N] as IntoIterator>::into_iter` + //~| WARNING this changes meaning Box::new([0u8; 33]).iter(); - //~^ WARNING this method call currently resolves to `<&[T; N] as IntoIterator>::into_iter` - //~| WARNING this was previously accepted by the compiler but is being phased out + //~^ WARNING this method call resolves to `<&[T; N] as IntoIterator>::into_iter` + //~| WARNING this changes meaning Box::new(Box::new(small)).iter(); - //~^ WARNING this method call currently resolves to `<&[T; N] as IntoIterator>::into_iter` - //~| WARNING this was previously accepted by the compiler but is being phased out + //~^ WARNING this method call resolves to `<&[T; N] as IntoIterator>::into_iter` + //~| WARNING this changes meaning Box::new(Box::new([1, 2])).iter(); - //~^ WARNING this method call currently resolves to `<&[T; N] as IntoIterator>::into_iter` - //~| WARNING this was previously accepted by the compiler but is being phased out + //~^ WARNING this method call resolves to `<&[T; N] as IntoIterator>::into_iter` + //~| WARNING this changes meaning Box::new(Box::new(big)).iter(); - //~^ WARNING this method call currently resolves to `<&[T; N] as IntoIterator>::into_iter` - //~| WARNING this was previously accepted by the compiler but is being phased out + //~^ WARNING this method call resolves to `<&[T; N] as IntoIterator>::into_iter` + //~| WARNING this changes meaning Box::new(Box::new([0u8; 33])).iter(); - //~^ WARNING this method call currently resolves to `<&[T; N] as IntoIterator>::into_iter` - //~| WARNING this was previously accepted by the compiler but is being phased out + //~^ WARNING this method call resolves to `<&[T; N] as IntoIterator>::into_iter` + //~| WARNING this changes meaning // Expressions that should not (&[1, 2]).into_iter(); diff --git a/src/test/ui/iterators/into-iter-on-arrays-lint.rs b/src/test/ui/iterators/into-iter-on-arrays-lint.rs index d5fe83a7834..01857c78a73 100644 --- a/src/test/ui/iterators/into-iter-on-arrays-lint.rs +++ b/src/test/ui/iterators/into-iter-on-arrays-lint.rs @@ -1,5 +1,6 @@ // run-pass // run-rustfix +// rustfix-only-machine-applicable fn main() { let small = [1, 2]; @@ -7,43 +8,43 @@ fn main() { // Expressions that should trigger the lint small.into_iter(); - //~^ WARNING this method call currently resolves to `<&[T; N] as IntoIterator>::into_iter` - //~| WARNING this was previously accepted by the compiler but is being phased out + //~^ WARNING this method call resolves to `<&[T; N] as IntoIterator>::into_iter` + //~| WARNING this changes meaning [1, 2].into_iter(); - //~^ WARNING this method call currently resolves to `<&[T; N] as IntoIterator>::into_iter` - //~| WARNING this was previously accepted by the compiler but is being phased out + //~^ WARNING this method call resolves to `<&[T; N] as IntoIterator>::into_iter` + //~| WARNING this changes meaning big.into_iter(); - //~^ WARNING this method call currently resolves to `<&[T; N] as IntoIterator>::into_iter` - //~| WARNING this was previously accepted by the compiler but is being phased out + //~^ WARNING this method call resolves to `<&[T; N] as IntoIterator>::into_iter` + //~| WARNING this changes meaning [0u8; 33].into_iter(); - //~^ WARNING this method call currently resolves to `<&[T; N] as IntoIterator>::into_iter` - //~| WARNING this was previously accepted by the compiler but is being phased out + //~^ WARNING this method call resolves to `<&[T; N] as IntoIterator>::into_iter` + //~| WARNING this changes meaning Box::new(small).into_iter(); - //~^ WARNING this method call currently resolves to `<&[T; N] as IntoIterator>::into_iter` - //~| WARNING this was previously accepted by the compiler but is being phased out + //~^ WARNING this method call resolves to `<&[T; N] as IntoIterator>::into_iter` + //~| WARNING this changes meaning Box::new([1, 2]).into_iter(); - //~^ WARNING this method call currently resolves to `<&[T; N] as IntoIterator>::into_iter` - //~| WARNING this was previously accepted by the compiler but is being phased out + //~^ WARNING this method call resolves to `<&[T; N] as IntoIterator>::into_iter` + //~| WARNING this changes meaning Box::new(big).into_iter(); - //~^ WARNING this method call currently resolves to `<&[T; N] as IntoIterator>::into_iter` - //~| WARNING this was previously accepted by the compiler but is being phased out + //~^ WARNING this method call resolves to `<&[T; N] as IntoIterator>::into_iter` + //~| WARNING this changes meaning Box::new([0u8; 33]).into_iter(); - //~^ WARNING this method call currently resolves to `<&[T; N] as IntoIterator>::into_iter` - //~| WARNING this was previously accepted by the compiler but is being phased out + //~^ WARNING this method call resolves to `<&[T; N] as IntoIterator>::into_iter` + //~| WARNING this changes meaning Box::new(Box::new(small)).into_iter(); - //~^ WARNING this method call currently resolves to `<&[T; N] as IntoIterator>::into_iter` - //~| WARNING this was previously accepted by the compiler but is being phased out + //~^ WARNING this method call resolves to `<&[T; N] as IntoIterator>::into_iter` + //~| WARNING this changes meaning Box::new(Box::new([1, 2])).into_iter(); - //~^ WARNING this method call currently resolves to `<&[T; N] as IntoIterator>::into_iter` - //~| WARNING this was previously accepted by the compiler but is being phased out + //~^ WARNING this method call resolves to `<&[T; N] as IntoIterator>::into_iter` + //~| WARNING this changes meaning Box::new(Box::new(big)).into_iter(); - //~^ WARNING this method call currently resolves to `<&[T; N] as IntoIterator>::into_iter` - //~| WARNING this was previously accepted by the compiler but is being phased out + //~^ WARNING this method call resolves to `<&[T; N] as IntoIterator>::into_iter` + //~| WARNING this changes meaning Box::new(Box::new([0u8; 33])).into_iter(); - //~^ WARNING this method call currently resolves to `<&[T; N] as IntoIterator>::into_iter` - //~| WARNING this was previously accepted by the compiler but is being phased out + //~^ WARNING this method call resolves to `<&[T; N] as IntoIterator>::into_iter` + //~| WARNING this changes meaning // Expressions that should not (&[1, 2]).into_iter(); diff --git a/src/test/ui/iterators/into-iter-on-arrays-lint.stderr b/src/test/ui/iterators/into-iter-on-arrays-lint.stderr index 211315c3fcf..01789e0e257 100644 --- a/src/test/ui/iterators/into-iter-on-arrays-lint.stderr +++ b/src/test/ui/iterators/into-iter-on-arrays-lint.stderr @@ -1,247 +1,207 @@ -warning: this method call currently resolves to `<&[T; N] as IntoIterator>::into_iter` (due to autoref coercions), but that might change in the future when `IntoIterator` impls for arrays are added. - --> $DIR/into-iter-on-arrays-lint.rs:9:11 +warning: this method call resolves to `<&[T; N] as IntoIterator>::into_iter` (due to backwards compatibility), but will resolve to <[T; N] as IntoIterator>::into_iter in Rust 2021. + --> $DIR/into-iter-on-arrays-lint.rs:10:11 | LL | small.into_iter(); - | ^^^^^^^^^ help: use `.iter()` instead of `.into_iter()` to avoid ambiguity: `iter` + | ^^^^^^^^^ | = note: `#[warn(array_into_iter)]` 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! + = warning: this changes meaning in Rust 2021 = note: for more information, see issue #66145 <https://github.com/rust-lang/rust/issues/66145> - -warning: this method call currently resolves to `<&[T; N] as IntoIterator>::into_iter` (due to autoref coercions), but that might change in the future when `IntoIterator` impls for arrays are added. - --> $DIR/into-iter-on-arrays-lint.rs:12:12 +help: use `.iter()` instead of `.into_iter()` to avoid ambiguity | -LL | [1, 2].into_iter(); - | ^^^^^^^^^ help: use `.iter()` instead of `.into_iter()` to avoid ambiguity: `iter` +LL | small.iter(); + | ^^^^ +help: or use `IntoIterator::into_iter(..)` instead of `.into_iter()` to explicitly iterate by value | - = 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 #66145 <https://github.com/rust-lang/rust/issues/66145> +LL | IntoIterator::into_iter(small); + | ^^^^^^^^^^^^^^^^^^^^^^^^ ^ -warning: this method call currently resolves to `<&[T; N] as IntoIterator>::into_iter` (due to autoref coercions), but that might change in the future when `IntoIterator` impls for arrays are added. - --> $DIR/into-iter-on-arrays-lint.rs:15:9 +warning: this method call resolves to `<&[T; N] as IntoIterator>::into_iter` (due to backwards compatibility), but will resolve to <[T; N] as IntoIterator>::into_iter in Rust 2021. + --> $DIR/into-iter-on-arrays-lint.rs:13:12 | -LL | big.into_iter(); - | ^^^^^^^^^ help: use `.iter()` instead of `.into_iter()` to avoid ambiguity: `iter` +LL | [1, 2].into_iter(); + | ^^^^^^^^^ | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = warning: this changes meaning in Rust 2021 = note: for more information, see issue #66145 <https://github.com/rust-lang/rust/issues/66145> - -warning: this method call currently resolves to `<&[T; N] as IntoIterator>::into_iter` (due to autoref coercions), but that might change in the future when `IntoIterator` impls for arrays are added. - --> $DIR/into-iter-on-arrays-lint.rs:18:15 +help: use `.iter()` instead of `.into_iter()` to avoid ambiguity | -LL | [0u8; 33].into_iter(); - | ^^^^^^^^^ help: use `.iter()` instead of `.into_iter()` to avoid ambiguity: `iter` +LL | [1, 2].iter(); + | ^^^^ +help: or use `IntoIterator::into_iter(..)` instead of `.into_iter()` to explicitly iterate by value | - = 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 #66145 <https://github.com/rust-lang/rust/issues/66145> +LL | IntoIterator::into_iter([1, 2]); + | ^^^^^^^^^^^^^^^^^^^^^^^^ ^ -warning: this method call currently resolves to `<&[T; N] as IntoIterator>::into_iter` (due to autoref coercions), but that might change in the future when `IntoIterator` impls for arrays are added. - --> $DIR/into-iter-on-arrays-lint.rs:22:21 +warning: this method call resolves to `<&[T; N] as IntoIterator>::into_iter` (due to backwards compatibility), but will resolve to <[T; N] as IntoIterator>::into_iter in Rust 2021. + --> $DIR/into-iter-on-arrays-lint.rs:16:9 | -LL | Box::new(small).into_iter(); - | ^^^^^^^^^ help: use `.iter()` instead of `.into_iter()` to avoid ambiguity: `iter` +LL | big.into_iter(); + | ^^^^^^^^^ | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = warning: this changes meaning in Rust 2021 = note: for more information, see issue #66145 <https://github.com/rust-lang/rust/issues/66145> - -warning: this method call currently resolves to `<&[T; N] as IntoIterator>::into_iter` (due to autoref coercions), but that might change in the future when `IntoIterator` impls for arrays are added. - --> $DIR/into-iter-on-arrays-lint.rs:25:22 +help: use `.iter()` instead of `.into_iter()` to avoid ambiguity | -LL | Box::new([1, 2]).into_iter(); - | ^^^^^^^^^ help: use `.iter()` instead of `.into_iter()` to avoid ambiguity: `iter` +LL | big.iter(); + | ^^^^ +help: or use `IntoIterator::into_iter(..)` instead of `.into_iter()` to explicitly iterate by value | - = 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 #66145 <https://github.com/rust-lang/rust/issues/66145> +LL | IntoIterator::into_iter(big); + | ^^^^^^^^^^^^^^^^^^^^^^^^ ^ -warning: this method call currently resolves to `<&[T; N] as IntoIterator>::into_iter` (due to autoref coercions), but that might change in the future when `IntoIterator` impls for arrays are added. - --> $DIR/into-iter-on-arrays-lint.rs:28:19 +warning: this method call resolves to `<&[T; N] as IntoIterator>::into_iter` (due to backwards compatibility), but will resolve to <[T; N] as IntoIterator>::into_iter in Rust 2021. + --> $DIR/into-iter-on-arrays-lint.rs:19:15 | -LL | Box::new(big).into_iter(); - | ^^^^^^^^^ help: use `.iter()` instead of `.into_iter()` to avoid ambiguity: `iter` - | - = 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 #66145 <https://github.com/rust-lang/rust/issues/66145> - -warning: this method call currently resolves to `<&[T; N] as IntoIterator>::into_iter` (due to autoref coercions), but that might change in the future when `IntoIterator` impls for arrays are added. - --> $DIR/into-iter-on-arrays-lint.rs:31:25 - | -LL | Box::new([0u8; 33]).into_iter(); - | ^^^^^^^^^ help: use `.iter()` instead of `.into_iter()` to avoid ambiguity: `iter` +LL | [0u8; 33].into_iter(); + | ^^^^^^^^^ | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = warning: this changes meaning in Rust 2021 = note: for more information, see issue #66145 <https://github.com/rust-lang/rust/issues/66145> - -warning: this method call currently resolves to `<&[T; N] as IntoIterator>::into_iter` (due to autoref coercions), but that might change in the future when `IntoIterator` impls for arrays are added. - --> $DIR/into-iter-on-arrays-lint.rs:35:31 +help: use `.iter()` instead of `.into_iter()` to avoid ambiguity | -LL | Box::new(Box::new(small)).into_iter(); - | ^^^^^^^^^ help: use `.iter()` instead of `.into_iter()` to avoid ambiguity: `iter` +LL | [0u8; 33].iter(); + | ^^^^ +help: or use `IntoIterator::into_iter(..)` instead of `.into_iter()` to explicitly iterate by value | - = 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 #66145 <https://github.com/rust-lang/rust/issues/66145> +LL | IntoIterator::into_iter([0u8; 33]); + | ^^^^^^^^^^^^^^^^^^^^^^^^ ^ -warning: this method call currently resolves to `<&[T; N] as IntoIterator>::into_iter` (due to autoref coercions), but that might change in the future when `IntoIterator` impls for arrays are added. - --> $DIR/into-iter-on-arrays-lint.rs:38:32 +warning: this method call resolves to `<&[T; N] as IntoIterator>::into_iter` (due to backwards compatibility), but will resolve to <[T; N] as IntoIterator>::into_iter in Rust 2021. + --> $DIR/into-iter-on-arrays-lint.rs:23:21 | -LL | Box::new(Box::new([1, 2])).into_iter(); - | ^^^^^^^^^ help: use `.iter()` instead of `.into_iter()` to avoid ambiguity: `iter` +LL | Box::new(small).into_iter(); + | ^^^^^^^^^ | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = warning: this changes meaning in Rust 2021 = note: for more information, see issue #66145 <https://github.com/rust-lang/rust/issues/66145> - -warning: this method call currently resolves to `<&[T; N] as IntoIterator>::into_iter` (due to autoref coercions), but that might change in the future when `IntoIterator` impls for arrays are added. - --> $DIR/into-iter-on-arrays-lint.rs:41:29 +help: use `.iter()` instead of `.into_iter()` to avoid ambiguity | -LL | Box::new(Box::new(big)).into_iter(); - | ^^^^^^^^^ help: use `.iter()` instead of `.into_iter()` to avoid ambiguity: `iter` +LL | Box::new(small).iter(); + | ^^^^ +help: or use `IntoIterator::into_iter(..)` instead of `.into_iter()` to explicitly iterate by value | - = 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 #66145 <https://github.com/rust-lang/rust/issues/66145> +LL | IntoIterator::into_iter(Box::new(small)); + | ^^^^^^^^^^^^^^^^^^^^^^^^ ^ -warning: this method call currently resolves to `<&[T; N] as IntoIterator>::into_iter` (due to autoref coercions), but that might change in the future when `IntoIterator` impls for arrays are added. - --> $DIR/into-iter-on-arrays-lint.rs:44:35 +warning: this method call resolves to `<&[T; N] as IntoIterator>::into_iter` (due to backwards compatibility), but will resolve to <[T; N] as IntoIterator>::into_iter in Rust 2021. + --> $DIR/into-iter-on-arrays-lint.rs:26:22 | -LL | Box::new(Box::new([0u8; 33])).into_iter(); - | ^^^^^^^^^ help: use `.iter()` instead of `.into_iter()` to avoid ambiguity: `iter` +LL | Box::new([1, 2]).into_iter(); + | ^^^^^^^^^ | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = warning: this changes meaning in Rust 2021 = note: for more information, see issue #66145 <https://github.com/rust-lang/rust/issues/66145> - -warning: 12 warnings emitted - -Future incompatibility report: Future breakage date: None, diagnostic: -warning: this method call currently resolves to `<&[T; N] as IntoIterator>::into_iter` (due to autoref coercions), but that might change in the future when `IntoIterator` impls for arrays are added. - --> $DIR/into-iter-on-arrays-lint.rs:9:11 +help: use `.iter()` instead of `.into_iter()` to avoid ambiguity | -LL | small.into_iter(); - | ^^^^^^^^^ help: use `.iter()` instead of `.into_iter()` to avoid ambiguity: `iter` +LL | Box::new([1, 2]).iter(); + | ^^^^ +help: or use `IntoIterator::into_iter(..)` instead of `.into_iter()` to explicitly iterate by value | - = note: `#[warn(array_into_iter)]` 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! - = note: for more information, see issue #66145 <https://github.com/rust-lang/rust/issues/66145> +LL | IntoIterator::into_iter(Box::new([1, 2])); + | ^^^^^^^^^^^^^^^^^^^^^^^^ ^ -Future breakage date: None, diagnostic: -warning: this method call currently resolves to `<&[T; N] as IntoIterator>::into_iter` (due to autoref coercions), but that might change in the future when `IntoIterator` impls for arrays are added. - --> $DIR/into-iter-on-arrays-lint.rs:12:12 +warning: this method call resolves to `<&[T; N] as IntoIterator>::into_iter` (due to backwards compatibility), but will resolve to <[T; N] as IntoIterator>::into_iter in Rust 2021. + --> $DIR/into-iter-on-arrays-lint.rs:29:19 | -LL | [1, 2].into_iter(); - | ^^^^^^^^^ help: use `.iter()` instead of `.into_iter()` to avoid ambiguity: `iter` +LL | Box::new(big).into_iter(); + | ^^^^^^^^^ | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = warning: this changes meaning in Rust 2021 = note: for more information, see issue #66145 <https://github.com/rust-lang/rust/issues/66145> - -Future breakage date: None, diagnostic: -warning: this method call currently resolves to `<&[T; N] as IntoIterator>::into_iter` (due to autoref coercions), but that might change in the future when `IntoIterator` impls for arrays are added. - --> $DIR/into-iter-on-arrays-lint.rs:15:9 +help: use `.iter()` instead of `.into_iter()` to avoid ambiguity | -LL | big.into_iter(); - | ^^^^^^^^^ help: use `.iter()` instead of `.into_iter()` to avoid ambiguity: `iter` +LL | Box::new(big).iter(); + | ^^^^ +help: or use `IntoIterator::into_iter(..)` instead of `.into_iter()` to explicitly iterate by value | - = 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 #66145 <https://github.com/rust-lang/rust/issues/66145> +LL | IntoIterator::into_iter(Box::new(big)); + | ^^^^^^^^^^^^^^^^^^^^^^^^ ^ -Future breakage date: None, diagnostic: -warning: this method call currently resolves to `<&[T; N] as IntoIterator>::into_iter` (due to autoref coercions), but that might change in the future when `IntoIterator` impls for arrays are added. - --> $DIR/into-iter-on-arrays-lint.rs:18:15 +warning: this method call resolves to `<&[T; N] as IntoIterator>::into_iter` (due to backwards compatibility), but will resolve to <[T; N] as IntoIterator>::into_iter in Rust 2021. + --> $DIR/into-iter-on-arrays-lint.rs:32:25 | -LL | [0u8; 33].into_iter(); - | ^^^^^^^^^ help: use `.iter()` instead of `.into_iter()` to avoid ambiguity: `iter` +LL | Box::new([0u8; 33]).into_iter(); + | ^^^^^^^^^ | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = warning: this changes meaning in Rust 2021 = note: for more information, see issue #66145 <https://github.com/rust-lang/rust/issues/66145> - -Future breakage date: None, diagnostic: -warning: this method call currently resolves to `<&[T; N] as IntoIterator>::into_iter` (due to autoref coercions), but that might change in the future when `IntoIterator` impls for arrays are added. - --> $DIR/into-iter-on-arrays-lint.rs:22:21 +help: use `.iter()` instead of `.into_iter()` to avoid ambiguity | -LL | Box::new(small).into_iter(); - | ^^^^^^^^^ help: use `.iter()` instead of `.into_iter()` to avoid ambiguity: `iter` +LL | Box::new([0u8; 33]).iter(); + | ^^^^ +help: or use `IntoIterator::into_iter(..)` instead of `.into_iter()` to explicitly iterate by value | - = 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 #66145 <https://github.com/rust-lang/rust/issues/66145> +LL | IntoIterator::into_iter(Box::new([0u8; 33])); + | ^^^^^^^^^^^^^^^^^^^^^^^^ ^ -Future breakage date: None, diagnostic: -warning: this method call currently resolves to `<&[T; N] as IntoIterator>::into_iter` (due to autoref coercions), but that might change in the future when `IntoIterator` impls for arrays are added. - --> $DIR/into-iter-on-arrays-lint.rs:25:22 +warning: this method call resolves to `<&[T; N] as IntoIterator>::into_iter` (due to backwards compatibility), but will resolve to <[T; N] as IntoIterator>::into_iter in Rust 2021. + --> $DIR/into-iter-on-arrays-lint.rs:36:31 | -LL | Box::new([1, 2]).into_iter(); - | ^^^^^^^^^ help: use `.iter()` instead of `.into_iter()` to avoid ambiguity: `iter` +LL | Box::new(Box::new(small)).into_iter(); + | ^^^^^^^^^ | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = warning: this changes meaning in Rust 2021 = note: for more information, see issue #66145 <https://github.com/rust-lang/rust/issues/66145> - -Future breakage date: None, diagnostic: -warning: this method call currently resolves to `<&[T; N] as IntoIterator>::into_iter` (due to autoref coercions), but that might change in the future when `IntoIterator` impls for arrays are added. - --> $DIR/into-iter-on-arrays-lint.rs:28:19 +help: use `.iter()` instead of `.into_iter()` to avoid ambiguity | -LL | Box::new(big).into_iter(); - | ^^^^^^^^^ help: use `.iter()` instead of `.into_iter()` to avoid ambiguity: `iter` +LL | Box::new(Box::new(small)).iter(); + | ^^^^ +help: or use `IntoIterator::into_iter(..)` instead of `.into_iter()` to explicitly iterate by value | - = 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 #66145 <https://github.com/rust-lang/rust/issues/66145> +LL | IntoIterator::into_iter(Box::new(Box::new(small))); + | ^^^^^^^^^^^^^^^^^^^^^^^^ ^ -Future breakage date: None, diagnostic: -warning: this method call currently resolves to `<&[T; N] as IntoIterator>::into_iter` (due to autoref coercions), but that might change in the future when `IntoIterator` impls for arrays are added. - --> $DIR/into-iter-on-arrays-lint.rs:31:25 +warning: this method call resolves to `<&[T; N] as IntoIterator>::into_iter` (due to backwards compatibility), but will resolve to <[T; N] as IntoIterator>::into_iter in Rust 2021. + --> $DIR/into-iter-on-arrays-lint.rs:39:32 | -LL | Box::new([0u8; 33]).into_iter(); - | ^^^^^^^^^ help: use `.iter()` instead of `.into_iter()` to avoid ambiguity: `iter` +LL | Box::new(Box::new([1, 2])).into_iter(); + | ^^^^^^^^^ | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = warning: this changes meaning in Rust 2021 = note: for more information, see issue #66145 <https://github.com/rust-lang/rust/issues/66145> - -Future breakage date: None, diagnostic: -warning: this method call currently resolves to `<&[T; N] as IntoIterator>::into_iter` (due to autoref coercions), but that might change in the future when `IntoIterator` impls for arrays are added. - --> $DIR/into-iter-on-arrays-lint.rs:35:31 +help: use `.iter()` instead of `.into_iter()` to avoid ambiguity | -LL | Box::new(Box::new(small)).into_iter(); - | ^^^^^^^^^ help: use `.iter()` instead of `.into_iter()` to avoid ambiguity: `iter` +LL | Box::new(Box::new([1, 2])).iter(); + | ^^^^ +help: or use `IntoIterator::into_iter(..)` instead of `.into_iter()` to explicitly iterate by value | - = 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 #66145 <https://github.com/rust-lang/rust/issues/66145> +LL | IntoIterator::into_iter(Box::new(Box::new([1, 2]))); + | ^^^^^^^^^^^^^^^^^^^^^^^^ ^ -Future breakage date: None, diagnostic: -warning: this method call currently resolves to `<&[T; N] as IntoIterator>::into_iter` (due to autoref coercions), but that might change in the future when `IntoIterator` impls for arrays are added. - --> $DIR/into-iter-on-arrays-lint.rs:38:32 +warning: this method call resolves to `<&[T; N] as IntoIterator>::into_iter` (due to backwards compatibility), but will resolve to <[T; N] as IntoIterator>::into_iter in Rust 2021. + --> $DIR/into-iter-on-arrays-lint.rs:42:29 | -LL | Box::new(Box::new([1, 2])).into_iter(); - | ^^^^^^^^^ help: use `.iter()` instead of `.into_iter()` to avoid ambiguity: `iter` +LL | Box::new(Box::new(big)).into_iter(); + | ^^^^^^^^^ | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = warning: this changes meaning in Rust 2021 = note: for more information, see issue #66145 <https://github.com/rust-lang/rust/issues/66145> - -Future breakage date: None, diagnostic: -warning: this method call currently resolves to `<&[T; N] as IntoIterator>::into_iter` (due to autoref coercions), but that might change in the future when `IntoIterator` impls for arrays are added. - --> $DIR/into-iter-on-arrays-lint.rs:41:29 +help: use `.iter()` instead of `.into_iter()` to avoid ambiguity | -LL | Box::new(Box::new(big)).into_iter(); - | ^^^^^^^^^ help: use `.iter()` instead of `.into_iter()` to avoid ambiguity: `iter` +LL | Box::new(Box::new(big)).iter(); + | ^^^^ +help: or use `IntoIterator::into_iter(..)` instead of `.into_iter()` to explicitly iterate by value | - = 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 #66145 <https://github.com/rust-lang/rust/issues/66145> +LL | IntoIterator::into_iter(Box::new(Box::new(big))); + | ^^^^^^^^^^^^^^^^^^^^^^^^ ^ -Future breakage date: None, diagnostic: -warning: this method call currently resolves to `<&[T; N] as IntoIterator>::into_iter` (due to autoref coercions), but that might change in the future when `IntoIterator` impls for arrays are added. - --> $DIR/into-iter-on-arrays-lint.rs:44:35 +warning: this method call resolves to `<&[T; N] as IntoIterator>::into_iter` (due to backwards compatibility), but will resolve to <[T; N] as IntoIterator>::into_iter in Rust 2021. + --> $DIR/into-iter-on-arrays-lint.rs:45:35 | LL | Box::new(Box::new([0u8; 33])).into_iter(); - | ^^^^^^^^^ help: use `.iter()` instead of `.into_iter()` to avoid ambiguity: `iter` + | ^^^^^^^^^ | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = warning: this changes meaning in Rust 2021 = note: for more information, see issue #66145 <https://github.com/rust-lang/rust/issues/66145> - -Future breakage date: None, diagnostic: -warning: this method call currently resolves to `<&[T; N] as IntoIterator>::into_iter` (due to autoref coercions), but that might change in the future when `IntoIterator` impls for arrays are added. - --> $DIR/into-iter-on-arrays-lint.rs:60:12 +help: use `.iter()` instead of `.into_iter()` to avoid ambiguity | -LL | [0, 1].into_iter(); - | ^^^^^^^^^ help: use `.iter()` instead of `.into_iter()` to avoid ambiguity: `iter` +LL | Box::new(Box::new([0u8; 33])).iter(); + | ^^^^ +help: or use `IntoIterator::into_iter(..)` instead of `.into_iter()` to explicitly iterate by value | -note: the lint level is defined here - --> $DIR/into-iter-on-arrays-lint.rs:59:13 - | -LL | #[allow(array_into_iter)] - | ^^^^^^^^^^^^^^^ - = 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 #66145 <https://github.com/rust-lang/rust/issues/66145> +LL | IntoIterator::into_iter(Box::new(Box::new([0u8; 33]))); + | ^^^^^^^^^^^^^^^^^^^^^^^^ ^ + +warning: 12 warnings emitted diff --git a/src/test/ui/limits/issue-69485-var-size-diffs-too-large.stderr b/src/test/ui/limits/issue-69485-var-size-diffs-too-large.stderr index c229458da47..f7923bd4743 100644 --- a/src/test/ui/limits/issue-69485-var-size-diffs-too-large.stderr +++ b/src/test/ui/limits/issue-69485-var-size-diffs-too-large.stderr @@ -1,8 +1,8 @@ error: values of the type `[u8; 18446744073709551615]` are too big for the current architecture - --> $DIR/issue-69485-var-size-diffs-too-large.rs:6:12 + --> $DIR/issue-69485-var-size-diffs-too-large.rs:6:5 | LL | Bug::V([0; !0]); - | ^^^^^^^ + | ^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/lint/bare-trait-objects-path.rs b/src/test/ui/lint/bare-trait-objects-path.rs index 74f838e9ed1..0a7c5a8dbd1 100644 --- a/src/test/ui/lint/bare-trait-objects-path.rs +++ b/src/test/ui/lint/bare-trait-objects-path.rs @@ -13,12 +13,12 @@ impl Assoc for dyn Dyn {} fn main() { Dyn::func(); //~^ WARN trait objects without an explicit `dyn` are deprecated - //~| WARN this was previously accepted by the compiler + //~| WARN this is accepted in the current edition ::Dyn::func(); //~^ WARN trait objects without an explicit `dyn` are deprecated - //~| WARN this was previously accepted by the compiler + //~| WARN this is accepted in the current edition Dyn::CONST; //~^ WARN trait objects without an explicit `dyn` are deprecated - //~| WARN this was previously accepted by the compiler + //~| WARN this is accepted in the current edition let _: Dyn::Ty; //~ ERROR ambiguous associated type } diff --git a/src/test/ui/lint/bare-trait-objects-path.stderr b/src/test/ui/lint/bare-trait-objects-path.stderr index 55c9ea234de..40fafc4b3b5 100644 --- a/src/test/ui/lint/bare-trait-objects-path.stderr +++ b/src/test/ui/lint/bare-trait-objects-path.stderr @@ -11,7 +11,7 @@ LL | Dyn::func(); | ^^^ help: use `dyn`: `<dyn Dyn>` | = note: `#[warn(bare_trait_objects)]` on by default - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2021 edition! + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! = note: for more information, see issue #80165 <https://github.com/rust-lang/rust/issues/80165> warning: trait objects without an explicit `dyn` are deprecated @@ -20,7 +20,7 @@ warning: trait objects without an explicit `dyn` are deprecated LL | ::Dyn::func(); | ^^^^^ help: use `dyn`: `<dyn (::Dyn)>` | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2021 edition! + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! = note: for more information, see issue #80165 <https://github.com/rust-lang/rust/issues/80165> warning: trait objects without an explicit `dyn` are deprecated @@ -29,7 +29,7 @@ warning: trait objects without an explicit `dyn` are deprecated LL | Dyn::CONST; | ^^^ help: use `dyn`: `<dyn Dyn>` | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2021 edition! + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! = note: for more information, see issue #80165 <https://github.com/rust-lang/rust/issues/80165> error: aborting due to previous error; 3 warnings emitted diff --git a/src/test/ui/lint/force-warn/force-lint-in-allowed-group.rs b/src/test/ui/lint/force-warn/force-lint-in-allowed-group.rs index bb2f394aef3..b4c2c505aa5 100644 --- a/src/test/ui/lint/force-warn/force-lint-in-allowed-group.rs +++ b/src/test/ui/lint/force-warn/force-lint-in-allowed-group.rs @@ -7,6 +7,6 @@ pub trait SomeTrait {} pub fn function(_x: Box<SomeTrait>) {} //~^ WARN trait objects without an explicit `dyn` are deprecated -//~| WARN this was previously accepted by the compiler +//~| WARN this is accepted in the current edition fn main() {} diff --git a/src/test/ui/lint/force-warn/force-lint-in-allowed-group.stderr b/src/test/ui/lint/force-warn/force-lint-in-allowed-group.stderr index 40750ffea8c..8ecfe3a15b8 100644 --- a/src/test/ui/lint/force-warn/force-lint-in-allowed-group.stderr +++ b/src/test/ui/lint/force-warn/force-lint-in-allowed-group.stderr @@ -5,7 +5,7 @@ LL | pub fn function(_x: Box<SomeTrait>) {} | ^^^^^^^^^ help: use `dyn`: `dyn SomeTrait` | = note: warning forced by `force-warns` commandline option - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2021 edition! + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! = note: for more information, see issue #80165 <https://github.com/rust-lang/rust/issues/80165> warning: 1 warning emitted diff --git a/src/test/ui/lint/force-warn/force-warn-group-allow-warning.rs b/src/test/ui/lint/force-warn/force-warn-group-allow-warning.rs index d8a81d73afb..83a1c078f06 100644 --- a/src/test/ui/lint/force-warn/force-warn-group-allow-warning.rs +++ b/src/test/ui/lint/force-warn/force-warn-group-allow-warning.rs @@ -7,6 +7,6 @@ pub trait SomeTrait {} pub fn function(_x: Box<SomeTrait>) {} //~^ WARN trait objects without an explicit `dyn` are deprecated -//~| WARN this was previously accepted by the compiler +//~| WARN this is accepted in the current edition fn main() {} diff --git a/src/test/ui/lint/force-warn/force-warn-group-allow-warning.stderr b/src/test/ui/lint/force-warn/force-warn-group-allow-warning.stderr index 88ae846caa0..232edf4f1ef 100644 --- a/src/test/ui/lint/force-warn/force-warn-group-allow-warning.stderr +++ b/src/test/ui/lint/force-warn/force-warn-group-allow-warning.stderr @@ -5,7 +5,7 @@ LL | pub fn function(_x: Box<SomeTrait>) {} | ^^^^^^^^^ help: use `dyn`: `dyn SomeTrait` | = note: warning forced by `force-warns` commandline option - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2021 edition! + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! = note: for more information, see issue #80165 <https://github.com/rust-lang/rust/issues/80165> warning: 1 warning emitted diff --git a/src/test/ui/lint/force-warn/force-warn-group.rs b/src/test/ui/lint/force-warn/force-warn-group.rs index c97eeabbd4e..5e5fda973d5 100644 --- a/src/test/ui/lint/force-warn/force-warn-group.rs +++ b/src/test/ui/lint/force-warn/force-warn-group.rs @@ -7,6 +7,6 @@ pub trait SomeTrait {} pub fn function(_x: Box<SomeTrait>) {} //~^ WARN trait objects without an explicit `dyn` are deprecated -//~| WARN this was previously accepted by the compiler +//~| WARN this is accepted in the current edition fn main() {} diff --git a/src/test/ui/lint/force-warn/force-warn-group.stderr b/src/test/ui/lint/force-warn/force-warn-group.stderr index f808727991e..82781984f0c 100644 --- a/src/test/ui/lint/force-warn/force-warn-group.stderr +++ b/src/test/ui/lint/force-warn/force-warn-group.stderr @@ -5,7 +5,7 @@ LL | pub fn function(_x: Box<SomeTrait>) {} | ^^^^^^^^^ help: use `dyn`: `dyn SomeTrait` | = note: warning forced by `force-warns` commandline option - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2021 edition! + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! = note: for more information, see issue #80165 <https://github.com/rust-lang/rust/issues/80165> warning: 1 warning emitted diff --git a/src/test/ui/lint/inclusive-range-pattern-syntax.fixed b/src/test/ui/lint/inclusive-range-pattern-syntax.fixed index a1b738e33fa..bee5d4ae4b1 100644 --- a/src/test/ui/lint/inclusive-range-pattern-syntax.fixed +++ b/src/test/ui/lint/inclusive-range-pattern-syntax.fixed @@ -8,14 +8,14 @@ fn main() { match despondency { 1..=2 => {} //~^ WARN `...` range patterns are deprecated - //~| WARN this was previously accepted by the compiler + //~| WARN this is accepted in the current edition _ => {} } match &despondency { &(1..=2) => {} //~^ WARN `...` range patterns are deprecated - //~| WARN this was previously accepted by the compiler + //~| WARN this is accepted in the current edition _ => {} } } diff --git a/src/test/ui/lint/inclusive-range-pattern-syntax.rs b/src/test/ui/lint/inclusive-range-pattern-syntax.rs index d3ebbf38e1c..d98c10c26c7 100644 --- a/src/test/ui/lint/inclusive-range-pattern-syntax.rs +++ b/src/test/ui/lint/inclusive-range-pattern-syntax.rs @@ -8,14 +8,14 @@ fn main() { match despondency { 1...2 => {} //~^ WARN `...` range patterns are deprecated - //~| WARN this was previously accepted by the compiler + //~| WARN this is accepted in the current edition _ => {} } match &despondency { &1...2 => {} //~^ WARN `...` range patterns are deprecated - //~| WARN this was previously accepted by the compiler + //~| WARN this is accepted in the current edition _ => {} } } diff --git a/src/test/ui/lint/inclusive-range-pattern-syntax.stderr b/src/test/ui/lint/inclusive-range-pattern-syntax.stderr index ba4ae208e39..efa684a24e3 100644 --- a/src/test/ui/lint/inclusive-range-pattern-syntax.stderr +++ b/src/test/ui/lint/inclusive-range-pattern-syntax.stderr @@ -9,7 +9,7 @@ note: the lint level is defined here | LL | #![warn(ellipsis_inclusive_range_patterns)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2021 edition! + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! = note: for more information, see issue #80165 <https://github.com/rust-lang/rust/issues/80165> warning: `...` range patterns are deprecated @@ -18,7 +18,7 @@ warning: `...` range patterns are deprecated LL | &1...2 => {} | ^^^^^^ help: use `..=` for an inclusive range: `&(1..=2)` | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2021 edition! + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! = note: for more information, see issue #80165 <https://github.com/rust-lang/rust/issues/80165> warning: 2 warnings emitted diff --git a/src/test/ui/lint/issue-78660-cap-lints-future-compat.rs b/src/test/ui/lint/issue-78660-cap-lints-future-compat.rs deleted file mode 100644 index 4d98f0ad62d..00000000000 --- a/src/test/ui/lint/issue-78660-cap-lints-future-compat.rs +++ /dev/null @@ -1,10 +0,0 @@ -// compile-flags: -D warnings --cap-lints allow -// check-pass - -// Regression test for issue #78660 -// Tests that we don't ICE when a future-incompat-report lint has -// has a command-line source, but is capped to allow - -fn main() { - ["hi"].into_iter(); -} diff --git a/src/test/ui/lint/issue-78660-cap-lints-future-compat.stderr b/src/test/ui/lint/issue-78660-cap-lints-future-compat.stderr deleted file mode 100644 index 79958ba90d4..00000000000 --- a/src/test/ui/lint/issue-78660-cap-lints-future-compat.stderr +++ /dev/null @@ -1,11 +0,0 @@ -Future incompatibility report: Future breakage date: None, diagnostic: -warning: this method call currently resolves to `<&[T; N] as IntoIterator>::into_iter` (due to autoref coercions), but that might change in the future when `IntoIterator` impls for arrays are added. - --> $DIR/issue-78660-cap-lints-future-compat.rs:9:12 - | -LL | ["hi"].into_iter(); - | ^^^^^^^^^ help: use `.iter()` instead of `.into_iter()` to avoid ambiguity: `iter` - | - = note: `-D array-into-iter` implied by `-D warnings` - = 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 #66145 <https://github.com/rust-lang/rust/issues/66145> - diff --git a/src/test/ui/lint/lint-pre-expansion-extern-module.stderr b/src/test/ui/lint/lint-pre-expansion-extern-module.stderr index 6efd03f14a1..3355bb4e4ff 100644 --- a/src/test/ui/lint/lint-pre-expansion-extern-module.stderr +++ b/src/test/ui/lint/lint-pre-expansion-extern-module.stderr @@ -5,7 +5,7 @@ LL | pub fn try() {} | ^^^ help: you can use a raw identifier to stay compatible: `r#try` | = note: `-W keyword-idents` implied by `-W rust-2018-compatibility` - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2018 edition! + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716> warning: 1 warning emitted diff --git a/src/test/ui/lint/unused-borrows.rs b/src/test/ui/lint/unused-borrows.rs new file mode 100644 index 00000000000..4518522ae00 --- /dev/null +++ b/src/test/ui/lint/unused-borrows.rs @@ -0,0 +1,33 @@ +#![deny(unused_must_use)] + +fn foo(_: i32) -> bool { todo!() } + +fn bar() -> &'static i32 { + &42; + //~^ unused + + &mut foo(42); + //~^ unused + + &&42; + //~^ unused + + &&mut 42; + //~^ unused + + &mut &42; + //~^ unused + + let _result = foo(4) + && foo(2); // Misplaced semi-colon (perhaps due to reordering of lines) + && foo(42); + //~^ unused + + let _ = &42; // ok + + &42 // ok +} + +fn main() { + let _ = bar(); +} diff --git a/src/test/ui/lint/unused-borrows.stderr b/src/test/ui/lint/unused-borrows.stderr new file mode 100644 index 00000000000..24899fe992b --- /dev/null +++ b/src/test/ui/lint/unused-borrows.stderr @@ -0,0 +1,44 @@ +error: unused borrow that must be used + --> $DIR/unused-borrows.rs:6:5 + | +LL | &42; + | ^^^ + | +note: the lint level is defined here + --> $DIR/unused-borrows.rs:1:9 + | +LL | #![deny(unused_must_use)] + | ^^^^^^^^^^^^^^^ + +error: unused borrow that must be used + --> $DIR/unused-borrows.rs:9:5 + | +LL | &mut foo(42); + | ^^^^^^^^^^^^ + +error: unused borrow that must be used + --> $DIR/unused-borrows.rs:12:5 + | +LL | &&42; + | ^^^^ + +error: unused borrow that must be used + --> $DIR/unused-borrows.rs:15:5 + | +LL | &&mut 42; + | ^^^^^^^^ + +error: unused borrow that must be used + --> $DIR/unused-borrows.rs:18:5 + | +LL | &mut &42; + | ^^^^^^^^ + +error: unused borrow that must be used + --> $DIR/unused-borrows.rs:23:5 + | +LL | && foo(42); + | ^^^^^^^^^^ + +error: aborting due to 6 previous errors + diff --git a/src/test/ui/macros/auxiliary/or-pattern.rs b/src/test/ui/macros/auxiliary/or-pattern.rs new file mode 100644 index 00000000000..a319c405eb6 --- /dev/null +++ b/src/test/ui/macros/auxiliary/or-pattern.rs @@ -0,0 +1,6 @@ +#![crate_type = "lib"] + +#[macro_export] +macro_rules! a { + ($x:pat|) => (); +} diff --git a/src/test/ui/macros/issue-84632-eager-expansion-recursion-limit.rs b/src/test/ui/macros/issue-84632-eager-expansion-recursion-limit.rs new file mode 100644 index 00000000000..9139775c805 --- /dev/null +++ b/src/test/ui/macros/issue-84632-eager-expansion-recursion-limit.rs @@ -0,0 +1,16 @@ +// Regression test for #84632: Recursion limit is ignored +// for builtin macros that eagerly expands. + +#![recursion_limit = "15"] +macro_rules! a { + () => (""); + (A) => (concat!("", a!())); + (A, $($A:ident),*) => (concat!("", a!($($A),*))) + //~^ ERROR recursion limit reached + //~| HELP consider adding +} + +fn main() { + a!(A, A, A, A, A); + a!(A, A, A, A, A, A, A, A, A, A, A); +} diff --git a/src/test/ui/macros/issue-84632-eager-expansion-recursion-limit.stderr b/src/test/ui/macros/issue-84632-eager-expansion-recursion-limit.stderr new file mode 100644 index 00000000000..e6067e33349 --- /dev/null +++ b/src/test/ui/macros/issue-84632-eager-expansion-recursion-limit.stderr @@ -0,0 +1,14 @@ +error: recursion limit reached while expanding `concat!` + --> $DIR/issue-84632-eager-expansion-recursion-limit.rs:8:28 + | +LL | (A, $($A:ident),*) => (concat!("", a!($($A),*))) + | ^^^^^^^^^^^^^^^^^^^^^^^^ +... +LL | a!(A, A, A, A, A, A, A, A, A, A, A); + | ------------------------------------ in this macro invocation + | + = help: consider adding a `#![recursion_limit="30"]` attribute to your crate (`issue_84632_eager_expansion_recursion_limit`) + = note: this error originates in the macro `a` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: aborting due to previous error + diff --git a/src/test/ui/macros/macro-or-patterns-back-compat.fixed b/src/test/ui/macros/macro-or-patterns-back-compat.fixed index f829129d516..f5a42670fdd 100644 --- a/src/test/ui/macros/macro-or-patterns-back-compat.fixed +++ b/src/test/ui/macros/macro-or-patterns-back-compat.fixed @@ -1,14 +1,28 @@ // run-rustfix +// aux-build:or-pattern.rs #![deny(or_patterns_back_compat)] #![allow(unused_macros)] -macro_rules! foo { ($x:pat_param | $y:pat) => {} } //~ ERROR the meaning of the `pat` fragment specifier is changing in Rust 2021, which may affect this macro -macro_rules! bar { ($($x:pat_param)+ | $($y:pat)+) => {} } //~ ERROR the meaning of the `pat` fragment specifier is changing in Rust 2021, which may affect this macro + +#[macro_use] +extern crate or_pattern; + +macro_rules! foo { ($x:pat_param | $y:pat) => {} } +//~^ ERROR the meaning of the `pat` fragment specifier is changing in Rust 2021, which may affect this macro +//~| WARN this is accepted in the current edition +macro_rules! bar { ($($x:pat_param)+ | $($y:pat)+) => {} } +//~^ ERROR the meaning of the `pat` fragment specifier is changing in Rust 2021, which may affect this macro +//~| WARN this is accepted in the current edition + macro_rules! baz { ($x:pat_param | $y:pat_param) => {} } // should be ok macro_rules! qux { ($x:pat_param | $y:pat) => {} } // should be ok -macro_rules! ogg { ($x:pat_param | $y:pat_param) => {} } //~ ERROR the meaning of the `pat` fragment specifier is changing in Rust 2021, which may affect this macro +macro_rules! ogg { ($x:pat_param | $y:pat_param) => {} } +//~^ ERROR the meaning of the `pat` fragment specifier is changing in Rust 2021, which may affect this macro +//~| WARN this is accepted in the current edition macro_rules! match_any { - ( $expr:expr , $( $( $pat:pat_param )|+ => $expr_arm:expr ),+ ) => { //~ ERROR the meaning of the `pat` fragment specifier is changing in Rust 2021, which may affect this macro + ( $expr:expr , $( $( $pat:pat_param )|+ => $expr_arm:expr ),+ ) => { + //~^ ERROR the meaning of the `pat` fragment specifier is changing in Rust 2021, which may affect this macro + //~| WARN this is accepted in the current edition match $expr { $( $( $pat => $expr_arm, )+ @@ -21,4 +35,5 @@ fn main() { let result: Result<i64, i32> = Err(42); let int: i64 = match_any!(result, Ok(i) | Err(i) => i.into()); assert_eq!(int, 42); + a!(1|); } diff --git a/src/test/ui/macros/macro-or-patterns-back-compat.rs b/src/test/ui/macros/macro-or-patterns-back-compat.rs index 1cdaa1cd631..d6620f45f62 100644 --- a/src/test/ui/macros/macro-or-patterns-back-compat.rs +++ b/src/test/ui/macros/macro-or-patterns-back-compat.rs @@ -1,14 +1,28 @@ // run-rustfix +// aux-build:or-pattern.rs #![deny(or_patterns_back_compat)] #![allow(unused_macros)] -macro_rules! foo { ($x:pat | $y:pat) => {} } //~ ERROR the meaning of the `pat` fragment specifier is changing in Rust 2021, which may affect this macro -macro_rules! bar { ($($x:pat)+ | $($y:pat)+) => {} } //~ ERROR the meaning of the `pat` fragment specifier is changing in Rust 2021, which may affect this macro + +#[macro_use] +extern crate or_pattern; + +macro_rules! foo { ($x:pat | $y:pat) => {} } +//~^ ERROR the meaning of the `pat` fragment specifier is changing in Rust 2021, which may affect this macro +//~| WARN this is accepted in the current edition +macro_rules! bar { ($($x:pat)+ | $($y:pat)+) => {} } +//~^ ERROR the meaning of the `pat` fragment specifier is changing in Rust 2021, which may affect this macro +//~| WARN this is accepted in the current edition + macro_rules! baz { ($x:pat_param | $y:pat_param) => {} } // should be ok macro_rules! qux { ($x:pat_param | $y:pat) => {} } // should be ok -macro_rules! ogg { ($x:pat | $y:pat_param) => {} } //~ ERROR the meaning of the `pat` fragment specifier is changing in Rust 2021, which may affect this macro +macro_rules! ogg { ($x:pat | $y:pat_param) => {} } +//~^ ERROR the meaning of the `pat` fragment specifier is changing in Rust 2021, which may affect this macro +//~| WARN this is accepted in the current edition macro_rules! match_any { - ( $expr:expr , $( $( $pat:pat )|+ => $expr_arm:expr ),+ ) => { //~ ERROR the meaning of the `pat` fragment specifier is changing in Rust 2021, which may affect this macro + ( $expr:expr , $( $( $pat:pat )|+ => $expr_arm:expr ),+ ) => { + //~^ ERROR the meaning of the `pat` fragment specifier is changing in Rust 2021, which may affect this macro + //~| WARN this is accepted in the current edition match $expr { $( $( $pat => $expr_arm, )+ @@ -21,4 +35,5 @@ fn main() { let result: Result<i64, i32> = Err(42); let int: i64 = match_any!(result, Ok(i) | Err(i) => i.into()); assert_eq!(int, 42); + a!(1|); } diff --git a/src/test/ui/macros/macro-or-patterns-back-compat.stderr b/src/test/ui/macros/macro-or-patterns-back-compat.stderr index 01d220dd0b1..a48c9263154 100644 --- a/src/test/ui/macros/macro-or-patterns-back-compat.stderr +++ b/src/test/ui/macros/macro-or-patterns-back-compat.stderr @@ -1,32 +1,43 @@ error: the meaning of the `pat` fragment specifier is changing in Rust 2021, which may affect this macro - --> $DIR/macro-or-patterns-back-compat.rs:5:21 + --> $DIR/macro-or-patterns-back-compat.rs:10:21 | LL | macro_rules! foo { ($x:pat | $y:pat) => {} } | ^^^^^^ help: use pat_param to preserve semantics: `$x:pat_param` | note: the lint level is defined here - --> $DIR/macro-or-patterns-back-compat.rs:3:9 + --> $DIR/macro-or-patterns-back-compat.rs:4:9 | LL | #![deny(or_patterns_back_compat)] | ^^^^^^^^^^^^^^^^^^^^^^^ + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! + = note: for more information, see issue #84869 <https://github.com/rust-lang/rust/issues/84869> error: the meaning of the `pat` fragment specifier is changing in Rust 2021, which may affect this macro - --> $DIR/macro-or-patterns-back-compat.rs:6:23 + --> $DIR/macro-or-patterns-back-compat.rs:13:23 | LL | macro_rules! bar { ($($x:pat)+ | $($y:pat)+) => {} } | ^^^^^^ help: use pat_param to preserve semantics: `$x:pat_param` + | + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! + = note: for more information, see issue #84869 <https://github.com/rust-lang/rust/issues/84869> error: the meaning of the `pat` fragment specifier is changing in Rust 2021, which may affect this macro - --> $DIR/macro-or-patterns-back-compat.rs:9:21 + --> $DIR/macro-or-patterns-back-compat.rs:19:21 | LL | macro_rules! ogg { ($x:pat | $y:pat_param) => {} } | ^^^^^^ help: use pat_param to preserve semantics: `$x:pat_param` + | + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! + = note: for more information, see issue #84869 <https://github.com/rust-lang/rust/issues/84869> error: the meaning of the `pat` fragment specifier is changing in Rust 2021, which may affect this macro - --> $DIR/macro-or-patterns-back-compat.rs:11:26 + --> $DIR/macro-or-patterns-back-compat.rs:23:26 | LL | ( $expr:expr , $( $( $pat:pat )|+ => $expr_arm:expr ),+ ) => { | ^^^^^^^^ help: use pat_param to preserve semantics: `$pat:pat_param` + | + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! + = note: for more information, see issue #84869 <https://github.com/rust-lang/rust/issues/84869> error: aborting due to 4 previous errors diff --git a/src/test/ui/mir/issue-83499-input-output-iteration-ice.rs b/src/test/ui/mir/issue-83499-input-output-iteration-ice.rs index 4d404d015ec..0086d2ec18c 100644 --- a/src/test/ui/mir/issue-83499-input-output-iteration-ice.rs +++ b/src/test/ui/mir/issue-83499-input-output-iteration-ice.rs @@ -5,6 +5,6 @@ fn main() {} fn foo(_: Bar, ...) -> impl {} -//~^ ERROR only foreign or `unsafe extern "C" functions may be C-variadic +//~^ ERROR only foreign or `unsafe extern "C"` functions may be C-variadic //~| ERROR cannot find type `Bar` in this scope //~| ERROR at least one trait must be specified diff --git a/src/test/ui/mir/issue-83499-input-output-iteration-ice.stderr b/src/test/ui/mir/issue-83499-input-output-iteration-ice.stderr index eb172684899..4eb3adc8b4f 100644 --- a/src/test/ui/mir/issue-83499-input-output-iteration-ice.stderr +++ b/src/test/ui/mir/issue-83499-input-output-iteration-ice.stderr @@ -1,4 +1,4 @@ -error: only foreign or `unsafe extern "C" functions may be C-variadic +error: only foreign or `unsafe extern "C"` functions may be C-variadic --> $DIR/issue-83499-input-output-iteration-ice.rs:7:16 | LL | fn foo(_: Bar, ...) -> impl {} diff --git a/src/test/ui/moves/moves-based-on-type-no-recursive-stack-closure.rs b/src/test/ui/moves/moves-based-on-type-no-recursive-stack-closure.rs index 0385a120ce2..86fd37e7814 100644 --- a/src/test/ui/moves/moves-based-on-type-no-recursive-stack-closure.rs +++ b/src/test/ui/moves/moves-based-on-type-no-recursive-stack-closure.rs @@ -1,6 +1,6 @@ // Tests correct kind-checking of the reason stack closures without the :Copy // bound must be noncopyable. For details see -// http://smallcultfollowing.com/babysteps/blog/2013/04/30/the-case-of-the-recurring-closure/ +// https://smallcultfollowing.com/babysteps/blog/2013/04/30/the-case-of-the-recurring-closure/ struct R<'a> { // This struct is needed to create the diff --git a/src/test/ui/non-constant-in-const-path.rs b/src/test/ui/non-constant-in-const-path.rs deleted file mode 100644 index 343bb98aeb6..00000000000 --- a/src/test/ui/non-constant-in-const-path.rs +++ /dev/null @@ -1,7 +0,0 @@ -fn main() { - let x = 0; - match 1 { - 0 ..= x => {} - //~^ ERROR runtime values cannot be referenced in patterns - }; -} diff --git a/src/test/ui/non-constant-in-const-path.stderr b/src/test/ui/non-constant-in-const-path.stderr deleted file mode 100644 index 5936f76b2e0..00000000000 --- a/src/test/ui/non-constant-in-const-path.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0080]: runtime values cannot be referenced in patterns - --> $DIR/non-constant-in-const-path.rs:4:15 - | -LL | 0 ..= x => {} - | ^ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0080`. diff --git a/src/test/ui/nullable-pointer-iotareduction.rs b/src/test/ui/nullable-pointer-iotareduction.rs index 4c6964f294b..568c3e144be 100644 --- a/src/test/ui/nullable-pointer-iotareduction.rs +++ b/src/test/ui/nullable-pointer-iotareduction.rs @@ -4,7 +4,7 @@ // Iota-reduction is a rule in the Calculus of (Co-)Inductive Constructions, // which "says that a destructor applied to an object built from a constructor -// behaves as expected". -- http://coq.inria.fr/doc/Reference-Manual006.html +// behaves as expected". -- https://coq.inria.fr/doc/language/core/conversion.html#iota-reduction // // It's a little more complicated here, because of pointers and regions and // trying to get assert failure messages that at least identify which case diff --git a/src/test/ui/on-unimplemented/no-debug.stderr b/src/test/ui/on-unimplemented/no-debug.stderr index fe4114aeddc..b17c1d4c252 100644 --- a/src/test/ui/on-unimplemented/no-debug.stderr +++ b/src/test/ui/on-unimplemented/no-debug.stderr @@ -5,8 +5,7 @@ LL | println!("{:?} {:?}", Foo, Bar); | ^^^ `Foo` cannot be formatted using `{:?}` | = help: the trait `Debug` is not implemented for `Foo` - = note: add `#[derive(Debug)]` or manually implement `Debug` - = note: required by `std::fmt::Debug::fmt` + = note: add `#[derive(Debug)]` to `Foo` or manually `impl Debug for Foo` = note: this error originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: `Bar` doesn't implement `Debug` @@ -16,7 +15,6 @@ LL | println!("{:?} {:?}", Foo, Bar); | ^^^ `Bar` cannot be formatted using `{:?}` because it doesn't implement `Debug` | = help: the trait `Debug` is not implemented for `Bar` - = note: required by `std::fmt::Debug::fmt` = note: this error originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: `Foo` doesn't implement `std::fmt::Display` @@ -27,7 +25,6 @@ LL | println!("{} {}", Foo, Bar); | = help: the trait `std::fmt::Display` is not implemented for `Foo` = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead - = note: required by `std::fmt::Display::fmt` = note: this error originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: `Bar` doesn't implement `std::fmt::Display` @@ -38,7 +35,6 @@ LL | println!("{} {}", Foo, Bar); | = help: the trait `std::fmt::Display` is not implemented for `Bar` = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead - = note: required by `std::fmt::Display::fmt` = note: this error originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 4 previous errors diff --git a/src/test/ui/parser/expr-as-stmt.fixed b/src/test/ui/parser/expr-as-stmt.fixed index 02816ef2791..c217ab9774f 100644 --- a/src/test/ui/parser/expr-as-stmt.fixed +++ b/src/test/ui/parser/expr-as-stmt.fixed @@ -1,4 +1,5 @@ // run-rustfix +// rustfix-only-machine-applicable #![allow(unused_variables)] #![allow(dead_code)] #![allow(unused_must_use)] diff --git a/src/test/ui/parser/expr-as-stmt.rs b/src/test/ui/parser/expr-as-stmt.rs index 93baa8278f8..b04025faaec 100644 --- a/src/test/ui/parser/expr-as-stmt.rs +++ b/src/test/ui/parser/expr-as-stmt.rs @@ -1,4 +1,5 @@ // run-rustfix +// rustfix-only-machine-applicable #![allow(unused_variables)] #![allow(dead_code)] #![allow(unused_must_use)] diff --git a/src/test/ui/parser/expr-as-stmt.stderr b/src/test/ui/parser/expr-as-stmt.stderr index 09a6d7cbeb1..067b7edc770 100644 --- a/src/test/ui/parser/expr-as-stmt.stderr +++ b/src/test/ui/parser/expr-as-stmt.stderr @@ -1,5 +1,5 @@ error: expected expression, found `+` - --> $DIR/expr-as-stmt.rs:7:9 + --> $DIR/expr-as-stmt.rs:8:9 | LL | {2} + {2} | --- ^ expected expression @@ -7,7 +7,7 @@ LL | {2} + {2} | help: parentheses are required to parse this as an expression: `({2})` error: expected expression, found `+` - --> $DIR/expr-as-stmt.rs:12:9 + --> $DIR/expr-as-stmt.rs:13:9 | LL | {2} + 2 | --- ^ expected expression @@ -15,7 +15,7 @@ LL | {2} + 2 | help: parentheses are required to parse this as an expression: `({2})` error: expected expression, found `+` - --> $DIR/expr-as-stmt.rs:18:12 + --> $DIR/expr-as-stmt.rs:19:12 | LL | { 42 } + foo; | ------ ^ expected expression @@ -23,7 +23,7 @@ LL | { 42 } + foo; | help: parentheses are required to parse this as an expression: `({ 42 })` error: expected expression, found `>` - --> $DIR/expr-as-stmt.rs:31:7 + --> $DIR/expr-as-stmt.rs:32:7 | LL | } > 0 | ^ expected expression @@ -36,7 +36,7 @@ LL | }) > 0 | error[E0308]: mismatched types - --> $DIR/expr-as-stmt.rs:7:6 + --> $DIR/expr-as-stmt.rs:8:6 | LL | {2} + {2} | ^ expected `()`, found integer @@ -47,7 +47,7 @@ LL | {return 2;} + {2} | ^^^^^^ ^ error[E0308]: mismatched types - --> $DIR/expr-as-stmt.rs:12:6 + --> $DIR/expr-as-stmt.rs:13:6 | LL | {2} + 2 | ^ expected `()`, found integer @@ -58,7 +58,7 @@ LL | {return 2;} + 2 | ^^^^^^ ^ error[E0308]: mismatched types - --> $DIR/expr-as-stmt.rs:18:7 + --> $DIR/expr-as-stmt.rs:19:7 | LL | { 42 } + foo; | ^^ expected `()`, found integer @@ -69,7 +69,7 @@ LL | { return 42; } + foo; | ^^^^^^ ^ error[E0308]: mismatched types - --> $DIR/expr-as-stmt.rs:24:7 + --> $DIR/expr-as-stmt.rs:25:7 | LL | { 3 } * 3 | ^ expected `()`, found integer @@ -80,7 +80,7 @@ LL | { return 3; } * 3 | ^^^^^^ ^ error[E0614]: type `{integer}` cannot be dereferenced - --> $DIR/expr-as-stmt.rs:24:11 + --> $DIR/expr-as-stmt.rs:25:11 | LL | { 3 } * 3 | ----- ^^^ diff --git a/src/test/ui/parser/issue-68890-2.rs b/src/test/ui/parser/issue-68890-2.rs index 88527cc8783..0a6e26acfc7 100644 --- a/src/test/ui/parser/issue-68890-2.rs +++ b/src/test/ui/parser/issue-68890-2.rs @@ -4,4 +4,4 @@ type X<'a> = (?'a) +; //~^ ERROR `?` may only modify trait bounds, not lifetime bounds //~| ERROR at least one trait is required for an object type //~| WARN trait objects without an explicit `dyn` are deprecated -//~| WARN this was previously accepted by the compiler +//~| WARN this is accepted in the current edition diff --git a/src/test/ui/parser/issue-68890-2.stderr b/src/test/ui/parser/issue-68890-2.stderr index 37f38365b01..dce03e1a963 100644 --- a/src/test/ui/parser/issue-68890-2.stderr +++ b/src/test/ui/parser/issue-68890-2.stderr @@ -11,7 +11,7 @@ LL | type X<'a> = (?'a) +; | ^^^^^^^ help: use `dyn`: `dyn (?'a) +` | = note: `#[warn(bare_trait_objects)]` on by default - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2021 edition! + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! = note: for more information, see issue #80165 <https://github.com/rust-lang/rust/issues/80165> error[E0224]: at least one trait is required for an object type diff --git a/src/test/ui/parser/issue-73568-lifetime-after-mut.rs b/src/test/ui/parser/issue-73568-lifetime-after-mut.rs index 0733b2d2df7..e68ee747cfd 100644 --- a/src/test/ui/parser/issue-73568-lifetime-after-mut.rs +++ b/src/test/ui/parser/issue-73568-lifetime-after-mut.rs @@ -14,10 +14,10 @@ mac!('a); fn y<'a>(y: &mut 'a + Send) { //~^ ERROR expected a path on the left-hand side of `+`, not `&mut 'a` //~| WARNING trait objects without an explicit `dyn` are deprecated - //~| WARN this was previously accepted by the compiler + //~| WARN this is accepted in the current edition //~| ERROR at least one trait is required for an object type let z = y as &mut 'a + Send; //~^ ERROR expected value, found trait `Send` //~| WARNING trait objects without an explicit `dyn` are deprecated - //~| WARN this was previously accepted by the compiler + //~| WARN this is accepted in the current edition } diff --git a/src/test/ui/parser/issue-73568-lifetime-after-mut.stderr b/src/test/ui/parser/issue-73568-lifetime-after-mut.stderr index f83b7944b1b..c10037d44e3 100644 --- a/src/test/ui/parser/issue-73568-lifetime-after-mut.stderr +++ b/src/test/ui/parser/issue-73568-lifetime-after-mut.stderr @@ -34,7 +34,7 @@ LL | fn y<'a>(y: &mut 'a + Send) { | ^^ help: use `dyn`: `dyn 'a` | = note: `#[warn(bare_trait_objects)]` on by default - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2021 edition! + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! = note: for more information, see issue #80165 <https://github.com/rust-lang/rust/issues/80165> warning: trait objects without an explicit `dyn` are deprecated @@ -43,7 +43,7 @@ warning: trait objects without an explicit `dyn` are deprecated LL | let z = y as &mut 'a + Send; | ^^ help: use `dyn`: `dyn 'a` | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2021 edition! + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! = note: for more information, see issue #80165 <https://github.com/rust-lang/rust/issues/80165> error[E0224]: at least one trait is required for an object type diff --git a/src/test/ui/parser/macro/trait-object-macro-matcher.rs b/src/test/ui/parser/macro/trait-object-macro-matcher.rs index 0428ea0e2c1..663739f235a 100644 --- a/src/test/ui/parser/macro/trait-object-macro-matcher.rs +++ b/src/test/ui/parser/macro/trait-object-macro-matcher.rs @@ -12,5 +12,5 @@ fn main() { //~^ ERROR lifetime in trait object type must be followed by `+` //~| ERROR at least one trait is required for an object type //~| WARN trait objects without an explicit `dyn` are deprecated - //~| WARN this was previously accepted by the compiler + //~| WARN this is accepted in the current edition } diff --git a/src/test/ui/parser/macro/trait-object-macro-matcher.stderr b/src/test/ui/parser/macro/trait-object-macro-matcher.stderr index 8ae5611d89d..caca84f695d 100644 --- a/src/test/ui/parser/macro/trait-object-macro-matcher.stderr +++ b/src/test/ui/parser/macro/trait-object-macro-matcher.stderr @@ -11,7 +11,7 @@ LL | m!('static); | ^^^^^^^ help: use `dyn`: `dyn 'static` | = note: `#[warn(bare_trait_objects)]` on by default - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2021 edition! + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! = note: for more information, see issue #80165 <https://github.com/rust-lang/rust/issues/80165> error[E0224]: at least one trait is required for an object type diff --git a/src/test/ui/parser/parser-unicode-whitespace.rs b/src/test/ui/parser/parser-unicode-whitespace.rs index 2d1fa7dc42e..555cd68c3a7 100644 --- a/src/test/ui/parser/parser-unicode-whitespace.rs +++ b/src/test/ui/parser/parser-unicode-whitespace.rs @@ -1,7 +1,7 @@ // run-pass // Beware editing: it has numerous whitespace characters which are important. // It contains one ranges from the 'PATTERN_WHITE_SPACE' property outlined in -// http://unicode.org/Public/UNIDATA/PropList.txt +// https://unicode.org/Public/UNIDATA/PropList.txt // // The characters in the first expression of the assertion can be generated // from: "4\u{0C}+\n\t\r7\t*\u{20}2\u{85}/\u{200E}3\u{200F}*\u{2028}2\u{2029}" diff --git a/src/test/ui/parser/recover-range-pats.rs b/src/test/ui/parser/recover-range-pats.rs index a10add6d9e5..2e5a991543f 100644 --- a/src/test/ui/parser/recover-range-pats.rs +++ b/src/test/ui/parser/recover-range-pats.rs @@ -41,30 +41,30 @@ fn inclusive_from_to() { fn inclusive2_from_to() { if let 0...3 = 0 {} //~^ ERROR `...` range patterns are deprecated - //~| WARN this was previously accepted by the compiler + //~| WARN this is accepted in the current edition if let 0...Y = 0 {} //~^ ERROR `...` range patterns are deprecated - //~| WARN this was previously accepted by the compiler + //~| WARN this is accepted in the current edition if let X...3 = 0 {} //~^ ERROR `...` range patterns are deprecated - //~| WARN this was previously accepted by the compiler + //~| WARN this is accepted in the current edition if let X...Y = 0 {} //~^ ERROR `...` range patterns are deprecated - //~| WARN this was previously accepted by the compiler + //~| WARN this is accepted in the current edition if let true...Y = 0 {} //~ ERROR only `char` and numeric types //~^ ERROR `...` range patterns are deprecated - //~| WARN this was previously accepted by the compiler + //~| WARN this is accepted in the current edition if let X...true = 0 {} //~ ERROR only `char` and numeric types //~^ ERROR `...` range patterns are deprecated - //~| WARN this was previously accepted by the compiler + //~| WARN this is accepted in the current edition if let .0...Y = 0 {} //~ ERROR mismatched types //~^ ERROR float literals must have an integer part - //~| WARN this was previously accepted by the compiler + //~| WARN this is accepted in the current edition //~| ERROR `...` range patterns are deprecated if let X... .0 = 0 {} //~ ERROR mismatched types //~^ ERROR float literals must have an integer part //~| ERROR `...` range patterns are deprecated - //~| WARN this was previously accepted by the compiler + //~| WARN this is accepted in the current edition } fn exclusive_from() { @@ -137,7 +137,7 @@ fn with_macro_expr_var() { let $e1..$e2; let $e1...$e2; //~^ ERROR `...` range patterns are deprecated - //~| WARN this was previously accepted by the compiler + //~| WARN this is accepted in the current edition let $e1..=$e2; } } diff --git a/src/test/ui/parser/recover-range-pats.stderr b/src/test/ui/parser/recover-range-pats.stderr index 3236ef0db28..2d8088432a2 100644 --- a/src/test/ui/parser/recover-range-pats.stderr +++ b/src/test/ui/parser/recover-range-pats.stderr @@ -204,7 +204,7 @@ note: the lint level is defined here | LL | #![deny(ellipsis_inclusive_range_patterns)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2021 edition! + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! = note: for more information, see issue #80165 <https://github.com/rust-lang/rust/issues/80165> error: `...` range patterns are deprecated @@ -213,7 +213,7 @@ error: `...` range patterns are deprecated LL | if let 0...Y = 0 {} | ^^^ help: use `..=` for an inclusive range | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2021 edition! + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! = note: for more information, see issue #80165 <https://github.com/rust-lang/rust/issues/80165> error: `...` range patterns are deprecated @@ -222,7 +222,7 @@ error: `...` range patterns are deprecated LL | if let X...3 = 0 {} | ^^^ help: use `..=` for an inclusive range | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2021 edition! + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! = note: for more information, see issue #80165 <https://github.com/rust-lang/rust/issues/80165> error: `...` range patterns are deprecated @@ -231,7 +231,7 @@ error: `...` range patterns are deprecated LL | if let X...Y = 0 {} | ^^^ help: use `..=` for an inclusive range | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2021 edition! + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! = note: for more information, see issue #80165 <https://github.com/rust-lang/rust/issues/80165> error: `...` range patterns are deprecated @@ -240,7 +240,7 @@ error: `...` range patterns are deprecated LL | if let true...Y = 0 {} | ^^^ help: use `..=` for an inclusive range | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2021 edition! + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! = note: for more information, see issue #80165 <https://github.com/rust-lang/rust/issues/80165> error: `...` range patterns are deprecated @@ -249,7 +249,7 @@ error: `...` range patterns are deprecated LL | if let X...true = 0 {} | ^^^ help: use `..=` for an inclusive range | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2021 edition! + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! = note: for more information, see issue #80165 <https://github.com/rust-lang/rust/issues/80165> error: `...` range patterns are deprecated @@ -258,7 +258,7 @@ error: `...` range patterns are deprecated LL | if let .0...Y = 0 {} | ^^^ help: use `..=` for an inclusive range | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2021 edition! + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! = note: for more information, see issue #80165 <https://github.com/rust-lang/rust/issues/80165> error: `...` range patterns are deprecated @@ -267,7 +267,7 @@ error: `...` range patterns are deprecated LL | if let X... .0 = 0 {} | ^^^ help: use `..=` for an inclusive range | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2021 edition! + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! = note: for more information, see issue #80165 <https://github.com/rust-lang/rust/issues/80165> error: `...` range patterns are deprecated @@ -279,7 +279,7 @@ LL | let $e1...$e2; LL | mac2!(0, 1); | ------------ in this macro invocation | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2021 edition! + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! = note: for more information, see issue #80165 <https://github.com/rust-lang/rust/issues/80165> = note: this error originates in the macro `mac2` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/src/test/ui/parser/stmt_expr_attrs_placement.rs b/src/test/ui/parser/stmt_expr_attrs_placement.rs index d488cd0c2d3..5e9d29a152f 100644 --- a/src/test/ui/parser/stmt_expr_attrs_placement.rs +++ b/src/test/ui/parser/stmt_expr_attrs_placement.rs @@ -30,7 +30,7 @@ fn main() { //~^ ERROR an inner attribute is not permitted in this context let g = match true { #![allow(warnings)] _ => {} }; - //~^ ERROR an inner attribute is not permitted in this context + struct MyStruct { field: u8 } let h = MyStruct { #![allow(warnings)] field: 0 }; diff --git a/src/test/ui/parser/stmt_expr_attrs_placement.stderr b/src/test/ui/parser/stmt_expr_attrs_placement.stderr index 185cc009640..808903d9c62 100644 --- a/src/test/ui/parser/stmt_expr_attrs_placement.stderr +++ b/src/test/ui/parser/stmt_expr_attrs_placement.stderr @@ -47,14 +47,6 @@ LL | let f = [#![allow(warnings)] 1; 0]; = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files. Outer attributes, like `#[test]`, annotate the item following them. error: an inner attribute is not permitted in this context - --> $DIR/stmt_expr_attrs_placement.rs:32:26 - | -LL | let g = match true { #![allow(warnings)] _ => {} }; - | ^^^^^^^^^^^^^^^^^^^ - | - = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files. Outer attributes, like `#[test]`, annotate the item following them. - -error: an inner attribute is not permitted in this context --> $DIR/stmt_expr_attrs_placement.rs:36:24 | LL | let h = MyStruct { #![allow(warnings)] field: 0 }; @@ -62,5 +54,5 @@ LL | let h = MyStruct { #![allow(warnings)] field: 0 }; | = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files. Outer attributes, like `#[test]`, annotate the item following them. -error: aborting due to 8 previous errors +error: aborting due to 7 previous errors diff --git a/src/test/ui/parser/trait-object-trait-parens.rs b/src/test/ui/parser/trait-object-trait-parens.rs index 7d55da7d097..438034bc38a 100644 --- a/src/test/ui/parser/trait-object-trait-parens.rs +++ b/src/test/ui/parser/trait-object-trait-parens.rs @@ -9,15 +9,15 @@ fn main() { //~^ ERROR `?Trait` is not permitted in trait object types //~| ERROR only auto traits can be used as additional traits //~| WARN trait objects without an explicit `dyn` are deprecated - //~| WARN this was previously accepted by the compiler + //~| WARN this is accepted in the current edition let _: Box<?Sized + (for<'a> Trait<'a>) + (Obj)>; //~^ ERROR `?Trait` is not permitted in trait object types //~| ERROR only auto traits can be used as additional traits //~| WARN trait objects without an explicit `dyn` are deprecated - //~| WARN this was previously accepted by the compiler + //~| WARN this is accepted in the current edition let _: Box<for<'a> Trait<'a> + (Obj) + (?Sized)>; //~^ ERROR `?Trait` is not permitted in trait object types //~| ERROR only auto traits can be used as additional traits //~| WARN trait objects without an explicit `dyn` are deprecated - //~| WARN this was previously accepted by the compiler + //~| WARN this is accepted in the current edition } diff --git a/src/test/ui/parser/trait-object-trait-parens.stderr b/src/test/ui/parser/trait-object-trait-parens.stderr index 79b6892dc07..9bfc4943fe9 100644 --- a/src/test/ui/parser/trait-object-trait-parens.stderr +++ b/src/test/ui/parser/trait-object-trait-parens.stderr @@ -23,7 +23,7 @@ LL | let _: Box<(Obj) + (?Sized) + (for<'a> Trait<'a>)>; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `dyn`: `dyn (Obj) + (?Sized) + (for<'a> Trait<'a>)` | = note: `#[warn(bare_trait_objects)]` on by default - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2021 edition! + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! = note: for more information, see issue #80165 <https://github.com/rust-lang/rust/issues/80165> warning: trait objects without an explicit `dyn` are deprecated @@ -32,7 +32,7 @@ warning: trait objects without an explicit `dyn` are deprecated LL | let _: Box<?Sized + (for<'a> Trait<'a>) + (Obj)>; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `dyn`: `dyn ?Sized + (for<'a> Trait<'a>) + (Obj)` | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2021 edition! + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! = note: for more information, see issue #80165 <https://github.com/rust-lang/rust/issues/80165> warning: trait objects without an explicit `dyn` are deprecated @@ -41,7 +41,7 @@ warning: trait objects without an explicit `dyn` are deprecated LL | let _: Box<for<'a> Trait<'a> + (Obj) + (?Sized)>; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `dyn`: `dyn for<'a> Trait<'a> + (Obj) + (?Sized)` | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2021 edition! + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! = note: for more information, see issue #80165 <https://github.com/rust-lang/rust/issues/80165> error[E0225]: only auto traits can be used as additional traits in a trait object diff --git a/src/test/ui/parser/variadic-ffi-semantic-restrictions.rs b/src/test/ui/parser/variadic-ffi-semantic-restrictions.rs index fe993a6ee13..0b61e267da8 100644 --- a/src/test/ui/parser/variadic-ffi-semantic-restrictions.rs +++ b/src/test/ui/parser/variadic-ffi-semantic-restrictions.rs @@ -4,32 +4,32 @@ fn main() {} fn f1_1(x: isize, ...) {} -//~^ ERROR only foreign or `unsafe extern "C" functions may be C-variadic +//~^ ERROR only foreign or `unsafe extern "C"` functions may be C-variadic fn f1_2(...) {} -//~^ ERROR only foreign or `unsafe extern "C" functions may be C-variadic +//~^ ERROR only foreign or `unsafe extern "C"` functions may be C-variadic //~| ERROR C-variadic function must be declared with at least one named argument extern "C" fn f2_1(x: isize, ...) {} -//~^ ERROR only foreign or `unsafe extern "C" functions may be C-variadic +//~^ ERROR only foreign or `unsafe extern "C"` functions may be C-variadic extern "C" fn f2_2(...) {} -//~^ ERROR only foreign or `unsafe extern "C" functions may be C-variadic +//~^ ERROR only foreign or `unsafe extern "C"` functions may be C-variadic //~| ERROR C-variadic function must be declared with at least one named argument extern "C" fn f2_3(..., x: isize) {} -//~^ ERROR only foreign or `unsafe extern "C" functions may be C-variadic +//~^ ERROR only foreign or `unsafe extern "C"` functions may be C-variadic //~| ERROR `...` must be the last argument of a C-variadic function extern "C" fn f3_1(x: isize, ...) {} -//~^ ERROR only foreign or `unsafe extern "C" functions may be C-variadic +//~^ ERROR only foreign or `unsafe extern "C"` functions may be C-variadic extern "C" fn f3_2(...) {} -//~^ ERROR only foreign or `unsafe extern "C" functions may be C-variadic +//~^ ERROR only foreign or `unsafe extern "C"` functions may be C-variadic //~| ERROR C-variadic function must be declared with at least one named argument extern "C" fn f3_3(..., x: isize) {} -//~^ ERROR only foreign or `unsafe extern "C" functions may be C-variadic +//~^ ERROR only foreign or `unsafe extern "C"` functions may be C-variadic //~| ERROR `...` must be the last argument of a C-variadic function extern "C" { @@ -43,35 +43,35 @@ struct X; impl X { fn i_f1(x: isize, ...) {} - //~^ ERROR only foreign or `unsafe extern "C" functions may be C-variadic + //~^ ERROR only foreign or `unsafe extern "C"` functions may be C-variadic fn i_f2(...) {} - //~^ ERROR only foreign or `unsafe extern "C" functions may be C-variadic + //~^ ERROR only foreign or `unsafe extern "C"` functions may be C-variadic //~| ERROR C-variadic function must be declared with at least one named argument fn i_f3(..., x: isize, ...) {} - //~^ ERROR only foreign or `unsafe extern "C" functions may be C-variadic - //~| ERROR only foreign or `unsafe extern "C" functions may be C-variadic + //~^ ERROR only foreign or `unsafe extern "C"` functions may be C-variadic + //~| ERROR only foreign or `unsafe extern "C"` functions may be C-variadic //~| ERROR `...` must be the last argument of a C-variadic function fn i_f4(..., x: isize, ...) {} - //~^ ERROR only foreign or `unsafe extern "C" functions may be C-variadic - //~| ERROR only foreign or `unsafe extern "C" functions may be C-variadic + //~^ ERROR only foreign or `unsafe extern "C"` functions may be C-variadic + //~| ERROR only foreign or `unsafe extern "C"` functions may be C-variadic //~| ERROR `...` must be the last argument of a C-variadic function } trait T { fn t_f1(x: isize, ...) {} - //~^ ERROR only foreign or `unsafe extern "C" functions may be C-variadic + //~^ ERROR only foreign or `unsafe extern "C"` functions may be C-variadic fn t_f2(x: isize, ...); - //~^ ERROR only foreign or `unsafe extern "C" functions may be C-variadic + //~^ ERROR only foreign or `unsafe extern "C"` functions may be C-variadic fn t_f3(...) {} - //~^ ERROR only foreign or `unsafe extern "C" functions may be C-variadic + //~^ ERROR only foreign or `unsafe extern "C"` functions may be C-variadic //~| ERROR C-variadic function must be declared with at least one named argument fn t_f4(...); - //~^ ERROR only foreign or `unsafe extern "C" functions may be C-variadic + //~^ ERROR only foreign or `unsafe extern "C"` functions may be C-variadic //~| ERROR C-variadic function must be declared with at least one named argument fn t_f5(..., x: isize) {} - //~^ ERROR only foreign or `unsafe extern "C" functions may be C-variadic + //~^ ERROR only foreign or `unsafe extern "C"` functions may be C-variadic //~| ERROR `...` must be the last argument of a C-variadic function fn t_f6(..., x: isize); - //~^ ERROR only foreign or `unsafe extern "C" functions may be C-variadic + //~^ ERROR only foreign or `unsafe extern "C"` functions may be C-variadic //~| ERROR `...` must be the last argument of a C-variadic function } diff --git a/src/test/ui/parser/variadic-ffi-semantic-restrictions.stderr b/src/test/ui/parser/variadic-ffi-semantic-restrictions.stderr index 10fd05c0bef..f1cbbb279c8 100644 --- a/src/test/ui/parser/variadic-ffi-semantic-restrictions.stderr +++ b/src/test/ui/parser/variadic-ffi-semantic-restrictions.stderr @@ -1,4 +1,4 @@ -error: only foreign or `unsafe extern "C" functions may be C-variadic +error: only foreign or `unsafe extern "C"` functions may be C-variadic --> $DIR/variadic-ffi-semantic-restrictions.rs:6:19 | LL | fn f1_1(x: isize, ...) {} @@ -10,13 +10,13 @@ error: C-variadic function must be declared with at least one named argument LL | fn f1_2(...) {} | ^^^ -error: only foreign or `unsafe extern "C" functions may be C-variadic +error: only foreign or `unsafe extern "C"` functions may be C-variadic --> $DIR/variadic-ffi-semantic-restrictions.rs:9:9 | LL | fn f1_2(...) {} | ^^^ -error: only foreign or `unsafe extern "C" functions may be C-variadic +error: only foreign or `unsafe extern "C"` functions may be C-variadic --> $DIR/variadic-ffi-semantic-restrictions.rs:13:30 | LL | extern "C" fn f2_1(x: isize, ...) {} @@ -28,7 +28,7 @@ error: C-variadic function must be declared with at least one named argument LL | extern "C" fn f2_2(...) {} | ^^^ -error: only foreign or `unsafe extern "C" functions may be C-variadic +error: only foreign or `unsafe extern "C"` functions may be C-variadic --> $DIR/variadic-ffi-semantic-restrictions.rs:16:20 | LL | extern "C" fn f2_2(...) {} @@ -40,13 +40,13 @@ error: `...` must be the last argument of a C-variadic function LL | extern "C" fn f2_3(..., x: isize) {} | ^^^ -error: only foreign or `unsafe extern "C" functions may be C-variadic +error: only foreign or `unsafe extern "C"` functions may be C-variadic --> $DIR/variadic-ffi-semantic-restrictions.rs:20:20 | LL | extern "C" fn f2_3(..., x: isize) {} | ^^^ -error: only foreign or `unsafe extern "C" functions may be C-variadic +error: only foreign or `unsafe extern "C"` functions may be C-variadic --> $DIR/variadic-ffi-semantic-restrictions.rs:24:30 | LL | extern "C" fn f3_1(x: isize, ...) {} @@ -58,7 +58,7 @@ error: C-variadic function must be declared with at least one named argument LL | extern "C" fn f3_2(...) {} | ^^^ -error: only foreign or `unsafe extern "C" functions may be C-variadic +error: only foreign or `unsafe extern "C"` functions may be C-variadic --> $DIR/variadic-ffi-semantic-restrictions.rs:27:20 | LL | extern "C" fn f3_2(...) {} @@ -70,7 +70,7 @@ error: `...` must be the last argument of a C-variadic function LL | extern "C" fn f3_3(..., x: isize) {} | ^^^ -error: only foreign or `unsafe extern "C" functions may be C-variadic +error: only foreign or `unsafe extern "C"` functions may be C-variadic --> $DIR/variadic-ffi-semantic-restrictions.rs:31:20 | LL | extern "C" fn f3_3(..., x: isize) {} @@ -88,7 +88,7 @@ error: `...` must be the last argument of a C-variadic function LL | fn e_f2(..., x: isize); | ^^^ -error: only foreign or `unsafe extern "C" functions may be C-variadic +error: only foreign or `unsafe extern "C"` functions may be C-variadic --> $DIR/variadic-ffi-semantic-restrictions.rs:45:23 | LL | fn i_f1(x: isize, ...) {} @@ -100,7 +100,7 @@ error: C-variadic function must be declared with at least one named argument LL | fn i_f2(...) {} | ^^^ -error: only foreign or `unsafe extern "C" functions may be C-variadic +error: only foreign or `unsafe extern "C"` functions may be C-variadic --> $DIR/variadic-ffi-semantic-restrictions.rs:47:13 | LL | fn i_f2(...) {} @@ -112,13 +112,13 @@ error: `...` must be the last argument of a C-variadic function LL | fn i_f3(..., x: isize, ...) {} | ^^^ -error: only foreign or `unsafe extern "C" functions may be C-variadic +error: only foreign or `unsafe extern "C"` functions may be C-variadic --> $DIR/variadic-ffi-semantic-restrictions.rs:50:13 | LL | fn i_f3(..., x: isize, ...) {} | ^^^ -error: only foreign or `unsafe extern "C" functions may be C-variadic +error: only foreign or `unsafe extern "C"` functions may be C-variadic --> $DIR/variadic-ffi-semantic-restrictions.rs:50:28 | LL | fn i_f3(..., x: isize, ...) {} @@ -130,25 +130,25 @@ error: `...` must be the last argument of a C-variadic function LL | fn i_f4(..., x: isize, ...) {} | ^^^ -error: only foreign or `unsafe extern "C" functions may be C-variadic +error: only foreign or `unsafe extern "C"` functions may be C-variadic --> $DIR/variadic-ffi-semantic-restrictions.rs:54:13 | LL | fn i_f4(..., x: isize, ...) {} | ^^^ -error: only foreign or `unsafe extern "C" functions may be C-variadic +error: only foreign or `unsafe extern "C"` functions may be C-variadic --> $DIR/variadic-ffi-semantic-restrictions.rs:54:28 | LL | fn i_f4(..., x: isize, ...) {} | ^^^ -error: only foreign or `unsafe extern "C" functions may be C-variadic +error: only foreign or `unsafe extern "C"` functions may be C-variadic --> $DIR/variadic-ffi-semantic-restrictions.rs:61:23 | LL | fn t_f1(x: isize, ...) {} | ^^^ -error: only foreign or `unsafe extern "C" functions may be C-variadic +error: only foreign or `unsafe extern "C"` functions may be C-variadic --> $DIR/variadic-ffi-semantic-restrictions.rs:63:23 | LL | fn t_f2(x: isize, ...); @@ -160,7 +160,7 @@ error: C-variadic function must be declared with at least one named argument LL | fn t_f3(...) {} | ^^^ -error: only foreign or `unsafe extern "C" functions may be C-variadic +error: only foreign or `unsafe extern "C"` functions may be C-variadic --> $DIR/variadic-ffi-semantic-restrictions.rs:65:13 | LL | fn t_f3(...) {} @@ -172,7 +172,7 @@ error: C-variadic function must be declared with at least one named argument LL | fn t_f4(...); | ^^^ -error: only foreign or `unsafe extern "C" functions may be C-variadic +error: only foreign or `unsafe extern "C"` functions may be C-variadic --> $DIR/variadic-ffi-semantic-restrictions.rs:68:13 | LL | fn t_f4(...); @@ -184,7 +184,7 @@ error: `...` must be the last argument of a C-variadic function LL | fn t_f5(..., x: isize) {} | ^^^ -error: only foreign or `unsafe extern "C" functions may be C-variadic +error: only foreign or `unsafe extern "C"` functions may be C-variadic --> $DIR/variadic-ffi-semantic-restrictions.rs:71:13 | LL | fn t_f5(..., x: isize) {} @@ -196,7 +196,7 @@ error: `...` must be the last argument of a C-variadic function LL | fn t_f6(..., x: isize); | ^^^ -error: only foreign or `unsafe extern "C" functions may be C-variadic +error: only foreign or `unsafe extern "C"` functions may be C-variadic --> $DIR/variadic-ffi-semantic-restrictions.rs:74:13 | LL | fn t_f6(..., x: isize); diff --git a/src/test/ui/pattern/issue-68394-let-pat-runtime-value.rs b/src/test/ui/pattern/issue-68394-let-pat-runtime-value.rs deleted file mode 100644 index f10a7f2d8a5..00000000000 --- a/src/test/ui/pattern/issue-68394-let-pat-runtime-value.rs +++ /dev/null @@ -1,5 +0,0 @@ -fn main() { - let x = 255u8; - let 0u8..=x = 0; - //~^ ERROR runtime values cannot be referenced in patterns -} diff --git a/src/test/ui/pattern/issue-68394-let-pat-runtime-value.stderr b/src/test/ui/pattern/issue-68394-let-pat-runtime-value.stderr deleted file mode 100644 index c1508bd71ff..00000000000 --- a/src/test/ui/pattern/issue-68394-let-pat-runtime-value.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0080]: runtime values cannot be referenced in patterns - --> $DIR/issue-68394-let-pat-runtime-value.rs:3:15 - | -LL | let 0u8..=x = 0; - | ^ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0080`. diff --git a/src/test/ui/pattern/non-constant-in-const-path.rs b/src/test/ui/pattern/non-constant-in-const-path.rs new file mode 100644 index 00000000000..3918485bacb --- /dev/null +++ b/src/test/ui/pattern/non-constant-in-const-path.rs @@ -0,0 +1,18 @@ +// Checks if we emit `PatternError`s correctly. +// This is also a regression test for #27895 and #68394. + +static FOO: u8 = 10; + +fn main() { + let x = 0; + let 0u8..=x = 0; + //~^ ERROR: runtime values cannot be referenced in patterns + let 0u8..=FOO = 0; + //~^ ERROR: statics cannot be referenced in patterns + match 1 { + 0 ..= x => {} + //~^ ERROR: runtime values cannot be referenced in patterns + 0 ..= FOO => {} + //~^ ERROR: statics cannot be referenced in patterns + }; +} diff --git a/src/test/ui/pattern/non-constant-in-const-path.stderr b/src/test/ui/pattern/non-constant-in-const-path.stderr new file mode 100644 index 00000000000..53c3974f780 --- /dev/null +++ b/src/test/ui/pattern/non-constant-in-const-path.stderr @@ -0,0 +1,28 @@ +error[E0080]: runtime values cannot be referenced in patterns + --> $DIR/non-constant-in-const-path.rs:8:15 + | +LL | let 0u8..=x = 0; + | ^ + +error[E0158]: statics cannot be referenced in patterns + --> $DIR/non-constant-in-const-path.rs:10:15 + | +LL | let 0u8..=FOO = 0; + | ^^^ + +error[E0080]: runtime values cannot be referenced in patterns + --> $DIR/non-constant-in-const-path.rs:13:15 + | +LL | 0 ..= x => {} + | ^ + +error[E0158]: statics cannot be referenced in patterns + --> $DIR/non-constant-in-const-path.rs:15:15 + | +LL | 0 ..= FOO => {} + | ^^^ + +error: aborting due to 4 previous errors + +Some errors have detailed explanations: E0080, E0158. +For more information about an error, try `rustc --explain E0080`. diff --git a/src/test/ui/range/range-inclusive-pattern-precedence.fixed b/src/test/ui/range/range-inclusive-pattern-precedence.fixed index 6c012099676..8a4b8fc38e3 100644 --- a/src/test/ui/range/range-inclusive-pattern-precedence.fixed +++ b/src/test/ui/range/range-inclusive-pattern-precedence.fixed @@ -10,7 +10,7 @@ pub fn main() { match &12 { &(0..=9) => {} //~^ WARN `...` range patterns are deprecated - //~| WARN this was previously accepted by the compiler + //~| WARN this is accepted in the current edition //~| HELP use `..=` for an inclusive range &(10 ..=15) => {} //~^ ERROR the range pattern here has ambiguous interpretation diff --git a/src/test/ui/range/range-inclusive-pattern-precedence.rs b/src/test/ui/range/range-inclusive-pattern-precedence.rs index ce763ba2677..b294e436fa6 100644 --- a/src/test/ui/range/range-inclusive-pattern-precedence.rs +++ b/src/test/ui/range/range-inclusive-pattern-precedence.rs @@ -10,7 +10,7 @@ pub fn main() { match &12 { &0...9 => {} //~^ WARN `...` range patterns are deprecated - //~| WARN this was previously accepted by the compiler + //~| WARN this is accepted in the current edition //~| HELP use `..=` for an inclusive range &10..=15 => {} //~^ ERROR the range pattern here has ambiguous interpretation diff --git a/src/test/ui/range/range-inclusive-pattern-precedence.stderr b/src/test/ui/range/range-inclusive-pattern-precedence.stderr index ffb833535c2..3330ced1ebf 100644 --- a/src/test/ui/range/range-inclusive-pattern-precedence.stderr +++ b/src/test/ui/range/range-inclusive-pattern-precedence.stderr @@ -15,7 +15,7 @@ note: the lint level is defined here | LL | #![warn(ellipsis_inclusive_range_patterns)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2021 edition! + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! = note: for more information, see issue #80165 <https://github.com/rust-lang/rust/issues/80165> error: aborting due to previous error; 1 warning emitted diff --git a/src/test/ui/range/range-inclusive-pattern-precedence2.rs b/src/test/ui/range/range-inclusive-pattern-precedence2.rs index 7fa2698a496..bede9c57976 100644 --- a/src/test/ui/range/range-inclusive-pattern-precedence2.rs +++ b/src/test/ui/range/range-inclusive-pattern-precedence2.rs @@ -9,7 +9,7 @@ fn main() { // FIXME: can we add suggestions like `&(0..=9)`? box 0...9 => {} //~^ WARN `...` range patterns are deprecated - //~| WARN this was previously accepted by the compiler + //~| WARN this is accepted in the current edition //~| HELP use `..=` for an inclusive range box 10..=15 => {} //~^ ERROR the range pattern here has ambiguous interpretation diff --git a/src/test/ui/range/range-inclusive-pattern-precedence2.stderr b/src/test/ui/range/range-inclusive-pattern-precedence2.stderr index e8e62b485cc..90a4aa68222 100644 --- a/src/test/ui/range/range-inclusive-pattern-precedence2.stderr +++ b/src/test/ui/range/range-inclusive-pattern-precedence2.stderr @@ -15,7 +15,7 @@ note: the lint level is defined here | LL | #![warn(ellipsis_inclusive_range_patterns)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2021 edition! + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! = note: for more information, see issue #80165 <https://github.com/rust-lang/rust/issues/80165> error: aborting due to previous error; 1 warning emitted diff --git a/src/test/ui/repr/issue-83505-repr-simd.rs b/src/test/ui/repr/issue-83505-repr-simd.rs new file mode 100644 index 00000000000..280b771d015 --- /dev/null +++ b/src/test/ui/repr/issue-83505-repr-simd.rs @@ -0,0 +1,10 @@ +// Regression test for the ICE described in #83505. + +#![crate_type="lib"] + +#[repr(simd)] +//~^ ERROR: attribute should be applied to a struct [E0517] +//~| ERROR: unsupported representation for zero-variant enum [E0084] +enum Es {} +static CLs: Es; +//~^ ERROR: free static item without body diff --git a/src/test/ui/repr/issue-83505-repr-simd.stderr b/src/test/ui/repr/issue-83505-repr-simd.stderr new file mode 100644 index 00000000000..f1390a65201 --- /dev/null +++ b/src/test/ui/repr/issue-83505-repr-simd.stderr @@ -0,0 +1,30 @@ +error: free static item without body + --> $DIR/issue-83505-repr-simd.rs:9:1 + | +LL | static CLs: Es; + | ^^^^^^^^^^^^^^- + | | + | help: provide a definition for the static: `= <expr>;` + +error[E0517]: attribute should be applied to a struct + --> $DIR/issue-83505-repr-simd.rs:5:8 + | +LL | #[repr(simd)] + | ^^^^ +... +LL | enum Es {} + | ---------- not a struct + +error[E0084]: unsupported representation for zero-variant enum + --> $DIR/issue-83505-repr-simd.rs:5:1 + | +LL | #[repr(simd)] + | ^^^^^^^^^^^^^ +... +LL | enum Es {} + | ---------- zero-variant enum + +error: aborting due to 3 previous errors + +Some errors have detailed explanations: E0084, E0517. +For more information about an error, try `rustc --explain E0084`. diff --git a/src/test/ui/repr/repr-transparent.rs b/src/test/ui/repr/repr-transparent.rs index 8fbdb4cc80b..8c9d1639c0a 100644 --- a/src/test/ui/repr/repr-transparent.rs +++ b/src/test/ui/repr/repr-transparent.rs @@ -8,27 +8,29 @@ use std::marker::PhantomData; #[repr(transparent)] -struct NoFields; //~ ERROR needs exactly one non-zero-sized field +struct NoFields; #[repr(transparent)] -struct ContainsOnlyZst(()); //~ ERROR needs exactly one non-zero-sized field +struct ContainsOnlyZst(()); #[repr(transparent)] -struct ContainsOnlyZstArray([bool; 0]); //~ ERROR needs exactly one non-zero-sized field +struct ContainsOnlyZstArray([bool; 0]); #[repr(transparent)] struct ContainsMultipleZst(PhantomData<*const i32>, NoFields); -//~^ ERROR needs exactly one non-zero-sized field #[repr(transparent)] -struct MultipleNonZst(u8, u8); //~ ERROR needs exactly one non-zero-sized field +struct ContainsZstAndNonZst((), [i32; 2]); + +#[repr(transparent)] +struct MultipleNonZst(u8, u8); //~ ERROR needs at most one non-zero-sized field trait Mirror { type It: ?Sized; } impl<T: ?Sized> Mirror for T { type It = Self; } #[repr(transparent)] pub struct StructWithProjection(f32, <f32 as Mirror>::It); -//~^ ERROR needs exactly one non-zero-sized field +//~^ ERROR needs at most one non-zero-sized field #[repr(transparent)] struct NontrivialAlignZst(u32, [u16; 0]); //~ ERROR alignment larger than 1 @@ -40,22 +42,26 @@ struct ZstAlign32<T>(PhantomData<T>); struct GenericAlign<T>(ZstAlign32<T>, u32); //~ ERROR alignment larger than 1 #[repr(transparent)] //~ ERROR unsupported representation for zero-variant enum -enum Void {} -//~^ ERROR transparent enum needs exactly one variant, but has 0 +enum Void {} //~ ERROR transparent enum needs exactly one variant, but has 0 #[repr(transparent)] -enum FieldlessEnum { //~ ERROR transparent enum needs exactly one non-zero-sized field, but has 0 +enum FieldlessEnum { Foo, } #[repr(transparent)] +enum UnitFieldEnum { + Foo(()), +} + +#[repr(transparent)] enum TooManyFieldsEnum { Foo(u32, String), } -//~^^^ ERROR transparent enum needs exactly one non-zero-sized field, but has 2 +//~^^^ ERROR transparent enum needs at most one non-zero-sized field, but has 2 #[repr(transparent)] -enum TooManyVariants { //~ ERROR transparent enum needs exactly one variant, but has 2 +enum MultipleVariants { //~ ERROR transparent enum needs exactly one variant, but has 2 Foo(String), Bar, } @@ -71,12 +77,12 @@ enum GenericAlignEnum<T> { } #[repr(transparent)] -union UnitUnion { //~ ERROR transparent union needs exactly one non-zero-sized field, but has 0 +union UnitUnion { u: (), } #[repr(transparent)] -union TooManyFields { //~ ERROR transparent union needs exactly one non-zero-sized field, but has 2 +union TooManyFields { //~ ERROR transparent union needs at most one non-zero-sized field, but has 2 u: u32, s: i32 } diff --git a/src/test/ui/repr/repr-transparent.stderr b/src/test/ui/repr/repr-transparent.stderr index cbc74fbb6a2..001a181881f 100644 --- a/src/test/ui/repr/repr-transparent.stderr +++ b/src/test/ui/repr/repr-transparent.stderr @@ -1,61 +1,37 @@ -error[E0690]: transparent struct needs exactly one non-zero-sized field, but has 0 - --> $DIR/repr-transparent.rs:11:1 - | -LL | struct NoFields; - | ^^^^^^^^^^^^^^^^ needs exactly one non-zero-sized field, but has 0 - -error[E0690]: transparent struct needs exactly one non-zero-sized field, but has 0 - --> $DIR/repr-transparent.rs:14:1 - | -LL | struct ContainsOnlyZst(()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ needs exactly one non-zero-sized field, but has 0 - -error[E0690]: transparent struct needs exactly one non-zero-sized field, but has 0 - --> $DIR/repr-transparent.rs:17:1 - | -LL | struct ContainsOnlyZstArray([bool; 0]); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ needs exactly one non-zero-sized field, but has 0 - -error[E0690]: transparent struct needs exactly one non-zero-sized field, but has 0 - --> $DIR/repr-transparent.rs:20:1 - | -LL | struct ContainsMultipleZst(PhantomData<*const i32>, NoFields); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ needs exactly one non-zero-sized field, but has 0 - -error[E0690]: transparent struct needs exactly one non-zero-sized field, but has 2 - --> $DIR/repr-transparent.rs:24:1 +error[E0690]: transparent struct needs at most one non-zero-sized field, but has 2 + --> $DIR/repr-transparent.rs:26:1 | LL | struct MultipleNonZst(u8, u8); | ^^^^^^^^^^^^^^^^^^^^^^--^^--^^ | | | | | | | this field is non-zero-sized | | this field is non-zero-sized - | needs exactly one non-zero-sized field, but has 2 + | needs at most one non-zero-sized field, but has 2 -error[E0690]: transparent struct needs exactly one non-zero-sized field, but has 2 - --> $DIR/repr-transparent.rs:30:1 +error[E0690]: transparent struct needs at most one non-zero-sized field, but has 2 + --> $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 - | needs exactly one non-zero-sized field, but has 2 + | needs at most one non-zero-sized field, but has 2 error[E0691]: zero-sized field in transparent struct has alignment larger than 1 - --> $DIR/repr-transparent.rs:34:32 + --> $DIR/repr-transparent.rs:36:32 | LL | struct NontrivialAlignZst(u32, [u16; 0]); | ^^^^^^^^ has alignment larger than 1 error[E0691]: zero-sized field in transparent struct has alignment larger than 1 - --> $DIR/repr-transparent.rs:40:24 + --> $DIR/repr-transparent.rs:42:24 | LL | struct GenericAlign<T>(ZstAlign32<T>, u32); | ^^^^^^^^^^^^^ has alignment larger than 1 error[E0084]: unsupported representation for zero-variant enum - --> $DIR/repr-transparent.rs:42:1 + --> $DIR/repr-transparent.rs:44:1 | LL | #[repr(transparent)] | ^^^^^^^^^^^^^^^^^^^^ @@ -63,66 +39,54 @@ LL | enum Void {} | ------------ zero-variant enum error[E0731]: transparent enum needs exactly one variant, but has 0 - --> $DIR/repr-transparent.rs:43:1 + --> $DIR/repr-transparent.rs:45:1 | LL | enum Void {} | ^^^^^^^^^ needs exactly one variant, but has 0 -error[E0690]: the variant of a transparent enum needs exactly one non-zero-sized field, but has 0 - --> $DIR/repr-transparent.rs:47:1 - | -LL | enum FieldlessEnum { - | ^^^^^^^^^^^^^^^^^^ needs exactly one non-zero-sized field, but has 0 - -error[E0690]: the variant of a transparent enum needs exactly one non-zero-sized field, but has 2 - --> $DIR/repr-transparent.rs:52:1 +error[E0690]: the variant of a transparent enum needs at most one non-zero-sized field, but has 2 + --> $DIR/repr-transparent.rs:58:1 | LL | enum TooManyFieldsEnum { - | ^^^^^^^^^^^^^^^^^^^^^^ needs exactly one non-zero-sized field, but has 2 + | ^^^^^^^^^^^^^^^^^^^^^^ needs at most one non-zero-sized field, but has 2 LL | Foo(u32, String), | --- ------ this field is non-zero-sized | | | this field is non-zero-sized error[E0731]: transparent enum needs exactly one variant, but has 2 - --> $DIR/repr-transparent.rs:58:1 + --> $DIR/repr-transparent.rs:64:1 | -LL | enum TooManyVariants { - | ^^^^^^^^^^^^^^^^^^^^ needs exactly one variant, but has 2 +LL | enum MultipleVariants { + | ^^^^^^^^^^^^^^^^^^^^^ needs exactly one variant, but has 2 LL | Foo(String), | ----------- LL | Bar, - | --- too many variants in `TooManyVariants` + | --- too many variants in `MultipleVariants` error[E0691]: zero-sized field in transparent enum has alignment larger than 1 - --> $DIR/repr-transparent.rs:65:14 + --> $DIR/repr-transparent.rs:71:14 | LL | Foo(u32, [u16; 0]), | ^^^^^^^^ has alignment larger than 1 error[E0691]: zero-sized field in transparent enum has alignment larger than 1 - --> $DIR/repr-transparent.rs:70:11 + --> $DIR/repr-transparent.rs:76:11 | LL | Foo { bar: ZstAlign32<T>, baz: u32 } | ^^^^^^^^^^^^^^^^^^ has alignment larger than 1 -error[E0690]: transparent union needs exactly one non-zero-sized field, but has 0 - --> $DIR/repr-transparent.rs:74:1 - | -LL | union UnitUnion { - | ^^^^^^^^^^^^^^^ needs exactly one non-zero-sized field, but has 0 - -error[E0690]: transparent union needs exactly one non-zero-sized field, but has 2 - --> $DIR/repr-transparent.rs:79:1 +error[E0690]: transparent union needs at most one non-zero-sized field, but has 2 + --> $DIR/repr-transparent.rs:85:1 | LL | union TooManyFields { - | ^^^^^^^^^^^^^^^^^^^ needs exactly one non-zero-sized field, but has 2 + | ^^^^^^^^^^^^^^^^^^^ needs at most one non-zero-sized field, but has 2 LL | u: u32, | ------ this field is non-zero-sized LL | s: i32 | ------ this field is non-zero-sized -error: aborting due to 17 previous errors +error: aborting due to 11 previous errors Some errors have detailed explanations: E0084, E0690, E0691, E0731. For more information about an error, try `rustc --explain E0084`. diff --git a/src/test/ui/resolve/use_suggestion_placement.fixed b/src/test/ui/resolve/use_suggestion_placement.fixed new file mode 100644 index 00000000000..63676327aa0 --- /dev/null +++ b/src/test/ui/resolve/use_suggestion_placement.fixed @@ -0,0 +1,39 @@ +// run-rustfix +#![allow(dead_code)] + +use m::A; + +use std::collections::HashMap; + +macro_rules! y { + () => {} +} + +mod m { + pub const A: i32 = 0; +} + +mod foo { + // FIXME: UsePlacementFinder is broken because active attributes are + // removed, and thus the `derive` attribute here is not in the AST. + // An inert attribute should work, though. + // #[derive(Debug)] + use std::path::Path; + +#[allow(warnings)] + pub struct Foo; + + // test whether the use suggestion isn't + // placed into the expansion of `#[derive(Debug)] + type Bar = Path; //~ ERROR cannot find +} + +fn main() { + y!(); + let _ = A; //~ ERROR cannot find + foo(); +} + +fn foo() { + type Dict<K, V> = HashMap<K, V>; //~ ERROR cannot find +} diff --git a/src/test/ui/resolve/use_suggestion_placement.rs b/src/test/ui/resolve/use_suggestion_placement.rs index 56d4b8d6d11..ecc74d78167 100644 --- a/src/test/ui/resolve/use_suggestion_placement.rs +++ b/src/test/ui/resolve/use_suggestion_placement.rs @@ -1,3 +1,6 @@ +// run-rustfix +#![allow(dead_code)] + macro_rules! y { () => {} } @@ -7,7 +10,11 @@ mod m { } mod foo { - #[derive(Debug)] + // FIXME: UsePlacementFinder is broken because active attributes are + // removed, and thus the `derive` attribute here is not in the AST. + // An inert attribute should work, though. + // #[derive(Debug)] + #[allow(warnings)] pub struct Foo; // test whether the use suggestion isn't diff --git a/src/test/ui/resolve/use_suggestion_placement.stderr b/src/test/ui/resolve/use_suggestion_placement.stderr index af0495a57a1..217c08a560b 100644 --- a/src/test/ui/resolve/use_suggestion_placement.stderr +++ b/src/test/ui/resolve/use_suggestion_placement.stderr @@ -1,5 +1,5 @@ error[E0412]: cannot find type `Path` in this scope - --> $DIR/use_suggestion_placement.rs:15:16 + --> $DIR/use_suggestion_placement.rs:22:16 | LL | type Bar = Path; | ^^^^ not found in this scope @@ -10,7 +10,7 @@ LL | use std::path::Path; | error[E0425]: cannot find value `A` in this scope - --> $DIR/use_suggestion_placement.rs:20:13 + --> $DIR/use_suggestion_placement.rs:27:13 | LL | let _ = A; | ^ not found in this scope @@ -21,7 +21,7 @@ LL | use m::A; | error[E0412]: cannot find type `HashMap` in this scope - --> $DIR/use_suggestion_placement.rs:25:23 + --> $DIR/use_suggestion_placement.rs:32:23 | LL | type Dict<K, V> = HashMap<K, V>; | ^^^^^^^ not found in this scope diff --git a/src/test/ui/return/issue-86188-return-not-in-fn-body.rs b/src/test/ui/return/issue-86188-return-not-in-fn-body.rs new file mode 100644 index 00000000000..23cc9f0512c --- /dev/null +++ b/src/test/ui/return/issue-86188-return-not-in-fn-body.rs @@ -0,0 +1,22 @@ +// Due to a compiler bug, if a return occurs outside of a function body +// (e.g. in an AnonConst body), the return value expression would not be +// type-checked, leading to an ICE. This test checks that the ICE no +// longer happens, and that an appropriate error message is issued that +// also explains why the return is considered "outside of a function body" +// if it seems to be inside one, as in the main function below. + +const C: [(); 42] = { + [(); return || { + //~^ ERROR: return statement outside of function body [E0572] + let tx; + }] +}; + +fn main() { +//~^ NOTE: ...not the enclosing function body + [(); return || { + //~^ ERROR: return statement outside of function body [E0572] + //~| NOTE: the return is part of this body... + let tx; + }]; +} diff --git a/src/test/ui/return/issue-86188-return-not-in-fn-body.stderr b/src/test/ui/return/issue-86188-return-not-in-fn-body.stderr new file mode 100644 index 00000000000..9275cb91dd3 --- /dev/null +++ b/src/test/ui/return/issue-86188-return-not-in-fn-body.stderr @@ -0,0 +1,28 @@ +error[E0572]: return statement outside of function body + --> $DIR/issue-86188-return-not-in-fn-body.rs:9:10 + | +LL | [(); return || { + | __________^ +LL | | +LL | | let tx; +LL | | }] + | |_____^ + +error[E0572]: return statement outside of function body + --> $DIR/issue-86188-return-not-in-fn-body.rs:17:10 + | +LL | / fn main() { +LL | | +LL | | [(); return || { + | |__________^ +LL | || +LL | || +LL | || let tx; +LL | || }]; + | ||_____^ the return is part of this body... +LL | | } + | |_- ...not the enclosing function body + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0572`. diff --git a/src/test/ui/return/return-match-array-const.rs b/src/test/ui/return/return-match-array-const.rs index f21eac37c17..b619a4d57f9 100644 --- a/src/test/ui/return/return-match-array-const.rs +++ b/src/test/ui/return/return-match-array-const.rs @@ -1,10 +1,19 @@ fn main() { +//~^ NOTE: not the enclosing function body +//~| NOTE: not the enclosing function body +//~| NOTE: not the enclosing function body [(); return match 0 { n => n }]; - //~^ ERROR: return statement outside of function body + //~^ ERROR: return statement outside of function body [E0572] + //~| NOTE: the return is part of this body... [(); return match 0 { 0 => 0 }]; - //~^ ERROR: return statement outside of function body + //~^ ERROR: return statement outside of function body [E0572] + //~| NOTE: the return is part of this body... [(); return match () { 'a' => 0, _ => 0 }]; - //~^ ERROR: return statement outside of function body + //~^ ERROR: return statement outside of function body [E0572] + //~| NOTE: the return is part of this body... + //~| ERROR: mismatched types [E0308] + //~| NOTE: expected `()`, found `char` + //~| NOTE: this expression has type `()` } diff --git a/src/test/ui/return/return-match-array-const.stderr b/src/test/ui/return/return-match-array-const.stderr index 8e801e3fbb7..85a733adfee 100644 --- a/src/test/ui/return/return-match-array-const.stderr +++ b/src/test/ui/return/return-match-array-const.stderr @@ -1,21 +1,56 @@ error[E0572]: return statement outside of function body - --> $DIR/return-match-array-const.rs:2:10 + --> $DIR/return-match-array-const.rs:5:10 | -LL | [(); return match 0 { n => n }]; - | ^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | / fn main() { +LL | | +LL | | +LL | | +LL | | [(); return match 0 { n => n }]; + | | ^^^^^^^^^^^^^^^^^^^^^^^^^ the return is part of this body... +... | +LL | | +LL | | } + | |_- ...not the enclosing function body error[E0572]: return statement outside of function body - --> $DIR/return-match-array-const.rs:5:10 + --> $DIR/return-match-array-const.rs:9:10 | -LL | [(); return match 0 { 0 => 0 }]; - | ^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | / fn main() { +LL | | +LL | | +LL | | +... | +LL | | [(); return match 0 { 0 => 0 }]; + | | ^^^^^^^^^^^^^^^^^^^^^^^^^ the return is part of this body... +... | +LL | | +LL | | } + | |_- ...not the enclosing function body error[E0572]: return statement outside of function body - --> $DIR/return-match-array-const.rs:8:10 + --> $DIR/return-match-array-const.rs:13:10 + | +LL | / fn main() { +LL | | +LL | | +LL | | +... | +LL | | [(); return match () { 'a' => 0, _ => 0 }]; + | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the return is part of this body... +... | +LL | | +LL | | } + | |_- ...not the enclosing function body + +error[E0308]: mismatched types + --> $DIR/return-match-array-const.rs:13:28 | LL | [(); return match () { 'a' => 0, _ => 0 }]; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | -- ^^^ expected `()`, found `char` + | | + | this expression has type `()` -error: aborting due to 3 previous errors +error: aborting due to 4 previous errors -For more information about this error, try `rustc --explain E0572`. +Some errors have detailed explanations: E0308, E0572. +For more information about an error, try `rustc --explain E0308`. diff --git a/src/test/ui/rfc-2361-dbg-macro/dbg-macro-requires-debug.stderr b/src/test/ui/rfc-2361-dbg-macro/dbg-macro-requires-debug.stderr index 850ca30405f..3cdab6541e7 100644 --- a/src/test/ui/rfc-2361-dbg-macro/dbg-macro-requires-debug.stderr +++ b/src/test/ui/rfc-2361-dbg-macro/dbg-macro-requires-debug.stderr @@ -5,9 +5,7 @@ LL | let _: NotDebug = dbg!(NotDebug); | ^^^^^^^^^^^^^^ `NotDebug` cannot be formatted using `{:?}` | = help: the trait `Debug` is not implemented for `NotDebug` - = note: add `#[derive(Debug)]` or manually implement `Debug` - = note: required because of the requirements on the impl of `Debug` for `&NotDebug` - = note: required by `std::fmt::Debug::fmt` + = note: add `#[derive(Debug)]` to `NotDebug` or manually `impl Debug for NotDebug` = note: this error originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to previous error diff --git a/src/test/ui/rt-explody-panic-payloads.rs b/src/test/ui/rt-explody-panic-payloads.rs new file mode 100644 index 00000000000..1d3a2ff8284 --- /dev/null +++ b/src/test/ui/rt-explody-panic-payloads.rs @@ -0,0 +1,30 @@ +// run-pass +// ignore-emscripten no processes +// ignore-sgx no processes +// ignore-wasm32-bare no unwinding panic +// ignore-avr no unwinding panic +// ignore-nvptx64 no unwinding panic + +use std::env; +use std::process::Command; + +struct Bomb; + +impl Drop for Bomb { + fn drop(&mut self) { + std::panic::panic_any(Bomb); + } +} + +fn main() { + let args = env::args().collect::<Vec<_>>(); + let output = match &args[..] { + [me] => Command::new(&me).arg("plant the").output(), + [..] => std::panic::panic_any(Bomb), + }.expect("running the command should have succeeded"); + println!("{:#?}", output); + let stderr = std::str::from_utf8(&output.stderr); + assert!(stderr.map(|v| { + v.ends_with("drop of the panic payload panicked") + }).unwrap_or(false)); +} diff --git a/src/test/ui/rust-2018/async-ident-allowed.rs b/src/test/ui/rust-2018/async-ident-allowed.rs index 9d961214afc..8efcfbb7074 100644 --- a/src/test/ui/rust-2018/async-ident-allowed.rs +++ b/src/test/ui/rust-2018/async-ident-allowed.rs @@ -7,5 +7,5 @@ fn main() { let async = 3; //~ ERROR: is a keyword - //~^ WARN previously accepted + //~^ WARN this is accepted in the current edition } diff --git a/src/test/ui/rust-2018/async-ident-allowed.stderr b/src/test/ui/rust-2018/async-ident-allowed.stderr index 43fc3f5e334..5b63eab8e46 100644 --- a/src/test/ui/rust-2018/async-ident-allowed.stderr +++ b/src/test/ui/rust-2018/async-ident-allowed.stderr @@ -10,7 +10,7 @@ note: the lint level is defined here LL | #![deny(rust_2018_compatibility)] | ^^^^^^^^^^^^^^^^^^^^^^^ = note: `#[deny(keyword_idents)]` implied by `#[deny(rust_2018_compatibility)]` - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2018 edition! + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716> error: aborting due to previous error diff --git a/src/test/ui/rust-2018/async-ident.fixed b/src/test/ui/rust-2018/async-ident.fixed index 3d6f6ff8c49..f4ae518c71d 100644 --- a/src/test/ui/rust-2018/async-ident.fixed +++ b/src/test/ui/rust-2018/async-ident.fixed @@ -5,20 +5,20 @@ // run-rustfix fn r#async() {} //~ ERROR async -//~^ WARN hard error in the 2018 edition +//~^ WARN this is accepted in the current edition macro_rules! foo { ($foo:ident) => {}; ($r#async:expr, r#async) => {}; //~^ ERROR async //~| ERROR async - //~| WARN hard error in the 2018 edition - //~| WARN hard error in the 2018 edition + //~| WARN this is accepted in the current edition + //~| WARN this is accepted in the current edition } foo!(r#async); //~^ ERROR async - //~| WARN hard error in the 2018 edition + //~| WARN this is accepted in the current edition mod dont_lint_raw { fn r#async() {} @@ -27,53 +27,53 @@ mod dont_lint_raw { mod async_trait { trait r#async {} //~^ ERROR async - //~| WARN hard error in the 2018 edition + //~| WARN this is accepted in the current edition struct MyStruct; impl r#async for MyStruct {} //~^ ERROR async - //~| WARN hard error in the 2018 edition + //~| WARN this is accepted in the current edition } mod async_static { static r#async: u32 = 0; //~^ ERROR async - //~| WARN hard error in the 2018 edition + //~| WARN this is accepted in the current edition } mod async_const { const r#async: u32 = 0; //~^ ERROR async - //~| WARN hard error in the 2018 edition + //~| WARN this is accepted in the current edition } struct Foo; impl Foo { fn r#async() {} } //~^ ERROR async - //~| WARN hard error in the 2018 edition + //~| WARN this is accepted in the current edition fn main() { struct r#async {} //~^ ERROR async - //~| WARN hard error in the 2018 edition + //~| WARN this is accepted in the current edition let r#async: r#async = r#async {}; //~^ ERROR async - //~| WARN hard error in the 2018 edition + //~| WARN this is accepted in the current edition //~| ERROR async - //~| WARN hard error in the 2018 edition + //~| WARN this is accepted in the current edition //~| ERROR async - //~| WARN hard error in the 2018 edition + //~| WARN this is accepted in the current edition } #[macro_export] macro_rules! produces_async { () => (pub fn r#async() {}) //~^ ERROR async - //~| WARN hard error in the 2018 edition + //~| WARN this is accepted in the current edition } #[macro_export] macro_rules! consumes_async { (r#async) => (1) //~^ ERROR async - //~| WARN hard error in the 2018 edition + //~| WARN this is accepted in the current edition } diff --git a/src/test/ui/rust-2018/async-ident.rs b/src/test/ui/rust-2018/async-ident.rs index 6e8d33d237d..79c73dafac7 100644 --- a/src/test/ui/rust-2018/async-ident.rs +++ b/src/test/ui/rust-2018/async-ident.rs @@ -5,20 +5,20 @@ // run-rustfix fn async() {} //~ ERROR async -//~^ WARN hard error in the 2018 edition +//~^ WARN this is accepted in the current edition macro_rules! foo { ($foo:ident) => {}; ($async:expr, async) => {}; //~^ ERROR async //~| ERROR async - //~| WARN hard error in the 2018 edition - //~| WARN hard error in the 2018 edition + //~| WARN this is accepted in the current edition + //~| WARN this is accepted in the current edition } foo!(async); //~^ ERROR async - //~| WARN hard error in the 2018 edition + //~| WARN this is accepted in the current edition mod dont_lint_raw { fn r#async() {} @@ -27,53 +27,53 @@ mod dont_lint_raw { mod async_trait { trait async {} //~^ ERROR async - //~| WARN hard error in the 2018 edition + //~| WARN this is accepted in the current edition struct MyStruct; impl async for MyStruct {} //~^ ERROR async - //~| WARN hard error in the 2018 edition + //~| WARN this is accepted in the current edition } mod async_static { static async: u32 = 0; //~^ ERROR async - //~| WARN hard error in the 2018 edition + //~| WARN this is accepted in the current edition } mod async_const { const async: u32 = 0; //~^ ERROR async - //~| WARN hard error in the 2018 edition + //~| WARN this is accepted in the current edition } struct Foo; impl Foo { fn async() {} } //~^ ERROR async - //~| WARN hard error in the 2018 edition + //~| WARN this is accepted in the current edition fn main() { struct async {} //~^ ERROR async - //~| WARN hard error in the 2018 edition + //~| WARN this is accepted in the current edition let async: async = async {}; //~^ ERROR async - //~| WARN hard error in the 2018 edition + //~| WARN this is accepted in the current edition //~| ERROR async - //~| WARN hard error in the 2018 edition + //~| WARN this is accepted in the current edition //~| ERROR async - //~| WARN hard error in the 2018 edition + //~| WARN this is accepted in the current edition } #[macro_export] macro_rules! produces_async { () => (pub fn async() {}) //~^ ERROR async - //~| WARN hard error in the 2018 edition + //~| WARN this is accepted in the current edition } #[macro_export] macro_rules! consumes_async { (async) => (1) //~^ ERROR async - //~| WARN hard error in the 2018 edition + //~| WARN this is accepted in the current edition } diff --git a/src/test/ui/rust-2018/async-ident.stderr b/src/test/ui/rust-2018/async-ident.stderr index 6051c81f77c..6396e9deee2 100644 --- a/src/test/ui/rust-2018/async-ident.stderr +++ b/src/test/ui/rust-2018/async-ident.stderr @@ -9,7 +9,7 @@ note: the lint level is defined here | LL | #![deny(keyword_idents)] | ^^^^^^^^^^^^^^ - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2018 edition! + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716> error: `async` is a keyword in the 2018 edition @@ -18,7 +18,7 @@ error: `async` is a keyword in the 2018 edition LL | ($async:expr, async) => {}; | ^^^^^ help: you can use a raw identifier to stay compatible: `r#async` | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2018 edition! + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716> error: `async` is a keyword in the 2018 edition @@ -27,7 +27,7 @@ error: `async` is a keyword in the 2018 edition LL | ($async:expr, async) => {}; | ^^^^^ help: you can use a raw identifier to stay compatible: `r#async` | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2018 edition! + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716> error: `async` is a keyword in the 2018 edition @@ -36,7 +36,7 @@ error: `async` is a keyword in the 2018 edition LL | foo!(async); | ^^^^^ help: you can use a raw identifier to stay compatible: `r#async` | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2018 edition! + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716> error: `async` is a keyword in the 2018 edition @@ -45,7 +45,7 @@ error: `async` is a keyword in the 2018 edition LL | trait async {} | ^^^^^ help: you can use a raw identifier to stay compatible: `r#async` | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2018 edition! + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716> error: `async` is a keyword in the 2018 edition @@ -54,7 +54,7 @@ error: `async` is a keyword in the 2018 edition LL | impl async for MyStruct {} | ^^^^^ help: you can use a raw identifier to stay compatible: `r#async` | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2018 edition! + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716> error: `async` is a keyword in the 2018 edition @@ -63,7 +63,7 @@ error: `async` is a keyword in the 2018 edition LL | static async: u32 = 0; | ^^^^^ help: you can use a raw identifier to stay compatible: `r#async` | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2018 edition! + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716> error: `async` is a keyword in the 2018 edition @@ -72,7 +72,7 @@ error: `async` is a keyword in the 2018 edition LL | const async: u32 = 0; | ^^^^^ help: you can use a raw identifier to stay compatible: `r#async` | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2018 edition! + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716> error: `async` is a keyword in the 2018 edition @@ -81,7 +81,7 @@ error: `async` is a keyword in the 2018 edition LL | impl Foo { fn async() {} } | ^^^^^ help: you can use a raw identifier to stay compatible: `r#async` | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2018 edition! + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716> error: `async` is a keyword in the 2018 edition @@ -90,7 +90,7 @@ error: `async` is a keyword in the 2018 edition LL | struct async {} | ^^^^^ help: you can use a raw identifier to stay compatible: `r#async` | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2018 edition! + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716> error: `async` is a keyword in the 2018 edition @@ -99,7 +99,7 @@ error: `async` is a keyword in the 2018 edition LL | let async: async = async {}; | ^^^^^ help: you can use a raw identifier to stay compatible: `r#async` | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2018 edition! + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716> error: `async` is a keyword in the 2018 edition @@ -108,7 +108,7 @@ error: `async` is a keyword in the 2018 edition LL | let async: async = async {}; | ^^^^^ help: you can use a raw identifier to stay compatible: `r#async` | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2018 edition! + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716> error: `async` is a keyword in the 2018 edition @@ -117,7 +117,7 @@ error: `async` is a keyword in the 2018 edition LL | let async: async = async {}; | ^^^^^ help: you can use a raw identifier to stay compatible: `r#async` | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2018 edition! + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716> error: `async` is a keyword in the 2018 edition @@ -126,7 +126,7 @@ error: `async` is a keyword in the 2018 edition LL | () => (pub fn async() {}) | ^^^^^ help: you can use a raw identifier to stay compatible: `r#async` | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2018 edition! + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716> error: `async` is a keyword in the 2018 edition @@ -135,7 +135,7 @@ error: `async` is a keyword in the 2018 edition LL | (async) => (1) | ^^^^^ help: you can use a raw identifier to stay compatible: `r#async` | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2018 edition! + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716> error: aborting due to 15 previous errors diff --git a/src/test/ui/rust-2018/dyn-keyword.fixed b/src/test/ui/rust-2018/dyn-keyword.fixed index e9cda1af939..044824cbbd3 100644 --- a/src/test/ui/rust-2018/dyn-keyword.fixed +++ b/src/test/ui/rust-2018/dyn-keyword.fixed @@ -6,5 +6,5 @@ fn main() { let r#dyn = (); //~ ERROR dyn - //~^ WARN hard error in the 2018 edition + //~^ WARN this is accepted in the current edition } diff --git a/src/test/ui/rust-2018/dyn-keyword.rs b/src/test/ui/rust-2018/dyn-keyword.rs index bdd3a90cab9..5989cfa1c79 100644 --- a/src/test/ui/rust-2018/dyn-keyword.rs +++ b/src/test/ui/rust-2018/dyn-keyword.rs @@ -6,5 +6,5 @@ fn main() { let dyn = (); //~ ERROR dyn - //~^ WARN hard error in the 2018 edition + //~^ WARN this is accepted in the current edition } diff --git a/src/test/ui/rust-2018/dyn-keyword.stderr b/src/test/ui/rust-2018/dyn-keyword.stderr index 0fe11168c44..699242f2dcb 100644 --- a/src/test/ui/rust-2018/dyn-keyword.stderr +++ b/src/test/ui/rust-2018/dyn-keyword.stderr @@ -9,7 +9,7 @@ note: the lint level is defined here | LL | #![deny(keyword_idents)] | ^^^^^^^^^^^^^^ - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2018 edition! + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716> error: aborting due to previous error diff --git a/src/test/ui/rust-2018/edition-lint-fully-qualified-paths.fixed b/src/test/ui/rust-2018/edition-lint-fully-qualified-paths.fixed index 76fbfa66031..37847a98ac7 100644 --- a/src/test/ui/rust-2018/edition-lint-fully-qualified-paths.fixed +++ b/src/test/ui/rust-2018/edition-lint-fully-qualified-paths.fixed @@ -8,20 +8,19 @@ mod foo { type Bar; } - crate struct Baz { } + crate struct Baz {} impl Foo for Baz { type Bar = (); } } - fn main() { let _: <foo::Baz as crate::foo::Foo>::Bar = (); //~^ ERROR absolute paths must start with - //~| this was previously accepted + //~| this is accepted in the current edition let _: <crate::foo::Baz as foo::Foo>::Bar = (); //~^ ERROR absolute paths must start with - //~| this was previously accepted + //~| this is accepted in the current edition } diff --git a/src/test/ui/rust-2018/edition-lint-fully-qualified-paths.rs b/src/test/ui/rust-2018/edition-lint-fully-qualified-paths.rs index ace90a180d6..36efa14601d 100644 --- a/src/test/ui/rust-2018/edition-lint-fully-qualified-paths.rs +++ b/src/test/ui/rust-2018/edition-lint-fully-qualified-paths.rs @@ -8,20 +8,19 @@ mod foo { type Bar; } - crate struct Baz { } + crate struct Baz {} impl Foo for Baz { type Bar = (); } } - fn main() { let _: <foo::Baz as ::foo::Foo>::Bar = (); //~^ ERROR absolute paths must start with - //~| this was previously accepted + //~| this is accepted in the current edition let _: <::foo::Baz as foo::Foo>::Bar = (); //~^ ERROR absolute paths must start with - //~| this was previously accepted + //~| this is accepted in the current edition } diff --git a/src/test/ui/rust-2018/edition-lint-fully-qualified-paths.stderr b/src/test/ui/rust-2018/edition-lint-fully-qualified-paths.stderr index 0b400786d35..6f529fa9114 100644 --- a/src/test/ui/rust-2018/edition-lint-fully-qualified-paths.stderr +++ b/src/test/ui/rust-2018/edition-lint-fully-qualified-paths.stderr @@ -1,5 +1,5 @@ error: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition - --> $DIR/edition-lint-fully-qualified-paths.rs:20:25 + --> $DIR/edition-lint-fully-qualified-paths.rs:19:25 | LL | let _: <foo::Baz as ::foo::Foo>::Bar = (); | ^^^^^^^^^^ help: use `crate`: `crate::foo::Foo` @@ -9,16 +9,16 @@ note: the lint level is defined here | LL | #![deny(absolute_paths_not_starting_with_crate)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2018 edition! + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #53130 <https://github.com/rust-lang/rust/issues/53130> error: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition - --> $DIR/edition-lint-fully-qualified-paths.rs:24:13 + --> $DIR/edition-lint-fully-qualified-paths.rs:23:13 | LL | let _: <::foo::Baz as foo::Foo>::Bar = (); | ^^^^^^^^^^ help: use `crate`: `crate::foo::Baz` | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2018 edition! + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #53130 <https://github.com/rust-lang/rust/issues/53130> error: aborting due to 2 previous errors diff --git a/src/test/ui/rust-2018/edition-lint-nested-empty-paths.fixed b/src/test/ui/rust-2018/edition-lint-nested-empty-paths.fixed index 77478e8c608..03d15cea280 100644 --- a/src/test/ui/rust-2018/edition-lint-nested-empty-paths.fixed +++ b/src/test/ui/rust-2018/edition-lint-nested-empty-paths.fixed @@ -16,15 +16,15 @@ crate mod foo { use crate::foo::{bar::{baz::{}}}; //~^ ERROR absolute paths must start with -//~| WARN this was previously accepted +//~| WARN this is accepted in the current edition use crate::foo::{bar::{XX, baz::{}}}; //~^ ERROR absolute paths must start with -//~| WARN this was previously accepted +//~| WARN this is accepted in the current edition use crate::foo::{bar::{baz::{}, baz1::{}}}; //~^ ERROR absolute paths must start with -//~| WARN this was previously accepted +//~| WARN this is accepted in the current edition fn main() { } diff --git a/src/test/ui/rust-2018/edition-lint-nested-empty-paths.rs b/src/test/ui/rust-2018/edition-lint-nested-empty-paths.rs index 69bd4e3a187..d898daaba59 100644 --- a/src/test/ui/rust-2018/edition-lint-nested-empty-paths.rs +++ b/src/test/ui/rust-2018/edition-lint-nested-empty-paths.rs @@ -16,15 +16,15 @@ crate mod foo { use foo::{bar::{baz::{}}}; //~^ ERROR absolute paths must start with -//~| WARN this was previously accepted +//~| WARN this is accepted in the current edition use foo::{bar::{XX, baz::{}}}; //~^ ERROR absolute paths must start with -//~| WARN this was previously accepted +//~| WARN this is accepted in the current edition use foo::{bar::{baz::{}, baz1::{}}}; //~^ ERROR absolute paths must start with -//~| WARN this was previously accepted +//~| WARN this is accepted in the current edition fn main() { } diff --git a/src/test/ui/rust-2018/edition-lint-nested-empty-paths.stderr b/src/test/ui/rust-2018/edition-lint-nested-empty-paths.stderr index d554cc28621..54a4fed5cf9 100644 --- a/src/test/ui/rust-2018/edition-lint-nested-empty-paths.stderr +++ b/src/test/ui/rust-2018/edition-lint-nested-empty-paths.stderr @@ -9,7 +9,7 @@ note: the lint level is defined here | LL | #![deny(absolute_paths_not_starting_with_crate)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2018 edition! + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #53130 <https://github.com/rust-lang/rust/issues/53130> error: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition @@ -18,7 +18,7 @@ error: absolute paths must start with `self`, `super`, `crate`, or an external c LL | use foo::{bar::{XX, baz::{}}}; | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `crate`: `crate::foo::{bar::{XX, baz::{}}}` | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2018 edition! + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #53130 <https://github.com/rust-lang/rust/issues/53130> error: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition @@ -27,7 +27,7 @@ error: absolute paths must start with `self`, `super`, `crate`, or an external c LL | use foo::{bar::{baz::{}, baz1::{}}}; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `crate`: `crate::foo::{bar::{baz::{}, baz1::{}}}` | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2018 edition! + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #53130 <https://github.com/rust-lang/rust/issues/53130> error: aborting due to 3 previous errors diff --git a/src/test/ui/rust-2018/edition-lint-nested-paths.fixed b/src/test/ui/rust-2018/edition-lint-nested-paths.fixed index da7524a63e2..7c6e4a71a37 100644 --- a/src/test/ui/rust-2018/edition-lint-nested-paths.fixed +++ b/src/test/ui/rust-2018/edition-lint-nested-paths.fixed @@ -5,7 +5,7 @@ use crate::foo::{a, b}; //~^ ERROR absolute paths must start with -//~| this was previously accepted +//~| this is accepted in the current edition mod foo { crate fn a() {} @@ -20,7 +20,7 @@ fn main() { { use crate::foo::{self as x, c}; //~^ ERROR absolute paths must start with - //~| this was previously accepted + //~| this is accepted in the current edition x::a(); c(); } diff --git a/src/test/ui/rust-2018/edition-lint-nested-paths.rs b/src/test/ui/rust-2018/edition-lint-nested-paths.rs index e13b7d00864..3925f76391a 100644 --- a/src/test/ui/rust-2018/edition-lint-nested-paths.rs +++ b/src/test/ui/rust-2018/edition-lint-nested-paths.rs @@ -5,7 +5,7 @@ use foo::{a, b}; //~^ ERROR absolute paths must start with -//~| this was previously accepted +//~| this is accepted in the current edition mod foo { crate fn a() {} @@ -20,7 +20,7 @@ fn main() { { use foo::{self as x, c}; //~^ ERROR absolute paths must start with - //~| this was previously accepted + //~| this is accepted in the current edition x::a(); c(); } diff --git a/src/test/ui/rust-2018/edition-lint-nested-paths.stderr b/src/test/ui/rust-2018/edition-lint-nested-paths.stderr index 040aa4a5480..c2f91e342f5 100644 --- a/src/test/ui/rust-2018/edition-lint-nested-paths.stderr +++ b/src/test/ui/rust-2018/edition-lint-nested-paths.stderr @@ -9,7 +9,7 @@ note: the lint level is defined here | LL | #![deny(absolute_paths_not_starting_with_crate)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2018 edition! + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #53130 <https://github.com/rust-lang/rust/issues/53130> error: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition @@ -18,7 +18,7 @@ error: absolute paths must start with `self`, `super`, `crate`, or an external c LL | use foo::{self as x, c}; | ^^^^^^^^^^^^^^^^^^^ help: use `crate`: `crate::foo::{self as x, c}` | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2018 edition! + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #53130 <https://github.com/rust-lang/rust/issues/53130> error: aborting due to 2 previous errors diff --git a/src/test/ui/rust-2018/edition-lint-paths.fixed b/src/test/ui/rust-2018/edition-lint-paths.fixed index de16291fea6..f91405929ee 100644 --- a/src/test/ui/rust-2018/edition-lint-paths.fixed +++ b/src/test/ui/rust-2018/edition-lint-paths.fixed @@ -11,30 +11,29 @@ pub mod foo { use edition_lint_paths; use crate::bar::Bar; //~^ ERROR absolute - //~| WARN this was previously accepted + //~| WARN this is accepted in the current edition use super::bar::Bar2; use crate::bar::Bar3; use crate::bar; //~^ ERROR absolute - //~| WARN this was previously accepted - use crate::{bar as something_else}; + //~| WARN this is accepted in the current edition + use crate::bar as something_else; - use crate::{Bar as SomethingElse, main}; + use crate::{main, Bar as SomethingElse}; //~^ ERROR absolute - //~| WARN this was previously accepted + //~| WARN this is accepted in the current edition - use crate::{Bar as SomethingElse2, main as another_main}; + use crate::{main as another_main, Bar as SomethingElse2}; - pub fn test() { - } + pub fn test() {} - pub trait SomeTrait { } + pub trait SomeTrait {} } use crate::bar::Bar; //~^ ERROR absolute -//~| WARN this was previously accepted +//~| WARN this is accepted in the current edition pub mod bar { use edition_lint_paths as foo; @@ -46,17 +45,17 @@ pub mod bar { mod baz { use crate::*; //~^ ERROR absolute - //~| WARN this was previously accepted + //~| WARN this is accepted in the current edition } -impl crate::foo::SomeTrait for u32 { } +impl crate::foo::SomeTrait for u32 {} //~^ ERROR absolute -//~| WARN this was previously accepted +//~| WARN this is accepted in the current edition fn main() { let x = crate::bar::Bar; //~^ ERROR absolute - //~| WARN this was previously accepted + //~| WARN this is accepted in the current edition let x = bar::Bar; let x = crate::bar::Bar; let x = self::bar::Bar; diff --git a/src/test/ui/rust-2018/edition-lint-paths.rs b/src/test/ui/rust-2018/edition-lint-paths.rs index c5b4be5a3ac..52c97c7a253 100644 --- a/src/test/ui/rust-2018/edition-lint-paths.rs +++ b/src/test/ui/rust-2018/edition-lint-paths.rs @@ -9,32 +9,31 @@ extern crate edition_lint_paths; pub mod foo { use edition_lint_paths; - use ::bar::Bar; + use bar::Bar; //~^ ERROR absolute - //~| WARN this was previously accepted + //~| WARN this is accepted in the current edition use super::bar::Bar2; use crate::bar::Bar3; use bar; //~^ ERROR absolute - //~| WARN this was previously accepted - use crate::{bar as something_else}; + //~| WARN this is accepted in the current edition + use crate::bar as something_else; - use {Bar as SomethingElse, main}; + use {main, Bar as SomethingElse}; //~^ ERROR absolute - //~| WARN this was previously accepted + //~| WARN this is accepted in the current edition - use crate::{Bar as SomethingElse2, main as another_main}; + use crate::{main as another_main, Bar as SomethingElse2}; - pub fn test() { - } + pub fn test() {} - pub trait SomeTrait { } + pub trait SomeTrait {} } use bar::Bar; //~^ ERROR absolute -//~| WARN this was previously accepted +//~| WARN this is accepted in the current edition pub mod bar { use edition_lint_paths as foo; @@ -46,17 +45,17 @@ pub mod bar { mod baz { use *; //~^ ERROR absolute - //~| WARN this was previously accepted + //~| WARN this is accepted in the current edition } -impl ::foo::SomeTrait for u32 { } +impl ::foo::SomeTrait for u32 {} //~^ ERROR absolute -//~| WARN this was previously accepted +//~| WARN this is accepted in the current edition fn main() { let x = ::bar::Bar; //~^ ERROR absolute - //~| WARN this was previously accepted + //~| WARN this is accepted in the current edition let x = bar::Bar; let x = crate::bar::Bar; let x = self::bar::Bar; diff --git a/src/test/ui/rust-2018/edition-lint-paths.stderr b/src/test/ui/rust-2018/edition-lint-paths.stderr index dd36d07da56..23deeda14a4 100644 --- a/src/test/ui/rust-2018/edition-lint-paths.stderr +++ b/src/test/ui/rust-2018/edition-lint-paths.stderr @@ -1,15 +1,15 @@ error: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition --> $DIR/edition-lint-paths.rs:12:9 | -LL | use ::bar::Bar; - | ^^^^^^^^^^ help: use `crate`: `crate::bar::Bar` +LL | use bar::Bar; + | ^^^^^^^^ help: use `crate`: `crate::bar::Bar` | note: the lint level is defined here --> $DIR/edition-lint-paths.rs:5:9 | LL | #![deny(absolute_paths_not_starting_with_crate)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2018 edition! + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #53130 <https://github.com/rust-lang/rust/issues/53130> error: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition @@ -18,52 +18,52 @@ error: absolute paths must start with `self`, `super`, `crate`, or an external c LL | use bar; | ^^^ help: use `crate`: `crate::bar` | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2018 edition! + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #53130 <https://github.com/rust-lang/rust/issues/53130> error: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition --> $DIR/edition-lint-paths.rs:23:9 | -LL | use {Bar as SomethingElse, main}; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `crate`: `crate::{Bar as SomethingElse, main}` +LL | use {main, Bar as SomethingElse}; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `crate`: `crate::{main, Bar as SomethingElse}` | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2018 edition! + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #53130 <https://github.com/rust-lang/rust/issues/53130> error: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition - --> $DIR/edition-lint-paths.rs:35:5 + --> $DIR/edition-lint-paths.rs:34:5 | LL | use bar::Bar; | ^^^^^^^^ help: use `crate`: `crate::bar::Bar` | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2018 edition! + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #53130 <https://github.com/rust-lang/rust/issues/53130> error: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition - --> $DIR/edition-lint-paths.rs:47:9 + --> $DIR/edition-lint-paths.rs:46:9 | LL | use *; | ^ help: use `crate`: `crate::*` | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2018 edition! + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #53130 <https://github.com/rust-lang/rust/issues/53130> error: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition - --> $DIR/edition-lint-paths.rs:52:6 + --> $DIR/edition-lint-paths.rs:51:6 | -LL | impl ::foo::SomeTrait for u32 { } +LL | impl ::foo::SomeTrait for u32 {} | ^^^^^^^^^^^^^^^^ help: use `crate`: `crate::foo::SomeTrait` | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2018 edition! + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #53130 <https://github.com/rust-lang/rust/issues/53130> error: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition - --> $DIR/edition-lint-paths.rs:57:13 + --> $DIR/edition-lint-paths.rs:56:13 | LL | let x = ::bar::Bar; | ^^^^^^^^^^ help: use `crate`: `crate::bar::Bar` | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2018 edition! + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #53130 <https://github.com/rust-lang/rust/issues/53130> error: aborting due to 7 previous errors diff --git a/src/test/ui/rust-2018/extern-crate-rename.fixed b/src/test/ui/rust-2018/extern-crate-rename.fixed index c4c9bdf58c3..ea832ef3e7d 100644 --- a/src/test/ui/rust-2018/extern-crate-rename.fixed +++ b/src/test/ui/rust-2018/extern-crate-rename.fixed @@ -11,7 +11,7 @@ extern crate edition_lint_paths as my_crate; use crate::my_crate::foo; //~^ ERROR absolute paths must start -//~| WARNING this was previously accepted +//~| WARNING this is accepted in the current edition fn main() { foo(); diff --git a/src/test/ui/rust-2018/extern-crate-rename.rs b/src/test/ui/rust-2018/extern-crate-rename.rs index 8f14f2f1fec..b1f617dd884 100644 --- a/src/test/ui/rust-2018/extern-crate-rename.rs +++ b/src/test/ui/rust-2018/extern-crate-rename.rs @@ -11,7 +11,7 @@ extern crate edition_lint_paths as my_crate; use my_crate::foo; //~^ ERROR absolute paths must start -//~| WARNING this was previously accepted +//~| WARNING this is accepted in the current edition fn main() { foo(); diff --git a/src/test/ui/rust-2018/extern-crate-rename.stderr b/src/test/ui/rust-2018/extern-crate-rename.stderr index 6ea762ed999..4bccbc51223 100644 --- a/src/test/ui/rust-2018/extern-crate-rename.stderr +++ b/src/test/ui/rust-2018/extern-crate-rename.stderr @@ -9,7 +9,7 @@ note: the lint level is defined here | LL | #![deny(absolute_paths_not_starting_with_crate)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2018 edition! + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #53130 <https://github.com/rust-lang/rust/issues/53130> error: aborting due to previous error diff --git a/src/test/ui/rust-2018/extern-crate-submod.fixed b/src/test/ui/rust-2018/extern-crate-submod.fixed index 2a8e24db0bd..9b0b0dd8ee1 100644 --- a/src/test/ui/rust-2018/extern-crate-submod.fixed +++ b/src/test/ui/rust-2018/extern-crate-submod.fixed @@ -18,7 +18,7 @@ mod m { // *could* rewrite it to `use edition_lint_paths::foo` use crate::m::edition_lint_paths::foo; //~^ ERROR absolute paths must start -//~| WARNING this was previously accepted +//~| WARNING this is accepted in the current edition fn main() { foo(); diff --git a/src/test/ui/rust-2018/extern-crate-submod.rs b/src/test/ui/rust-2018/extern-crate-submod.rs index f3a357917cc..dfce9128c51 100644 --- a/src/test/ui/rust-2018/extern-crate-submod.rs +++ b/src/test/ui/rust-2018/extern-crate-submod.rs @@ -18,7 +18,7 @@ mod m { // *could* rewrite it to `use edition_lint_paths::foo` use m::edition_lint_paths::foo; //~^ ERROR absolute paths must start -//~| WARNING this was previously accepted +//~| WARNING this is accepted in the current edition fn main() { foo(); diff --git a/src/test/ui/rust-2018/extern-crate-submod.stderr b/src/test/ui/rust-2018/extern-crate-submod.stderr index 87a0d492675..3c75319aeda 100644 --- a/src/test/ui/rust-2018/extern-crate-submod.stderr +++ b/src/test/ui/rust-2018/extern-crate-submod.stderr @@ -9,7 +9,7 @@ note: the lint level is defined here | LL | #![deny(absolute_paths_not_starting_with_crate)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2018 edition! + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #53130 <https://github.com/rust-lang/rust/issues/53130> error: aborting due to previous error diff --git a/src/test/ui/rust-2018/try-ident.fixed b/src/test/ui/rust-2018/try-ident.fixed index 13f6f8e2829..985348665c9 100644 --- a/src/test/ui/rust-2018/try-ident.fixed +++ b/src/test/ui/rust-2018/try-ident.fixed @@ -6,10 +6,10 @@ fn main() { r#try(); //~^ WARNING `try` is a keyword in the 2018 edition - //~| WARNING it will become a hard error in the 2018 edition! + //~| WARNING this is accepted in the current edition } fn r#try() { //~^ WARNING `try` is a keyword in the 2018 edition - //~| WARNING it will become a hard error in the 2018 edition! + //~| WARNING this is accepted in the current edition } diff --git a/src/test/ui/rust-2018/try-ident.rs b/src/test/ui/rust-2018/try-ident.rs index bed7118011e..2c02b75960e 100644 --- a/src/test/ui/rust-2018/try-ident.rs +++ b/src/test/ui/rust-2018/try-ident.rs @@ -6,10 +6,10 @@ fn main() { try(); //~^ WARNING `try` is a keyword in the 2018 edition - //~| WARNING it will become a hard error in the 2018 edition! + //~| WARNING this is accepted in the current edition } fn try() { //~^ WARNING `try` is a keyword in the 2018 edition - //~| WARNING it will become a hard error in the 2018 edition! + //~| WARNING this is accepted in the current edition } diff --git a/src/test/ui/rust-2018/try-ident.stderr b/src/test/ui/rust-2018/try-ident.stderr index 2939dc1df70..3d93b433cf2 100644 --- a/src/test/ui/rust-2018/try-ident.stderr +++ b/src/test/ui/rust-2018/try-ident.stderr @@ -10,7 +10,7 @@ note: the lint level is defined here LL | #![warn(rust_2018_compatibility)] | ^^^^^^^^^^^^^^^^^^^^^^^ = note: `#[warn(keyword_idents)]` implied by `#[warn(rust_2018_compatibility)]` - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2018 edition! + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716> warning: `try` is a keyword in the 2018 edition @@ -19,7 +19,7 @@ warning: `try` is a keyword in the 2018 edition LL | fn try() { | ^^^ help: you can use a raw identifier to stay compatible: `r#try` | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2018 edition! + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716> warning: 2 warnings emitted diff --git a/src/test/ui/rust-2018/try-macro.fixed b/src/test/ui/rust-2018/try-macro.fixed index 5c899378b94..3308870f654 100644 --- a/src/test/ui/rust-2018/try-macro.fixed +++ b/src/test/ui/rust-2018/try-macro.fixed @@ -11,8 +11,8 @@ fn foo() -> Result<usize, ()> { let x: Result<usize, ()> = Ok(22); r#try!(x); //~^ WARNING `try` is a keyword in the 2018 edition - //~| WARNING this was previously accepted + //~| WARNING this is accepted in the current edition Ok(44) } -fn main() { } +fn main() {} diff --git a/src/test/ui/rust-2018/try-macro.rs b/src/test/ui/rust-2018/try-macro.rs index db8a198d282..69e87a1ff62 100644 --- a/src/test/ui/rust-2018/try-macro.rs +++ b/src/test/ui/rust-2018/try-macro.rs @@ -11,8 +11,8 @@ fn foo() -> Result<usize, ()> { let x: Result<usize, ()> = Ok(22); try!(x); //~^ WARNING `try` is a keyword in the 2018 edition - //~| WARNING this was previously accepted + //~| WARNING this is accepted in the current edition Ok(44) } -fn main() { } +fn main() {} diff --git a/src/test/ui/rust-2018/try-macro.stderr b/src/test/ui/rust-2018/try-macro.stderr index cdbb215605e..f315b4d4a9e 100644 --- a/src/test/ui/rust-2018/try-macro.stderr +++ b/src/test/ui/rust-2018/try-macro.stderr @@ -10,7 +10,7 @@ note: the lint level is defined here LL | #![warn(rust_2018_compatibility)] | ^^^^^^^^^^^^^^^^^^^^^^^ = note: `#[warn(keyword_idents)]` implied by `#[warn(rust_2018_compatibility)]` - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2018 edition! + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716> warning: 1 warning emitted diff --git a/src/test/ui/rust-2021/auxiliary/reserved-prefixes-macro-2018.rs b/src/test/ui/rust-2021/auxiliary/reserved-prefixes-macro-2018.rs new file mode 100644 index 00000000000..eb301e5e1be --- /dev/null +++ b/src/test/ui/rust-2021/auxiliary/reserved-prefixes-macro-2018.rs @@ -0,0 +1,25 @@ +// force-host +// edition:2018 +// no-prefer-dynamic + +#![crate_type = "proc-macro"] + +extern crate proc_macro; + +use proc_macro::TokenStream; +use std::str::FromStr; + +#[proc_macro] +pub fn number_of_tokens_in_a_prefixed_integer_literal(_: TokenStream) -> TokenStream { + TokenStream::from_str("hey#123").unwrap().into_iter().count().to_string().parse().unwrap() +} + +#[proc_macro] +pub fn number_of_tokens_in_a_prefixed_char_literal(_: TokenStream) -> TokenStream { + TokenStream::from_str("hey#'a'").unwrap().into_iter().count().to_string().parse().unwrap() +} + +#[proc_macro] +pub fn number_of_tokens_in_a_prefixed_string_literal(_: TokenStream) -> TokenStream { + TokenStream::from_str("hey#\"abc\"").unwrap().into_iter().count().to_string().parse().unwrap() +} diff --git a/src/test/ui/rust-2021/auxiliary/reserved-prefixes-macro-2021.rs b/src/test/ui/rust-2021/auxiliary/reserved-prefixes-macro-2021.rs new file mode 100644 index 00000000000..691bfdc15c3 --- /dev/null +++ b/src/test/ui/rust-2021/auxiliary/reserved-prefixes-macro-2021.rs @@ -0,0 +1,25 @@ +// force-host +// edition:2021 +// no-prefer-dynamic + +#![crate_type = "proc-macro"] + +extern crate proc_macro; + +use proc_macro::TokenStream; +use std::str::FromStr; + +#[proc_macro] +pub fn number_of_tokens_in_a_prefixed_integer_literal(_: TokenStream) -> TokenStream { + TokenStream::from_str("hey#123").unwrap().into_iter().count().to_string().parse().unwrap() +} + +#[proc_macro] +pub fn number_of_tokens_in_a_prefixed_char_literal(_: TokenStream) -> TokenStream { + TokenStream::from_str("hey#'a'").unwrap().into_iter().count().to_string().parse().unwrap() +} + +#[proc_macro] +pub fn number_of_tokens_in_a_prefixed_string_literal(_: TokenStream) -> TokenStream { + TokenStream::from_str("hey#\"abc\"").unwrap().into_iter().count().to_string().parse().unwrap() +} diff --git a/src/test/ui/rust-2021/future-prelude-collision-imported.fixed b/src/test/ui/rust-2021/future-prelude-collision-imported.fixed new file mode 100644 index 00000000000..725d5aa234e --- /dev/null +++ b/src/test/ui/rust-2021/future-prelude-collision-imported.fixed @@ -0,0 +1,59 @@ +// run-rustfix +// edition:2018 +// check-pass +#![warn(future_prelude_collision)] +#![allow(dead_code)] +#![allow(unused_imports)] + +mod m { + pub trait TryIntoU32 { + fn try_into(self) -> Result<u32, ()>; + } + + impl TryIntoU32 for u8 { + fn try_into(self) -> Result<u32, ()> { + Ok(self as u32) + } + } + + pub trait AnotherTrick {} +} + +mod a { + use crate::m::TryIntoU32; + + fn main() { + // In this case, we can just use `TryIntoU32` + let _: u32 = TryIntoU32::try_into(3u8).unwrap(); + //~^ WARNING trait method `try_into` will become ambiguous in Rust 2021 + //~^^ WARNING this is accepted in the current edition + } +} + +mod b { + use crate::m::AnotherTrick as TryIntoU32; + use crate::m::TryIntoU32 as _; + + fn main() { + // In this case, a `TryIntoU32::try_into` rewrite will not work, and we need to use + // the path `crate::m::TryIntoU32` (with which it was imported). + let _: u32 = crate::m::TryIntoU32::try_into(3u8).unwrap(); + //~^ WARNING trait method `try_into` will become ambiguous in Rust 2021 + //~^^ WARNING this is accepted in the current edition + } +} + +mod c { + use super::m::TryIntoU32 as _; + use crate::m::AnotherTrick as TryIntoU32; + + fn main() { + // In this case, a `TryIntoU32::try_into` rewrite will not work, and we need to use + // the path `super::m::TryIntoU32` (with which it was imported). + let _: u32 = super::m::TryIntoU32::try_into(3u8).unwrap(); + //~^ WARNING trait method `try_into` will become ambiguous in Rust 2021 + //~^^ WARNING this is accepted in the current edition + } +} + +fn main() {} diff --git a/src/test/ui/rust-2021/future-prelude-collision-imported.rs b/src/test/ui/rust-2021/future-prelude-collision-imported.rs new file mode 100644 index 00000000000..6ca9a919f3c --- /dev/null +++ b/src/test/ui/rust-2021/future-prelude-collision-imported.rs @@ -0,0 +1,59 @@ +// run-rustfix +// edition:2018 +// check-pass +#![warn(future_prelude_collision)] +#![allow(dead_code)] +#![allow(unused_imports)] + +mod m { + pub trait TryIntoU32 { + fn try_into(self) -> Result<u32, ()>; + } + + impl TryIntoU32 for u8 { + fn try_into(self) -> Result<u32, ()> { + Ok(self as u32) + } + } + + pub trait AnotherTrick {} +} + +mod a { + use crate::m::TryIntoU32; + + fn main() { + // In this case, we can just use `TryIntoU32` + let _: u32 = 3u8.try_into().unwrap(); + //~^ WARNING trait method `try_into` will become ambiguous in Rust 2021 + //~^^ WARNING this is accepted in the current edition + } +} + +mod b { + use crate::m::AnotherTrick as TryIntoU32; + use crate::m::TryIntoU32 as _; + + fn main() { + // In this case, a `TryIntoU32::try_into` rewrite will not work, and we need to use + // the path `crate::m::TryIntoU32` (with which it was imported). + let _: u32 = 3u8.try_into().unwrap(); + //~^ WARNING trait method `try_into` will become ambiguous in Rust 2021 + //~^^ WARNING this is accepted in the current edition + } +} + +mod c { + use super::m::TryIntoU32 as _; + use crate::m::AnotherTrick as TryIntoU32; + + fn main() { + // In this case, a `TryIntoU32::try_into` rewrite will not work, and we need to use + // the path `super::m::TryIntoU32` (with which it was imported). + let _: u32 = 3u8.try_into().unwrap(); + //~^ WARNING trait method `try_into` will become ambiguous in Rust 2021 + //~^^ WARNING this is accepted in the current edition + } +} + +fn main() {} diff --git a/src/test/ui/rust-2021/future-prelude-collision-imported.stderr b/src/test/ui/rust-2021/future-prelude-collision-imported.stderr new file mode 100644 index 00000000000..8889485c917 --- /dev/null +++ b/src/test/ui/rust-2021/future-prelude-collision-imported.stderr @@ -0,0 +1,34 @@ +warning: trait method `try_into` will become ambiguous in Rust 2021 + --> $DIR/future-prelude-collision-imported.rs:27:22 + | +LL | let _: u32 = 3u8.try_into().unwrap(); + | ^^^^^^^^^^^^^^ help: disambiguate the associated function: `TryIntoU32::try_into(3u8)` + | +note: the lint level is defined here + --> $DIR/future-prelude-collision-imported.rs:4:9 + | +LL | #![warn(future_prelude_collision)] + | ^^^^^^^^^^^^^^^^^^^^^^^^ + = warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021! + = note: for more information, see issue #85684 <https://github.com/rust-lang/rust/issues/85684> + +warning: trait method `try_into` will become ambiguous in Rust 2021 + --> $DIR/future-prelude-collision-imported.rs:40:22 + | +LL | let _: u32 = 3u8.try_into().unwrap(); + | ^^^^^^^^^^^^^^ help: disambiguate the associated function: `crate::m::TryIntoU32::try_into(3u8)` + | + = warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021! + = note: for more information, see issue #85684 <https://github.com/rust-lang/rust/issues/85684> + +warning: trait method `try_into` will become ambiguous in Rust 2021 + --> $DIR/future-prelude-collision-imported.rs:53:22 + | +LL | let _: u32 = 3u8.try_into().unwrap(); + | ^^^^^^^^^^^^^^ help: disambiguate the associated function: `super::m::TryIntoU32::try_into(3u8)` + | + = warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021! + = note: for more information, see issue #85684 <https://github.com/rust-lang/rust/issues/85684> + +warning: 3 warnings emitted + diff --git a/src/test/ui/rust-2021/future-prelude-collision-shadow.rs b/src/test/ui/rust-2021/future-prelude-collision-shadow.rs new file mode 100644 index 00000000000..c9d2529341f --- /dev/null +++ b/src/test/ui/rust-2021/future-prelude-collision-shadow.rs @@ -0,0 +1,32 @@ +// edition:2018 +#![warn(future_prelude_collision)] +#![allow(dead_code)] +#![allow(unused_imports)] + +mod m { + pub trait TryIntoU32 { + fn try_into(self) -> Result<u32, ()>; + } + + impl TryIntoU32 for u8 { + fn try_into(self) -> Result<u32, ()> { + Ok(self as u32) + } + } + + pub trait AnotherTrick {} +} + +mod d { + use crate::m::AnotherTrick as TryIntoU32; + use crate::m::*; + + fn main() { + // Here, `TryIntoU32` is imported but shadowed, but in that case we don't permit its methods + // to be available. + let _: u32 = 3u8.try_into().unwrap(); + //~^ ERROR no method named `try_into` found for type `u8` in the current scope + } +} + +fn main() {} diff --git a/src/test/ui/rust-2021/future-prelude-collision-shadow.stderr b/src/test/ui/rust-2021/future-prelude-collision-shadow.stderr new file mode 100644 index 00000000000..ad9b8af00e4 --- /dev/null +++ b/src/test/ui/rust-2021/future-prelude-collision-shadow.stderr @@ -0,0 +1,40 @@ +error[E0599]: no method named `try_into` found for type `u8` in the current scope + --> $DIR/future-prelude-collision-shadow.rs:27:26 + | +LL | let _: u32 = 3u8.try_into().unwrap(); + | ^^^^^^^^ method not found in `u8` + | + ::: $SRC_DIR/core/src/convert/mod.rs:LL:COL + | +LL | fn try_into(self) -> Result<T, Self::Error>; + | -------- + | | + | the method is available for `Box<u8>` here + | the method is available for `Pin<u8>` here + | the method is available for `Arc<u8>` here + | the method is available for `Rc<u8>` here + | + = help: items from traits can only be used if the trait is in scope + = note: the following traits are implemented but not in scope; perhaps add a `use` for one of them: + candidate #1: `use crate::m::TryIntoU32;` + candidate #2: `use std::convert::TryInto;` +help: consider wrapping the receiver expression with the appropriate type + | +LL | let _: u32 = Box::new(3u8).try_into().unwrap(); + | ^^^^^^^^^ ^ +help: consider wrapping the receiver expression with the appropriate type + | +LL | let _: u32 = Pin::new(3u8).try_into().unwrap(); + | ^^^^^^^^^ ^ +help: consider wrapping the receiver expression with the appropriate type + | +LL | let _: u32 = Arc::new(3u8).try_into().unwrap(); + | ^^^^^^^^^ ^ +help: consider wrapping the receiver expression with the appropriate type + | +LL | let _: u32 = Rc::new(3u8).try_into().unwrap(); + | ^^^^^^^^ ^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0599`. diff --git a/src/test/ui/rust-2021/future-prelude-collision.fixed b/src/test/ui/rust-2021/future-prelude-collision.fixed new file mode 100644 index 00000000000..4bcbe6b094a --- /dev/null +++ b/src/test/ui/rust-2021/future-prelude-collision.fixed @@ -0,0 +1,98 @@ +// run-rustfix +// edition:2018 +// check-pass +#![warn(future_prelude_collision)] + +trait TryIntoU32 { + fn try_into(self) -> Result<u32, ()>; +} + +impl TryIntoU32 for u8 { + fn try_into(self) -> Result<u32, ()> { + Ok(self as u32) + } +} + +// needed for autoref test +impl TryIntoU32 for &f32 { + fn try_into(self) -> Result<u32, ()> { + Ok(*self as u32) + } +} + +trait TryFromU8: Sized { + fn try_from(x: u8) -> Result<Self, ()>; +} + +impl TryFromU8 for u32 { + fn try_from(x: u8) -> Result<Self, ()> { + Ok(x as u32) + } +} + +impl TryIntoU32 for *const u16 { + fn try_into(self) -> Result<u32, ()> { + Ok(unsafe { *self } as u32) + } +} + +trait FromByteIterator { + fn from_iter<T>(iter: T) -> Self + where + T: Iterator<Item = u8>; +} + +impl FromByteIterator for Vec<u8> { + fn from_iter<T>(iter: T) -> Self + where + T: Iterator<Item = u8>, + { + iter.collect() + } +} + +fn main() { + // test dot-call that will break in 2021 edition + let _: u32 = TryIntoU32::try_into(3u8).unwrap(); + //~^ WARNING trait method `try_into` will become ambiguous in Rust 2021 + //~^^ WARNING this is accepted in the current edition + + // test associated function call that will break in 2021 edition + let _ = <u32 as TryFromU8>::try_from(3u8).unwrap(); + //~^ WARNING trait-associated function `try_from` will become ambiguous in Rust 2021 + //~^^ WARNING this is accepted in the current edition + + // test reverse turbofish too + let _ = <Vec<u8> as FromByteIterator>::from_iter(vec![1u8, 2, 3, 4, 5, 6].into_iter()); + //~^ WARNING trait-associated function `from_iter` will become ambiguous in Rust 2021 + //~^^ WARNING this is accepted in the current edition + + // negative testing lint (this line should *not* emit a warning) + let _: u32 = TryFromU8::try_from(3u8).unwrap(); + + // test type omission + let _: u32 = <_ as TryFromU8>::try_from(3u8).unwrap(); + //~^ WARNING trait-associated function `try_from` will become ambiguous in Rust 2021 + //~^^ WARNING this is accepted in the current edition + + // test autoderef + let _: u32 = TryIntoU32::try_into(*(&3u8)).unwrap(); + //~^ WARNING trait method `try_into` will become ambiguous in Rust 2021 + //~^^ WARNING this is accepted in the current edition + + // test autoref + let _: u32 = TryIntoU32::try_into(&3.0).unwrap(); + //~^ WARNING trait method `try_into` will become ambiguous in Rust 2021 + //~^^ WARNING this is accepted in the current edition + + let mut data = 3u16; + let mut_ptr = std::ptr::addr_of_mut!(data); + let _: u32 = TryIntoU32::try_into(mut_ptr as *const _).unwrap(); + //~^ WARNING trait method `try_into` will become ambiguous in Rust 2021 + //~^^ WARNING this is accepted in the current edition + + type U32Alias = u32; + let _ = <U32Alias as TryFromU8>::try_from(3u8).unwrap(); + //~^ WARNING trait-associated function `try_from` will become ambiguous in Rust 2021 + //~^^ WARNING this is accepted in the current edition +} diff --git a/src/test/ui/rust-2021/future-prelude-collision.rs b/src/test/ui/rust-2021/future-prelude-collision.rs new file mode 100644 index 00000000000..bc23a8a92a6 --- /dev/null +++ b/src/test/ui/rust-2021/future-prelude-collision.rs @@ -0,0 +1,98 @@ +// run-rustfix +// edition:2018 +// check-pass +#![warn(future_prelude_collision)] + +trait TryIntoU32 { + fn try_into(self) -> Result<u32, ()>; +} + +impl TryIntoU32 for u8 { + fn try_into(self) -> Result<u32, ()> { + Ok(self as u32) + } +} + +// needed for autoref test +impl TryIntoU32 for &f32 { + fn try_into(self) -> Result<u32, ()> { + Ok(*self as u32) + } +} + +trait TryFromU8: Sized { + fn try_from(x: u8) -> Result<Self, ()>; +} + +impl TryFromU8 for u32 { + fn try_from(x: u8) -> Result<Self, ()> { + Ok(x as u32) + } +} + +impl TryIntoU32 for *const u16 { + fn try_into(self) -> Result<u32, ()> { + Ok(unsafe { *self } as u32) + } +} + +trait FromByteIterator { + fn from_iter<T>(iter: T) -> Self + where + T: Iterator<Item = u8>; +} + +impl FromByteIterator for Vec<u8> { + fn from_iter<T>(iter: T) -> Self + where + T: Iterator<Item = u8>, + { + iter.collect() + } +} + +fn main() { + // test dot-call that will break in 2021 edition + let _: u32 = 3u8.try_into().unwrap(); + //~^ WARNING trait method `try_into` will become ambiguous in Rust 2021 + //~^^ WARNING this is accepted in the current edition + + // test associated function call that will break in 2021 edition + let _ = u32::try_from(3u8).unwrap(); + //~^ WARNING trait-associated function `try_from` will become ambiguous in Rust 2021 + //~^^ WARNING this is accepted in the current edition + + // test reverse turbofish too + let _ = <Vec<u8>>::from_iter(vec![1u8, 2, 3, 4, 5, 6].into_iter()); + //~^ WARNING trait-associated function `from_iter` will become ambiguous in Rust 2021 + //~^^ WARNING this is accepted in the current edition + + // negative testing lint (this line should *not* emit a warning) + let _: u32 = TryFromU8::try_from(3u8).unwrap(); + + // test type omission + let _: u32 = <_>::try_from(3u8).unwrap(); + //~^ WARNING trait-associated function `try_from` will become ambiguous in Rust 2021 + //~^^ WARNING this is accepted in the current edition + + // test autoderef + let _: u32 = (&3u8).try_into().unwrap(); + //~^ WARNING trait method `try_into` will become ambiguous in Rust 2021 + //~^^ WARNING this is accepted in the current edition + + // test autoref + let _: u32 = 3.0.try_into().unwrap(); + //~^ WARNING trait method `try_into` will become ambiguous in Rust 2021 + //~^^ WARNING this is accepted in the current edition + + let mut data = 3u16; + let mut_ptr = std::ptr::addr_of_mut!(data); + let _: u32 = mut_ptr.try_into().unwrap(); + //~^ WARNING trait method `try_into` will become ambiguous in Rust 2021 + //~^^ WARNING this is accepted in the current edition + + type U32Alias = u32; + let _ = U32Alias::try_from(3u8).unwrap(); + //~^ WARNING trait-associated function `try_from` will become ambiguous in Rust 2021 + //~^^ WARNING this is accepted in the current edition +} diff --git a/src/test/ui/rust-2021/future-prelude-collision.stderr b/src/test/ui/rust-2021/future-prelude-collision.stderr new file mode 100644 index 00000000000..e167468ab19 --- /dev/null +++ b/src/test/ui/rust-2021/future-prelude-collision.stderr @@ -0,0 +1,79 @@ +warning: trait method `try_into` will become ambiguous in Rust 2021 + --> $DIR/future-prelude-collision.rs:56:18 + | +LL | let _: u32 = 3u8.try_into().unwrap(); + | ^^^^^^^^^^^^^^ help: disambiguate the associated function: `TryIntoU32::try_into(3u8)` + | +note: the lint level is defined here + --> $DIR/future-prelude-collision.rs:4:9 + | +LL | #![warn(future_prelude_collision)] + | ^^^^^^^^^^^^^^^^^^^^^^^^ + = warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021! + = note: for more information, see issue #85684 <https://github.com/rust-lang/rust/issues/85684> + +warning: trait-associated function `try_from` will become ambiguous in Rust 2021 + --> $DIR/future-prelude-collision.rs:61:13 + | +LL | let _ = u32::try_from(3u8).unwrap(); + | ^^^^^^^^^^^^^ help: disambiguate the associated function: `<u32 as TryFromU8>::try_from` + | + = warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021! + = note: for more information, see issue #85684 <https://github.com/rust-lang/rust/issues/85684> + +warning: trait-associated function `from_iter` will become ambiguous in Rust 2021 + --> $DIR/future-prelude-collision.rs:66:13 + | +LL | let _ = <Vec<u8>>::from_iter(vec![1u8, 2, 3, 4, 5, 6].into_iter()); + | ^^^^^^^^^^^^^^^^^^^^ help: disambiguate the associated function: `<Vec<u8> as FromByteIterator>::from_iter` + | + = warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021! + = note: for more information, see issue #85684 <https://github.com/rust-lang/rust/issues/85684> + +warning: trait-associated function `try_from` will become ambiguous in Rust 2021 + --> $DIR/future-prelude-collision.rs:74:18 + | +LL | let _: u32 = <_>::try_from(3u8).unwrap(); + | ^^^^^^^^^^^^^ help: disambiguate the associated function: `<_ as TryFromU8>::try_from` + | + = warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021! + = note: for more information, see issue #85684 <https://github.com/rust-lang/rust/issues/85684> + +warning: trait method `try_into` will become ambiguous in Rust 2021 + --> $DIR/future-prelude-collision.rs:79:18 + | +LL | let _: u32 = (&3u8).try_into().unwrap(); + | ^^^^^^^^^^^^^^^^^ help: disambiguate the associated function: `TryIntoU32::try_into(*(&3u8))` + | + = warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021! + = note: for more information, see issue #85684 <https://github.com/rust-lang/rust/issues/85684> + +warning: trait method `try_into` will become ambiguous in Rust 2021 + --> $DIR/future-prelude-collision.rs:84:18 + | +LL | let _: u32 = 3.0.try_into().unwrap(); + | ^^^^^^^^^^^^^^ help: disambiguate the associated function: `TryIntoU32::try_into(&3.0)` + | + = warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021! + = note: for more information, see issue #85684 <https://github.com/rust-lang/rust/issues/85684> + +warning: trait method `try_into` will become ambiguous in Rust 2021 + --> $DIR/future-prelude-collision.rs:90:18 + | +LL | let _: u32 = mut_ptr.try_into().unwrap(); + | ^^^^^^^^^^^^^^^^^^ help: disambiguate the associated function: `TryIntoU32::try_into(mut_ptr as *const _)` + | + = warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021! + = note: for more information, see issue #85684 <https://github.com/rust-lang/rust/issues/85684> + +warning: trait-associated function `try_from` will become ambiguous in Rust 2021 + --> $DIR/future-prelude-collision.rs:95:13 + | +LL | let _ = U32Alias::try_from(3u8).unwrap(); + | ^^^^^^^^^^^^^^^^^^ help: disambiguate the associated function: `<U32Alias as TryFromU8>::try_from` + | + = warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021! + = note: for more information, see issue #85684 <https://github.com/rust-lang/rust/issues/85684> + +warning: 8 warnings emitted + diff --git a/src/test/ui/rust-2021/generic-type-collision.fixed b/src/test/ui/rust-2021/generic-type-collision.fixed new file mode 100644 index 00000000000..d1a085f23a0 --- /dev/null +++ b/src/test/ui/rust-2021/generic-type-collision.fixed @@ -0,0 +1,18 @@ +// check-pass +// run-rustfix +// edition 2018 +#![warn(future_prelude_collision)] + +trait MyTrait<A> { + fn from_iter(x: Option<A>); +} + +impl<T> MyTrait<()> for Vec<T> { + fn from_iter(_: Option<()>) {} +} + +fn main() { + <Vec<i32> as MyTrait<_>>::from_iter(None); + //~^ WARNING trait-associated function `from_iter` will become ambiguous in Rust 2021 + //~^^ WARNING this is accepted in the current edition +} diff --git a/src/test/ui/rust-2021/generic-type-collision.rs b/src/test/ui/rust-2021/generic-type-collision.rs new file mode 100644 index 00000000000..5069fba396e --- /dev/null +++ b/src/test/ui/rust-2021/generic-type-collision.rs @@ -0,0 +1,18 @@ +// check-pass +// run-rustfix +// edition 2018 +#![warn(future_prelude_collision)] + +trait MyTrait<A> { + fn from_iter(x: Option<A>); +} + +impl<T> MyTrait<()> for Vec<T> { + fn from_iter(_: Option<()>) {} +} + +fn main() { + <Vec<i32>>::from_iter(None); + //~^ WARNING trait-associated function `from_iter` will become ambiguous in Rust 2021 + //~^^ WARNING this is accepted in the current edition +} diff --git a/src/test/ui/rust-2021/generic-type-collision.stderr b/src/test/ui/rust-2021/generic-type-collision.stderr new file mode 100644 index 00000000000..05591c3d448 --- /dev/null +++ b/src/test/ui/rust-2021/generic-type-collision.stderr @@ -0,0 +1,16 @@ +warning: trait-associated function `from_iter` will become ambiguous in Rust 2021 + --> $DIR/generic-type-collision.rs:15:5 + | +LL | <Vec<i32>>::from_iter(None); + | ^^^^^^^^^^^^^^^^^^^^^ help: disambiguate the associated function: `<Vec<i32> as MyTrait<_>>::from_iter` + | +note: the lint level is defined here + --> $DIR/generic-type-collision.rs:4:9 + | +LL | #![warn(future_prelude_collision)] + | ^^^^^^^^^^^^^^^^^^^^^^^^ + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! + = note: for more information, see issue #85684 <https://github.com/rust-lang/rust/issues/85684> + +warning: 1 warning emitted + diff --git a/src/test/ui/rust-2021/inherent-dyn-collision.fixed b/src/test/ui/rust-2021/inherent-dyn-collision.fixed new file mode 100644 index 00000000000..cf6287a758f --- /dev/null +++ b/src/test/ui/rust-2021/inherent-dyn-collision.fixed @@ -0,0 +1,53 @@ +// Test case where the method we want is an inherent method on a +// dyn Trait. In that case, the fix is to insert `*` on the receiver. +// +// check-pass +// run-rustfix +// edition:2018 + +#![warn(future_prelude_collision)] + +trait TryIntoU32 { + fn try_into(&self) -> Result<u32, ()>; +} + +impl TryIntoU32 for u8 { + // note: &self + fn try_into(&self) -> Result<u32, ()> { + Ok(22) + } +} + +mod inner { + use super::get_dyn_trait; + + // note: this does nothing, but is copying from ffishim's problem of + // having a struct of the same name as the trait in-scope, while *also* + // implementing the trait for that struct but **without** importing the + // trait itself into scope + struct TryIntoU32; + + impl super::TryIntoU32 for TryIntoU32 { + fn try_into(&self) -> Result<u32, ()> { + Ok(0) + } + } + + // this is where the gross part happens. since `get_dyn_trait` returns + // a Box<dyn Trait>, it can still call the method for `dyn Trait` without + // `Trait` being in-scope. it might even be possible to make the trait itself + // entirely unreference-able from the callsite? + pub fn test() -> u32 { + (&*get_dyn_trait()).try_into().unwrap() + //~^ WARNING trait method `try_into` will become ambiguous + //~| WARNING this is accepted in the current edition + } +} + +fn get_dyn_trait() -> Box<dyn TryIntoU32> { + Box::new(3u8) as Box<dyn TryIntoU32> +} + +fn main() { + dbg!(inner::test()); +} diff --git a/src/test/ui/rust-2021/inherent-dyn-collision.rs b/src/test/ui/rust-2021/inherent-dyn-collision.rs new file mode 100644 index 00000000000..0349ad5b641 --- /dev/null +++ b/src/test/ui/rust-2021/inherent-dyn-collision.rs @@ -0,0 +1,53 @@ +// Test case where the method we want is an inherent method on a +// dyn Trait. In that case, the fix is to insert `*` on the receiver. +// +// check-pass +// run-rustfix +// edition:2018 + +#![warn(future_prelude_collision)] + +trait TryIntoU32 { + fn try_into(&self) -> Result<u32, ()>; +} + +impl TryIntoU32 for u8 { + // note: &self + fn try_into(&self) -> Result<u32, ()> { + Ok(22) + } +} + +mod inner { + use super::get_dyn_trait; + + // note: this does nothing, but is copying from ffishim's problem of + // having a struct of the same name as the trait in-scope, while *also* + // implementing the trait for that struct but **without** importing the + // trait itself into scope + struct TryIntoU32; + + impl super::TryIntoU32 for TryIntoU32 { + fn try_into(&self) -> Result<u32, ()> { + Ok(0) + } + } + + // this is where the gross part happens. since `get_dyn_trait` returns + // a Box<dyn Trait>, it can still call the method for `dyn Trait` without + // `Trait` being in-scope. it might even be possible to make the trait itself + // entirely unreference-able from the callsite? + pub fn test() -> u32 { + get_dyn_trait().try_into().unwrap() + //~^ WARNING trait method `try_into` will become ambiguous + //~| WARNING this is accepted in the current edition + } +} + +fn get_dyn_trait() -> Box<dyn TryIntoU32> { + Box::new(3u8) as Box<dyn TryIntoU32> +} + +fn main() { + dbg!(inner::test()); +} diff --git a/src/test/ui/rust-2021/inherent-dyn-collision.stderr b/src/test/ui/rust-2021/inherent-dyn-collision.stderr new file mode 100644 index 00000000000..9e95419715e --- /dev/null +++ b/src/test/ui/rust-2021/inherent-dyn-collision.stderr @@ -0,0 +1,16 @@ +warning: trait method `try_into` will become ambiguous in Rust 2021 + --> $DIR/inherent-dyn-collision.rs:41:9 + | +LL | get_dyn_trait().try_into().unwrap() + | ^^^^^^^^^^^^^^^ help: disambiguate the method call: `(&*get_dyn_trait())` + | +note: the lint level is defined here + --> $DIR/inherent-dyn-collision.rs:8:9 + | +LL | #![warn(future_prelude_collision)] + | ^^^^^^^^^^^^^^^^^^^^^^^^ + = warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021! + = note: for more information, see issue #85684 <https://github.com/rust-lang/rust/issues/85684> + +warning: 1 warning emitted + diff --git a/src/test/ui/rust-2021/inherent-method-collision.rs b/src/test/ui/rust-2021/inherent-method-collision.rs new file mode 100644 index 00000000000..c638351d5fc --- /dev/null +++ b/src/test/ui/rust-2021/inherent-method-collision.rs @@ -0,0 +1,15 @@ +// Test that we do NOT warn for inherent methods invoked via `T::` form. +// +// check-pass + +#![deny(future_prelude_collision)] + +pub struct MySeq {} + +impl MySeq { + pub fn from_iter(_: impl IntoIterator<Item = u32>) {} +} + +fn main() { + MySeq::from_iter(Some(22)); +} diff --git a/src/test/ui/rust-2021/reserved-prefixes-migration.fixed b/src/test/ui/rust-2021/reserved-prefixes-migration.fixed new file mode 100644 index 00000000000..dbc2ec6d42e --- /dev/null +++ b/src/test/ui/rust-2021/reserved-prefixes-migration.fixed @@ -0,0 +1,38 @@ +// check-pass +// run-rustfix +// compile-flags: -Z unstable-options --edition 2018 + +#![warn(reserved_prefix)] + +macro_rules! m2 { + ($a:tt $b:tt) => {}; +} + +macro_rules! m3 { + ($a:tt $b:tt $c:tt) => {}; +} + +fn main() { + m2!(z "hey"); + //~^ WARNING prefix `z` is unknown [reserved_prefix] + //~| WARNING hard error in Rust 2021 + m2!(prefix "hey"); + //~^ WARNING prefix `prefix` is unknown [reserved_prefix] + //~| WARNING hard error in Rust 2021 + m3!(hey #123); + //~^ WARNING prefix `hey` is unknown [reserved_prefix] + //~| WARNING hard error in Rust 2021 + m3!(hey #hey); + //~^ WARNING prefix `hey` is unknown [reserved_prefix] + //~| WARNING hard error in Rust 2021 +} + +macro_rules! quote { + (# name = # kind # value) => {}; +} + +quote! { + #name = #kind #value + //~^ WARNING prefix `kind` is unknown [reserved_prefix] + //~| WARNING hard error in Rust 2021 +} diff --git a/src/test/ui/rust-2021/reserved-prefixes-migration.rs b/src/test/ui/rust-2021/reserved-prefixes-migration.rs new file mode 100644 index 00000000000..6f7e3eb7a43 --- /dev/null +++ b/src/test/ui/rust-2021/reserved-prefixes-migration.rs @@ -0,0 +1,38 @@ +// check-pass +// run-rustfix +// compile-flags: -Z unstable-options --edition 2018 + +#![warn(reserved_prefix)] + +macro_rules! m2 { + ($a:tt $b:tt) => {}; +} + +macro_rules! m3 { + ($a:tt $b:tt $c:tt) => {}; +} + +fn main() { + m2!(z"hey"); + //~^ WARNING prefix `z` is unknown [reserved_prefix] + //~| WARNING hard error in Rust 2021 + m2!(prefix"hey"); + //~^ WARNING prefix `prefix` is unknown [reserved_prefix] + //~| WARNING hard error in Rust 2021 + m3!(hey#123); + //~^ WARNING prefix `hey` is unknown [reserved_prefix] + //~| WARNING hard error in Rust 2021 + m3!(hey#hey); + //~^ WARNING prefix `hey` is unknown [reserved_prefix] + //~| WARNING hard error in Rust 2021 +} + +macro_rules! quote { + (# name = # kind # value) => {}; +} + +quote! { + #name = #kind#value + //~^ WARNING prefix `kind` is unknown [reserved_prefix] + //~| WARNING hard error in Rust 2021 +} diff --git a/src/test/ui/rust-2021/reserved-prefixes-migration.stderr b/src/test/ui/rust-2021/reserved-prefixes-migration.stderr new file mode 100644 index 00000000000..28ac1966a1b --- /dev/null +++ b/src/test/ui/rust-2021/reserved-prefixes-migration.stderr @@ -0,0 +1,72 @@ +warning: prefix `z` is unknown + --> $DIR/reserved-prefixes-migration.rs:16:9 + | +LL | m2!(z"hey"); + | ^ unknown prefix + | +note: the lint level is defined here + --> $DIR/reserved-prefixes-migration.rs:5:9 + | +LL | #![warn(reserved_prefix)] + | ^^^^^^^^^^^^^^^ + = warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021! + = note: for more information, see issue #84978 <https://github.com/rust-lang/rust/issues/84978> +help: insert whitespace here to avoid this being parsed as a prefix in Rust 2021 + | +LL | m2!(z "hey"); + | -- + +warning: prefix `prefix` is unknown + --> $DIR/reserved-prefixes-migration.rs:19:9 + | +LL | m2!(prefix"hey"); + | ^^^^^^ unknown prefix + | + = warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021! + = note: for more information, see issue #84978 <https://github.com/rust-lang/rust/issues/84978> +help: insert whitespace here to avoid this being parsed as a prefix in Rust 2021 + | +LL | m2!(prefix "hey"); + | -- + +warning: prefix `hey` is unknown + --> $DIR/reserved-prefixes-migration.rs:22:9 + | +LL | m3!(hey#123); + | ^^^ unknown prefix + | + = warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021! + = note: for more information, see issue #84978 <https://github.com/rust-lang/rust/issues/84978> +help: insert whitespace here to avoid this being parsed as a prefix in Rust 2021 + | +LL | m3!(hey #123); + | -- + +warning: prefix `hey` is unknown + --> $DIR/reserved-prefixes-migration.rs:25:9 + | +LL | m3!(hey#hey); + | ^^^ unknown prefix + | + = warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021! + = note: for more information, see issue #84978 <https://github.com/rust-lang/rust/issues/84978> +help: insert whitespace here to avoid this being parsed as a prefix in Rust 2021 + | +LL | m3!(hey #hey); + | -- + +warning: prefix `kind` is unknown + --> $DIR/reserved-prefixes-migration.rs:35:14 + | +LL | #name = #kind#value + | ^^^^ unknown prefix + | + = warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021! + = note: for more information, see issue #84978 <https://github.com/rust-lang/rust/issues/84978> +help: insert whitespace here to avoid this being parsed as a prefix in Rust 2021 + | +LL | #name = #kind #value + | -- + +warning: 5 warnings emitted + diff --git a/src/test/ui/rust-2021/reserved-prefixes-via-macro-2.rs b/src/test/ui/rust-2021/reserved-prefixes-via-macro-2.rs new file mode 100644 index 00000000000..74f20660613 --- /dev/null +++ b/src/test/ui/rust-2021/reserved-prefixes-via-macro-2.rs @@ -0,0 +1,21 @@ +// edition:2018 +// aux-build:reserved-prefixes-macro-2018.rs +// aux-build:reserved-prefixes-macro-2021.rs + +extern crate reserved_prefixes_macro_2018 as m2018; +extern crate reserved_prefixes_macro_2021 as m2021; + +fn main() { + // Ok: + m2018::number_of_tokens_in_a_prefixed_integer_literal!(); + m2018::number_of_tokens_in_a_prefixed_char_literal!(); + m2018::number_of_tokens_in_a_prefixed_string_literal!(); + + // Error, even though *this* crate is 2018: + m2021::number_of_tokens_in_a_prefixed_integer_literal!(); + //~^ ERROR prefix `hey` is unknown + m2021::number_of_tokens_in_a_prefixed_char_literal!(); + //~^ ERROR prefix `hey` is unknown + m2021::number_of_tokens_in_a_prefixed_string_literal!(); + //~^ ERROR prefix `hey` is unknown +} diff --git a/src/test/ui/rust-2021/reserved-prefixes-via-macro-2.stderr b/src/test/ui/rust-2021/reserved-prefixes-via-macro-2.stderr new file mode 100644 index 00000000000..9d7ca570c4c --- /dev/null +++ b/src/test/ui/rust-2021/reserved-prefixes-via-macro-2.stderr @@ -0,0 +1,29 @@ +error: prefix `hey` is unknown + --> $DIR/reserved-prefixes-via-macro-2.rs:15:5 + | +LL | m2021::number_of_tokens_in_a_prefixed_integer_literal!(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unknown prefix + | + = note: prefixed identifiers and literals are reserved since Rust 2021 + = note: this error originates in the macro `m2021::number_of_tokens_in_a_prefixed_integer_literal` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: prefix `hey` is unknown + --> $DIR/reserved-prefixes-via-macro-2.rs:17:5 + | +LL | m2021::number_of_tokens_in_a_prefixed_char_literal!(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unknown prefix + | + = note: prefixed identifiers and literals are reserved since Rust 2021 + = note: this error originates in the macro `m2021::number_of_tokens_in_a_prefixed_char_literal` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: prefix `hey` is unknown + --> $DIR/reserved-prefixes-via-macro-2.rs:19:5 + | +LL | m2021::number_of_tokens_in_a_prefixed_string_literal!(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unknown prefix + | + = note: prefixed identifiers and literals are reserved since Rust 2021 + = note: this error originates in the macro `m2021::number_of_tokens_in_a_prefixed_string_literal` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: aborting due to 3 previous errors + diff --git a/src/test/ui/rust-2021/reserved-prefixes-via-macro.rs b/src/test/ui/rust-2021/reserved-prefixes-via-macro.rs new file mode 100644 index 00000000000..110b6d64ccc --- /dev/null +++ b/src/test/ui/rust-2021/reserved-prefixes-via-macro.rs @@ -0,0 +1,12 @@ +// run-pass +// edition:2021 +// aux-build:reserved-prefixes-macro-2018.rs + +extern crate reserved_prefixes_macro_2018 as m2018; + +fn main() { + // Ok, even though *this* crate is 2021: + assert_eq!(m2018::number_of_tokens_in_a_prefixed_integer_literal!(), 3); + assert_eq!(m2018::number_of_tokens_in_a_prefixed_char_literal!(), 3); + assert_eq!(m2018::number_of_tokens_in_a_prefixed_string_literal!(), 3); +} diff --git a/src/test/ui/rust-2021/reserved-prefixes.rs b/src/test/ui/rust-2021/reserved-prefixes.rs new file mode 100644 index 00000000000..5882c7d83d8 --- /dev/null +++ b/src/test/ui/rust-2021/reserved-prefixes.rs @@ -0,0 +1,36 @@ +// compile-flags: -Z unstable-options --edition 2021 + +macro_rules! demo2 { + ( $a:tt $b:tt ) => { println!("two tokens") }; +} + +macro_rules! demo3 { + ( $a:tt $b:tt $c:tt ) => { println!("three tokens") }; +} + +macro_rules! demo4 { + ( $a:tt $b:tt $c:tt $d:tt ) => { println!("four tokens") }; +} + +fn main() { + demo3!(foo#bar); //~ ERROR prefix `foo` is unknown + demo2!(foo"bar"); //~ ERROR prefix `foo` is unknown + demo2!(foo'b'); //~ ERROR prefix `foo` is unknown + + demo2!(foo'b); //~ ERROR prefix `foo` is unknown + demo3!(foo# bar); //~ ERROR prefix `foo` is unknown + demo4!(foo#! bar); //~ ERROR prefix `foo` is unknown + demo4!(foo## bar); //~ ERROR prefix `foo` is unknown + + demo4!(foo#bar#); + //~^ ERROR prefix `foo` is unknown + //~| ERROR prefix `bar` is unknown + + demo3!(foo # bar); + demo3!(foo #bar); + demo4!(foo!#bar); + demo4!(foo ##bar); + + demo3!(r"foo"#bar); + demo3!(r#foo#bar); +} diff --git a/src/test/ui/rust-2021/reserved-prefixes.stderr b/src/test/ui/rust-2021/reserved-prefixes.stderr new file mode 100644 index 00000000000..32e18563329 --- /dev/null +++ b/src/test/ui/rust-2021/reserved-prefixes.stderr @@ -0,0 +1,110 @@ +error: prefix `foo` is unknown + --> $DIR/reserved-prefixes.rs:16:12 + | +LL | demo3!(foo#bar); + | ^^^ unknown prefix + | + = note: prefixed identifiers and literals are reserved since Rust 2021 +help: consider inserting whitespace here + | +LL | demo3!(foo #bar); + | -- + +error: prefix `foo` is unknown + --> $DIR/reserved-prefixes.rs:17:12 + | +LL | demo2!(foo"bar"); + | ^^^ unknown prefix + | + = note: prefixed identifiers and literals are reserved since Rust 2021 +help: consider inserting whitespace here + | +LL | demo2!(foo "bar"); + | -- + +error: prefix `foo` is unknown + --> $DIR/reserved-prefixes.rs:18:12 + | +LL | demo2!(foo'b'); + | ^^^ unknown prefix + | + = note: prefixed identifiers and literals are reserved since Rust 2021 +help: consider inserting whitespace here + | +LL | demo2!(foo 'b'); + | -- + +error: prefix `foo` is unknown + --> $DIR/reserved-prefixes.rs:20:12 + | +LL | demo2!(foo'b); + | ^^^ unknown prefix + | + = note: prefixed identifiers and literals are reserved since Rust 2021 +help: consider inserting whitespace here + | +LL | demo2!(foo 'b); + | -- + +error: prefix `foo` is unknown + --> $DIR/reserved-prefixes.rs:21:12 + | +LL | demo3!(foo# bar); + | ^^^ unknown prefix + | + = note: prefixed identifiers and literals are reserved since Rust 2021 +help: consider inserting whitespace here + | +LL | demo3!(foo # bar); + | -- + +error: prefix `foo` is unknown + --> $DIR/reserved-prefixes.rs:22:12 + | +LL | demo4!(foo#! bar); + | ^^^ unknown prefix + | + = note: prefixed identifiers and literals are reserved since Rust 2021 +help: consider inserting whitespace here + | +LL | demo4!(foo #! bar); + | -- + +error: prefix `foo` is unknown + --> $DIR/reserved-prefixes.rs:23:12 + | +LL | demo4!(foo## bar); + | ^^^ unknown prefix + | + = note: prefixed identifiers and literals are reserved since Rust 2021 +help: consider inserting whitespace here + | +LL | demo4!(foo ## bar); + | -- + +error: prefix `foo` is unknown + --> $DIR/reserved-prefixes.rs:25:12 + | +LL | demo4!(foo#bar#); + | ^^^ unknown prefix + | + = note: prefixed identifiers and literals are reserved since Rust 2021 +help: consider inserting whitespace here + | +LL | demo4!(foo #bar#); + | -- + +error: prefix `bar` is unknown + --> $DIR/reserved-prefixes.rs:25:16 + | +LL | demo4!(foo#bar#); + | ^^^ unknown prefix + | + = note: prefixed identifiers and literals are reserved since Rust 2021 +help: consider inserting whitespace here + | +LL | demo4!(foo#bar #); + | -- + +error: aborting due to 9 previous errors + diff --git a/src/test/ui/rustdoc/check-doc-alias-attr-location.rs b/src/test/ui/rustdoc/check-doc-alias-attr-location.rs index 007d2ae6506..4738e5116b4 100644 --- a/src/test/ui/rustdoc/check-doc-alias-attr-location.rs +++ b/src/test/ui/rustdoc/check-doc-alias-attr-location.rs @@ -1,9 +1,9 @@ -#![crate_type="lib"] +#![crate_type = "lib"] pub struct Bar; pub trait Foo { type X; - fn foo() -> Self::X; + fn foo(x: u32) -> Self::X; } #[doc(alias = "foo")] //~ ERROR @@ -19,7 +19,8 @@ impl Bar { impl Foo for Bar { #[doc(alias = "assoc")] //~ ERROR type X = i32; - fn foo() -> Self::X { + fn foo(#[doc(alias = "qux")] _x: u32) -> Self::X { + //~^ ERROR 0 } } diff --git a/src/test/ui/rustdoc/check-doc-alias-attr-location.stderr b/src/test/ui/rustdoc/check-doc-alias-attr-location.stderr index a66e9939eaf..2b25882be21 100644 --- a/src/test/ui/rustdoc/check-doc-alias-attr-location.stderr +++ b/src/test/ui/rustdoc/check-doc-alias-attr-location.stderr @@ -1,3 +1,9 @@ +error: allow, cfg, cfg_attr, deny, forbid, and warn are the only allowed built-in attributes in function parameters + --> $DIR/check-doc-alias-attr-location.rs:22:12 + | +LL | fn foo(#[doc(alias = "qux")] _x: u32) -> Self::X { + | ^^^^^^^^^^^^^^^^^^^^^ + error: `#[doc(alias = "...")]` isn't allowed on extern block --> $DIR/check-doc-alias-attr-location.rs:9:7 | @@ -22,5 +28,5 @@ error: `#[doc(alias = "...")]` isn't allowed on type alias in implementation blo LL | #[doc(alias = "assoc")] | ^^^^^^^^^^^^^^^ -error: aborting due to 4 previous errors +error: aborting due to 5 previous errors diff --git a/src/test/ui/rustdoc/doc_keyword.rs b/src/test/ui/rustdoc/doc_keyword.rs index 4c72e7e9684..4518f77ef93 100644 --- a/src/test/ui/rustdoc/doc_keyword.rs +++ b/src/test/ui/rustdoc/doc_keyword.rs @@ -10,3 +10,11 @@ mod foo { #[doc(keyword = "hall")] //~ ERROR fn foo() {} + + +// Regression test for the ICE described in #83512. +trait Foo { + #[doc(keyword = "match")] + //~^ ERROR: `#[doc(keyword = "...")]` can only be used on modules + fn quux() {} +} diff --git a/src/test/ui/rustdoc/doc_keyword.stderr b/src/test/ui/rustdoc/doc_keyword.stderr index 0679bb8c5a7..6ba7034d541 100644 --- a/src/test/ui/rustdoc/doc_keyword.stderr +++ b/src/test/ui/rustdoc/doc_keyword.stderr @@ -10,11 +10,17 @@ error: `#[doc(keyword = "...")]` can only be used on modules LL | #[doc(keyword = "hall")] | ^^^^^^^^^^^^^^^^ +error: `#[doc(keyword = "...")]` can only be used on modules + --> $DIR/doc_keyword.rs:17:11 + | +LL | #[doc(keyword = "match")] + | ^^^^^^^^^^^^^^^^^ + error: `#![doc(keyword = "...")]` isn't allowed as a crate-level attribute --> $DIR/doc_keyword.rs:4:8 | LL | #![doc(keyword = "hello")] | ^^^^^^^^^^^^^^^^^ -error: aborting due to 3 previous errors +error: aborting due to 4 previous errors diff --git a/src/test/ui/sanitize/crt-static.rs b/src/test/ui/sanitize/crt-static.rs index f5dd2a40cc4..7a6b9eda3fa 100644 --- a/src/test/ui/sanitize/crt-static.rs +++ b/src/test/ui/sanitize/crt-static.rs @@ -1,4 +1,5 @@ // compile-flags: -Z sanitizer=address -C target-feature=+crt-static --target x86_64-unknown-linux-gnu +// needs-llvm-components: x86 #![feature(no_core)] #![no_core] diff --git a/src/test/ui/sanitize/incompatible.rs b/src/test/ui/sanitize/incompatible.rs index 4947f3b3d8b..bcafc2891fd 100644 --- a/src/test/ui/sanitize/incompatible.rs +++ b/src/test/ui/sanitize/incompatible.rs @@ -1,4 +1,5 @@ // compile-flags: -Z sanitizer=address -Z sanitizer=memory --target x86_64-unknown-linux-gnu +// needs-llvm-components: x86 // error-pattern: error: `-Zsanitizer=address` is incompatible with `-Zsanitizer=memory` #![feature(no_core)] diff --git a/src/test/ui/sanitize/unsupported-target.rs b/src/test/ui/sanitize/unsupported-target.rs index 3fb749815f7..9f29c76353b 100644 --- a/src/test/ui/sanitize/unsupported-target.rs +++ b/src/test/ui/sanitize/unsupported-target.rs @@ -1,4 +1,5 @@ // compile-flags: -Z sanitizer=leak --target i686-unknown-linux-gnu +// needs-llvm-components: x86 // error-pattern: error: leak sanitizer is not supported for this target #![feature(no_core)] #![no_core] diff --git a/src/test/ui/self/self-infer.rs b/src/test/ui/self/self-infer.rs index 0956f2a5691..cc17d8f8e39 100644 --- a/src/test/ui/self/self-infer.rs +++ b/src/test/ui/self/self-infer.rs @@ -1,8 +1,8 @@ struct S; impl S { - fn f(self: _) {} //~ERROR the type placeholder `_` is not allowed within types on item sig - fn g(self: &_) {} //~ERROR the type placeholder `_` is not allowed within types on item sig + fn f(self: _) {} //~ERROR the type placeholder `_` is not allowed within types on item signatures for functions + fn g(self: &_) {} //~ERROR the type placeholder `_` is not allowed within types on item signatures for functions } fn main() {} diff --git a/src/test/ui/self/self-infer.stderr b/src/test/ui/self/self-infer.stderr index 1475b212b56..8d70c6287e5 100644 --- a/src/test/ui/self/self-infer.stderr +++ b/src/test/ui/self/self-infer.stderr @@ -1,4 +1,4 @@ -error[E0121]: the type placeholder `_` is not allowed within types on item signatures +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for functions --> $DIR/self-infer.rs:4:16 | LL | fn f(self: _) {} @@ -9,7 +9,7 @@ help: use type parameters instead LL | fn f<T>(self: T) {} | ^^^ ^ -error[E0121]: the type placeholder `_` is not allowed within types on item signatures +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for functions --> $DIR/self-infer.rs:5:17 | LL | fn g(self: &_) {} diff --git a/src/test/ui/span/missing-unit-argument.rs b/src/test/ui/span/missing-unit-argument.rs index b8fb332120a..5b9861da6e8 100644 --- a/src/test/ui/span/missing-unit-argument.rs +++ b/src/test/ui/span/missing-unit-argument.rs @@ -8,7 +8,7 @@ impl S { } fn main() { - let _: Result<(), String> = Ok(); //~ ERROR this function takes + let _: Result<(), String> = Ok(); //~ ERROR this enum variant takes foo(); //~ ERROR this function takes foo(()); //~ ERROR this function takes bar(); //~ ERROR this function takes diff --git a/src/test/ui/span/missing-unit-argument.stderr b/src/test/ui/span/missing-unit-argument.stderr index b15da2cb479..7a24ffbd81c 100644 --- a/src/test/ui/span/missing-unit-argument.stderr +++ b/src/test/ui/span/missing-unit-argument.stderr @@ -1,4 +1,4 @@ -error[E0061]: this function takes 1 argument but 0 arguments were supplied +error[E0061]: this enum variant takes 1 argument but 0 arguments were supplied --> $DIR/missing-unit-argument.rs:11:33 | LL | let _: Result<(), String> = Ok(); diff --git a/src/test/ui/suggestions/const-no-type.rs b/src/test/ui/suggestions/const-no-type.rs index 2ffb24c6e6c..6f46cfdf024 100644 --- a/src/test/ui/suggestions/const-no-type.rs +++ b/src/test/ui/suggestions/const-no-type.rs @@ -32,20 +32,20 @@ static mut SM2 = "abc"; const C = 42; //~^ ERROR missing type for `const` item -//~| HELP provide a type for the item +//~| HELP provide a type for the constant //~| SUGGESTION C: i32 const D = &&42; //~^ ERROR missing type for `const` item -//~| HELP provide a type for the item +//~| HELP provide a type for the constant //~| SUGGESTION D: &&i32 static S = Vec::<String>::new(); //~^ ERROR missing type for `static` item -//~| HELP provide a type for the item +//~| HELP provide a type for the static variable //~| SUGGESTION S: Vec<String> static mut SM = "abc"; //~^ ERROR missing type for `static mut` item -//~| HELP provide a type for the item +//~| HELP provide a type for the static variable //~| SUGGESTION &str diff --git a/src/test/ui/suggestions/const-no-type.stderr b/src/test/ui/suggestions/const-no-type.stderr index b180a6a9a9b..3b0fd6337f1 100644 --- a/src/test/ui/suggestions/const-no-type.stderr +++ b/src/test/ui/suggestions/const-no-type.stderr @@ -2,25 +2,25 @@ error: missing type for `const` item --> $DIR/const-no-type.rs:33:7 | LL | const C = 42; - | ^ help: provide a type for the item: `C: i32` + | ^ help: provide a type for the constant: `C: i32` error: missing type for `const` item --> $DIR/const-no-type.rs:38:7 | LL | const D = &&42; - | ^ help: provide a type for the item: `D: &&i32` + | ^ help: provide a type for the constant: `D: &&i32` error: missing type for `static` item --> $DIR/const-no-type.rs:43:8 | LL | static S = Vec::<String>::new(); - | ^ help: provide a type for the item: `S: Vec<String>` + | ^ help: provide a type for the static variable: `S: Vec<String>` error: missing type for `static mut` item --> $DIR/const-no-type.rs:48:12 | LL | static mut SM = "abc"; - | ^^ help: provide a type for the item: `SM: &str` + | ^^ help: provide a type for the static variable: `SM: &str` error: missing type for `const` item --> $DIR/const-no-type.rs:14:7 diff --git a/src/test/ui/suggestions/issue-61963.rs b/src/test/ui/suggestions/issue-61963.rs index b5c379ebc6e..d31ed01b191 100644 --- a/src/test/ui/suggestions/issue-61963.rs +++ b/src/test/ui/suggestions/issue-61963.rs @@ -17,11 +17,11 @@ pub struct Qux<T>(T); #[dom_struct] pub struct Foo { //~^ ERROR trait objects without an explicit `dyn` are deprecated [bare_trait_objects] - //~| WARN this was previously accepted by the compiler + //~| WARN this is accepted in the current edition qux: Qux<Qux<Baz>>, bar: Box<Bar>, //~^ ERROR trait objects without an explicit `dyn` are deprecated [bare_trait_objects] - //~| WARN this was previously accepted by the compiler + //~| WARN this is accepted in the current edition } fn main() {} diff --git a/src/test/ui/suggestions/issue-61963.stderr b/src/test/ui/suggestions/issue-61963.stderr index f8c58b61734..6282a693855 100644 --- a/src/test/ui/suggestions/issue-61963.stderr +++ b/src/test/ui/suggestions/issue-61963.stderr @@ -9,7 +9,7 @@ note: the lint level is defined here | LL | #![deny(bare_trait_objects)] | ^^^^^^^^^^^^^^^^^^ - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2021 edition! + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! = note: for more information, see issue #80165 <https://github.com/rust-lang/rust/issues/80165> error: trait objects without an explicit `dyn` are deprecated @@ -18,7 +18,7 @@ error: trait objects without an explicit `dyn` are deprecated LL | pub struct Foo { | ^^^ help: use `dyn`: `dyn pub` | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2021 edition! + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! = note: for more information, see issue #80165 <https://github.com/rust-lang/rust/issues/80165> error: aborting due to 2 previous errors diff --git a/src/test/ui/suggestions/path-display.stderr b/src/test/ui/suggestions/path-display.stderr index 80ed1cdedf1..25c73c4c874 100644 --- a/src/test/ui/suggestions/path-display.stderr +++ b/src/test/ui/suggestions/path-display.stderr @@ -6,8 +6,6 @@ LL | println!("{}", path); | = help: the trait `std::fmt::Display` is not implemented for `Path` = note: call `.display()` or `.to_string_lossy()` to safely print paths, as they may contain non-Unicode data - = note: required because of the requirements on the impl of `std::fmt::Display` for `&Path` - = note: required by `std::fmt::Display::fmt` = note: this error originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to previous error diff --git a/src/test/ui/suggestions/unnamable-types.rs b/src/test/ui/suggestions/unnamable-types.rs index 5d0616443e5..483f9bbb48c 100644 --- a/src/test/ui/suggestions/unnamable-types.rs +++ b/src/test/ui/suggestions/unnamable-types.rs @@ -5,17 +5,17 @@ const A = 5; //~^ ERROR: missing type for `const` item -//~| HELP: provide a type for the item +//~| HELP: provide a type for the constant static B: _ = "abc"; -//~^ ERROR: the type placeholder `_` is not allowed within types on item signatures +//~^ ERROR: the type placeholder `_` is not allowed within types on item signatures for static variables //~| NOTE: not allowed in type signatures //~| HELP: replace with the correct type // FIXME: this should also suggest a function pointer, as the closure is non-capturing const C: _ = || 42; -//~^ ERROR: the type placeholder `_` is not allowed within types on item signatures +//~^ ERROR: the type placeholder `_` is not allowed within types on item signatures for constants //~| NOTE: not allowed in type signatures //~| NOTE: however, the inferred type @@ -28,10 +28,10 @@ const D = S { t: { let i = 0; move || -> i32 { i } } }; fn foo() -> i32 { 42 } const E = foo; //~^ ERROR: missing type for `const` item -//~| HELP: provide a type for the item +//~| HELP: provide a type for the constant const F = S { t: foo }; //~^ ERROR: missing type for `const` item -//~| HELP: provide a type for the item +//~| HELP: provide a type for the constant const G = || -> i32 { yield 0; return 1; }; diff --git a/src/test/ui/suggestions/unnamable-types.stderr b/src/test/ui/suggestions/unnamable-types.stderr index 05a7baa68ba..3a489a6e943 100644 --- a/src/test/ui/suggestions/unnamable-types.stderr +++ b/src/test/ui/suggestions/unnamable-types.stderr @@ -2,9 +2,9 @@ error: missing type for `const` item --> $DIR/unnamable-types.rs:6:7 | LL | const A = 5; - | ^ help: provide a type for the item: `A: i32` + | ^ help: provide a type for the constant: `A: i32` -error[E0121]: the type placeholder `_` is not allowed within types on item signatures +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for static variables --> $DIR/unnamable-types.rs:10:11 | LL | static B: _ = "abc"; @@ -13,7 +13,7 @@ LL | static B: _ = "abc"; | not allowed in type signatures | help: replace with the correct type: `&str` -error[E0121]: the type placeholder `_` is not allowed within types on item signatures +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for constants --> $DIR/unnamable-types.rs:17:10 | LL | const C: _ = || 42; @@ -41,13 +41,13 @@ error: missing type for `const` item --> $DIR/unnamable-types.rs:29:7 | LL | const E = foo; - | ^ help: provide a type for the item: `E: fn() -> i32` + | ^ help: provide a type for the constant: `E: fn() -> i32` error: missing type for `const` item --> $DIR/unnamable-types.rs:32:7 | LL | const F = S { t: foo }; - | ^ help: provide a type for the item: `F: S<fn() -> i32>` + | ^ help: provide a type for the constant: `F: S<fn() -> i32>` error: missing type for `const` item --> $DIR/unnamable-types.rs:37:7 diff --git a/src/test/ui/suggestions/use-placement-resolve.fixed b/src/test/ui/suggestions/use-placement-resolve.fixed new file mode 100644 index 00000000000..afe74cff2e9 --- /dev/null +++ b/src/test/ui/suggestions/use-placement-resolve.fixed @@ -0,0 +1,13 @@ +// compile-flags: --test +// run-rustfix +// Checks that the `use` suggestion appears *below* this inner attribute. +// There was an issue where the test synthetic #[allow(dead)] attribute on +// main which has a dummy span caused the suggestion to be placed at the top +// of the file. +#![allow(unused)] + +use std::fmt::Debug; + +fn main() {} + +fn foobar<T: Debug>(x: T) {} //~ ERROR expected trait, found derive macro diff --git a/src/test/ui/suggestions/use-placement-resolve.rs b/src/test/ui/suggestions/use-placement-resolve.rs new file mode 100644 index 00000000000..b30ddb3af07 --- /dev/null +++ b/src/test/ui/suggestions/use-placement-resolve.rs @@ -0,0 +1,11 @@ +// compile-flags: --test +// run-rustfix +// Checks that the `use` suggestion appears *below* this inner attribute. +// There was an issue where the test synthetic #[allow(dead)] attribute on +// main which has a dummy span caused the suggestion to be placed at the top +// of the file. +#![allow(unused)] + +fn main() {} + +fn foobar<T: Debug>(x: T) {} //~ ERROR expected trait, found derive macro diff --git a/src/test/ui/suggestions/use-placement-resolve.stderr b/src/test/ui/suggestions/use-placement-resolve.stderr new file mode 100644 index 00000000000..9da9e8e2702 --- /dev/null +++ b/src/test/ui/suggestions/use-placement-resolve.stderr @@ -0,0 +1,14 @@ +error[E0404]: expected trait, found derive macro `Debug` + --> $DIR/use-placement-resolve.rs:11:14 + | +LL | fn foobar<T: Debug>(x: T) {} + | ^^^^^ not a trait + | +help: consider importing this trait instead + | +LL | use std::fmt::Debug; + | + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0404`. diff --git a/src/test/ui/suggestions/use-placement-typeck.fixed b/src/test/ui/suggestions/use-placement-typeck.fixed new file mode 100644 index 00000000000..40c55d1dd06 --- /dev/null +++ b/src/test/ui/suggestions/use-placement-typeck.fixed @@ -0,0 +1,22 @@ +// compile-flags: --test +// run-rustfix +// Checks that the `use` suggestion appears *below* this inner attribute. +// There was an issue where the test synthetic #[allow(dead)] attribute on +// main which has a dummy span caused the suggestion to be placed at the top +// of the file. +#![allow(unused)] + +use m::Foo; + +fn main() { + let s = m::S; + s.abc(); //~ ERROR no method named `abc` +} + +mod m { + pub trait Foo { + fn abc(&self) {} + } + pub struct S; + impl Foo for S{} +} diff --git a/src/test/ui/suggestions/use-placement-typeck.rs b/src/test/ui/suggestions/use-placement-typeck.rs new file mode 100644 index 00000000000..aab20d2e90a --- /dev/null +++ b/src/test/ui/suggestions/use-placement-typeck.rs @@ -0,0 +1,20 @@ +// compile-flags: --test +// run-rustfix +// Checks that the `use` suggestion appears *below* this inner attribute. +// There was an issue where the test synthetic #[allow(dead)] attribute on +// main which has a dummy span caused the suggestion to be placed at the top +// of the file. +#![allow(unused)] + +fn main() { + let s = m::S; + s.abc(); //~ ERROR no method named `abc` +} + +mod m { + pub trait Foo { + fn abc(&self) {} + } + pub struct S; + impl Foo for S{} +} diff --git a/src/test/ui/suggestions/use-placement-typeck.stderr b/src/test/ui/suggestions/use-placement-typeck.stderr new file mode 100644 index 00000000000..21f22dade2c --- /dev/null +++ b/src/test/ui/suggestions/use-placement-typeck.stderr @@ -0,0 +1,21 @@ +error[E0599]: no method named `abc` found for struct `S` in the current scope + --> $DIR/use-placement-typeck.rs:11:7 + | +LL | s.abc(); + | ^^^ method not found in `S` +... +LL | fn abc(&self) {} + | --- the method is available for `S` here +LL | } +LL | pub struct S; + | ------------- method `abc` not found for this + | + = help: items from traits can only be used if the trait is in scope +help: the following trait is implemented but not in scope; perhaps add a `use` for it: + | +LL | use m::Foo; + | + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0599`. diff --git a/src/test/ui/thir-unsafeck-issue-85871.rs b/src/test/ui/thir-unsafeck-issue-85871.rs new file mode 100644 index 00000000000..aea539b74df --- /dev/null +++ b/src/test/ui/thir-unsafeck-issue-85871.rs @@ -0,0 +1,20 @@ +// Tests that no ICE occurs when a closure appears inside a node +// that does not have a body when compiling with +// compile-flags: -Zthir-unsafeck=yes +// check-pass + +#![allow(dead_code)] + +struct Bug { + inner: [(); match || 1 { + _n => 42, // we may not call the closure here (E0015) + }], +} + +enum E { + V([(); { let _ = || 1; 42 }]), +} + +type Ty = [(); { let _ = || 1; 42 }]; + +fn main() {} diff --git a/src/test/ui/thread-local-static.rs b/src/test/ui/thread-local-static.rs index dc542fe2db9..c7fee9e6b4c 100644 --- a/src/test/ui/thread-local-static.rs +++ b/src/test/ui/thread-local-static.rs @@ -11,7 +11,6 @@ const fn g(x: &mut [u32; 8]) { //~| ERROR mutable references are not allowed //~| ERROR use of mutable static is unsafe //~| constant functions cannot refer to statics - //~| ERROR calls in constant functions are limited to constant functions } fn main() {} diff --git a/src/test/ui/thread-local-static.stderr b/src/test/ui/thread-local-static.stderr index a213282eb85..08bf593a5a7 100644 --- a/src/test/ui/thread-local-static.stderr +++ b/src/test/ui/thread-local-static.stderr @@ -30,12 +30,6 @@ LL | std::mem::swap(x, &mut STATIC_VAR_2) = note: see issue #57349 <https://github.com/rust-lang/rust/issues/57349> for more information = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable -error[E0015]: calls in constant functions are limited to constant functions, tuple structs and tuple variants - --> $DIR/thread-local-static.rs:9:5 - | -LL | std::mem::swap(x, &mut STATIC_VAR_2) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - error[E0133]: use of mutable static is unsafe and requires unsafe function or block --> $DIR/thread-local-static.rs:9:23 | @@ -44,7 +38,7 @@ LL | std::mem::swap(x, &mut STATIC_VAR_2) | = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior -error: aborting due to 6 previous errors +error: aborting due to 5 previous errors -Some errors have detailed explanations: E0013, E0015, E0133, E0658. +Some errors have detailed explanations: E0013, E0133, E0658. For more information about an error, try `rustc --explain E0013`. diff --git a/src/test/ui/thread-local/thread-local-issue-37508.rs b/src/test/ui/thread-local/thread-local-issue-37508.rs new file mode 100644 index 00000000000..219108c77f7 --- /dev/null +++ b/src/test/ui/thread-local/thread-local-issue-37508.rs @@ -0,0 +1,36 @@ +// only-x86_64 +// compile-flags: -Ccode-model=large --crate-type lib +// build-pass +// +// Regression test for issue #37508 + +#![no_main] +#![no_std] +#![feature(thread_local, lang_items)] + +#[lang = "eh_personality"] +extern "C" fn eh_personality() {} + +use core::panic::PanicInfo; + +#[panic_handler] +fn panic(_panic: &PanicInfo<'_>) -> ! { + loop {} +} + +pub struct BB; + +#[thread_local] +static mut KEY: Key = Key { inner: BB, dtor_running: false }; + +pub unsafe fn set() -> Option<&'static BB> { + if KEY.dtor_running { + return None; + } + Some(&KEY.inner) +} + +pub struct Key { + inner: BB, + dtor_running: bool, +} diff --git a/src/test/ui/traits/bound/not-on-bare-trait.rs b/src/test/ui/traits/bound/not-on-bare-trait.rs index 08355a55630..daf18c6702e 100644 --- a/src/test/ui/traits/bound/not-on-bare-trait.rs +++ b/src/test/ui/traits/bound/not-on-bare-trait.rs @@ -7,7 +7,7 @@ trait Foo { fn foo(_x: Foo + Send) { //~^ ERROR the size for values of type //~| WARN trait objects without an explicit `dyn` are deprecated - //~| WARN this was previously accepted by the compiler + //~| WARN this is accepted in the current edition } fn main() {} diff --git a/src/test/ui/traits/bound/not-on-bare-trait.stderr b/src/test/ui/traits/bound/not-on-bare-trait.stderr index 418e67d56ea..e65b8989e0b 100644 --- a/src/test/ui/traits/bound/not-on-bare-trait.stderr +++ b/src/test/ui/traits/bound/not-on-bare-trait.stderr @@ -5,7 +5,7 @@ LL | fn foo(_x: Foo + Send) { | ^^^^^^^^^^ help: use `dyn`: `dyn Foo + Send` | = note: `#[warn(bare_trait_objects)]` on by default - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2021 edition! + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! = note: for more information, see issue #80165 <https://github.com/rust-lang/rust/issues/80165> error[E0277]: the size for values of type `(dyn Foo + Send + 'static)` cannot be known at compilation time diff --git a/src/test/ui/traits/issue-78632.rs b/src/test/ui/traits/issue-78632.rs new file mode 100644 index 00000000000..c72a2aef490 --- /dev/null +++ b/src/test/ui/traits/issue-78632.rs @@ -0,0 +1,59 @@ +// check-pass +// +// Regression test for issue #78632 + +#![crate_type = "lib"] + +pub trait Corge<T> { + type Fred; +} + +impl Corge<u8> for () { + type Fred = u32; +} + +pub trait Waldo { + type Quax; +} + +impl Waldo for u32 { + type Quax = u8; +} + +pub trait Grault +where + (): Corge<Self::Thud>, +{ + type Thud; + fn bar(_: <() as Corge<Self::Thud>>::Fred) {} +} + +impl<T> Grault for T +where + T: Waldo, + (): Corge<T::Quax>, + <() as Corge<T::Quax>>::Fred: Waldo, +{ + type Thud = u8; +} + +pub trait Plugh<I> { + fn baz(); +} + +#[derive(Copy, Clone, Debug)] +pub struct Qiz<T> { + foo: T, +} + +impl<T> Plugh<<() as Corge<T::Thud>>::Fred> for Qiz<T> +where + T: Grault, + (): Corge<T::Thud>, +{ + fn baz() {} +} + +pub fn test() { + <Qiz<u32> as Plugh<u32>>::baz(); +} diff --git a/src/test/ui/traits/operator-overloading-issue-52025.rs b/src/test/ui/traits/operator-overloading-issue-52025.rs new file mode 100644 index 00000000000..7ce638832b0 --- /dev/null +++ b/src/test/ui/traits/operator-overloading-issue-52025.rs @@ -0,0 +1,57 @@ +// only-x86_64 +// build-pass + +use std::arch::x86_64::*; +use std::fmt::Debug; +use std::ops::*; + +pub trait Simd { + type Vf32: Copy + Debug + Add<Self::Vf32, Output = Self::Vf32> + Add<f32, Output = Self::Vf32>; + + unsafe fn set1_ps(a: f32) -> Self::Vf32; + unsafe fn add_ps(a: Self::Vf32, b: Self::Vf32) -> Self::Vf32; +} + +#[derive(Copy, Debug, Clone)] +pub struct F32x4(pub __m128); + +impl Add<F32x4> for F32x4 { + type Output = F32x4; + + fn add(self, rhs: F32x4) -> F32x4 { + F32x4(unsafe { _mm_add_ps(self.0, rhs.0) }) + } +} + +impl Add<f32> for F32x4 { + type Output = F32x4; + fn add(self, rhs: f32) -> F32x4 { + F32x4(unsafe { _mm_add_ps(self.0, _mm_set1_ps(rhs)) }) + } +} + +pub struct Sse2; +impl Simd for Sse2 { + type Vf32 = F32x4; + + #[inline(always)] + unsafe fn set1_ps(a: f32) -> Self::Vf32 { + F32x4(_mm_set1_ps(a)) + } + + #[inline(always)] + unsafe fn add_ps(a: Self::Vf32, b: Self::Vf32) -> Self::Vf32 { + F32x4(_mm_add_ps(a.0, b.0)) + } +} + +unsafe fn test<S: Simd>() -> S::Vf32 { + let a = S::set1_ps(3.0); + let b = S::set1_ps(2.0); + let result = a + b; + result +} + +fn main() { + println!("{:?}", unsafe { test::<Sse2>() }); +} diff --git a/src/test/ui/traits/reservation-impl/non-lattice-ok.rs b/src/test/ui/traits/reservation-impl/non-lattice-ok.rs index f14589ccf84..b894577c1f7 100644 --- a/src/test/ui/traits/reservation-impl/non-lattice-ok.rs +++ b/src/test/ui/traits/reservation-impl/non-lattice-ok.rs @@ -28,7 +28,7 @@ // go with a known approach, we should go with a "marker trait overlap"-style // approach. // -// [ii]: http://smallcultfollowing.com/babysteps/blog/2016/09/24/intersection-impls/ +// [ii]: https://smallcultfollowing.com/babysteps/blog/2016/09/24/intersection-impls/ #![feature(rustc_attrs, never_type)] diff --git a/src/test/ui/type-alias-impl-trait/associated-type-lifetime-ice.rs b/src/test/ui/type-alias-impl-trait/associated-type-lifetime-ice.rs deleted file mode 100644 index 967d4c3f0f7..00000000000 --- a/src/test/ui/type-alias-impl-trait/associated-type-lifetime-ice.rs +++ /dev/null @@ -1,33 +0,0 @@ -// failure-status: 101 -// rustc-env:RUST_BACKTRACE=0 -// normalize-stderr-test "note: .*\n\n" -> "" -// normalize-stderr-test "thread 'rustc' panicked.*\n" -> "" - -// compile-flags: --crate-type=rlib - -// Regression test for https://github.com/rust-lang/rust/issues/78450 - -#![feature(min_type_alias_impl_trait)] -#![no_std] - -pub trait AssociatedImpl { - type ImplTrait; - - fn f() -> Self::ImplTrait; -} - -struct S<T>(T); - -trait Associated { - type A; -} - -// ICE -impl<'a, T: Associated<A = &'a ()>> AssociatedImpl for S<T> { - type ImplTrait = impl core::fmt::Debug; - - fn f() -> Self::ImplTrait { - //~^ ERROR unexpected concrete region in borrowck: ReEarlyBound(0, 'a) - () - } -} diff --git a/src/test/ui/type-alias-impl-trait/associated-type-lifetime-ice.stderr b/src/test/ui/type-alias-impl-trait/associated-type-lifetime-ice.stderr deleted file mode 100644 index 64ab7b70b1a..00000000000 --- a/src/test/ui/type-alias-impl-trait/associated-type-lifetime-ice.stderr +++ /dev/null @@ -1,13 +0,0 @@ -error: internal compiler error: unexpected concrete region in borrowck: ReEarlyBound(0, 'a) - --> $DIR/associated-type-lifetime-ice.rs:29:5 - | -LL | / fn f() -> Self::ImplTrait { -LL | | -LL | | () -LL | | } - | |_____^ - | - = error: internal compiler error: unexpected panic - -query stack during panic: -end of query stack diff --git a/src/test/ui/type-alias-impl-trait/issue-78450.rs b/src/test/ui/type-alias-impl-trait/issue-78450.rs new file mode 100644 index 00000000000..640f929f8f1 --- /dev/null +++ b/src/test/ui/type-alias-impl-trait/issue-78450.rs @@ -0,0 +1,27 @@ +// check-pass + +#![feature(min_type_alias_impl_trait)] +#![feature(type_alias_impl_trait)] +//~^ WARNING: the feature `type_alias_impl_trait` is incomplete + +pub trait AssociatedImpl { + type ImplTrait; + + fn f() -> Self::ImplTrait; +} + +struct S<T>(T); + +trait Associated { + type A; +} + +impl<'a, T: Associated<A = &'a ()>> AssociatedImpl for S<T> { + type ImplTrait = impl core::fmt::Debug; + + fn f() -> Self::ImplTrait { + () + } +} + +fn main() {} diff --git a/src/test/ui/type-alias-impl-trait/issue-78450.stderr b/src/test/ui/type-alias-impl-trait/issue-78450.stderr new file mode 100644 index 00000000000..efccf6241fb --- /dev/null +++ b/src/test/ui/type-alias-impl-trait/issue-78450.stderr @@ -0,0 +1,11 @@ +warning: the feature `type_alias_impl_trait` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/issue-78450.rs:4:12 + | +LL | #![feature(type_alias_impl_trait)] + | ^^^^^^^^^^^^^^^^^^^^^ + | + = note: `#[warn(incomplete_features)]` on by default + = note: see issue #63063 <https://github.com/rust-lang/rust/issues/63063> for more information + +warning: 1 warning emitted + diff --git a/src/test/ui/type-alias-impl-trait/issue-85113.rs b/src/test/ui/type-alias-impl-trait/issue-85113.rs new file mode 100644 index 00000000000..b09833f3ed0 --- /dev/null +++ b/src/test/ui/type-alias-impl-trait/issue-85113.rs @@ -0,0 +1,22 @@ +#![feature(min_type_alias_impl_trait)] +#![feature(impl_trait_in_bindings)] +#![allow(incomplete_features)] + +type OpaqueOutputImpl<'a> = impl Output<'a> + 'a; +//~^ ERROR: hidden type for `impl Trait` captures lifetime that does not appear in bounds +//~| ERROR: the type `&'<empty> str` does not fulfill the required lifetime +//~| ERROR: cannot infer an appropriate lifetime for lifetime parameter `'a` due to conflicting requirements + +trait Output<'a> {} + +impl<'a> Output<'a> for &'a str {} + +fn cool_fn<'a>(arg: &'a str) -> OpaqueOutputImpl<'a> { + let out: OpaqueOutputImpl<'a> = arg; + arg +} + +fn main() { + let s = String::from("wassup"); + cool_fn(&s); +} diff --git a/src/test/ui/type-alias-impl-trait/issue-85113.stderr b/src/test/ui/type-alias-impl-trait/issue-85113.stderr new file mode 100644 index 00000000000..361d66866ef --- /dev/null +++ b/src/test/ui/type-alias-impl-trait/issue-85113.stderr @@ -0,0 +1,48 @@ +error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds + --> $DIR/issue-85113.rs:5:29 + | +LL | type OpaqueOutputImpl<'a> = impl Output<'a> + 'a; + | ^^^^^^^^^^^^^^^^^^^^ + | +note: hidden type `&'<empty> str` captures lifetime smaller than the function body + --> $DIR/issue-85113.rs:5:29 + | +LL | type OpaqueOutputImpl<'a> = impl Output<'a> + 'a; + | ^^^^^^^^^^^^^^^^^^^^ + +error[E0477]: the type `&'<empty> str` does not fulfill the required lifetime + --> $DIR/issue-85113.rs:5:29 + | +LL | type OpaqueOutputImpl<'a> = impl Output<'a> + 'a; + | ^^^^^^^^^^^^^^^^^^^^ + | +note: type must outlive the lifetime `'a` as defined on the item at 5:23 + --> $DIR/issue-85113.rs:5:23 + | +LL | type OpaqueOutputImpl<'a> = impl Output<'a> + 'a; + | ^^ + +error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'a` due to conflicting requirements + --> $DIR/issue-85113.rs:5:29 + | +LL | type OpaqueOutputImpl<'a> = impl Output<'a> + 'a; + | ^^^^^^^^^^^^^^^^^^^^ + | + = note: first, the lifetime cannot outlive the empty lifetime... +note: ...but the lifetime must also be valid for the lifetime `'a` as defined on the item at 5:23... + --> $DIR/issue-85113.rs:5:23 + | +LL | type OpaqueOutputImpl<'a> = impl Output<'a> + 'a; + | ^^ +note: ...so that the types are compatible + --> $DIR/issue-85113.rs:5:29 + | +LL | type OpaqueOutputImpl<'a> = impl Output<'a> + 'a; + | ^^^^^^^^^^^^^^^^^^^^ + = note: expected `Output<'a>` + found `Output<'_>` + +error: aborting due to 3 previous errors + +Some errors have detailed explanations: E0477, E0495, E0700. +For more information about an error, try `rustc --explain E0477`. diff --git a/src/test/ui/issues/issue-74086.rs b/src/test/ui/typeck/issue-74086.rs index f68a665b2f3..1de9cd8007c 100644 --- a/src/test/ui/issues/issue-74086.rs +++ b/src/test/ui/typeck/issue-74086.rs @@ -1,4 +1,4 @@ fn main() { static BUG: fn(_) -> u8 = |_| 8; - //~^ ERROR the type placeholder `_` is not allowed within types on item signatures [E0121] + //~^ ERROR the type placeholder `_` is not allowed within types on item signatures for functions [E0121] } diff --git a/src/test/ui/issues/issue-74086.stderr b/src/test/ui/typeck/issue-74086.stderr index e602425059e..ac1752e17df 100644 --- a/src/test/ui/issues/issue-74086.stderr +++ b/src/test/ui/typeck/issue-74086.stderr @@ -1,4 +1,4 @@ -error[E0121]: the type placeholder `_` is not allowed within types on item signatures +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for functions --> $DIR/issue-74086.rs:2:20 | LL | static BUG: fn(_) -> u8 = |_| 8; diff --git a/src/test/ui/typeck/issue-75883.rs b/src/test/ui/typeck/issue-75883.rs index 8cd34f48835..0d1534df091 100644 --- a/src/test/ui/typeck/issue-75883.rs +++ b/src/test/ui/typeck/issue-75883.rs @@ -5,7 +5,7 @@ pub struct UI {} impl UI { pub fn run() -> Result<_> { //~^ ERROR: this enum takes 2 generic arguments but 1 generic argument was supplied - //~| ERROR: the type placeholder `_` is not allowed within types on item signatures + //~| ERROR: the type placeholder `_` is not allowed within types on item signatures for return types let mut ui = UI {}; ui.interact(); @@ -14,7 +14,7 @@ impl UI { pub fn interact(&mut self) -> Result<_> { //~^ ERROR: this enum takes 2 generic arguments but 1 generic argument was supplied - //~| ERROR: the type placeholder `_` is not allowed within types on item signatures + //~| ERROR: the type placeholder `_` is not allowed within types on item signatures for return types unimplemented!(); } } diff --git a/src/test/ui/typeck/issue-75883.stderr b/src/test/ui/typeck/issue-75883.stderr index 71f4138c81d..a722c4b5e3e 100644 --- a/src/test/ui/typeck/issue-75883.stderr +++ b/src/test/ui/typeck/issue-75883.stderr @@ -34,13 +34,13 @@ help: add missing generic argument LL | pub fn interact(&mut self) -> Result<_, E> { | ^^^ -error[E0121]: the type placeholder `_` is not allowed within types on item signatures +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for return types --> $DIR/issue-75883.rs:15:42 | LL | pub fn interact(&mut self) -> Result<_> { | ^ not allowed in type signatures -error[E0121]: the type placeholder `_` is not allowed within types on item signatures +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for return types --> $DIR/issue-75883.rs:6:28 | LL | pub fn run() -> Result<_> { diff --git a/src/test/ui/typeck/issue-75889.rs b/src/test/ui/typeck/issue-75889.rs new file mode 100644 index 00000000000..84c067ed0c7 --- /dev/null +++ b/src/test/ui/typeck/issue-75889.rs @@ -0,0 +1,6 @@ +// Regression test for #75889. + +const FOO: dyn Fn() -> _ = ""; //~ ERROR E0121 +static BOO: dyn Fn() -> _ = ""; //~ ERROR E0121 + +fn main() {} diff --git a/src/test/ui/typeck/issue-75889.stderr b/src/test/ui/typeck/issue-75889.stderr new file mode 100644 index 00000000000..de4bdf4e6d9 --- /dev/null +++ b/src/test/ui/typeck/issue-75889.stderr @@ -0,0 +1,15 @@ +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for constant items + --> $DIR/issue-75889.rs:3:24 + | +LL | const FOO: dyn Fn() -> _ = ""; + | ^ not allowed in type signatures + +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for static items + --> $DIR/issue-75889.rs:4:25 + | +LL | static BOO: dyn Fn() -> _ = ""; + | ^ not allowed in type signatures + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0121`. diff --git a/src/test/ui/typeck/issue-80779.rs b/src/test/ui/typeck/issue-80779.rs index 6791976196f..99a93b1863d 100644 --- a/src/test/ui/typeck/issue-80779.rs +++ b/src/test/ui/typeck/issue-80779.rs @@ -3,11 +3,11 @@ pub struct T<'a>(&'a str); pub fn f<'a>(val: T<'a>) -> _ { - //~^ ERROR: the type placeholder `_` is not allowed within types on item signatures + //~^ ERROR: the type placeholder `_` is not allowed within types on item signatures for return types g(val) } pub fn g(_: T<'static>) -> _ {} -//~^ ERROR: the type placeholder `_` is not allowed within types on item signatures +//~^ ERROR: the type placeholder `_` is not allowed within types on item signatures for return types fn main() {} diff --git a/src/test/ui/typeck/issue-80779.stderr b/src/test/ui/typeck/issue-80779.stderr index aca494520f8..5a695fecc29 100644 --- a/src/test/ui/typeck/issue-80779.stderr +++ b/src/test/ui/typeck/issue-80779.stderr @@ -1,4 +1,4 @@ -error[E0121]: the type placeholder `_` is not allowed within types on item signatures +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for return types --> $DIR/issue-80779.rs:10:28 | LL | pub fn g(_: T<'static>) -> _ {} @@ -7,7 +7,7 @@ LL | pub fn g(_: T<'static>) -> _ {} | not allowed in type signatures | help: replace with the correct return type: `()` -error[E0121]: the type placeholder `_` is not allowed within types on item signatures +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for return types --> $DIR/issue-80779.rs:5:29 | LL | pub fn f<'a>(val: T<'a>) -> _ { diff --git a/src/test/ui/issues/issue-81885.rs b/src/test/ui/typeck/issue-81885.rs index 86c39d4a48c..5117f250fe5 100644 --- a/src/test/ui/issues/issue-81885.rs +++ b/src/test/ui/typeck/issue-81885.rs @@ -1,10 +1,8 @@ const TEST4: fn() -> _ = 42; - //~^ ERROR the type placeholder `_` is not allowed within types on item - //signatures + //~^ ERROR the type placeholder `_` is not allowed within types on item signatures for functions fn main() { const TEST5: fn() -> _ = 42; - //~^ ERROR the type placeholder `_` is not allowed within types on item - //signatures + //~^ ERROR the type placeholder `_` is not allowed within types on item signatures for functions } diff --git a/src/test/ui/issues/issue-81885.stderr b/src/test/ui/typeck/issue-81885.stderr index 955b4283874..8206156a618 100644 --- a/src/test/ui/issues/issue-81885.stderr +++ b/src/test/ui/typeck/issue-81885.stderr @@ -1,11 +1,11 @@ -error[E0121]: the type placeholder `_` is not allowed within types on item signatures +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for functions --> $DIR/issue-81885.rs:1:22 | LL | const TEST4: fn() -> _ = 42; | ^ not allowed in type signatures -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/issue-81885.rs:6:26 +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for functions + --> $DIR/issue-81885.rs:5:26 | LL | const TEST5: fn() -> _ = 42; | ^ not allowed in type signatures diff --git a/src/test/ui/typeck/issue-83621-placeholder-static-in-extern.stderr b/src/test/ui/typeck/issue-83621-placeholder-static-in-extern.stderr index b1bec4c0827..7c5cf1082be 100644 --- a/src/test/ui/typeck/issue-83621-placeholder-static-in-extern.stderr +++ b/src/test/ui/typeck/issue-83621-placeholder-static-in-extern.stderr @@ -1,4 +1,4 @@ -error[E0121]: the type placeholder `_` is not allowed within types on item signatures +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for static variables --> $DIR/issue-83621-placeholder-static-in-extern.rs:4:15 | LL | static x: _; diff --git a/src/test/ui/typeck/struct-enum-wrong-args.rs b/src/test/ui/typeck/struct-enum-wrong-args.rs new file mode 100644 index 00000000000..19de4d67729 --- /dev/null +++ b/src/test/ui/typeck/struct-enum-wrong-args.rs @@ -0,0 +1,14 @@ +// Regression test of #86481. +struct Wrapper(i32); +struct DoubleWrapper(i32, i32); + +fn main() { + let _ = Some(3, 2); //~ ERROR this enum variant takes + let _ = Ok(3, 6, 2); //~ ERROR this enum variant takes + let _ = Ok(); //~ ERROR this enum variant takes + let _ = Wrapper(); //~ ERROR this struct takes + let _ = Wrapper(5, 2); //~ ERROR this struct takes + let _ = DoubleWrapper(); //~ ERROR this struct takes + let _ = DoubleWrapper(5); //~ ERROR this struct takes + let _ = DoubleWrapper(5, 2, 7); //~ ERROR this struct takes +} diff --git a/src/test/ui/typeck/struct-enum-wrong-args.stderr b/src/test/ui/typeck/struct-enum-wrong-args.stderr new file mode 100644 index 00000000000..d77ef73028b --- /dev/null +++ b/src/test/ui/typeck/struct-enum-wrong-args.stderr @@ -0,0 +1,67 @@ +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); + | ^^^^ - - supplied 2 arguments + | | + | expected 1 argument + +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); + | ^^ - - - supplied 3 arguments + | | + | expected 1 argument + +error[E0061]: this enum variant takes 1 argument but 0 arguments were supplied + --> $DIR/struct-enum-wrong-args.rs:8:13 + | +LL | let _ = Ok(); + | ^^-- supplied 0 arguments + | | + | expected 1 argument + +error[E0061]: this struct takes 1 argument but 0 arguments were supplied + --> $DIR/struct-enum-wrong-args.rs:9:13 + | +LL | let _ = Wrapper(); + | ^^^^^^^-- supplied 0 arguments + | | + | expected 1 argument + +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); + | ^^^^^^^ - - supplied 2 arguments + | | + | expected 1 argument + +error[E0061]: this struct takes 2 arguments but 0 arguments were supplied + --> $DIR/struct-enum-wrong-args.rs:11:13 + | +LL | let _ = DoubleWrapper(); + | ^^^^^^^^^^^^^-- supplied 0 arguments + | | + | expected 2 arguments + +error[E0061]: this struct takes 2 arguments but 1 argument was supplied + --> $DIR/struct-enum-wrong-args.rs:12:13 + | +LL | let _ = DoubleWrapper(5); + | ^^^^^^^^^^^^^ - supplied 1 argument + | | + | expected 2 arguments + +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); + | ^^^^^^^^^^^^^ - - - supplied 3 arguments + | | + | expected 2 arguments + +error: aborting due to 8 previous errors + +For more information about this error, try `rustc --explain E0061`. diff --git a/src/test/ui/typeck/type-placeholder-fn-in-const.rs b/src/test/ui/typeck/type-placeholder-fn-in-const.rs new file mode 100644 index 00000000000..f657bea1648 --- /dev/null +++ b/src/test/ui/typeck/type-placeholder-fn-in-const.rs @@ -0,0 +1,14 @@ +struct MyStruct; + +trait Test { + const TEST: fn() -> _; + //~^ ERROR: the type placeholder `_` is not allowed within types on item signatures for functions [E0121] + //~| ERROR: the type placeholder `_` is not allowed within types on item signatures for constants [E0121] +} + +impl Test for MyStruct { + const TEST: fn() -> _ = 42; + //~^ ERROR: the type placeholder `_` is not allowed within types on item signatures for functions [E0121] +} + +fn main() {} diff --git a/src/test/ui/typeck/type-placeholder-fn-in-const.stderr b/src/test/ui/typeck/type-placeholder-fn-in-const.stderr new file mode 100644 index 00000000000..62f4db8638f --- /dev/null +++ b/src/test/ui/typeck/type-placeholder-fn-in-const.stderr @@ -0,0 +1,21 @@ +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for functions + --> $DIR/type-placeholder-fn-in-const.rs:4:25 + | +LL | const TEST: fn() -> _; + | ^ not allowed in type signatures + +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for constants + --> $DIR/type-placeholder-fn-in-const.rs:4:25 + | +LL | const TEST: fn() -> _; + | ^ not allowed in type signatures + +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for functions + --> $DIR/type-placeholder-fn-in-const.rs:10:25 + | +LL | const TEST: fn() -> _ = 42; + | ^ not allowed in type signatures + +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0121`. diff --git a/src/test/ui/typeck-closure-to-unsafe-fn-ptr.rs b/src/test/ui/typeck/typeck-closure-to-unsafe-fn-ptr.rs index 2530a1e966d..2530a1e966d 100644 --- a/src/test/ui/typeck-closure-to-unsafe-fn-ptr.rs +++ b/src/test/ui/typeck/typeck-closure-to-unsafe-fn-ptr.rs diff --git a/src/test/ui/typeck-fn-to-unsafe-fn-ptr.rs b/src/test/ui/typeck/typeck-fn-to-unsafe-fn-ptr.rs index 1e954f56909..1e954f56909 100644 --- a/src/test/ui/typeck-fn-to-unsafe-fn-ptr.rs +++ b/src/test/ui/typeck/typeck-fn-to-unsafe-fn-ptr.rs diff --git a/src/test/ui/typeck_type_placeholder_1.rs b/src/test/ui/typeck/typeck_type_placeholder_1.rs index ea7aa5285b0..ea7aa5285b0 100644 --- a/src/test/ui/typeck_type_placeholder_1.rs +++ b/src/test/ui/typeck/typeck_type_placeholder_1.rs diff --git a/src/test/ui/typeck/typeck_type_placeholder_item.full_tait.stderr b/src/test/ui/typeck/typeck_type_placeholder_item.full_tait.stderr index bd7cbd444d7..b6aea9586b8 100644 --- a/src/test/ui/typeck/typeck_type_placeholder_item.full_tait.stderr +++ b/src/test/ui/typeck/typeck_type_placeholder_item.full_tait.stderr @@ -1,35 +1,35 @@ error: expected identifier, found reserved identifier `_` - --> $DIR/typeck_type_placeholder_item.rs:158:18 + --> $DIR/typeck_type_placeholder_item.rs:157:18 | LL | struct BadStruct<_>(_); | ^ expected identifier, found reserved identifier error: expected identifier, found reserved identifier `_` - --> $DIR/typeck_type_placeholder_item.rs:161:16 + --> $DIR/typeck_type_placeholder_item.rs:160:16 | LL | trait BadTrait<_> {} | ^ expected identifier, found reserved identifier error: expected identifier, found reserved identifier `_` - --> $DIR/typeck_type_placeholder_item.rs:171:19 + --> $DIR/typeck_type_placeholder_item.rs:170:19 | LL | struct BadStruct1<_, _>(_); | ^ expected identifier, found reserved identifier error: expected identifier, found reserved identifier `_` - --> $DIR/typeck_type_placeholder_item.rs:171:22 + --> $DIR/typeck_type_placeholder_item.rs:170:22 | LL | struct BadStruct1<_, _>(_); | ^ expected identifier, found reserved identifier error: expected identifier, found reserved identifier `_` - --> $DIR/typeck_type_placeholder_item.rs:176:19 + --> $DIR/typeck_type_placeholder_item.rs:175:19 | LL | struct BadStruct2<_, T>(_, T); | ^ expected identifier, found reserved identifier error: associated constant in `impl` without body - --> $DIR/typeck_type_placeholder_item.rs:209:5 + --> $DIR/typeck_type_placeholder_item.rs:208:5 | LL | const C: _; | ^^^^^^^^^^- @@ -37,7 +37,7 @@ LL | const C: _; | help: provide a definition for the constant: `= <expr>;` error[E0403]: the name `_` is already used for a generic parameter in this item's generic parameters - --> $DIR/typeck_type_placeholder_item.rs:171:22 + --> $DIR/typeck_type_placeholder_item.rs:170:22 | LL | struct BadStruct1<_, _>(_); | - ^ already used @@ -53,7 +53,7 @@ LL | #![cfg_attr(full_tait, feature(type_alias_impl_trait))] = note: `#[warn(incomplete_features)]` on by default = note: see issue #63063 <https://github.com/rust-lang/rust/issues/63063> for more information -error[E0121]: the type placeholder `_` is not allowed within types on item signatures +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for return types --> $DIR/typeck_type_placeholder_item.rs:10:14 | LL | fn test() -> _ { 5 } @@ -62,7 +62,7 @@ LL | fn test() -> _ { 5 } | not allowed in type signatures | help: replace with the correct return type: `i32` -error[E0121]: the type placeholder `_` is not allowed within types on item signatures +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for return types --> $DIR/typeck_type_placeholder_item.rs:13:16 | LL | fn test2() -> (_, _) { (5, 5) } @@ -72,7 +72,7 @@ LL | fn test2() -> (_, _) { (5, 5) } | |not allowed in type signatures | help: replace with the correct return type: `(i32, i32)` -error[E0121]: the type placeholder `_` is not allowed within types on item signatures +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for static variables --> $DIR/typeck_type_placeholder_item.rs:16:15 | LL | static TEST3: _ = "test"; @@ -81,7 +81,7 @@ LL | static TEST3: _ = "test"; | not allowed in type signatures | help: replace with the correct type: `&str` -error[E0121]: the type placeholder `_` is not allowed within types on item signatures +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for static variables --> $DIR/typeck_type_placeholder_item.rs:19:15 | LL | static TEST4: _ = 145; @@ -90,13 +90,13 @@ LL | static TEST4: _ = 145; | not allowed in type signatures | help: replace with the correct type: `i32` -error[E0121]: the type placeholder `_` is not allowed within types on item signatures +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for static variables --> $DIR/typeck_type_placeholder_item.rs:22:15 | LL | static TEST5: (_, _) = (1, 2); | ^^^^^^ not allowed in type signatures -error[E0121]: the type placeholder `_` is not allowed within types on item signatures +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for functions --> $DIR/typeck_type_placeholder_item.rs:25:13 | LL | fn test6(_: _) { } @@ -107,7 +107,7 @@ help: use type parameters instead LL | fn test6<T>(_: T) { } | ^^^ ^ -error[E0121]: the type placeholder `_` is not allowed within types on item signatures +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for functions --> $DIR/typeck_type_placeholder_item.rs:28:18 | LL | fn test6_b<T>(_: _, _: T) { } @@ -118,7 +118,7 @@ help: use type parameters instead LL | fn test6_b<T, U>(_: U, _: T) { } | ^^^ ^ -error[E0121]: the type placeholder `_` is not allowed within types on item signatures +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for functions --> $DIR/typeck_type_placeholder_item.rs:31:30 | LL | fn test6_c<T, K, L, A, B>(_: _, _: (T, K, L, A, B)) { } @@ -129,7 +129,7 @@ help: use type parameters instead LL | fn test6_c<T, K, L, A, B, U>(_: U, _: (T, K, L, A, B)) { } | ^^^ ^ -error[E0121]: the type placeholder `_` is not allowed within types on item signatures +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for functions --> $DIR/typeck_type_placeholder_item.rs:34:13 | LL | fn test7(x: _) { let _x: usize = x; } @@ -140,7 +140,7 @@ help: use type parameters instead LL | fn test7<T>(x: T) { let _x: usize = x; } | ^^^ ^ -error[E0121]: the type placeholder `_` is not allowed within types on item signatures +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for functions --> $DIR/typeck_type_placeholder_item.rs:37:22 | LL | fn test8(_f: fn() -> _) { } @@ -149,7 +149,7 @@ LL | fn test8(_f: fn() -> _) { } | not allowed in type signatures | help: use type parameters instead: `T` -error[E0121]: the type placeholder `_` is not allowed within types on item signatures +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for functions --> $DIR/typeck_type_placeholder_item.rs:37:22 | LL | fn test8(_f: fn() -> _) { } @@ -160,7 +160,7 @@ help: use type parameters instead LL | fn test8<T>(_f: fn() -> T) { } | ^^^ ^ -error[E0121]: the type placeholder `_` is not allowed within types on item signatures +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for return types --> $DIR/typeck_type_placeholder_item.rs:51:26 | LL | fn test11(x: &usize) -> &_ { @@ -169,7 +169,7 @@ LL | fn test11(x: &usize) -> &_ { | |not allowed in type signatures | help: replace with the correct return type: `&'static &'static usize` -error[E0121]: the type placeholder `_` is not allowed within types on item signatures +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for return types --> $DIR/typeck_type_placeholder_item.rs:56:52 | LL | unsafe fn test12(x: *const usize) -> *const *const _ { @@ -178,7 +178,7 @@ LL | unsafe fn test12(x: *const usize) -> *const *const _ { | | not allowed in type signatures | help: replace with the correct return type: `*const *const usize` -error[E0121]: the type placeholder `_` is not allowed within types on item signatures +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for structs --> $DIR/typeck_type_placeholder_item.rs:70:8 | LL | a: _, @@ -201,9 +201,9 @@ error: missing type for `static` item --> $DIR/typeck_type_placeholder_item.rs:76:12 | LL | static A = 42; - | ^ help: provide a type for the item: `A: i32` + | ^ help: provide a type for the static variable: `A: i32` -error[E0121]: the type placeholder `_` is not allowed within types on item signatures +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for static variables --> $DIR/typeck_type_placeholder_item.rs:78:15 | LL | static B: _ = 42; @@ -212,14 +212,14 @@ LL | static B: _ = 42; | not allowed in type signatures | help: replace with the correct type: `i32` -error[E0121]: the type placeholder `_` is not allowed within types on item signatures +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for static variables --> $DIR/typeck_type_placeholder_item.rs:80:15 | LL | static C: Option<_> = Some(42); | ^^^^^^^^^ not allowed in type signatures -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:83:21 +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for return types + --> $DIR/typeck_type_placeholder_item.rs:82:21 | LL | fn fn_test() -> _ { 5 } | ^ @@ -227,8 +227,8 @@ LL | fn fn_test() -> _ { 5 } | not allowed in type signatures | help: replace with the correct return type: `i32` -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:86:23 +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for return types + --> $DIR/typeck_type_placeholder_item.rs:85:23 | LL | fn fn_test2() -> (_, _) { (5, 5) } | -^--^- @@ -237,8 +237,8 @@ LL | fn fn_test2() -> (_, _) { (5, 5) } | |not allowed in type signatures | help: replace with the correct return type: `(i32, i32)` -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:89:22 +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for static variables + --> $DIR/typeck_type_placeholder_item.rs:88:22 | LL | static FN_TEST3: _ = "test"; | ^ @@ -246,8 +246,8 @@ LL | static FN_TEST3: _ = "test"; | not allowed in type signatures | help: replace with the correct type: `&str` -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:92:22 +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for static variables + --> $DIR/typeck_type_placeholder_item.rs:91:22 | LL | static FN_TEST4: _ = 145; | ^ @@ -255,14 +255,14 @@ LL | static FN_TEST4: _ = 145; | not allowed in type signatures | help: replace with the correct type: `i32` -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:95:22 +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for static variables + --> $DIR/typeck_type_placeholder_item.rs:94:22 | LL | static FN_TEST5: (_, _) = (1, 2); | ^^^^^^ not allowed in type signatures -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:98:20 +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for functions + --> $DIR/typeck_type_placeholder_item.rs:97:20 | LL | fn fn_test6(_: _) { } | ^ not allowed in type signatures @@ -272,8 +272,8 @@ help: use type parameters instead LL | fn fn_test6<T>(_: T) { } | ^^^ ^ -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:101:20 +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for functions + --> $DIR/typeck_type_placeholder_item.rs:100:20 | LL | fn fn_test7(x: _) { let _x: usize = x; } | ^ not allowed in type signatures @@ -283,8 +283,8 @@ help: use type parameters instead LL | fn fn_test7<T>(x: T) { let _x: usize = x; } | ^^^ ^ -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:104:29 +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for functions + --> $DIR/typeck_type_placeholder_item.rs:103:29 | LL | fn fn_test8(_f: fn() -> _) { } | ^ @@ -292,8 +292,8 @@ LL | fn fn_test8(_f: fn() -> _) { } | not allowed in type signatures | help: use type parameters instead: `T` -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:104:29 +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for functions + --> $DIR/typeck_type_placeholder_item.rs:103:29 | LL | fn fn_test8(_f: fn() -> _) { } | ^ not allowed in type signatures @@ -303,8 +303,8 @@ help: use type parameters instead LL | fn fn_test8<T>(_f: fn() -> T) { } | ^^^ ^ -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:127:12 +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for structs + --> $DIR/typeck_type_placeholder_item.rs:126:12 | LL | a: _, | ^ not allowed in type signatures @@ -323,21 +323,21 @@ LL | b: (T, T), | error[E0282]: type annotations needed - --> $DIR/typeck_type_placeholder_item.rs:132:18 + --> $DIR/typeck_type_placeholder_item.rs:131:18 | LL | fn fn_test11(_: _) -> (_, _) { panic!() } | ^ cannot infer type -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:132:28 +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for return types + --> $DIR/typeck_type_placeholder_item.rs:131:28 | LL | fn fn_test11(_: _) -> (_, _) { panic!() } | ^ ^ not allowed in type signatures | | | not allowed in type signatures -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:136:30 +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for return types + --> $DIR/typeck_type_placeholder_item.rs:135:30 | LL | fn fn_test12(x: i32) -> (_, _) { (x, x) } | -^--^- @@ -346,8 +346,8 @@ LL | fn fn_test12(x: i32) -> (_, _) { (x, x) } | |not allowed in type signatures | help: replace with the correct return type: `(i32, i32)` -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:139:33 +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for return types + --> $DIR/typeck_type_placeholder_item.rs:138:33 | LL | fn fn_test13(x: _) -> (i32, _) { (x, x) } | ------^- @@ -355,8 +355,8 @@ LL | fn fn_test13(x: _) -> (i32, _) { (x, x) } | | not allowed in type signatures | help: replace with the correct return type: `(i32, i32)` -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:158:21 +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for structs + --> $DIR/typeck_type_placeholder_item.rs:157:21 | LL | struct BadStruct<_>(_); | ^ not allowed in type signatures @@ -366,8 +366,8 @@ help: use type parameters instead LL | struct BadStruct<T>(T); | ^ ^ -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:163:15 +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for implementations + --> $DIR/typeck_type_placeholder_item.rs:162:15 | LL | impl BadTrait<_> for BadStruct<_> {} | ^ ^ not allowed in type signatures @@ -379,14 +379,14 @@ help: use type parameters instead LL | impl<T> BadTrait<T> for BadStruct<T> {} | ^^^ ^ ^ -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:166:34 +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for opaque types + --> $DIR/typeck_type_placeholder_item.rs:165:34 | LL | fn impl_trait() -> impl BadTrait<_> { | ^ not allowed in type signatures -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:171:25 +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for structs + --> $DIR/typeck_type_placeholder_item.rs:170:25 | LL | struct BadStruct1<_, _>(_); | ^ not allowed in type signatures @@ -396,8 +396,8 @@ help: use type parameters instead LL | struct BadStruct1<T, _>(T); | ^ ^ -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:176:25 +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for structs + --> $DIR/typeck_type_placeholder_item.rs:175:25 | LL | struct BadStruct2<_, T>(_, T); | ^ not allowed in type signatures @@ -407,20 +407,20 @@ help: use type parameters instead LL | struct BadStruct2<U, T>(U, T); | ^ ^ -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:180:14 +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for type aliases + --> $DIR/typeck_type_placeholder_item.rs:179:14 | LL | type X = Box<_>; | ^ not allowed in type signatures -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:186:21 +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for opaque types + --> $DIR/typeck_type_placeholder_item.rs:185:21 | LL | type Y = impl Trait<_>; | ^ not allowed in type signatures -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:220:31 +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for return types + --> $DIR/typeck_type_placeholder_item.rs:219:31 | LL | fn value() -> Option<&'static _> { | ----------------^- @@ -428,8 +428,8 @@ LL | fn value() -> Option<&'static _> { | | not allowed in type signatures | help: replace with the correct return type: `Option<&'static u8>` -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:225:10 +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for constants + --> $DIR/typeck_type_placeholder_item.rs:224:10 | LL | const _: Option<_> = map(value); | ^^^^^^^^^ @@ -437,8 +437,8 @@ LL | const _: Option<_> = map(value); | not allowed in type signatures | help: replace with the correct type: `Option<u8>` -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:144:31 +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for functions + --> $DIR/typeck_type_placeholder_item.rs:143:31 | LL | fn method_test1(&self, x: _); | ^ not allowed in type signatures @@ -448,8 +448,8 @@ help: use type parameters instead LL | fn method_test1<T>(&self, x: T); | ^^^ ^ -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:146:31 +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for functions + --> $DIR/typeck_type_placeholder_item.rs:145:31 | LL | fn method_test2(&self, x: _) -> _; | ^ ^ not allowed in type signatures @@ -461,8 +461,8 @@ help: use type parameters instead LL | fn method_test2<T>(&self, x: T) -> T; | ^^^ ^ ^ -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:148:31 +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for functions + --> $DIR/typeck_type_placeholder_item.rs:147:31 | LL | fn method_test3(&self) -> _; | ^ not allowed in type signatures @@ -472,8 +472,8 @@ help: use type parameters instead LL | fn method_test3<T>(&self) -> T; | ^^^ ^ -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:150:26 +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for functions + --> $DIR/typeck_type_placeholder_item.rs:149:26 | LL | fn assoc_fn_test1(x: _); | ^ not allowed in type signatures @@ -483,8 +483,8 @@ help: use type parameters instead LL | fn assoc_fn_test1<T>(x: T); | ^^^ ^ -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:152:26 +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for functions + --> $DIR/typeck_type_placeholder_item.rs:151:26 | LL | fn assoc_fn_test2(x: _) -> _; | ^ ^ not allowed in type signatures @@ -496,8 +496,8 @@ help: use type parameters instead LL | fn assoc_fn_test2<T>(x: T) -> T; | ^^^ ^ ^ -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:154:28 +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for functions + --> $DIR/typeck_type_placeholder_item.rs:153:28 | LL | fn assoc_fn_test3() -> _; | ^ not allowed in type signatures @@ -507,20 +507,20 @@ help: use type parameters instead LL | fn assoc_fn_test3<T>() -> T; | ^^^ ^ -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:194:14 +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for associated types + --> $DIR/typeck_type_placeholder_item.rs:193:14 | LL | type B = _; | ^ not allowed in type signatures -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:196:14 +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for constants + --> $DIR/typeck_type_placeholder_item.rs:195:14 | LL | const C: _; | ^ not allowed in type signatures -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:198:14 +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for constants + --> $DIR/typeck_type_placeholder_item.rs:197:14 | LL | const D: _ = 42; | ^ @@ -528,13 +528,13 @@ LL | const D: _ = 42; | not allowed in type signatures | help: replace with the correct type: `i32` -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:201:26 +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for associated types + --> $DIR/typeck_type_placeholder_item.rs:200:26 | LL | type F: std::ops::Fn(_); | ^ not allowed in type signatures -error[E0121]: the type placeholder `_` is not allowed within types on item signatures +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for return types --> $DIR/typeck_type_placeholder_item.rs:44:24 | LL | fn test9(&self) -> _ { () } @@ -543,7 +543,7 @@ LL | fn test9(&self) -> _ { () } | not allowed in type signatures | help: replace with the correct return type: `()` -error[E0121]: the type placeholder `_` is not allowed within types on item signatures +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for functions --> $DIR/typeck_type_placeholder_item.rs:47:27 | LL | fn test10(&self, _x : _) { } @@ -554,7 +554,7 @@ help: use type parameters instead LL | fn test10<T>(&self, _x : T) { } | ^^^ ^ -error[E0121]: the type placeholder `_` is not allowed within types on item signatures +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for return types --> $DIR/typeck_type_placeholder_item.rs:62:24 | LL | fn clone(&self) -> _ { Test9 } @@ -563,7 +563,7 @@ LL | fn clone(&self) -> _ { Test9 } | not allowed in type signatures | help: replace with the correct return type: `Test9` -error[E0121]: the type placeholder `_` is not allowed within types on item signatures +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for functions --> $DIR/typeck_type_placeholder_item.rs:65:37 | LL | fn clone_from(&mut self, other: _) { *self = Test9; } @@ -574,8 +574,8 @@ help: use type parameters instead LL | fn clone_from<T>(&mut self, other: T) { *self = Test9; } | ^^^ ^ -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:111:31 +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for return types + --> $DIR/typeck_type_placeholder_item.rs:110:31 | LL | fn fn_test9(&self) -> _ { () } | ^ @@ -583,8 +583,8 @@ LL | fn fn_test9(&self) -> _ { () } | not allowed in type signatures | help: replace with the correct return type: `()` -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:114:34 +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for functions + --> $DIR/typeck_type_placeholder_item.rs:113:34 | LL | fn fn_test10(&self, _x : _) { } | ^ not allowed in type signatures @@ -594,8 +594,8 @@ help: use type parameters instead LL | fn fn_test10<T>(&self, _x : T) { } | ^^^ ^ -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:119:28 +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for return types + --> $DIR/typeck_type_placeholder_item.rs:118:28 | LL | fn clone(&self) -> _ { FnTest9 } | ^ @@ -603,8 +603,8 @@ LL | fn clone(&self) -> _ { FnTest9 } | not allowed in type signatures | help: replace with the correct return type: `FnTest9` -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:122:41 +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for functions + --> $DIR/typeck_type_placeholder_item.rs:121:41 | LL | fn clone_from(&mut self, other: _) { *self = FnTest9; } | ^ not allowed in type signatures @@ -614,26 +614,26 @@ help: use type parameters instead LL | fn clone_from<T>(&mut self, other: T) { *self = FnTest9; } | ^^^ ^ -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:205:14 +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for associated types + --> $DIR/typeck_type_placeholder_item.rs:204:14 | LL | type A = _; | ^ not allowed in type signatures -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:207:14 +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for associated types + --> $DIR/typeck_type_placeholder_item.rs:206:14 | LL | type B = _; | ^ not allowed in type signatures -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:209:14 +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for constants + --> $DIR/typeck_type_placeholder_item.rs:208:14 | LL | const C: _; | ^ not allowed in type signatures -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:212:14 +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for constants + --> $DIR/typeck_type_placeholder_item.rs:211:14 | LL | const D: _ = 42; | ^ diff --git a/src/test/ui/typeck/typeck_type_placeholder_item.min_tait.stderr b/src/test/ui/typeck/typeck_type_placeholder_item.min_tait.stderr index afd6aaf4e55..88cc3bfc7f8 100644 --- a/src/test/ui/typeck/typeck_type_placeholder_item.min_tait.stderr +++ b/src/test/ui/typeck/typeck_type_placeholder_item.min_tait.stderr @@ -1,35 +1,35 @@ error: expected identifier, found reserved identifier `_` - --> $DIR/typeck_type_placeholder_item.rs:158:18 + --> $DIR/typeck_type_placeholder_item.rs:157:18 | LL | struct BadStruct<_>(_); | ^ expected identifier, found reserved identifier error: expected identifier, found reserved identifier `_` - --> $DIR/typeck_type_placeholder_item.rs:161:16 + --> $DIR/typeck_type_placeholder_item.rs:160:16 | LL | trait BadTrait<_> {} | ^ expected identifier, found reserved identifier error: expected identifier, found reserved identifier `_` - --> $DIR/typeck_type_placeholder_item.rs:171:19 + --> $DIR/typeck_type_placeholder_item.rs:170:19 | LL | struct BadStruct1<_, _>(_); | ^ expected identifier, found reserved identifier error: expected identifier, found reserved identifier `_` - --> $DIR/typeck_type_placeholder_item.rs:171:22 + --> $DIR/typeck_type_placeholder_item.rs:170:22 | LL | struct BadStruct1<_, _>(_); | ^ expected identifier, found reserved identifier error: expected identifier, found reserved identifier `_` - --> $DIR/typeck_type_placeholder_item.rs:176:19 + --> $DIR/typeck_type_placeholder_item.rs:175:19 | LL | struct BadStruct2<_, T>(_, T); | ^ expected identifier, found reserved identifier error: associated constant in `impl` without body - --> $DIR/typeck_type_placeholder_item.rs:209:5 + --> $DIR/typeck_type_placeholder_item.rs:208:5 | LL | const C: _; | ^^^^^^^^^^- @@ -37,14 +37,14 @@ LL | const C: _; | help: provide a definition for the constant: `= <expr>;` error[E0403]: the name `_` is already used for a generic parameter in this item's generic parameters - --> $DIR/typeck_type_placeholder_item.rs:171:22 + --> $DIR/typeck_type_placeholder_item.rs:170:22 | LL | struct BadStruct1<_, _>(_); | - ^ already used | | | first use of `_` -error[E0121]: the type placeholder `_` is not allowed within types on item signatures +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for return types --> $DIR/typeck_type_placeholder_item.rs:10:14 | LL | fn test() -> _ { 5 } @@ -53,7 +53,7 @@ LL | fn test() -> _ { 5 } | not allowed in type signatures | help: replace with the correct return type: `i32` -error[E0121]: the type placeholder `_` is not allowed within types on item signatures +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for return types --> $DIR/typeck_type_placeholder_item.rs:13:16 | LL | fn test2() -> (_, _) { (5, 5) } @@ -63,7 +63,7 @@ LL | fn test2() -> (_, _) { (5, 5) } | |not allowed in type signatures | help: replace with the correct return type: `(i32, i32)` -error[E0121]: the type placeholder `_` is not allowed within types on item signatures +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for static variables --> $DIR/typeck_type_placeholder_item.rs:16:15 | LL | static TEST3: _ = "test"; @@ -72,7 +72,7 @@ LL | static TEST3: _ = "test"; | not allowed in type signatures | help: replace with the correct type: `&str` -error[E0121]: the type placeholder `_` is not allowed within types on item signatures +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for static variables --> $DIR/typeck_type_placeholder_item.rs:19:15 | LL | static TEST4: _ = 145; @@ -81,13 +81,13 @@ LL | static TEST4: _ = 145; | not allowed in type signatures | help: replace with the correct type: `i32` -error[E0121]: the type placeholder `_` is not allowed within types on item signatures +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for static variables --> $DIR/typeck_type_placeholder_item.rs:22:15 | LL | static TEST5: (_, _) = (1, 2); | ^^^^^^ not allowed in type signatures -error[E0121]: the type placeholder `_` is not allowed within types on item signatures +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for functions --> $DIR/typeck_type_placeholder_item.rs:25:13 | LL | fn test6(_: _) { } @@ -98,7 +98,7 @@ help: use type parameters instead LL | fn test6<T>(_: T) { } | ^^^ ^ -error[E0121]: the type placeholder `_` is not allowed within types on item signatures +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for functions --> $DIR/typeck_type_placeholder_item.rs:28:18 | LL | fn test6_b<T>(_: _, _: T) { } @@ -109,7 +109,7 @@ help: use type parameters instead LL | fn test6_b<T, U>(_: U, _: T) { } | ^^^ ^ -error[E0121]: the type placeholder `_` is not allowed within types on item signatures +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for functions --> $DIR/typeck_type_placeholder_item.rs:31:30 | LL | fn test6_c<T, K, L, A, B>(_: _, _: (T, K, L, A, B)) { } @@ -120,7 +120,7 @@ help: use type parameters instead LL | fn test6_c<T, K, L, A, B, U>(_: U, _: (T, K, L, A, B)) { } | ^^^ ^ -error[E0121]: the type placeholder `_` is not allowed within types on item signatures +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for functions --> $DIR/typeck_type_placeholder_item.rs:34:13 | LL | fn test7(x: _) { let _x: usize = x; } @@ -131,7 +131,7 @@ help: use type parameters instead LL | fn test7<T>(x: T) { let _x: usize = x; } | ^^^ ^ -error[E0121]: the type placeholder `_` is not allowed within types on item signatures +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for functions --> $DIR/typeck_type_placeholder_item.rs:37:22 | LL | fn test8(_f: fn() -> _) { } @@ -140,7 +140,7 @@ LL | fn test8(_f: fn() -> _) { } | not allowed in type signatures | help: use type parameters instead: `T` -error[E0121]: the type placeholder `_` is not allowed within types on item signatures +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for functions --> $DIR/typeck_type_placeholder_item.rs:37:22 | LL | fn test8(_f: fn() -> _) { } @@ -151,7 +151,7 @@ help: use type parameters instead LL | fn test8<T>(_f: fn() -> T) { } | ^^^ ^ -error[E0121]: the type placeholder `_` is not allowed within types on item signatures +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for return types --> $DIR/typeck_type_placeholder_item.rs:51:26 | LL | fn test11(x: &usize) -> &_ { @@ -160,7 +160,7 @@ LL | fn test11(x: &usize) -> &_ { | |not allowed in type signatures | help: replace with the correct return type: `&'static &'static usize` -error[E0121]: the type placeholder `_` is not allowed within types on item signatures +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for return types --> $DIR/typeck_type_placeholder_item.rs:56:52 | LL | unsafe fn test12(x: *const usize) -> *const *const _ { @@ -169,7 +169,7 @@ LL | unsafe fn test12(x: *const usize) -> *const *const _ { | | not allowed in type signatures | help: replace with the correct return type: `*const *const usize` -error[E0121]: the type placeholder `_` is not allowed within types on item signatures +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for structs --> $DIR/typeck_type_placeholder_item.rs:70:8 | LL | a: _, @@ -192,9 +192,9 @@ error: missing type for `static` item --> $DIR/typeck_type_placeholder_item.rs:76:12 | LL | static A = 42; - | ^ help: provide a type for the item: `A: i32` + | ^ help: provide a type for the static variable: `A: i32` -error[E0121]: the type placeholder `_` is not allowed within types on item signatures +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for static variables --> $DIR/typeck_type_placeholder_item.rs:78:15 | LL | static B: _ = 42; @@ -203,14 +203,14 @@ LL | static B: _ = 42; | not allowed in type signatures | help: replace with the correct type: `i32` -error[E0121]: the type placeholder `_` is not allowed within types on item signatures +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for static variables --> $DIR/typeck_type_placeholder_item.rs:80:15 | LL | static C: Option<_> = Some(42); | ^^^^^^^^^ not allowed in type signatures -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:83:21 +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for return types + --> $DIR/typeck_type_placeholder_item.rs:82:21 | LL | fn fn_test() -> _ { 5 } | ^ @@ -218,8 +218,8 @@ LL | fn fn_test() -> _ { 5 } | not allowed in type signatures | help: replace with the correct return type: `i32` -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:86:23 +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for return types + --> $DIR/typeck_type_placeholder_item.rs:85:23 | LL | fn fn_test2() -> (_, _) { (5, 5) } | -^--^- @@ -228,8 +228,8 @@ LL | fn fn_test2() -> (_, _) { (5, 5) } | |not allowed in type signatures | help: replace with the correct return type: `(i32, i32)` -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:89:22 +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for static variables + --> $DIR/typeck_type_placeholder_item.rs:88:22 | LL | static FN_TEST3: _ = "test"; | ^ @@ -237,8 +237,8 @@ LL | static FN_TEST3: _ = "test"; | not allowed in type signatures | help: replace with the correct type: `&str` -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:92:22 +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for static variables + --> $DIR/typeck_type_placeholder_item.rs:91:22 | LL | static FN_TEST4: _ = 145; | ^ @@ -246,14 +246,14 @@ LL | static FN_TEST4: _ = 145; | not allowed in type signatures | help: replace with the correct type: `i32` -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:95:22 +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for static variables + --> $DIR/typeck_type_placeholder_item.rs:94:22 | LL | static FN_TEST5: (_, _) = (1, 2); | ^^^^^^ not allowed in type signatures -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:98:20 +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for functions + --> $DIR/typeck_type_placeholder_item.rs:97:20 | LL | fn fn_test6(_: _) { } | ^ not allowed in type signatures @@ -263,8 +263,8 @@ help: use type parameters instead LL | fn fn_test6<T>(_: T) { } | ^^^ ^ -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:101:20 +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for functions + --> $DIR/typeck_type_placeholder_item.rs:100:20 | LL | fn fn_test7(x: _) { let _x: usize = x; } | ^ not allowed in type signatures @@ -274,8 +274,8 @@ help: use type parameters instead LL | fn fn_test7<T>(x: T) { let _x: usize = x; } | ^^^ ^ -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:104:29 +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for functions + --> $DIR/typeck_type_placeholder_item.rs:103:29 | LL | fn fn_test8(_f: fn() -> _) { } | ^ @@ -283,8 +283,8 @@ LL | fn fn_test8(_f: fn() -> _) { } | not allowed in type signatures | help: use type parameters instead: `T` -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:104:29 +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for functions + --> $DIR/typeck_type_placeholder_item.rs:103:29 | LL | fn fn_test8(_f: fn() -> _) { } | ^ not allowed in type signatures @@ -294,8 +294,8 @@ help: use type parameters instead LL | fn fn_test8<T>(_f: fn() -> T) { } | ^^^ ^ -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:127:12 +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for structs + --> $DIR/typeck_type_placeholder_item.rs:126:12 | LL | a: _, | ^ not allowed in type signatures @@ -314,21 +314,21 @@ LL | b: (T, T), | error[E0282]: type annotations needed - --> $DIR/typeck_type_placeholder_item.rs:132:18 + --> $DIR/typeck_type_placeholder_item.rs:131:18 | LL | fn fn_test11(_: _) -> (_, _) { panic!() } | ^ cannot infer type -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:132:28 +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for return types + --> $DIR/typeck_type_placeholder_item.rs:131:28 | LL | fn fn_test11(_: _) -> (_, _) { panic!() } | ^ ^ not allowed in type signatures | | | not allowed in type signatures -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:136:30 +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for return types + --> $DIR/typeck_type_placeholder_item.rs:135:30 | LL | fn fn_test12(x: i32) -> (_, _) { (x, x) } | -^--^- @@ -337,8 +337,8 @@ LL | fn fn_test12(x: i32) -> (_, _) { (x, x) } | |not allowed in type signatures | help: replace with the correct return type: `(i32, i32)` -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:139:33 +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for return types + --> $DIR/typeck_type_placeholder_item.rs:138:33 | LL | fn fn_test13(x: _) -> (i32, _) { (x, x) } | ------^- @@ -346,8 +346,8 @@ LL | fn fn_test13(x: _) -> (i32, _) { (x, x) } | | not allowed in type signatures | help: replace with the correct return type: `(i32, i32)` -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:158:21 +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for structs + --> $DIR/typeck_type_placeholder_item.rs:157:21 | LL | struct BadStruct<_>(_); | ^ not allowed in type signatures @@ -357,8 +357,8 @@ help: use type parameters instead LL | struct BadStruct<T>(T); | ^ ^ -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:163:15 +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for implementations + --> $DIR/typeck_type_placeholder_item.rs:162:15 | LL | impl BadTrait<_> for BadStruct<_> {} | ^ ^ not allowed in type signatures @@ -370,14 +370,14 @@ help: use type parameters instead LL | impl<T> BadTrait<T> for BadStruct<T> {} | ^^^ ^ ^ -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:166:34 +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for opaque types + --> $DIR/typeck_type_placeholder_item.rs:165:34 | LL | fn impl_trait() -> impl BadTrait<_> { | ^ not allowed in type signatures -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:171:25 +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for structs + --> $DIR/typeck_type_placeholder_item.rs:170:25 | LL | struct BadStruct1<_, _>(_); | ^ not allowed in type signatures @@ -387,8 +387,8 @@ help: use type parameters instead LL | struct BadStruct1<T, _>(T); | ^ ^ -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:176:25 +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for structs + --> $DIR/typeck_type_placeholder_item.rs:175:25 | LL | struct BadStruct2<_, T>(_, T); | ^ not allowed in type signatures @@ -398,20 +398,20 @@ help: use type parameters instead LL | struct BadStruct2<U, T>(U, T); | ^ ^ -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:180:14 +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for type aliases + --> $DIR/typeck_type_placeholder_item.rs:179:14 | LL | type X = Box<_>; | ^ not allowed in type signatures -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:186:21 +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for opaque types + --> $DIR/typeck_type_placeholder_item.rs:185:21 | LL | type Y = impl Trait<_>; | ^ not allowed in type signatures -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:220:31 +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for return types + --> $DIR/typeck_type_placeholder_item.rs:219:31 | LL | fn value() -> Option<&'static _> { | ----------------^- @@ -419,8 +419,8 @@ LL | fn value() -> Option<&'static _> { | | not allowed in type signatures | help: replace with the correct return type: `Option<&'static u8>` -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:225:10 +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for constants + --> $DIR/typeck_type_placeholder_item.rs:224:10 | LL | const _: Option<_> = map(value); | ^^^^^^^^^ @@ -428,8 +428,8 @@ LL | const _: Option<_> = map(value); | not allowed in type signatures | help: replace with the correct type: `Option<u8>` -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:144:31 +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for functions + --> $DIR/typeck_type_placeholder_item.rs:143:31 | LL | fn method_test1(&self, x: _); | ^ not allowed in type signatures @@ -439,8 +439,8 @@ help: use type parameters instead LL | fn method_test1<T>(&self, x: T); | ^^^ ^ -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:146:31 +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for functions + --> $DIR/typeck_type_placeholder_item.rs:145:31 | LL | fn method_test2(&self, x: _) -> _; | ^ ^ not allowed in type signatures @@ -452,8 +452,8 @@ help: use type parameters instead LL | fn method_test2<T>(&self, x: T) -> T; | ^^^ ^ ^ -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:148:31 +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for functions + --> $DIR/typeck_type_placeholder_item.rs:147:31 | LL | fn method_test3(&self) -> _; | ^ not allowed in type signatures @@ -463,8 +463,8 @@ help: use type parameters instead LL | fn method_test3<T>(&self) -> T; | ^^^ ^ -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:150:26 +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for functions + --> $DIR/typeck_type_placeholder_item.rs:149:26 | LL | fn assoc_fn_test1(x: _); | ^ not allowed in type signatures @@ -474,8 +474,8 @@ help: use type parameters instead LL | fn assoc_fn_test1<T>(x: T); | ^^^ ^ -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:152:26 +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for functions + --> $DIR/typeck_type_placeholder_item.rs:151:26 | LL | fn assoc_fn_test2(x: _) -> _; | ^ ^ not allowed in type signatures @@ -487,8 +487,8 @@ help: use type parameters instead LL | fn assoc_fn_test2<T>(x: T) -> T; | ^^^ ^ ^ -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:154:28 +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for functions + --> $DIR/typeck_type_placeholder_item.rs:153:28 | LL | fn assoc_fn_test3() -> _; | ^ not allowed in type signatures @@ -498,20 +498,20 @@ help: use type parameters instead LL | fn assoc_fn_test3<T>() -> T; | ^^^ ^ -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:194:14 +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for associated types + --> $DIR/typeck_type_placeholder_item.rs:193:14 | LL | type B = _; | ^ not allowed in type signatures -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:196:14 +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for constants + --> $DIR/typeck_type_placeholder_item.rs:195:14 | LL | const C: _; | ^ not allowed in type signatures -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:198:14 +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for constants + --> $DIR/typeck_type_placeholder_item.rs:197:14 | LL | const D: _ = 42; | ^ @@ -519,13 +519,13 @@ LL | const D: _ = 42; | not allowed in type signatures | help: replace with the correct type: `i32` -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:201:26 +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for associated types + --> $DIR/typeck_type_placeholder_item.rs:200:26 | LL | type F: std::ops::Fn(_); | ^ not allowed in type signatures -error[E0121]: the type placeholder `_` is not allowed within types on item signatures +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for return types --> $DIR/typeck_type_placeholder_item.rs:44:24 | LL | fn test9(&self) -> _ { () } @@ -534,7 +534,7 @@ LL | fn test9(&self) -> _ { () } | not allowed in type signatures | help: replace with the correct return type: `()` -error[E0121]: the type placeholder `_` is not allowed within types on item signatures +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for functions --> $DIR/typeck_type_placeholder_item.rs:47:27 | LL | fn test10(&self, _x : _) { } @@ -545,7 +545,7 @@ help: use type parameters instead LL | fn test10<T>(&self, _x : T) { } | ^^^ ^ -error[E0121]: the type placeholder `_` is not allowed within types on item signatures +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for return types --> $DIR/typeck_type_placeholder_item.rs:62:24 | LL | fn clone(&self) -> _ { Test9 } @@ -554,7 +554,7 @@ LL | fn clone(&self) -> _ { Test9 } | not allowed in type signatures | help: replace with the correct return type: `Test9` -error[E0121]: the type placeholder `_` is not allowed within types on item signatures +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for functions --> $DIR/typeck_type_placeholder_item.rs:65:37 | LL | fn clone_from(&mut self, other: _) { *self = Test9; } @@ -565,8 +565,8 @@ help: use type parameters instead LL | fn clone_from<T>(&mut self, other: T) { *self = Test9; } | ^^^ ^ -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:111:31 +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for return types + --> $DIR/typeck_type_placeholder_item.rs:110:31 | LL | fn fn_test9(&self) -> _ { () } | ^ @@ -574,8 +574,8 @@ LL | fn fn_test9(&self) -> _ { () } | not allowed in type signatures | help: replace with the correct return type: `()` -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:114:34 +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for functions + --> $DIR/typeck_type_placeholder_item.rs:113:34 | LL | fn fn_test10(&self, _x : _) { } | ^ not allowed in type signatures @@ -585,8 +585,8 @@ help: use type parameters instead LL | fn fn_test10<T>(&self, _x : T) { } | ^^^ ^ -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:119:28 +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for return types + --> $DIR/typeck_type_placeholder_item.rs:118:28 | LL | fn clone(&self) -> _ { FnTest9 } | ^ @@ -594,8 +594,8 @@ LL | fn clone(&self) -> _ { FnTest9 } | not allowed in type signatures | help: replace with the correct return type: `FnTest9` -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:122:41 +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for functions + --> $DIR/typeck_type_placeholder_item.rs:121:41 | LL | fn clone_from(&mut self, other: _) { *self = FnTest9; } | ^ not allowed in type signatures @@ -605,26 +605,26 @@ help: use type parameters instead LL | fn clone_from<T>(&mut self, other: T) { *self = FnTest9; } | ^^^ ^ -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:205:14 +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for associated types + --> $DIR/typeck_type_placeholder_item.rs:204:14 | LL | type A = _; | ^ not allowed in type signatures -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:207:14 +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for associated types + --> $DIR/typeck_type_placeholder_item.rs:206:14 | LL | type B = _; | ^ not allowed in type signatures -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:209:14 +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for constants + --> $DIR/typeck_type_placeholder_item.rs:208:14 | LL | const C: _; | ^ not allowed in type signatures -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:212:14 +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for constants + --> $DIR/typeck_type_placeholder_item.rs:211:14 | LL | const D: _ = 42; | ^ diff --git a/src/test/ui/typeck/typeck_type_placeholder_item.rs b/src/test/ui/typeck/typeck_type_placeholder_item.rs index 8a52556ed34..55f5d44d46b 100644 --- a/src/test/ui/typeck/typeck_type_placeholder_item.rs +++ b/src/test/ui/typeck/typeck_type_placeholder_item.rs @@ -8,67 +8,67 @@ // inference by using the `_` type placeholder. fn test() -> _ { 5 } -//~^ ERROR the type placeholder `_` is not allowed within types on item signatures +//~^ ERROR the type placeholder `_` is not allowed within types on item signatures for return types fn test2() -> (_, _) { (5, 5) } -//~^ ERROR the type placeholder `_` is not allowed within types on item signatures +//~^ ERROR the type placeholder `_` is not allowed within types on item signatures for return types static TEST3: _ = "test"; -//~^ ERROR the type placeholder `_` is not allowed within types on item signatures +//~^ ERROR the type placeholder `_` is not allowed within types on item signatures for static variables static TEST4: _ = 145; -//~^ ERROR the type placeholder `_` is not allowed within types on item signatures +//~^ ERROR the type placeholder `_` is not allowed within types on item signatures for static variables static TEST5: (_, _) = (1, 2); -//~^ ERROR the type placeholder `_` is not allowed within types on item signatures +//~^ ERROR the type placeholder `_` is not allowed within types on item signatures for static variables fn test6(_: _) { } -//~^ ERROR the type placeholder `_` is not allowed within types on item signatures +//~^ ERROR the type placeholder `_` is not allowed within types on item signatures for functions fn test6_b<T>(_: _, _: T) { } -//~^ ERROR the type placeholder `_` is not allowed within types on item signatures +//~^ ERROR the type placeholder `_` is not allowed within types on item signatures for functions fn test6_c<T, K, L, A, B>(_: _, _: (T, K, L, A, B)) { } -//~^ ERROR the type placeholder `_` is not allowed within types on item signatures +//~^ ERROR the type placeholder `_` is not allowed within types on item signatures for functions fn test7(x: _) { let _x: usize = x; } -//~^ ERROR the type placeholder `_` is not allowed within types on item signatures +//~^ ERROR the type placeholder `_` is not allowed within types on item signatures for functions fn test8(_f: fn() -> _) { } -//~^ ERROR the type placeholder `_` is not allowed within types on item signatures -//~^^ ERROR the type placeholder `_` is not allowed within types on item signatures +//~^ ERROR the type placeholder `_` is not allowed within types on item signatures for functions +//~^^ ERROR the type placeholder `_` is not allowed within types on item signatures for functions struct Test9; impl Test9 { fn test9(&self) -> _ { () } - //~^ ERROR the type placeholder `_` is not allowed within types on item signatures + //~^ ERROR the type placeholder `_` is not allowed within types on item signatures for return types fn test10(&self, _x : _) { } - //~^ ERROR the type placeholder `_` is not allowed within types on item signatures + //~^ ERROR the type placeholder `_` is not allowed within types on item signatures for functions } fn test11(x: &usize) -> &_ { -//~^ ERROR the type placeholder `_` is not allowed within types on item signatures +//~^ ERROR the type placeholder `_` is not allowed within types on item signatures for return types &x } unsafe fn test12(x: *const usize) -> *const *const _ { -//~^ ERROR the type placeholder `_` is not allowed within types on item signatures +//~^ ERROR the type placeholder `_` is not allowed within types on item signatures for return types &x } impl Clone for Test9 { fn clone(&self) -> _ { Test9 } - //~^ ERROR the type placeholder `_` is not allowed within types on item signatures + //~^ ERROR the type placeholder `_` is not allowed within types on item signatures for return types fn clone_from(&mut self, other: _) { *self = Test9; } - //~^ ERROR the type placeholder `_` is not allowed within types on item signatures + //~^ ERROR the type placeholder `_` is not allowed within types on item signatures for functions } struct Test10 { a: _, - //~^ ERROR the type placeholder `_` is not allowed within types on item signatures + //~^ ERROR the type placeholder `_` is not allowed within types on item signatures for structs b: (_, _), } @@ -76,95 +76,94 @@ pub fn main() { static A = 42; //~^ ERROR missing type for `static` item static B: _ = 42; - //~^ ERROR the type placeholder `_` is not allowed within types on item signatures + //~^ ERROR the type placeholder `_` is not allowed within types on item signatures for static variables static C: Option<_> = Some(42); - //~^ ERROR the type placeholder `_` is not allowed within types on item signatures - + //~^ ERROR the type placeholder `_` is not allowed within types on item signatures for static variables fn fn_test() -> _ { 5 } - //~^ ERROR the type placeholder `_` is not allowed within types on item signatures + //~^ ERROR the type placeholder `_` is not allowed within types on item signatures for return types fn fn_test2() -> (_, _) { (5, 5) } - //~^ ERROR the type placeholder `_` is not allowed within types on item signatures + //~^ ERROR the type placeholder `_` is not allowed within types on item signatures for return types static FN_TEST3: _ = "test"; - //~^ ERROR the type placeholder `_` is not allowed within types on item signatures + //~^ ERROR the type placeholder `_` is not allowed within types on item signatures for static variables static FN_TEST4: _ = 145; - //~^ ERROR the type placeholder `_` is not allowed within types on item signatures + //~^ ERROR the type placeholder `_` is not allowed within types on item signatures for static variables static FN_TEST5: (_, _) = (1, 2); - //~^ ERROR the type placeholder `_` is not allowed within types on item signatures + //~^ ERROR the type placeholder `_` is not allowed within types on item signatures for static variables fn fn_test6(_: _) { } - //~^ ERROR the type placeholder `_` is not allowed within types on item signatures + //~^ ERROR the type placeholder `_` is not allowed within types on item signatures for functions fn fn_test7(x: _) { let _x: usize = x; } - //~^ ERROR the type placeholder `_` is not allowed within types on item signatures + //~^ ERROR the type placeholder `_` is not allowed within types on item signatures for functions fn fn_test8(_f: fn() -> _) { } - //~^ ERROR the type placeholder `_` is not allowed within types on item signatures - //~^^ ERROR the type placeholder `_` is not allowed within types on item signatures + //~^ ERROR the type placeholder `_` is not allowed within types on item signatures for functions + //~^^ ERROR the type placeholder `_` is not allowed within types on item signatures for functions struct FnTest9; impl FnTest9 { fn fn_test9(&self) -> _ { () } - //~^ ERROR the type placeholder `_` is not allowed within types on item signatures + //~^ ERROR the type placeholder `_` is not allowed within types on item signatures for return types fn fn_test10(&self, _x : _) { } - //~^ ERROR the type placeholder `_` is not allowed within types on item signatures + //~^ ERROR the type placeholder `_` is not allowed within types on item signatures for functions } impl Clone for FnTest9 { fn clone(&self) -> _ { FnTest9 } - //~^ ERROR the type placeholder `_` is not allowed within types on item signatures + //~^ ERROR the type placeholder `_` is not allowed within types on item signatures for return types fn clone_from(&mut self, other: _) { *self = FnTest9; } - //~^ ERROR the type placeholder `_` is not allowed within types on item signatures + //~^ ERROR the type placeholder `_` is not allowed within types on item signatures for functions } struct FnTest10 { a: _, - //~^ ERROR the type placeholder `_` is not allowed within types on item signatures + //~^ ERROR the type placeholder `_` is not allowed within types on item signatures for structs b: (_, _), } fn fn_test11(_: _) -> (_, _) { panic!() } - //~^ ERROR the type placeholder `_` is not allowed within types on item signatures + //~^ ERROR the type placeholder `_` is not allowed within types on item signatures for return types //~| ERROR type annotations needed fn fn_test12(x: i32) -> (_, _) { (x, x) } - //~^ ERROR the type placeholder `_` is not allowed within types on item signatures + //~^ ERROR the type placeholder `_` is not allowed within types on item signatures for return types fn fn_test13(x: _) -> (i32, _) { (x, x) } - //~^ ERROR the type placeholder `_` is not allowed within types on item signatures + //~^ ERROR the type placeholder `_` is not allowed within types on item signatures for return types } trait T { fn method_test1(&self, x: _); - //~^ ERROR the type placeholder `_` is not allowed within types on item signatures + //~^ ERROR the type placeholder `_` is not allowed within types on item signatures for functions fn method_test2(&self, x: _) -> _; - //~^ ERROR the type placeholder `_` is not allowed within types on item signatures + //~^ ERROR the type placeholder `_` is not allowed within types on item signatures for functions fn method_test3(&self) -> _; - //~^ ERROR the type placeholder `_` is not allowed within types on item signatures + //~^ ERROR the type placeholder `_` is not allowed within types on item signatures for functions fn assoc_fn_test1(x: _); - //~^ ERROR the type placeholder `_` is not allowed within types on item signatures + //~^ ERROR the type placeholder `_` is not allowed within types on item signatures for functions fn assoc_fn_test2(x: _) -> _; - //~^ ERROR the type placeholder `_` is not allowed within types on item signatures + //~^ ERROR the type placeholder `_` is not allowed within types on item signatures for functions fn assoc_fn_test3() -> _; - //~^ ERROR the type placeholder `_` is not allowed within types on item signatures + //~^ ERROR the type placeholder `_` is not allowed within types on item signatures for functions } struct BadStruct<_>(_); //~^ ERROR expected identifier, found reserved identifier `_` -//~| ERROR the type placeholder `_` is not allowed within types on item signatures +//~| ERROR the type placeholder `_` is not allowed within types on item signatures for structs trait BadTrait<_> {} //~^ ERROR expected identifier, found reserved identifier `_` impl BadTrait<_> for BadStruct<_> {} -//~^ ERROR the type placeholder `_` is not allowed within types on item signatures +//~^ ERROR the type placeholder `_` is not allowed within types on item signatures for implementations fn impl_trait() -> impl BadTrait<_> { -//~^ ERROR the type placeholder `_` is not allowed within types on item signatures +//~^ ERROR the type placeholder `_` is not allowed within types on item signatures for opaque types unimplemented!() } @@ -172,19 +171,19 @@ struct BadStruct1<_, _>(_); //~^ ERROR expected identifier, found reserved identifier `_` //~| ERROR expected identifier, found reserved identifier `_` //~| ERROR the name `_` is already used -//~| ERROR the type placeholder `_` is not allowed within types on item signatures +//~| ERROR the type placeholder `_` is not allowed within types on item signatures for structs struct BadStruct2<_, T>(_, T); //~^ ERROR expected identifier, found reserved identifier `_` -//~| ERROR the type placeholder `_` is not allowed within types on item signatures +//~| ERROR the type placeholder `_` is not allowed within types on item signatures for structs type X = Box<_>; -//~^ ERROR the type placeholder `_` is not allowed within types on item signatures +//~^ ERROR the type placeholder `_` is not allowed within types on item signatures for type aliases struct Struct; trait Trait<T> {} impl Trait<usize> for Struct {} type Y = impl Trait<_>; -//~^ ERROR the type placeholder `_` is not allowed within types on item signatures +//~^ ERROR the type placeholder `_` is not allowed within types on item signatures for opaque types fn foo() -> Y { Struct } @@ -192,25 +191,25 @@ fn foo() -> Y { trait Qux { type A; type B = _; - //~^ ERROR the type placeholder `_` is not allowed within types on item signatures + //~^ ERROR the type placeholder `_` is not allowed within types on item signatures for associated types const C: _; - //~^ ERROR the type placeholder `_` is not allowed within types on item signatures + //~^ ERROR the type placeholder `_` is not allowed within types on item signatures for constants const D: _ = 42; - //~^ ERROR the type placeholder `_` is not allowed within types on item signatures + //~^ ERROR the type placeholder `_` is not allowed within types on item signatures for constants // type E: _; // FIXME: make the parser propagate the existence of `B` type F: std::ops::Fn(_); - //~^ ERROR the type placeholder `_` is not allowed within types on item signatures + //~^ ERROR the type placeholder `_` is not allowed within types on item signatures for associated types } impl Qux for Struct { type A = _; - //~^ ERROR the type placeholder `_` is not allowed within types on item signatures + //~^ ERROR the type placeholder `_` is not allowed within types on item signatures for associated types type B = _; - //~^ ERROR the type placeholder `_` is not allowed within types on item signatures + //~^ ERROR the type placeholder `_` is not allowed within types on item signatures for associated types const C: _; - //~^ ERROR the type placeholder `_` is not allowed within types on item signatures + //~^ ERROR the type placeholder `_` is not allowed within types on item signatures for constants //~| ERROR associated constant in `impl` without body const D: _ = 42; - //~^ ERROR the type placeholder `_` is not allowed within types on item signatures + //~^ ERROR the type placeholder `_` is not allowed within types on item signatures for constants } fn map<T>(_: fn() -> Option<&'static T>) -> Option<T> { @@ -218,9 +217,9 @@ fn map<T>(_: fn() -> Option<&'static T>) -> Option<T> { } fn value() -> Option<&'static _> { -//~^ ERROR the type placeholder `_` is not allowed within types on item signatures +//~^ ERROR the type placeholder `_` is not allowed within types on item signatures for return types Option::<&'static u8>::None } const _: Option<_> = map(value); -//~^ ERROR the type placeholder `_` is not allowed within types on item signatures +//~^ ERROR the type placeholder `_` is not allowed within types on item signatures for constants diff --git a/src/test/ui/typeck/typeck_type_placeholder_item_help.rs b/src/test/ui/typeck/typeck_type_placeholder_item_help.rs index 0c890f88c60..3af5cf926ab 100644 --- a/src/test/ui/typeck/typeck_type_placeholder_item_help.rs +++ b/src/test/ui/typeck/typeck_type_placeholder_item_help.rs @@ -2,27 +2,27 @@ // using the `_` type placeholder. fn test1() -> _ { Some(42) } -//~^ ERROR the type placeholder `_` is not allowed within types on item signatures +//~^ ERROR the type placeholder `_` is not allowed within types on item signatures for return types const TEST2: _ = 42u32; -//~^ ERROR the type placeholder `_` is not allowed within types on item signatures +//~^ ERROR the type placeholder `_` is not allowed within types on item signatures for constants const TEST3: _ = Some(42); -//~^ ERROR the type placeholder `_` is not allowed within types on item signatures +//~^ ERROR the type placeholder `_` is not allowed within types on item signatures for constants const TEST4: fn() -> _ = 42; -//~^ ERROR the type placeholder `_` is not allowed within types on item signatures +//~^ ERROR the type placeholder `_` is not allowed within types on item signatures for functions trait Test5 { const TEST5: _ = 42; - //~^ ERROR the type placeholder `_` is not allowed within types on item signatures + //~^ ERROR the type placeholder `_` is not allowed within types on item signatures for constants } struct Test6; impl Test6 { const TEST6: _ = 13; - //~^ ERROR the type placeholder `_` is not allowed within types on item signatures + //~^ ERROR the type placeholder `_` is not allowed within types on item signatures for constants } pub fn main() { diff --git a/src/test/ui/typeck/typeck_type_placeholder_item_help.stderr b/src/test/ui/typeck/typeck_type_placeholder_item_help.stderr index 2b64df774b0..1b56b1033a8 100644 --- a/src/test/ui/typeck/typeck_type_placeholder_item_help.stderr +++ b/src/test/ui/typeck/typeck_type_placeholder_item_help.stderr @@ -1,4 +1,4 @@ -error[E0121]: the type placeholder `_` is not allowed within types on item signatures +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for return types --> $DIR/typeck_type_placeholder_item_help.rs:4:15 | LL | fn test1() -> _ { Some(42) } @@ -7,7 +7,7 @@ LL | fn test1() -> _ { Some(42) } | not allowed in type signatures | help: replace with the correct return type: `Option<i32>` -error[E0121]: the type placeholder `_` is not allowed within types on item signatures +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for constants --> $DIR/typeck_type_placeholder_item_help.rs:7:14 | LL | const TEST2: _ = 42u32; @@ -16,7 +16,7 @@ LL | const TEST2: _ = 42u32; | not allowed in type signatures | help: replace with the correct type: `u32` -error[E0121]: the type placeholder `_` is not allowed within types on item signatures +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for constants --> $DIR/typeck_type_placeholder_item_help.rs:10:14 | LL | const TEST3: _ = Some(42); @@ -25,13 +25,13 @@ LL | const TEST3: _ = Some(42); | not allowed in type signatures | help: replace with the correct type: `Option<i32>` -error[E0121]: the type placeholder `_` is not allowed within types on item signatures +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for functions --> $DIR/typeck_type_placeholder_item_help.rs:13:22 | LL | const TEST4: fn() -> _ = 42; | ^ not allowed in type signatures -error[E0121]: the type placeholder `_` is not allowed within types on item signatures +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for constants --> $DIR/typeck_type_placeholder_item_help.rs:17:18 | LL | const TEST5: _ = 42; @@ -40,7 +40,7 @@ LL | const TEST5: _ = 42; | not allowed in type signatures | help: replace with the correct type: `i32` -error[E0121]: the type placeholder `_` is not allowed within types on item signatures +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for constants --> $DIR/typeck_type_placeholder_item_help.rs:24:18 | LL | const TEST6: _ = 13; diff --git a/src/test/ui/unpretty-expr-fn-arg.rs b/src/test/ui/unpretty-expr-fn-arg.rs new file mode 100644 index 00000000000..6e1132a3372 --- /dev/null +++ b/src/test/ui/unpretty-expr-fn-arg.rs @@ -0,0 +1,13 @@ +// Regression test for the ICE described in #82328. The pretty-printer for +// `-Zunpretty=hir,typed` would previously retrieve type-checking results +// when entering a body, which means that type information was not available +// for expressions occurring in function signatures, as in the `foo` example +// below, leading to an ICE. + +// check-pass +// compile-flags: -Zunpretty=hir,typed +#![allow(dead_code)] + +fn main() {} + +fn foo(-128..=127: i8) {} diff --git a/src/test/ui/unpretty-expr-fn-arg.stdout b/src/test/ui/unpretty-expr-fn-arg.stdout new file mode 100644 index 00000000000..cb04dfead73 --- /dev/null +++ b/src/test/ui/unpretty-expr-fn-arg.stdout @@ -0,0 +1,17 @@ +// Regression test for the ICE described in #82328. The pretty-printer for +// `-Zunpretty=hir,typed` would previously retrieve type-checking results +// when entering a body, which means that type information was not available +// for expressions occurring in function signatures, as in the `foo` example +// below, leading to an ICE. + +// check-pass +// compile-flags: -Zunpretty=hir,typed +#![allow(dead_code)] +#[prelude_import] +use ::std::prelude::rust_2015::*; +#[macro_use] +extern crate std; + +fn main() ({ } as ()) + +fn foo((-(128 as i8) as i8) ...(127 as i8): i8) ({ } as ()) diff --git a/src/test/ui/unsafe/unsafe-around-compiler-generated-unsafe.mir.stderr b/src/test/ui/unsafe/unsafe-around-compiler-generated-unsafe.mir.stderr index 68101326861..29bd84cd0db 100644 --- a/src/test/ui/unsafe/unsafe-around-compiler-generated-unsafe.mir.stderr +++ b/src/test/ui/unsafe/unsafe-around-compiler-generated-unsafe.mir.stderr @@ -1,11 +1,11 @@ error: unnecessary `unsafe` block - --> $DIR/unsafe-around-compiler-generated-unsafe.rs:9:5 + --> $DIR/unsafe-around-compiler-generated-unsafe.rs:9:9 | -LL | unsafe { println!("foo"); } - | ^^^^^^ unnecessary `unsafe` block +LL | unsafe { async {}.await; } + | ^^^^^^ unnecessary `unsafe` block | note: the lint level is defined here - --> $DIR/unsafe-around-compiler-generated-unsafe.rs:6:9 + --> $DIR/unsafe-around-compiler-generated-unsafe.rs:5:9 | LL | #![deny(unused_unsafe)] | ^^^^^^^^^^^^^ diff --git a/src/test/ui/unsafe/unsafe-around-compiler-generated-unsafe.rs b/src/test/ui/unsafe/unsafe-around-compiler-generated-unsafe.rs index 08801f9ef59..e9c7efb9e8b 100644 --- a/src/test/ui/unsafe/unsafe-around-compiler-generated-unsafe.rs +++ b/src/test/ui/unsafe/unsafe-around-compiler-generated-unsafe.rs @@ -1,10 +1,11 @@ -// issue #12418 - +// edition:2018 // revisions: mir thir // [thir]compile-flags: -Z thir-unsafeck #![deny(unused_unsafe)] fn main() { - unsafe { println!("foo"); } //~ ERROR unnecessary `unsafe` + let _ = async { + unsafe { async {}.await; } //~ ERROR unnecessary `unsafe` + }; } diff --git a/src/test/ui/unsafe/unsafe-around-compiler-generated-unsafe.thir.stderr b/src/test/ui/unsafe/unsafe-around-compiler-generated-unsafe.thir.stderr index 68101326861..29bd84cd0db 100644 --- a/src/test/ui/unsafe/unsafe-around-compiler-generated-unsafe.thir.stderr +++ b/src/test/ui/unsafe/unsafe-around-compiler-generated-unsafe.thir.stderr @@ -1,11 +1,11 @@ error: unnecessary `unsafe` block - --> $DIR/unsafe-around-compiler-generated-unsafe.rs:9:5 + --> $DIR/unsafe-around-compiler-generated-unsafe.rs:9:9 | -LL | unsafe { println!("foo"); } - | ^^^^^^ unnecessary `unsafe` block +LL | unsafe { async {}.await; } + | ^^^^^^ unnecessary `unsafe` block | note: the lint level is defined here - --> $DIR/unsafe-around-compiler-generated-unsafe.rs:6:9 + --> $DIR/unsafe-around-compiler-generated-unsafe.rs:5:9 | LL | #![deny(unused_unsafe)] | ^^^^^^^^^^^^^ diff --git a/src/test/ui/variance/variance-btree-invariant-types.nll.stderr b/src/test/ui/variance/variance-btree-invariant-types.nll.stderr index be18737b5f1..4b653238aa7 100644 --- a/src/test/ui/variance/variance-btree-invariant-types.nll.stderr +++ b/src/test/ui/variance/variance-btree-invariant-types.nll.stderr @@ -39,7 +39,47 @@ LL | v = help: consider replacing `'new` with `'static` error: lifetime may not live long enough - --> $DIR/variance-btree-invariant-types.rs:18:5 + --> $DIR/variance-btree-invariant-types.rs:17:5 + | +LL | fn range_cov_key<'a, 'new>(v: RangeMut<'a, &'static (), ()>) -> RangeMut<'a, &'new (), ()> { + | ---- lifetime `'new` defined here +LL | v + | ^ returning this value requires that `'new` must outlive `'static` + | + = help: consider replacing `'new` with `'static` + +error: lifetime may not live long enough + --> $DIR/variance-btree-invariant-types.rs:20:5 + | +LL | fn range_cov_val<'a, 'new>(v: RangeMut<'a, (), &'static ()>) -> RangeMut<'a, (), &'new ()> { + | ---- lifetime `'new` defined here +LL | v + | ^ returning this value requires that `'new` must outlive `'static` + | + = help: consider replacing `'new` with `'static` + +error: lifetime may not live long enough + --> $DIR/variance-btree-invariant-types.rs:23:5 + | +LL | fn range_contra_key<'a, 'new>(v: RangeMut<'a, &'new (), ()>) -> RangeMut<'a, &'static (), ()> { + | ---- lifetime `'new` defined here +LL | v + | ^ returning this value requires that `'new` must outlive `'static` + | + = help: consider replacing `'new` with `'static` + +error: lifetime may not live long enough + --> $DIR/variance-btree-invariant-types.rs:26:5 + | +LL | fn range_contra_val<'a, 'new>(v: RangeMut<'a, (), &'new ()>) -> RangeMut<'a, (), &'static ()> { + | ---- lifetime `'new` defined here +LL | v + | ^ returning this value requires that `'new` must outlive `'static` + | + = help: consider replacing `'new` with `'static` + +error: lifetime may not live long enough + --> $DIR/variance-btree-invariant-types.rs:31:5 | LL | fn occ_cov_key<'a, 'new>(v: OccupiedEntry<'a, &'static (), ()>) | ---- lifetime `'new` defined here @@ -50,7 +90,7 @@ LL | v = help: consider replacing `'new` with `'static` error: lifetime may not live long enough - --> $DIR/variance-btree-invariant-types.rs:22:5 + --> $DIR/variance-btree-invariant-types.rs:35:5 | LL | fn occ_cov_val<'a, 'new>(v: OccupiedEntry<'a, (), &'static ()>) | ---- lifetime `'new` defined here @@ -61,7 +101,7 @@ LL | v = help: consider replacing `'new` with `'static` error: lifetime may not live long enough - --> $DIR/variance-btree-invariant-types.rs:26:5 + --> $DIR/variance-btree-invariant-types.rs:39:5 | LL | fn occ_contra_key<'a, 'new>(v: OccupiedEntry<'a, &'new (), ()>) | ---- lifetime `'new` defined here @@ -72,7 +112,7 @@ LL | v = help: consider replacing `'new` with `'static` error: lifetime may not live long enough - --> $DIR/variance-btree-invariant-types.rs:30:5 + --> $DIR/variance-btree-invariant-types.rs:43:5 | LL | fn occ_contra_val<'a, 'new>(v: OccupiedEntry<'a, (), &'new ()>) | ---- lifetime `'new` defined here @@ -83,7 +123,7 @@ LL | v = help: consider replacing `'new` with `'static` error: lifetime may not live long enough - --> $DIR/variance-btree-invariant-types.rs:35:5 + --> $DIR/variance-btree-invariant-types.rs:48:5 | LL | fn vac_cov_key<'a, 'new>(v: VacantEntry<'a, &'static (), ()>) | ---- lifetime `'new` defined here @@ -94,7 +134,7 @@ LL | v = help: consider replacing `'new` with `'static` error: lifetime may not live long enough - --> $DIR/variance-btree-invariant-types.rs:39:5 + --> $DIR/variance-btree-invariant-types.rs:52:5 | LL | fn vac_cov_val<'a, 'new>(v: VacantEntry<'a, (), &'static ()>) | ---- lifetime `'new` defined here @@ -105,7 +145,7 @@ LL | v = help: consider replacing `'new` with `'static` error: lifetime may not live long enough - --> $DIR/variance-btree-invariant-types.rs:43:5 + --> $DIR/variance-btree-invariant-types.rs:56:5 | LL | fn vac_contra_key<'a, 'new>(v: VacantEntry<'a, &'new (), ()>) | ---- lifetime `'new` defined here @@ -116,7 +156,7 @@ LL | v = help: consider replacing `'new` with `'static` error: lifetime may not live long enough - --> $DIR/variance-btree-invariant-types.rs:47:5 + --> $DIR/variance-btree-invariant-types.rs:60:5 | LL | fn vac_contra_val<'a, 'new>(v: VacantEntry<'a, (), &'new ()>) | ---- lifetime `'new` defined here @@ -126,5 +166,5 @@ LL | v | = help: consider replacing `'new` with `'static` -error: aborting due to 12 previous errors +error: aborting due to 16 previous errors diff --git a/src/test/ui/variance/variance-btree-invariant-types.rs b/src/test/ui/variance/variance-btree-invariant-types.rs index 2e5dc671db8..4549622f24a 100644 --- a/src/test/ui/variance/variance-btree-invariant-types.rs +++ b/src/test/ui/variance/variance-btree-invariant-types.rs @@ -1,4 +1,4 @@ -use std::collections::btree_map::{IterMut, OccupiedEntry, VacantEntry}; +use std::collections::btree_map::{IterMut, OccupiedEntry, RangeMut, VacantEntry}; fn iter_cov_key<'a, 'new>(v: IterMut<'a, &'static (), ()>) -> IterMut<'a, &'new (), ()> { v //~ ERROR mismatched types @@ -13,6 +13,19 @@ fn iter_contra_val<'a, 'new>(v: IterMut<'a, (), &'new ()>) -> IterMut<'a, (), &' v //~ ERROR mismatched types } +fn range_cov_key<'a, 'new>(v: RangeMut<'a, &'static (), ()>) -> RangeMut<'a, &'new (), ()> { + v //~ ERROR mismatched types +} +fn range_cov_val<'a, 'new>(v: RangeMut<'a, (), &'static ()>) -> RangeMut<'a, (), &'new ()> { + v //~ ERROR mismatched types +} +fn range_contra_key<'a, 'new>(v: RangeMut<'a, &'new (), ()>) -> RangeMut<'a, &'static (), ()> { + v //~ ERROR mismatched types +} +fn range_contra_val<'a, 'new>(v: RangeMut<'a, (), &'new ()>) -> RangeMut<'a, (), &'static ()> { + v //~ ERROR mismatched types +} + fn occ_cov_key<'a, 'new>(v: OccupiedEntry<'a, &'static (), ()>) -> OccupiedEntry<'a, &'new (), ()> { v //~ ERROR mismatched types diff --git a/src/test/ui/variance/variance-btree-invariant-types.stderr b/src/test/ui/variance/variance-btree-invariant-types.stderr index 8172a019b65..ba47bdff281 100644 --- a/src/test/ui/variance/variance-btree-invariant-types.stderr +++ b/src/test/ui/variance/variance-btree-invariant-types.stderr @@ -59,125 +59,185 @@ LL | fn iter_contra_val<'a, 'new>(v: IterMut<'a, (), &'new ()>) -> IterMut<'a, ( = note: ...does not necessarily outlive the static lifetime error[E0308]: mismatched types - --> $DIR/variance-btree-invariant-types.rs:18:5 + --> $DIR/variance-btree-invariant-types.rs:17:5 + | +LL | v + | ^ lifetime mismatch + | + = note: expected struct `RangeMut<'_, &'new (), _>` + found struct `RangeMut<'_, &'static (), _>` +note: the lifetime `'new` as defined on the function body at 16:22... + --> $DIR/variance-btree-invariant-types.rs:16:22 + | +LL | fn range_cov_key<'a, 'new>(v: RangeMut<'a, &'static (), ()>) -> RangeMut<'a, &'new (), ()> { + | ^^^^ + = note: ...does not necessarily outlive the static lifetime + +error[E0308]: mismatched types + --> $DIR/variance-btree-invariant-types.rs:20:5 + | +LL | v + | ^ lifetime mismatch + | + = note: expected struct `RangeMut<'_, _, &'new ()>` + found struct `RangeMut<'_, _, &'static ()>` +note: the lifetime `'new` as defined on the function body at 19:22... + --> $DIR/variance-btree-invariant-types.rs:19:22 + | +LL | fn range_cov_val<'a, 'new>(v: RangeMut<'a, (), &'static ()>) -> RangeMut<'a, (), &'new ()> { + | ^^^^ + = note: ...does not necessarily outlive the static lifetime + +error[E0308]: mismatched types + --> $DIR/variance-btree-invariant-types.rs:23:5 + | +LL | v + | ^ lifetime mismatch + | + = note: expected struct `RangeMut<'_, &'static (), _>` + found struct `RangeMut<'_, &'new (), _>` +note: the lifetime `'new` as defined on the function body at 22:25... + --> $DIR/variance-btree-invariant-types.rs:22:25 + | +LL | fn range_contra_key<'a, 'new>(v: RangeMut<'a, &'new (), ()>) -> RangeMut<'a, &'static (), ()> { + | ^^^^ + = note: ...does not necessarily outlive the static lifetime + +error[E0308]: mismatched types + --> $DIR/variance-btree-invariant-types.rs:26:5 + | +LL | v + | ^ lifetime mismatch + | + = note: expected struct `RangeMut<'_, _, &'static ()>` + found struct `RangeMut<'_, _, &'new ()>` +note: the lifetime `'new` as defined on the function body at 25:25... + --> $DIR/variance-btree-invariant-types.rs:25:25 + | +LL | fn range_contra_val<'a, 'new>(v: RangeMut<'a, (), &'new ()>) -> RangeMut<'a, (), &'static ()> { + | ^^^^ + = note: ...does not necessarily outlive the static lifetime + +error[E0308]: mismatched types + --> $DIR/variance-btree-invariant-types.rs:31:5 | LL | v | ^ lifetime mismatch | = note: expected struct `std::collections::btree_map::OccupiedEntry<'_, &'new (), _>` found struct `std::collections::btree_map::OccupiedEntry<'_, &'static (), _>` -note: the lifetime `'new` as defined on the function body at 16:20... - --> $DIR/variance-btree-invariant-types.rs:16:20 +note: the lifetime `'new` as defined on the function body at 29:20... + --> $DIR/variance-btree-invariant-types.rs:29:20 | LL | fn occ_cov_key<'a, 'new>(v: OccupiedEntry<'a, &'static (), ()>) | ^^^^ = note: ...does not necessarily outlive the static lifetime error[E0308]: mismatched types - --> $DIR/variance-btree-invariant-types.rs:22:5 + --> $DIR/variance-btree-invariant-types.rs:35:5 | LL | v | ^ lifetime mismatch | = note: expected struct `std::collections::btree_map::OccupiedEntry<'_, _, &'new ()>` found struct `std::collections::btree_map::OccupiedEntry<'_, _, &'static ()>` -note: the lifetime `'new` as defined on the function body at 20:20... - --> $DIR/variance-btree-invariant-types.rs:20:20 +note: the lifetime `'new` as defined on the function body at 33:20... + --> $DIR/variance-btree-invariant-types.rs:33:20 | LL | fn occ_cov_val<'a, 'new>(v: OccupiedEntry<'a, (), &'static ()>) | ^^^^ = note: ...does not necessarily outlive the static lifetime error[E0308]: mismatched types - --> $DIR/variance-btree-invariant-types.rs:26:5 + --> $DIR/variance-btree-invariant-types.rs:39:5 | LL | v | ^ lifetime mismatch | = note: expected struct `std::collections::btree_map::OccupiedEntry<'_, &'static (), _>` found struct `std::collections::btree_map::OccupiedEntry<'_, &'new (), _>` -note: the lifetime `'new` as defined on the function body at 24:23... - --> $DIR/variance-btree-invariant-types.rs:24:23 +note: the lifetime `'new` as defined on the function body at 37:23... + --> $DIR/variance-btree-invariant-types.rs:37:23 | LL | fn occ_contra_key<'a, 'new>(v: OccupiedEntry<'a, &'new (), ()>) | ^^^^ = note: ...does not necessarily outlive the static lifetime error[E0308]: mismatched types - --> $DIR/variance-btree-invariant-types.rs:30:5 + --> $DIR/variance-btree-invariant-types.rs:43:5 | LL | v | ^ lifetime mismatch | = note: expected struct `std::collections::btree_map::OccupiedEntry<'_, _, &'static ()>` found struct `std::collections::btree_map::OccupiedEntry<'_, _, &'new ()>` -note: the lifetime `'new` as defined on the function body at 28:23... - --> $DIR/variance-btree-invariant-types.rs:28:23 +note: the lifetime `'new` as defined on the function body at 41:23... + --> $DIR/variance-btree-invariant-types.rs:41:23 | LL | fn occ_contra_val<'a, 'new>(v: OccupiedEntry<'a, (), &'new ()>) | ^^^^ = note: ...does not necessarily outlive the static lifetime error[E0308]: mismatched types - --> $DIR/variance-btree-invariant-types.rs:35:5 + --> $DIR/variance-btree-invariant-types.rs:48:5 | LL | v | ^ lifetime mismatch | = note: expected struct `std::collections::btree_map::VacantEntry<'_, &'new (), _>` found struct `std::collections::btree_map::VacantEntry<'_, &'static (), _>` -note: the lifetime `'new` as defined on the function body at 33:20... - --> $DIR/variance-btree-invariant-types.rs:33:20 +note: the lifetime `'new` as defined on the function body at 46:20... + --> $DIR/variance-btree-invariant-types.rs:46:20 | LL | fn vac_cov_key<'a, 'new>(v: VacantEntry<'a, &'static (), ()>) | ^^^^ = note: ...does not necessarily outlive the static lifetime error[E0308]: mismatched types - --> $DIR/variance-btree-invariant-types.rs:39:5 + --> $DIR/variance-btree-invariant-types.rs:52:5 | LL | v | ^ lifetime mismatch | = note: expected struct `std::collections::btree_map::VacantEntry<'_, _, &'new ()>` found struct `std::collections::btree_map::VacantEntry<'_, _, &'static ()>` -note: the lifetime `'new` as defined on the function body at 37:20... - --> $DIR/variance-btree-invariant-types.rs:37:20 +note: the lifetime `'new` as defined on the function body at 50:20... + --> $DIR/variance-btree-invariant-types.rs:50:20 | LL | fn vac_cov_val<'a, 'new>(v: VacantEntry<'a, (), &'static ()>) | ^^^^ = note: ...does not necessarily outlive the static lifetime error[E0308]: mismatched types - --> $DIR/variance-btree-invariant-types.rs:43:5 + --> $DIR/variance-btree-invariant-types.rs:56:5 | LL | v | ^ lifetime mismatch | = note: expected struct `std::collections::btree_map::VacantEntry<'_, &'static (), _>` found struct `std::collections::btree_map::VacantEntry<'_, &'new (), _>` -note: the lifetime `'new` as defined on the function body at 41:23... - --> $DIR/variance-btree-invariant-types.rs:41:23 +note: the lifetime `'new` as defined on the function body at 54:23... + --> $DIR/variance-btree-invariant-types.rs:54:23 | LL | fn vac_contra_key<'a, 'new>(v: VacantEntry<'a, &'new (), ()>) | ^^^^ = note: ...does not necessarily outlive the static lifetime error[E0308]: mismatched types - --> $DIR/variance-btree-invariant-types.rs:47:5 + --> $DIR/variance-btree-invariant-types.rs:60:5 | LL | v | ^ lifetime mismatch | = note: expected struct `std::collections::btree_map::VacantEntry<'_, _, &'static ()>` found struct `std::collections::btree_map::VacantEntry<'_, _, &'new ()>` -note: the lifetime `'new` as defined on the function body at 45:23... - --> $DIR/variance-btree-invariant-types.rs:45:23 +note: the lifetime `'new` as defined on the function body at 58:23... + --> $DIR/variance-btree-invariant-types.rs:58:23 | LL | fn vac_contra_val<'a, 'new>(v: VacantEntry<'a, (), &'new ()>) | ^^^^ = note: ...does not necessarily outlive the static lifetime -error: aborting due to 12 previous errors +error: aborting due to 16 previous errors For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/wait-forked-but-failed-child.rs b/src/test/ui/wait-forked-but-failed-child.rs index 26835907759..0eb0fe071f5 100644 --- a/src/test/ui/wait-forked-but-failed-child.rs +++ b/src/test/ui/wait-forked-but-failed-child.rs @@ -28,7 +28,7 @@ use std::process::Command; fn find_zombies() { let my_pid = unsafe { libc::getpid() }; - // http://pubs.opengroup.org/onlinepubs/9699919799/utilities/ps.html + // https://pubs.opengroup.org/onlinepubs/9699919799/utilities/ps.html let ps_cmd_output = Command::new("ps").args(&["-A", "-o", "pid,ppid,args"]).output().unwrap(); let ps_output = String::from_utf8_lossy(&ps_cmd_output.stdout); |
