diff options
Diffstat (limited to 'tests')
581 files changed, 5053 insertions, 2105 deletions
diff --git a/tests/assembly-llvm/x86_64-fortanix-unknown-sgx-lvi-generic-load.rs b/tests/assembly-llvm/x86_64-fortanix-unknown-sgx-lvi-generic-load.rs index f5e2f18e68e..2892ff2882a 100644 --- a/tests/assembly-llvm/x86_64-fortanix-unknown-sgx-lvi-generic-load.rs +++ b/tests/assembly-llvm/x86_64-fortanix-unknown-sgx-lvi-generic-load.rs @@ -1,17 +1,24 @@ -// Test LVI load hardening on SGX enclave code +// Test LVI load hardening on SGX enclave code, specifically that `ret` is rewritten. +//@ add-core-stubs //@ assembly-output: emit-asm -//@ compile-flags: --crate-type staticlib -//@ only-x86_64-fortanix-unknown-sgx +//@ compile-flags: --target x86_64-fortanix-unknown-sgx -Copt-level=0 +//@ needs-llvm-components: x86 + +#![feature(no_core, lang_items, f16)] +#![crate_type = "lib"] +#![no_core] + +extern crate minicore; +use minicore::*; #[no_mangle] -pub extern "C" fn plus_one(r: &mut u64) { - *r = *r + 1; +pub extern "C" fn dereference(a: &mut u64) -> u64 { + // CHECK-LABEL: dereference + // CHECK: lfence + // CHECK: mov + // CHECK: popq [[REGISTER:%[a-z]+]] + // CHECK-NEXT: lfence + // CHECK-NEXT: jmpq *[[REGISTER]] + *a } - -// CHECK: plus_one -// CHECK: lfence -// CHECK-NEXT: incq -// CHECK: popq [[REGISTER:%[a-z]+]] -// CHECK-NEXT: lfence -// CHECK-NEXT: jmpq *[[REGISTER]] diff --git a/tests/assembly-llvm/x86_64-fortanix-unknown-sgx-lvi-generic-ret.rs b/tests/assembly-llvm/x86_64-fortanix-unknown-sgx-lvi-generic-ret.rs index f16d68fa255..a0cedc3bc2d 100644 --- a/tests/assembly-llvm/x86_64-fortanix-unknown-sgx-lvi-generic-ret.rs +++ b/tests/assembly-llvm/x86_64-fortanix-unknown-sgx-lvi-generic-ret.rs @@ -1,12 +1,20 @@ // Test LVI ret hardening on generic rust code +//@ add-core-stubs //@ assembly-output: emit-asm -//@ compile-flags: --crate-type staticlib -//@ only-x86_64-fortanix-unknown-sgx +//@ compile-flags: --target x86_64-fortanix-unknown-sgx +//@ needs-llvm-components: x86 + +#![feature(no_core, lang_items, f16)] +#![crate_type = "lib"] +#![no_core] + +extern crate minicore; +use minicore::*; #[no_mangle] pub extern "C" fn myret() {} -// CHECK: myret: +// CHECK-LABEL: myret: // CHECK: popq [[REGISTER:%[a-z]+]] // CHECK-NEXT: lfence // CHECK-NEXT: jmpq *[[REGISTER]] diff --git a/tests/assembly-llvm/x86_64-fortanix-unknown-sgx-lvi-inline-assembly.rs b/tests/assembly-llvm/x86_64-fortanix-unknown-sgx-lvi-inline-assembly.rs index a729df8e166..215fb4b804a 100644 --- a/tests/assembly-llvm/x86_64-fortanix-unknown-sgx-lvi-inline-assembly.rs +++ b/tests/assembly-llvm/x86_64-fortanix-unknown-sgx-lvi-inline-assembly.rs @@ -1,13 +1,22 @@ // Test LVI load hardening on SGX inline assembly code +//@ add-core-stubs //@ assembly-output: emit-asm -//@ compile-flags: --crate-type staticlib -//@ only-x86_64-fortanix-unknown-sgx +//@ compile-flags: --target x86_64-fortanix-unknown-sgx +//@ needs-llvm-components: x86 -use std::arch::asm; +#![feature(no_core, lang_items, f16)] +#![crate_type = "lib"] +#![no_core] + +extern crate minicore; +use minicore::*; #[no_mangle] pub extern "C" fn get(ptr: *const u64) -> u64 { + // CHECK-LABEL: get + // CHECK: movq + // CHECK-NEXT: lfence let value: u64; unsafe { asm!("mov {}, [{}]", @@ -17,18 +26,13 @@ pub extern "C" fn get(ptr: *const u64) -> u64 { value } -// CHECK: get -// CHECK: movq -// CHECK-NEXT: lfence - #[no_mangle] pub extern "C" fn myret() { + // CHECK-LABEL: myret + // CHECK: shlq $0, (%rsp) + // CHECK-NEXT: lfence + // CHECK-NEXT: retq unsafe { asm!("ret"); } } - -// CHECK: myret -// CHECK: shlq $0, (%rsp) -// CHECK-NEXT: lfence -// CHECK-NEXT: retq diff --git a/tests/codegen-llvm/become-musttail.rs b/tests/codegen-llvm/become-musttail.rs new file mode 100644 index 00000000000..07f33571910 --- /dev/null +++ b/tests/codegen-llvm/become-musttail.rs @@ -0,0 +1,18 @@ +//@ compile-flags: -C opt-level=0 -Cpanic=abort -C no-prepopulate-passes +//@ needs-unwind + +#![crate_type = "lib"] +#![feature(explicit_tail_calls)] + +// CHECK-LABEL: define {{.*}}@fibonacci( +#[no_mangle] +#[inline(never)] +pub fn fibonacci(n: u64, a: u64, b: u64) -> u64 { + // CHECK: musttail call {{.*}}@fibonacci( + // CHECK-NEXT: ret i64 + match n { + 0 => a, + 1 => b, + _ => become fibonacci(n - 1, b, a + b), + } +} diff --git a/tests/codegen-llvm/bounds-check-elision-slice-min.rs b/tests/codegen-llvm/bounds-check-elision-slice-min.rs new file mode 100644 index 00000000000..e160e5da50f --- /dev/null +++ b/tests/codegen-llvm/bounds-check-elision-slice-min.rs @@ -0,0 +1,19 @@ +//! Regression test for #<https://github.com/rust-lang/rust/issues/120433>: +//! Multiple bounds checking elision failures +//! (ensures bounds checks are properly elided, +//! with no calls to panic_bounds_check in the LLVM IR). + +//@ compile-flags: -C opt-level=3 + +#![crate_type = "lib"] + +// CHECK-LABEL: @foo +// CHECK-NOT: panic_bounds_check +#[no_mangle] +pub fn foo(buf: &[u8], alloced_size: usize) -> &[u8] { + if alloced_size.checked_add(1).map(|total| buf.len() < total).unwrap_or(true) { + return &[]; + } + let size = buf[0]; + &buf[1..1 + usize::min(alloced_size, usize::from(size))] +} diff --git a/tests/codegen-llvm/gdb_debug_script_load.rs b/tests/codegen-llvm/gdb_debug_script_load.rs index 3e92eba10b1..90f2be41cf2 100644 --- a/tests/codegen-llvm/gdb_debug_script_load.rs +++ b/tests/codegen-llvm/gdb_debug_script_load.rs @@ -9,6 +9,8 @@ #![feature(lang_items)] #![no_std] +// CHECK: @llvm.used = {{.+}} @__rustc_debug_gdb_scripts_section + #[panic_handler] fn panic_handler(_: &core::panic::PanicInfo) -> ! { loop {} @@ -22,7 +24,7 @@ extern "C" fn rust_eh_personality() { // Needs rustc to generate `main` as that's where the magic load is inserted. // IOW, we cannot write this test with `#![no_main]`. // CHECK-LABEL: @main -// CHECK: load volatile i8, {{.+}} @__rustc_debug_gdb_scripts_section__ +// CHECK: load volatile i8, {{.+}} @__rustc_debug_gdb_scripts_section #[lang = "start"] fn lang_start<T: 'static>( diff --git a/tests/codegen-llvm/simd/extract-insert-dyn.rs b/tests/codegen-llvm/simd/extract-insert-dyn.rs index 729f0145314..9c17b82e553 100644 --- a/tests/codegen-llvm/simd/extract-insert-dyn.rs +++ b/tests/codegen-llvm/simd/extract-insert-dyn.rs @@ -5,7 +5,8 @@ repr_simd, arm_target_feature, mips_target_feature, - s390x_target_feature + s390x_target_feature, + riscv_target_feature )] #![no_std] #![crate_type = "lib"] @@ -25,97 +26,105 @@ pub struct u32x16([u32; 16]); pub struct i8x16([i8; 16]); // CHECK-LABEL: dyn_simd_extract -// CHECK: extractelement <16 x i8> %x, i32 %idx +// CHECK: extractelement <16 x i8> %[[TEMP:.+]], i32 %idx #[no_mangle] #[cfg_attr(target_family = "wasm", target_feature(enable = "simd128"))] #[cfg_attr(target_arch = "arm", target_feature(enable = "neon"))] #[cfg_attr(target_arch = "x86", target_feature(enable = "sse"))] #[cfg_attr(target_arch = "mips", target_feature(enable = "msa"))] #[cfg_attr(target_arch = "s390x", target_feature(enable = "vector"))] +#[cfg_attr(target_arch = "riscv64", target_feature(enable = "v"))] unsafe extern "C" fn dyn_simd_extract(x: i8x16, idx: u32) -> i8 { simd_extract_dyn(x, idx) } // CHECK-LABEL: literal_dyn_simd_extract -// CHECK: extractelement <16 x i8> %x, i32 7 +// CHECK: extractelement <16 x i8> %[[TEMP:.+]], i32 7 #[no_mangle] #[cfg_attr(target_family = "wasm", target_feature(enable = "simd128"))] #[cfg_attr(target_arch = "arm", target_feature(enable = "neon"))] #[cfg_attr(target_arch = "x86", target_feature(enable = "sse"))] #[cfg_attr(target_arch = "mips", target_feature(enable = "msa"))] #[cfg_attr(target_arch = "s390x", target_feature(enable = "vector"))] +#[cfg_attr(target_arch = "riscv64", target_feature(enable = "v"))] unsafe extern "C" fn literal_dyn_simd_extract(x: i8x16) -> i8 { simd_extract_dyn(x, 7) } // CHECK-LABEL: const_dyn_simd_extract -// CHECK: extractelement <16 x i8> %x, i32 7 +// CHECK: extractelement <16 x i8> %[[TEMP:.+]], i32 7 #[no_mangle] #[cfg_attr(target_family = "wasm", target_feature(enable = "simd128"))] #[cfg_attr(target_arch = "arm", target_feature(enable = "neon"))] #[cfg_attr(target_arch = "x86", target_feature(enable = "sse"))] #[cfg_attr(target_arch = "mips", target_feature(enable = "msa"))] #[cfg_attr(target_arch = "s390x", target_feature(enable = "vector"))] +#[cfg_attr(target_arch = "riscv64", target_feature(enable = "v"))] unsafe extern "C" fn const_dyn_simd_extract(x: i8x16) -> i8 { simd_extract_dyn(x, const { 3 + 4 }) } // CHECK-LABEL: const_simd_extract -// CHECK: extractelement <16 x i8> %x, i32 7 +// CHECK: extractelement <16 x i8> %[[TEMP:.+]], i32 7 #[no_mangle] #[cfg_attr(target_family = "wasm", target_feature(enable = "simd128"))] #[cfg_attr(target_arch = "arm", target_feature(enable = "neon"))] #[cfg_attr(target_arch = "x86", target_feature(enable = "sse"))] #[cfg_attr(target_arch = "mips", target_feature(enable = "msa"))] #[cfg_attr(target_arch = "s390x", target_feature(enable = "vector"))] +#[cfg_attr(target_arch = "riscv64", target_feature(enable = "v"))] unsafe extern "C" fn const_simd_extract(x: i8x16) -> i8 { simd_extract(x, const { 3 + 4 }) } // CHECK-LABEL: dyn_simd_insert -// CHECK: insertelement <16 x i8> %x, i8 %e, i32 %idx +// CHECK: insertelement <16 x i8> %[[TEMP:.+]], i8 %e, i32 %idx #[no_mangle] #[cfg_attr(target_family = "wasm", target_feature(enable = "simd128"))] #[cfg_attr(target_arch = "arm", target_feature(enable = "neon"))] #[cfg_attr(target_arch = "x86", target_feature(enable = "sse"))] #[cfg_attr(target_arch = "mips", target_feature(enable = "msa"))] #[cfg_attr(target_arch = "s390x", target_feature(enable = "vector"))] +#[cfg_attr(target_arch = "riscv64", target_feature(enable = "v"))] unsafe extern "C" fn dyn_simd_insert(x: i8x16, e: i8, idx: u32) -> i8x16 { simd_insert_dyn(x, idx, e) } // CHECK-LABEL: literal_dyn_simd_insert -// CHECK: insertelement <16 x i8> %x, i8 %e, i32 7 +// CHECK: insertelement <16 x i8> %[[TEMP:.+]], i8 %e, i32 7 #[no_mangle] #[cfg_attr(target_family = "wasm", target_feature(enable = "simd128"))] #[cfg_attr(target_arch = "arm", target_feature(enable = "neon"))] #[cfg_attr(target_arch = "x86", target_feature(enable = "sse"))] #[cfg_attr(target_arch = "mips", target_feature(enable = "msa"))] #[cfg_attr(target_arch = "s390x", target_feature(enable = "vector"))] +#[cfg_attr(target_arch = "riscv64", target_feature(enable = "v"))] unsafe extern "C" fn literal_dyn_simd_insert(x: i8x16, e: i8) -> i8x16 { simd_insert_dyn(x, 7, e) } // CHECK-LABEL: const_dyn_simd_insert -// CHECK: insertelement <16 x i8> %x, i8 %e, i32 7 +// CHECK: insertelement <16 x i8> %[[TEMP:.+]], i8 %e, i32 7 #[no_mangle] #[cfg_attr(target_family = "wasm", target_feature(enable = "simd128"))] #[cfg_attr(target_arch = "arm", target_feature(enable = "neon"))] #[cfg_attr(target_arch = "x86", target_feature(enable = "sse"))] #[cfg_attr(target_arch = "mips", target_feature(enable = "msa"))] #[cfg_attr(target_arch = "s390x", target_feature(enable = "vector"))] +#[cfg_attr(target_arch = "riscv64", target_feature(enable = "v"))] unsafe extern "C" fn const_dyn_simd_insert(x: i8x16, e: i8) -> i8x16 { simd_insert_dyn(x, const { 3 + 4 }, e) } // CHECK-LABEL: const_simd_insert -// CHECK: insertelement <16 x i8> %x, i8 %e, i32 7 +// CHECK: insertelement <16 x i8> %[[TEMP:.+]], i8 %e, i32 7 #[no_mangle] #[cfg_attr(target_family = "wasm", target_feature(enable = "simd128"))] #[cfg_attr(target_arch = "arm", target_feature(enable = "neon"))] #[cfg_attr(target_arch = "x86", target_feature(enable = "sse"))] #[cfg_attr(target_arch = "mips", target_feature(enable = "msa"))] #[cfg_attr(target_arch = "s390x", target_feature(enable = "vector"))] +#[cfg_attr(target_arch = "riscv64", target_feature(enable = "v"))] unsafe extern "C" fn const_simd_insert(x: i8x16, e: i8) -> i8x16 { simd_insert(x, const { 3 + 4 }, e) } diff --git a/tests/coverage/async_closure.cov-map b/tests/coverage/async_closure.cov-map index 9f8dc8d6cbb..53128dd7a48 100644 --- a/tests/coverage/async_closure.cov-map +++ b/tests/coverage/async_closure.cov-map @@ -37,32 +37,29 @@ Number of file 0 mappings: 8 Highest counter ID seen: c0 Function name: async_closure::main::{closure#0} -Raw bytes (14): 0x[01, 01, 00, 02, 01, 0b, 22, 00, 23, 01, 00, 23, 00, 24] +Raw bytes (9): 0x[01, 01, 00, 01, 01, 0b, 22, 00, 24] Number of files: 1 - file 0 => $DIR/async_closure.rs Number of expressions: 0 -Number of file 0 mappings: 2 -- Code(Counter(0)) at (prev + 11, 34) to (start + 0, 35) -- Code(Counter(0)) at (prev + 0, 35) to (start + 0, 36) +Number of file 0 mappings: 1 +- Code(Counter(0)) at (prev + 11, 34) to (start + 0, 36) Highest counter ID seen: c0 Function name: async_closure::main::{closure#0} -Raw bytes (14): 0x[01, 01, 00, 02, 01, 0b, 22, 00, 23, 01, 00, 23, 00, 24] +Raw bytes (9): 0x[01, 01, 00, 01, 01, 0b, 22, 00, 24] Number of files: 1 - file 0 => $DIR/async_closure.rs Number of expressions: 0 -Number of file 0 mappings: 2 -- Code(Counter(0)) at (prev + 11, 34) to (start + 0, 35) -- Code(Counter(0)) at (prev + 0, 35) to (start + 0, 36) +Number of file 0 mappings: 1 +- Code(Counter(0)) at (prev + 11, 34) to (start + 0, 36) Highest counter ID seen: c0 Function name: async_closure::main::{closure#0}::{closure#0}::<i16> -Raw bytes (14): 0x[01, 01, 00, 02, 01, 0b, 22, 00, 23, 01, 00, 23, 00, 24] +Raw bytes (9): 0x[01, 01, 00, 01, 01, 0b, 22, 00, 24] Number of files: 1 - file 0 => $DIR/async_closure.rs Number of expressions: 0 -Number of file 0 mappings: 2 -- Code(Counter(0)) at (prev + 11, 34) to (start + 0, 35) -- Code(Counter(0)) at (prev + 0, 35) to (start + 0, 36) +Number of file 0 mappings: 1 +- Code(Counter(0)) at (prev + 11, 34) to (start + 0, 36) Highest counter ID seen: c0 diff --git a/tests/coverage/branch/no-mir-spans.cov-map b/tests/coverage/branch/no-mir-spans.cov-map deleted file mode 100644 index 4f893cba1f8..00000000000 --- a/tests/coverage/branch/no-mir-spans.cov-map +++ /dev/null @@ -1,63 +0,0 @@ -Function name: no_mir_spans::while_cond -Raw bytes (18): 0x[01, 01, 01, 05, 01, 02, 01, 10, 01, 00, 10, 20, 02, 01, 04, 0b, 00, 10] -Number of files: 1 -- file 0 => $DIR/no-mir-spans.rs -Number of expressions: 1 -- expression 0 operands: lhs = Counter(1), rhs = Counter(0) -Number of file 0 mappings: 2 -- Code(Counter(0)) at (prev + 16, 1) to (start + 0, 16) -- Branch { true: Expression(0, Sub), false: Counter(0) } at (prev + 4, 11) to (start + 0, 16) - true = (c1 - c0) - false = c0 -Highest counter ID seen: c0 - -Function name: no_mir_spans::while_cond_not -Raw bytes (18): 0x[01, 01, 01, 05, 01, 02, 01, 19, 01, 00, 14, 20, 02, 01, 04, 0b, 00, 14] -Number of files: 1 -- file 0 => $DIR/no-mir-spans.rs -Number of expressions: 1 -- expression 0 operands: lhs = Counter(1), rhs = Counter(0) -Number of file 0 mappings: 2 -- Code(Counter(0)) at (prev + 25, 1) to (start + 0, 20) -- Branch { true: Expression(0, Sub), false: Counter(0) } at (prev + 4, 11) to (start + 0, 20) - true = (c1 - c0) - false = c0 -Highest counter ID seen: c0 - -Function name: no_mir_spans::while_op_and -Raw bytes (31): 0x[01, 01, 04, 09, 05, 09, 01, 0f, 09, 01, 05, 03, 01, 22, 01, 00, 12, 20, 05, 02, 05, 0b, 00, 10, 20, 06, 0a, 00, 14, 00, 19] -Number of files: 1 -- file 0 => $DIR/no-mir-spans.rs -Number of expressions: 4 -- expression 0 operands: lhs = Counter(2), rhs = Counter(1) -- expression 1 operands: lhs = Counter(2), rhs = Counter(0) -- expression 2 operands: lhs = Expression(3, Add), rhs = Counter(2) -- expression 3 operands: lhs = Counter(0), rhs = Counter(1) -Number of file 0 mappings: 3 -- Code(Counter(0)) at (prev + 34, 1) to (start + 0, 18) -- Branch { true: Counter(1), false: Expression(0, Sub) } at (prev + 5, 11) to (start + 0, 16) - true = c1 - false = (c2 - c1) -- Branch { true: Expression(1, Sub), false: Expression(2, Sub) } at (prev + 0, 20) to (start + 0, 25) - true = (c2 - c0) - false = ((c0 + c1) - c2) -Highest counter ID seen: c1 - -Function name: no_mir_spans::while_op_or -Raw bytes (29): 0x[01, 01, 03, 09, 05, 09, 0b, 01, 05, 03, 01, 2d, 01, 00, 11, 20, 05, 02, 05, 0b, 00, 10, 20, 06, 01, 00, 14, 00, 19] -Number of files: 1 -- file 0 => $DIR/no-mir-spans.rs -Number of expressions: 3 -- expression 0 operands: lhs = Counter(2), rhs = Counter(1) -- expression 1 operands: lhs = Counter(2), rhs = Expression(2, Add) -- expression 2 operands: lhs = Counter(0), rhs = Counter(1) -Number of file 0 mappings: 3 -- Code(Counter(0)) at (prev + 45, 1) to (start + 0, 17) -- Branch { true: Counter(1), false: Expression(0, Sub) } at (prev + 5, 11) to (start + 0, 16) - true = c1 - false = (c2 - c1) -- Branch { true: Expression(1, Sub), false: Counter(0) } at (prev + 0, 20) to (start + 0, 25) - true = (c2 - (c0 + c1)) - false = c0 -Highest counter ID seen: c1 - diff --git a/tests/coverage/branch/no-mir-spans.coverage b/tests/coverage/branch/no-mir-spans.coverage deleted file mode 100644 index 2cae98ed3ff..00000000000 --- a/tests/coverage/branch/no-mir-spans.coverage +++ /dev/null @@ -1,77 +0,0 @@ - LL| |#![feature(coverage_attribute)] - LL| |//@ edition: 2021 - LL| |//@ compile-flags: -Zcoverage-options=branch,no-mir-spans - LL| |//@ llvm-cov-flags: --show-branches=count - LL| | - LL| |// Tests the behaviour of the `-Zcoverage-options=no-mir-spans` debugging flag. - LL| |// The actual code below is just some non-trivial code copied from another test - LL| |// (`while.rs`), and has no particular significance. - LL| | - LL| |macro_rules! no_merge { - LL| | () => { - LL| | for _ in 0..1 {} - LL| | }; - LL| |} - LL| | - LL| 1|fn while_cond() { - LL| | no_merge!(); - LL| | - LL| | let mut a = 8; - LL| | while a > 0 { - ------------------ - | Branch (LL:11): [True: 8, False: 1] - ------------------ - LL| | a -= 1; - LL| | } - LL| |} - LL| | - LL| 1|fn while_cond_not() { - LL| | no_merge!(); - LL| | - LL| | let mut a = 8; - LL| | while !(a == 0) { - ------------------ - | Branch (LL:11): [True: 8, False: 1] - ------------------ - LL| | a -= 1; - LL| | } - LL| |} - LL| | - LL| 1|fn while_op_and() { - LL| | no_merge!(); - LL| | - LL| | let mut a = 8; - LL| | let mut b = 4; - LL| | while a > 0 && b > 0 { - ------------------ - | Branch (LL:11): [True: 5, False: 0] - | Branch (LL:20): [True: 4, False: 1] - ------------------ - LL| | a -= 1; - LL| | b -= 1; - LL| | } - LL| |} - LL| | - LL| 1|fn while_op_or() { - LL| | no_merge!(); - LL| | - LL| | let mut a = 4; - LL| | let mut b = 8; - LL| | while a > 0 || b > 0 { - ------------------ - | Branch (LL:11): [True: 4, False: 5] - | Branch (LL:20): [True: 4, False: 1] - ------------------ - LL| | a -= 1; - LL| | b -= 1; - LL| | } - LL| |} - LL| | - LL| |#[coverage(off)] - LL| |fn main() { - LL| | while_cond(); - LL| | while_cond_not(); - LL| | while_op_and(); - LL| | while_op_or(); - LL| |} - diff --git a/tests/coverage/branch/no-mir-spans.rs b/tests/coverage/branch/no-mir-spans.rs deleted file mode 100644 index acb268f2d45..00000000000 --- a/tests/coverage/branch/no-mir-spans.rs +++ /dev/null @@ -1,62 +0,0 @@ -#![feature(coverage_attribute)] -//@ edition: 2021 -//@ compile-flags: -Zcoverage-options=branch,no-mir-spans -//@ llvm-cov-flags: --show-branches=count - -// Tests the behaviour of the `-Zcoverage-options=no-mir-spans` debugging flag. -// The actual code below is just some non-trivial code copied from another test -// (`while.rs`), and has no particular significance. - -macro_rules! no_merge { - () => { - for _ in 0..1 {} - }; -} - -fn while_cond() { - no_merge!(); - - let mut a = 8; - while a > 0 { - a -= 1; - } -} - -fn while_cond_not() { - no_merge!(); - - let mut a = 8; - while !(a == 0) { - a -= 1; - } -} - -fn while_op_and() { - no_merge!(); - - let mut a = 8; - let mut b = 4; - while a > 0 && b > 0 { - a -= 1; - b -= 1; - } -} - -fn while_op_or() { - no_merge!(); - - let mut a = 4; - let mut b = 8; - while a > 0 || b > 0 { - a -= 1; - b -= 1; - } -} - -#[coverage(off)] -fn main() { - while_cond(); - while_cond_not(); - while_op_and(); - while_op_or(); -} diff --git a/tests/coverage/try-in-macro.attr.cov-map b/tests/coverage/try-in-macro.attr.cov-map index 7111e89637c..1b6c97cf145 100644 --- a/tests/coverage/try-in-macro.attr.cov-map +++ b/tests/coverage/try-in-macro.attr.cov-map @@ -1,12 +1,3 @@ -Function name: <try_in_macro::MyEnum as try_in_macro::Arbitrary>::try_size_hint -Raw bytes (9): 0x[01, 01, 00, 01, 00, 1e, 2a, 00, 2b] -Number of files: 1 -- file 0 => $DIR/try-in-macro.rs -Number of expressions: 0 -Number of file 0 mappings: 1 -- Code(Zero) at (prev + 30, 42) to (start + 0, 43) -Highest counter ID seen: (none) - Function name: try_in_macro::main Raw bytes (19): 0x[01, 01, 00, 03, 01, 29, 01, 00, 0a, 01, 01, 05, 00, 1a, 01, 01, 01, 00, 02] Number of files: 1 diff --git a/tests/coverage/try-in-macro.bang.cov-map b/tests/coverage/try-in-macro.bang.cov-map index 80bd91a993c..1b6c97cf145 100644 --- a/tests/coverage/try-in-macro.bang.cov-map +++ b/tests/coverage/try-in-macro.bang.cov-map @@ -1,12 +1,3 @@ -Function name: <try_in_macro::MyEnum as try_in_macro::Arbitrary>::try_size_hint -Raw bytes (9): 0x[01, 01, 00, 01, 00, 23, 1c, 00, 1d] -Number of files: 1 -- file 0 => $DIR/try-in-macro.rs -Number of expressions: 0 -Number of file 0 mappings: 1 -- Code(Zero) at (prev + 35, 28) to (start + 0, 29) -Highest counter ID seen: (none) - Function name: try_in_macro::main Raw bytes (19): 0x[01, 01, 00, 03, 01, 29, 01, 00, 0a, 01, 01, 05, 00, 1a, 01, 01, 01, 00, 02] Number of files: 1 diff --git a/tests/coverage/try-in-macro.derive.cov-map b/tests/coverage/try-in-macro.derive.cov-map index 6646b6693ba..1b6c97cf145 100644 --- a/tests/coverage/try-in-macro.derive.cov-map +++ b/tests/coverage/try-in-macro.derive.cov-map @@ -1,12 +1,3 @@ -Function name: <try_in_macro::MyEnum as try_in_macro::Arbitrary>::try_size_hint -Raw bytes (9): 0x[01, 01, 00, 01, 00, 26, 38, 00, 39] -Number of files: 1 -- file 0 => $DIR/try-in-macro.rs -Number of expressions: 0 -Number of file 0 mappings: 1 -- Code(Zero) at (prev + 38, 56) to (start + 0, 57) -Highest counter ID seen: (none) - Function name: try_in_macro::main Raw bytes (19): 0x[01, 01, 00, 03, 01, 29, 01, 00, 0a, 01, 01, 05, 00, 1a, 01, 01, 01, 00, 02] Number of files: 1 diff --git a/tests/crashes/139409.rs b/tests/crashes/139409.rs deleted file mode 100644 index 68cbfa153de..00000000000 --- a/tests/crashes/139409.rs +++ /dev/null @@ -1,12 +0,0 @@ -//@ known-bug: #139409 -//@ compile-flags: -Znext-solver=globally - -fn main() { - trait B<C> {} - impl<C> B<C> for () {} - trait D<C, E>: B<C> + B<E> { - fn f(&self) {} - } - impl<C, E> D<C, E> for () {} - (&() as &dyn D<&(), &()>).f() -} diff --git a/tests/debuginfo/associated-types.rs b/tests/debuginfo/associated-types.rs index b20bd520936..7c2a793c8cd 100644 --- a/tests/debuginfo/associated-types.rs +++ b/tests/debuginfo/associated-types.rs @@ -1,4 +1,5 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== // gdb-command:run @@ -68,8 +69,6 @@ #![allow(unused_variables)] #![allow(dead_code)] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] trait TraitWithAssocType { type Type; diff --git a/tests/debuginfo/auxiliary/cross_crate_spans.rs b/tests/debuginfo/auxiliary/cross_crate_spans.rs index af853ee0b00..d0d32c2cbe3 100644 --- a/tests/debuginfo/auxiliary/cross_crate_spans.rs +++ b/tests/debuginfo/auxiliary/cross_crate_spans.rs @@ -1,8 +1,6 @@ #![crate_type = "rlib"] #![allow(unused_variables)] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] //@ no-prefer-dynamic //@ compile-flags:-g diff --git a/tests/debuginfo/basic-stepping.rs b/tests/debuginfo/basic-stepping.rs new file mode 100644 index 00000000000..6e1344d22a5 --- /dev/null +++ b/tests/debuginfo/basic-stepping.rs @@ -0,0 +1,47 @@ +//! Test that stepping through a simple program with a debugger one line at a +//! time works intuitively, e.g. that `next` takes you to the next source line. +//! Regression test for <https://github.com/rust-lang/rust/issues/33013>. + +//@ ignore-aarch64: Doesn't work yet. +//@ compile-flags: -g + +// gdb-command: run +// FIXME(#97083): Should we be able to break on initialization of zero-sized types? +// FIXME(#97083): Right now the first breakable line is: +// gdb-check: let mut c = 27; +// gdb-command: next +// gdb-check: let d = c = 99; +// gdb-command: next +// FIXME(#33013): gdb-check: let e = "hi bob"; +// FIXME(#33013): gdb-command: next +// FIXME(#33013): gdb-check: let f = b"hi bob"; +// FIXME(#33013): gdb-command: next +// FIXME(#33013): gdb-check: let g = b'9'; +// FIXME(#33013): gdb-command: next +// FIXME(#33013): gdb-check: let h = ["whatever"; 8]; +// FIXME(#33013): gdb-command: next +// gdb-check: let i = [1,2,3,4]; +// gdb-command: next +// gdb-check: let j = (23, "hi"); +// gdb-command: next +// gdb-check: let k = 2..3; +// gdb-command: next +// gdb-check: let l = &i[k]; +// gdb-command: next +// gdb-check: let m: *const() = &a; + +fn main () { + let a = (); // #break + let b : [i32; 0] = []; + let mut c = 27; + let d = c = 99; + let e = "hi bob"; + let f = b"hi bob"; + let g = b'9'; + let h = ["whatever"; 8]; + let i = [1,2,3,4]; + let j = (23, "hi"); + let k = 2..3; + let l = &i[k]; + let m: *const() = &a; +} diff --git a/tests/debuginfo/basic-types-globals-metadata.rs b/tests/debuginfo/basic-types-globals-metadata.rs index aec8ff183ad..fc8f6dc173f 100644 --- a/tests/debuginfo/basic-types-globals-metadata.rs +++ b/tests/debuginfo/basic-types-globals-metadata.rs @@ -1,4 +1,5 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers // gdb-command:run // gdb-command:whatis basic_types_globals_metadata::B @@ -35,8 +36,6 @@ #![allow(unused_variables)] #![allow(dead_code)] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] #![feature(f16)] // N.B. These are `mut` only so they don't constant fold away. diff --git a/tests/debuginfo/basic-types-globals.rs b/tests/debuginfo/basic-types-globals.rs index 15a0deb64c1..9d28820ce68 100644 --- a/tests/debuginfo/basic-types-globals.rs +++ b/tests/debuginfo/basic-types-globals.rs @@ -1,6 +1,7 @@ //@ revisions: lto no-lto //@ compile-flags:-g +//@ disable-gdb-pretty-printers //@ [lto] compile-flags:-C lto //@ [lto] no-prefer-dynamic @@ -39,8 +40,6 @@ // gdb-command:continue #![allow(unused_variables)] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] #![feature(f16)] // N.B. These are `mut` only so they don't constant fold away. diff --git a/tests/debuginfo/basic-types-metadata.rs b/tests/debuginfo/basic-types-metadata.rs index 6b7cfbdebca..941db81a4de 100644 --- a/tests/debuginfo/basic-types-metadata.rs +++ b/tests/debuginfo/basic-types-metadata.rs @@ -1,4 +1,5 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers // gdb-command:run // gdb-command:whatis unit @@ -53,8 +54,6 @@ // gdb-command:continue #![allow(unused_variables)] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] #![feature(f16)] fn main() { diff --git a/tests/debuginfo/basic-types-mut-globals.rs b/tests/debuginfo/basic-types-mut-globals.rs index f6a2399d230..e979d82b55c 100644 --- a/tests/debuginfo/basic-types-mut-globals.rs +++ b/tests/debuginfo/basic-types-mut-globals.rs @@ -5,6 +5,7 @@ // its numerical value. //@ compile-flags:-g +//@ disable-gdb-pretty-printers // gdb-command:run @@ -74,8 +75,6 @@ // gdb-check:$30 = 9.25 #![allow(unused_variables)] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] #![feature(f16)] static mut B: bool = false; diff --git a/tests/debuginfo/basic-types.rs b/tests/debuginfo/basic-types.rs index fea5262bc41..7862f45b3c4 100644 --- a/tests/debuginfo/basic-types.rs +++ b/tests/debuginfo/basic-types.rs @@ -5,6 +5,7 @@ // its numerical value. //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -112,8 +113,6 @@ // cdb-check:s : [...] [Type: ref$<str$>] #![allow(unused_variables)] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] #![feature(f16)] fn main() { diff --git a/tests/debuginfo/borrowed-basic.rs b/tests/debuginfo/borrowed-basic.rs index 91de691e78e..334eae38318 100644 --- a/tests/debuginfo/borrowed-basic.rs +++ b/tests/debuginfo/borrowed-basic.rs @@ -1,4 +1,5 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -96,8 +97,6 @@ // lldb-check:[...] 3.5 #![allow(unused_variables)] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] #![feature(f16)] fn main() { diff --git a/tests/debuginfo/borrowed-c-style-enum.rs b/tests/debuginfo/borrowed-c-style-enum.rs index 6a91d4f9650..d382a389fe4 100644 --- a/tests/debuginfo/borrowed-c-style-enum.rs +++ b/tests/debuginfo/borrowed-c-style-enum.rs @@ -1,4 +1,5 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -28,8 +29,6 @@ // lldb-check:[...] TheC #![allow(unused_variables)] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] enum ABC { TheA, TheB, TheC } diff --git a/tests/debuginfo/borrowed-enum.rs b/tests/debuginfo/borrowed-enum.rs index c5a795fdede..517b439ff15 100644 --- a/tests/debuginfo/borrowed-enum.rs +++ b/tests/debuginfo/borrowed-enum.rs @@ -1,6 +1,7 @@ //@ min-lldb-version: 1800 //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -28,8 +29,6 @@ // lldb-check:(borrowed_enum::Univariant) *univariant_ref = { value = { 0 = 4820353753753434 } } #![allow(unused_variables)] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] // The first element is to ensure proper alignment, irrespective of the machines word size. Since // the size of the discriminant value is machine dependent, this has be taken into account when diff --git a/tests/debuginfo/borrowed-struct.rs b/tests/debuginfo/borrowed-struct.rs index 245af35f505..5d64ba3cbef 100644 --- a/tests/debuginfo/borrowed-struct.rs +++ b/tests/debuginfo/borrowed-struct.rs @@ -1,4 +1,5 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -52,8 +53,6 @@ // lldb-check:[...] 26.5 #![allow(unused_variables)] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] struct SomeStruct { x: isize, diff --git a/tests/debuginfo/borrowed-tuple.rs b/tests/debuginfo/borrowed-tuple.rs index 9e4ceec033e..fd4e22feb06 100644 --- a/tests/debuginfo/borrowed-tuple.rs +++ b/tests/debuginfo/borrowed-tuple.rs @@ -1,4 +1,5 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -29,8 +30,6 @@ #![allow(unused_variables)] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] fn main() { let stack_val: (i16, f32) = (-14, -19f32); diff --git a/tests/debuginfo/borrowed-unique-basic.rs b/tests/debuginfo/borrowed-unique-basic.rs index 7a9b4d1df82..54d7f27bb0c 100644 --- a/tests/debuginfo/borrowed-unique-basic.rs +++ b/tests/debuginfo/borrowed-unique-basic.rs @@ -1,4 +1,5 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -100,8 +101,6 @@ // lldb-check:[...] 3.5 #![allow(unused_variables)] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] #![feature(f16)] fn main() { diff --git a/tests/debuginfo/box.rs b/tests/debuginfo/box.rs index d22566c0b17..d4612f98a5f 100644 --- a/tests/debuginfo/box.rs +++ b/tests/debuginfo/box.rs @@ -1,4 +1,5 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -19,8 +20,6 @@ // lldb-check:[...] { 0 = 2 1 = 3.5 } #![allow(unused_variables)] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] fn main() { let a = Box::new(1); diff --git a/tests/debuginfo/boxed-struct.rs b/tests/debuginfo/boxed-struct.rs index 158609fb2ed..ca072693cdc 100644 --- a/tests/debuginfo/boxed-struct.rs +++ b/tests/debuginfo/boxed-struct.rs @@ -1,4 +1,5 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -22,8 +23,6 @@ // lldb-check:[...] { x = 77 y = 777 z = 7777 w = 77777 } #![allow(unused_variables)] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] struct StructWithSomePadding { x: i16, diff --git a/tests/debuginfo/by-value-non-immediate-argument.rs b/tests/debuginfo/by-value-non-immediate-argument.rs index deacea5f6cc..b5b0df73a68 100644 --- a/tests/debuginfo/by-value-non-immediate-argument.rs +++ b/tests/debuginfo/by-value-non-immediate-argument.rs @@ -1,6 +1,7 @@ //@ min-lldb-version: 1800 //@ min-gdb-version: 13.0 //@ compile-flags:-g +//@ disable-gdb-pretty-printers //@ ignore-windows-gnu: #128973 //@ ignore-aarch64-unknown-linux-gnu (gdb tries to read from 0x0; FIXME: #128973) //@ ignore-powerpc64: #128973 on both -gnu and -musl @@ -62,9 +63,6 @@ // lldb-check:[...] Case1 { x: 0, y: 8970181431921507452 } // lldb-command:continue -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] - #[derive(Clone)] struct Struct { a: isize, diff --git a/tests/debuginfo/by-value-self-argument-in-trait-impl.rs b/tests/debuginfo/by-value-self-argument-in-trait-impl.rs index 6981fdfc9e1..a49a375569b 100644 --- a/tests/debuginfo/by-value-self-argument-in-trait-impl.rs +++ b/tests/debuginfo/by-value-self-argument-in-trait-impl.rs @@ -1,4 +1,5 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -33,9 +34,6 @@ // lldb-check:[...] { 0 = 4444.5 1 = 5555 2 = 6666 3 = 7777.5 } // lldb-command:continue -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] - trait Trait { fn method(self) -> Self; } diff --git a/tests/debuginfo/c-style-enum-in-composite.rs b/tests/debuginfo/c-style-enum-in-composite.rs index 642879cf3b6..47b4b980f9c 100644 --- a/tests/debuginfo/c-style-enum-in-composite.rs +++ b/tests/debuginfo/c-style-enum-in-composite.rs @@ -1,4 +1,5 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -51,8 +52,6 @@ // lldb-check:[...] { 0 = { a = OneHundred b = Vienna } 1 = 9 } #![allow(unused_variables)] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] use self::AnEnum::{OneHundred, OneThousand, OneMillion}; use self::AnotherEnum::{MountainView, Toronto, Vienna}; diff --git a/tests/debuginfo/c-style-enum.rs b/tests/debuginfo/c-style-enum.rs index 08378f7af18..d5455be0cb5 100644 --- a/tests/debuginfo/c-style-enum.rs +++ b/tests/debuginfo/c-style-enum.rs @@ -1,6 +1,7 @@ //@ ignore-aarch64 //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -88,8 +89,6 @@ #![allow(unused_variables)] #![allow(dead_code)] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] use self::AutoDiscriminant::{One, Two, Three}; use self::ManualDiscriminant::{OneHundred, OneThousand, OneMillion}; diff --git a/tests/debuginfo/closure-in-generic-function.rs b/tests/debuginfo/closure-in-generic-function.rs index 0c6a6fdfca1..0bb72209cc8 100644 --- a/tests/debuginfo/closure-in-generic-function.rs +++ b/tests/debuginfo/closure-in-generic-function.rs @@ -1,4 +1,5 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -33,9 +34,6 @@ // lldb-check:[...] 110 // lldb-command:continue -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] - fn some_generic_fun<T1, T2>(a: T1, b: T2) -> (T2, T1) { let closure = |x, y| { diff --git a/tests/debuginfo/constant-debug-locs.rs b/tests/debuginfo/constant-debug-locs.rs index 81115fc3c38..d13b8648b18 100644 --- a/tests/debuginfo/constant-debug-locs.rs +++ b/tests/debuginfo/constant-debug-locs.rs @@ -1,8 +1,7 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers #![allow(dead_code, unused_variables)] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] // This test makes sure that the compiler doesn't crash when trying to assign // debug locations to const-expressions. diff --git a/tests/debuginfo/constant-in-match-pattern.rs b/tests/debuginfo/constant-in-match-pattern.rs index 952db216deb..922e0a5d8da 100644 --- a/tests/debuginfo/constant-in-match-pattern.rs +++ b/tests/debuginfo/constant-in-match-pattern.rs @@ -1,8 +1,7 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers #![allow(dead_code, unused_variables)] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] // This test makes sure that the compiler doesn't crash when trying to assign // debug locations to 'constant' patterns in match expressions. diff --git a/tests/debuginfo/coroutine-locals.rs b/tests/debuginfo/coroutine-locals.rs index f3593adc945..c2b8aef8a67 100644 --- a/tests/debuginfo/coroutine-locals.rs +++ b/tests/debuginfo/coroutine-locals.rs @@ -1,4 +1,5 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -44,8 +45,7 @@ // lldb-command:v c // lldb-check:(int) c = 6 -#![feature(omit_gdb_pretty_printer_section, coroutines, coroutine_trait, stmt_expr_attributes)] -#![omit_gdb_pretty_printer_section] +#![feature(coroutines, coroutine_trait, stmt_expr_attributes)] use std::ops::Coroutine; use std::pin::Pin; diff --git a/tests/debuginfo/coroutine-objects.rs b/tests/debuginfo/coroutine-objects.rs index 242c76c2989..7ead154cbdb 100644 --- a/tests/debuginfo/coroutine-objects.rs +++ b/tests/debuginfo/coroutine-objects.rs @@ -5,6 +5,7 @@ // ensure that LLDB won't crash at least (like #57822). //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -53,8 +54,7 @@ // cdb-check: b : Returned [Type: enum2$<coroutine_objects::main::coroutine_env$0>] // cdb-check: [+0x[...]] _ref__a : 0x[...] : 6 [Type: int *] -#![feature(omit_gdb_pretty_printer_section, coroutines, coroutine_trait, stmt_expr_attributes)] -#![omit_gdb_pretty_printer_section] +#![feature(coroutines, coroutine_trait, stmt_expr_attributes)] use std::ops::Coroutine; use std::pin::Pin; diff --git a/tests/debuginfo/cross-crate-spans.rs b/tests/debuginfo/cross-crate-spans.rs index e337aaf5a6c..38176e46909 100644 --- a/tests/debuginfo/cross-crate-spans.rs +++ b/tests/debuginfo/cross-crate-spans.rs @@ -1,15 +1,13 @@ -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] - //@ aux-build:cross_crate_spans.rs extern crate cross_crate_spans; //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== -// gdb-command:break cross_crate_spans.rs:14 +// gdb-command:break cross_crate_spans.rs:12 // gdb-command:run // gdb-command:print result @@ -32,7 +30,7 @@ extern crate cross_crate_spans; // === LLDB TESTS ================================================================================== -// lldb-command:b cross_crate_spans.rs:14 +// lldb-command:b cross_crate_spans.rs:12 // lldb-command:run // lldb-command:v result diff --git a/tests/debuginfo/destructured-fn-argument.rs b/tests/debuginfo/destructured-fn-argument.rs index 37a7bb2b778..fe8f91588e0 100644 --- a/tests/debuginfo/destructured-fn-argument.rs +++ b/tests/debuginfo/destructured-fn-argument.rs @@ -1,4 +1,5 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -299,8 +300,6 @@ #![allow(unused_variables)] #![feature(box_patterns)] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] use self::Univariant::Unit; diff --git a/tests/debuginfo/destructured-for-loop-variable.rs b/tests/debuginfo/destructured-for-loop-variable.rs index cc16be1268a..01c524083da 100644 --- a/tests/debuginfo/destructured-for-loop-variable.rs +++ b/tests/debuginfo/destructured-for-loop-variable.rs @@ -1,4 +1,5 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -141,8 +142,6 @@ #![allow(unused_variables)] #![feature(box_patterns)] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] struct Struct { x: i16, diff --git a/tests/debuginfo/destructured-local.rs b/tests/debuginfo/destructured-local.rs index fad96ca7d4b..ff24c924aad 100644 --- a/tests/debuginfo/destructured-local.rs +++ b/tests/debuginfo/destructured-local.rs @@ -1,4 +1,5 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -232,8 +233,6 @@ #![allow(unused_variables)] #![feature(box_patterns)] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] use self::Univariant::Unit; diff --git a/tests/debuginfo/embedded-visualizer.rs b/tests/debuginfo/embedded-visualizer.rs index cbd8691394d..12d87be7c66 100644 --- a/tests/debuginfo/embedded-visualizer.rs +++ b/tests/debuginfo/embedded-visualizer.rs @@ -1,6 +1,8 @@ //@ compile-flags:-g //@ ignore-lldb //@ ignore-windows-gnu: #128981 +//@ ignore-musl: linker too old in CI +//@ ignore-i586-unknown-linux-gnu: linker too old in CI // === CDB TESTS ================================================================================== diff --git a/tests/debuginfo/enum-thinlto.rs b/tests/debuginfo/enum-thinlto.rs index af77145c312..6eb33b2ef46 100644 --- a/tests/debuginfo/enum-thinlto.rs +++ b/tests/debuginfo/enum-thinlto.rs @@ -1,5 +1,6 @@ //@ min-lldb-version: 1800 //@ compile-flags:-g -Z thinlto +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -16,8 +17,6 @@ // lldb-check:(enum_thinlto::ABC) *abc = { value = { x = 0 y = 8970181431921507452 } $discr$ = 0 } #![allow(unused_variables)] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] // The first element is to ensure proper alignment, irrespective of the machines word size. Since // the size of the discriminant value is machine dependent, this has be taken into account when diff --git a/tests/debuginfo/evec-in-struct.rs b/tests/debuginfo/evec-in-struct.rs index 303669cf06c..f08c436bbe3 100644 --- a/tests/debuginfo/evec-in-struct.rs +++ b/tests/debuginfo/evec-in-struct.rs @@ -1,4 +1,5 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -38,8 +39,6 @@ // lldb-check:[...] { x = { [0] = 22 [1] = 23 } y = { [0] = 24 [1] = 25 } } #![allow(unused_variables)] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] struct NoPadding1 { x: [u32; 3], diff --git a/tests/debuginfo/extern-c-fn.rs b/tests/debuginfo/extern-c-fn.rs index 4642073faab..7130658f2d8 100644 --- a/tests/debuginfo/extern-c-fn.rs +++ b/tests/debuginfo/extern-c-fn.rs @@ -1,4 +1,5 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== // gdb-command:run @@ -32,9 +33,6 @@ #![allow(unused_variables)] #![allow(dead_code)] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] - #[no_mangle] pub unsafe extern "C" fn fn_with_c_abi(s: *const u8, len: i32) -> i32 { diff --git a/tests/debuginfo/function-arg-initialization.rs b/tests/debuginfo/function-arg-initialization.rs index ae54d56623c..03fb1e2d062 100644 --- a/tests/debuginfo/function-arg-initialization.rs +++ b/tests/debuginfo/function-arg-initialization.rs @@ -8,6 +8,7 @@ //@ min-lldb-version: 1800 //@ compile-flags:-g -Zmir-enable-passes=-SingleUseConsts // SingleUseConsts shouldn't need to be disabled, see #128945 +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -214,8 +215,6 @@ #![allow(unused_variables)] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] fn immediate_args(a: isize, b: bool, c: f64) { zzz(); // #break diff --git a/tests/debuginfo/function-arguments.rs b/tests/debuginfo/function-arguments.rs index 21c0c7d859c..64d026a705b 100644 --- a/tests/debuginfo/function-arguments.rs +++ b/tests/debuginfo/function-arguments.rs @@ -1,4 +1,5 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -32,10 +33,6 @@ // lldb-check:[...] 3000 // lldb-command:continue - -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] - fn main() { fun(111102, true); diff --git a/tests/debuginfo/function-names.rs b/tests/debuginfo/function-names.rs index c51884451e5..b5aec5c595e 100644 --- a/tests/debuginfo/function-names.rs +++ b/tests/debuginfo/function-names.rs @@ -2,6 +2,7 @@ //@ min-gdb-version: 10.1 //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -78,8 +79,6 @@ // cdb-check:[...] a!function_names::const_generic_fn_bool<false> (void) #![allow(unused_variables)] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] #![feature(adt_const_params, coroutines, coroutine_trait, stmt_expr_attributes)] #![allow(incomplete_features)] diff --git a/tests/debuginfo/function-prologue-stepping-regular.rs b/tests/debuginfo/function-prologue-stepping-regular.rs index 07b9356fb50..f61128ca2df 100644 --- a/tests/debuginfo/function-prologue-stepping-regular.rs +++ b/tests/debuginfo/function-prologue-stepping-regular.rs @@ -4,6 +4,7 @@ //@ min-lldb-version: 1800 //@ ignore-gdb //@ compile-flags:-g +//@ disable-gdb-pretty-printers // lldb-command:breakpoint set --name immediate_args // lldb-command:breakpoint set --name non_immediate_args @@ -116,8 +117,6 @@ // lldb-command:continue #![allow(unused_variables)] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] fn immediate_args(a: isize, b: bool, c: f64) { () diff --git a/tests/debuginfo/gdb-char.rs b/tests/debuginfo/gdb-char.rs index 7d8608d4f51..d296e675fa3 100644 --- a/tests/debuginfo/gdb-char.rs +++ b/tests/debuginfo/gdb-char.rs @@ -3,6 +3,7 @@ //@ min-gdb-version: 11.2 //@ compile-flags: -g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -11,8 +12,6 @@ // gdb-check:$1 = 97 'a' #![allow(unused_variables)] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] fn main() { let ch: char = 'a'; diff --git a/tests/debuginfo/generic-enum-with-different-disr-sizes.rs b/tests/debuginfo/generic-enum-with-different-disr-sizes.rs index e723543a37b..5c5f05d9c4b 100644 --- a/tests/debuginfo/generic-enum-with-different-disr-sizes.rs +++ b/tests/debuginfo/generic-enum-with-different-disr-sizes.rs @@ -1,6 +1,7 @@ //@ ignore-lldb: FIXME(#27089) //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== // gdb-command:run @@ -57,8 +58,6 @@ #![allow(unused_variables)] #![allow(dead_code)] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] // This test case makes sure that we get correct type descriptions for the enum // discriminant of different instantiations of the same generic enum type where, diff --git a/tests/debuginfo/generic-function.rs b/tests/debuginfo/generic-function.rs index 4be8d5ad45a..ab3cb6953ac 100644 --- a/tests/debuginfo/generic-function.rs +++ b/tests/debuginfo/generic-function.rs @@ -1,4 +1,5 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -44,9 +45,6 @@ // lldb-check:[...] { a = 6 b = 7.5 } // lldb-command:continue -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] - #[derive(Clone)] struct Struct { a: isize, diff --git a/tests/debuginfo/generic-functions-nested.rs b/tests/debuginfo/generic-functions-nested.rs index 7e0c20f8903..8ac2b8b9d7a 100644 --- a/tests/debuginfo/generic-functions-nested.rs +++ b/tests/debuginfo/generic-functions-nested.rs @@ -1,4 +1,5 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -57,10 +58,6 @@ // lldb-check:[...] 2.5 // lldb-command:continue - -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] - fn outer<TA: Clone>(a: TA) { inner(a.clone(), 1); inner(a.clone(), 2.5f64); diff --git a/tests/debuginfo/generic-method-on-generic-struct.rs b/tests/debuginfo/generic-method-on-generic-struct.rs index 9c587ca2839..36a94f2999d 100644 --- a/tests/debuginfo/generic-method-on-generic-struct.rs +++ b/tests/debuginfo/generic-method-on-generic-struct.rs @@ -1,4 +1,5 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -99,9 +100,6 @@ // lldb-check:[...] -10.5 // lldb-command:continue -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] - #[derive(Copy, Clone)] struct Struct<T> { x: T diff --git a/tests/debuginfo/generic-static-method-on-struct-and-enum.rs b/tests/debuginfo/generic-static-method-on-struct-and-enum.rs index 79fe2144cf4..09b515d69e4 100644 --- a/tests/debuginfo/generic-static-method-on-struct-and-enum.rs +++ b/tests/debuginfo/generic-static-method-on-struct-and-enum.rs @@ -1,4 +1,5 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers // gdb-command:run @@ -19,9 +20,6 @@ // gdb-command:continue -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] - struct Struct { x: isize } diff --git a/tests/debuginfo/generic-struct-style-enum.rs b/tests/debuginfo/generic-struct-style-enum.rs index a5529ab8027..4f580f8c515 100644 --- a/tests/debuginfo/generic-struct-style-enum.rs +++ b/tests/debuginfo/generic-struct-style-enum.rs @@ -1,4 +1,5 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers // gdb-command:set print union on // gdb-command:run @@ -16,9 +17,6 @@ // gdb-check:$4 = generic_struct_style_enum::Univariant<i32>::TheOnlyCase{a: -1} -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] - use self::Regular::{Case1, Case2, Case3}; use self::Univariant::TheOnlyCase; diff --git a/tests/debuginfo/generic-struct.rs b/tests/debuginfo/generic-struct.rs index f26d823d4f2..0196ca43544 100644 --- a/tests/debuginfo/generic-struct.rs +++ b/tests/debuginfo/generic-struct.rs @@ -1,4 +1,5 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -49,9 +50,6 @@ // cdb-check:[...]value [Type: generic_struct::AGenericStruct<i32,f64>] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] - struct AGenericStruct<TKey, TValue> { key: TKey, value: TValue diff --git a/tests/debuginfo/generic-tuple-style-enum.rs b/tests/debuginfo/generic-tuple-style-enum.rs index 4a5996645cb..719b5c6161f 100644 --- a/tests/debuginfo/generic-tuple-style-enum.rs +++ b/tests/debuginfo/generic-tuple-style-enum.rs @@ -1,4 +1,5 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -30,8 +31,6 @@ // lldb-command:v univariant -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] use self::Regular::{Case1, Case2, Case3}; use self::Univariant::TheOnlyCase; diff --git a/tests/debuginfo/include_string.rs b/tests/debuginfo/include_string.rs index 704b85e1ac2..4ec23b68262 100644 --- a/tests/debuginfo/include_string.rs +++ b/tests/debuginfo/include_string.rs @@ -2,6 +2,7 @@ // ^ test temporarily disabled as it fails under gdb 15 //@ compile-flags:-g +//@ disable-gdb-pretty-printers // gdb-command:run // gdb-command:print string1.length // gdb-check:$1 = 48 @@ -26,8 +27,6 @@ // lldb-command:continue #![allow(unused_variables)] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] // This test case makes sure that debug info does not ICE when include_str is // used multiple times (see issue #11322). diff --git a/tests/debuginfo/issue-12886.rs b/tests/debuginfo/issue-12886.rs index 48250e88537..5574294cd57 100644 --- a/tests/debuginfo/issue-12886.rs +++ b/tests/debuginfo/issue-12886.rs @@ -2,14 +2,13 @@ //@ ignore-aarch64 //@ compile-flags:-g +//@ disable-gdb-pretty-printers // gdb-command:run // gdb-command:next -// gdb-check:[...]23[...]let s = Some(5).unwrap(); // #break +// gdb-check:[...]22[...]let s = Some(5).unwrap(); // #break // gdb-command:continue -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] // IF YOU MODIFY THIS FILE, BE CAREFUL TO ADAPT THE LINE NUMBERS IN THE DEBUGGER COMMANDS diff --git a/tests/debuginfo/issue-22656.rs b/tests/debuginfo/issue-22656.rs index eb0b38cfa4d..3407c0524eb 100644 --- a/tests/debuginfo/issue-22656.rs +++ b/tests/debuginfo/issue-22656.rs @@ -5,6 +5,7 @@ //@ ignore-gdb //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === LLDB TESTS ================================================================================== // lldb-command:run @@ -16,8 +17,6 @@ #![allow(unused_variables)] #![allow(dead_code)] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] struct ZeroSizedStruct; diff --git a/tests/debuginfo/issue-57822.rs b/tests/debuginfo/issue-57822.rs index 7abac1c14d3..ba4e01196a4 100644 --- a/tests/debuginfo/issue-57822.rs +++ b/tests/debuginfo/issue-57822.rs @@ -3,6 +3,7 @@ //@ min-lldb-version: 1800 //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -24,8 +25,7 @@ // lldb-command:v b // lldb-check:(issue_57822::main::{coroutine_env#3}) b = { value = { a = { value = { y = 2 } $discr$ = '\x02' } } $discr$ = '\x02' } -#![feature(omit_gdb_pretty_printer_section, coroutines, coroutine_trait, stmt_expr_attributes)] -#![omit_gdb_pretty_printer_section] +#![feature(coroutines, coroutine_trait, stmt_expr_attributes)] use std::ops::Coroutine; use std::pin::Pin; diff --git a/tests/debuginfo/lexical-scope-in-for-loop.rs b/tests/debuginfo/lexical-scope-in-for-loop.rs index 08f244f89a0..f591f48ad59 100644 --- a/tests/debuginfo/lexical-scope-in-for-loop.rs +++ b/tests/debuginfo/lexical-scope-in-for-loop.rs @@ -1,4 +1,5 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -73,9 +74,6 @@ // lldb-check:[...] 1000000 // lldb-command:continue -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] - fn main() { let range = [1, 2, 3]; diff --git a/tests/debuginfo/lexical-scope-in-if.rs b/tests/debuginfo/lexical-scope-in-if.rs index c0e1f2f3e05..2b3a4ee5fc4 100644 --- a/tests/debuginfo/lexical-scope-in-if.rs +++ b/tests/debuginfo/lexical-scope-in-if.rs @@ -1,4 +1,5 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -121,9 +122,6 @@ // lldb-check:[...] -1 // lldb-command:continue -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] - fn main() { let x = 999; diff --git a/tests/debuginfo/lexical-scope-in-match.rs b/tests/debuginfo/lexical-scope-in-match.rs index 9169c19c6a3..0e369c6ca16 100644 --- a/tests/debuginfo/lexical-scope-in-match.rs +++ b/tests/debuginfo/lexical-scope-in-match.rs @@ -1,4 +1,5 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -113,9 +114,6 @@ // lldb-check:[...] 232 // lldb-command:continue -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] - struct Struct { x: isize, y: isize diff --git a/tests/debuginfo/lexical-scope-in-stack-closure.rs b/tests/debuginfo/lexical-scope-in-stack-closure.rs index d01162c39d6..483d5dda86c 100644 --- a/tests/debuginfo/lexical-scope-in-stack-closure.rs +++ b/tests/debuginfo/lexical-scope-in-stack-closure.rs @@ -1,4 +1,5 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -57,9 +58,6 @@ // lldb-check:[...] false // lldb-command:continue -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] - fn main() { let x = false; diff --git a/tests/debuginfo/lexical-scope-in-unconditional-loop.rs b/tests/debuginfo/lexical-scope-in-unconditional-loop.rs index dfec570218f..129d0b8c83d 100644 --- a/tests/debuginfo/lexical-scope-in-unconditional-loop.rs +++ b/tests/debuginfo/lexical-scope-in-unconditional-loop.rs @@ -1,4 +1,5 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -119,9 +120,6 @@ // lldb-check:[...] 2 // lldb-command:continue -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] - fn main() { let mut x = 0; diff --git a/tests/debuginfo/lexical-scope-in-unique-closure.rs b/tests/debuginfo/lexical-scope-in-unique-closure.rs index db84005121a..93bea18d7cd 100644 --- a/tests/debuginfo/lexical-scope-in-unique-closure.rs +++ b/tests/debuginfo/lexical-scope-in-unique-closure.rs @@ -1,4 +1,5 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -58,9 +59,6 @@ // lldb-command:continue -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] - fn main() { let x = false; diff --git a/tests/debuginfo/lexical-scope-in-while.rs b/tests/debuginfo/lexical-scope-in-while.rs index d6536d77545..5fe76851bd7 100644 --- a/tests/debuginfo/lexical-scope-in-while.rs +++ b/tests/debuginfo/lexical-scope-in-while.rs @@ -1,4 +1,5 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -119,9 +120,6 @@ // lldb-check:[...] 2 // lldb-command:continue -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] - fn main() { let mut x = 0; diff --git a/tests/debuginfo/lexical-scope-with-macro.rs b/tests/debuginfo/lexical-scope-with-macro.rs index 6e8fef201ea..efec9a3b1ce 100644 --- a/tests/debuginfo/lexical-scope-with-macro.rs +++ b/tests/debuginfo/lexical-scope-with-macro.rs @@ -1,4 +1,5 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -97,9 +98,6 @@ // lldb-check:[...] 400 // lldb-command:continue -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] - macro_rules! trivial { ($e1:expr) => ($e1) } diff --git a/tests/debuginfo/lexical-scopes-in-block-expression.rs b/tests/debuginfo/lexical-scopes-in-block-expression.rs index cd27c88db58..bec69ec87e8 100644 --- a/tests/debuginfo/lexical-scopes-in-block-expression.rs +++ b/tests/debuginfo/lexical-scopes-in-block-expression.rs @@ -1,4 +1,5 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -336,8 +337,6 @@ #![allow(unused_variables)] #![allow(unused_assignments)] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] static mut MUT_INT: isize = 0; diff --git a/tests/debuginfo/limited-debuginfo.rs b/tests/debuginfo/limited-debuginfo.rs index fb453d8078c..c3b516460aa 100644 --- a/tests/debuginfo/limited-debuginfo.rs +++ b/tests/debuginfo/limited-debuginfo.rs @@ -1,6 +1,7 @@ //@ ignore-lldb //@ compile-flags:-C debuginfo=1 +//@ disable-gdb-pretty-printers // Make sure functions have proper names // gdb-command:info functions @@ -18,8 +19,6 @@ #![allow(unused_variables)] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] struct Struct { a: i64, diff --git a/tests/debuginfo/method-on-enum.rs b/tests/debuginfo/method-on-enum.rs index 754b4a2dc26..f86cf8ccfdf 100644 --- a/tests/debuginfo/method-on-enum.rs +++ b/tests/debuginfo/method-on-enum.rs @@ -2,6 +2,7 @@ //@ min-gdb-version: 13.0 //@ compile-flags:-g +//@ disable-gdb-pretty-printers //@ ignore-windows-gnu: #128973 @@ -104,9 +105,6 @@ // lldb-check:[...] -10 // lldb-command:continue -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] - #[derive(Copy, Clone)] enum Enum { Variant1 { x: u16, y: u16 }, diff --git a/tests/debuginfo/method-on-generic-struct.rs b/tests/debuginfo/method-on-generic-struct.rs index 1e6c9d66178..5da952fa4e1 100644 --- a/tests/debuginfo/method-on-generic-struct.rs +++ b/tests/debuginfo/method-on-generic-struct.rs @@ -1,4 +1,5 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -99,9 +100,6 @@ // lldb-check:[...] -10 // lldb-command:continue -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] - #[derive(Copy, Clone)] struct Struct<T> { x: T diff --git a/tests/debuginfo/method-on-struct.rs b/tests/debuginfo/method-on-struct.rs index 91f609365e9..83badd8dbf0 100644 --- a/tests/debuginfo/method-on-struct.rs +++ b/tests/debuginfo/method-on-struct.rs @@ -1,4 +1,5 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -99,9 +100,6 @@ // lldb-check:[...] -10 // lldb-command:continue -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] - #[derive(Copy, Clone)] struct Struct { x: isize diff --git a/tests/debuginfo/method-on-trait.rs b/tests/debuginfo/method-on-trait.rs index 7b95e1f81c7..c91b255bd6a 100644 --- a/tests/debuginfo/method-on-trait.rs +++ b/tests/debuginfo/method-on-trait.rs @@ -1,4 +1,5 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -99,9 +100,6 @@ // lldb-check:[...] -10 // lldb-command:continue -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] - #[derive(Copy, Clone)] struct Struct { x: isize diff --git a/tests/debuginfo/method-on-tuple-struct.rs b/tests/debuginfo/method-on-tuple-struct.rs index 04c00d88302..7e6e724d42e 100644 --- a/tests/debuginfo/method-on-tuple-struct.rs +++ b/tests/debuginfo/method-on-tuple-struct.rs @@ -1,4 +1,5 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -99,9 +100,6 @@ // lldb-check:[...] -10 // lldb-command:continue -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] - #[derive(Copy, Clone)] struct TupleStruct(isize, f64); diff --git a/tests/debuginfo/multi-cgu.rs b/tests/debuginfo/multi-cgu.rs index 3bb5269adea..ca4146da405 100644 --- a/tests/debuginfo/multi-cgu.rs +++ b/tests/debuginfo/multi-cgu.rs @@ -2,6 +2,7 @@ // compiled with multiple codegen units. (see #39160) //@ compile-flags:-g -Ccodegen-units=2 +//@ disable-gdb-pretty-printers // === GDB TESTS =============================================================== @@ -29,9 +30,6 @@ // lldb-command:continue -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] - mod a { pub fn foo(xxx: u32) { super::_zzz(); // #break diff --git a/tests/debuginfo/multiple-functions-equal-var-names.rs b/tests/debuginfo/multiple-functions-equal-var-names.rs index 6ae9225d55c..2bc40b87e6f 100644 --- a/tests/debuginfo/multiple-functions-equal-var-names.rs +++ b/tests/debuginfo/multiple-functions-equal-var-names.rs @@ -1,4 +1,5 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -32,8 +33,6 @@ // lldb-check:[...] 30303 #![allow(unused_variables)] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] fn function_one() { let abc = 10101; diff --git a/tests/debuginfo/multiple-functions.rs b/tests/debuginfo/multiple-functions.rs index 3f7a0ded91b..5469408c78f 100644 --- a/tests/debuginfo/multiple-functions.rs +++ b/tests/debuginfo/multiple-functions.rs @@ -1,4 +1,5 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -32,8 +33,6 @@ // lldb-check:[...] 30303 #![allow(unused_variables)] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] fn function_one() { let a = 10101; diff --git a/tests/debuginfo/name-shadowing-and-scope-nesting.rs b/tests/debuginfo/name-shadowing-and-scope-nesting.rs index d3829b60713..e8d85473d86 100644 --- a/tests/debuginfo/name-shadowing-and-scope-nesting.rs +++ b/tests/debuginfo/name-shadowing-and-scope-nesting.rs @@ -1,4 +1,5 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -81,9 +82,6 @@ // lldb-check:[...] 20 // lldb-command:continue -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] - fn main() { let x = false; let y = true; diff --git a/tests/debuginfo/option-like-enum.rs b/tests/debuginfo/option-like-enum.rs index 72a41986dce..5a55b143fbb 100644 --- a/tests/debuginfo/option-like-enum.rs +++ b/tests/debuginfo/option-like-enum.rs @@ -2,6 +2,7 @@ //@ min-gdb-version: 13.0 //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -69,9 +70,6 @@ // lldb-check:[...] Nope -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] - // If a struct has exactly two variants, one of them is empty, and the other one // contains a non-nullable pointer, then this value is used as the discriminator. // The test cases in this file make sure that something readable is generated for diff --git a/tests/debuginfo/packed-struct-with-destructor.rs b/tests/debuginfo/packed-struct-with-destructor.rs index f923d36953c..0c5725ca25c 100644 --- a/tests/debuginfo/packed-struct-with-destructor.rs +++ b/tests/debuginfo/packed-struct-with-destructor.rs @@ -1,4 +1,5 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -60,8 +61,6 @@ #![allow(unused_variables)] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] #[repr(packed)] struct Packed { diff --git a/tests/debuginfo/packed-struct.rs b/tests/debuginfo/packed-struct.rs index 2b3652fe861..3bc39adee83 100644 --- a/tests/debuginfo/packed-struct.rs +++ b/tests/debuginfo/packed-struct.rs @@ -1,4 +1,5 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -46,8 +47,6 @@ // lldb-check:[...] 40 #![allow(unused_variables)] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] #[repr(packed)] struct Packed { diff --git a/tests/debuginfo/recursive-enum.rs b/tests/debuginfo/recursive-enum.rs index b861e6d617c..5fb339f54f3 100644 --- a/tests/debuginfo/recursive-enum.rs +++ b/tests/debuginfo/recursive-enum.rs @@ -1,14 +1,13 @@ //@ ignore-lldb //@ compile-flags:-g +//@ disable-gdb-pretty-printers // gdb-command:run // Test whether compiling a recursive enum definition crashes debug info generation. The test case // is taken from issue #11083 and #135093. #![allow(unused_variables)] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] pub struct Window<'a> { callbacks: WindowCallbacks<'a> diff --git a/tests/debuginfo/recursive-struct.rs b/tests/debuginfo/recursive-struct.rs index a97eb295eb4..5be90992848 100644 --- a/tests/debuginfo/recursive-struct.rs +++ b/tests/debuginfo/recursive-struct.rs @@ -1,6 +1,7 @@ //@ ignore-lldb //@ compile-flags:-g +//@ disable-gdb-pretty-printers // gdb-command:run @@ -58,8 +59,6 @@ // gdb-command:continue #![allow(unused_variables)] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] use self::Opt::{Empty, Val}; use std::boxed::Box as B; diff --git a/tests/debuginfo/reference-debuginfo.rs b/tests/debuginfo/reference-debuginfo.rs index 773c3ae4bc3..242da1dd654 100644 --- a/tests/debuginfo/reference-debuginfo.rs +++ b/tests/debuginfo/reference-debuginfo.rs @@ -3,6 +3,7 @@ // and leaves codegen to create a ladder of allocations so as `*a == b`. // //@ compile-flags:-g -Zmir-enable-passes=+ReferencePropagation,-ConstDebugInfo +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -106,8 +107,6 @@ // lldb-check:[...] 3.5 #![allow(unused_variables)] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] #![feature(f16)] fn main() { diff --git a/tests/debuginfo/self-in-default-method.rs b/tests/debuginfo/self-in-default-method.rs index 02fc01d96eb..4297129e0cf 100644 --- a/tests/debuginfo/self-in-default-method.rs +++ b/tests/debuginfo/self-in-default-method.rs @@ -1,4 +1,5 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -99,9 +100,6 @@ // lldb-check:[...] -10 // lldb-command:continue -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] - #[derive(Copy, Clone)] struct Struct { x: isize diff --git a/tests/debuginfo/self-in-generic-default-method.rs b/tests/debuginfo/self-in-generic-default-method.rs index 65018e549ee..e7ffa05f418 100644 --- a/tests/debuginfo/self-in-generic-default-method.rs +++ b/tests/debuginfo/self-in-generic-default-method.rs @@ -1,4 +1,5 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -99,9 +100,6 @@ // lldb-check:[...] -10.5 // lldb-command:continue -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] - #[derive(Copy, Clone)] struct Struct { x: isize diff --git a/tests/debuginfo/shadowed-argument.rs b/tests/debuginfo/shadowed-argument.rs index 3a575b4addf..3a0f0ad17a8 100644 --- a/tests/debuginfo/shadowed-argument.rs +++ b/tests/debuginfo/shadowed-argument.rs @@ -1,4 +1,5 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -46,9 +47,6 @@ // lldb-command:continue -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] - fn a_function(x: bool, y: bool) { zzz(); // #break sentinel(); diff --git a/tests/debuginfo/shadowed-variable.rs b/tests/debuginfo/shadowed-variable.rs index 752e4c233f1..6a658a7c494 100644 --- a/tests/debuginfo/shadowed-variable.rs +++ b/tests/debuginfo/shadowed-variable.rs @@ -1,4 +1,5 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -68,9 +69,6 @@ // lldb-check:[...] 20 // lldb-command:continue -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] - fn main() { let x = false; let y = true; diff --git a/tests/debuginfo/simd.rs b/tests/debuginfo/simd.rs index 12675a71a57..43cd7130b25 100644 --- a/tests/debuginfo/simd.rs +++ b/tests/debuginfo/simd.rs @@ -7,6 +7,7 @@ //@ ignore-s390x //@ compile-flags:-g +//@ disable-gdb-pretty-printers // gdb-command:run // gdb-command:print vi8x16 @@ -35,8 +36,6 @@ // gdb-command:continue #![allow(unused_variables)] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] #![feature(repr_simd)] #[repr(simd)] diff --git a/tests/debuginfo/simple-lexical-scope.rs b/tests/debuginfo/simple-lexical-scope.rs index 6008489bd65..64afcf8d61d 100644 --- a/tests/debuginfo/simple-lexical-scope.rs +++ b/tests/debuginfo/simple-lexical-scope.rs @@ -1,4 +1,5 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -66,9 +67,6 @@ // lldb-command:continue -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] - fn main() { let x = false; diff --git a/tests/debuginfo/simple-struct.rs b/tests/debuginfo/simple-struct.rs index bb6b2b79810..da09a8a3ce0 100644 --- a/tests/debuginfo/simple-struct.rs +++ b/tests/debuginfo/simple-struct.rs @@ -1,4 +1,5 @@ //@ compile-flags: -g -Zmir-enable-passes=-CheckAlignment +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -84,8 +85,6 @@ #![allow(unused_variables)] #![allow(dead_code)] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] struct NoPadding16 { x: u16, diff --git a/tests/debuginfo/simple-tuple.rs b/tests/debuginfo/simple-tuple.rs index 82467ef3bcf..f086472d725 100644 --- a/tests/debuginfo/simple-tuple.rs +++ b/tests/debuginfo/simple-tuple.rs @@ -1,4 +1,5 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -121,8 +122,6 @@ #![allow(unused_variables)] #![allow(dead_code)] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] static mut NO_PADDING_8: (i8, u8) = (-50, 50); static mut NO_PADDING_16: (i16, i16, u16) = (-1, 2, 3); diff --git a/tests/debuginfo/static-method-on-struct-and-enum.rs b/tests/debuginfo/static-method-on-struct-and-enum.rs index b487512a52f..2a3502712de 100644 --- a/tests/debuginfo/static-method-on-struct-and-enum.rs +++ b/tests/debuginfo/static-method-on-struct-and-enum.rs @@ -1,4 +1,5 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -41,9 +42,6 @@ // lldb-check:[...] 5 // lldb-command:continue -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] - struct Struct { x: isize } diff --git a/tests/debuginfo/strings-and-strs.rs b/tests/debuginfo/strings-and-strs.rs index 7d550408bec..392cf697e11 100644 --- a/tests/debuginfo/strings-and-strs.rs +++ b/tests/debuginfo/strings-and-strs.rs @@ -2,6 +2,7 @@ //@ min-lldb-version: 1800 //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== // gdb-command:run @@ -40,8 +41,6 @@ #![allow(unused_variables)] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] pub struct Foo<'a> { inner: &'a str, diff --git a/tests/debuginfo/struct-in-enum.rs b/tests/debuginfo/struct-in-enum.rs index bc2c59fe4aa..c5a7fb95e1e 100644 --- a/tests/debuginfo/struct-in-enum.rs +++ b/tests/debuginfo/struct-in-enum.rs @@ -1,6 +1,7 @@ //@ min-lldb-version: 1800 //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -30,8 +31,6 @@ // lldb-check:[...] TheOnlyCase(Struct { x: 123, y: 456, z: 789 }) #![allow(unused_variables)] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] use self::Regular::{Case1, Case2}; use self::Univariant::TheOnlyCase; diff --git a/tests/debuginfo/struct-in-struct.rs b/tests/debuginfo/struct-in-struct.rs index 3cf48470391..c818df31b4b 100644 --- a/tests/debuginfo/struct-in-struct.rs +++ b/tests/debuginfo/struct-in-struct.rs @@ -1,4 +1,5 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -43,8 +44,6 @@ // lldb-check:[...] { x = { x = 25 } y = { x = { x = 26 y = 27 } y = { x = 28 y = 29 } z = { x = 30 y = 31 } } z = { x = { x = { x = 32 } } } } #![allow(unused_variables)] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] struct Simple { x: i32 diff --git a/tests/debuginfo/struct-namespace.rs b/tests/debuginfo/struct-namespace.rs index 95788419100..d56c84c4f13 100644 --- a/tests/debuginfo/struct-namespace.rs +++ b/tests/debuginfo/struct-namespace.rs @@ -1,5 +1,6 @@ //@ ignore-gdb //@ compile-flags:-g +//@ disable-gdb-pretty-printers // Check that structs get placed in the correct namespace @@ -16,8 +17,6 @@ #![allow(unused_variables)] #![allow(dead_code)] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] struct Struct1 { a: u32, diff --git a/tests/debuginfo/struct-style-enum.rs b/tests/debuginfo/struct-style-enum.rs index cea9f3def8b..1f28fe4fea1 100644 --- a/tests/debuginfo/struct-style-enum.rs +++ b/tests/debuginfo/struct-style-enum.rs @@ -1,5 +1,6 @@ //@ min-lldb-version: 1800 //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -36,8 +37,6 @@ // lldb-check:(struct_style_enum::Univariant) univariant = { value = { a = -1 } } #![allow(unused_variables)] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] use self::Regular::{Case1, Case2, Case3}; use self::Univariant::TheOnlyCase; diff --git a/tests/debuginfo/struct-with-destructor.rs b/tests/debuginfo/struct-with-destructor.rs index c159824980a..4d2ce8ff79d 100644 --- a/tests/debuginfo/struct-with-destructor.rs +++ b/tests/debuginfo/struct-with-destructor.rs @@ -1,4 +1,5 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -32,8 +33,6 @@ // lldb-check:[...] { a = { a = { x = 7890 y = 9870 } } } #![allow(unused_variables)] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] struct NoDestructor { x: i32, diff --git a/tests/debuginfo/trait-pointers.rs b/tests/debuginfo/trait-pointers.rs index 71da71b897a..5cdefe94e50 100644 --- a/tests/debuginfo/trait-pointers.rs +++ b/tests/debuginfo/trait-pointers.rs @@ -1,10 +1,9 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers // gdb-command:run // lldb-command:run #![allow(unused_variables)] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] trait Trait { fn method(&self) -> isize { 0 } diff --git a/tests/debuginfo/tuple-in-struct.rs b/tests/debuginfo/tuple-in-struct.rs index a74d6203f5f..bef96fad50c 100644 --- a/tests/debuginfo/tuple-in-struct.rs +++ b/tests/debuginfo/tuple-in-struct.rs @@ -1,4 +1,5 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers // gdb-command:run @@ -28,8 +29,6 @@ // gdb-check:$10 = tuple_in_struct::MixedPadding {x: ((40, 41, 42), (43, 44)), y: (45, 46, 47, 48)} #![allow(unused_variables)] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] struct NoPadding1 { x: (i32, i32), diff --git a/tests/debuginfo/tuple-in-tuple.rs b/tests/debuginfo/tuple-in-tuple.rs index d4388095ad7..7bf97764c5c 100644 --- a/tests/debuginfo/tuple-in-tuple.rs +++ b/tests/debuginfo/tuple-in-tuple.rs @@ -1,4 +1,5 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -111,8 +112,6 @@ // cdb-check:[...][1] : 22 [Type: [...]] #![allow(unused_variables)] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] fn main() { let no_padding1: ((u32, u32), u32, u32) = ((0, 1), 2, 3); diff --git a/tests/debuginfo/tuple-struct.rs b/tests/debuginfo/tuple-struct.rs index 0110203a7c7..a1bdaf1f3bb 100644 --- a/tests/debuginfo/tuple-struct.rs +++ b/tests/debuginfo/tuple-struct.rs @@ -1,4 +1,5 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -50,9 +51,6 @@ // structs. -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] - struct NoPadding16(u16, i16); struct NoPadding32(i32, f32, u32); struct NoPadding64(f64, i64, u64); diff --git a/tests/debuginfo/tuple-style-enum.rs b/tests/debuginfo/tuple-style-enum.rs index a759ad61c05..6113ccc10a1 100644 --- a/tests/debuginfo/tuple-style-enum.rs +++ b/tests/debuginfo/tuple-style-enum.rs @@ -1,6 +1,7 @@ //@ min-lldb-version: 1800 //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -37,8 +38,6 @@ // lldb-check:(tuple_style_enum::Univariant) univariant = { value = { 0 = -1 } } #![allow(unused_variables)] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] use self::Regular::{Case1, Case2, Case3}; use self::Univariant::TheOnlyCase; diff --git a/tests/debuginfo/type-names.rs b/tests/debuginfo/type-names.rs index ac61fef48fe..ecf7c597c0c 100644 --- a/tests/debuginfo/type-names.rs +++ b/tests/debuginfo/type-names.rs @@ -6,6 +6,7 @@ //@ min-gdb-version: 9.2 //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS ================================================================================== @@ -271,8 +272,6 @@ // cdb-check:struct type_names::mod1::extern$0::ForeignType2 * foreign2 = [...] #![allow(unused_variables)] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] #![feature(extern_types)] use std::marker::PhantomData; diff --git a/tests/debuginfo/union-smoke.rs b/tests/debuginfo/union-smoke.rs index 6043240069e..bd253794bd8 100644 --- a/tests/debuginfo/union-smoke.rs +++ b/tests/debuginfo/union-smoke.rs @@ -1,4 +1,5 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -18,8 +19,6 @@ // lldb-check:[...] { a = { 0 = '\x01' 1 = '\x01' } b = 257 } #![allow(unused)] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] union U { a: (u8, u8), diff --git a/tests/debuginfo/unique-enum.rs b/tests/debuginfo/unique-enum.rs index 230429278aa..e5a9c550135 100644 --- a/tests/debuginfo/unique-enum.rs +++ b/tests/debuginfo/unique-enum.rs @@ -1,6 +1,7 @@ //@ min-lldb-version: 1800 //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -30,8 +31,6 @@ // lldb-check:(unique_enum::Univariant) *univariant = { value = { 0 = 123234 } } #![allow(unused_variables)] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] // The first element is to ensure proper alignment, irrespective of the machines word size. Since // the size of the discriminant value is machine dependent, this has be taken into account when diff --git a/tests/debuginfo/unreachable-locals.rs b/tests/debuginfo/unreachable-locals.rs index d4416387e0b..4d3f01fe423 100644 --- a/tests/debuginfo/unreachable-locals.rs +++ b/tests/debuginfo/unreachable-locals.rs @@ -1,8 +1,7 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers #![allow(unused_variables)] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] // No need to actually run the debugger, just make sure that the compiler can // handle locals in unreachable code. diff --git a/tests/debuginfo/unsized.rs b/tests/debuginfo/unsized.rs index edd9f5af557..e34eaaaacb9 100644 --- a/tests/debuginfo/unsized.rs +++ b/tests/debuginfo/unsized.rs @@ -1,4 +1,5 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers //@ ignore-gdb-version: 13.1 - 99.0 // ^ https://sourceware.org/bugzilla/show_bug.cgi?id=30330 @@ -41,9 +42,6 @@ // cdb-check:[+0x000] pointer : 0x[...] [Type: unsized::Foo<dyn$<core::fmt::Debug> > *] // cdb-check:[...] vtable : 0x[...] [Type: unsigned [...]int[...] (*)[4]] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] - struct Foo<T: ?Sized> { value: T, } diff --git a/tests/debuginfo/var-captured-in-nested-closure.rs b/tests/debuginfo/var-captured-in-nested-closure.rs index 4e8700015ba..1795a352802 100644 --- a/tests/debuginfo/var-captured-in-nested-closure.rs +++ b/tests/debuginfo/var-captured-in-nested-closure.rs @@ -1,4 +1,5 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -115,8 +116,6 @@ // cdb-check:closure_local : 8 [Type: [...]] #![allow(unused_variables)] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] struct Struct { a: isize, diff --git a/tests/debuginfo/var-captured-in-sendable-closure.rs b/tests/debuginfo/var-captured-in-sendable-closure.rs index cbb09daeb5f..2b0d4bb430a 100644 --- a/tests/debuginfo/var-captured-in-sendable-closure.rs +++ b/tests/debuginfo/var-captured-in-sendable-closure.rs @@ -1,4 +1,5 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -28,8 +29,6 @@ // lldb-check:[...] 5 #![allow(unused_variables)] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] struct Struct { a: isize, diff --git a/tests/debuginfo/var-captured-in-stack-closure.rs b/tests/debuginfo/var-captured-in-stack-closure.rs index 0f84ea57b00..7fda71c2297 100644 --- a/tests/debuginfo/var-captured-in-stack-closure.rs +++ b/tests/debuginfo/var-captured-in-stack-closure.rs @@ -1,4 +1,5 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -100,8 +101,6 @@ // cdb-check:owned : 0x[...] : 6 [Type: [...] *] #![allow(unused_variables)] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] struct Struct { a: isize, diff --git a/tests/debuginfo/vec-slices.rs b/tests/debuginfo/vec-slices.rs index 2b4d624976a..2a4e413612f 100644 --- a/tests/debuginfo/vec-slices.rs +++ b/tests/debuginfo/vec-slices.rs @@ -2,6 +2,7 @@ // ^ test temporarily disabled as it fails under gdb 15 //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -71,8 +72,6 @@ // lldb-check:[...] size=2 { [0] = { x = 10 y = 11 z = 12 } [1] = { x = 13 y = 14 z = 15 } } #![allow(dead_code, unused_variables)] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] struct AStruct { x: i16, diff --git a/tests/debuginfo/vec.rs b/tests/debuginfo/vec.rs index 1093e38d878..fd75e7005af 100644 --- a/tests/debuginfo/vec.rs +++ b/tests/debuginfo/vec.rs @@ -1,4 +1,5 @@ //@ compile-flags:-g +//@ disable-gdb-pretty-printers // === GDB TESTS =================================================================================== @@ -16,8 +17,6 @@ // lldb-check:[...] { [0] = 1 [1] = 2 [2] = 3 } #![allow(unused_variables)] -#![feature(omit_gdb_pretty_printer_section)] -#![omit_gdb_pretty_printer_section] static mut VECT: [i32; 3] = [1, 2, 3]; diff --git a/tests/mir-opt/box_conditional_drop_allocator.main.ElaborateDrops.diff b/tests/mir-opt/box_conditional_drop_allocator.main.ElaborateDrops.diff new file mode 100644 index 00000000000..6f6c239d7c8 --- /dev/null +++ b/tests/mir-opt/box_conditional_drop_allocator.main.ElaborateDrops.diff @@ -0,0 +1,186 @@ +- // MIR for `main` before ElaborateDrops ++ // MIR for `main` after ElaborateDrops + + fn main() -> () { + let mut _0: (); + let _1: std::boxed::Box<HasDrop, DropAllocator>; + let mut _2: HasDrop; + let mut _3: DropAllocator; + let mut _4: bool; + let _5: (); + let mut _6: HasDrop; + let _7: (); + let mut _8: std::boxed::Box<HasDrop, DropAllocator>; ++ let mut _9: bool; ++ let mut _10: &mut std::boxed::Box<HasDrop, DropAllocator>; ++ let mut _11: (); ++ let mut _12: &mut std::boxed::Box<HasDrop, DropAllocator>; ++ let mut _13: (); ++ let mut _14: *const HasDrop; ++ let mut _15: &mut std::boxed::Box<HasDrop, DropAllocator>; ++ let mut _16: (); ++ let mut _17: *const HasDrop; + scope 1 { + debug b => _1; + } + + bb0: { ++ _9 = const false; + StorageLive(_1); + StorageLive(_2); + _2 = HasDrop; + StorageLive(_3); + _3 = DropAllocator; + _1 = Box::<HasDrop, DropAllocator>::new_in(move _2, move _3) -> [return: bb1, unwind: bb11]; + } + + bb1: { ++ _9 = const true; + StorageDead(_3); + StorageDead(_2); + StorageLive(_4); + _4 = const true; + switchInt(move _4) -> [0: bb4, otherwise: bb2]; + } + + bb2: { + StorageLive(_5); + StorageLive(_6); + _6 = move (*_1); + _5 = std::mem::drop::<HasDrop>(move _6) -> [return: bb3, unwind: bb9]; + } + + bb3: { + StorageDead(_6); + StorageDead(_5); + _0 = const (); + goto -> bb6; + } + + bb4: { + StorageLive(_7); + StorageLive(_8); ++ _9 = const false; + _8 = move _1; + _7 = std::mem::drop::<Box<HasDrop, DropAllocator>>(move _8) -> [return: bb5, unwind: bb8]; + } + + bb5: { + StorageDead(_8); + StorageDead(_7); + _0 = const (); + goto -> bb6; + } + + bb6: { + StorageDead(_4); +- drop(_1) -> [return: bb7, unwind continue]; ++ goto -> bb23; + } + + bb7: { ++ _9 = const false; + StorageDead(_1); + return; + } + + bb8 (cleanup): { +- drop(_8) -> [return: bb10, unwind terminate(cleanup)]; ++ goto -> bb10; + } + + bb9 (cleanup): { +- drop(_6) -> [return: bb10, unwind terminate(cleanup)]; ++ goto -> bb10; + } + + bb10 (cleanup): { +- drop(_1) -> [return: bb13, unwind terminate(cleanup)]; ++ goto -> bb29; + } + + bb11 (cleanup): { +- drop(_3) -> [return: bb12, unwind terminate(cleanup)]; ++ goto -> bb12; + } + + bb12 (cleanup): { +- drop(_2) -> [return: bb13, unwind terminate(cleanup)]; ++ goto -> bb13; + } + + bb13 (cleanup): { + resume; ++ } ++ ++ bb14: { ++ _9 = const false; ++ goto -> bb7; ++ } ++ ++ bb15 (cleanup): { ++ drop((_1.1: DropAllocator)) -> [return: bb13, unwind terminate(cleanup)]; ++ } ++ ++ bb16 (cleanup): { ++ switchInt(copy _9) -> [0: bb13, otherwise: bb15]; ++ } ++ ++ bb17: { ++ drop((_1.1: DropAllocator)) -> [return: bb14, unwind: bb13]; ++ } ++ ++ bb18: { ++ switchInt(copy _9) -> [0: bb14, otherwise: bb17]; ++ } ++ ++ bb19: { ++ _10 = &mut _1; ++ _11 = <Box<HasDrop, DropAllocator> as Drop>::drop(move _10) -> [return: bb18, unwind: bb16]; ++ } ++ ++ bb20 (cleanup): { ++ _12 = &mut _1; ++ _13 = <Box<HasDrop, DropAllocator> as Drop>::drop(move _12) -> [return: bb16, unwind terminate(cleanup)]; ++ } ++ ++ bb21: { ++ goto -> bb19; ++ } ++ ++ bb22: { ++ _14 = copy ((_1.0: std::ptr::Unique<HasDrop>).0: std::ptr::NonNull<HasDrop>) as *const HasDrop (Transmute); ++ goto -> bb21; ++ } ++ ++ bb23: { ++ switchInt(copy _9) -> [0: bb18, otherwise: bb22]; ++ } ++ ++ bb24 (cleanup): { ++ drop((_1.1: DropAllocator)) -> [return: bb13, unwind terminate(cleanup)]; ++ } ++ ++ bb25 (cleanup): { ++ switchInt(copy _9) -> [0: bb13, otherwise: bb24]; ++ } ++ ++ bb26 (cleanup): { ++ _15 = &mut _1; ++ _16 = <Box<HasDrop, DropAllocator> as Drop>::drop(move _15) -> [return: bb25, unwind terminate(cleanup)]; ++ } ++ ++ bb27 (cleanup): { ++ goto -> bb26; ++ } ++ ++ bb28 (cleanup): { ++ _17 = copy ((_1.0: std::ptr::Unique<HasDrop>).0: std::ptr::NonNull<HasDrop>) as *const HasDrop (Transmute); ++ goto -> bb27; ++ } ++ ++ bb29 (cleanup): { ++ switchInt(copy _9) -> [0: bb25, otherwise: bb28]; + } + } + diff --git a/tests/mir-opt/box_conditional_drop_allocator.rs b/tests/mir-opt/box_conditional_drop_allocator.rs new file mode 100644 index 00000000000..9471be14c87 --- /dev/null +++ b/tests/mir-opt/box_conditional_drop_allocator.rs @@ -0,0 +1,39 @@ +// skip-filecheck +//@ test-mir-pass: ElaborateDrops +//@ needs-unwind +#![feature(allocator_api)] + +// Regression test for #131082. +// Testing that the allocator of a Box is dropped in conditional drops + +use std::alloc::{AllocError, Allocator, Global, Layout}; +use std::ptr::NonNull; + +struct DropAllocator; + +unsafe impl Allocator for DropAllocator { + fn allocate(&self, layout: Layout) -> Result<NonNull<[u8]>, AllocError> { + Global.allocate(layout) + } + unsafe fn deallocate(&self, ptr: NonNull<u8>, layout: Layout) { + Global.deallocate(ptr, layout); + } +} +impl Drop for DropAllocator { + fn drop(&mut self) {} +} + +struct HasDrop; +impl Drop for HasDrop { + fn drop(&mut self) {} +} + +// EMIT_MIR box_conditional_drop_allocator.main.ElaborateDrops.diff +fn main() { + let b = Box::new_in(HasDrop, DropAllocator); + if true { + drop(*b); + } else { + drop(b); + } +} diff --git a/tests/mir-opt/building/async_await.b-{closure#0}.coroutine_resume.0.mir b/tests/mir-opt/building/async_await.b-{closure#0}.coroutine_resume.0.mir index 109a41d1ef9..9bff257e063 100644 --- a/tests/mir-opt/building/async_await.b-{closure#0}.coroutine_resume.0.mir +++ b/tests/mir-opt/building/async_await.b-{closure#0}.coroutine_resume.0.mir @@ -9,10 +9,6 @@ std::future::ResumeTy, (), (), - CoroutineWitness( - DefId(0:5 ~ async_await[ccf8]::a::{closure#0}), - [], - ), (), ], ), @@ -30,10 +26,6 @@ std::future::ResumeTy, (), (), - CoroutineWitness( - DefId(0:5 ~ async_await[ccf8]::a::{closure#0}), - [], - ), (), ], ), diff --git a/tests/mir-opt/building/custom/terminators.tail_call.built.after.mir b/tests/mir-opt/building/custom/terminators.tail_call.built.after.mir index ab3925dae1c..feec68d3b0d 100644 --- a/tests/mir-opt/building/custom/terminators.tail_call.built.after.mir +++ b/tests/mir-opt/building/custom/terminators.tail_call.built.after.mir @@ -6,6 +6,6 @@ fn tail_call(_1: i32) -> i32 { bb0: { _2 = Add(copy _1, const 42_i32); - tailcall ident::<i32>(Spanned { node: copy _2, span: $DIR/terminators.rs:32:28: 32:29 (#0) }); + tailcall ident::<i32>(copy _2); } } diff --git a/tests/mir-opt/coverage/branch_match_arms.main.InstrumentCoverage.diff b/tests/mir-opt/coverage/branch_match_arms.main.InstrumentCoverage.diff index d465b8bded2..fa88211383a 100644 --- a/tests/mir-opt/coverage/branch_match_arms.main.InstrumentCoverage.diff +++ b/tests/mir-opt/coverage/branch_match_arms.main.InstrumentCoverage.diff @@ -40,7 +40,7 @@ + coverage Code { bcb: bcb5 } => $DIR/branch_match_arms.rs:19:17: 19:18 (#0); + coverage Code { bcb: bcb5 } => $DIR/branch_match_arms.rs:19:23: 19:30 (#0); + coverage Code { bcb: bcb5 } => $DIR/branch_match_arms.rs:19:31: 19:32 (#0); -+ coverage Code { bcb: bcb2 } => $DIR/branch_match_arms.rs:21:2: 21:2 (#0); ++ coverage Code { bcb: bcb2 } => $DIR/branch_match_arms.rs:21:1: 21:2 (#0); + bb0: { + Coverage::VirtualCounter(bcb0); diff --git a/tests/mir-opt/coverage/instrument_coverage.bar.InstrumentCoverage.diff b/tests/mir-opt/coverage/instrument_coverage.bar.InstrumentCoverage.diff index cf6d85abd80..9b6d2b22087 100644 --- a/tests/mir-opt/coverage/instrument_coverage.bar.InstrumentCoverage.diff +++ b/tests/mir-opt/coverage/instrument_coverage.bar.InstrumentCoverage.diff @@ -6,7 +6,7 @@ + coverage Code { bcb: bcb0 } => $DIR/instrument_coverage.rs:27:1: 27:17 (#0); + coverage Code { bcb: bcb0 } => $DIR/instrument_coverage.rs:28:5: 28:9 (#0); -+ coverage Code { bcb: bcb0 } => $DIR/instrument_coverage.rs:29:2: 29:2 (#0); ++ coverage Code { bcb: bcb0 } => $DIR/instrument_coverage.rs:29:1: 29:2 (#0); + bb0: { + Coverage::VirtualCounter(bcb0); diff --git a/tests/mir-opt/coverage/instrument_coverage.main.InstrumentCoverage.diff b/tests/mir-opt/coverage/instrument_coverage.main.InstrumentCoverage.diff index 980c5e202ff..b2bb2375aee 100644 --- a/tests/mir-opt/coverage/instrument_coverage.main.InstrumentCoverage.diff +++ b/tests/mir-opt/coverage/instrument_coverage.main.InstrumentCoverage.diff @@ -10,8 +10,8 @@ + coverage Code { bcb: bcb0 } => $DIR/instrument_coverage.rs:13:1: 13:10 (#0); + coverage Code { bcb: bcb1 } => $DIR/instrument_coverage.rs:15:12: 15:15 (#0); + coverage Code { bcb: bcb2 } => $DIR/instrument_coverage.rs:16:13: 16:18 (#0); -+ coverage Code { bcb: bcb3 } => $DIR/instrument_coverage.rs:17:10: 17:10 (#0); -+ coverage Code { bcb: bcb2 } => $DIR/instrument_coverage.rs:19:2: 19:2 (#0); ++ coverage Code { bcb: bcb3 } => $DIR/instrument_coverage.rs:17:9: 17:10 (#0); ++ coverage Code { bcb: bcb2 } => $DIR/instrument_coverage.rs:19:1: 19:2 (#0); + bb0: { + Coverage::VirtualCounter(bcb0); diff --git a/tests/mir-opt/coverage/instrument_coverage_cleanup.main.CleanupPostBorrowck.diff b/tests/mir-opt/coverage/instrument_coverage_cleanup.main.CleanupPostBorrowck.diff index b707cd41788..2eb78c08ee8 100644 --- a/tests/mir-opt/coverage/instrument_coverage_cleanup.main.CleanupPostBorrowck.diff +++ b/tests/mir-opt/coverage/instrument_coverage_cleanup.main.CleanupPostBorrowck.diff @@ -10,8 +10,8 @@ coverage Code { bcb: bcb0 } => $DIR/instrument_coverage_cleanup.rs:13:1: 13:10 (#0); coverage Code { bcb: bcb0 } => $DIR/instrument_coverage_cleanup.rs:14:8: 14:36 (#0); coverage Code { bcb: bcb3 } => $DIR/instrument_coverage_cleanup.rs:14:37: 14:39 (#0); - coverage Code { bcb: bcb1 } => $DIR/instrument_coverage_cleanup.rs:14:39: 14:39 (#0); - coverage Code { bcb: bcb2 } => $DIR/instrument_coverage_cleanup.rs:15:2: 15:2 (#0); + coverage Code { bcb: bcb1 } => $DIR/instrument_coverage_cleanup.rs:14:38: 14:39 (#0); + coverage Code { bcb: bcb2 } => $DIR/instrument_coverage_cleanup.rs:15:1: 15:2 (#0); coverage Branch { true_bcb: bcb3, false_bcb: bcb1 } => $DIR/instrument_coverage_cleanup.rs:14:8: 14:36 (#0); bb0: { diff --git a/tests/mir-opt/coverage/instrument_coverage_cleanup.main.InstrumentCoverage.diff b/tests/mir-opt/coverage/instrument_coverage_cleanup.main.InstrumentCoverage.diff index 239b845c231..0c1bc24b6dc 100644 --- a/tests/mir-opt/coverage/instrument_coverage_cleanup.main.InstrumentCoverage.diff +++ b/tests/mir-opt/coverage/instrument_coverage_cleanup.main.InstrumentCoverage.diff @@ -10,8 +10,8 @@ + coverage Code { bcb: bcb0 } => $DIR/instrument_coverage_cleanup.rs:13:1: 13:10 (#0); + coverage Code { bcb: bcb0 } => $DIR/instrument_coverage_cleanup.rs:14:8: 14:36 (#0); + coverage Code { bcb: bcb3 } => $DIR/instrument_coverage_cleanup.rs:14:37: 14:39 (#0); -+ coverage Code { bcb: bcb1 } => $DIR/instrument_coverage_cleanup.rs:14:39: 14:39 (#0); -+ coverage Code { bcb: bcb2 } => $DIR/instrument_coverage_cleanup.rs:15:2: 15:2 (#0); ++ coverage Code { bcb: bcb1 } => $DIR/instrument_coverage_cleanup.rs:14:38: 14:39 (#0); ++ coverage Code { bcb: bcb2 } => $DIR/instrument_coverage_cleanup.rs:15:1: 15:2 (#0); + coverage Branch { true_bcb: bcb3, false_bcb: bcb1 } => $DIR/instrument_coverage_cleanup.rs:14:8: 14:36 (#0); + bb0: { diff --git a/tests/mir-opt/pre-codegen/derived_ord_debug.rs b/tests/mir-opt/pre-codegen/derived_ord_debug.rs new file mode 100644 index 00000000000..1d6a884cee4 --- /dev/null +++ b/tests/mir-opt/pre-codegen/derived_ord_debug.rs @@ -0,0 +1,18 @@ +//@ compile-flags: -Copt-level=0 -Zmir-opt-level=1 -Cdebuginfo=limited +// EMIT_MIR_FOR_EACH_PANIC_STRATEGY + +#![crate_type = "lib"] + +#[derive(PartialOrd, Ord, PartialEq, Eq)] +pub struct MultiField(char, i16); + +// EMIT_MIR derived_ord_debug.{impl#0}-partial_cmp.PreCodegen.after.mir +// EMIT_MIR derived_ord_debug.{impl#1}-cmp.PreCodegen.after.mir + +// CHECK-LABEL: partial_cmp(_1: &MultiField, _2: &MultiField) -> Option<std::cmp::Ordering> +// CHECK: = <char as PartialOrd>::partial_cmp( +// CHECK: = <i16 as PartialOrd>::partial_cmp( + +// CHECK-LABEL: cmp(_1: &MultiField, _2: &MultiField) -> std::cmp::Ordering +// CHECK: = <char as Ord>::cmp( +// CHECK: = <i16 as Ord>::cmp( diff --git a/tests/mir-opt/pre-codegen/derived_ord_debug.{impl#0}-partial_cmp.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/derived_ord_debug.{impl#0}-partial_cmp.PreCodegen.after.panic-abort.mir new file mode 100644 index 00000000000..9fc8da3a112 --- /dev/null +++ b/tests/mir-opt/pre-codegen/derived_ord_debug.{impl#0}-partial_cmp.PreCodegen.after.panic-abort.mir @@ -0,0 +1,52 @@ +// MIR for `<impl at $DIR/derived_ord_debug.rs:6:10: 6:20>::partial_cmp` after PreCodegen + +fn <impl at $DIR/derived_ord_debug.rs:6:10: 6:20>::partial_cmp(_1: &MultiField, _2: &MultiField) -> Option<std::cmp::Ordering> { + debug self => _1; + debug other => _2; + let mut _0: std::option::Option<std::cmp::Ordering>; + let _3: &char; + let _4: &char; + let mut _5: std::option::Option<std::cmp::Ordering>; + let mut _6: isize; + let mut _7: i8; + let _8: &i16; + let _9: &i16; + scope 1 { + debug cmp => _5; + } + + bb0: { + _3 = &((*_1).0: char); + _4 = &((*_2).0: char); + _5 = <char as PartialOrd>::partial_cmp(copy _3, copy _4) -> [return: bb1, unwind unreachable]; + } + + bb1: { + _6 = discriminant(_5); + switchInt(move _6) -> [1: bb2, 0: bb4, otherwise: bb6]; + } + + bb2: { + _7 = discriminant(((_5 as Some).0: std::cmp::Ordering)); + switchInt(move _7) -> [0: bb3, otherwise: bb4]; + } + + bb3: { + _8 = &((*_1).1: i16); + _9 = &((*_2).1: i16); + _0 = <i16 as PartialOrd>::partial_cmp(copy _8, copy _9) -> [return: bb5, unwind unreachable]; + } + + bb4: { + _0 = copy _5; + goto -> bb5; + } + + bb5: { + return; + } + + bb6: { + unreachable; + } +} diff --git a/tests/mir-opt/pre-codegen/derived_ord_debug.{impl#0}-partial_cmp.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/derived_ord_debug.{impl#0}-partial_cmp.PreCodegen.after.panic-unwind.mir new file mode 100644 index 00000000000..29cc5415076 --- /dev/null +++ b/tests/mir-opt/pre-codegen/derived_ord_debug.{impl#0}-partial_cmp.PreCodegen.after.panic-unwind.mir @@ -0,0 +1,52 @@ +// MIR for `<impl at $DIR/derived_ord_debug.rs:6:10: 6:20>::partial_cmp` after PreCodegen + +fn <impl at $DIR/derived_ord_debug.rs:6:10: 6:20>::partial_cmp(_1: &MultiField, _2: &MultiField) -> Option<std::cmp::Ordering> { + debug self => _1; + debug other => _2; + let mut _0: std::option::Option<std::cmp::Ordering>; + let _3: &char; + let _4: &char; + let mut _5: std::option::Option<std::cmp::Ordering>; + let mut _6: isize; + let mut _7: i8; + let _8: &i16; + let _9: &i16; + scope 1 { + debug cmp => _5; + } + + bb0: { + _3 = &((*_1).0: char); + _4 = &((*_2).0: char); + _5 = <char as PartialOrd>::partial_cmp(copy _3, copy _4) -> [return: bb1, unwind continue]; + } + + bb1: { + _6 = discriminant(_5); + switchInt(move _6) -> [1: bb2, 0: bb4, otherwise: bb6]; + } + + bb2: { + _7 = discriminant(((_5 as Some).0: std::cmp::Ordering)); + switchInt(move _7) -> [0: bb3, otherwise: bb4]; + } + + bb3: { + _8 = &((*_1).1: i16); + _9 = &((*_2).1: i16); + _0 = <i16 as PartialOrd>::partial_cmp(copy _8, copy _9) -> [return: bb5, unwind continue]; + } + + bb4: { + _0 = copy _5; + goto -> bb5; + } + + bb5: { + return; + } + + bb6: { + unreachable; + } +} diff --git a/tests/mir-opt/pre-codegen/derived_ord_debug.{impl#1}-cmp.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/derived_ord_debug.{impl#1}-cmp.PreCodegen.after.panic-abort.mir new file mode 100644 index 00000000000..66d96021aa9 --- /dev/null +++ b/tests/mir-opt/pre-codegen/derived_ord_debug.{impl#1}-cmp.PreCodegen.after.panic-abort.mir @@ -0,0 +1,42 @@ +// MIR for `<impl at $DIR/derived_ord_debug.rs:6:22: 6:25>::cmp` after PreCodegen + +fn <impl at $DIR/derived_ord_debug.rs:6:22: 6:25>::cmp(_1: &MultiField, _2: &MultiField) -> std::cmp::Ordering { + debug self => _1; + debug other => _2; + let mut _0: std::cmp::Ordering; + let _3: &char; + let _4: &char; + let mut _5: std::cmp::Ordering; + let mut _6: i8; + let _7: &i16; + let _8: &i16; + scope 1 { + debug cmp => _5; + } + + bb0: { + _3 = &((*_1).0: char); + _4 = &((*_2).0: char); + _5 = <char as Ord>::cmp(copy _3, copy _4) -> [return: bb1, unwind unreachable]; + } + + bb1: { + _6 = discriminant(_5); + switchInt(move _6) -> [0: bb2, otherwise: bb3]; + } + + bb2: { + _7 = &((*_1).1: i16); + _8 = &((*_2).1: i16); + _0 = <i16 as Ord>::cmp(copy _7, copy _8) -> [return: bb4, unwind unreachable]; + } + + bb3: { + _0 = copy _5; + goto -> bb4; + } + + bb4: { + return; + } +} diff --git a/tests/mir-opt/pre-codegen/derived_ord_debug.{impl#1}-cmp.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/derived_ord_debug.{impl#1}-cmp.PreCodegen.after.panic-unwind.mir new file mode 100644 index 00000000000..2dcba6195f7 --- /dev/null +++ b/tests/mir-opt/pre-codegen/derived_ord_debug.{impl#1}-cmp.PreCodegen.after.panic-unwind.mir @@ -0,0 +1,42 @@ +// MIR for `<impl at $DIR/derived_ord_debug.rs:6:22: 6:25>::cmp` after PreCodegen + +fn <impl at $DIR/derived_ord_debug.rs:6:22: 6:25>::cmp(_1: &MultiField, _2: &MultiField) -> std::cmp::Ordering { + debug self => _1; + debug other => _2; + let mut _0: std::cmp::Ordering; + let _3: &char; + let _4: &char; + let mut _5: std::cmp::Ordering; + let mut _6: i8; + let _7: &i16; + let _8: &i16; + scope 1 { + debug cmp => _5; + } + + bb0: { + _3 = &((*_1).0: char); + _4 = &((*_2).0: char); + _5 = <char as Ord>::cmp(copy _3, copy _4) -> [return: bb1, unwind continue]; + } + + bb1: { + _6 = discriminant(_5); + switchInt(move _6) -> [0: bb2, otherwise: bb3]; + } + + bb2: { + _7 = &((*_1).1: i16); + _8 = &((*_2).1: i16); + _0 = <i16 as Ord>::cmp(copy _7, copy _8) -> [return: bb4, unwind continue]; + } + + bb3: { + _0 = copy _5; + goto -> bb4; + } + + bb4: { + return; + } +} diff --git a/tests/mir-opt/pre-codegen/drop_boxed_slice.generic_in_place.PreCodegen.after.32bit.panic-abort.mir b/tests/mir-opt/pre-codegen/drop_boxed_slice.generic_in_place.PreCodegen.after.32bit.panic-abort.mir index 2777bba893b..ba6ce0ee528 100644 --- a/tests/mir-opt/pre-codegen/drop_boxed_slice.generic_in_place.PreCodegen.after.32bit.panic-abort.mir +++ b/tests/mir-opt/pre-codegen/drop_boxed_slice.generic_in_place.PreCodegen.after.32bit.panic-abort.mir @@ -8,7 +8,7 @@ fn generic_in_place(_1: *mut Box<[T]>) -> () { let _2: std::ptr::NonNull<[T]>; let mut _3: *mut [T]; let mut _4: *const [T]; - let _12: (); + let _11: (); scope 3 { let _8: std::ptr::alignment::AlignmentEnum; scope 4 { @@ -31,12 +31,11 @@ fn generic_in_place(_1: *mut Box<[T]>) -> () { scope 20 (inlined NonNull::<u8>::as_ptr) { } scope 21 (inlined std::alloc::dealloc) { - let mut _11: usize; + let mut _10: usize; scope 22 (inlined Layout::size) { } scope 23 (inlined Layout::align) { scope 24 (inlined std::ptr::Alignment::as_usize) { - let mut _10: u32; } } } @@ -87,16 +86,13 @@ fn generic_in_place(_1: *mut Box<[T]>) -> () { bb2: { StorageLive(_9); _9 = copy _3 as *mut u8 (PtrToPtr); - StorageLive(_11); StorageLive(_10); _10 = discriminant(_8); - _11 = move _10 as usize (IntToInt); - StorageDead(_10); - _12 = alloc::alloc::__rust_dealloc(move _9, move _5, move _11) -> [return: bb3, unwind unreachable]; + _11 = alloc::alloc::__rust_dealloc(move _9, move _5, move _10) -> [return: bb3, unwind unreachable]; } bb3: { - StorageDead(_11); + StorageDead(_10); StorageDead(_9); goto -> bb4; } diff --git a/tests/mir-opt/pre-codegen/drop_boxed_slice.generic_in_place.PreCodegen.after.32bit.panic-unwind.mir b/tests/mir-opt/pre-codegen/drop_boxed_slice.generic_in_place.PreCodegen.after.32bit.panic-unwind.mir index 2777bba893b..ba6ce0ee528 100644 --- a/tests/mir-opt/pre-codegen/drop_boxed_slice.generic_in_place.PreCodegen.after.32bit.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/drop_boxed_slice.generic_in_place.PreCodegen.after.32bit.panic-unwind.mir @@ -8,7 +8,7 @@ fn generic_in_place(_1: *mut Box<[T]>) -> () { let _2: std::ptr::NonNull<[T]>; let mut _3: *mut [T]; let mut _4: *const [T]; - let _12: (); + let _11: (); scope 3 { let _8: std::ptr::alignment::AlignmentEnum; scope 4 { @@ -31,12 +31,11 @@ fn generic_in_place(_1: *mut Box<[T]>) -> () { scope 20 (inlined NonNull::<u8>::as_ptr) { } scope 21 (inlined std::alloc::dealloc) { - let mut _11: usize; + let mut _10: usize; scope 22 (inlined Layout::size) { } scope 23 (inlined Layout::align) { scope 24 (inlined std::ptr::Alignment::as_usize) { - let mut _10: u32; } } } @@ -87,16 +86,13 @@ fn generic_in_place(_1: *mut Box<[T]>) -> () { bb2: { StorageLive(_9); _9 = copy _3 as *mut u8 (PtrToPtr); - StorageLive(_11); StorageLive(_10); _10 = discriminant(_8); - _11 = move _10 as usize (IntToInt); - StorageDead(_10); - _12 = alloc::alloc::__rust_dealloc(move _9, move _5, move _11) -> [return: bb3, unwind unreachable]; + _11 = alloc::alloc::__rust_dealloc(move _9, move _5, move _10) -> [return: bb3, unwind unreachable]; } bb3: { - StorageDead(_11); + StorageDead(_10); StorageDead(_9); goto -> bb4; } diff --git a/tests/mir-opt/pre-codegen/drop_boxed_slice.generic_in_place.PreCodegen.after.64bit.panic-abort.mir b/tests/mir-opt/pre-codegen/drop_boxed_slice.generic_in_place.PreCodegen.after.64bit.panic-abort.mir index 2be0a478c85..ba6ce0ee528 100644 --- a/tests/mir-opt/pre-codegen/drop_boxed_slice.generic_in_place.PreCodegen.after.64bit.panic-abort.mir +++ b/tests/mir-opt/pre-codegen/drop_boxed_slice.generic_in_place.PreCodegen.after.64bit.panic-abort.mir @@ -8,7 +8,7 @@ fn generic_in_place(_1: *mut Box<[T]>) -> () { let _2: std::ptr::NonNull<[T]>; let mut _3: *mut [T]; let mut _4: *const [T]; - let _12: (); + let _11: (); scope 3 { let _8: std::ptr::alignment::AlignmentEnum; scope 4 { @@ -31,12 +31,11 @@ fn generic_in_place(_1: *mut Box<[T]>) -> () { scope 20 (inlined NonNull::<u8>::as_ptr) { } scope 21 (inlined std::alloc::dealloc) { - let mut _11: usize; + let mut _10: usize; scope 22 (inlined Layout::size) { } scope 23 (inlined Layout::align) { scope 24 (inlined std::ptr::Alignment::as_usize) { - let mut _10: u64; } } } @@ -87,16 +86,13 @@ fn generic_in_place(_1: *mut Box<[T]>) -> () { bb2: { StorageLive(_9); _9 = copy _3 as *mut u8 (PtrToPtr); - StorageLive(_11); StorageLive(_10); _10 = discriminant(_8); - _11 = move _10 as usize (IntToInt); - StorageDead(_10); - _12 = alloc::alloc::__rust_dealloc(move _9, move _5, move _11) -> [return: bb3, unwind unreachable]; + _11 = alloc::alloc::__rust_dealloc(move _9, move _5, move _10) -> [return: bb3, unwind unreachable]; } bb3: { - StorageDead(_11); + StorageDead(_10); StorageDead(_9); goto -> bb4; } diff --git a/tests/mir-opt/pre-codegen/drop_boxed_slice.generic_in_place.PreCodegen.after.64bit.panic-unwind.mir b/tests/mir-opt/pre-codegen/drop_boxed_slice.generic_in_place.PreCodegen.after.64bit.panic-unwind.mir index 2be0a478c85..ba6ce0ee528 100644 --- a/tests/mir-opt/pre-codegen/drop_boxed_slice.generic_in_place.PreCodegen.after.64bit.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/drop_boxed_slice.generic_in_place.PreCodegen.after.64bit.panic-unwind.mir @@ -8,7 +8,7 @@ fn generic_in_place(_1: *mut Box<[T]>) -> () { let _2: std::ptr::NonNull<[T]>; let mut _3: *mut [T]; let mut _4: *const [T]; - let _12: (); + let _11: (); scope 3 { let _8: std::ptr::alignment::AlignmentEnum; scope 4 { @@ -31,12 +31,11 @@ fn generic_in_place(_1: *mut Box<[T]>) -> () { scope 20 (inlined NonNull::<u8>::as_ptr) { } scope 21 (inlined std::alloc::dealloc) { - let mut _11: usize; + let mut _10: usize; scope 22 (inlined Layout::size) { } scope 23 (inlined Layout::align) { scope 24 (inlined std::ptr::Alignment::as_usize) { - let mut _10: u64; } } } @@ -87,16 +86,13 @@ fn generic_in_place(_1: *mut Box<[T]>) -> () { bb2: { StorageLive(_9); _9 = copy _3 as *mut u8 (PtrToPtr); - StorageLive(_11); StorageLive(_10); _10 = discriminant(_8); - _11 = move _10 as usize (IntToInt); - StorageDead(_10); - _12 = alloc::alloc::__rust_dealloc(move _9, move _5, move _11) -> [return: bb3, unwind unreachable]; + _11 = alloc::alloc::__rust_dealloc(move _9, move _5, move _10) -> [return: bb3, unwind unreachable]; } bb3: { - StorageDead(_11); + StorageDead(_10); StorageDead(_9); goto -> bb4; } diff --git a/tests/mir-opt/pre-codegen/drop_boxed_slice.rs b/tests/mir-opt/pre-codegen/drop_boxed_slice.rs index 11fb7afef0f..9ceba9444b8 100644 --- a/tests/mir-opt/pre-codegen/drop_boxed_slice.rs +++ b/tests/mir-opt/pre-codegen/drop_boxed_slice.rs @@ -13,7 +13,6 @@ pub unsafe fn generic_in_place<T: Copy>(ptr: *mut Box<[T]>) { // CHECK: [[B:_.+]] = copy [[ALIGN]] as std::ptr::Alignment (Transmute); // CHECK: [[C:_.+]] = move ([[B]].0: std::ptr::alignment::AlignmentEnum); // CHECK: [[D:_.+]] = discriminant([[C]]); - // CHECK: [[E:_.+]] = move [[D]] as usize (IntToInt); - // CHECK: = alloc::alloc::__rust_dealloc({{.+}}, move [[SIZE]], move [[E]]) -> + // CHECK: = alloc::alloc::__rust_dealloc({{.+}}, move [[SIZE]], move [[D]]) -> std::ptr::drop_in_place(ptr) } diff --git a/tests/mir-opt/pre-codegen/option_bubble_debug.option_direct.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/option_bubble_debug.option_direct.PreCodegen.after.panic-abort.mir new file mode 100644 index 00000000000..b29662dfa61 --- /dev/null +++ b/tests/mir-opt/pre-codegen/option_bubble_debug.option_direct.PreCodegen.after.panic-abort.mir @@ -0,0 +1,37 @@ +// MIR for `option_direct` after PreCodegen + +fn option_direct(_1: Option<u32>) -> Option<u32> { + debug x => _1; + let mut _0: std::option::Option<u32>; + let mut _2: isize; + let _3: u32; + let mut _4: u32; + scope 1 { + debug x => _3; + } + + bb0: { + _2 = discriminant(_1); + switchInt(move _2) -> [0: bb1, 1: bb2, otherwise: bb4]; + } + + bb1: { + _0 = Option::<u32>::None; + goto -> bb3; + } + + bb2: { + _3 = copy ((_1 as Some).0: u32); + _4 = Not(copy _3); + _0 = Option::<u32>::Some(move _4); + goto -> bb3; + } + + bb3: { + return; + } + + bb4: { + unreachable; + } +} diff --git a/tests/mir-opt/pre-codegen/option_bubble_debug.option_direct.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/option_bubble_debug.option_direct.PreCodegen.after.panic-unwind.mir new file mode 100644 index 00000000000..b29662dfa61 --- /dev/null +++ b/tests/mir-opt/pre-codegen/option_bubble_debug.option_direct.PreCodegen.after.panic-unwind.mir @@ -0,0 +1,37 @@ +// MIR for `option_direct` after PreCodegen + +fn option_direct(_1: Option<u32>) -> Option<u32> { + debug x => _1; + let mut _0: std::option::Option<u32>; + let mut _2: isize; + let _3: u32; + let mut _4: u32; + scope 1 { + debug x => _3; + } + + bb0: { + _2 = discriminant(_1); + switchInt(move _2) -> [0: bb1, 1: bb2, otherwise: bb4]; + } + + bb1: { + _0 = Option::<u32>::None; + goto -> bb3; + } + + bb2: { + _3 = copy ((_1 as Some).0: u32); + _4 = Not(copy _3); + _0 = Option::<u32>::Some(move _4); + goto -> bb3; + } + + bb3: { + return; + } + + bb4: { + unreachable; + } +} diff --git a/tests/mir-opt/pre-codegen/option_bubble_debug.option_traits.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/option_bubble_debug.option_traits.PreCodegen.after.panic-abort.mir new file mode 100644 index 00000000000..5b401064dd0 --- /dev/null +++ b/tests/mir-opt/pre-codegen/option_bubble_debug.option_traits.PreCodegen.after.panic-abort.mir @@ -0,0 +1,47 @@ +// MIR for `option_traits` after PreCodegen + +fn option_traits(_1: Option<u32>) -> Option<u32> { + debug x => _1; + let mut _0: std::option::Option<u32>; + let mut _2: std::ops::ControlFlow<std::option::Option<std::convert::Infallible>, u32>; + let mut _3: isize; + let _4: u32; + let mut _5: u32; + scope 1 { + debug residual => const Option::<Infallible>::None; + scope 2 { + } + } + scope 3 { + debug val => _4; + scope 4 { + } + } + + bb0: { + _2 = <Option<u32> as Try>::branch(copy _1) -> [return: bb1, unwind unreachable]; + } + + bb1: { + _3 = discriminant(_2); + switchInt(move _3) -> [0: bb2, 1: bb3, otherwise: bb5]; + } + + bb2: { + _4 = copy ((_2 as Continue).0: u32); + _5 = Not(copy _4); + _0 = <Option<u32> as Try>::from_output(move _5) -> [return: bb4, unwind unreachable]; + } + + bb3: { + _0 = <Option<u32> as FromResidual<Option<Infallible>>>::from_residual(const Option::<Infallible>::None) -> [return: bb4, unwind unreachable]; + } + + bb4: { + return; + } + + bb5: { + unreachable; + } +} diff --git a/tests/mir-opt/pre-codegen/option_bubble_debug.option_traits.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/option_bubble_debug.option_traits.PreCodegen.after.panic-unwind.mir new file mode 100644 index 00000000000..bda9e9d8e60 --- /dev/null +++ b/tests/mir-opt/pre-codegen/option_bubble_debug.option_traits.PreCodegen.after.panic-unwind.mir @@ -0,0 +1,47 @@ +// MIR for `option_traits` after PreCodegen + +fn option_traits(_1: Option<u32>) -> Option<u32> { + debug x => _1; + let mut _0: std::option::Option<u32>; + let mut _2: std::ops::ControlFlow<std::option::Option<std::convert::Infallible>, u32>; + let mut _3: isize; + let _4: u32; + let mut _5: u32; + scope 1 { + debug residual => const Option::<Infallible>::None; + scope 2 { + } + } + scope 3 { + debug val => _4; + scope 4 { + } + } + + bb0: { + _2 = <Option<u32> as Try>::branch(copy _1) -> [return: bb1, unwind continue]; + } + + bb1: { + _3 = discriminant(_2); + switchInt(move _3) -> [0: bb2, 1: bb3, otherwise: bb5]; + } + + bb2: { + _4 = copy ((_2 as Continue).0: u32); + _5 = Not(copy _4); + _0 = <Option<u32> as Try>::from_output(move _5) -> [return: bb4, unwind continue]; + } + + bb3: { + _0 = <Option<u32> as FromResidual<Option<Infallible>>>::from_residual(const Option::<Infallible>::None) -> [return: bb4, unwind continue]; + } + + bb4: { + return; + } + + bb5: { + unreachable; + } +} diff --git a/tests/mir-opt/pre-codegen/option_bubble_debug.rs b/tests/mir-opt/pre-codegen/option_bubble_debug.rs new file mode 100644 index 00000000000..b9bf78a1d6e --- /dev/null +++ b/tests/mir-opt/pre-codegen/option_bubble_debug.rs @@ -0,0 +1,29 @@ +//@ compile-flags: -Copt-level=0 -Zmir-opt-level=1 -Cdebuginfo=limited +//@ edition: 2024 +// EMIT_MIR_FOR_EACH_PANIC_STRATEGY + +#![crate_type = "lib"] +#![feature(try_blocks)] + +// EMIT_MIR option_bubble_debug.option_direct.PreCodegen.after.mir +pub fn option_direct(x: Option<u32>) -> Option<u32> { + // CHECK-LABEL: fn option_direct(_1: Option<u32>) -> Option<u32> + // CHECK: = discriminant(_1); + // CHECK: [[TEMP:_.+]] = Not({{.+}}); + // CHECK: _0 = Option::<u32>::Some(move [[TEMP]]); + + match x { + Some(x) => Some(!x), + None => None, + } +} + +// EMIT_MIR option_bubble_debug.option_traits.PreCodegen.after.mir +pub fn option_traits(x: Option<u32>) -> Option<u32> { + // CHECK-LABEL: fn option_traits(_1: Option<u32>) -> Option<u32> + // CHECK: = <Option<u32> as Try>::branch(copy _1) + // CHECK: [[TEMP:_.+]] = Not({{.+}}); + // CHECK: _0 = <Option<u32> as Try>::from_output(move [[TEMP]]) + + try { !(x?) } +} diff --git a/tests/mir-opt/remove_unneeded_drops.cannot_opt_generic.RemoveUnneededDrops.diff b/tests/mir-opt/remove_unneeded_drops.cannot_opt_generic.RemoveUnneededDrops.diff new file mode 100644 index 00000000000..52832e73905 --- /dev/null +++ b/tests/mir-opt/remove_unneeded_drops.cannot_opt_generic.RemoveUnneededDrops.diff @@ -0,0 +1,15 @@ +- // MIR for `cannot_opt_generic` before RemoveUnneededDrops ++ // MIR for `cannot_opt_generic` after RemoveUnneededDrops + + fn cannot_opt_generic(_1: T) -> () { + let mut _0: (); + + bb0: { + drop(_1) -> [return: bb1, unwind unreachable]; + } + + bb1: { + return; + } + } + diff --git a/tests/mir-opt/remove_unneeded_drops.cannot_opt_generic.RemoveUnneededDrops.panic-abort.diff b/tests/mir-opt/remove_unneeded_drops.cannot_opt_generic.RemoveUnneededDrops.panic-abort.diff deleted file mode 100644 index 0c73602bec8..00000000000 --- a/tests/mir-opt/remove_unneeded_drops.cannot_opt_generic.RemoveUnneededDrops.panic-abort.diff +++ /dev/null @@ -1,26 +0,0 @@ -- // MIR for `cannot_opt_generic` before RemoveUnneededDrops -+ // MIR for `cannot_opt_generic` after RemoveUnneededDrops - - fn cannot_opt_generic(_1: T) -> () { - debug x => _1; - let mut _0: (); - let _2: (); - let mut _3: T; - scope 1 (inlined std::mem::drop::<T>) { - } - - bb0: { - nop; - StorageLive(_3); - _3 = move _1; - drop(_3) -> [return: bb1, unwind unreachable]; - } - - bb1: { - StorageDead(_3); - nop; - nop; - return; - } - } - diff --git a/tests/mir-opt/remove_unneeded_drops.cannot_opt_generic.RemoveUnneededDrops.panic-unwind.diff b/tests/mir-opt/remove_unneeded_drops.cannot_opt_generic.RemoveUnneededDrops.panic-unwind.diff deleted file mode 100644 index 59cce9fbcdd..00000000000 --- a/tests/mir-opt/remove_unneeded_drops.cannot_opt_generic.RemoveUnneededDrops.panic-unwind.diff +++ /dev/null @@ -1,30 +0,0 @@ -- // MIR for `cannot_opt_generic` before RemoveUnneededDrops -+ // MIR for `cannot_opt_generic` after RemoveUnneededDrops - - fn cannot_opt_generic(_1: T) -> () { - debug x => _1; - let mut _0: (); - let _2: (); - let mut _3: T; - scope 1 (inlined std::mem::drop::<T>) { - } - - bb0: { - nop; - StorageLive(_3); - _3 = move _1; - drop(_3) -> [return: bb2, unwind: bb1]; - } - - bb1 (cleanup): { - resume; - } - - bb2: { - StorageDead(_3); - nop; - nop; - return; - } - } - diff --git a/tests/mir-opt/remove_unneeded_drops.dont_opt.RemoveUnneededDrops.diff b/tests/mir-opt/remove_unneeded_drops.dont_opt.RemoveUnneededDrops.diff new file mode 100644 index 00000000000..3d67cada5dd --- /dev/null +++ b/tests/mir-opt/remove_unneeded_drops.dont_opt.RemoveUnneededDrops.diff @@ -0,0 +1,15 @@ +- // MIR for `dont_opt` before RemoveUnneededDrops ++ // MIR for `dont_opt` after RemoveUnneededDrops + + fn dont_opt(_1: Vec<bool>) -> () { + let mut _0: (); + + bb0: { + drop(_1) -> [return: bb1, unwind unreachable]; + } + + bb1: { + return; + } + } + diff --git a/tests/mir-opt/remove_unneeded_drops.dont_opt.RemoveUnneededDrops.panic-abort.diff b/tests/mir-opt/remove_unneeded_drops.dont_opt.RemoveUnneededDrops.panic-abort.diff deleted file mode 100644 index 428b366b5a6..00000000000 --- a/tests/mir-opt/remove_unneeded_drops.dont_opt.RemoveUnneededDrops.panic-abort.diff +++ /dev/null @@ -1,26 +0,0 @@ -- // MIR for `dont_opt` before RemoveUnneededDrops -+ // MIR for `dont_opt` after RemoveUnneededDrops - - fn dont_opt(_1: Vec<bool>) -> () { - debug x => _1; - let mut _0: (); - let _2: (); - let mut _3: std::vec::Vec<bool>; - scope 1 (inlined std::mem::drop::<Vec<bool>>) { - } - - bb0: { - nop; - StorageLive(_3); - _3 = move _1; - drop(_3) -> [return: bb1, unwind unreachable]; - } - - bb1: { - StorageDead(_3); - nop; - nop; - return; - } - } - diff --git a/tests/mir-opt/remove_unneeded_drops.dont_opt.RemoveUnneededDrops.panic-unwind.diff b/tests/mir-opt/remove_unneeded_drops.dont_opt.RemoveUnneededDrops.panic-unwind.diff deleted file mode 100644 index 445c1f82a96..00000000000 --- a/tests/mir-opt/remove_unneeded_drops.dont_opt.RemoveUnneededDrops.panic-unwind.diff +++ /dev/null @@ -1,30 +0,0 @@ -- // MIR for `dont_opt` before RemoveUnneededDrops -+ // MIR for `dont_opt` after RemoveUnneededDrops - - fn dont_opt(_1: Vec<bool>) -> () { - debug x => _1; - let mut _0: (); - let _2: (); - let mut _3: std::vec::Vec<bool>; - scope 1 (inlined std::mem::drop::<Vec<bool>>) { - } - - bb0: { - nop; - StorageLive(_3); - _3 = move _1; - drop(_3) -> [return: bb2, unwind: bb1]; - } - - bb1 (cleanup): { - resume; - } - - bb2: { - StorageDead(_3); - nop; - nop; - return; - } - } - diff --git a/tests/mir-opt/remove_unneeded_drops.opt.RemoveUnneededDrops.diff b/tests/mir-opt/remove_unneeded_drops.opt.RemoveUnneededDrops.diff new file mode 100644 index 00000000000..cb7e58ca1a1 --- /dev/null +++ b/tests/mir-opt/remove_unneeded_drops.opt.RemoveUnneededDrops.diff @@ -0,0 +1,15 @@ +- // MIR for `opt` before RemoveUnneededDrops ++ // MIR for `opt` after RemoveUnneededDrops + + fn opt(_1: bool) -> () { + let mut _0: (); + + bb0: { +- drop(_1) -> [return: bb1, unwind unreachable]; +- } +- +- bb1: { + return; + } + } + diff --git a/tests/mir-opt/remove_unneeded_drops.opt.RemoveUnneededDrops.panic-abort.diff b/tests/mir-opt/remove_unneeded_drops.opt.RemoveUnneededDrops.panic-abort.diff deleted file mode 100644 index 01eb6d4901f..00000000000 --- a/tests/mir-opt/remove_unneeded_drops.opt.RemoveUnneededDrops.panic-abort.diff +++ /dev/null @@ -1,26 +0,0 @@ -- // MIR for `opt` before RemoveUnneededDrops -+ // MIR for `opt` after RemoveUnneededDrops - - fn opt(_1: bool) -> () { - debug x => _1; - let mut _0: (); - let _2: (); - let mut _3: bool; - scope 1 (inlined std::mem::drop::<bool>) { - } - - bb0: { -- nop; - StorageLive(_3); - _3 = copy _1; -- drop(_3) -> [return: bb1, unwind unreachable]; -- } -- -- bb1: { - StorageDead(_3); -- nop; -- nop; - return; - } - } - diff --git a/tests/mir-opt/remove_unneeded_drops.opt.RemoveUnneededDrops.panic-unwind.diff b/tests/mir-opt/remove_unneeded_drops.opt.RemoveUnneededDrops.panic-unwind.diff deleted file mode 100644 index c2c3cb76e83..00000000000 --- a/tests/mir-opt/remove_unneeded_drops.opt.RemoveUnneededDrops.panic-unwind.diff +++ /dev/null @@ -1,26 +0,0 @@ -- // MIR for `opt` before RemoveUnneededDrops -+ // MIR for `opt` after RemoveUnneededDrops - - fn opt(_1: bool) -> () { - debug x => _1; - let mut _0: (); - let _2: (); - let mut _3: bool; - scope 1 (inlined std::mem::drop::<bool>) { - } - - bb0: { -- nop; - StorageLive(_3); - _3 = copy _1; -- drop(_3) -> [return: bb1, unwind continue]; -- } -- -- bb1: { - StorageDead(_3); -- nop; -- nop; - return; - } - } - diff --git a/tests/mir-opt/remove_unneeded_drops.opt_generic_copy.RemoveUnneededDrops.diff b/tests/mir-opt/remove_unneeded_drops.opt_generic_copy.RemoveUnneededDrops.diff new file mode 100644 index 00000000000..1e166eee9fb --- /dev/null +++ b/tests/mir-opt/remove_unneeded_drops.opt_generic_copy.RemoveUnneededDrops.diff @@ -0,0 +1,15 @@ +- // MIR for `opt_generic_copy` before RemoveUnneededDrops ++ // MIR for `opt_generic_copy` after RemoveUnneededDrops + + fn opt_generic_copy(_1: T) -> () { + let mut _0: (); + + bb0: { +- drop(_1) -> [return: bb1, unwind unreachable]; +- } +- +- bb1: { + return; + } + } + diff --git a/tests/mir-opt/remove_unneeded_drops.opt_generic_copy.RemoveUnneededDrops.panic-abort.diff b/tests/mir-opt/remove_unneeded_drops.opt_generic_copy.RemoveUnneededDrops.panic-abort.diff deleted file mode 100644 index a82ede6196e..00000000000 --- a/tests/mir-opt/remove_unneeded_drops.opt_generic_copy.RemoveUnneededDrops.panic-abort.diff +++ /dev/null @@ -1,26 +0,0 @@ -- // MIR for `opt_generic_copy` before RemoveUnneededDrops -+ // MIR for `opt_generic_copy` after RemoveUnneededDrops - - fn opt_generic_copy(_1: T) -> () { - debug x => _1; - let mut _0: (); - let _2: (); - let mut _3: T; - scope 1 (inlined std::mem::drop::<T>) { - } - - bb0: { -- nop; - StorageLive(_3); - _3 = copy _1; -- drop(_3) -> [return: bb1, unwind unreachable]; -- } -- -- bb1: { - StorageDead(_3); -- nop; -- nop; - return; - } - } - diff --git a/tests/mir-opt/remove_unneeded_drops.opt_generic_copy.RemoveUnneededDrops.panic-unwind.diff b/tests/mir-opt/remove_unneeded_drops.opt_generic_copy.RemoveUnneededDrops.panic-unwind.diff deleted file mode 100644 index 6e7c9ead740..00000000000 --- a/tests/mir-opt/remove_unneeded_drops.opt_generic_copy.RemoveUnneededDrops.panic-unwind.diff +++ /dev/null @@ -1,26 +0,0 @@ -- // MIR for `opt_generic_copy` before RemoveUnneededDrops -+ // MIR for `opt_generic_copy` after RemoveUnneededDrops - - fn opt_generic_copy(_1: T) -> () { - debug x => _1; - let mut _0: (); - let _2: (); - let mut _3: T; - scope 1 (inlined std::mem::drop::<T>) { - } - - bb0: { -- nop; - StorageLive(_3); - _3 = copy _1; -- drop(_3) -> [return: bb1, unwind continue]; -- } -- -- bb1: { - StorageDead(_3); -- nop; -- nop; - return; - } - } - diff --git a/tests/mir-opt/remove_unneeded_drops.rs b/tests/mir-opt/remove_unneeded_drops.rs index cad79e0aa0c..49dc611838e 100644 --- a/tests/mir-opt/remove_unneeded_drops.rs +++ b/tests/mir-opt/remove_unneeded_drops.rs @@ -1,28 +1,56 @@ -// skip-filecheck -// EMIT_MIR_FOR_EACH_PANIC_STRATEGY +//@ test-mir-pass: RemoveUnneededDrops + +#![feature(custom_mir, core_intrinsics)] +use std::intrinsics::mir::*; + // EMIT_MIR remove_unneeded_drops.opt.RemoveUnneededDrops.diff +#[custom_mir(dialect = "runtime")] fn opt(x: bool) { - drop(x); + // CHECK-LABEL: fn opt( + // CHECK-NOT: drop( + mir! { + { Drop(x, ReturnTo(bb1), UnwindUnreachable()) } + bb1 = { Return() } + } } // EMIT_MIR remove_unneeded_drops.dont_opt.RemoveUnneededDrops.diff +#[custom_mir(dialect = "runtime")] fn dont_opt(x: Vec<bool>) { - drop(x); + // CHECK-LABEL: fn dont_opt( + // CHECK: drop( + mir! { + { Drop(x, ReturnTo(bb1), UnwindUnreachable()) } + bb1 = { Return() } + } } // EMIT_MIR remove_unneeded_drops.opt_generic_copy.RemoveUnneededDrops.diff +#[custom_mir(dialect = "runtime")] fn opt_generic_copy<T: Copy>(x: T) { - drop(x); + // CHECK-LABEL: fn opt_generic_copy( + // CHECK-NOT: drop( + mir! { + { Drop(x, ReturnTo(bb1), UnwindUnreachable()) } + bb1 = { Return() } + } } // EMIT_MIR remove_unneeded_drops.cannot_opt_generic.RemoveUnneededDrops.diff // since the pass is not running on monomorphisized code, // we can't (but probably should) optimize this +#[custom_mir(dialect = "runtime")] fn cannot_opt_generic<T>(x: T) { - drop(x); + // CHECK-LABEL: fn cannot_opt_generic( + // CHECK: drop( + mir! { + { Drop(x, ReturnTo(bb1), UnwindUnreachable()) } + bb1 = { Return() } + } } fn main() { + // CHECK-LABEL: fn main( opt(true); opt_generic_copy(42); cannot_opt_generic(42); diff --git a/tests/mir-opt/sroa/simd_sroa.foo.ScalarReplacementOfAggregates.diff b/tests/mir-opt/sroa/simd_sroa.foo.ScalarReplacementOfAggregates.diff new file mode 100644 index 00000000000..74403247108 --- /dev/null +++ b/tests/mir-opt/sroa/simd_sroa.foo.ScalarReplacementOfAggregates.diff @@ -0,0 +1,32 @@ +- // MIR for `foo` before ScalarReplacementOfAggregates ++ // MIR for `foo` after ScalarReplacementOfAggregates + + fn foo(_1: &[Simd<u8, 16>], _2: Simd<u8, 16>) -> () { + debug simds => _1; + debug _unused => _2; + let mut _0: (); + let _3: std::simd::Simd<u8, 16>; + let _4: usize; + let mut _5: usize; + let mut _6: bool; + scope 1 { + debug a => _3; + } + + bb0: { + StorageLive(_3); + StorageLive(_4); + _4 = const 0_usize; + _5 = PtrMetadata(copy _1); + _6 = Lt(copy _4, copy _5); + assert(move _6, "index out of bounds: the length is {} but the index is {}", move _5, copy _4) -> [success: bb1, unwind continue]; + } + + bb1: { + _3 = copy (*_1)[_4]; + StorageDead(_4); + StorageDead(_3); + return; + } + } + diff --git a/tests/mir-opt/sroa/simd_sroa.rs b/tests/mir-opt/sroa/simd_sroa.rs new file mode 100644 index 00000000000..1ae84d3f975 --- /dev/null +++ b/tests/mir-opt/sroa/simd_sroa.rs @@ -0,0 +1,18 @@ +//@ needs-unwind +#![feature(portable_simd)] + +// SRoA expands things even if they're unused +// <https://github.com/rust-lang/rust/issues/144621> + +use std::simd::Simd; + +// EMIT_MIR simd_sroa.foo.ScalarReplacementOfAggregates.diff +pub(crate) fn foo(simds: &[Simd<u8, 16>], _unused: Simd<u8, 16>) { + // CHECK-LABEL: fn foo + // CHECK-NOT: [u8; 16] + // CHECK: let [[SIMD:_.+]]: std::simd::Simd<u8, 16>; + // CHECK-NOT: [u8; 16] + // CHECK: [[SIMD]] = copy (*_1)[0 of 1]; + // CHECK-NOT: [u8; 16] + let a = simds[0]; +} diff --git a/tests/mir-opt/tail_call_drops.f_with_arg.ElaborateDrops.panic-abort.diff b/tests/mir-opt/tail_call_drops.f_with_arg.ElaborateDrops.panic-abort.diff index a8c57d2cfe0..4fba0032729 100644 --- a/tests/mir-opt/tail_call_drops.f_with_arg.ElaborateDrops.panic-abort.diff +++ b/tests/mir-opt/tail_call_drops.f_with_arg.ElaborateDrops.panic-abort.diff @@ -93,7 +93,7 @@ } bb11: { - tailcall g_with_arg(Spanned { node: move _10, span: $DIR/tail_call_drops.rs:36:23: 36:36 (#0) }, Spanned { node: move _11, span: $DIR/tail_call_drops.rs:36:38: 36:51 (#0) }); + tailcall g_with_arg(move _10, move _11); } bb12 (cleanup): { diff --git a/tests/mir-opt/tail_call_drops.f_with_arg.ElaborateDrops.panic-unwind.diff b/tests/mir-opt/tail_call_drops.f_with_arg.ElaborateDrops.panic-unwind.diff index a8c57d2cfe0..4fba0032729 100644 --- a/tests/mir-opt/tail_call_drops.f_with_arg.ElaborateDrops.panic-unwind.diff +++ b/tests/mir-opt/tail_call_drops.f_with_arg.ElaborateDrops.panic-unwind.diff @@ -93,7 +93,7 @@ } bb11: { - tailcall g_with_arg(Spanned { node: move _10, span: $DIR/tail_call_drops.rs:36:23: 36:36 (#0) }, Spanned { node: move _11, span: $DIR/tail_call_drops.rs:36:38: 36:51 (#0) }); + tailcall g_with_arg(move _10, move _11); } bb12 (cleanup): { diff --git a/tests/mir-opt/tail_call_drops.f_with_arg.built.after.panic-abort.mir b/tests/mir-opt/tail_call_drops.f_with_arg.built.after.panic-abort.mir index f89b98a3205..9ec358ec189 100644 --- a/tests/mir-opt/tail_call_drops.f_with_arg.built.after.panic-abort.mir +++ b/tests/mir-opt/tail_call_drops.f_with_arg.built.after.panic-abort.mir @@ -90,7 +90,7 @@ fn f_with_arg(_1: String, _2: String) -> () { } bb11: { - tailcall g_with_arg(Spanned { node: move _10, span: $DIR/tail_call_drops.rs:36:23: 36:36 (#0) }, Spanned { node: move _11, span: $DIR/tail_call_drops.rs:36:38: 36:51 (#0) }); + tailcall g_with_arg(move _10, move _11); } bb12: { diff --git a/tests/mir-opt/tail_call_drops.f_with_arg.built.after.panic-unwind.mir b/tests/mir-opt/tail_call_drops.f_with_arg.built.after.panic-unwind.mir index f89b98a3205..9ec358ec189 100644 --- a/tests/mir-opt/tail_call_drops.f_with_arg.built.after.panic-unwind.mir +++ b/tests/mir-opt/tail_call_drops.f_with_arg.built.after.panic-unwind.mir @@ -90,7 +90,7 @@ fn f_with_arg(_1: String, _2: String) -> () { } bb11: { - tailcall g_with_arg(Spanned { node: move _10, span: $DIR/tail_call_drops.rs:36:23: 36:36 (#0) }, Spanned { node: move _11, span: $DIR/tail_call_drops.rs:36:38: 36:51 (#0) }); + tailcall g_with_arg(move _10, move _11); } bb12: { diff --git a/tests/run-make/cross-lang-lto-clang/rmake.rs b/tests/run-make/cross-lang-lto-clang/rmake.rs index 3fed6ea2066..f209318abbc 100644 --- a/tests/run-make/cross-lang-lto-clang/rmake.rs +++ b/tests/run-make/cross-lang-lto-clang/rmake.rs @@ -28,7 +28,17 @@ static C_NEVER_INLINED_PATTERN: &'static str = "bl.*<c_never_inlined>"; static C_NEVER_INLINED_PATTERN: &'static str = "call.*c_never_inlined"; fn main() { + test_lto(false); + test_lto(true); +} + +fn test_lto(fat_lto: bool) { + let lto = if fat_lto { "fat" } else { "thin" }; + let clang_lto = if fat_lto { "full" } else { "thin" }; + println!("Running {lto} lto"); + rustc() + .lto(lto) .linker_plugin_lto("on") .output(static_lib_name("rustlib-xlto")) .opt_level("2") @@ -36,30 +46,36 @@ fn main() { .input("rustlib.rs") .run(); clang() - .lto("thin") + .lto(clang_lto) .use_ld("lld") .arg("-lrustlib-xlto") .out_exe("cmain") .input("cmain.c") .arg("-O3") .run(); + + let dump = llvm_objdump().disassemble().input("cmain").run(); // Make sure we don't find a call instruction to the function we expect to // always be inlined. - llvm_objdump() - .disassemble() - .input("cmain") - .run() - .assert_stdout_not_contains_regex(RUST_ALWAYS_INLINED_PATTERN); + dump.assert_stdout_not_contains_regex(RUST_ALWAYS_INLINED_PATTERN); // As a sanity check, make sure we do find a call instruction to a // non-inlined function - llvm_objdump() - .disassemble() - .input("cmain") - .run() - .assert_stdout_contains_regex(RUST_NEVER_INLINED_PATTERN); - clang().input("clib.c").lto("thin").arg("-c").out_exe("clib.o").arg("-O2").run(); + #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] + dump.assert_stdout_contains_regex(RUST_NEVER_INLINED_PATTERN); + #[cfg(any(target_arch = "aarch64", target_arch = "arm"))] + { + if fat_lto { + // fat lto inlines this anyway + dump.assert_stdout_not_contains_regex(RUST_NEVER_INLINED_PATTERN); + } else { + dump.assert_stdout_contains_regex(RUST_NEVER_INLINED_PATTERN); + } + } + + clang().input("clib.c").lto(clang_lto).arg("-c").out_exe("clib.o").arg("-O2").run(); llvm_ar().obj_to_ar().output_input(static_lib_name("xyz"), "clib.o").run(); rustc() + .lto(lto) .linker_plugin_lto("on") .opt_level("2") .linker(&env_var("CLANG")) @@ -67,14 +83,13 @@ fn main() { .input("main.rs") .output("rsmain") .run(); - llvm_objdump() - .disassemble() - .input("rsmain") - .run() - .assert_stdout_not_contains_regex(C_ALWAYS_INLINED_PATTERN); - llvm_objdump() - .disassemble() - .input("rsmain") - .run() - .assert_stdout_contains_regex(C_NEVER_INLINED_PATTERN); + + let dump = llvm_objdump().disassemble().input("rsmain").run(); + dump.assert_stdout_not_contains_regex(C_ALWAYS_INLINED_PATTERN); + if fat_lto { + // fat lto inlines this anyway + dump.assert_stdout_not_contains_regex(C_NEVER_INLINED_PATTERN); + } else { + dump.assert_stdout_contains_regex(C_NEVER_INLINED_PATTERN); + } } diff --git a/tests/run-make/fat-then-thin-lto/lib.rs b/tests/run-make/fat-then-thin-lto/lib.rs new file mode 100644 index 00000000000..c675dcb6e8a --- /dev/null +++ b/tests/run-make/fat-then-thin-lto/lib.rs @@ -0,0 +1,13 @@ +#![allow(internal_features)] +#![feature(no_core, lang_items)] +#![no_core] +#![crate_type = "rlib"] + +#[lang = "pointee_sized"] +trait PointeeSized {} +#[lang = "meta_sized"] +trait MetaSized: PointeeSized {} +#[lang = "sized"] +trait Sized: MetaSized {} + +pub fn foo() {} diff --git a/tests/run-make/fat-then-thin-lto/main.rs b/tests/run-make/fat-then-thin-lto/main.rs new file mode 100644 index 00000000000..a3f2e18158b --- /dev/null +++ b/tests/run-make/fat-then-thin-lto/main.rs @@ -0,0 +1,11 @@ +#![allow(internal_features)] +#![feature(no_core, lang_items)] +#![no_core] +#![crate_type = "cdylib"] + +extern crate lib; + +#[unsafe(no_mangle)] +pub fn bar() { + lib::foo(); +} diff --git a/tests/run-make/fat-then-thin-lto/rmake.rs b/tests/run-make/fat-then-thin-lto/rmake.rs new file mode 100644 index 00000000000..ef4f26689d4 --- /dev/null +++ b/tests/run-make/fat-then-thin-lto/rmake.rs @@ -0,0 +1,25 @@ +// Compile a library with lto=fat, then compile a binary with lto=thin +// and check that lto is applied with the library. +// The goal is to mimic the standard library being build with lto=fat +// and allowing users to build with lto=thin. + +//@ only-x86_64-unknown-linux-gnu + +use run_make_support::{dynamic_lib_name, llvm_objdump, rustc}; + +fn main() { + rustc().input("lib.rs").opt_level("3").lto("fat").run(); + rustc().input("main.rs").panic("abort").opt_level("3").lto("thin").run(); + + llvm_objdump() + .input(dynamic_lib_name("main")) + .arg("--disassemble-symbols=bar") + .run() + // The called function should be inlined. + // Check that we have a ret (to detect tail + // calls with a jmp) and no call. + .assert_stdout_contains("bar") + .assert_stdout_contains("ret") + .assert_stdout_not_contains("foo") + .assert_stdout_not_contains("call"); +} diff --git a/tests/run-make/libtest-json/output-default.json b/tests/run-make/libtest-json/output-default.json index a6a8a9f3b47..5371715d17c 100644 --- a/tests/run-make/libtest-json/output-default.json +++ b/tests/run-make/libtest-json/output-default.json @@ -2,7 +2,7 @@ { "type": "test", "event": "started", "name": "a" } { "type": "test", "name": "a", "event": "ok" } { "type": "test", "event": "started", "name": "b" } -{ "type": "test", "name": "b", "event": "failed", "stdout": "\nthread 'b' panicked at f.rs:9:5:\nassertion failed: false\nnote: run with `RUST_BACKTRACE=1` environment variable to display a backtrace\n" } +{ "type": "test", "name": "b", "event": "failed", "stdout": "\nthread 'b' ($TID) panicked at f.rs:9:5:\nassertion failed: false\nnote: run with `RUST_BACKTRACE=1` environment variable to display a backtrace\n" } { "type": "test", "event": "started", "name": "c" } { "type": "test", "name": "c", "event": "ok" } { "type": "test", "event": "started", "name": "d" } diff --git a/tests/run-make/libtest-json/output-stdout-success.json b/tests/run-make/libtest-json/output-stdout-success.json index a6c36e746b3..5caadcf56cf 100644 --- a/tests/run-make/libtest-json/output-stdout-success.json +++ b/tests/run-make/libtest-json/output-stdout-success.json @@ -2,9 +2,9 @@ { "type": "test", "event": "started", "name": "a" } { "type": "test", "name": "a", "event": "ok", "stdout": "print from successful test\n" } { "type": "test", "event": "started", "name": "b" } -{ "type": "test", "name": "b", "event": "failed", "stdout": "\nthread 'b' panicked at f.rs:9:5:\nassertion failed: false\nnote: run with `RUST_BACKTRACE=1` environment variable to display a backtrace\n" } +{ "type": "test", "name": "b", "event": "failed", "stdout": "\nthread 'b' ($TID) panicked at f.rs:9:5:\nassertion failed: false\nnote: run with `RUST_BACKTRACE=1` environment variable to display a backtrace\n" } { "type": "test", "event": "started", "name": "c" } -{ "type": "test", "name": "c", "event": "ok", "stdout": "\nthread 'c' panicked at f.rs:15:5:\nassertion failed: false\n" } +{ "type": "test", "name": "c", "event": "ok", "stdout": "\nthread 'c' ($TID) panicked at f.rs:15:5:\nassertion failed: false\n" } { "type": "test", "event": "started", "name": "d" } { "type": "test", "name": "d", "event": "ignored", "message": "msg" } { "type": "suite", "event": "failed", "passed": 2, "failed": 1, "ignored": 1, "measured": 0, "filtered_out": 0, "exec_time": "$EXEC_TIME" } diff --git a/tests/run-make/libtest-json/rmake.rs b/tests/run-make/libtest-json/rmake.rs index c31f4a79b64..034ba6246f1 100644 --- a/tests/run-make/libtest-json/rmake.rs +++ b/tests/run-make/libtest-json/rmake.rs @@ -38,5 +38,6 @@ fn run_tests(extra_args: &[&str], expected_file: &str) { .expected_file(expected_file) .actual_text("stdout", test_stdout) .normalize(r#"(?<prefix>"exec_time": )[0-9.]+"#, r#"${prefix}"$$EXEC_TIME""#) + .normalize(r"thread '(?P<name>.*?)' \(\d+\) panicked", "thread '$name' ($$TID) panicked") .run(); } diff --git a/tests/run-make/libtest-junit/output-default.xml b/tests/run-make/libtest-junit/output-default.xml index aa1b8c855aa..2467d8d940a 100644 --- a/tests/run-make/libtest-junit/output-default.xml +++ b/tests/run-make/libtest-junit/output-default.xml @@ -1 +1 @@ -<?xml version="1.0" encoding="UTF-8"?><testsuites><testsuite name="test" package="test" id="0" errors="0" failures="1" tests="4" skipped="1" ><testcase classname="unknown" name="a" time="$TIME"/><testcase classname="unknown" name="b" time="$TIME"><failure type="assert"/><system-out><![CDATA[print from failing test]]>

<![CDATA[thread 'b' panicked at f.rs:10:5:]]>
<![CDATA[assertion failed: false]]>
<![CDATA[note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace]]>
<![CDATA[]]></system-out></testcase><testcase classname="unknown" name="c" time="$TIME"/><system-out/><system-err/></testsuite></testsuites> +<?xml version="1.0" encoding="UTF-8"?><testsuites><testsuite name="test" package="test" id="0" errors="0" failures="1" tests="4" skipped="1" ><testcase classname="unknown" name="a" time="$TIME"/><testcase classname="unknown" name="b" time="$TIME"><failure type="assert"/><system-out><![CDATA[print from failing test]]>

<![CDATA[thread 'b' ($TID) panicked at f.rs:10:5:]]>
<![CDATA[assertion failed: false]]>
<![CDATA[note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace]]>
<![CDATA[]]></system-out></testcase><testcase classname="unknown" name="c" time="$TIME"/><system-out/><system-err/></testsuite></testsuites> diff --git a/tests/run-make/libtest-junit/output-stdout-success.xml b/tests/run-make/libtest-junit/output-stdout-success.xml index 2592ec7efb1..6bf1d7008a4 100644 --- a/tests/run-make/libtest-junit/output-stdout-success.xml +++ b/tests/run-make/libtest-junit/output-stdout-success.xml @@ -1 +1 @@ -<?xml version="1.0" encoding="UTF-8"?><testsuites><testsuite name="test" package="test" id="0" errors="0" failures="1" tests="4" skipped="1" ><testcase classname="unknown" name="a" time="$TIME"><system-out><![CDATA[print from successful test]]>
<![CDATA[]]></system-out></testcase><testcase classname="unknown" name="b" time="$TIME"><failure type="assert"/><system-out><![CDATA[print from failing test]]>

<![CDATA[thread 'b' panicked at f.rs:10:5:]]>
<![CDATA[assertion failed: false]]>
<![CDATA[note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace]]>
<![CDATA[]]></system-out></testcase><testcase classname="unknown" name="c" time="$TIME"><system-out><![CDATA[]]>
<![CDATA[thread 'c' panicked at f.rs:16:5:]]>
<![CDATA[assertion failed: false]]>
<![CDATA[]]></system-out></testcase><system-out/><system-err/></testsuite></testsuites> +<?xml version="1.0" encoding="UTF-8"?><testsuites><testsuite name="test" package="test" id="0" errors="0" failures="1" tests="4" skipped="1" ><testcase classname="unknown" name="a" time="$TIME"><system-out><![CDATA[print from successful test]]>
<![CDATA[]]></system-out></testcase><testcase classname="unknown" name="b" time="$TIME"><failure type="assert"/><system-out><![CDATA[print from failing test]]>

<![CDATA[thread 'b' ($TID) panicked at f.rs:10:5:]]>
<![CDATA[assertion failed: false]]>
<![CDATA[note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace]]>
<![CDATA[]]></system-out></testcase><testcase classname="unknown" name="c" time="$TIME"><system-out><![CDATA[]]>
<![CDATA[thread 'c' ($TID) panicked at f.rs:16:5:]]>
<![CDATA[assertion failed: false]]>
<![CDATA[]]></system-out></testcase><system-out/><system-err/></testsuite></testsuites> diff --git a/tests/run-make/libtest-junit/rmake.rs b/tests/run-make/libtest-junit/rmake.rs index 5917660b6c7..6961be21513 100644 --- a/tests/run-make/libtest-junit/rmake.rs +++ b/tests/run-make/libtest-junit/rmake.rs @@ -27,5 +27,6 @@ fn run_tests(extra_args: &[&str], expected_file: &str) { .expected_file(expected_file) .actual_text("stdout", test_stdout) .normalize(r#"\btime="[0-9.]+""#, r#"time="$$TIME""#) + .normalize(r"thread '(?P<name>.*?)' \(\d+\) panicked", "thread '$name' ($$TID) panicked") .run(); } diff --git a/tests/run-make/linker-plugin-lto-fat/ir.ll b/tests/run-make/linker-plugin-lto-fat/ir.ll new file mode 100644 index 00000000000..fa3dbdd4e08 --- /dev/null +++ b/tests/run-make/linker-plugin-lto-fat/ir.ll @@ -0,0 +1,6 @@ +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-unknown-linux-gnu" + +define void @ir_callee() { + ret void +} diff --git a/tests/run-make/linker-plugin-lto-fat/main.rs b/tests/run-make/linker-plugin-lto-fat/main.rs new file mode 100644 index 00000000000..ad2a90bc801 --- /dev/null +++ b/tests/run-make/linker-plugin-lto-fat/main.rs @@ -0,0 +1,22 @@ +#![allow(internal_features)] +#![feature(no_core, lang_items)] +#![no_core] +#![crate_type = "cdylib"] + +#[lang = "pointee_sized"] +trait PointeeSized {} +#[lang = "meta_sized"] +trait MetaSized: PointeeSized {} +#[lang = "sized"] +trait Sized: MetaSized {} + +extern "C" { + fn ir_callee(); +} + +#[no_mangle] +extern "C" fn rs_foo() { + unsafe { + ir_callee(); + } +} diff --git a/tests/run-make/linker-plugin-lto-fat/rmake.rs b/tests/run-make/linker-plugin-lto-fat/rmake.rs new file mode 100644 index 00000000000..ff5b647a594 --- /dev/null +++ b/tests/run-make/linker-plugin-lto-fat/rmake.rs @@ -0,0 +1,33 @@ +// Check that -C lto=fat with -C linker-plugin-lto actually works and can inline functions. +// A library is created from LLVM IR, defining a single function. Then a dylib is compiled, +// linking to the library and calling the function from the library. +// The function from the library should end up inlined and disappear from the output. + +//@ only-x86_64-unknown-linux-gnu +//@ needs-rust-lld + +use run_make_support::{dynamic_lib_name, llvm_as, llvm_objdump, rustc}; + +fn main() { + llvm_as().input("ir.ll").run(); + rustc() + .input("main.rs") + .opt_level("3") + .lto("fat") + .linker_plugin_lto("on") + .link_arg("ir.bc") + .arg("-Zunstable-options") + .arg("-Clinker-features=+lld") + .run(); + + llvm_objdump() + .input(dynamic_lib_name("main")) + .arg("--disassemble-symbols=rs_foo") + .run() + // The called function should be inlined. + // Check that we have a ret (to detect tail + // calls with a jmp) and no call. + .assert_stdout_contains("foo") + .assert_stdout_contains("ret") + .assert_stdout_not_contains("call"); +} diff --git a/tests/run-make/rustdoc-scrape-examples-paths/foo/Cargo.toml b/tests/run-make/rustdoc-scrape-examples-paths/foo/Cargo.toml new file mode 100644 index 00000000000..6962028375b --- /dev/null +++ b/tests/run-make/rustdoc-scrape-examples-paths/foo/Cargo.toml @@ -0,0 +1,8 @@ +[package] +name = "foo" +version = "0.0.1" +edition = "2024" + +[[example]] +name = "complex" +doc-scrape-examples = true diff --git a/tests/run-make/rustdoc-scrape-examples-paths/foo/examples/complex.rs b/tests/run-make/rustdoc-scrape-examples-paths/foo/examples/complex.rs new file mode 100644 index 00000000000..1cda7e098f4 --- /dev/null +++ b/tests/run-make/rustdoc-scrape-examples-paths/foo/examples/complex.rs @@ -0,0 +1,3 @@ +fn main() { + let mut x = foo::X::new(); +} diff --git a/tests/run-make/rustdoc-scrape-examples-paths/foo/examples/tester.rs b/tests/run-make/rustdoc-scrape-examples-paths/foo/examples/tester.rs new file mode 100644 index 00000000000..fbd1906ec09 --- /dev/null +++ b/tests/run-make/rustdoc-scrape-examples-paths/foo/examples/tester.rs @@ -0,0 +1 @@ +// This file MUST exist to trigger the original bug. diff --git a/tests/run-make/rustdoc-scrape-examples-paths/foo/src/lib.rs b/tests/run-make/rustdoc-scrape-examples-paths/foo/src/lib.rs new file mode 100644 index 00000000000..a9bb0272c78 --- /dev/null +++ b/tests/run-make/rustdoc-scrape-examples-paths/foo/src/lib.rs @@ -0,0 +1,7 @@ +pub struct X; + +impl X { + pub fn new() -> Self { + X + } +} diff --git a/tests/run-make/rustdoc-scrape-examples-paths/rmake.rs b/tests/run-make/rustdoc-scrape-examples-paths/rmake.rs new file mode 100644 index 00000000000..03888f69eab --- /dev/null +++ b/tests/run-make/rustdoc-scrape-examples-paths/rmake.rs @@ -0,0 +1,16 @@ +//! Test to ensure that the rustdoc `scrape-examples` feature is not panicking. +//! Regression test for <https://github.com/rust-lang/rust/issues/144752>. + +use run_make_support::{cargo, path, rfs}; + +fn main() { + // We copy the crate to be documented "outside" to prevent documenting + // the whole compiler. + let tmp = std::env::temp_dir(); + let test_crate = tmp.join("foo"); + rfs::copy_dir_all(path("foo"), &test_crate); + + // The `scrape-examples` feature is also implemented in `cargo` so instead of reproducing + // what `cargo` does, better to just let `cargo` do it. + cargo().current_dir(&test_crate).args(["doc", "-p", "foo", "-Zrustdoc-scrape-examples"]).run(); +} diff --git a/tests/run-make/symbols-all-mangled/rmake.rs b/tests/run-make/symbols-all-mangled/rmake.rs index 2cf57975800..e30bef98580 100644 --- a/tests/run-make/symbols-all-mangled/rmake.rs +++ b/tests/run-make/symbols-all-mangled/rmake.rs @@ -35,13 +35,7 @@ fn symbols_check_archive(path: &str) { continue; // All compiler-builtins symbols must remain unmangled } - if name.contains("rust_eh_personality") { - continue; // Unfortunately LLVM doesn't allow us to mangle this symbol - } - - if name.contains(".llvm.") { - // Starting in LLVM 21 we get various implementation-detail functions which - // contain .llvm. that are not a problem. + if symbol_ok_everywhere(name) { continue; } @@ -71,13 +65,7 @@ fn symbols_check(path: &str) { continue; } - if name.contains("rust_eh_personality") { - continue; // Unfortunately LLVM doesn't allow us to mangle this symbol - } - - if name.contains(".llvm.") { - // Starting in LLVM 21 we get various implementation-detail functions which - // contain .llvm. that are not a problem. + if symbol_ok_everywhere(name) { continue; } @@ -88,3 +76,22 @@ fn symbols_check(path: &str) { fn strip_underscore_if_apple(symbol: &str) -> &str { if cfg!(target_vendor = "apple") { symbol.strip_prefix("_").unwrap() } else { symbol } } + +fn symbol_ok_everywhere(name: &str) -> bool { + if name.contains("rust_eh_personality") { + return true; // Unfortunately LLVM doesn't allow us to mangle this symbol + } + + if name.contains(".llvm.") { + // Starting in LLVM 21 we get various implementation-detail functions which + // contain .llvm. that are not a problem. + return true; + } + + if name.starts_with("__rustc_debug_gdb_scripts_section") { + // These symbols are fine; they're made unique by the crate ID. + return true; + } + + return false; +} diff --git a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/rmake.rs b/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/rmake.rs index e58762aeb6d..89754cdaf90 100644 --- a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/rmake.rs +++ b/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/rmake.rs @@ -13,42 +13,56 @@ //@ only-x86_64-fortanix-unknown-sgx -use run_make_support::{cmd, cwd, llvm_filecheck, llvm_objdump, regex, set_current_dir, target}; +use run_make_support::{ + cargo, cwd, llvm_filecheck, llvm_objdump, regex, run, set_current_dir, target, +}; fn main() { - let main_dir = cwd(); - set_current_dir("enclave"); - // HACK(eddyb) sets `RUSTC_BOOTSTRAP=1` so Cargo can accept nightly features. - // These come from the top-level Rust workspace, that this crate is not a - // member of, but Cargo tries to load the workspace `Cargo.toml` anyway. - cmd("cargo") - .env("RUSTC_BOOTSTRAP", "1") + cargo() .arg("-v") - .arg("run") + .arg("build") .arg("--target") .arg(target()) + .current_dir("enclave") + .env("CC_x86_64_fortanix_unknown_sgx", "clang") + .env( + "CFLAGS_x86_64_fortanix_unknown_sgx", + "-D__ELF__ -isystem/usr/include/x86_64-linux-gnu -mlvi-hardening -mllvm -x86-experimental-lvi-inline-asm-hardening", + ) + .env("CXX_x86_64_fortanix_unknown_sgx", "clang++") + .env( + "CXXFLAGS_x86_64_fortanix_unknown_sgx", + "-D__ELF__ -isystem/usr/include/x86_64-linux-gnu -mlvi-hardening -mllvm -x86-experimental-lvi-inline-asm-hardening", + ) .run(); - set_current_dir(&main_dir); - // Rust has various ways of adding code to a binary: + + // Rust has several ways of including machine code into a binary: + // // - Rust code // - Inline assembly // - Global assembly // - C/C++ code compiled as part of Rust crates - // For those different kinds, we do have very small code examples that should be - // mitigated in some way. Mostly we check that ret instructions should no longer be present. + // + // For each of those, check that the mitigations are applied. Mostly we check + // that ret instructions are no longer present. + + // Check that normal rust code has the right mitigations. check("unw_getcontext", "unw_getcontext.checks"); check("__libunwind_Registers_x86_64_jumpto", "jumpto.checks"); check("std::io::stdio::_print::[[:alnum:]]+", "print.with_frame_pointers.checks"); + // Check that rust global assembly has the right mitigations. check("rust_plus_one_global_asm", "rust_plus_one_global_asm.checks"); + // Check that C code compiled using the `cc` crate has the right mitigations. check("cc_plus_one_c", "cc_plus_one_c.checks"); check("cc_plus_one_c_asm", "cc_plus_one_c_asm.checks"); check("cc_plus_one_cxx", "cc_plus_one_cxx.checks"); check("cc_plus_one_cxx_asm", "cc_plus_one_cxx_asm.checks"); check("cc_plus_one_asm", "cc_plus_one_asm.checks"); + // Check that C++ code compiled using the `cc` crate has the right mitigations. check("cmake_plus_one_c", "cmake_plus_one_c.checks"); check("cmake_plus_one_c_asm", "cmake_plus_one_c_asm.checks"); check("cmake_plus_one_c_global_asm", "cmake_plus_one_c_global_asm.checks"); @@ -71,8 +85,7 @@ fn check(func_re: &str, mut checks: &str) { .input("enclave/target/x86_64-fortanix-unknown-sgx/debug/enclave") .args(&["--demangle", &format!("--disassemble-symbols={func}")]) .run() - .stdout_utf8(); - let dump = dump.as_bytes(); + .stdout(); // Unique case, must succeed at one of two possible tests. // This is because frame pointers are optional, and them being enabled requires diff --git a/tests/rustdoc-gui/notable-trait.goml b/tests/rustdoc-gui/notable-trait.goml index 7fc70e0675d..423a273fde7 100644 --- a/tests/rustdoc-gui/notable-trait.goml +++ b/tests/rustdoc-gui/notable-trait.goml @@ -8,10 +8,10 @@ define-function: ( [x, i_x], block { // Checking they have the same y position. - compare-elements-position: ( + compare-elements-position-near: ( "//*[@id='method.create_an_iterator_from_read']//a[normalize-space()='NotableStructWithLongName']", "//*[@id='method.create_an_iterator_from_read']//*[@class='tooltip']", - ["y"], + {"y": 1}, ) // Checking they don't have the same x position. compare-elements-position-false: ( diff --git a/tests/rustdoc-gui/src/test_docs/lib.rs b/tests/rustdoc-gui/src/test_docs/lib.rs index e8afe8b5687..623f5b33e9b 100644 --- a/tests/rustdoc-gui/src/test_docs/lib.rs +++ b/tests/rustdoc-gui/src/test_docs/lib.rs @@ -767,3 +767,17 @@ pub mod impls_indent { pub fn bar() {} } } + +pub mod tooltips { + pub struct X; + + impl X { + pub fn bar() -> Vec<u8> { + Vec::new() + } + } + + pub fn bar() -> Vec<u8> { + Vec::new() + } +} diff --git a/tests/rustdoc-gui/tooltips.goml b/tests/rustdoc-gui/tooltips.goml new file mode 100644 index 00000000000..6e79196be27 --- /dev/null +++ b/tests/rustdoc-gui/tooltips.goml @@ -0,0 +1,15 @@ +// This test checks that the right font is applied to the `i` tooltip element. + +define-function: ( + "check-font", + [path], + block { + go-to: "file://" + |DOC_PATH| + "/test_docs/" + |path| + assert-css: ( + "a.tooltip", {"font-family": '"Source Serif 4", NanumBarunGothic, serif'}, ALL, + ) + } +) + +call-function: ("check-font", {"path": "tooltips/fn.bar.html"}) +call-function: ("check-font", {"path": "tooltips/struct.X.html"}) diff --git a/tests/rustdoc-json/attrs/macro_export.rs b/tests/rustdoc-json/attrs/macro_export.rs new file mode 100644 index 00000000000..5d487cf6a56 --- /dev/null +++ b/tests/rustdoc-json/attrs/macro_export.rs @@ -0,0 +1,40 @@ +//@ compile-flags: --document-private-items + +//@ set exported_id = "$.index[?(@.name=='exported')].id" +//@ is "$.index[?(@.name=='exported')].attrs" '["macro_export"]' +//@ is "$.index[?(@.name=='exported')].visibility" '"public"' + +#[macro_export] +macro_rules! exported { + () => {}; +} + +//@ set not_exported_id = "$.index[?(@.name=='not_exported')].id" +//@ is "$.index[?(@.name=='not_exported')].attrs" [] +//@ is "$.index[?(@.name=='not_exported')].visibility" '"crate"' +macro_rules! not_exported { + () => {}; +} + +//@ set module_id = "$.index[?(@.name=='module')].id" +pub mod module { + //@ set exported_from_mod_id = "$.index[?(@.name=='exported_from_mod')].id" + //@ is "$.index[?(@.name=='exported_from_mod')].attrs" '["macro_export"]' + //@ is "$.index[?(@.name=='exported_from_mod')].visibility" '"public"' + #[macro_export] + macro_rules! exported_from_mod { + () => {}; + } + + //@ set not_exported_from_mod_id = "$.index[?(@.name=='not_exported_from_mod')].id" + //@ is "$.index[?(@.name=='not_exported_from_mod')].attrs" [] + //@ is "$.index[?(@.name=='not_exported_from_mod')].visibility" '"crate"' + macro_rules! not_exported_from_mod { + () => {}; + } +} +// The non-exported macro's are left in place, but the #[macro_export]'d ones +// are moved to the crate root. + +//@ is "$.index[?(@.name=='module')].inner.module.items[*]" $not_exported_from_mod_id +//@ ismany "$.index[?(@.name=='macro_export')].inner.module.items[*]" $exported_id $not_exported_id $module_id $exported_from_mod_id diff --git a/tests/rustdoc-ui/2024-doctests-checks.rs b/tests/rustdoc-ui/2024-doctests-checks.rs index 0c3a11771f3..61f90fe6231 100644 --- a/tests/rustdoc-ui/2024-doctests-checks.rs +++ b/tests/rustdoc-ui/2024-doctests-checks.rs @@ -3,6 +3,8 @@ //@ compile-flags: --test --test-args=--test-threads=1 //@ normalize-stdout: "tests/rustdoc-ui" -> "$$DIR" //@ normalize-stdout: "finished in \d+\.\d+s" -> "finished in $$TIME" +//@ normalize-stdout: "ran in \d+\.\d+s" -> "ran in $$TIME" +//@ normalize-stdout: "compilation took \d+\.\d+s" -> "compilation took $$TIME" //@ normalize-stdout: ".rs:\d+:\d+" -> ".rs:$$LINE:$$COL" /// ``` diff --git a/tests/rustdoc-ui/2024-doctests-checks.stdout b/tests/rustdoc-ui/2024-doctests-checks.stdout index 534fe466fe7..c86eafd61b9 100644 --- a/tests/rustdoc-ui/2024-doctests-checks.stdout +++ b/tests/rustdoc-ui/2024-doctests-checks.stdout @@ -1,12 +1,13 @@ running 1 test -test $DIR/2024-doctests-checks.rs - Foo (line 8) ... ok +test $DIR/2024-doctests-checks.rs - Foo (line 10) ... ok test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME running 1 test -test $DIR/2024-doctests-checks.rs - Foo (line 15) ... ok +test $DIR/2024-doctests-checks.rs - Foo (line 17) ... ok test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME +all doctests ran in $TIME; merged doctests compilation took $TIME diff --git a/tests/rustdoc-ui/2024-doctests-crate-attribute.rs b/tests/rustdoc-ui/2024-doctests-crate-attribute.rs index c9887cbc63b..416d50cb070 100644 --- a/tests/rustdoc-ui/2024-doctests-crate-attribute.rs +++ b/tests/rustdoc-ui/2024-doctests-crate-attribute.rs @@ -4,6 +4,8 @@ //@ normalize-stdout: "tests/rustdoc-ui" -> "$$DIR" //@ normalize-stdout: "finished in \d+\.\d+s" -> "finished in $$TIME" //@ normalize-stdout: ".rs:\d+:\d+" -> ".rs:$$LINE:$$COL" +//@ normalize-stdout: "ran in \d+\.\d+s" -> "ran in $$TIME" +//@ normalize-stdout: "compilation took \d+\.\d+s" -> "compilation took $$TIME" /// This doctest is used to ensure that if a crate attribute is present, /// it will not be part of the merged doctests. diff --git a/tests/rustdoc-ui/2024-doctests-crate-attribute.stdout b/tests/rustdoc-ui/2024-doctests-crate-attribute.stdout index c084ac4522e..20618426312 100644 --- a/tests/rustdoc-ui/2024-doctests-crate-attribute.stdout +++ b/tests/rustdoc-ui/2024-doctests-crate-attribute.stdout @@ -1,12 +1,13 @@ running 1 test -test $DIR/2024-doctests-crate-attribute.rs - Foo (line 20) ... ok +test $DIR/2024-doctests-crate-attribute.rs - Foo (line 22) ... ok test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME running 1 test -test $DIR/2024-doctests-crate-attribute.rs - Foo (line 11) ... ok +test $DIR/2024-doctests-crate-attribute.rs - Foo (line 13) ... ok test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME +all doctests ran in $TIME; merged doctests compilation took $TIME diff --git a/tests/rustdoc-ui/disambiguator-endswith-named-suffix.rs b/tests/rustdoc-ui/disambiguator-endswith-named-suffix.rs index 1174e16dd53..cb277d529ce 100644 --- a/tests/rustdoc-ui/disambiguator-endswith-named-suffix.rs +++ b/tests/rustdoc-ui/disambiguator-endswith-named-suffix.rs @@ -2,67 +2,67 @@ //@ normalize-stderr: "nightly|beta|1\.[0-9][0-9]\.[0-9]" -> "$$CHANNEL" //! [struct@m!()] //~ WARN: unmatched disambiguator `struct` and suffix `!()` -//! [struct@m!{}] +//! [struct@m!{}] //~ WARN: unmatched disambiguator `struct` and suffix `!{}` //! [struct@m![]] //! [struct@f()] //~ WARN: unmatched disambiguator `struct` and suffix `()` //! [struct@m!] //~ WARN: unmatched disambiguator `struct` and suffix `!` //! //! [enum@m!()] //~ WARN: unmatched disambiguator `enum` and suffix `!()` -//! [enum@m!{}] +//! [enum@m!{}] //~ WARN: unmatched disambiguator `enum` and suffix `!{}` //! [enum@m![]] //! [enum@f()] //~ WARN: unmatched disambiguator `enum` and suffix `()` //! [enum@m!] //~ WARN: unmatched disambiguator `enum` and suffix `!` //! //! [trait@m!()] //~ WARN: unmatched disambiguator `trait` and suffix `!()` -//! [trait@m!{}] +//! [trait@m!{}] //~ WARN: unmatched disambiguator `trait` and suffix `!{}` //! [trait@m![]] //! [trait@f()] //~ WARN: unmatched disambiguator `trait` and suffix `()` //! [trait@m!] //~ WARN: unmatched disambiguator `trait` and suffix `!` //! //! [module@m!()] //~ WARN: unmatched disambiguator `module` and suffix `!()` -//! [module@m!{}] +//! [module@m!{}] //~ WARN: unmatched disambiguator `module` and suffix `!{}` //! [module@m![]] //! [module@f()] //~ WARN: unmatched disambiguator `module` and suffix `()` //! [module@m!] //~ WARN: unmatched disambiguator `module` and suffix `!` //! //! [mod@m!()] //~ WARN: unmatched disambiguator `mod` and suffix `!()` -//! [mod@m!{}] +//! [mod@m!{}] //~ WARN: unmatched disambiguator `mod` and suffix `!{}` //! [mod@m![]] //! [mod@f()] //~ WARN: unmatched disambiguator `mod` and suffix `()` //! [mod@m!] //~ WARN: unmatched disambiguator `mod` and suffix `!` //! //! [const@m!()] //~ WARN: unmatched disambiguator `const` and suffix `!()` -//! [const@m!{}] +//! [const@m!{}] //~ WARN: unmatched disambiguator `const` and suffix `!{}` //! [const@m![]] //! [const@f()] //~ WARN: incompatible link kind for `f` //! [const@m!] //~ WARN: unmatched disambiguator `const` and suffix `!` //! //! [constant@m!()] //~ WARN: unmatched disambiguator `constant` and suffix `!()` -//! [constant@m!{}] +//! [constant@m!{}] //~ WARN: unmatched disambiguator `constant` and suffix `!{}` //! [constant@m![]] //! [constant@f()] //~ WARN: incompatible link kind for `f` //! [constant@m!] //~ WARN: unmatched disambiguator `constant` and suffix `!` //! //! [static@m!()] //~ WARN: unmatched disambiguator `static` and suffix `!()` -//! [static@m!{}] +//! [static@m!{}] //~ WARN: unmatched disambiguator `static` and suffix `!{}` //! [static@m![]] //! [static@f()] //~ WARN: incompatible link kind for `f` //! [static@m!] //~ WARN: unmatched disambiguator `static` and suffix `!` //! //! [function@m!()] //~ WARN: unmatched disambiguator `function` and suffix `!()` -//! [function@m!{}] +//! [function@m!{}] //~ WARN: unmatched disambiguator `function` and suffix `!{}` //! [function@m![]] //! [function@f()] //! [function@m!] //~ WARN: unmatched disambiguator `function` and suffix `!` //! //! [fn@m!()] //~ WARN: unmatched disambiguator `fn` and suffix `!()` -//! [fn@m!{}] +//! [fn@m!{}] //~ WARN: unmatched disambiguator `fn` and suffix `!{}` //! [fn@m![]] //! [fn@f()] //! [fn@m!] //~ WARN: unmatched disambiguator `fn` and suffix `!` //! //! [method@m!()] //~ WARN: unmatched disambiguator `method` and suffix `!()` -//! [method@m!{}] +//! [method@m!{}] //~ WARN: unmatched disambiguator `method` and suffix `!{}` //! [method@m![]] //! [method@f()] //! [method@m!] //~ WARN: unmatched disambiguator `method` and suffix `!` @@ -74,13 +74,13 @@ //! [derive@m!] //~ WARN: incompatible link kind for `m` //! //! [type@m!()] //~ WARN: unmatched disambiguator `type` and suffix `!()` -//! [type@m!{}] +//! [type@m!{}] //~ WARN: unmatched disambiguator `type` and suffix `!{}` //! [type@m![]] //! [type@f()] //~ WARN: unmatched disambiguator `type` and suffix `()` //! [type@m!] //~ WARN: unmatched disambiguator `type` and suffix `!` //! //! [value@m!()] //~ WARN: unmatched disambiguator `value` and suffix `!()` -//! [value@m!{}] +//! [value@m!{}] //~ WARN: unmatched disambiguator `value` and suffix `!{}` //! [value@m![]] //! [value@f()] //! [value@m!] //~ WARN: unmatched disambiguator `value` and suffix `!` @@ -92,13 +92,13 @@ //! [macro@m!] //! //! [prim@m!()] //~ WARN: unmatched disambiguator `prim` and suffix `!()` -//! [prim@m!{}] +//! [prim@m!{}] //~ WARN: unmatched disambiguator `prim` and suffix `!{}` //! [prim@m![]] //! [prim@f()] //~ WARN: unmatched disambiguator `prim` and suffix `()` //! [prim@m!] //~ WARN: unmatched disambiguator `prim` and suffix `!` //! //! [primitive@m!()] //~ WARN: unmatched disambiguator `primitive` and suffix `!()` -//! [primitive@m!{}] +//! [primitive@m!{}] //~ WARN: unmatched disambiguator `primitive` and suffix `!{}` //! [primitive@m![]] //! [primitive@f()] //~ WARN: unmatched disambiguator `primitive` and suffix `()` //! [primitive@m!] //~ WARN: unmatched disambiguator `primitive` and suffix `!` diff --git a/tests/rustdoc-ui/disambiguator-endswith-named-suffix.stderr b/tests/rustdoc-ui/disambiguator-endswith-named-suffix.stderr index f4e40a48873..18403385968 100644 --- a/tests/rustdoc-ui/disambiguator-endswith-named-suffix.stderr +++ b/tests/rustdoc-ui/disambiguator-endswith-named-suffix.stderr @@ -7,6 +7,14 @@ LL | //! [struct@m!()] = note: see https://doc.rust-lang.org/$CHANNEL/rustdoc/write-documentation/linking-to-items-by-name.html#namespaces-and-disambiguators for more info about disambiguators = note: `#[warn(rustdoc::broken_intra_doc_links)]` on by default +warning: unmatched disambiguator `struct` and suffix `!{}` + --> $DIR/disambiguator-endswith-named-suffix.rs:5:6 + | +LL | //! [struct@m!{}] + | ^^^^^^ + | + = note: see https://doc.rust-lang.org/$CHANNEL/rustdoc/write-documentation/linking-to-items-by-name.html#namespaces-and-disambiguators for more info about disambiguators + warning: unmatched disambiguator `struct` and suffix `()` --> $DIR/disambiguator-endswith-named-suffix.rs:7:6 | @@ -31,6 +39,14 @@ LL | //! [enum@m!()] | = note: see https://doc.rust-lang.org/$CHANNEL/rustdoc/write-documentation/linking-to-items-by-name.html#namespaces-and-disambiguators for more info about disambiguators +warning: unmatched disambiguator `enum` and suffix `!{}` + --> $DIR/disambiguator-endswith-named-suffix.rs:11:6 + | +LL | //! [enum@m!{}] + | ^^^^ + | + = note: see https://doc.rust-lang.org/$CHANNEL/rustdoc/write-documentation/linking-to-items-by-name.html#namespaces-and-disambiguators for more info about disambiguators + warning: unmatched disambiguator `enum` and suffix `()` --> $DIR/disambiguator-endswith-named-suffix.rs:13:6 | @@ -55,6 +71,14 @@ LL | //! [trait@m!()] | = note: see https://doc.rust-lang.org/$CHANNEL/rustdoc/write-documentation/linking-to-items-by-name.html#namespaces-and-disambiguators for more info about disambiguators +warning: unmatched disambiguator `trait` and suffix `!{}` + --> $DIR/disambiguator-endswith-named-suffix.rs:17:6 + | +LL | //! [trait@m!{}] + | ^^^^^ + | + = note: see https://doc.rust-lang.org/$CHANNEL/rustdoc/write-documentation/linking-to-items-by-name.html#namespaces-and-disambiguators for more info about disambiguators + warning: unmatched disambiguator `trait` and suffix `()` --> $DIR/disambiguator-endswith-named-suffix.rs:19:6 | @@ -79,6 +103,14 @@ LL | //! [module@m!()] | = note: see https://doc.rust-lang.org/$CHANNEL/rustdoc/write-documentation/linking-to-items-by-name.html#namespaces-and-disambiguators for more info about disambiguators +warning: unmatched disambiguator `module` and suffix `!{}` + --> $DIR/disambiguator-endswith-named-suffix.rs:23:6 + | +LL | //! [module@m!{}] + | ^^^^^^ + | + = note: see https://doc.rust-lang.org/$CHANNEL/rustdoc/write-documentation/linking-to-items-by-name.html#namespaces-and-disambiguators for more info about disambiguators + warning: unmatched disambiguator `module` and suffix `()` --> $DIR/disambiguator-endswith-named-suffix.rs:25:6 | @@ -103,6 +135,14 @@ LL | //! [mod@m!()] | = note: see https://doc.rust-lang.org/$CHANNEL/rustdoc/write-documentation/linking-to-items-by-name.html#namespaces-and-disambiguators for more info about disambiguators +warning: unmatched disambiguator `mod` and suffix `!{}` + --> $DIR/disambiguator-endswith-named-suffix.rs:29:6 + | +LL | //! [mod@m!{}] + | ^^^ + | + = note: see https://doc.rust-lang.org/$CHANNEL/rustdoc/write-documentation/linking-to-items-by-name.html#namespaces-and-disambiguators for more info about disambiguators + warning: unmatched disambiguator `mod` and suffix `()` --> $DIR/disambiguator-endswith-named-suffix.rs:31:6 | @@ -127,6 +167,14 @@ LL | //! [const@m!()] | = note: see https://doc.rust-lang.org/$CHANNEL/rustdoc/write-documentation/linking-to-items-by-name.html#namespaces-and-disambiguators for more info about disambiguators +warning: unmatched disambiguator `const` and suffix `!{}` + --> $DIR/disambiguator-endswith-named-suffix.rs:35:6 + | +LL | //! [const@m!{}] + | ^^^^^ + | + = note: see https://doc.rust-lang.org/$CHANNEL/rustdoc/write-documentation/linking-to-items-by-name.html#namespaces-and-disambiguators for more info about disambiguators + warning: incompatible link kind for `f` --> $DIR/disambiguator-endswith-named-suffix.rs:37:6 | @@ -155,6 +203,14 @@ LL | //! [constant@m!()] | = note: see https://doc.rust-lang.org/$CHANNEL/rustdoc/write-documentation/linking-to-items-by-name.html#namespaces-and-disambiguators for more info about disambiguators +warning: unmatched disambiguator `constant` and suffix `!{}` + --> $DIR/disambiguator-endswith-named-suffix.rs:41:6 + | +LL | //! [constant@m!{}] + | ^^^^^^^^ + | + = note: see https://doc.rust-lang.org/$CHANNEL/rustdoc/write-documentation/linking-to-items-by-name.html#namespaces-and-disambiguators for more info about disambiguators + warning: incompatible link kind for `f` --> $DIR/disambiguator-endswith-named-suffix.rs:43:6 | @@ -183,6 +239,14 @@ LL | //! [static@m!()] | = note: see https://doc.rust-lang.org/$CHANNEL/rustdoc/write-documentation/linking-to-items-by-name.html#namespaces-and-disambiguators for more info about disambiguators +warning: unmatched disambiguator `static` and suffix `!{}` + --> $DIR/disambiguator-endswith-named-suffix.rs:47:6 + | +LL | //! [static@m!{}] + | ^^^^^^ + | + = note: see https://doc.rust-lang.org/$CHANNEL/rustdoc/write-documentation/linking-to-items-by-name.html#namespaces-and-disambiguators for more info about disambiguators + warning: incompatible link kind for `f` --> $DIR/disambiguator-endswith-named-suffix.rs:49:6 | @@ -211,6 +275,14 @@ LL | //! [function@m!()] | = note: see https://doc.rust-lang.org/$CHANNEL/rustdoc/write-documentation/linking-to-items-by-name.html#namespaces-and-disambiguators for more info about disambiguators +warning: unmatched disambiguator `function` and suffix `!{}` + --> $DIR/disambiguator-endswith-named-suffix.rs:53:6 + | +LL | //! [function@m!{}] + | ^^^^^^^^ + | + = note: see https://doc.rust-lang.org/$CHANNEL/rustdoc/write-documentation/linking-to-items-by-name.html#namespaces-and-disambiguators for more info about disambiguators + warning: unmatched disambiguator `function` and suffix `!` --> $DIR/disambiguator-endswith-named-suffix.rs:56:6 | @@ -227,6 +299,14 @@ LL | //! [fn@m!()] | = note: see https://doc.rust-lang.org/$CHANNEL/rustdoc/write-documentation/linking-to-items-by-name.html#namespaces-and-disambiguators for more info about disambiguators +warning: unmatched disambiguator `fn` and suffix `!{}` + --> $DIR/disambiguator-endswith-named-suffix.rs:59:6 + | +LL | //! [fn@m!{}] + | ^^ + | + = note: see https://doc.rust-lang.org/$CHANNEL/rustdoc/write-documentation/linking-to-items-by-name.html#namespaces-and-disambiguators for more info about disambiguators + warning: unmatched disambiguator `fn` and suffix `!` --> $DIR/disambiguator-endswith-named-suffix.rs:62:6 | @@ -243,6 +323,14 @@ LL | //! [method@m!()] | = note: see https://doc.rust-lang.org/$CHANNEL/rustdoc/write-documentation/linking-to-items-by-name.html#namespaces-and-disambiguators for more info about disambiguators +warning: unmatched disambiguator `method` and suffix `!{}` + --> $DIR/disambiguator-endswith-named-suffix.rs:65:6 + | +LL | //! [method@m!{}] + | ^^^^^^ + | + = note: see https://doc.rust-lang.org/$CHANNEL/rustdoc/write-documentation/linking-to-items-by-name.html#namespaces-and-disambiguators for more info about disambiguators + warning: unmatched disambiguator `method` and suffix `!` --> $DIR/disambiguator-endswith-named-suffix.rs:68:6 | @@ -303,6 +391,14 @@ LL | //! [type@m!()] | = note: see https://doc.rust-lang.org/$CHANNEL/rustdoc/write-documentation/linking-to-items-by-name.html#namespaces-and-disambiguators for more info about disambiguators +warning: unmatched disambiguator `type` and suffix `!{}` + --> $DIR/disambiguator-endswith-named-suffix.rs:77:6 + | +LL | //! [type@m!{}] + | ^^^^ + | + = note: see https://doc.rust-lang.org/$CHANNEL/rustdoc/write-documentation/linking-to-items-by-name.html#namespaces-and-disambiguators for more info about disambiguators + warning: unmatched disambiguator `type` and suffix `()` --> $DIR/disambiguator-endswith-named-suffix.rs:79:6 | @@ -327,6 +423,14 @@ LL | //! [value@m!()] | = note: see https://doc.rust-lang.org/$CHANNEL/rustdoc/write-documentation/linking-to-items-by-name.html#namespaces-and-disambiguators for more info about disambiguators +warning: unmatched disambiguator `value` and suffix `!{}` + --> $DIR/disambiguator-endswith-named-suffix.rs:83:6 + | +LL | //! [value@m!{}] + | ^^^^^ + | + = note: see https://doc.rust-lang.org/$CHANNEL/rustdoc/write-documentation/linking-to-items-by-name.html#namespaces-and-disambiguators for more info about disambiguators + warning: unmatched disambiguator `value` and suffix `!` --> $DIR/disambiguator-endswith-named-suffix.rs:86:6 | @@ -351,6 +455,14 @@ LL | //! [prim@m!()] | = note: see https://doc.rust-lang.org/$CHANNEL/rustdoc/write-documentation/linking-to-items-by-name.html#namespaces-and-disambiguators for more info about disambiguators +warning: unmatched disambiguator `prim` and suffix `!{}` + --> $DIR/disambiguator-endswith-named-suffix.rs:95:6 + | +LL | //! [prim@m!{}] + | ^^^^ + | + = note: see https://doc.rust-lang.org/$CHANNEL/rustdoc/write-documentation/linking-to-items-by-name.html#namespaces-and-disambiguators for more info about disambiguators + warning: unmatched disambiguator `prim` and suffix `()` --> $DIR/disambiguator-endswith-named-suffix.rs:97:6 | @@ -375,6 +487,14 @@ LL | //! [primitive@m!()] | = note: see https://doc.rust-lang.org/$CHANNEL/rustdoc/write-documentation/linking-to-items-by-name.html#namespaces-and-disambiguators for more info about disambiguators +warning: unmatched disambiguator `primitive` and suffix `!{}` + --> $DIR/disambiguator-endswith-named-suffix.rs:101:6 + | +LL | //! [primitive@m!{}] + | ^^^^^^^^^ + | + = note: see https://doc.rust-lang.org/$CHANNEL/rustdoc/write-documentation/linking-to-items-by-name.html#namespaces-and-disambiguators for more info about disambiguators + warning: unmatched disambiguator `primitive` and suffix `()` --> $DIR/disambiguator-endswith-named-suffix.rs:103:6 | @@ -391,5 +511,5 @@ LL | //! [primitive@m!] | = note: see https://doc.rust-lang.org/$CHANNEL/rustdoc/write-documentation/linking-to-items-by-name.html#namespaces-and-disambiguators for more info about disambiguators -warning: 46 warnings emitted +warning: 61 warnings emitted diff --git a/tests/rustdoc-ui/doctest/dead-code-2024.rs b/tests/rustdoc-ui/doctest/dead-code-2024.rs index 079d44570bb..e02d2601c58 100644 --- a/tests/rustdoc-ui/doctest/dead-code-2024.rs +++ b/tests/rustdoc-ui/doctest/dead-code-2024.rs @@ -4,6 +4,8 @@ //@ compile-flags:--test //@ normalize-stdout: "tests/rustdoc-ui/doctest" -> "$$DIR" //@ normalize-stdout: "finished in \d+\.\d+s" -> "finished in $$TIME" +//@ normalize-stdout: "ran in \d+\.\d+s" -> "ran in $$TIME" +//@ normalize-stdout: "compilation took \d+\.\d+s" -> "compilation took $$TIME" //@ failure-status: 101 #![doc(test(attr(allow(unused_variables), deny(warnings))))] diff --git a/tests/rustdoc-ui/doctest/dead-code-2024.stdout b/tests/rustdoc-ui/doctest/dead-code-2024.stdout index a943a177e10..bf9cd65200b 100644 --- a/tests/rustdoc-ui/doctest/dead-code-2024.stdout +++ b/tests/rustdoc-ui/doctest/dead-code-2024.stdout @@ -1,18 +1,18 @@ running 1 test -test $DIR/dead-code-2024.rs - f (line 13) - compile ... FAILED +test $DIR/dead-code-2024.rs - f (line 15) - compile ... FAILED failures: ----- $DIR/dead-code-2024.rs - f (line 13) stdout ---- +---- $DIR/dead-code-2024.rs - f (line 15) stdout ---- error: trait `T` is never used - --> $DIR/dead-code-2024.rs:14:7 + --> $DIR/dead-code-2024.rs:16:7 | LL | trait T { fn f(); } | ^ | note: the lint level is defined here - --> $DIR/dead-code-2024.rs:12:9 + --> $DIR/dead-code-2024.rs:14:9 | LL | #![deny(warnings)] | ^^^^^^^^ @@ -23,7 +23,8 @@ error: aborting due to 1 previous error Couldn't compile the test. failures: - $DIR/dead-code-2024.rs - f (line 13) + $DIR/dead-code-2024.rs - f (line 15) test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME +all doctests ran in $TIME; merged doctests compilation took $TIME diff --git a/tests/rustdoc-ui/doctest/dead-code-items.rs b/tests/rustdoc-ui/doctest/dead-code-items.rs index 015504cbced..ff59bfaabc4 100644 --- a/tests/rustdoc-ui/doctest/dead-code-items.rs +++ b/tests/rustdoc-ui/doctest/dead-code-items.rs @@ -4,6 +4,8 @@ //@ compile-flags:--test --test-args=--test-threads=1 //@ normalize-stdout: "tests/rustdoc-ui/doctest" -> "$$DIR" //@ normalize-stdout: "finished in \d+\.\d+s" -> "finished in $$TIME" +//@ normalize-stdout: "ran in \d+\.\d+s" -> "ran in $$TIME" +//@ normalize-stdout: "compilation took \d+\.\d+s" -> "compilation took $$TIME" //@ failure-status: 101 #![doc(test(attr(deny(warnings))))] diff --git a/tests/rustdoc-ui/doctest/dead-code-items.stdout b/tests/rustdoc-ui/doctest/dead-code-items.stdout index 4b9d8be94dd..ecfe09f09ce 100644 --- a/tests/rustdoc-ui/doctest/dead-code-items.stdout +++ b/tests/rustdoc-ui/doctest/dead-code-items.stdout @@ -1,30 +1,30 @@ running 13 tests -test $DIR/dead-code-items.rs - A (line 32) - compile ... ok -test $DIR/dead-code-items.rs - A (line 88) - compile ... ok -test $DIR/dead-code-items.rs - A::field (line 39) - compile ... FAILED -test $DIR/dead-code-items.rs - A::method (line 94) - compile ... ok -test $DIR/dead-code-items.rs - C (line 22) - compile ... FAILED -test $DIR/dead-code-items.rs - Enum (line 70) - compile ... FAILED -test $DIR/dead-code-items.rs - Enum::Variant1 (line 77) - compile ... FAILED -test $DIR/dead-code-items.rs - MyTrait (line 103) - compile ... FAILED -test $DIR/dead-code-items.rs - MyTrait::my_trait_fn (line 110) - compile ... FAILED -test $DIR/dead-code-items.rs - S (line 14) - compile ... ok -test $DIR/dead-code-items.rs - U (line 48) - compile ... ok -test $DIR/dead-code-items.rs - U::field (line 55) - compile ... FAILED -test $DIR/dead-code-items.rs - U::field2 (line 61) - compile ... ok +test $DIR/dead-code-items.rs - A (line 34) - compile ... ok +test $DIR/dead-code-items.rs - A (line 90) - compile ... ok +test $DIR/dead-code-items.rs - A::field (line 41) - compile ... FAILED +test $DIR/dead-code-items.rs - A::method (line 96) - compile ... ok +test $DIR/dead-code-items.rs - C (line 24) - compile ... FAILED +test $DIR/dead-code-items.rs - Enum (line 72) - compile ... FAILED +test $DIR/dead-code-items.rs - Enum::Variant1 (line 79) - compile ... FAILED +test $DIR/dead-code-items.rs - MyTrait (line 105) - compile ... FAILED +test $DIR/dead-code-items.rs - MyTrait::my_trait_fn (line 112) - compile ... FAILED +test $DIR/dead-code-items.rs - S (line 16) - compile ... ok +test $DIR/dead-code-items.rs - U (line 50) - compile ... ok +test $DIR/dead-code-items.rs - U::field (line 57) - compile ... FAILED +test $DIR/dead-code-items.rs - U::field2 (line 63) - compile ... ok failures: ----- $DIR/dead-code-items.rs - A::field (line 39) stdout ---- +---- $DIR/dead-code-items.rs - A::field (line 41) stdout ---- error: trait `DeadCodeInField` is never used - --> $DIR/dead-code-items.rs:40:7 + --> $DIR/dead-code-items.rs:42:7 | LL | trait DeadCodeInField {} | ^^^^^^^^^^^^^^^ | note: the lint level is defined here - --> $DIR/dead-code-items.rs:38:9 + --> $DIR/dead-code-items.rs:40:9 | LL | #![deny(dead_code)] | ^^^^^^^^^ @@ -32,15 +32,15 @@ LL | #![deny(dead_code)] error: aborting due to 1 previous error Couldn't compile the test. ----- $DIR/dead-code-items.rs - C (line 22) stdout ---- +---- $DIR/dead-code-items.rs - C (line 24) stdout ---- error: unused variable: `unused_error` - --> $DIR/dead-code-items.rs:23:5 + --> $DIR/dead-code-items.rs:25:5 | LL | let unused_error = 5; | ^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_unused_error` | note: the lint level is defined here - --> $DIR/dead-code-items.rs:20:9 + --> $DIR/dead-code-items.rs:22:9 | LL | #![deny(warnings)] | ^^^^^^^^ @@ -49,15 +49,15 @@ LL | #![deny(warnings)] error: aborting due to 1 previous error Couldn't compile the test. ----- $DIR/dead-code-items.rs - Enum (line 70) stdout ---- +---- $DIR/dead-code-items.rs - Enum (line 72) stdout ---- error: unused variable: `not_dead_code_but_unused` - --> $DIR/dead-code-items.rs:71:5 + --> $DIR/dead-code-items.rs:73:5 | LL | let not_dead_code_but_unused = 5; | ^^^^^^^^^^^^^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_not_dead_code_but_unused` | note: the lint level is defined here - --> $DIR/dead-code-items.rs:68:9 + --> $DIR/dead-code-items.rs:70:9 | LL | #![deny(warnings)] | ^^^^^^^^ @@ -66,15 +66,15 @@ LL | #![deny(warnings)] error: aborting due to 1 previous error Couldn't compile the test. ----- $DIR/dead-code-items.rs - Enum::Variant1 (line 77) stdout ---- +---- $DIR/dead-code-items.rs - Enum::Variant1 (line 79) stdout ---- error: unused variable: `unused_in_variant` - --> $DIR/dead-code-items.rs:80:17 + --> $DIR/dead-code-items.rs:82:17 | LL | fn main() { let unused_in_variant = 5; } | ^^^^^^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_unused_in_variant` | note: the lint level is defined here - --> $DIR/dead-code-items.rs:75:9 + --> $DIR/dead-code-items.rs:77:9 | LL | #![deny(warnings)] | ^^^^^^^^ @@ -83,15 +83,15 @@ LL | #![deny(warnings)] error: aborting due to 1 previous error Couldn't compile the test. ----- $DIR/dead-code-items.rs - MyTrait (line 103) stdout ---- +---- $DIR/dead-code-items.rs - MyTrait (line 105) stdout ---- error: trait `StillDeadCodeAtMyTrait` is never used - --> $DIR/dead-code-items.rs:104:7 + --> $DIR/dead-code-items.rs:106:7 | LL | trait StillDeadCodeAtMyTrait { } | ^^^^^^^^^^^^^^^^^^^^^^ | note: the lint level is defined here - --> $DIR/dead-code-items.rs:102:9 + --> $DIR/dead-code-items.rs:104:9 | LL | #![deny(dead_code)] | ^^^^^^^^^ @@ -99,15 +99,15 @@ LL | #![deny(dead_code)] error: aborting due to 1 previous error Couldn't compile the test. ----- $DIR/dead-code-items.rs - MyTrait::my_trait_fn (line 110) stdout ---- +---- $DIR/dead-code-items.rs - MyTrait::my_trait_fn (line 112) stdout ---- error: unused variable: `unused_in_impl` - --> $DIR/dead-code-items.rs:113:17 + --> $DIR/dead-code-items.rs:115:17 | LL | fn main() { let unused_in_impl = 5; } | ^^^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_unused_in_impl` | note: the lint level is defined here - --> $DIR/dead-code-items.rs:108:9 + --> $DIR/dead-code-items.rs:110:9 | LL | #![deny(warnings)] | ^^^^^^^^ @@ -116,15 +116,15 @@ LL | #![deny(warnings)] error: aborting due to 1 previous error Couldn't compile the test. ----- $DIR/dead-code-items.rs - U::field (line 55) stdout ---- +---- $DIR/dead-code-items.rs - U::field (line 57) stdout ---- error: trait `DeadCodeInUnionField` is never used - --> $DIR/dead-code-items.rs:56:7 + --> $DIR/dead-code-items.rs:58:7 | LL | trait DeadCodeInUnionField {} | ^^^^^^^^^^^^^^^^^^^^ | note: the lint level is defined here - --> $DIR/dead-code-items.rs:54:9 + --> $DIR/dead-code-items.rs:56:9 | LL | #![deny(dead_code)] | ^^^^^^^^^ @@ -134,13 +134,14 @@ error: aborting due to 1 previous error Couldn't compile the test. failures: - $DIR/dead-code-items.rs - A::field (line 39) - $DIR/dead-code-items.rs - C (line 22) - $DIR/dead-code-items.rs - Enum (line 70) - $DIR/dead-code-items.rs - Enum::Variant1 (line 77) - $DIR/dead-code-items.rs - MyTrait (line 103) - $DIR/dead-code-items.rs - MyTrait::my_trait_fn (line 110) - $DIR/dead-code-items.rs - U::field (line 55) + $DIR/dead-code-items.rs - A::field (line 41) + $DIR/dead-code-items.rs - C (line 24) + $DIR/dead-code-items.rs - Enum (line 72) + $DIR/dead-code-items.rs - Enum::Variant1 (line 79) + $DIR/dead-code-items.rs - MyTrait (line 105) + $DIR/dead-code-items.rs - MyTrait::my_trait_fn (line 112) + $DIR/dead-code-items.rs - U::field (line 57) test result: FAILED. 6 passed; 7 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME +all doctests ran in $TIME; merged doctests compilation took $TIME diff --git a/tests/rustdoc-ui/doctest/dead-code-module-2.rs b/tests/rustdoc-ui/doctest/dead-code-module-2.rs index de7b11b91ec..fd9c313ec9a 100644 --- a/tests/rustdoc-ui/doctest/dead-code-module-2.rs +++ b/tests/rustdoc-ui/doctest/dead-code-module-2.rs @@ -4,6 +4,8 @@ //@ compile-flags:--test //@ normalize-stdout: "tests/rustdoc-ui/doctest" -> "$$DIR" //@ normalize-stdout: "finished in \d+\.\d+s" -> "finished in $$TIME" +//@ normalize-stdout: "ran in \d+\.\d+s" -> "ran in $$TIME" +//@ normalize-stdout: "compilation took \d+\.\d+s" -> "compilation took $$TIME" //@ failure-status: 101 #![doc(test(attr(allow(unused_variables))))] diff --git a/tests/rustdoc-ui/doctest/dead-code-module-2.stdout b/tests/rustdoc-ui/doctest/dead-code-module-2.stdout index d44068dcbf5..cf737996d5c 100644 --- a/tests/rustdoc-ui/doctest/dead-code-module-2.stdout +++ b/tests/rustdoc-ui/doctest/dead-code-module-2.stdout @@ -1,24 +1,24 @@ running 1 test -test $DIR/dead-code-module-2.rs - g (line 24) - compile ... ok +test $DIR/dead-code-module-2.rs - g (line 26) - compile ... ok test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME running 1 test -test $DIR/dead-code-module-2.rs - my_mod::f (line 16) - compile ... FAILED +test $DIR/dead-code-module-2.rs - my_mod::f (line 18) - compile ... FAILED failures: ----- $DIR/dead-code-module-2.rs - my_mod::f (line 16) stdout ---- +---- $DIR/dead-code-module-2.rs - my_mod::f (line 18) stdout ---- error: trait `T` is never used - --> $DIR/dead-code-module-2.rs:17:7 + --> $DIR/dead-code-module-2.rs:19:7 | LL | trait T { fn f(); } | ^ | note: the lint level is defined here - --> $DIR/dead-code-module-2.rs:15:9 + --> $DIR/dead-code-module-2.rs:17:9 | LL | #![deny(warnings)] | ^^^^^^^^ @@ -29,7 +29,8 @@ error: aborting due to 1 previous error Couldn't compile the test. failures: - $DIR/dead-code-module-2.rs - my_mod::f (line 16) + $DIR/dead-code-module-2.rs - my_mod::f (line 18) test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME +all doctests ran in $TIME; merged doctests compilation took $TIME diff --git a/tests/rustdoc-ui/doctest/dead-code-module.rs b/tests/rustdoc-ui/doctest/dead-code-module.rs index f825749a6a2..d3103ad28e9 100644 --- a/tests/rustdoc-ui/doctest/dead-code-module.rs +++ b/tests/rustdoc-ui/doctest/dead-code-module.rs @@ -4,6 +4,8 @@ //@ compile-flags:--test //@ normalize-stdout: "tests/rustdoc-ui/doctest" -> "$$DIR" //@ normalize-stdout: "finished in \d+\.\d+s" -> "finished in $$TIME" +//@ normalize-stdout: "ran in \d+\.\d+s" -> "ran in $$TIME" +//@ normalize-stdout: "compilation took \d+\.\d+s" -> "compilation took $$TIME" //@ failure-status: 101 mod my_mod { diff --git a/tests/rustdoc-ui/doctest/dead-code-module.stdout b/tests/rustdoc-ui/doctest/dead-code-module.stdout index b5ccf225d25..83c6af3775e 100644 --- a/tests/rustdoc-ui/doctest/dead-code-module.stdout +++ b/tests/rustdoc-ui/doctest/dead-code-module.stdout @@ -1,18 +1,18 @@ running 1 test -test $DIR/dead-code-module.rs - my_mod::f (line 14) - compile ... FAILED +test $DIR/dead-code-module.rs - my_mod::f (line 16) - compile ... FAILED failures: ----- $DIR/dead-code-module.rs - my_mod::f (line 14) stdout ---- +---- $DIR/dead-code-module.rs - my_mod::f (line 16) stdout ---- error: trait `T` is never used - --> $DIR/dead-code-module.rs:15:7 + --> $DIR/dead-code-module.rs:17:7 | LL | trait T { fn f(); } | ^ | note: the lint level is defined here - --> $DIR/dead-code-module.rs:13:9 + --> $DIR/dead-code-module.rs:15:9 | LL | #![deny(warnings)] | ^^^^^^^^ @@ -23,7 +23,8 @@ error: aborting due to 1 previous error Couldn't compile the test. failures: - $DIR/dead-code-module.rs - my_mod::f (line 14) + $DIR/dead-code-module.rs - my_mod::f (line 16) test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME +all doctests ran in $TIME; merged doctests compilation took $TIME diff --git a/tests/rustdoc-ui/doctest/doctest-output-include-fail.rs b/tests/rustdoc-ui/doctest/doctest-output-include-fail.rs index a47bac3daef..2f0d6756b27 100644 --- a/tests/rustdoc-ui/doctest/doctest-output-include-fail.rs +++ b/tests/rustdoc-ui/doctest/doctest-output-include-fail.rs @@ -2,6 +2,8 @@ //@ compile-flags:--test --test-args=--test-threads=1 //@ normalize-stdout: "tests/rustdoc-ui/doctest" -> "$$DIR" //@ normalize-stdout: "finished in \d+\.\d+s" -> "finished in $$TIME" +//@ normalize-stdout: "ran in \d+\.\d+s" -> "ran in $$TIME" +//@ normalize-stdout: "compilation took \d+\.\d+s" -> "compilation took $$TIME" //@ failure-status: 101 // https://github.com/rust-lang/rust/issues/130470 diff --git a/tests/rustdoc-ui/doctest/doctest-output-include-fail.stdout b/tests/rustdoc-ui/doctest/doctest-output-include-fail.stdout index 22d15f8743c..ceaf60b1201 100644 --- a/tests/rustdoc-ui/doctest/doctest-output-include-fail.stdout +++ b/tests/rustdoc-ui/doctest/doctest-output-include-fail.stdout @@ -22,3 +22,4 @@ failures: test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME +all doctests ran in $TIME; merged doctests compilation took $TIME diff --git a/tests/rustdoc-ui/doctest/edition-2024-error-output.rs b/tests/rustdoc-ui/doctest/edition-2024-error-output.rs index 82a85debcd1..e1e57ad01cd 100644 --- a/tests/rustdoc-ui/doctest/edition-2024-error-output.rs +++ b/tests/rustdoc-ui/doctest/edition-2024-error-output.rs @@ -6,6 +6,8 @@ //@ normalize-stdout: "tests/rustdoc-ui/doctest" -> "$$DIR" //@ normalize-stdout: "panicked at .+rs:" -> "panicked at $$TMP:" //@ normalize-stdout: "finished in \d+\.\d+s" -> "finished in $$TIME" +//@ normalize-stdout: "ran in \d+\.\d+s" -> "ran in $$TIME" +//@ normalize-stdout: "compilation took \d+\.\d+s" -> "compilation took $$TIME" //@ rustc-env:RUST_BACKTRACE=0 //@ failure-status: 101 diff --git a/tests/rustdoc-ui/doctest/edition-2024-error-output.stdout b/tests/rustdoc-ui/doctest/edition-2024-error-output.stdout index 273d7071237..c8acbe4eda7 100644 --- a/tests/rustdoc-ui/doctest/edition-2024-error-output.stdout +++ b/tests/rustdoc-ui/doctest/edition-2024-error-output.stdout @@ -1,15 +1,15 @@ running 1 test -test $DIR/edition-2024-error-output.rs - (line 12) ... FAILED +test $DIR/edition-2024-error-output.rs - (line 14) ... FAILED failures: ----- $DIR/edition-2024-error-output.rs - (line 12) stdout ---- +---- $DIR/edition-2024-error-output.rs - (line 14) stdout ---- Test executable failed (exit status: 101). stderr: -thread 'main' panicked at $TMP:6:1: +thread 'main' ($TID) panicked at $TMP:6:1: assertion `left == right` failed left: 4 right: 5 @@ -18,7 +18,8 @@ note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace failures: - $DIR/edition-2024-error-output.rs - (line 12) + $DIR/edition-2024-error-output.rs - (line 14) test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME +all doctests ran in $TIME; merged doctests compilation took $TIME diff --git a/tests/rustdoc-ui/doctest/failed-doctest-output-windows.stdout b/tests/rustdoc-ui/doctest/failed-doctest-output-windows.stdout index 7aa965d543b..12a59d435fe 100644 --- a/tests/rustdoc-ui/doctest/failed-doctest-output-windows.stdout +++ b/tests/rustdoc-ui/doctest/failed-doctest-output-windows.stdout @@ -27,7 +27,7 @@ stderr: stderr 1 stderr 2 -thread 'main' panicked at $DIR/failed-doctest-output-windows.rs:7:1: +thread 'main' ($TID) panicked at $DIR/failed-doctest-output-windows.rs:7:1: oh no note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace diff --git a/tests/rustdoc-ui/doctest/failed-doctest-output.stdout b/tests/rustdoc-ui/doctest/failed-doctest-output.stdout index a333f341ce5..3dbb2179b8f 100644 --- a/tests/rustdoc-ui/doctest/failed-doctest-output.stdout +++ b/tests/rustdoc-ui/doctest/failed-doctest-output.stdout @@ -27,7 +27,7 @@ stderr: stderr 1 stderr 2 -thread 'main' panicked at $DIR/failed-doctest-output.rs:7:1: +thread 'main' ($TID) panicked at $DIR/failed-doctest-output.rs:7:1: oh no note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace diff --git a/tests/rustdoc-ui/doctest/failed-doctest-should-panic.rs b/tests/rustdoc-ui/doctest/failed-doctest-should-panic.rs index 793f8654661..0504c3dc730 100644 --- a/tests/rustdoc-ui/doctest/failed-doctest-should-panic.rs +++ b/tests/rustdoc-ui/doctest/failed-doctest-should-panic.rs @@ -5,6 +5,8 @@ //@ compile-flags:--test //@ normalize-stdout: "tests/rustdoc-ui/doctest" -> "$$DIR" //@ normalize-stdout: "finished in \d+\.\d+s" -> "finished in $$TIME" +//@ normalize-stdout: "ran in \d+\.\d+s" -> "ran in $$TIME" +//@ normalize-stdout: "compilation took \d+\.\d+s" -> "compilation took $$TIME" //@ failure-status: 101 /// ```should_panic diff --git a/tests/rustdoc-ui/doctest/failed-doctest-should-panic.stdout b/tests/rustdoc-ui/doctest/failed-doctest-should-panic.stdout index 2b04b77c9dc..9047fe0dcdd 100644 --- a/tests/rustdoc-ui/doctest/failed-doctest-should-panic.stdout +++ b/tests/rustdoc-ui/doctest/failed-doctest-should-panic.stdout @@ -1,14 +1,15 @@ running 1 test -test $DIR/failed-doctest-should-panic.rs - Foo (line 10) - should panic ... FAILED +test $DIR/failed-doctest-should-panic.rs - Foo (line 12) - should panic ... FAILED failures: ----- $DIR/failed-doctest-should-panic.rs - Foo (line 10) stdout ---- -note: test did not panic as expected at $DIR/failed-doctest-should-panic.rs:10:0 +---- $DIR/failed-doctest-should-panic.rs - Foo (line 12) stdout ---- +note: test did not panic as expected at $DIR/failed-doctest-should-panic.rs:12:0 failures: - $DIR/failed-doctest-should-panic.rs - Foo (line 10) + $DIR/failed-doctest-should-panic.rs - Foo (line 12) test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME +all doctests ran in $TIME; merged doctests compilation took $TIME diff --git a/tests/rustdoc-ui/doctest/failed-doctest-test-crate.edition2015.stdout b/tests/rustdoc-ui/doctest/failed-doctest-test-crate.edition2015.stdout index ce767fb8443..d80c0da323d 100644 --- a/tests/rustdoc-ui/doctest/failed-doctest-test-crate.edition2015.stdout +++ b/tests/rustdoc-ui/doctest/failed-doctest-test-crate.edition2015.stdout @@ -1,12 +1,12 @@ running 1 test -test $DIR/failed-doctest-test-crate.rs - m (line 14) ... FAILED +test $DIR/failed-doctest-test-crate.rs - m (line 16) ... FAILED failures: ----- $DIR/failed-doctest-test-crate.rs - m (line 14) stdout ---- +---- $DIR/failed-doctest-test-crate.rs - m (line 16) stdout ---- error[E0432]: unresolved import `test` - --> $DIR/failed-doctest-test-crate.rs:15:5 + --> $DIR/failed-doctest-test-crate.rs:17:5 | LL | use test::*; | ^^^^ use of unresolved module or unlinked crate `test` @@ -22,7 +22,7 @@ For more information about this error, try `rustc --explain E0432`. Couldn't compile the test. failures: - $DIR/failed-doctest-test-crate.rs - m (line 14) + $DIR/failed-doctest-test-crate.rs - m (line 16) test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME diff --git a/tests/rustdoc-ui/doctest/failed-doctest-test-crate.edition2024.stdout b/tests/rustdoc-ui/doctest/failed-doctest-test-crate.edition2024.stdout index 80642e93bbd..724bb9bee62 100644 --- a/tests/rustdoc-ui/doctest/failed-doctest-test-crate.edition2024.stdout +++ b/tests/rustdoc-ui/doctest/failed-doctest-test-crate.edition2024.stdout @@ -1,12 +1,12 @@ running 1 test -test $DIR/failed-doctest-test-crate.rs - m (line 14) ... FAILED +test $DIR/failed-doctest-test-crate.rs - m (line 16) ... FAILED failures: ----- $DIR/failed-doctest-test-crate.rs - m (line 14) stdout ---- +---- $DIR/failed-doctest-test-crate.rs - m (line 16) stdout ---- error[E0432]: unresolved import `test` - --> $DIR/failed-doctest-test-crate.rs:15:5 + --> $DIR/failed-doctest-test-crate.rs:17:5 | LL | use test::*; | ^^^^ use of unresolved module or unlinked crate `test` @@ -19,7 +19,8 @@ For more information about this error, try `rustc --explain E0432`. Couldn't compile the test. failures: - $DIR/failed-doctest-test-crate.rs - m (line 14) + $DIR/failed-doctest-test-crate.rs - m (line 16) test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME +all doctests ran in $TIME; merged doctests compilation took $TIME diff --git a/tests/rustdoc-ui/doctest/failed-doctest-test-crate.rs b/tests/rustdoc-ui/doctest/failed-doctest-test-crate.rs index 6966d3df11c..75f7ac396f5 100644 --- a/tests/rustdoc-ui/doctest/failed-doctest-test-crate.rs +++ b/tests/rustdoc-ui/doctest/failed-doctest-test-crate.rs @@ -7,6 +7,8 @@ //@ compile-flags:--test //@ normalize-stdout: "tests/rustdoc-ui/doctest" -> "$$DIR" //@ normalize-stdout: "finished in \d+\.\d+s" -> "finished in $$TIME" +//@ normalize-stdout: "ran in \d+\.\d+s" -> "ran in $$TIME" +//@ normalize-stdout: "compilation took \d+\.\d+s" -> "compilation took $$TIME" //@ failure-status: 101 /// <https://github.com/rust-lang/rust/pull/137899#discussion_r1976743383> diff --git a/tests/rustdoc-ui/doctest/relative-path-include-bytes-132203.edition2015.stdout b/tests/rustdoc-ui/doctest/relative-path-include-bytes-132203.edition2015.stdout index ff26e7e3231..0d00a9fc9c4 100644 --- a/tests/rustdoc-ui/doctest/relative-path-include-bytes-132203.edition2015.stdout +++ b/tests/rustdoc-ui/doctest/relative-path-include-bytes-132203.edition2015.stdout @@ -1,12 +1,12 @@ running 1 test -test $DIR/relative-path-include-bytes-132203.rs - (line 18) ... FAILED +test $DIR/relative-path-include-bytes-132203.rs - (line 20) ... FAILED failures: ----- $DIR/relative-path-include-bytes-132203.rs - (line 18) stdout ---- +---- $DIR/relative-path-include-bytes-132203.rs - (line 20) stdout ---- error: couldn't read `$DIR/relative-dir-empty-file`: $FILE_NOT_FOUND_MSG (os error 2) - --> $DIR/relative-path-include-bytes-132203.rs:19:9 + --> $DIR/relative-path-include-bytes-132203.rs:21:9 | LL | let x = include_bytes!("relative-dir-empty-file"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -16,7 +16,7 @@ error: aborting due to 1 previous error Couldn't compile the test. failures: - $DIR/relative-path-include-bytes-132203.rs - (line 18) + $DIR/relative-path-include-bytes-132203.rs - (line 20) test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME diff --git a/tests/rustdoc-ui/doctest/relative-path-include-bytes-132203.edition2024.stdout b/tests/rustdoc-ui/doctest/relative-path-include-bytes-132203.edition2024.stdout index e4c65703081..fa5bd7c93fa 100644 --- a/tests/rustdoc-ui/doctest/relative-path-include-bytes-132203.edition2024.stdout +++ b/tests/rustdoc-ui/doctest/relative-path-include-bytes-132203.edition2024.stdout @@ -4,3 +4,4 @@ test $DIR/auxiliary/relative-dir.md - (line 1) ... ok test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME +all doctests ran in $TIME; merged doctests compilation took $TIME diff --git a/tests/rustdoc-ui/doctest/relative-path-include-bytes-132203.rs b/tests/rustdoc-ui/doctest/relative-path-include-bytes-132203.rs index ceacd69a5fd..321edc3ee84 100644 --- a/tests/rustdoc-ui/doctest/relative-path-include-bytes-132203.rs +++ b/tests/rustdoc-ui/doctest/relative-path-include-bytes-132203.rs @@ -9,6 +9,8 @@ //@ normalize-stdout: "tests.rustdoc-ui.doctest." -> "$$DIR/" //@ normalize-stdout: "finished in \d+\.\d+s" -> "finished in $$TIME" //@ normalize-stdout: "`: .* \(os error 2\)" -> "`: $$FILE_NOT_FOUND_MSG (os error 2)" +//@ normalize-stdout: "ran in \d+\.\d+s" -> "ran in $$TIME" +//@ normalize-stdout: "compilation took \d+\.\d+s" -> "compilation took $$TIME" // https://github.com/rust-lang/rust/issues/132203 // This version, because it's edition2024, passes thanks to the new diff --git a/tests/rustdoc-ui/doctest/stdout-and-stderr.rs b/tests/rustdoc-ui/doctest/stdout-and-stderr.rs index 9b0c69d8839..a4eda8c7f83 100644 --- a/tests/rustdoc-ui/doctest/stdout-and-stderr.rs +++ b/tests/rustdoc-ui/doctest/stdout-and-stderr.rs @@ -9,6 +9,8 @@ //@ normalize-stdout: "tests/rustdoc-ui/doctest" -> "$$DIR" //@ normalize-stdout: "finished in \d+\.\d+s" -> "finished in $$TIME" //@ normalize-stdout: "panicked at .+rs:" -> "panicked at $$TMP:" +//@ normalize-stdout: "ran in \d+\.\d+s" -> "ran in $$TIME" +//@ normalize-stdout: "compilation took \d+\.\d+s" -> "compilation took $$TIME" //@ failure-status: 101 //@ rustc-env:RUST_BACKTRACE=0 diff --git a/tests/rustdoc-ui/doctest/stdout-and-stderr.stdout b/tests/rustdoc-ui/doctest/stdout-and-stderr.stdout index b2febe1344f..dfdcd7759d5 100644 --- a/tests/rustdoc-ui/doctest/stdout-and-stderr.stdout +++ b/tests/rustdoc-ui/doctest/stdout-and-stderr.stdout @@ -1,12 +1,12 @@ running 3 tests -test $DIR/stdout-and-stderr.rs - (line 15) ... FAILED -test $DIR/stdout-and-stderr.rs - (line 20) ... FAILED -test $DIR/stdout-and-stderr.rs - (line 24) ... FAILED +test $DIR/stdout-and-stderr.rs - (line 17) ... FAILED +test $DIR/stdout-and-stderr.rs - (line 22) ... FAILED +test $DIR/stdout-and-stderr.rs - (line 26) ... FAILED failures: ----- $DIR/stdout-and-stderr.rs - (line 15) stdout ---- +---- $DIR/stdout-and-stderr.rs - (line 17) stdout ---- Test executable failed (exit status: 101). stdout: @@ -14,33 +14,34 @@ stdout: stderr: -thread 'main' panicked at $TMP:7:1: +thread 'main' ($TID) panicked at $TMP:7:1: assertion `left == right` failed left: "doc" right: "test" note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace ----- $DIR/stdout-and-stderr.rs - (line 20) stdout ---- +---- $DIR/stdout-and-stderr.rs - (line 22) stdout ---- Test executable failed (exit status: 101). stderr: -thread 'main' panicked at $TMP:15:1: +thread 'main' ($TID) panicked at $TMP:15:1: assertion `left == right` failed left: "doc" right: "test" note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace ----- $DIR/stdout-and-stderr.rs - (line 24) stdout ---- +---- $DIR/stdout-and-stderr.rs - (line 26) stdout ---- Test executable failed (exit status: 1). failures: - $DIR/stdout-and-stderr.rs - (line 15) - $DIR/stdout-and-stderr.rs - (line 20) - $DIR/stdout-and-stderr.rs - (line 24) + $DIR/stdout-and-stderr.rs - (line 17) + $DIR/stdout-and-stderr.rs - (line 22) + $DIR/stdout-and-stderr.rs - (line 26) test result: FAILED. 0 passed; 3 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME +all doctests ran in $TIME; merged doctests compilation took $TIME diff --git a/tests/rustdoc-ui/doctest/wrong-ast-2024.rs b/tests/rustdoc-ui/doctest/wrong-ast-2024.rs index 3b4fb3f3443..df30e01b25e 100644 --- a/tests/rustdoc-ui/doctest/wrong-ast-2024.rs +++ b/tests/rustdoc-ui/doctest/wrong-ast-2024.rs @@ -3,6 +3,8 @@ //@ normalize-stdout: "tests/rustdoc-ui/doctest" -> "$$DIR" //@ normalize-stdout: "finished in \d+\.\d+s" -> "finished in $$TIME" //@ normalize-stdout: ".rs:\d+:\d+" -> ".rs:$$LINE:$$COL" +//@ normalize-stdout: "ran in \d+\.\d+s" -> "ran in $$TIME" +//@ normalize-stdout: "compilation took \d+\.\d+s" -> "compilation took $$TIME" //@ failure-status: 101 /// ``` diff --git a/tests/rustdoc-ui/doctest/wrong-ast-2024.stdout b/tests/rustdoc-ui/doctest/wrong-ast-2024.stdout index 62e1fb10b9f..13567b41e51 100644 --- a/tests/rustdoc-ui/doctest/wrong-ast-2024.stdout +++ b/tests/rustdoc-ui/doctest/wrong-ast-2024.stdout @@ -1,17 +1,17 @@ running 1 test -test $DIR/wrong-ast-2024.rs - three (line 18) - should panic ... ok +test $DIR/wrong-ast-2024.rs - three (line 20) - should panic ... ok test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME running 2 tests -test $DIR/wrong-ast-2024.rs - one (line 8) ... FAILED -test $DIR/wrong-ast-2024.rs - two (line 13) ... FAILED +test $DIR/wrong-ast-2024.rs - one (line 10) ... FAILED +test $DIR/wrong-ast-2024.rs - two (line 15) ... FAILED failures: ----- $DIR/wrong-ast-2024.rs - one (line 8) stdout ---- +---- $DIR/wrong-ast-2024.rs - one (line 10) stdout ---- error[E0758]: unterminated block comment --> $DIR/wrong-ast-2024.rs:$LINE:$COL | @@ -22,7 +22,7 @@ error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0758`. Couldn't compile the test. ----- $DIR/wrong-ast-2024.rs - two (line 13) stdout ---- +---- $DIR/wrong-ast-2024.rs - two (line 15) stdout ---- error: unexpected closing delimiter: `}` --> $DIR/wrong-ast-2024.rs:$LINE:$COL | @@ -34,8 +34,9 @@ error: aborting due to 1 previous error Couldn't compile the test. failures: - $DIR/wrong-ast-2024.rs - one (line 8) - $DIR/wrong-ast-2024.rs - two (line 13) + $DIR/wrong-ast-2024.rs - one (line 10) + $DIR/wrong-ast-2024.rs - two (line 15) test result: FAILED. 0 passed; 2 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME +all doctests ran in $TIME; merged doctests compilation took $TIME diff --git a/tests/rustdoc-ui/intra-doc/bad-intra-doc.rs b/tests/rustdoc-ui/intra-doc/bad-intra-doc.rs new file mode 100644 index 00000000000..c24a848d898 --- /dev/null +++ b/tests/rustdoc-ui/intra-doc/bad-intra-doc.rs @@ -0,0 +1,15 @@ +#![no_std] +#![deny(rustdoc::broken_intra_doc_links)] + +// regression test for https://github.com/rust-lang/rust/issues/54191 + +/// this is not a link to [`example.com`] //~ERROR unresolved link +/// +/// this link [`has spaces in it`]. +/// +/// attempted link to method: [`Foo.bar()`] //~ERROR unresolved link +/// +/// classic broken intra-doc link: [`Bar`] //~ERROR unresolved link +/// +/// no backticks, so we let this one slide: [Foo.bar()] +pub struct Foo; diff --git a/tests/rustdoc-ui/intra-doc/bad-intra-doc.stderr b/tests/rustdoc-ui/intra-doc/bad-intra-doc.stderr new file mode 100644 index 00000000000..9533792b35b --- /dev/null +++ b/tests/rustdoc-ui/intra-doc/bad-intra-doc.stderr @@ -0,0 +1,31 @@ +error: unresolved link to `example.com` + --> $DIR/bad-intra-doc.rs:6:29 + | +LL | /// this is not a link to [`example.com`] + | ^^^^^^^^^^^ no item named `example.com` in scope + | + = help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]` +note: the lint level is defined here + --> $DIR/bad-intra-doc.rs:2:9 + | +LL | #![deny(rustdoc::broken_intra_doc_links)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: unresolved link to `Foo.bar` + --> $DIR/bad-intra-doc.rs:10:33 + | +LL | /// attempted link to method: [`Foo.bar()`] + | ^^^^^^^^^ no item named `Foo.bar` in scope + | + = help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]` + +error: unresolved link to `Bar` + --> $DIR/bad-intra-doc.rs:12:38 + | +LL | /// classic broken intra-doc link: [`Bar`] + | ^^^ no item named `Bar` in scope + | + = help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]` + +error: aborting due to 3 previous errors + diff --git a/tests/rustdoc-ui/intra-doc/weird-syntax.rs b/tests/rustdoc-ui/intra-doc/weird-syntax.rs index d2a922b2b62..1c5977b1bc3 100644 --- a/tests/rustdoc-ui/intra-doc/weird-syntax.rs +++ b/tests/rustdoc-ui/intra-doc/weird-syntax.rs @@ -65,7 +65,7 @@ pub struct XLinkToCloneWithStartSpace; /// [x][struct@Clone ] //~ERROR link pub struct XLinkToCloneWithEndSpace; -/// [x][Clone\(\)] not URL-shaped enough +/// [x][Clone\(\)] //~ERROR link pub struct XLinkToCloneWithEscapedParens; /// [x][`Clone`] not URL-shaped enough diff --git a/tests/rustdoc-ui/intra-doc/weird-syntax.stderr b/tests/rustdoc-ui/intra-doc/weird-syntax.stderr index ad813f0f9b6..7f2fc1fe625 100644 --- a/tests/rustdoc-ui/intra-doc/weird-syntax.stderr +++ b/tests/rustdoc-ui/intra-doc/weird-syntax.stderr @@ -123,6 +123,14 @@ LL - /// [x][struct@Clone ] LL + /// [x][trait@Clone ] | +error: unresolved link to `Clone\(\)` + --> $DIR/weird-syntax.rs:68:9 + | +LL | /// [x][Clone\(\)] + | ^^^^^^^^^ no item named `Clone\(\)` in scope + | + = help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]` + error: unresolved link to `Clone` --> $DIR/weird-syntax.rs:74:9 | @@ -299,5 +307,5 @@ LL | /// - [`SDL_PROP_WINDOW_CREATE_COCOA_WINDOW_POINTER`]: the | = help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]` -error: aborting due to 27 previous errors +error: aborting due to 28 previous errors diff --git a/tests/rustdoc-ui/lints/redundant_explicit_links-utf8.rs b/tests/rustdoc-ui/lints/redundant_explicit_links-utf8.rs index 4f4590d45fc..81cd6c73d1c 100644 --- a/tests/rustdoc-ui/lints/redundant_explicit_links-utf8.rs +++ b/tests/rustdoc-ui/lints/redundant_explicit_links-utf8.rs @@ -1,18 +1,24 @@ //@ check-pass -/// [`…foo`] [`…bar`] [`Err`] +/// [`…foo`] //~ WARN: unresolved link +/// [`…bar`] //~ WARN: unresolved link +/// [`Err`] pub struct Broken {} -/// [`…`] [`…`] [`Err`] +/// [`…`] //~ WARN: unresolved link +/// [`…`] //~ WARN: unresolved link +/// [`Err`] pub struct Broken2 {} -/// [`…`][…] [`…`][…] [`Err`] +/// [`…`][…] //~ WARN: unresolved link +/// [`…`][…] //~ WARN: unresolved link +/// [`Err`] pub struct Broken3 {} /// […………………………][Broken3] pub struct Broken4 {} -/// [Broken3][…………………………] +/// [Broken3][…………………………] //~ WARN: unresolved link pub struct Broken5 {} pub struct Err; diff --git a/tests/rustdoc-ui/lints/redundant_explicit_links-utf8.stderr b/tests/rustdoc-ui/lints/redundant_explicit_links-utf8.stderr new file mode 100644 index 00000000000..0a5ff68b908 --- /dev/null +++ b/tests/rustdoc-ui/lints/redundant_explicit_links-utf8.stderr @@ -0,0 +1,59 @@ +warning: unresolved link to `…foo` + --> $DIR/redundant_explicit_links-utf8.rs:3:7 + | +LL | /// [`…foo`] + | ^^^^ no item named `…foo` in scope + | + = help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]` + = note: `#[warn(rustdoc::broken_intra_doc_links)]` on by default + +warning: unresolved link to `…bar` + --> $DIR/redundant_explicit_links-utf8.rs:4:7 + | +LL | /// [`…bar`] + | ^^^^ no item named `…bar` in scope + | + = help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]` + +warning: unresolved link to `…` + --> $DIR/redundant_explicit_links-utf8.rs:8:7 + | +LL | /// [`…`] + | ^ no item named `…` in scope + | + = help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]` + +warning: unresolved link to `…` + --> $DIR/redundant_explicit_links-utf8.rs:9:7 + | +LL | /// [`…`] + | ^ no item named `…` in scope + | + = help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]` + +warning: unresolved link to `…` + --> $DIR/redundant_explicit_links-utf8.rs:13:11 + | +LL | /// [`…`][…] + | ^ no item named `…` in scope + | + = help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]` + +warning: unresolved link to `…` + --> $DIR/redundant_explicit_links-utf8.rs:14:11 + | +LL | /// [`…`][…] + | ^ no item named `…` in scope + | + = help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]` + +warning: unresolved link to `…………………………` + --> $DIR/redundant_explicit_links-utf8.rs:21:15 + | +LL | /// [Broken3][…………………………] + | ^^^^^^^^^^ no item named `…………………………` in scope + | + = help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]` + +warning: 7 warnings emitted + diff --git a/tests/rustdoc-ui/remap-path-prefix-failed-doctest-output.stdout b/tests/rustdoc-ui/remap-path-prefix-failed-doctest-output.stdout index 87d1e772b80..08f7a4ddd3a 100644 --- a/tests/rustdoc-ui/remap-path-prefix-failed-doctest-output.stdout +++ b/tests/rustdoc-ui/remap-path-prefix-failed-doctest-output.stdout @@ -9,7 +9,7 @@ Test executable failed (exit status: 101). stderr: -thread 'main' panicked at remapped_path/remap-path-prefix-failed-doctest-output.rs:3:1: +thread 'main' ($TID) panicked at remapped_path/remap-path-prefix-failed-doctest-output.rs:3:1: oh no note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace diff --git a/tests/rustdoc/attribute-rendering.rs b/tests/rustdoc/attribute-rendering.rs index 841533814c3..bf9b81077f3 100644 --- a/tests/rustdoc/attribute-rendering.rs +++ b/tests/rustdoc/attribute-rendering.rs @@ -1,7 +1,7 @@ #![crate_name = "foo"] //@ has 'foo/fn.f.html' -//@ has - //*[@'class="rust item-decl"]' '#[export_name = "f"] pub fn f()' -#[export_name = "\ -f"] +//@ has - //*[@'class="rust item-decl"]' '#[unsafe(export_name = "f")] pub fn f()' +#[unsafe(export_name = "\ +f")] pub fn f() {} diff --git a/tests/rustdoc/attributes-2021-edition.rs b/tests/rustdoc/attributes-2021-edition.rs new file mode 100644 index 00000000000..b5028d8c852 --- /dev/null +++ b/tests/rustdoc/attributes-2021-edition.rs @@ -0,0 +1,14 @@ +//@ edition: 2021 +#![crate_name = "foo"] + +//@ has foo/fn.f.html '//pre[@class="rust item-decl"]' '#[unsafe(no_mangle)]' +#[no_mangle] +pub extern "C" fn f() {} + +//@ has foo/fn.g.html '//pre[@class="rust item-decl"]' '#[unsafe(export_name = "bar")]' +#[export_name = "bar"] +pub extern "C" fn g() {} + +//@ has foo/fn.example.html '//pre[@class="rust item-decl"]' '#[unsafe(link_section = ".text")]' +#[link_section = ".text"] +pub extern "C" fn example() {} diff --git a/tests/rustdoc/attributes-re-export-2021-edition.rs b/tests/rustdoc/attributes-re-export-2021-edition.rs new file mode 100644 index 00000000000..04ee6c273dd --- /dev/null +++ b/tests/rustdoc/attributes-re-export-2021-edition.rs @@ -0,0 +1,13 @@ +// Tests that attributes are correctly copied onto a re-exported item. +//@ edition:2024 +#![crate_name = "re_export"] + +//@ has 're_export/fn.thingy2.html' '//pre[@class="rust item-decl"]' '#[unsafe(no_mangle)]' +pub use thingymod::thingy as thingy2; + +mod thingymod { + #[unsafe(no_mangle)] + pub fn thingy() { + + } +} diff --git a/tests/rustdoc/attributes-re-export.rs b/tests/rustdoc/attributes-re-export.rs index 458826ea8a3..820276f83c0 100644 --- a/tests/rustdoc/attributes-re-export.rs +++ b/tests/rustdoc/attributes-re-export.rs @@ -2,7 +2,7 @@ //@ edition:2021 #![crate_name = "re_export"] -//@ has 're_export/fn.thingy2.html' '//pre[@class="rust item-decl"]' '#[no_mangle]' +//@ has 're_export/fn.thingy2.html' '//pre[@class="rust item-decl"]' '#[unsafe(no_mangle)]' pub use thingymod::thingy as thingy2; mod thingymod { diff --git a/tests/rustdoc/attributes.rs b/tests/rustdoc/attributes.rs index e34468a88b1..34487a89127 100644 --- a/tests/rustdoc/attributes.rs +++ b/tests/rustdoc/attributes.rs @@ -1,13 +1,18 @@ +//@ edition: 2024 #![crate_name = "foo"] -//@ has foo/fn.f.html '//pre[@class="rust item-decl"]' '#[no_mangle]' -#[no_mangle] +//@ has foo/fn.f.html '//pre[@class="rust item-decl"]' '#[unsafe(no_mangle)]' +#[unsafe(no_mangle)] pub extern "C" fn f() {} -//@ has foo/fn.g.html '//pre[@class="rust item-decl"]' '#[export_name = "bar"]' -#[export_name = "bar"] +//@ has foo/fn.g.html '//pre[@class="rust item-decl"]' '#[unsafe(export_name = "bar")]' +#[unsafe(export_name = "bar")] pub extern "C" fn g() {} +//@ has foo/fn.example.html '//pre[@class="rust item-decl"]' '#[unsafe(link_section = ".text")]' +#[unsafe(link_section = ".text")] +pub extern "C" fn example() {} + //@ has foo/struct.Repr.html '//pre[@class="rust item-decl"]' '#[repr(C, align(8))]' #[repr(C, align(8))] pub struct Repr; diff --git a/tests/rustdoc/extern/extern-html-alias.rs b/tests/rustdoc/extern/extern-html-alias.rs new file mode 100644 index 00000000000..3ff782d3963 --- /dev/null +++ b/tests/rustdoc/extern/extern-html-alias.rs @@ -0,0 +1,9 @@ +//@ compile-flags:-Z unstable-options --extern-html-root-url externs_name=https://renamed.example.com --extern-html-root-url empty=https://bad.invalid +//@ aux-crate:externs_name=empty.rs +//@ edition: 2018 + +extern crate externs_name as renamed; + +//@ has extern_html_alias/index.html +//@ has - '//a/@href' 'https://renamed.example.com/empty/index.html' +pub use renamed as yet_different_name; diff --git a/tests/rustdoc/extern/extern-html-fallback.rs b/tests/rustdoc/extern/extern-html-fallback.rs new file mode 100644 index 00000000000..ddac9bf713c --- /dev/null +++ b/tests/rustdoc/extern/extern-html-fallback.rs @@ -0,0 +1,14 @@ +//@ compile-flags:-Z unstable-options --extern-html-root-url yet_another_name=https://bad.invalid --extern-html-root-url renamed_privately=https://bad.invalid --extern-html-root-url renamed_locally=https://bad.invalid --extern-html-root-url empty=https://localhost +//@ aux-crate:externs_name=empty.rs +//@ edition: 2018 + +mod m { + pub extern crate externs_name as renamed_privately; +} + +// renaming within the crate's source code is not supposed to affect CLI flags +extern crate externs_name as renamed_locally; + +//@ has extern_html_fallback/index.html +//@ has - '//a/@href' 'https://localhost/empty/index.html' +pub use crate::renamed_locally as yet_another_name; diff --git a/tests/rustdoc/intra-doc/macro-caching-144965.rs b/tests/rustdoc/intra-doc/macro-caching-144965.rs new file mode 100644 index 00000000000..e14b465aeea --- /dev/null +++ b/tests/rustdoc/intra-doc/macro-caching-144965.rs @@ -0,0 +1,35 @@ +// regression test for https://github.com/rust-lang/rust/issues/144965 + +#![crate_name = "foo"] +#![no_std] + +#[doc(hidden)] +pub struct MyStruct; + +macro_rules! my_macro { + () => { + pub fn my_function() {} + + /// Incorrect: [`my_function()`]. + #[doc(inline)] + pub use $crate::MyStruct; + + /// Correct: [`my_function`]. + pub struct AnotherStruct; + }; +} + + +pub mod one { + //@ has 'foo/one/index.html' + //@ has - '//dl[@class="item-table"]/dd[1]/a[@href="fn.my_function.html"]/code' 'my_function' + //@ has - '//dl[@class="item-table"]/dd[2]/a[@href="fn.my_function.html"]/code' 'my_function()' + my_macro!(); +} + +pub mod two { + //@ has 'foo/two/index.html' + //@ has - '//dl[@class="item-table"]/dd[1]/a[@href="fn.my_function.html"]/code' 'my_function' + //@ has - '//dl[@class="item-table"]/dd[2]/a[@href="fn.my_function.html"]/code' 'my_function()' + my_macro!(); +} diff --git a/tests/rustdoc/reexport/auxiliary/wrap-unnamable-type.rs b/tests/rustdoc/reexport/auxiliary/wrap-unnamable-type.rs new file mode 100644 index 00000000000..7f8e346c8be --- /dev/null +++ b/tests/rustdoc/reexport/auxiliary/wrap-unnamable-type.rs @@ -0,0 +1,12 @@ +pub trait Assoc { + type Ty; +} + +pub struct Foo(<Foo as crate::Assoc>::Ty); + +const _X: () = { + impl crate::Assoc for Foo { + type Ty = Bar; + } + pub struct Bar; +}; diff --git a/tests/rustdoc/reexport/reexport-attrs.rs b/tests/rustdoc/reexport/reexport-attrs.rs index 0ec645841f0..aec0a11c0c6 100644 --- a/tests/rustdoc/reexport/reexport-attrs.rs +++ b/tests/rustdoc/reexport/reexport-attrs.rs @@ -4,13 +4,13 @@ extern crate reexports_attrs; -//@ has 'foo/fn.f0.html' '//pre[@class="rust item-decl"]' '#[no_mangle]' +//@ has 'foo/fn.f0.html' '//pre[@class="rust item-decl"]' '#[unsafe(no_mangle)]' pub use reexports_attrs::f0; -//@ has 'foo/fn.f1.html' '//pre[@class="rust item-decl"]' '#[link_section = ".here"]' +//@ has 'foo/fn.f1.html' '//pre[@class="rust item-decl"]' '#[unsafe(link_section = ".here")]' pub use reexports_attrs::f1; -//@ has 'foo/fn.f2.html' '//pre[@class="rust item-decl"]' '#[export_name = "f2export"]' +//@ has 'foo/fn.f2.html' '//pre[@class="rust item-decl"]' '#[unsafe(export_name = "f2export")]' pub use reexports_attrs::f2; //@ has 'foo/enum.T0.html' '//pre[@class="rust item-decl"]' '#[repr(u8)]' diff --git a/tests/rustdoc/reexport/wrapped-unnamble-type-143222.rs b/tests/rustdoc/reexport/wrapped-unnamble-type-143222.rs new file mode 100644 index 00000000000..9a8893786f5 --- /dev/null +++ b/tests/rustdoc/reexport/wrapped-unnamble-type-143222.rs @@ -0,0 +1,16 @@ +//@ compile-flags: -Z normalize-docs --document-private-items -Zunstable-options --show-type-layout +//@ aux-build:wrap-unnamable-type.rs +//@ build-aux-docs + +// regression test for https://github.com/rust-lang/rust/issues/143222 +// makes sure normalizing docs does not cause us to link to unnamable types +// in cross-crate reexports. + +#![crate_name = "foo"] + +extern crate wrap_unnamable_type as helper; + +//@ has 'foo/struct.Foo.html' +//@ !hasraw - 'struct.Bar.html' +#[doc(inline)] +pub use helper::Foo; diff --git a/tests/ui/issues/issue-5754.rs b/tests/ui/abi/extern-c-two-doubles-x86_64-5754.rs index 0aa09882959..7f44ef9c685 100644 --- a/tests/ui/issues/issue-5754.rs +++ b/tests/ui/abi/extern-c-two-doubles-x86_64-5754.rs @@ -1,8 +1,8 @@ +// https://github.com/rust-lang/rust/issues/5754 //@ build-pass #![allow(dead_code)] #![allow(improper_ctypes)] - struct TwoDoubles { r: f64, i: f64 diff --git a/tests/ui/issues/issue-8898.rs b/tests/ui/array-slice-vec/fixed-size-arrays-zero-size-types-8898.rs index 4447704f059..fe627b00f53 100644 --- a/tests/ui/issues/issue-8898.rs +++ b/tests/ui/array-slice-vec/fixed-size-arrays-zero-size-types-8898.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/8898 //@ run-pass fn assert_repr_eq<T: std::fmt::Debug>(obj : T, expected : String) { diff --git a/tests/ui/issues/issue-26095.rs b/tests/ui/associated-consts/constant-trait-item-reference-selection-26095.rs index 34c617dc495..f0fe2db432b 100644 --- a/tests/ui/issues/issue-26095.rs +++ b/tests/ui/associated-consts/constant-trait-item-reference-selection-26095.rs @@ -1,8 +1,8 @@ +// https://github.com/rust-lang/rust/issues/26095 //@ check-pass #![allow(dead_code)] #![allow(non_upper_case_globals)] - trait HasNumber<T> { const Number: usize; } diff --git a/tests/ui/issues/issue-43483.rs b/tests/ui/associated-consts/trait-associated-const-usage-43483.rs index 2c62671d0c7..c24157d45e7 100644 --- a/tests/ui/issues/issue-43483.rs +++ b/tests/ui/associated-consts/trait-associated-const-usage-43483.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/43483 //@ check-pass #![allow(dead_code)] #![allow(unused_variables)] diff --git a/tests/ui/issues/issue-21946.rs b/tests/ui/associated-types/recursive-associated-type-overflow-21946.rs index d0c052cb2fd..ba84ea11300 100644 --- a/tests/ui/issues/issue-21946.rs +++ b/tests/ui/associated-types/recursive-associated-type-overflow-21946.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/21946 trait Foo { type A; } diff --git a/tests/ui/issues/issue-21946.stderr b/tests/ui/associated-types/recursive-associated-type-overflow-21946.stderr index d1b4a808d2e..37fb0ed7eb8 100644 --- a/tests/ui/issues/issue-21946.stderr +++ b/tests/ui/associated-types/recursive-associated-type-overflow-21946.stderr @@ -1,5 +1,5 @@ error[E0275]: overflow evaluating the requirement `<FooStruct as Foo>::A == _` - --> $DIR/issue-21946.rs:8:14 + --> $DIR/recursive-associated-type-overflow-21946.rs:9:14 | LL | type A = <FooStruct as Foo>::A; | ^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/async-await/async-closures/def-path.stderr b/tests/ui/async-await/async-closures/def-path.stderr index 58a5b0b79c4..a507fa69760 100644 --- a/tests/ui/async-await/async-closures/def-path.stderr +++ b/tests/ui/async-await/async-closures/def-path.stderr @@ -5,11 +5,11 @@ LL | let x = async || {}; | -- the expected `async` closure body LL | LL | let () = x(); - | ^^ --- this expression has type `{static main::{closure#0}::{closure#0}<?16t> upvar_tys=?15t resume_ty=ResumeTy yield_ty=() return_ty=() witness={main::{closure#0}::{closure#0}}}` + | ^^ --- this expression has type `{static main::{closure#0}::{closure#0}<?15t> upvar_tys=?14t resume_ty=ResumeTy yield_ty=() return_ty=()}` | | | expected `async` closure body, found `()` | - = note: expected `async` closure body `{static main::{closure#0}::{closure#0}<?16t> upvar_tys=?15t resume_ty=ResumeTy yield_ty=() return_ty=() witness={main::{closure#0}::{closure#0}}}` + = note: expected `async` closure body `{static main::{closure#0}::{closure#0}<?15t> upvar_tys=?14t resume_ty=ResumeTy yield_ty=() return_ty=()}` found unit type `()` error: aborting due to 1 previous error diff --git a/tests/ui/async-await/async-drop/async-drop-box-allocator.rs b/tests/ui/async-await/async-drop/async-drop-box-allocator.rs new file mode 100644 index 00000000000..86ebf8a0ffd --- /dev/null +++ b/tests/ui/async-await/async-drop/async-drop-box-allocator.rs @@ -0,0 +1,134 @@ +//@ run-pass +//@ check-run-results +// struct `Foo` has both sync and async drop. +// It's used as the allocator of a `Box` which is conditionally moved out of. +// Sync version is called in sync context, async version is called in async function. + +#![feature(async_drop, allocator_api)] +#![allow(incomplete_features)] + +use std::mem::ManuallyDrop; + +//@ edition: 2021 + +#[inline(never)] +fn myprintln(msg: &str, my_resource_handle: usize) { + println!("{} : {}", msg, my_resource_handle); +} + +use std::{ + future::{Future, async_drop_in_place, AsyncDrop}, + pin::{pin, Pin}, + sync::{mpsc, Arc}, + task::{Context, Poll, Wake, Waker}, + alloc::{AllocError, Allocator, Global, Layout}, + ptr::NonNull, +}; + +struct Foo { + my_resource_handle: usize, +} + +impl Foo { + fn new(my_resource_handle: usize) -> Self { + let out = Foo { + my_resource_handle, + }; + myprintln("Foo::new()", my_resource_handle); + out + } +} + +impl Drop for Foo { + fn drop(&mut self) { + myprintln("Foo::drop()", self.my_resource_handle); + } +} + +impl AsyncDrop for Foo { + async fn drop(self: Pin<&mut Self>) { + myprintln("Foo::async drop()", self.my_resource_handle); + } +} + +unsafe impl Allocator for Foo { + fn allocate(&self, layout: Layout) -> Result<NonNull<[u8]>, AllocError> { + Global.allocate(layout) + } + unsafe fn deallocate(&self, ptr: NonNull<u8>, layout: Layout) { + Global.deallocate(ptr, layout); + } +} + +struct HasDrop; +impl Drop for HasDrop { + fn drop(&mut self) {} +} + +fn main() { + { + let b = Box::new_in(HasDrop, Foo::new(7)); + + if true { + let _x = *b; + } else { + let _y = b; + } + } + println!("Middle"); + block_on(bar(10)); + println!("Done") +} + +async fn bar(ident_base: usize) { + let b = Box::new_in(HasDrop, Foo::new(ident_base)); + + if true { + let _x = *b; + } else { + let _y = b; + } +} + +fn block_on<F>(fut_unpin: F) -> F::Output +where + F: Future, +{ + let mut fut_pin = pin!(ManuallyDrop::new(fut_unpin)); + let mut fut: Pin<&mut F> = unsafe { + Pin::map_unchecked_mut(fut_pin.as_mut(), |x| &mut **x) + }; + let (waker, rx) = simple_waker(); + let mut context = Context::from_waker(&waker); + let rv = loop { + match fut.as_mut().poll(&mut context) { + Poll::Ready(out) => break out, + // expect wake in polls + Poll::Pending => rx.try_recv().unwrap(), + } + }; + let drop_fut_unpin = unsafe { async_drop_in_place(fut.get_unchecked_mut()) }; + let mut drop_fut: Pin<&mut _> = pin!(drop_fut_unpin); + loop { + match drop_fut.as_mut().poll(&mut context) { + Poll::Ready(()) => break, + Poll::Pending => rx.try_recv().unwrap(), + } + } + rv +} + +fn simple_waker() -> (Waker, mpsc::Receiver<()>) { + struct SimpleWaker { + tx: std::sync::mpsc::Sender<()>, + } + + impl Wake for SimpleWaker { + fn wake(self: Arc<Self>) { + self.tx.send(()).unwrap(); + } + } + + let (tx, rx) = mpsc::channel(); + (Waker::from(Arc::new(SimpleWaker { tx })), rx) +} diff --git a/tests/ui/async-await/async-drop/async-drop-box-allocator.run.stdout b/tests/ui/async-await/async-drop/async-drop-box-allocator.run.stdout new file mode 100644 index 00000000000..cb7d0b0fea5 --- /dev/null +++ b/tests/ui/async-await/async-drop/async-drop-box-allocator.run.stdout @@ -0,0 +1,6 @@ +Foo::new() : 7 +Foo::drop() : 7 +Middle +Foo::new() : 10 +Foo::async drop() : 10 +Done diff --git a/tests/ui/async-await/async-drop/async-drop-box.rs b/tests/ui/async-await/async-drop/async-drop-box.rs new file mode 100644 index 00000000000..0a6ed412863 --- /dev/null +++ b/tests/ui/async-await/async-drop/async-drop-box.rs @@ -0,0 +1,109 @@ +//@ run-pass +//@ check-run-results +// struct `Foo` has both sync and async drop. +// `Foo` is always inside `Box` +// Sync version is called in sync context, async version is called in async function. + +//@ known-bug: #143658 +// async version is never actually called + +#![feature(async_drop)] +#![allow(incomplete_features)] + +use std::mem::ManuallyDrop; + +//@ edition: 2021 + +#[inline(never)] +fn myprintln(msg: &str, my_resource_handle: usize) { + println!("{} : {}", msg, my_resource_handle); +} + +use std::{ + future::{Future, async_drop_in_place, AsyncDrop}, + pin::{pin, Pin}, + sync::{mpsc, Arc}, + task::{Context, Poll, Wake, Waker}, +}; + +struct Foo { + my_resource_handle: usize, +} + +impl Foo { + fn new(my_resource_handle: usize) -> Self { + let out = Foo { + my_resource_handle, + }; + myprintln("Foo::new()", my_resource_handle); + out + } +} + +impl Drop for Foo { + fn drop(&mut self) { + myprintln("Foo::drop()", self.my_resource_handle); + } +} + +impl AsyncDrop for Foo { + async fn drop(self: Pin<&mut Self>) { + myprintln("Foo::async drop()", self.my_resource_handle); + } +} + +fn main() { + { + let _ = Box::new(Foo::new(7)); + } + println!("Middle"); + block_on(bar(10)); + println!("Done") +} + +async fn bar(ident_base: usize) { + let _first = Box::new(Foo::new(ident_base)); +} + +fn block_on<F>(fut_unpin: F) -> F::Output +where + F: Future, +{ + let mut fut_pin = pin!(ManuallyDrop::new(fut_unpin)); + let mut fut: Pin<&mut F> = unsafe { + Pin::map_unchecked_mut(fut_pin.as_mut(), |x| &mut **x) + }; + let (waker, rx) = simple_waker(); + let mut context = Context::from_waker(&waker); + let rv = loop { + match fut.as_mut().poll(&mut context) { + Poll::Ready(out) => break out, + // expect wake in polls + Poll::Pending => rx.try_recv().unwrap(), + } + }; + let drop_fut_unpin = unsafe { async_drop_in_place(fut.get_unchecked_mut()) }; + let mut drop_fut: Pin<&mut _> = pin!(drop_fut_unpin); + loop { + match drop_fut.as_mut().poll(&mut context) { + Poll::Ready(()) => break, + Poll::Pending => rx.try_recv().unwrap(), + } + } + rv +} + +fn simple_waker() -> (Waker, mpsc::Receiver<()>) { + struct SimpleWaker { + tx: std::sync::mpsc::Sender<()>, + } + + impl Wake for SimpleWaker { + fn wake(self: Arc<Self>) { + self.tx.send(()).unwrap(); + } + } + + let (tx, rx) = mpsc::channel(); + (Waker::from(Arc::new(SimpleWaker { tx })), rx) +} diff --git a/tests/ui/async-await/async-drop/async-drop-box.run.stdout b/tests/ui/async-await/async-drop/async-drop-box.run.stdout new file mode 100644 index 00000000000..a2dab2ba992 --- /dev/null +++ b/tests/ui/async-await/async-drop/async-drop-box.run.stdout @@ -0,0 +1,6 @@ +Foo::new() : 7 +Foo::drop() : 7 +Middle +Foo::new() : 10 +Foo::drop() : 10 +Done diff --git a/tests/ui/async-await/higher-ranked-auto-trait-6.no_assumptions.stderr b/tests/ui/async-await/higher-ranked-auto-trait-6.no_assumptions.stderr index d1f2d9a0753..d1c88101618 100644 --- a/tests/ui/async-await/higher-ranked-auto-trait-6.no_assumptions.stderr +++ b/tests/ui/async-await/higher-ranked-auto-trait-6.no_assumptions.stderr @@ -21,30 +21,6 @@ LL | Box::new(async { new(|| async { f().await }).await }) = help: consider pinning your async block and casting it to a trait object = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -error[E0308]: mismatched types - --> $DIR/higher-ranked-auto-trait-6.rs:16:5 - | -LL | Box::new(async { new(|| async { f().await }).await }) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other - | - = note: expected `async` block `{async block@$DIR/higher-ranked-auto-trait-6.rs:16:29: 16:34}` - found `async` block `{async block@$DIR/higher-ranked-auto-trait-6.rs:16:29: 16:34}` - = note: no two async blocks, even if identical, have the same type - = help: consider pinning your async block and casting it to a trait object - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - -error[E0308]: mismatched types - --> $DIR/higher-ranked-auto-trait-6.rs:16:5 - | -LL | Box::new(async { new(|| async { f().await }).await }) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other - | - = note: expected `async` block `{async block@$DIR/higher-ranked-auto-trait-6.rs:16:29: 16:34}` - found `async` block `{async block@$DIR/higher-ranked-auto-trait-6.rs:16:29: 16:34}` - = note: no two async blocks, even if identical, have the same type - = help: consider pinning your async block and casting it to a trait object - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - -error: aborting due to 4 previous errors +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/async-await/issue-70818.rs b/tests/ui/async-await/issue-70818.rs index bc181de8d92..c11332fe7d8 100644 --- a/tests/ui/async-await/issue-70818.rs +++ b/tests/ui/async-await/issue-70818.rs @@ -4,6 +4,7 @@ use std::future::Future; fn foo<T: Send, U>(ty: T, ty1: U) -> impl Future<Output = (T, U)> + Send { //~^ ERROR future cannot be sent between threads safely async { (ty, ty1) } + //~^ ERROR future cannot be sent between threads safely } fn main() {} diff --git a/tests/ui/async-await/issue-70818.stderr b/tests/ui/async-await/issue-70818.stderr index 8de6a825042..07fd20cdd77 100644 --- a/tests/ui/async-await/issue-70818.stderr +++ b/tests/ui/async-await/issue-70818.stderr @@ -1,4 +1,25 @@ error: future cannot be sent between threads safely + --> $DIR/issue-70818.rs:6:5 + | +LL | async { (ty, ty1) } + | ^^^^^^^^^^^^^^^^^^^ future created by async block is not `Send` + | +note: captured value is not `Send` + --> $DIR/issue-70818.rs:6:18 + | +LL | async { (ty, ty1) } + | ^^^ has type `U` which is not `Send` +note: required by a bound in an opaque type + --> $DIR/issue-70818.rs:4:69 + | +LL | fn foo<T: Send, U>(ty: T, ty1: U) -> impl Future<Output = (T, U)> + Send { + | ^^^^ +help: consider restricting type parameter `U` with trait `Send` + | +LL | fn foo<T: Send, U: std::marker::Send>(ty: T, ty1: U) -> impl Future<Output = (T, U)> + Send { + | +++++++++++++++++++ + +error: future cannot be sent between threads safely --> $DIR/issue-70818.rs:4:38 | LL | fn foo<T: Send, U>(ty: T, ty1: U) -> impl Future<Output = (T, U)> + Send { @@ -14,5 +35,5 @@ help: consider restricting type parameter `U` with trait `Send` LL | fn foo<T: Send, U: std::marker::Send>(ty: T, ty1: U) -> impl Future<Output = (T, U)> + Send { | +++++++++++++++++++ -error: aborting due to 1 previous error +error: aborting due to 2 previous errors diff --git a/tests/ui/async-await/issue-86507.stderr b/tests/ui/async-await/issue-86507.stderr index 6385a8c975e..c71801dcfc8 100644 --- a/tests/ui/async-await/issue-86507.stderr +++ b/tests/ui/async-await/issue-86507.stderr @@ -13,7 +13,7 @@ note: captured value is not `Send` because `&` references cannot be sent unless | LL | let x = x; | ^ has type `&T` which is not `Send`, because `T` is not `Sync` - = note: required for the cast from `Pin<Box<{async block@$DIR/issue-86507.rs:18:17: 18:27}>>` to `Pin<Box<(dyn Future<Output = ()> + Send + 'async_trait)>>` + = note: required for the cast from `Pin<Box<{async block@$DIR/issue-86507.rs:18:17: 18:27}>>` to `Pin<Box<dyn Future<Output = ()> + Send>>` help: consider further restricting type parameter `T` with trait `Sync` | LL | fn bar<'me, 'async_trait, T: Send + std::marker::Sync>(x: &'me T) diff --git a/tests/ui/async-await/issues/issue-65419/issue-65419-async-fn-resume-after-completion.rs b/tests/ui/async-await/issues/issue-65419/issue-65419-async-fn-resume-after-completion.rs index a8b05a4befa..ed99614914a 100644 --- a/tests/ui/async-await/issues/issue-65419/issue-65419-async-fn-resume-after-completion.rs +++ b/tests/ui/async-await/issues/issue-65419/issue-65419-async-fn-resume-after-completion.rs @@ -2,7 +2,7 @@ // be talking about `async fn`s instead. //@ run-fail -//@ error-pattern: thread 'main' panicked +//@ regex-error-pattern: thread 'main'.*panicked //@ error-pattern: `async fn` resumed after completion //@ edition:2018 diff --git a/tests/ui/async-await/issues/issue-65419/issue-65419-async-fn-resume-after-panic.rs b/tests/ui/async-await/issues/issue-65419/issue-65419-async-fn-resume-after-panic.rs index 94366e66263..881fafb010f 100644 --- a/tests/ui/async-await/issues/issue-65419/issue-65419-async-fn-resume-after-panic.rs +++ b/tests/ui/async-await/issues/issue-65419/issue-65419-async-fn-resume-after-panic.rs @@ -3,7 +3,7 @@ //@ run-fail //@ needs-unwind -//@ error-pattern: thread 'main' panicked +//@ regex-error-pattern: thread 'main'.*panicked //@ error-pattern: `async fn` resumed after panicking //@ edition:2018 diff --git a/tests/ui/issues/issue-54044.rs b/tests/ui/attributes/cold-attribute-application-54044.rs index 809ea7a87db..2e644b91c07 100644 --- a/tests/ui/issues/issue-54044.rs +++ b/tests/ui/attributes/cold-attribute-application-54044.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/54044 #![deny(unused_attributes)] //~ NOTE lint level is defined here #[cold] diff --git a/tests/ui/issues/issue-54044.stderr b/tests/ui/attributes/cold-attribute-application-54044.stderr index 8bd94a041d0..efdf5e0de52 100644 --- a/tests/ui/issues/issue-54044.stderr +++ b/tests/ui/attributes/cold-attribute-application-54044.stderr @@ -1,5 +1,5 @@ error: attribute should be applied to a function definition - --> $DIR/issue-54044.rs:3:1 + --> $DIR/cold-attribute-application-54044.rs:4:1 | LL | #[cold] | ^^^^^^^ @@ -9,13 +9,13 @@ LL | struct Foo; | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! note: the lint level is defined here - --> $DIR/issue-54044.rs:1:9 + --> $DIR/cold-attribute-application-54044.rs:2:9 | LL | #![deny(unused_attributes)] | ^^^^^^^^^^^^^^^^^ error: attribute should be applied to a function definition - --> $DIR/issue-54044.rs:9:5 + --> $DIR/cold-attribute-application-54044.rs:10:5 | LL | #[cold] | ^^^^^^^ diff --git a/tests/ui/attributes/malformed-attrs.rs b/tests/ui/attributes/malformed-attrs.rs index 2a8b7b41e58..0d5bf69d548 100644 --- a/tests/ui/attributes/malformed-attrs.rs +++ b/tests/ui/attributes/malformed-attrs.rs @@ -20,13 +20,9 @@ #![feature(linkage)] #![feature(cfi_encoding, extern_types)] #![feature(patchable_function_entry)] -#![feature(omit_gdb_pretty_printer_section)] #![feature(fundamental)] -#![omit_gdb_pretty_printer_section = 1] -//~^ ERROR malformed `omit_gdb_pretty_printer_section` attribute input - #![windows_subsystem] //~^ ERROR malformed diff --git a/tests/ui/attributes/malformed-attrs.stderr b/tests/ui/attributes/malformed-attrs.stderr index 814a1e5f691..e8ae4715398 100644 --- a/tests/ui/attributes/malformed-attrs.stderr +++ b/tests/ui/attributes/malformed-attrs.stderr @@ -1,5 +1,5 @@ error[E0539]: malformed `cfg` attribute input - --> $DIR/malformed-attrs.rs:103:1 + --> $DIR/malformed-attrs.rs:99:1 | LL | #[cfg] | ^^^^^^ @@ -8,7 +8,7 @@ LL | #[cfg] | help: must be of the form: `#[cfg(predicate)]` error: malformed `cfg_attr` attribute input - --> $DIR/malformed-attrs.rs:105:1 + --> $DIR/malformed-attrs.rs:101:1 | LL | #[cfg_attr] | ^^^^^^^^^^^ @@ -20,49 +20,43 @@ LL | #[cfg_attr(condition, attribute, other_attribute, ...)] | ++++++++++++++++++++++++++++++++++++++++++++ error[E0463]: can't find crate for `wloop` - --> $DIR/malformed-attrs.rs:212:1 + --> $DIR/malformed-attrs.rs:208:1 | LL | extern crate wloop; | ^^^^^^^^^^^^^^^^^^^ can't find crate error: malformed `windows_subsystem` attribute input - --> $DIR/malformed-attrs.rs:30:1 + --> $DIR/malformed-attrs.rs:26:1 | LL | #![windows_subsystem] | ^^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#![windows_subsystem = "windows|console"]` error: malformed `crate_name` attribute input - --> $DIR/malformed-attrs.rs:75:1 + --> $DIR/malformed-attrs.rs:71:1 | LL | #[crate_name] | ^^^^^^^^^^^^^ help: must be of the form: `#[crate_name = "name"]` error: malformed `no_sanitize` attribute input - --> $DIR/malformed-attrs.rs:93:1 + --> $DIR/malformed-attrs.rs:89:1 | LL | #[no_sanitize] | ^^^^^^^^^^^^^^ help: must be of the form: `#[no_sanitize(address, kcfi, memory, thread)]` error: malformed `instruction_set` attribute input - --> $DIR/malformed-attrs.rs:107:1 + --> $DIR/malformed-attrs.rs:103:1 | LL | #[instruction_set] | ^^^^^^^^^^^^^^^^^^ help: must be of the form: `#[instruction_set(set)]` error: malformed `patchable_function_entry` attribute input - --> $DIR/malformed-attrs.rs:109:1 + --> $DIR/malformed-attrs.rs:105:1 | LL | #[patchable_function_entry] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#[patchable_function_entry(prefix_nops = m, entry_nops = n)]` -error: malformed `coroutine` attribute input - --> $DIR/malformed-attrs.rs:112:5 - | -LL | #[coroutine = 63] || {} - | ^^^^^^^^^^^^^^^^^ help: must be of the form: `#[coroutine]` - error: malformed `must_not_suspend` attribute input - --> $DIR/malformed-attrs.rs:133:1 + --> $DIR/malformed-attrs.rs:129:1 | LL | #[must_not_suspend()] | ^^^^^^^^^^^^^^^^^^^^^ @@ -77,67 +71,67 @@ LL + #[must_not_suspend] | error: malformed `cfi_encoding` attribute input - --> $DIR/malformed-attrs.rs:135:1 + --> $DIR/malformed-attrs.rs:131:1 | LL | #[cfi_encoding] | ^^^^^^^^^^^^^^^ help: must be of the form: `#[cfi_encoding = "encoding"]` error: malformed `linkage` attribute input - --> $DIR/malformed-attrs.rs:174:5 + --> $DIR/malformed-attrs.rs:170:5 | LL | #[linkage] | ^^^^^^^^^^ help: must be of the form: `#[linkage = "external|internal|..."]` error: malformed `allow` attribute input - --> $DIR/malformed-attrs.rs:179:1 + --> $DIR/malformed-attrs.rs:175:1 | LL | #[allow] | ^^^^^^^^ help: must be of the form: `#[allow(lint1, lint2, ..., /*opt*/ reason = "...")]` error: malformed `expect` attribute input - --> $DIR/malformed-attrs.rs:181:1 + --> $DIR/malformed-attrs.rs:177:1 | LL | #[expect] | ^^^^^^^^^ help: must be of the form: `#[expect(lint1, lint2, ..., /*opt*/ reason = "...")]` error: malformed `warn` attribute input - --> $DIR/malformed-attrs.rs:183:1 + --> $DIR/malformed-attrs.rs:179:1 | LL | #[warn] | ^^^^^^^ help: must be of the form: `#[warn(lint1, lint2, ..., /*opt*/ reason = "...")]` error: malformed `deny` attribute input - --> $DIR/malformed-attrs.rs:185:1 + --> $DIR/malformed-attrs.rs:181:1 | LL | #[deny] | ^^^^^^^ help: must be of the form: `#[deny(lint1, lint2, ..., /*opt*/ reason = "...")]` error: malformed `forbid` attribute input - --> $DIR/malformed-attrs.rs:187:1 + --> $DIR/malformed-attrs.rs:183:1 | LL | #[forbid] | ^^^^^^^^^ help: must be of the form: `#[forbid(lint1, lint2, ..., /*opt*/ reason = "...")]` error: malformed `debugger_visualizer` attribute input - --> $DIR/malformed-attrs.rs:189:1 + --> $DIR/malformed-attrs.rs:185:1 | LL | #[debugger_visualizer] | ^^^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#[debugger_visualizer(natvis_file = "...", gdb_script_file = "...")]` error: malformed `thread_local` attribute input - --> $DIR/malformed-attrs.rs:204:1 + --> $DIR/malformed-attrs.rs:200:1 | LL | #[thread_local()] | ^^^^^^^^^^^^^^^^^ help: must be of the form: `#[thread_local]` error: malformed `no_link` attribute input - --> $DIR/malformed-attrs.rs:208:1 + --> $DIR/malformed-attrs.rs:204:1 | LL | #[no_link()] | ^^^^^^^^^^^^ help: must be of the form: `#[no_link]` error: malformed `macro_export` attribute input - --> $DIR/malformed-attrs.rs:215:1 + --> $DIR/malformed-attrs.rs:211:1 | LL | #[macro_export = 18] | ^^^^^^^^^^^^^^^^^^^^ @@ -152,31 +146,31 @@ LL + #[macro_export] | error: malformed `allow_internal_unsafe` attribute input - --> $DIR/malformed-attrs.rs:217:1 + --> $DIR/malformed-attrs.rs:213:1 | LL | #[allow_internal_unsafe = 1] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#[allow_internal_unsafe]` error: the `#[proc_macro]` attribute is only usable with crates of the `proc-macro` crate type - --> $DIR/malformed-attrs.rs:100:1 + --> $DIR/malformed-attrs.rs:96:1 | LL | #[proc_macro = 18] | ^^^^^^^^^^^^^^^^^^ error: the `#[proc_macro_attribute]` attribute is only usable with crates of the `proc-macro` crate type - --> $DIR/malformed-attrs.rs:117:1 + --> $DIR/malformed-attrs.rs:113:1 | LL | #[proc_macro_attribute = 19] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: the `#[proc_macro_derive]` attribute is only usable with crates of the `proc-macro` crate type - --> $DIR/malformed-attrs.rs:124:1 + --> $DIR/malformed-attrs.rs:120:1 | LL | #[proc_macro_derive] | ^^^^^^^^^^^^^^^^^^^^ error[E0658]: allow_internal_unsafe side-steps the unsafe_code lint - --> $DIR/malformed-attrs.rs:217:1 + --> $DIR/malformed-attrs.rs:213:1 | LL | #[allow_internal_unsafe = 1] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -185,7 +179,7 @@ LL | #[allow_internal_unsafe = 1] = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error: valid forms for the attribute are `#[doc(hidden|inline|...)]` and `#[doc = "string"]` - --> $DIR/malformed-attrs.rs:44:1 + --> $DIR/malformed-attrs.rs:40:1 | LL | #[doc] | ^^^^^^ @@ -195,7 +189,7 @@ LL | #[doc] = note: `#[deny(ill_formed_attribute_input)]` on by default error: valid forms for the attribute are `#[doc(hidden|inline|...)]` and `#[doc = "string"]` - --> $DIR/malformed-attrs.rs:77:1 + --> $DIR/malformed-attrs.rs:73:1 | LL | #[doc] | ^^^^^^ @@ -204,7 +198,7 @@ LL | #[doc] = note: for more information, see issue #57571 <https://github.com/rust-lang/rust/issues/57571> error: attribute must be of the form `#[link(name = "...", /*opt*/ kind = "dylib|static|...", /*opt*/ wasm_import_module = "...", /*opt*/ import_name_type = "decorated|noprefix|undecorated")]` - --> $DIR/malformed-attrs.rs:84:1 + --> $DIR/malformed-attrs.rs:80:1 | LL | #[link] | ^^^^^^^ @@ -213,7 +207,7 @@ LL | #[link] = note: for more information, see issue #57571 <https://github.com/rust-lang/rust/issues/57571> error: invalid argument - --> $DIR/malformed-attrs.rs:189:1 + --> $DIR/malformed-attrs.rs:185:1 | LL | #[debugger_visualizer] | ^^^^^^^^^^^^^^^^^^^^^^ @@ -222,35 +216,26 @@ LL | #[debugger_visualizer] = note: OR = note: expected: `gdb_script_file = "..."` -error[E0565]: malformed `omit_gdb_pretty_printer_section` attribute input - --> $DIR/malformed-attrs.rs:27:1 - | -LL | #![omit_gdb_pretty_printer_section = 1] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---^ - | | | - | | didn't expect any arguments here - | help: must be of the form: `#[omit_gdb_pretty_printer_section]` - error[E0539]: malformed `export_name` attribute input - --> $DIR/malformed-attrs.rs:33:1 + --> $DIR/malformed-attrs.rs:29:1 | LL | #[unsafe(export_name)] | ^^^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#[export_name = "name"]` error: `rustc_allow_const_fn_unstable` expects a list of feature names - --> $DIR/malformed-attrs.rs:35:1 + --> $DIR/malformed-attrs.rs:31:1 | LL | #[rustc_allow_const_fn_unstable] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: `allow_internal_unstable` expects a list of feature names - --> $DIR/malformed-attrs.rs:38:1 + --> $DIR/malformed-attrs.rs:34:1 | LL | #[allow_internal_unstable] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0539]: malformed `rustc_confusables` attribute input - --> $DIR/malformed-attrs.rs:40:1 + --> $DIR/malformed-attrs.rs:36:1 | LL | #[rustc_confusables] | ^^^^^^^^^^^^^^^^^^^^ @@ -259,7 +244,7 @@ LL | #[rustc_confusables] | help: must be of the form: `#[rustc_confusables("name1", "name2", ...)]` error[E0539]: malformed `deprecated` attribute input - --> $DIR/malformed-attrs.rs:42:1 + --> $DIR/malformed-attrs.rs:38:1 | LL | #[deprecated = 5] | ^^^^^^^^^^^^^^^-^ @@ -279,13 +264,13 @@ LL + #[deprecated] | error[E0539]: malformed `rustc_macro_transparency` attribute input - --> $DIR/malformed-attrs.rs:47:1 + --> $DIR/malformed-attrs.rs:43:1 | LL | #[rustc_macro_transparency] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#[rustc_macro_transparency = "transparent|semitransparent|opaque"]` error[E0539]: malformed `repr` attribute input - --> $DIR/malformed-attrs.rs:49:1 + --> $DIR/malformed-attrs.rs:45:1 | LL | #[repr] | ^^^^^^^ @@ -294,7 +279,7 @@ LL | #[repr] | help: must be of the form: `#[repr(C | Rust | align(...) | packed(...) | <integer type> | transparent)]` error[E0565]: malformed `rustc_as_ptr` attribute input - --> $DIR/malformed-attrs.rs:52:1 + --> $DIR/malformed-attrs.rs:48:1 | LL | #[rustc_as_ptr = 5] | ^^^^^^^^^^^^^^^---^ @@ -303,7 +288,7 @@ LL | #[rustc_as_ptr = 5] | help: must be of the form: `#[rustc_as_ptr]` error[E0539]: malformed `rustc_align` attribute input - --> $DIR/malformed-attrs.rs:57:1 + --> $DIR/malformed-attrs.rs:53:1 | LL | #[rustc_align] | ^^^^^^^^^^^^^^ @@ -312,7 +297,7 @@ LL | #[rustc_align] | help: must be of the form: `#[rustc_align(<alignment in bytes>)]` error[E0539]: malformed `optimize` attribute input - --> $DIR/malformed-attrs.rs:59:1 + --> $DIR/malformed-attrs.rs:55:1 | LL | #[optimize] | ^^^^^^^^^^^ @@ -321,7 +306,7 @@ LL | #[optimize] | help: must be of the form: `#[optimize(size|speed|none)]` error[E0565]: malformed `cold` attribute input - --> $DIR/malformed-attrs.rs:61:1 + --> $DIR/malformed-attrs.rs:57:1 | LL | #[cold = 1] | ^^^^^^^---^ @@ -330,13 +315,13 @@ LL | #[cold = 1] | help: must be of the form: `#[cold]` error: valid forms for the attribute are `#[must_use = "reason"]` and `#[must_use]` - --> $DIR/malformed-attrs.rs:63:1 + --> $DIR/malformed-attrs.rs:59:1 | LL | #[must_use()] | ^^^^^^^^^^^^^ error[E0565]: malformed `no_mangle` attribute input - --> $DIR/malformed-attrs.rs:65:1 + --> $DIR/malformed-attrs.rs:61:1 | LL | #[no_mangle = 1] | ^^^^^^^^^^^^---^ @@ -345,7 +330,7 @@ LL | #[no_mangle = 1] | help: must be of the form: `#[no_mangle]` error[E0565]: malformed `naked` attribute input - --> $DIR/malformed-attrs.rs:67:1 + --> $DIR/malformed-attrs.rs:63:1 | LL | #[unsafe(naked())] | ^^^^^^^^^^^^^^--^^ @@ -354,7 +339,7 @@ LL | #[unsafe(naked())] | help: must be of the form: `#[naked]` error[E0565]: malformed `track_caller` attribute input - --> $DIR/malformed-attrs.rs:69:1 + --> $DIR/malformed-attrs.rs:65:1 | LL | #[track_caller()] | ^^^^^^^^^^^^^^--^ @@ -363,13 +348,13 @@ LL | #[track_caller()] | help: must be of the form: `#[track_caller]` error[E0539]: malformed `export_name` attribute input - --> $DIR/malformed-attrs.rs:71:1 + --> $DIR/malformed-attrs.rs:67:1 | LL | #[export_name()] | ^^^^^^^^^^^^^^^^ help: must be of the form: `#[export_name = "name"]` error[E0805]: malformed `used` attribute input - --> $DIR/malformed-attrs.rs:73:1 + --> $DIR/malformed-attrs.rs:69:1 | LL | #[used()] | ^^^^^^--^ @@ -385,7 +370,7 @@ LL + #[used] | error[E0539]: malformed `target_feature` attribute input - --> $DIR/malformed-attrs.rs:80:1 + --> $DIR/malformed-attrs.rs:76:1 | LL | #[target_feature] | ^^^^^^^^^^^^^^^^^ @@ -394,7 +379,7 @@ LL | #[target_feature] | help: must be of the form: `#[target_feature(enable = "feat1, feat2")]` error[E0565]: malformed `export_stable` attribute input - --> $DIR/malformed-attrs.rs:82:1 + --> $DIR/malformed-attrs.rs:78:1 | LL | #[export_stable = 1] | ^^^^^^^^^^^^^^^^---^ @@ -403,19 +388,19 @@ LL | #[export_stable = 1] | help: must be of the form: `#[export_stable]` error[E0539]: malformed `link_name` attribute input - --> $DIR/malformed-attrs.rs:87:1 + --> $DIR/malformed-attrs.rs:83:1 | LL | #[link_name] | ^^^^^^^^^^^^ help: must be of the form: `#[link_name = "name"]` error[E0539]: malformed `link_section` attribute input - --> $DIR/malformed-attrs.rs:89:1 + --> $DIR/malformed-attrs.rs:85:1 | LL | #[link_section] | ^^^^^^^^^^^^^^^ help: must be of the form: `#[link_section = "name"]` error[E0539]: malformed `coverage` attribute input - --> $DIR/malformed-attrs.rs:91:1 + --> $DIR/malformed-attrs.rs:87:1 | LL | #[coverage] | ^^^^^^^^^^^ this attribute is only valid with either `on` or `off` as an argument @@ -428,7 +413,7 @@ LL | #[coverage(on)] | ++++ error[E0565]: malformed `no_implicit_prelude` attribute input - --> $DIR/malformed-attrs.rs:98:1 + --> $DIR/malformed-attrs.rs:94:1 | LL | #[no_implicit_prelude = 23] | ^^^^^^^^^^^^^^^^^^^^^^----^ @@ -437,7 +422,7 @@ LL | #[no_implicit_prelude = 23] | help: must be of the form: `#[no_implicit_prelude]` error[E0565]: malformed `proc_macro` attribute input - --> $DIR/malformed-attrs.rs:100:1 + --> $DIR/malformed-attrs.rs:96:1 | LL | #[proc_macro = 18] | ^^^^^^^^^^^^^----^ @@ -445,8 +430,17 @@ LL | #[proc_macro = 18] | | didn't expect any arguments here | help: must be of the form: `#[proc_macro]` +error[E0565]: malformed `coroutine` attribute input + --> $DIR/malformed-attrs.rs:108:5 + | +LL | #[coroutine = 63] || {} + | ^^^^^^^^^^^^----^ + | | | + | | didn't expect any arguments here + | help: must be of the form: `#[coroutine]` + error[E0565]: malformed `proc_macro_attribute` attribute input - --> $DIR/malformed-attrs.rs:117:1 + --> $DIR/malformed-attrs.rs:113:1 | LL | #[proc_macro_attribute = 19] | ^^^^^^^^^^^^^^^^^^^^^^^----^ @@ -455,7 +449,7 @@ LL | #[proc_macro_attribute = 19] | help: must be of the form: `#[proc_macro_attribute]` error[E0539]: malformed `must_use` attribute input - --> $DIR/malformed-attrs.rs:120:1 + --> $DIR/malformed-attrs.rs:116:1 | LL | #[must_use = 1] | ^^^^^^^^^^^^^-^ @@ -472,7 +466,7 @@ LL + #[must_use] | error[E0539]: malformed `proc_macro_derive` attribute input - --> $DIR/malformed-attrs.rs:124:1 + --> $DIR/malformed-attrs.rs:120:1 | LL | #[proc_macro_derive] | ^^^^^^^^^^^^^^^^^^^^ @@ -481,7 +475,7 @@ LL | #[proc_macro_derive] | help: must be of the form: `#[proc_macro_derive(TraitName, /*opt*/ attributes(name1, name2, ...))]` error[E0539]: malformed `rustc_layout_scalar_valid_range_start` attribute input - --> $DIR/malformed-attrs.rs:129:1 + --> $DIR/malformed-attrs.rs:125:1 | LL | #[rustc_layout_scalar_valid_range_start] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -490,7 +484,7 @@ LL | #[rustc_layout_scalar_valid_range_start] | help: must be of the form: `#[rustc_layout_scalar_valid_range_start(start)]` error[E0539]: malformed `rustc_layout_scalar_valid_range_end` attribute input - --> $DIR/malformed-attrs.rs:131:1 + --> $DIR/malformed-attrs.rs:127:1 | LL | #[rustc_layout_scalar_valid_range_end] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -499,7 +493,7 @@ LL | #[rustc_layout_scalar_valid_range_end] | help: must be of the form: `#[rustc_layout_scalar_valid_range_end(end)]` error[E0565]: malformed `marker` attribute input - --> $DIR/malformed-attrs.rs:156:1 + --> $DIR/malformed-attrs.rs:152:1 | LL | #[marker = 3] | ^^^^^^^^^---^ @@ -508,7 +502,7 @@ LL | #[marker = 3] | help: must be of the form: `#[marker]` error[E0565]: malformed `fundamental` attribute input - --> $DIR/malformed-attrs.rs:158:1 + --> $DIR/malformed-attrs.rs:154:1 | LL | #[fundamental()] | ^^^^^^^^^^^^^--^ @@ -517,7 +511,7 @@ LL | #[fundamental()] | help: must be of the form: `#[fundamental]` error[E0565]: malformed `ffi_pure` attribute input - --> $DIR/malformed-attrs.rs:166:5 + --> $DIR/malformed-attrs.rs:162:5 | LL | #[unsafe(ffi_pure = 1)] | ^^^^^^^^^^^^^^^^^^---^^ @@ -526,7 +520,7 @@ LL | #[unsafe(ffi_pure = 1)] | help: must be of the form: `#[ffi_pure]` error[E0539]: malformed `link_ordinal` attribute input - --> $DIR/malformed-attrs.rs:168:5 + --> $DIR/malformed-attrs.rs:164:5 | LL | #[link_ordinal] | ^^^^^^^^^^^^^^^ @@ -535,7 +529,7 @@ LL | #[link_ordinal] | help: must be of the form: `#[link_ordinal(ordinal)]` error[E0565]: malformed `ffi_const` attribute input - --> $DIR/malformed-attrs.rs:172:5 + --> $DIR/malformed-attrs.rs:168:5 | LL | #[unsafe(ffi_const = 1)] | ^^^^^^^^^^^^^^^^^^^---^^ @@ -544,7 +538,7 @@ LL | #[unsafe(ffi_const = 1)] | help: must be of the form: `#[ffi_const]` error[E0565]: malformed `automatically_derived` attribute input - --> $DIR/malformed-attrs.rs:192:1 + --> $DIR/malformed-attrs.rs:188:1 | LL | #[automatically_derived = 18] | ^^^^^^^^^^^^^^^^^^^^^^^^----^ @@ -553,7 +547,7 @@ LL | #[automatically_derived = 18] | help: must be of the form: `#[automatically_derived]` error[E0565]: malformed `non_exhaustive` attribute input - --> $DIR/malformed-attrs.rs:198:1 + --> $DIR/malformed-attrs.rs:194:1 | LL | #[non_exhaustive = 1] | ^^^^^^^^^^^^^^^^^---^ @@ -562,13 +556,13 @@ LL | #[non_exhaustive = 1] | help: must be of the form: `#[non_exhaustive]` error: valid forms for the attribute are `#[macro_use(name1, name2, ...)]` and `#[macro_use]` - --> $DIR/malformed-attrs.rs:210:1 + --> $DIR/malformed-attrs.rs:206:1 | LL | #[macro_use = 1] | ^^^^^^^^^^^^^^^^ error[E0565]: malformed `type_const` attribute input - --> $DIR/malformed-attrs.rs:144:5 + --> $DIR/malformed-attrs.rs:140:5 | LL | #[type_const = 1] | ^^^^^^^^^^^^^---^ @@ -577,7 +571,7 @@ LL | #[type_const = 1] | help: must be of the form: `#[type_const]` error: attribute should be applied to `const fn` - --> $DIR/malformed-attrs.rs:35:1 + --> $DIR/malformed-attrs.rs:31:1 | LL | #[rustc_allow_const_fn_unstable] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -589,19 +583,19 @@ LL | | } | |_- not a `const fn` error: `#[repr(align(...))]` is not supported on function items - --> $DIR/malformed-attrs.rs:49:1 + --> $DIR/malformed-attrs.rs:45:1 | LL | #[repr] | ^^^^^^^ | help: use `#[rustc_align(...)]` instead - --> $DIR/malformed-attrs.rs:49:1 + --> $DIR/malformed-attrs.rs:45:1 | LL | #[repr] | ^^^^^^^ warning: `#[diagnostic::do_not_recommend]` does not expect any arguments - --> $DIR/malformed-attrs.rs:150:1 + --> $DIR/malformed-attrs.rs:146:1 | LL | #[diagnostic::do_not_recommend()] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -609,7 +603,7 @@ LL | #[diagnostic::do_not_recommend()] = note: `#[warn(malformed_diagnostic_attributes)]` on by default warning: missing options for `on_unimplemented` attribute - --> $DIR/malformed-attrs.rs:139:1 + --> $DIR/malformed-attrs.rs:135:1 | LL | #[diagnostic::on_unimplemented] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -617,7 +611,7 @@ LL | #[diagnostic::on_unimplemented] = help: at least one of the `message`, `note` and `label` options are expected warning: malformed `on_unimplemented` attribute - --> $DIR/malformed-attrs.rs:141:1 + --> $DIR/malformed-attrs.rs:137:1 | LL | #[diagnostic::on_unimplemented = 1] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ invalid option found here @@ -625,7 +619,7 @@ LL | #[diagnostic::on_unimplemented = 1] = help: only `message`, `note` and `label` are allowed as options error: valid forms for the attribute are `#[inline(always|never)]` and `#[inline]` - --> $DIR/malformed-attrs.rs:54:1 + --> $DIR/malformed-attrs.rs:50:1 | LL | #[inline = 5] | ^^^^^^^^^^^^^ @@ -634,7 +628,7 @@ LL | #[inline = 5] = note: for more information, see issue #57571 <https://github.com/rust-lang/rust/issues/57571> error: valid forms for the attribute are `#[ignore = "reason"]` and `#[ignore]` - --> $DIR/malformed-attrs.rs:95:1 + --> $DIR/malformed-attrs.rs:91:1 | LL | #[ignore()] | ^^^^^^^^^^^ @@ -643,7 +637,7 @@ LL | #[ignore()] = note: for more information, see issue #57571 <https://github.com/rust-lang/rust/issues/57571> error: valid forms for the attribute are `#[ignore = "reason"]` and `#[ignore]` - --> $DIR/malformed-attrs.rs:224:1 + --> $DIR/malformed-attrs.rs:220:1 | LL | #[ignore = 1] | ^^^^^^^^^^^^^ @@ -652,7 +646,7 @@ LL | #[ignore = 1] = note: for more information, see issue #57571 <https://github.com/rust-lang/rust/issues/57571> error[E0308]: mismatched types - --> $DIR/malformed-attrs.rs:112:23 + --> $DIR/malformed-attrs.rs:108:23 | LL | fn test() { | - help: a return type might be missing here: `-> _` @@ -660,9 +654,9 @@ LL | #[coroutine = 63] || {} | ^^^^^ expected `()`, found coroutine | = note: expected unit type `()` - found coroutine `{coroutine@$DIR/malformed-attrs.rs:112:23: 112:25}` + found coroutine `{coroutine@$DIR/malformed-attrs.rs:108:23: 108:25}` -error: aborting due to 75 previous errors; 3 warnings emitted +error: aborting due to 74 previous errors; 3 warnings emitted Some errors have detailed explanations: E0308, E0463, E0539, E0565, E0658, E0805. For more information about an error, try `rustc --explain E0308`. diff --git a/tests/ui/issues/issue-36786-resolve-call.rs b/tests/ui/autoref-autoderef/autoderef-vec-box-fn-36786.rs index de7b0e18d52..e16929bf48a 100644 --- a/tests/ui/issues/issue-36786-resolve-call.rs +++ b/tests/ui/autoref-autoderef/autoderef-vec-box-fn-36786.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/36786 //@ run-pass // Ensure that types that rely on obligations are autoderefed // correctly diff --git a/tests/ui/issues/issue-13264.rs b/tests/ui/autoref-autoderef/deref-chain-method-calls-13264.rs index bf4ec388c4f..f471c1c7eef 100644 --- a/tests/ui/issues/issue-13264.rs +++ b/tests/ui/autoref-autoderef/deref-chain-method-calls-13264.rs @@ -1,3 +1,5 @@ +//! Regression test for https://github.com/rust-lang/rust/issues/13264 + //@ run-pass #![allow(non_camel_case_types)] #![allow(non_snake_case)] diff --git a/tests/ui/backtrace/synchronized-panic-handler.run.stderr b/tests/ui/backtrace/synchronized-panic-handler.run.stderr index 7a60ef2da60..c604d49c193 100644 --- a/tests/ui/backtrace/synchronized-panic-handler.run.stderr +++ b/tests/ui/backtrace/synchronized-panic-handler.run.stderr @@ -1,7 +1,7 @@ -thread '<unnamed>' panicked at $DIR/synchronized-panic-handler.rs:11:5: +thread '<unnamed>' ($TID) panicked at $DIR/synchronized-panic-handler.rs:11:5: oops oh no woe is me note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace -thread '<unnamed>' panicked at $DIR/synchronized-panic-handler.rs:11:5: +thread '<unnamed>' ($TID) panicked at $DIR/synchronized-panic-handler.rs:11:5: oops oh no woe is me diff --git a/tests/ui/issues/issue-11709.rs b/tests/ui/block-result/blocks-without-results-11709.rs index 8a11074eca8..97ea6f9e19e 100644 --- a/tests/ui/issues/issue-11709.rs +++ b/tests/ui/block-result/blocks-without-results-11709.rs @@ -1,3 +1,5 @@ +//! Regression test for https://github.com/rust-lang/rust/issues/11709 + //@ run-pass #![allow(dead_code)] diff --git a/tests/ui/issues/issue-46471-1.rs b/tests/ui/borrowck/borrow-checker-lifetime-error-46471.rs index aa161d40f70..020b02aa34d 100644 --- a/tests/ui/issues/issue-46471-1.rs +++ b/tests/ui/borrowck/borrow-checker-lifetime-error-46471.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/46471 fn main() { let y = { let mut z = 0; diff --git a/tests/ui/issues/issue-46471-1.stderr b/tests/ui/borrowck/borrow-checker-lifetime-error-46471.stderr index d4517223982..c90da551620 100644 --- a/tests/ui/issues/issue-46471-1.stderr +++ b/tests/ui/borrowck/borrow-checker-lifetime-error-46471.stderr @@ -1,5 +1,5 @@ error[E0597]: `z` does not live long enough - --> $DIR/issue-46471-1.rs:4:9 + --> $DIR/borrow-checker-lifetime-error-46471.rs:5:9 | LL | let mut z = 0; | ----- binding `z` declared here diff --git a/tests/ui/issues/issue-7061.rs b/tests/ui/borrowck/mismatched-pointer-type-in-self-7061.rs index c5d5a9d9498..521a5ee9c37 100644 --- a/tests/ui/issues/issue-7061.rs +++ b/tests/ui/borrowck/mismatched-pointer-type-in-self-7061.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/7061 //@ dont-require-annotations: NOTE struct BarStruct; diff --git a/tests/ui/issues/issue-7061.stderr b/tests/ui/borrowck/mismatched-pointer-type-in-self-7061.stderr index b4c0ebfbdd5..39b9072dc30 100644 --- a/tests/ui/issues/issue-7061.stderr +++ b/tests/ui/borrowck/mismatched-pointer-type-in-self-7061.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/issue-7061.rs:6:46 + --> $DIR/mismatched-pointer-type-in-self-7061.rs:7:46 | LL | fn foo(&'a mut self) -> Box<BarStruct> { self } | -------------- ^^^^ expected `Box<BarStruct>`, found `&mut BarStruct` diff --git a/tests/ui/issues/issue-12041.rs b/tests/ui/borrowck/moved-value-in-thread-loop-12041.rs index 091e8fe8b2a..98f9cdbdef7 100644 --- a/tests/ui/issues/issue-12041.rs +++ b/tests/ui/borrowck/moved-value-in-thread-loop-12041.rs @@ -1,3 +1,5 @@ +//! Regression test for https://github.com/rust-lang/rust/issues/12041 + use std::sync::mpsc::channel; use std::thread; diff --git a/tests/ui/issues/issue-12041.stderr b/tests/ui/borrowck/moved-value-in-thread-loop-12041.stderr index f2c10b83383..627dd193dad 100644 --- a/tests/ui/issues/issue-12041.stderr +++ b/tests/ui/borrowck/moved-value-in-thread-loop-12041.stderr @@ -1,5 +1,5 @@ error[E0382]: use of moved value: `tx` - --> $DIR/issue-12041.rs:8:22 + --> $DIR/moved-value-in-thread-loop-12041.rs:10:22 | LL | let tx = tx; | ^^ value moved here, in previous iteration of loop diff --git a/tests/ui/issues/issue-12033.rs b/tests/ui/borrowck/refcell-borrow-comparison-12033.rs index 0bf6490bafe..de22cedd5b9 100644 --- a/tests/ui/issues/issue-12033.rs +++ b/tests/ui/borrowck/refcell-borrow-comparison-12033.rs @@ -1,3 +1,5 @@ +//! Regression test for https://github.com/rust-lang/rust/issues/12033 + //@ run-pass use std::cell::RefCell; diff --git a/tests/ui/issues/issue-13665.rs b/tests/ui/borrowck/region-checker-map-closure-13665.rs index e1d8be16f45..72efa42fe38 100644 --- a/tests/ui/issues/issue-13665.rs +++ b/tests/ui/borrowck/region-checker-map-closure-13665.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/13665 //@ run-pass fn foo<'r>() { diff --git a/tests/ui/issues/issue-11869.rs b/tests/ui/borrowck/string-borrowing-pattern-matching-11869.rs index dd752227bbe..fe3d1bf6e8a 100644 --- a/tests/ui/issues/issue-11869.rs +++ b/tests/ui/borrowck/string-borrowing-pattern-matching-11869.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/11869 //@ check-pass #![allow(dead_code)] diff --git a/tests/ui/borrowck/string-literal-match-patterns-11869.rs b/tests/ui/borrowck/string-literal-match-patterns-11869.rs new file mode 100644 index 00000000000..4c159e457cf --- /dev/null +++ b/tests/ui/borrowck/string-literal-match-patterns-11869.rs @@ -0,0 +1,18 @@ +//! Regression test for https://github.com/rust-lang/rust/issues/11869 + +//@ check-pass +#![allow(dead_code)] + +struct A { + a: String +} + +fn borrow<'a>(binding: &'a A) -> &'a str { + match &*binding.a { + "in" => "in_", + "ref" => "ref_", + ident => ident + } +} + +fn main() {} diff --git a/tests/ui/issues/issue-9918.rs b/tests/ui/cast/u8-to-char-cast-9918.rs index 017e833aefb..2b8be1f0fc9 100644 --- a/tests/ui/issues/issue-9918.rs +++ b/tests/ui/cast/u8-to-char-cast-9918.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/9918 //@ run-pass pub fn main() { diff --git a/tests/ui/cfg/both-true-false.stderr b/tests/ui/cfg/both-true-false.stderr index 1526cc2b707..1a7c509aec0 100644 --- a/tests/ui/cfg/both-true-false.stderr +++ b/tests/ui/cfg/both-true-false.stderr @@ -3,6 +3,22 @@ error[E0425]: cannot find function `foo` in this scope | LL | foo(); | ^^^ not found in this scope + | +note: found an item that was configured out + --> $DIR/both-true-false.rs:6:4 + | +LL | #[cfg(false)] + | ----- the item is gated here +LL | #[cfg(true)] +LL | fn foo() {} + | ^^^ +note: found an item that was configured out + --> $DIR/both-true-false.rs:10:4 + | +LL | #[cfg(false)] + | ----- the item is gated here +LL | fn foo() {} + | ^^^ error: aborting due to 1 previous error diff --git a/tests/ui/cfg/cfg-version/syntax.stderr b/tests/ui/cfg/cfg-version/syntax.stderr index 188f6d7aa5d..34ddfff3e8e 100644 --- a/tests/ui/cfg/cfg-version/syntax.stderr +++ b/tests/ui/cfg/cfg-version/syntax.stderr @@ -128,60 +128,150 @@ error[E0425]: cannot find function `key_value_form` in this scope | LL | key_value_form(); | ^^^^^^^^^^^^^^ not found in this scope + | +note: found an item that was configured out + --> $DIR/syntax.rs:32:4 + | +LL | #[cfg(version = "1.43")] + | ---------------- the item is gated behind the `1.43` feature +LL | +LL | fn key_value_form() {} + | ^^^^^^^^^^^^^^ error[E0425]: cannot find function `not_numbers_or_periods` in this scope --> $DIR/syntax.rs:143:5 | LL | not_numbers_or_periods(); | ^^^^^^^^^^^^^^^^^^^^^^ not found in this scope + | +note: found an item that was configured out + --> $DIR/syntax.rs:53:4 + | +LL | #[cfg(version("foo"))] + | ------- the item is gated here +LL | +LL | fn not_numbers_or_periods() {} + | ^^^^^^^^^^^^^^^^^^^^^^ error[E0425]: cannot find function `complex_semver_with_metadata` in this scope --> $DIR/syntax.rs:144:5 | LL | complex_semver_with_metadata(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not found in this scope + | +note: found an item that was configured out + --> $DIR/syntax.rs:57:4 + | +LL | #[cfg(version("1.20.0-stable"))] + | ----------------- the item is gated here +LL | +LL | fn complex_semver_with_metadata() {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0425]: cannot find function `invalid_major_only` in this scope --> $DIR/syntax.rs:145:5 | LL | invalid_major_only(); | ^^^^^^^^^^^^^^^^^^ not found in this scope + | +note: found an item that was configured out + --> $DIR/syntax.rs:80:4 + | +LL | #[cfg(version("1"))] + | ----- the item is gated here +LL | +LL | fn invalid_major_only() {} + | ^^^^^^^^^^^^^^^^^^ error[E0425]: cannot find function `invalid_major_only_zero` in this scope --> $DIR/syntax.rs:146:5 | LL | invalid_major_only_zero(); | ^^^^^^^^^^^^^^^^^^^^^^^ not found in this scope + | +note: found an item that was configured out + --> $DIR/syntax.rs:84:4 + | +LL | #[cfg(version("0"))] + | ----- the item is gated here +LL | +LL | fn invalid_major_only_zero() {} + | ^^^^^^^^^^^^^^^^^^^^^^^ error[E0425]: cannot find function `invalid_major_only_negative` in this scope --> $DIR/syntax.rs:147:5 | LL | invalid_major_only_negative(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ not found in this scope + | +note: found an item that was configured out + --> $DIR/syntax.rs:97:4 + | +LL | #[cfg(version("-1"))] + | ------ the item is gated here +LL | +LL | fn invalid_major_only_negative() {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0425]: cannot find function `exceed_u16_major` in this scope --> $DIR/syntax.rs:148:5 | LL | exceed_u16_major(); | ^^^^^^^^^^^^^^^^ not found in this scope + | +note: found an item that was configured out + --> $DIR/syntax.rs:103:4 + | +LL | #[cfg(version("65536"))] + | --------- the item is gated here +LL | +LL | fn exceed_u16_major() {} + | ^^^^^^^^^^^^^^^^ error[E0425]: cannot find function `exceed_u16_minor` in this scope --> $DIR/syntax.rs:149:5 | LL | exceed_u16_minor(); | ^^^^^^^^^^^^^^^^ not found in this scope + | +note: found an item that was configured out + --> $DIR/syntax.rs:107:4 + | +LL | #[cfg(version("1.65536.0"))] + | ------------- the item is gated here +LL | +LL | fn exceed_u16_minor() {} + | ^^^^^^^^^^^^^^^^ error[E0425]: cannot find function `exceed_u16_patch` in this scope --> $DIR/syntax.rs:150:5 | LL | exceed_u16_patch(); | ^^^^^^^^^^^^^^^^ not found in this scope + | +note: found an item that was configured out + --> $DIR/syntax.rs:111:4 + | +LL | #[cfg(version("1.0.65536"))] + | ------------- the item is gated here +LL | +LL | fn exceed_u16_patch() {} + | ^^^^^^^^^^^^^^^^ error[E0425]: cannot find function `exceed_u16_mixed` in this scope --> $DIR/syntax.rs:151:5 | LL | exceed_u16_mixed(); | ^^^^^^^^^^^^^^^^ not found in this scope + | +note: found an item that was configured out + --> $DIR/syntax.rs:115:4 + | +LL | #[cfg(version("65536.0.65536"))] + | ----------------- the item is gated here +LL | +LL | fn exceed_u16_mixed() {} + | ^^^^^^^^^^^^^^^^ error: aborting due to 14 previous errors; 14 warnings emitted diff --git a/tests/ui/cfg/cmdline-false.stderr b/tests/ui/cfg/cmdline-false.stderr index 5f57c754c40..3d486803821 100644 --- a/tests/ui/cfg/cmdline-false.stderr +++ b/tests/ui/cfg/cmdline-false.stderr @@ -3,6 +3,14 @@ error[E0425]: cannot find function `foo` in this scope | LL | foo(); | ^^^ not found in this scope + | +note: found an item that was configured out + --> $DIR/cmdline-false.rs:5:4 + | +LL | #[cfg(false)] + | ----- the item is gated here +LL | fn foo() {} + | ^^^ error: aborting due to 1 previous error diff --git a/tests/ui/cfg/diagnostics-cross-crate.rs b/tests/ui/cfg/diagnostics-cross-crate.rs index 00ac7e2fd08..f959332c817 100644 --- a/tests/ui/cfg/diagnostics-cross-crate.rs +++ b/tests/ui/cfg/diagnostics-cross-crate.rs @@ -11,24 +11,20 @@ fn main() { cfged_out::inner::uwu(); //~ ERROR cannot find function //~^ NOTE found an item that was configured out //~| NOTE not found in `cfged_out::inner` - //~| NOTE the item is gated here // The module isn't found - we would like to get a diagnostic, but currently don't due to // the awkward way the resolver diagnostics are currently implemented. cfged_out::inner::doesnt_exist::hello(); //~ ERROR failed to resolve //~^ NOTE could not find `doesnt_exist` in `inner` //~| NOTE found an item that was configured out - //~| NOTE the item is gated here // It should find the one in the right module, not the wrong one. cfged_out::inner::right::meow(); //~ ERROR cannot find function //~^ NOTE found an item that was configured out //~| NOTE not found in `cfged_out::inner::right - //~| NOTE the item is gated behind the `what-a-cool-feature` feature // Exists in the crate root - diagnostic. cfged_out::vanished(); //~ ERROR cannot find function //~^ NOTE found an item that was configured out //~| NOTE not found in `cfged_out` - //~| NOTE the item is gated here } diff --git a/tests/ui/cfg/diagnostics-cross-crate.stderr b/tests/ui/cfg/diagnostics-cross-crate.stderr index 155b3db2f42..658e5a442bd 100644 --- a/tests/ui/cfg/diagnostics-cross-crate.stderr +++ b/tests/ui/cfg/diagnostics-cross-crate.stderr @@ -1,5 +1,5 @@ error[E0433]: failed to resolve: could not find `doesnt_exist` in `inner` - --> $DIR/diagnostics-cross-crate.rs:18:23 + --> $DIR/diagnostics-cross-crate.rs:17:23 | LL | cfged_out::inner::doesnt_exist::hello(); | ^^^^^^^^^^^^ could not find `doesnt_exist` in `inner` @@ -7,13 +7,10 @@ LL | cfged_out::inner::doesnt_exist::hello(); note: found an item that was configured out --> $DIR/auxiliary/cfged_out.rs:6:13 | +LL | #[cfg(false)] + | ----- the item is gated here LL | pub mod doesnt_exist { | ^^^^^^^^^^^^ -note: the item is gated here - --> $DIR/auxiliary/cfged_out.rs:5:11 - | -LL | #[cfg(false)] - | ^^^^^ error[E0425]: cannot find function `uwu` in crate `cfged_out` --> $DIR/diagnostics-cross-crate.rs:7:16 @@ -30,16 +27,13 @@ LL | cfged_out::inner::uwu(); note: found an item that was configured out --> $DIR/auxiliary/cfged_out.rs:3:12 | +LL | #[cfg(false)] + | ----- the item is gated here LL | pub fn uwu() {} | ^^^ -note: the item is gated here - --> $DIR/auxiliary/cfged_out.rs:2:11 - | -LL | #[cfg(false)] - | ^^^^^ error[E0425]: cannot find function `meow` in module `cfged_out::inner::right` - --> $DIR/diagnostics-cross-crate.rs:24:30 + --> $DIR/diagnostics-cross-crate.rs:22:30 | LL | cfged_out::inner::right::meow(); | ^^^^ not found in `cfged_out::inner::right` @@ -47,16 +41,13 @@ LL | cfged_out::inner::right::meow(); note: found an item that was configured out --> $DIR/auxiliary/cfged_out.rs:17:16 | +LL | #[cfg(feature = "what-a-cool-feature")] + | ------------------------------- the item is gated behind the `what-a-cool-feature` feature LL | pub fn meow() {} | ^^^^ -note: the item is gated behind the `what-a-cool-feature` feature - --> $DIR/auxiliary/cfged_out.rs:16:15 - | -LL | #[cfg(feature = "what-a-cool-feature")] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0425]: cannot find function `vanished` in crate `cfged_out` - --> $DIR/diagnostics-cross-crate.rs:30:16 + --> $DIR/diagnostics-cross-crate.rs:27:16 | LL | cfged_out::vanished(); | ^^^^^^^^ not found in `cfged_out` @@ -64,13 +55,10 @@ LL | cfged_out::vanished(); note: found an item that was configured out --> $DIR/auxiliary/cfged_out.rs:22:8 | +LL | #[cfg(i_dont_exist_and_you_can_do_nothing_about_it)] + | -------------------------------------------- the item is gated here LL | pub fn vanished() {} | ^^^^^^^^ -note: the item is gated here - --> $DIR/auxiliary/cfged_out.rs:21:7 - | -LL | #[cfg(i_dont_exist_and_you_can_do_nothing_about_it)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 5 previous errors diff --git a/tests/ui/cfg/diagnostics-reexport-2.stderr b/tests/ui/cfg/diagnostics-reexport-2.stderr index e1f91fcc5d1..713cffce65b 100644 --- a/tests/ui/cfg/diagnostics-reexport-2.stderr +++ b/tests/ui/cfg/diagnostics-reexport-2.stderr @@ -7,13 +7,11 @@ LL | reexport::gated::foo(); note: found an item that was configured out --> $DIR/diagnostics-reexport-2.rs:10:13 | +LL | #[cfg(false)] + | ----- the item is gated here +... LL | pub mod gated { | ^^^^^ -note: the item is gated here - --> $DIR/diagnostics-reexport-2.rs:4:11 - | -LL | #[cfg(false)] - | ^^^^^ error[E0433]: failed to resolve: could not find `gated` in `reexport2` --> $DIR/diagnostics-reexport-2.rs:46:16 @@ -24,13 +22,11 @@ LL | reexport2::gated::foo(); note: found an item that was configured out --> $DIR/diagnostics-reexport-2.rs:10:13 | +LL | #[cfg(false)] + | ----- the item is gated here +... LL | pub mod gated { | ^^^^^ -note: the item is gated here - --> $DIR/diagnostics-reexport-2.rs:4:11 - | -LL | #[cfg(false)] - | ^^^^^ error[E0433]: failed to resolve: could not find `gated` in `reexport30` --> $DIR/diagnostics-reexport-2.rs:50:17 @@ -41,13 +37,11 @@ LL | reexport30::gated::foo(); note: found an item that was configured out --> $DIR/diagnostics-reexport-2.rs:10:13 | +LL | #[cfg(false)] + | ----- the item is gated here +... LL | pub mod gated { | ^^^^^ -note: the item is gated here - --> $DIR/diagnostics-reexport-2.rs:4:11 - | -LL | #[cfg(false)] - | ^^^^^ error[E0433]: failed to resolve: could not find `gated` in `reexport31` --> $DIR/diagnostics-reexport-2.rs:54:17 @@ -58,13 +52,11 @@ LL | reexport31::gated::foo(); note: found an item that was configured out --> $DIR/diagnostics-reexport-2.rs:10:13 | +LL | #[cfg(false)] + | ----- the item is gated here +... LL | pub mod gated { | ^^^^^ -note: the item is gated here - --> $DIR/diagnostics-reexport-2.rs:4:11 - | -LL | #[cfg(false)] - | ^^^^^ error[E0433]: failed to resolve: could not find `gated` in `reexport32` --> $DIR/diagnostics-reexport-2.rs:58:17 @@ -75,13 +67,11 @@ LL | reexport32::gated::foo(); note: found an item that was configured out --> $DIR/diagnostics-reexport-2.rs:10:13 | +LL | #[cfg(false)] + | ----- the item is gated here +... LL | pub mod gated { | ^^^^^ -note: the item is gated here - --> $DIR/diagnostics-reexport-2.rs:4:11 - | -LL | #[cfg(false)] - | ^^^^^ error: aborting due to 5 previous errors diff --git a/tests/ui/cfg/diagnostics-reexport.rs b/tests/ui/cfg/diagnostics-reexport.rs index 56fac562238..c6a714fca71 100644 --- a/tests/ui/cfg/diagnostics-reexport.rs +++ b/tests/ui/cfg/diagnostics-reexport.rs @@ -34,7 +34,7 @@ mod b { } fn main() { - // There is no uwu at this path - no diagnostic. + // There is no uwu at this path, but there's one in a cgfd out sub-module, so we mention it. inner::uwu(); //~ ERROR cannot find function //~^ NOTE not found in `inner` } diff --git a/tests/ui/cfg/diagnostics-reexport.stderr b/tests/ui/cfg/diagnostics-reexport.stderr index bf1bbcba7e4..a3a6e13f475 100644 --- a/tests/ui/cfg/diagnostics-reexport.stderr +++ b/tests/ui/cfg/diagnostics-reexport.stderr @@ -7,13 +7,10 @@ LL | pub use a::x; note: found an item that was configured out --> $DIR/diagnostics-reexport.rs:18:12 | +LL | #[cfg(false)] + | ----- the item is gated here LL | pub fn x() {} | ^ -note: the item is gated here - --> $DIR/diagnostics-reexport.rs:17:11 - | -LL | #[cfg(false)] - | ^^^^^ error[E0432]: unresolved imports `b::x`, `b::y` --> $DIR/diagnostics-reexport.rs:22:13 @@ -26,23 +23,17 @@ LL | pub use b::{x, y}; note: found an item that was configured out --> $DIR/diagnostics-reexport.rs:29:12 | +LL | #[cfg(false)] + | ----- the item is gated here LL | pub fn x() {} | ^ -note: the item is gated here - --> $DIR/diagnostics-reexport.rs:28:11 - | -LL | #[cfg(false)] - | ^^^^^ note: found an item that was configured out --> $DIR/diagnostics-reexport.rs:32:12 | +LL | #[cfg(false)] + | ----- the item is gated here LL | pub fn y() {} | ^ -note: the item is gated here - --> $DIR/diagnostics-reexport.rs:31:11 - | -LL | #[cfg(false)] - | ^^^^^ error[E0425]: cannot find function `uwu` in module `inner` --> $DIR/diagnostics-reexport.rs:38:12 @@ -53,13 +44,10 @@ LL | inner::uwu(); note: found an item that was configured out --> $DIR/diagnostics-reexport.rs:8:20 | +LL | #[cfg(false)] + | ----- the item is gated here LL | pub use super::uwu; | ^^^ -note: the item is gated here - --> $DIR/diagnostics-reexport.rs:7:11 - | -LL | #[cfg(false)] - | ^^^^^ error: aborting due to 3 previous errors diff --git a/tests/ui/cfg/diagnostics-same-crate.rs b/tests/ui/cfg/diagnostics-same-crate.rs index 9153f20b296..29209d5f3ea 100644 --- a/tests/ui/cfg/diagnostics-same-crate.rs +++ b/tests/ui/cfg/diagnostics-same-crate.rs @@ -37,8 +37,8 @@ mod placeholder { //~| NOTE could not find `doesnt_exist` in `inner` } -#[cfg(i_dont_exist_and_you_can_do_nothing_about_it)] -pub fn vanished() {} +#[cfg(i_dont_exist_and_you_can_do_nothing_about_it)] //~ NOTE the item is gated here +pub fn vanished() {} //~ NOTE found an item that was configured out fn main() { // There is no uwu at this path - no diagnostic. @@ -49,8 +49,7 @@ fn main() { inner::uwu(); //~ ERROR cannot find function //~| NOTE not found in `inner` - // The module isn't found - we would like to get a diagnostic, but currently don't due to - // the awkward way the resolver diagnostics are currently implemented. + // The module isn't found - we get a diagnostic. inner::doesnt_exist::hello(); //~ ERROR failed to resolve //~| NOTE could not find `doesnt_exist` in `inner` @@ -58,9 +57,8 @@ fn main() { inner::right::meow(); //~ ERROR cannot find function //~| NOTE not found in `inner::right - // Exists in the crate root - we would generally want a diagnostic, - // but currently don't have one. - // Not that it matters much though, this is highly unlikely to confuse anyone. + // Exists in the crate root - we show a diagnostic because we treat "no module DefId" as "crate + // root DefId". vanished(); //~ ERROR cannot find function //~^ NOTE not found in this scope } diff --git a/tests/ui/cfg/diagnostics-same-crate.stderr b/tests/ui/cfg/diagnostics-same-crate.stderr index 121f25ca090..a8d789e61d1 100644 --- a/tests/ui/cfg/diagnostics-same-crate.stderr +++ b/tests/ui/cfg/diagnostics-same-crate.stderr @@ -7,13 +7,11 @@ LL | use super::inner::doesnt_exist; note: found an item that was configured out --> $DIR/diagnostics-same-crate.rs:11:13 | +LL | #[cfg(false)] + | ----- the item is gated here +... LL | pub mod doesnt_exist { | ^^^^^^^^^^^^ -note: the item is gated here - --> $DIR/diagnostics-same-crate.rs:8:11 - | -LL | #[cfg(false)] - | ^^^^^ error[E0432]: unresolved import `super::inner::doesnt_exist` --> $DIR/diagnostics-same-crate.rs:35:23 @@ -24,16 +22,14 @@ LL | use super::inner::doesnt_exist::hi; note: found an item that was configured out --> $DIR/diagnostics-same-crate.rs:11:13 | +LL | #[cfg(false)] + | ----- the item is gated here +... LL | pub mod doesnt_exist { | ^^^^^^^^^^^^ -note: the item is gated here - --> $DIR/diagnostics-same-crate.rs:8:11 - | -LL | #[cfg(false)] - | ^^^^^ error[E0433]: failed to resolve: could not find `doesnt_exist` in `inner` - --> $DIR/diagnostics-same-crate.rs:54:12 + --> $DIR/diagnostics-same-crate.rs:53:12 | LL | inner::doesnt_exist::hello(); | ^^^^^^^^^^^^ could not find `doesnt_exist` in `inner` @@ -41,13 +37,11 @@ LL | inner::doesnt_exist::hello(); note: found an item that was configured out --> $DIR/diagnostics-same-crate.rs:11:13 | +LL | #[cfg(false)] + | ----- the item is gated here +... LL | pub mod doesnt_exist { | ^^^^^^^^^^^^ -note: the item is gated here - --> $DIR/diagnostics-same-crate.rs:8:11 - | -LL | #[cfg(false)] - | ^^^^^ error[E0425]: cannot find function `uwu` in module `inner` --> $DIR/diagnostics-same-crate.rs:49:12 @@ -58,16 +52,13 @@ LL | inner::uwu(); note: found an item that was configured out --> $DIR/diagnostics-same-crate.rs:5:12 | +LL | #[cfg(false)] + | ----- the item is gated here LL | pub fn uwu() {} | ^^^ -note: the item is gated here - --> $DIR/diagnostics-same-crate.rs:4:11 - | -LL | #[cfg(false)] - | ^^^^^ error[E0425]: cannot find function `meow` in module `inner::right` - --> $DIR/diagnostics-same-crate.rs:58:19 + --> $DIR/diagnostics-same-crate.rs:57:19 | LL | inner::right::meow(); | ^^^^ not found in `inner::right` @@ -75,13 +66,10 @@ LL | inner::right::meow(); note: found an item that was configured out --> $DIR/diagnostics-same-crate.rs:26:16 | +LL | #[cfg(feature = "what-a-cool-feature")] + | ------------------------------- the item is gated behind the `what-a-cool-feature` feature LL | pub fn meow() {} | ^^^^ -note: the item is gated behind the `what-a-cool-feature` feature - --> $DIR/diagnostics-same-crate.rs:25:15 - | -LL | #[cfg(feature = "what-a-cool-feature")] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0425]: cannot find function `uwu` in this scope --> $DIR/diagnostics-same-crate.rs:45:5 @@ -90,10 +78,18 @@ LL | uwu(); | ^^^ not found in this scope error[E0425]: cannot find function `vanished` in this scope - --> $DIR/diagnostics-same-crate.rs:64:5 + --> $DIR/diagnostics-same-crate.rs:62:5 | LL | vanished(); | ^^^^^^^^ not found in this scope + | +note: found an item that was configured out + --> $DIR/diagnostics-same-crate.rs:41:8 + | +LL | #[cfg(i_dont_exist_and_you_can_do_nothing_about_it)] + | -------------------------------------------- the item is gated here +LL | pub fn vanished() {} + | ^^^^^^^^ error: aborting due to 7 previous errors diff --git a/tests/ui/cfg/nested-cfg-attr-conditional-compilation.rs b/tests/ui/cfg/nested-cfg-attr-conditional-compilation.rs index 7618e83a642..c5d86a27d52 100644 --- a/tests/ui/cfg/nested-cfg-attr-conditional-compilation.rs +++ b/tests/ui/cfg/nested-cfg-attr-conditional-compilation.rs @@ -10,9 +10,10 @@ //! //! Added in <https://github.com/rust-lang/rust/pull/34216>. -#[cfg_attr(all(), cfg_attr(all(), cfg(false)))] -fn f() {} +#[cfg_attr(all(), cfg_attr(all(), cfg(false)))] //~ NOTE the item is gated here +fn f() {} //~ NOTE found an item that was configured out fn main() { f() //~ ERROR cannot find function `f` in this scope + //~^ NOTE not found in this scope } diff --git a/tests/ui/cfg/nested-cfg-attr-conditional-compilation.stderr b/tests/ui/cfg/nested-cfg-attr-conditional-compilation.stderr index ddb8ea1e13a..3f833bd558b 100644 --- a/tests/ui/cfg/nested-cfg-attr-conditional-compilation.stderr +++ b/tests/ui/cfg/nested-cfg-attr-conditional-compilation.stderr @@ -3,6 +3,14 @@ error[E0425]: cannot find function `f` in this scope | LL | f() | ^ not found in this scope + | +note: found an item that was configured out + --> $DIR/nested-cfg-attr-conditional-compilation.rs:14:4 + | +LL | #[cfg_attr(all(), cfg_attr(all(), cfg(false)))] + | ----- the item is gated here +LL | fn f() {} + | ^ error: aborting due to 1 previous error diff --git a/tests/ui/issues/issue-21600.rs b/tests/ui/closures/aliasability-violation-with-closure-21600.rs index 2e22e5e6fa2..d4c658319ab 100644 --- a/tests/ui/issues/issue-21600.rs +++ b/tests/ui/closures/aliasability-violation-with-closure-21600.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/21600 fn call_it<F>(f: F) where F: Fn() { f(); } struct A; diff --git a/tests/ui/issues/issue-21600.stderr b/tests/ui/closures/aliasability-violation-with-closure-21600.stderr index f7905934424..2d2397a2141 100644 --- a/tests/ui/issues/issue-21600.stderr +++ b/tests/ui/closures/aliasability-violation-with-closure-21600.stderr @@ -1,5 +1,5 @@ error[E0596]: cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure - --> $DIR/issue-21600.rs:14:20 + --> $DIR/aliasability-violation-with-closure-21600.rs:15:20 | LL | fn call_it<F>(f: F) where F: Fn() { f(); } | - change this to accept `FnMut` instead of `Fn` @@ -11,7 +11,7 @@ LL | call_it(|| x.gen_mut()); | expects `Fn` instead of `FnMut` error[E0596]: cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure - --> $DIR/issue-21600.rs:14:17 + --> $DIR/aliasability-violation-with-closure-21600.rs:15:17 | LL | fn call_it<F>(f: F) where F: Fn() { f(); } | - change this to accept `FnMut` instead of `Fn` diff --git a/tests/ui/issues/issue-12127.rs b/tests/ui/closures/fnonce-moved-twice-12127.rs index 199d542e816..369ddcafaab 100644 --- a/tests/ui/issues/issue-12127.rs +++ b/tests/ui/closures/fnonce-moved-twice-12127.rs @@ -1,3 +1,5 @@ +//! Regression test for https://github.com/rust-lang/rust/issues/12127 + #![feature(unboxed_closures, tuple_trait)] fn to_fn_once<A:std::marker::Tuple,F:FnOnce<A>>(f: F) -> F { f } diff --git a/tests/ui/issues/issue-12127.stderr b/tests/ui/closures/fnonce-moved-twice-12127.stderr index 2a6233547ee..c2e12827527 100644 --- a/tests/ui/issues/issue-12127.stderr +++ b/tests/ui/closures/fnonce-moved-twice-12127.stderr @@ -1,5 +1,5 @@ error[E0382]: use of moved value: `f` - --> $DIR/issue-12127.rs:11:9 + --> $DIR/fnonce-moved-twice-12127.rs:13:9 | LL | f(); | --- `f` moved due to this call @@ -7,11 +7,11 @@ LL | f(); | ^ value used here after move | note: this value implements `FnOnce`, which causes it to be moved when called - --> $DIR/issue-12127.rs:10:9 + --> $DIR/fnonce-moved-twice-12127.rs:12:9 | LL | f(); | ^ - = note: move occurs because `f` has type `{closure@$DIR/issue-12127.rs:8:24: 8:30}`, which does not implement the `Copy` trait + = note: move occurs because `f` has type `{closure@$DIR/fnonce-moved-twice-12127.rs:10:24: 10:30}`, which does not implement the `Copy` trait error: aborting due to 1 previous error diff --git a/tests/ui/issues/issue-11958.rs b/tests/ui/closures/moved-upvar-mut-rebind-11958.rs index 9185c5158af..701dc1a2cef 100644 --- a/tests/ui/issues/issue-11958.rs +++ b/tests/ui/closures/moved-upvar-mut-rebind-11958.rs @@ -1,3 +1,5 @@ +//! Regression test for https://github.com/rust-lang/rust/issues/11958 + //@ run-pass // We shouldn't need to rebind a moved upvar as mut if it's already diff --git a/tests/ui/issues/issue-11958.stderr b/tests/ui/closures/moved-upvar-mut-rebind-11958.stderr index 5dca4c2f01d..b12bbcad925 100644 --- a/tests/ui/issues/issue-11958.stderr +++ b/tests/ui/closures/moved-upvar-mut-rebind-11958.stderr @@ -1,5 +1,5 @@ warning: value assigned to `x` is never read - --> $DIR/issue-11958.rs:8:36 + --> $DIR/moved-upvar-mut-rebind-11958.rs:10:36 | LL | let _thunk = Box::new(move|| { x = 2; }); | ^ @@ -8,7 +8,7 @@ LL | let _thunk = Box::new(move|| { x = 2; }); = note: `#[warn(unused_assignments)]` on by default warning: unused variable: `x` - --> $DIR/issue-11958.rs:8:36 + --> $DIR/moved-upvar-mut-rebind-11958.rs:10:36 | LL | let _thunk = Box::new(move|| { x = 2; }); | ^ diff --git a/tests/ui/issues/issue-36023.rs b/tests/ui/codegen/llvm-miscompile-metadata-invalidation-36023.rs index 32e8af65c7d..efa31a51881 100644 --- a/tests/ui/issues/issue-36023.rs +++ b/tests/ui/codegen/llvm-miscompile-metadata-invalidation-36023.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/36023 //@ run-pass #![allow(unused_variables)] use std::ops::Deref; diff --git a/tests/ui/codegen/unsupported-static-initializer-in-const-array.rs b/tests/ui/codegen/unsupported-static-initializer-in-const-array.rs new file mode 100644 index 00000000000..bc94130ee19 --- /dev/null +++ b/tests/ui/codegen/unsupported-static-initializer-in-const-array.rs @@ -0,0 +1,18 @@ +//! LLVM error with unsupported expression in static +//! initializer for const pointer in array on macOS. +//! +//! Regression test for <https://github.com/rust-lang/rust/issues/89225>. + +//@ build-pass +//@ compile-flags: -C opt-level=3 + +const fn make() -> (i32, i32, *const i32) { + const V: i32 = 123; + &V as *const i32; + (0, 0, &V) +} + +fn main() { + let arr = [make(); 32]; + println!("{}", arr[0].0); +} diff --git a/tests/ui/issues/issue-12744.rs b/tests/ui/coercion/any-trait-object-debug-12744.rs index eaf92d413d5..4d981c077ee 100644 --- a/tests/ui/issues/issue-12744.rs +++ b/tests/ui/coercion/any-trait-object-debug-12744.rs @@ -1,3 +1,5 @@ +//! Regression test for https://github.com/rust-lang/rust/issues/12744 + //@ run-pass fn main() { fn test() -> Box<dyn std::any::Any + 'static> { Box::new(1) } diff --git a/tests/ui/issues/issue-18058.rs b/tests/ui/coherence/impl-coherence-error-for-undefined-type-18058.rs index cced66717e1..52baf9871c3 100644 --- a/tests/ui/issues/issue-18058.rs +++ b/tests/ui/coherence/impl-coherence-error-for-undefined-type-18058.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/18058 impl Undefined {} //~^ ERROR cannot find type `Undefined` in this scope diff --git a/tests/ui/issues/issue-18058.stderr b/tests/ui/coherence/impl-coherence-error-for-undefined-type-18058.stderr index c880bb00291..07dce0b04fd 100644 --- a/tests/ui/issues/issue-18058.stderr +++ b/tests/ui/coherence/impl-coherence-error-for-undefined-type-18058.stderr @@ -1,5 +1,5 @@ error[E0412]: cannot find type `Undefined` in this scope - --> $DIR/issue-18058.rs:1:6 + --> $DIR/impl-coherence-error-for-undefined-type-18058.rs:2:6 | LL | impl Undefined {} | ^^^^^^^^^ not found in this scope diff --git a/tests/ui/issues/issue-12860.rs b/tests/ui/collections/hashset-connected-border-12860.rs index 255f6670793..40185bef7c8 100644 --- a/tests/ui/issues/issue-12860.rs +++ b/tests/ui/collections/hashset-connected-border-12860.rs @@ -1,3 +1,5 @@ +//! Regression test for https://github.com/rust-lang/rust/issues/12860 + //@ run-pass use std::collections::HashSet; diff --git a/tests/ui/conditional-compilation/test-cfg.rs b/tests/ui/conditional-compilation/test-cfg.rs index adbbc309be4..b3fff26a8fd 100644 --- a/tests/ui/conditional-compilation/test-cfg.rs +++ b/tests/ui/conditional-compilation/test-cfg.rs @@ -1,8 +1,10 @@ //@ compile-flags: --cfg foo --check-cfg=cfg(foo,bar) #[cfg(all(foo, bar))] // foo AND bar -fn foo() {} +//~^ NOTE the item is gated here +fn foo() {} //~ NOTE found an item that was configured out fn main() { foo(); //~ ERROR cannot find function `foo` in this scope + //~^ NOTE not found in this scope } diff --git a/tests/ui/conditional-compilation/test-cfg.stderr b/tests/ui/conditional-compilation/test-cfg.stderr index 9715f16acc2..379456f74b1 100644 --- a/tests/ui/conditional-compilation/test-cfg.stderr +++ b/tests/ui/conditional-compilation/test-cfg.stderr @@ -1,8 +1,17 @@ error[E0425]: cannot find function `foo` in this scope - --> $DIR/test-cfg.rs:7:5 + --> $DIR/test-cfg.rs:8:5 | LL | foo(); | ^^^ not found in this scope + | +note: found an item that was configured out + --> $DIR/test-cfg.rs:5:4 + | +LL | #[cfg(all(foo, bar))] // foo AND bar + | --- the item is gated here +LL | +LL | fn foo() {} + | ^^^ error: aborting due to 1 previous error diff --git a/tests/ui/const-generics/defaults/default-on-impl.rs b/tests/ui/const-generics/defaults/default-on-impl.rs index 9ce46aa09de..85d0c583965 100644 --- a/tests/ui/const-generics/defaults/default-on-impl.rs +++ b/tests/ui/const-generics/defaults/default-on-impl.rs @@ -1,6 +1,6 @@ struct Foo<const N: usize>; impl<const N: usize = 1> Foo<N> {} -//~^ ERROR defaults for const parameters are only allowed +//~^ ERROR defaults for generic parameters are not allowed here fn main() {} diff --git a/tests/ui/const-generics/defaults/default-on-impl.stderr b/tests/ui/const-generics/defaults/default-on-impl.stderr index 691e0354edd..eb5d57e14bf 100644 --- a/tests/ui/const-generics/defaults/default-on-impl.stderr +++ b/tests/ui/const-generics/defaults/default-on-impl.stderr @@ -1,4 +1,4 @@ -error: defaults for const parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions +error: defaults for generic parameters are not allowed here --> $DIR/default-on-impl.rs:3:6 | LL | impl<const N: usize = 1> Foo<N> {} diff --git a/tests/ui/const-generics/generic_const_exprs/issue-105257.rs b/tests/ui/const-generics/generic_const_exprs/issue-105257.rs index a107556fd79..85a28f2b330 100644 --- a/tests/ui/const-generics/generic_const_exprs/issue-105257.rs +++ b/tests/ui/const-generics/generic_const_exprs/issue-105257.rs @@ -1,10 +1,10 @@ #![feature(generic_const_exprs)] -#![allow(incomplete_features)] +#![expect(incomplete_features)] trait Trait<T> { - fn fnc<const N: usize = "">(&self) {} //~ERROR defaults for const parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions + fn fnc<const N: usize = "">(&self) {} //~ERROR defaults for generic parameters are not allowed here //~^ ERROR: mismatched types - fn foo<const N: usize = { std::mem::size_of::<T>() }>(&self) {} //~ERROR defaults for const parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions + fn foo<const N: usize = { std::mem::size_of::<T>() }>(&self) {} //~ERROR defaults for generic parameters are not allowed here } fn main() {} diff --git a/tests/ui/const-generics/generic_const_exprs/issue-105257.stderr b/tests/ui/const-generics/generic_const_exprs/issue-105257.stderr index d7ded0f1f74..1d0ab56519c 100644 --- a/tests/ui/const-generics/generic_const_exprs/issue-105257.stderr +++ b/tests/ui/const-generics/generic_const_exprs/issue-105257.stderr @@ -1,10 +1,10 @@ -error: defaults for const parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions +error: defaults for generic parameters are not allowed here --> $DIR/issue-105257.rs:5:12 | LL | fn fnc<const N: usize = "">(&self) {} | ^^^^^^^^^^^^^^^^^^^ -error: defaults for const parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions +error: defaults for generic parameters are not allowed here --> $DIR/issue-105257.rs:7:12 | LL | fn foo<const N: usize = { std::mem::size_of::<T>() }>(&self) {} diff --git a/tests/ui/const-generics/generic_const_exprs/issue-80742.rs b/tests/ui/const-generics/generic_const_exprs/issue-80742.rs index 73357d208c0..ac4d9fc0f4f 100644 --- a/tests/ui/const-generics/generic_const_exprs/issue-80742.rs +++ b/tests/ui/const-generics/generic_const_exprs/issue-80742.rs @@ -2,7 +2,7 @@ //@ known-bug: #97477 //@ failure-status: 101 //@ normalize-stderr: "note: .*\n\n" -> "" -//@ normalize-stderr: "thread 'rustc' panicked.*\n" -> "" +//@ normalize-stderr: "thread 'rustc'.*panicked.*\n" -> "" //@ normalize-stderr: "(error: internal compiler error: [^:]+):\d+:\d+: " -> "$1:LL:CC: " //@ rustc-env:RUST_BACKTRACE=0 diff --git a/tests/ui/const-generics/min_const_generics/default_function_param.rs b/tests/ui/const-generics/min_const_generics/default_function_param.rs index 92d495ef665..153cd94849e 100644 --- a/tests/ui/const-generics/min_const_generics/default_function_param.rs +++ b/tests/ui/const-generics/min_const_generics/default_function_param.rs @@ -1,4 +1,4 @@ #![crate_type = "lib"] fn foo<const SIZE: usize = 5usize>() {} -//~^ ERROR defaults for const parameters are +//~^ ERROR defaults for generic parameters are not allowed here diff --git a/tests/ui/const-generics/min_const_generics/default_function_param.stderr b/tests/ui/const-generics/min_const_generics/default_function_param.stderr index 247eea3d989..261298a1c63 100644 --- a/tests/ui/const-generics/min_const_generics/default_function_param.stderr +++ b/tests/ui/const-generics/min_const_generics/default_function_param.stderr @@ -1,4 +1,4 @@ -error: defaults for const parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions +error: defaults for generic parameters are not allowed here --> $DIR/default_function_param.rs:3:8 | LL | fn foo<const SIZE: usize = 5usize>() {} diff --git a/tests/ui/issues/issue-77919.rs b/tests/ui/const-generics/trait-resolution-error-with-const-generics-77919.rs index bf603314977..5ab443422df 100644 --- a/tests/ui/issues/issue-77919.rs +++ b/tests/ui/const-generics/trait-resolution-error-with-const-generics-77919.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/77919 fn main() { [1; <Multiply<Five, Five>>::VAL]; } diff --git a/tests/ui/issues/issue-77919.stderr b/tests/ui/const-generics/trait-resolution-error-with-const-generics-77919.stderr index dbbe70ff069..bac8abf46dc 100644 --- a/tests/ui/issues/issue-77919.stderr +++ b/tests/ui/const-generics/trait-resolution-error-with-const-generics-77919.stderr @@ -1,5 +1,5 @@ error[E0412]: cannot find type `PhantomData` in this scope - --> $DIR/issue-77919.rs:9:9 + --> $DIR/trait-resolution-error-with-const-generics-77919.rs:10:9 | LL | _n: PhantomData, | ^^^^^^^^^^^ not found in this scope @@ -10,7 +10,7 @@ LL + use std::marker::PhantomData; | error[E0412]: cannot find type `VAL` in this scope - --> $DIR/issue-77919.rs:11:63 + --> $DIR/trait-resolution-error-with-const-generics-77919.rs:12:63 | LL | impl<N, M> TypeVal<usize> for Multiply<N, M> where N: TypeVal<VAL> {} | ^^^ not found in this scope @@ -21,7 +21,7 @@ LL | impl<N, M, VAL> TypeVal<usize> for Multiply<N, M> where N: TypeVal<VAL> {} | +++++ error[E0046]: not all trait items implemented, missing: `VAL` - --> $DIR/issue-77919.rs:11:1 + --> $DIR/trait-resolution-error-with-const-generics-77919.rs:12:1 | LL | const VAL: T; | ------------ `VAL` from trait diff --git a/tests/ui/issues/issue-13446.rs b/tests/ui/const-generics/vec-macro-in-static-array.rs index 9f1fc42774f..7a81836e255 100644 --- a/tests/ui/issues/issue-13446.rs +++ b/tests/ui/const-generics/vec-macro-in-static-array.rs @@ -1,3 +1,5 @@ +//! Regression test for https://github.com/rust-lang/rust/issues/13446 + // Used to cause ICE static VEC: [u32; 256] = vec![]; diff --git a/tests/ui/issues/issue-13446.stderr b/tests/ui/const-generics/vec-macro-in-static-array.stderr index 28c459e6e62..de21f2274f3 100644 --- a/tests/ui/issues/issue-13446.stderr +++ b/tests/ui/const-generics/vec-macro-in-static-array.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/issue-13446.rs:3:26 + --> $DIR/vec-macro-in-static-array.rs:5:26 | LL | static VEC: [u32; 256] = vec![]; | ^^^^^^ expected `[u32; 256]`, found `Vec<_>` diff --git a/tests/ui/issues/issue-32086.rs b/tests/ui/consts/const-pattern-rewrite-error-32086.rs index d595d1dd7e6..d35dfe57687 100644 --- a/tests/ui/issues/issue-32086.rs +++ b/tests/ui/consts/const-pattern-rewrite-error-32086.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/32086 struct S(u8); const C: S = S(10); diff --git a/tests/ui/issues/issue-32086.stderr b/tests/ui/consts/const-pattern-rewrite-error-32086.stderr index e566dea8908..47616b06632 100644 --- a/tests/ui/issues/issue-32086.stderr +++ b/tests/ui/consts/const-pattern-rewrite-error-32086.stderr @@ -1,5 +1,5 @@ error[E0532]: expected tuple struct or tuple variant, found constant `C` - --> $DIR/issue-32086.rs:5:9 + --> $DIR/const-pattern-rewrite-error-32086.rs:6:9 | LL | struct S(u8); | ------------- similarly named tuple struct `S` defined here @@ -8,7 +8,7 @@ LL | let C(a) = S(11); | ^ help: a tuple struct with a similar name exists: `S` error[E0532]: expected tuple struct or tuple variant, found constant `C` - --> $DIR/issue-32086.rs:6:9 + --> $DIR/const-pattern-rewrite-error-32086.rs:7:9 | LL | struct S(u8); | ------------- similarly named tuple struct `S` defined here diff --git a/tests/ui/coroutine/clone-impl-async.rs b/tests/ui/coroutine/clone-impl-async.rs index 2794b167aa2..4e2b26d0295 100644 --- a/tests/ui/coroutine/clone-impl-async.rs +++ b/tests/ui/coroutine/clone-impl-async.rs @@ -9,7 +9,7 @@ use std::future::ready; struct NonClone; -fn main() { +fn local() { let inner_non_clone = async { let non_clone = NonClone; let () = ready(()).await; @@ -34,7 +34,9 @@ fn main() { //~^ ERROR : Copy` is not satisfied check_clone(&maybe_copy_clone); //~^ ERROR : Clone` is not satisfied +} +fn non_local() { let inner_non_clone_fn = the_inner_non_clone_fn(); check_copy(&inner_non_clone_fn); //~^ ERROR : Copy` is not satisfied @@ -69,3 +71,5 @@ async fn the_maybe_copy_clone_fn() {} fn check_copy<T: Copy>(_x: &T) {} fn check_clone<T: Clone>(_x: &T) {} + +fn main() {} diff --git a/tests/ui/coroutine/clone-impl-async.stderr b/tests/ui/coroutine/clone-impl-async.stderr index 62bcce2fbcb..319a5ed3d8d 100644 --- a/tests/ui/coroutine/clone-impl-async.stderr +++ b/tests/ui/coroutine/clone-impl-async.stderr @@ -1,167 +1,155 @@ -error[E0277]: the trait bound `{async block@$DIR/clone-impl-async.rs:13:27: 13:32}: Copy` is not satisfied - --> $DIR/clone-impl-async.rs:18:16 +error[E0277]: the trait bound `impl Future<Output = ()>: Copy` is not satisfied + --> $DIR/clone-impl-async.rs:41:16 | -LL | check_copy(&inner_non_clone); - | ---------- ^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `{async block@$DIR/clone-impl-async.rs:13:27: 13:32}` +LL | check_copy(&inner_non_clone_fn); + | ---------- ^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `impl Future<Output = ()>` | | | required by a bound introduced by this call | note: required by a bound in `check_copy` - --> $DIR/clone-impl-async.rs:70:18 + --> $DIR/clone-impl-async.rs:72:18 | LL | fn check_copy<T: Copy>(_x: &T) {} | ^^^^ required by this bound in `check_copy` -error[E0277]: the trait bound `{async block@$DIR/clone-impl-async.rs:13:27: 13:32}: Clone` is not satisfied - --> $DIR/clone-impl-async.rs:20:17 +error[E0277]: the trait bound `impl Future<Output = ()>: Clone` is not satisfied + --> $DIR/clone-impl-async.rs:43:17 | -LL | check_clone(&inner_non_clone); - | ----------- ^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `{async block@$DIR/clone-impl-async.rs:13:27: 13:32}` +LL | check_clone(&inner_non_clone_fn); + | ----------- ^^^^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `impl Future<Output = ()>` | | | required by a bound introduced by this call | note: required by a bound in `check_clone` - --> $DIR/clone-impl-async.rs:71:19 + --> $DIR/clone-impl-async.rs:73:19 | LL | fn check_clone<T: Clone>(_x: &T) {} | ^^^^^ required by this bound in `check_clone` -error[E0277]: the trait bound `{async block@$DIR/clone-impl-async.rs:24:27: 24:37}: Copy` is not satisfied - --> $DIR/clone-impl-async.rs:27:16 +error[E0277]: the trait bound `impl Future<Output = ()>: Copy` is not satisfied + --> $DIR/clone-impl-async.rs:47:16 | -LL | check_copy(&outer_non_clone); - | ---------- ^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `{async block@$DIR/clone-impl-async.rs:24:27: 24:37}` +LL | check_copy(&outer_non_clone_fn); + | ---------- ^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `impl Future<Output = ()>` | | | required by a bound introduced by this call | note: required by a bound in `check_copy` - --> $DIR/clone-impl-async.rs:70:18 + --> $DIR/clone-impl-async.rs:72:18 | LL | fn check_copy<T: Copy>(_x: &T) {} | ^^^^ required by this bound in `check_copy` -error[E0277]: the trait bound `{async block@$DIR/clone-impl-async.rs:24:27: 24:37}: Clone` is not satisfied - --> $DIR/clone-impl-async.rs:29:17 +error[E0277]: the trait bound `impl Future<Output = ()>: Clone` is not satisfied + --> $DIR/clone-impl-async.rs:49:17 | -LL | check_clone(&outer_non_clone); - | ----------- ^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `{async block@$DIR/clone-impl-async.rs:24:27: 24:37}` +LL | check_clone(&outer_non_clone_fn); + | ----------- ^^^^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `impl Future<Output = ()>` | | | required by a bound introduced by this call | note: required by a bound in `check_clone` - --> $DIR/clone-impl-async.rs:71:19 + --> $DIR/clone-impl-async.rs:73:19 | LL | fn check_clone<T: Clone>(_x: &T) {} | ^^^^^ required by this bound in `check_clone` -error[E0277]: the trait bound `{async block@$DIR/clone-impl-async.rs:32:28: 32:38}: Copy` is not satisfied - --> $DIR/clone-impl-async.rs:33:16 +error[E0277]: the trait bound `impl Future<Output = ()>: Copy` is not satisfied + --> $DIR/clone-impl-async.rs:53:16 | -LL | check_copy(&maybe_copy_clone); - | ---------- ^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `{async block@$DIR/clone-impl-async.rs:32:28: 32:38}` +LL | check_copy(&maybe_copy_clone_fn); + | ---------- ^^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `impl Future<Output = ()>` | | | required by a bound introduced by this call | note: required by a bound in `check_copy` - --> $DIR/clone-impl-async.rs:70:18 + --> $DIR/clone-impl-async.rs:72:18 | LL | fn check_copy<T: Copy>(_x: &T) {} | ^^^^ required by this bound in `check_copy` -error[E0277]: the trait bound `{async block@$DIR/clone-impl-async.rs:32:28: 32:38}: Clone` is not satisfied - --> $DIR/clone-impl-async.rs:35:17 +error[E0277]: the trait bound `impl Future<Output = ()>: Clone` is not satisfied + --> $DIR/clone-impl-async.rs:55:17 | -LL | check_clone(&maybe_copy_clone); - | ----------- ^^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `{async block@$DIR/clone-impl-async.rs:32:28: 32:38}` +LL | check_clone(&maybe_copy_clone_fn); + | ----------- ^^^^^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `impl Future<Output = ()>` | | | required by a bound introduced by this call | note: required by a bound in `check_clone` - --> $DIR/clone-impl-async.rs:71:19 + --> $DIR/clone-impl-async.rs:73:19 | LL | fn check_clone<T: Clone>(_x: &T) {} | ^^^^^ required by this bound in `check_clone` -error[E0277]: the trait bound `impl Future<Output = ()>: Copy` is not satisfied - --> $DIR/clone-impl-async.rs:39:16 +error[E0277]: the trait bound `{async block@$DIR/clone-impl-async.rs:13:27: 13:32}: Copy` is not satisfied + --> $DIR/clone-impl-async.rs:18:5 | -LL | check_copy(&inner_non_clone_fn); - | ---------- ^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `impl Future<Output = ()>` - | | - | required by a bound introduced by this call +LL | check_copy(&inner_non_clone); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `{async block@$DIR/clone-impl-async.rs:13:27: 13:32}` | note: required by a bound in `check_copy` - --> $DIR/clone-impl-async.rs:70:18 + --> $DIR/clone-impl-async.rs:72:18 | LL | fn check_copy<T: Copy>(_x: &T) {} | ^^^^ required by this bound in `check_copy` -error[E0277]: the trait bound `impl Future<Output = ()>: Clone` is not satisfied - --> $DIR/clone-impl-async.rs:41:17 +error[E0277]: the trait bound `{async block@$DIR/clone-impl-async.rs:13:27: 13:32}: Clone` is not satisfied + --> $DIR/clone-impl-async.rs:20:5 | -LL | check_clone(&inner_non_clone_fn); - | ----------- ^^^^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `impl Future<Output = ()>` - | | - | required by a bound introduced by this call +LL | check_clone(&inner_non_clone); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `{async block@$DIR/clone-impl-async.rs:13:27: 13:32}` | note: required by a bound in `check_clone` - --> $DIR/clone-impl-async.rs:71:19 + --> $DIR/clone-impl-async.rs:73:19 | LL | fn check_clone<T: Clone>(_x: &T) {} | ^^^^^ required by this bound in `check_clone` -error[E0277]: the trait bound `impl Future<Output = ()>: Copy` is not satisfied - --> $DIR/clone-impl-async.rs:45:16 +error[E0277]: the trait bound `{async block@$DIR/clone-impl-async.rs:24:27: 24:37}: Copy` is not satisfied + --> $DIR/clone-impl-async.rs:27:5 | -LL | check_copy(&outer_non_clone_fn); - | ---------- ^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `impl Future<Output = ()>` - | | - | required by a bound introduced by this call +LL | check_copy(&outer_non_clone); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `{async block@$DIR/clone-impl-async.rs:24:27: 24:37}` | note: required by a bound in `check_copy` - --> $DIR/clone-impl-async.rs:70:18 + --> $DIR/clone-impl-async.rs:72:18 | LL | fn check_copy<T: Copy>(_x: &T) {} | ^^^^ required by this bound in `check_copy` -error[E0277]: the trait bound `impl Future<Output = ()>: Clone` is not satisfied - --> $DIR/clone-impl-async.rs:47:17 +error[E0277]: the trait bound `{async block@$DIR/clone-impl-async.rs:24:27: 24:37}: Clone` is not satisfied + --> $DIR/clone-impl-async.rs:29:5 | -LL | check_clone(&outer_non_clone_fn); - | ----------- ^^^^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `impl Future<Output = ()>` - | | - | required by a bound introduced by this call +LL | check_clone(&outer_non_clone); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `{async block@$DIR/clone-impl-async.rs:24:27: 24:37}` | note: required by a bound in `check_clone` - --> $DIR/clone-impl-async.rs:71:19 + --> $DIR/clone-impl-async.rs:73:19 | LL | fn check_clone<T: Clone>(_x: &T) {} | ^^^^^ required by this bound in `check_clone` -error[E0277]: the trait bound `impl Future<Output = ()>: Copy` is not satisfied - --> $DIR/clone-impl-async.rs:51:16 +error[E0277]: the trait bound `{async block@$DIR/clone-impl-async.rs:32:28: 32:38}: Copy` is not satisfied + --> $DIR/clone-impl-async.rs:33:5 | -LL | check_copy(&maybe_copy_clone_fn); - | ---------- ^^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `impl Future<Output = ()>` - | | - | required by a bound introduced by this call +LL | check_copy(&maybe_copy_clone); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `{async block@$DIR/clone-impl-async.rs:32:28: 32:38}` | note: required by a bound in `check_copy` - --> $DIR/clone-impl-async.rs:70:18 + --> $DIR/clone-impl-async.rs:72:18 | LL | fn check_copy<T: Copy>(_x: &T) {} | ^^^^ required by this bound in `check_copy` -error[E0277]: the trait bound `impl Future<Output = ()>: Clone` is not satisfied - --> $DIR/clone-impl-async.rs:53:17 +error[E0277]: the trait bound `{async block@$DIR/clone-impl-async.rs:32:28: 32:38}: Clone` is not satisfied + --> $DIR/clone-impl-async.rs:35:5 | -LL | check_clone(&maybe_copy_clone_fn); - | ----------- ^^^^^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `impl Future<Output = ()>` - | | - | required by a bound introduced by this call +LL | check_clone(&maybe_copy_clone); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `{async block@$DIR/clone-impl-async.rs:32:28: 32:38}` | note: required by a bound in `check_clone` - --> $DIR/clone-impl-async.rs:71:19 + --> $DIR/clone-impl-async.rs:73:19 | LL | fn check_clone<T: Clone>(_x: &T) {} | ^^^^^ required by this bound in `check_clone` diff --git a/tests/ui/coroutine/clone-impl-static.stderr b/tests/ui/coroutine/clone-impl-static.stderr index 9fb71fd5fd0..4df6b9759c3 100644 --- a/tests/ui/coroutine/clone-impl-static.stderr +++ b/tests/ui/coroutine/clone-impl-static.stderr @@ -1,10 +1,8 @@ error[E0277]: the trait bound `{static coroutine@$DIR/clone-impl-static.rs:11:5: 11:19}: Copy` is not satisfied - --> $DIR/clone-impl-static.rs:14:16 + --> $DIR/clone-impl-static.rs:14:5 | LL | check_copy(&generator); - | ---------- ^^^^^^^^^^ the trait `Copy` is not implemented for `{static coroutine@$DIR/clone-impl-static.rs:11:5: 11:19}` - | | - | required by a bound introduced by this call + | ^^^^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `{static coroutine@$DIR/clone-impl-static.rs:11:5: 11:19}` | note: required by a bound in `check_copy` --> $DIR/clone-impl-static.rs:20:18 @@ -13,12 +11,10 @@ LL | fn check_copy<T: Copy>(_x: &T) {} | ^^^^ required by this bound in `check_copy` error[E0277]: the trait bound `{static coroutine@$DIR/clone-impl-static.rs:11:5: 11:19}: Clone` is not satisfied - --> $DIR/clone-impl-static.rs:16:17 + --> $DIR/clone-impl-static.rs:16:5 | LL | check_clone(&generator); - | ----------- ^^^^^^^^^^ the trait `Clone` is not implemented for `{static coroutine@$DIR/clone-impl-static.rs:11:5: 11:19}` - | | - | required by a bound introduced by this call + | ^^^^^^^^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `{static coroutine@$DIR/clone-impl-static.rs:11:5: 11:19}` | note: required by a bound in `check_clone` --> $DIR/clone-impl-static.rs:21:19 diff --git a/tests/ui/coroutine/clone-impl.rs b/tests/ui/coroutine/clone-impl.rs index e528f031d52..9e04e256fc1 100644 --- a/tests/ui/coroutine/clone-impl.rs +++ b/tests/ui/coroutine/clone-impl.rs @@ -42,6 +42,7 @@ fn test3_upvars() { let clonable_0: Vec<u32> = Vec::new(); let gen_clone_0 = #[coroutine] move || { + yield; drop(clonable_0); }; check_copy(&gen_clone_0); diff --git a/tests/ui/coroutine/clone-impl.stderr b/tests/ui/coroutine/clone-impl.stderr index 714e5aa3d9e..f316902a42d 100644 --- a/tests/ui/coroutine/clone-impl.stderr +++ b/tests/ui/coroutine/clone-impl.stderr @@ -1,59 +1,81 @@ error[E0277]: the trait bound `Vec<u32>: Copy` is not satisfied in `{coroutine@$DIR/clone-impl.rs:44:5: 44:12}` - --> $DIR/clone-impl.rs:47:16 + --> $DIR/clone-impl.rs:48:5 | LL | move || { | ------- within this `{coroutine@$DIR/clone-impl.rs:44:5: 44:12}` ... LL | check_copy(&gen_clone_0); - | ^^^^^^^^^^^^ within `{coroutine@$DIR/clone-impl.rs:44:5: 44:12}`, the trait `Copy` is not implemented for `Vec<u32>` + | ^^^^^^^^^^^^^^^^^^^^^^^^ within `{coroutine@$DIR/clone-impl.rs:44:5: 44:12}`, the trait `Copy` is not implemented for `Vec<u32>` | note: captured value does not implement `Copy` - --> $DIR/clone-impl.rs:45:14 + --> $DIR/clone-impl.rs:46:14 | LL | drop(clonable_0); | ^^^^^^^^^^ has type `Vec<u32>` which does not implement `Copy` note: required by a bound in `check_copy` - --> $DIR/clone-impl.rs:91:18 + --> $DIR/clone-impl.rs:92:18 | LL | fn check_copy<T: Copy>(_x: &T) {} | ^^^^ required by this bound in `check_copy` -error[E0277]: the trait bound `Vec<u32>: Copy` is not satisfied in `{coroutine@$DIR/clone-impl.rs:67:5: 67:12}` - --> $DIR/clone-impl.rs:73:16 +error[E0277]: the trait bound `Vec<char>: Copy` is not satisfied in `{coroutine@$DIR/clone-impl.rs:55:5: 55:12}` + --> $DIR/clone-impl.rs:60:5 | LL | move || { - | ------- within this `{coroutine@$DIR/clone-impl.rs:67:5: 67:12}` + | ------- within this `{coroutine@$DIR/clone-impl.rs:55:5: 55:12}` ... LL | check_copy(&gen_clone_1); - | ^^^^^^^^^^^^ within `{coroutine@$DIR/clone-impl.rs:67:5: 67:12}`, the trait `Copy` is not implemented for `Vec<u32>` + | ^^^^^^^^^^^^^^^^^^^^^^^^ within `{coroutine@$DIR/clone-impl.rs:55:5: 55:12}`, the trait `Copy` is not implemented for `Vec<char>` + | +note: coroutine does not implement `Copy` as this value is used across a yield + --> $DIR/clone-impl.rs:57:9 + | +LL | let v = vec!['a']; + | - has type `Vec<char>` which does not implement `Copy` +LL | yield; + | ^^^^^ yield occurs here, with `v` maybe used later +note: required by a bound in `check_copy` + --> $DIR/clone-impl.rs:92:18 + | +LL | fn check_copy<T: Copy>(_x: &T) {} + | ^^^^ required by this bound in `check_copy` + +error[E0277]: the trait bound `Vec<u32>: Copy` is not satisfied in `{coroutine@$DIR/clone-impl.rs:68:5: 68:12}` + --> $DIR/clone-impl.rs:74:5 + | +LL | move || { + | ------- within this `{coroutine@$DIR/clone-impl.rs:68:5: 68:12}` +... +LL | check_copy(&gen_clone_1); + | ^^^^^^^^^^^^^^^^^^^^^^^^ within `{coroutine@$DIR/clone-impl.rs:68:5: 68:12}`, the trait `Copy` is not implemented for `Vec<u32>` | note: captured value does not implement `Copy` - --> $DIR/clone-impl.rs:71:14 + --> $DIR/clone-impl.rs:72:14 | LL | drop(clonable_1); | ^^^^^^^^^^ has type `Vec<u32>` which does not implement `Copy` note: required by a bound in `check_copy` - --> $DIR/clone-impl.rs:91:18 + --> $DIR/clone-impl.rs:92:18 | LL | fn check_copy<T: Copy>(_x: &T) {} | ^^^^ required by this bound in `check_copy` -error[E0277]: the trait bound `NonClone: Copy` is not satisfied in `{coroutine@$DIR/clone-impl.rs:81:5: 81:12}` - --> $DIR/clone-impl.rs:85:16 +error[E0277]: the trait bound `NonClone: Copy` is not satisfied in `{coroutine@$DIR/clone-impl.rs:82:5: 82:12}` + --> $DIR/clone-impl.rs:86:5 | LL | move || { - | ------- within this `{coroutine@$DIR/clone-impl.rs:81:5: 81:12}` + | ------- within this `{coroutine@$DIR/clone-impl.rs:82:5: 82:12}` ... LL | check_copy(&gen_non_clone); - | ^^^^^^^^^^^^^^ within `{coroutine@$DIR/clone-impl.rs:81:5: 81:12}`, the trait `Copy` is not implemented for `NonClone` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ within `{coroutine@$DIR/clone-impl.rs:82:5: 82:12}`, the trait `Copy` is not implemented for `NonClone` | note: captured value does not implement `Copy` - --> $DIR/clone-impl.rs:83:14 + --> $DIR/clone-impl.rs:84:14 | LL | drop(non_clonable); | ^^^^^^^^^^^^ has type `NonClone` which does not implement `Copy` note: required by a bound in `check_copy` - --> $DIR/clone-impl.rs:91:18 + --> $DIR/clone-impl.rs:92:18 | LL | fn check_copy<T: Copy>(_x: &T) {} | ^^^^ required by this bound in `check_copy` @@ -63,22 +85,22 @@ LL + #[derive(Copy)] LL | struct NonClone; | -error[E0277]: the trait bound `NonClone: Clone` is not satisfied in `{coroutine@$DIR/clone-impl.rs:81:5: 81:12}` - --> $DIR/clone-impl.rs:87:17 +error[E0277]: the trait bound `NonClone: Clone` is not satisfied in `{coroutine@$DIR/clone-impl.rs:82:5: 82:12}` + --> $DIR/clone-impl.rs:88:5 | LL | move || { - | ------- within this `{coroutine@$DIR/clone-impl.rs:81:5: 81:12}` + | ------- within this `{coroutine@$DIR/clone-impl.rs:82:5: 82:12}` ... LL | check_clone(&gen_non_clone); - | ^^^^^^^^^^^^^^ within `{coroutine@$DIR/clone-impl.rs:81:5: 81:12}`, the trait `Clone` is not implemented for `NonClone` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ within `{coroutine@$DIR/clone-impl.rs:82:5: 82:12}`, the trait `Clone` is not implemented for `NonClone` | note: captured value does not implement `Clone` - --> $DIR/clone-impl.rs:83:14 + --> $DIR/clone-impl.rs:84:14 | LL | drop(non_clonable); | ^^^^^^^^^^^^ has type `NonClone` which does not implement `Clone` note: required by a bound in `check_clone` - --> $DIR/clone-impl.rs:92:19 + --> $DIR/clone-impl.rs:93:19 | LL | fn check_clone<T: Clone>(_x: &T) {} | ^^^^^ required by this bound in `check_clone` @@ -88,28 +110,6 @@ LL + #[derive(Clone)] LL | struct NonClone; | -error[E0277]: the trait bound `Vec<char>: Copy` is not satisfied in `{coroutine@$DIR/clone-impl.rs:54:5: 54:12}` - --> $DIR/clone-impl.rs:59:5 - | -LL | move || { - | ------- within this `{coroutine@$DIR/clone-impl.rs:54:5: 54:12}` -... -LL | check_copy(&gen_clone_1); - | ^^^^^^^^^^^^^^^^^^^^^^^^ within `{coroutine@$DIR/clone-impl.rs:54:5: 54:12}`, the trait `Copy` is not implemented for `Vec<char>` - | -note: coroutine does not implement `Copy` as this value is used across a yield - --> $DIR/clone-impl.rs:56:9 - | -LL | let v = vec!['a']; - | - has type `Vec<char>` which does not implement `Copy` -LL | yield; - | ^^^^^ yield occurs here, with `v` maybe used later -note: required by a bound in `check_copy` - --> $DIR/clone-impl.rs:91:18 - | -LL | fn check_copy<T: Copy>(_x: &T) {} - | ^^^^ required by this bound in `check_copy` - error: aborting due to 5 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/coroutine/print/coroutine-print-verbose-2.stderr b/tests/ui/coroutine/print/coroutine-print-verbose-2.stderr index 8877d45ddda..11b78e3bcf8 100644 --- a/tests/ui/coroutine/print/coroutine-print-verbose-2.stderr +++ b/tests/ui/coroutine/print/coroutine-print-verbose-2.stderr @@ -9,7 +9,7 @@ LL | | drop(a); LL | | }); | |______^ coroutine is not `Sync` | - = help: within `{main::{closure#0} upvar_tys=() resume_ty=() yield_ty=() return_ty=() witness={main::{closure#0}}}`, the trait `Sync` is not implemented for `NotSync` + = help: within `{main::{closure#0} upvar_tys=() resume_ty=() yield_ty=() return_ty=()}`, the trait `Sync` is not implemented for `NotSync` note: coroutine is not `Sync` as this value is used across a yield --> $DIR/coroutine-print-verbose-2.rs:20:9 | @@ -34,7 +34,7 @@ LL | | drop(a); LL | | }); | |______^ coroutine is not `Send` | - = help: within `{main::{closure#1} upvar_tys=() resume_ty=() yield_ty=() return_ty=() witness={main::{closure#1}}}`, the trait `Send` is not implemented for `NotSend` + = help: within `{main::{closure#1} upvar_tys=() resume_ty=() yield_ty=() return_ty=()}`, the trait `Send` is not implemented for `NotSend` note: coroutine is not `Send` as this value is used across a yield --> $DIR/coroutine-print-verbose-2.rs:27:9 | diff --git a/tests/ui/coroutine/print/coroutine-print-verbose-3.stderr b/tests/ui/coroutine/print/coroutine-print-verbose-3.stderr index 4a1e5b078a8..135e8175793 100644 --- a/tests/ui/coroutine/print/coroutine-print-verbose-3.stderr +++ b/tests/ui/coroutine/print/coroutine-print-verbose-3.stderr @@ -11,7 +11,7 @@ LL | | }; | |_____^ expected `()`, found coroutine | = note: expected unit type `()` - found coroutine `{main::{closure#0} upvar_tys=?4t resume_ty=() yield_ty=i32 return_ty=&'?1 str witness={main::{closure#0}}}` + found coroutine `{main::{closure#0} upvar_tys=?4t resume_ty=() yield_ty=i32 return_ty=&'?1 str}` error: aborting due to 1 previous error diff --git a/tests/ui/coroutine/ref-upvar-not-send.stderr b/tests/ui/coroutine/ref-upvar-not-send.stderr index 892b5d261c2..3a5e8ec4dab 100644 --- a/tests/ui/coroutine/ref-upvar-not-send.stderr +++ b/tests/ui/coroutine/ref-upvar-not-send.stderr @@ -1,14 +1,13 @@ error: coroutine cannot be sent between threads safely - --> $DIR/ref-upvar-not-send.rs:15:30 + --> $DIR/ref-upvar-not-send.rs:15:5 | -LL | assert_send(#[coroutine] move || { - | ______________________________^ +LL | / assert_send(#[coroutine] move || { LL | | LL | | LL | | yield; LL | | let _x = x; LL | | }); - | |_____^ coroutine is not `Send` + | |______^ coroutine is not `Send` | = help: the trait `Sync` is not implemented for `*mut ()` note: captured value is not `Send` because `&` references cannot be sent unless their referent is `Sync` @@ -23,16 +22,15 @@ LL | fn assert_send<T: Send>(_: T) {} | ^^^^ required by this bound in `assert_send` error: coroutine cannot be sent between threads safely - --> $DIR/ref-upvar-not-send.rs:23:30 + --> $DIR/ref-upvar-not-send.rs:23:5 | -LL | assert_send(#[coroutine] move || { - | ______________________________^ +LL | / assert_send(#[coroutine] move || { LL | | LL | | LL | | yield; LL | | let _y = y; LL | | }); - | |_____^ coroutine is not `Send` + | |______^ coroutine is not `Send` | = help: within `{coroutine@$DIR/ref-upvar-not-send.rs:23:30: 23:37}`, the trait `Send` is not implemented for `*mut ()` note: captured value is not `Send` because `&mut` references cannot be sent unless their referent is `Send` diff --git a/tests/ui/issues/auxiliary/issue-5521.rs b/tests/ui/cross-crate/auxiliary/aux-5521.rs index c2f81779b35..c2f81779b35 100644 --- a/tests/ui/issues/auxiliary/issue-5521.rs +++ b/tests/ui/cross-crate/auxiliary/aux-5521.rs diff --git a/tests/ui/issues/issue-5521.rs b/tests/ui/cross-crate/cross-crate-map-usage-5521.rs index 45896ae8128..ffce846be2c 100644 --- a/tests/ui/issues/issue-5521.rs +++ b/tests/ui/cross-crate/cross-crate-map-usage-5521.rs @@ -1,10 +1,9 @@ +// https://github.com/rust-lang/rust/issues/5521 //@ run-pass #![allow(dead_code)] -//@ aux-build:issue-5521.rs +//@ aux-build:aux-5521.rs - - -extern crate issue_5521 as foo; +extern crate aux_5521 as foo; fn bar(a: foo::map) { if false { diff --git a/tests/ui/issues/issue-46332.rs b/tests/ui/did_you_mean/typo-suggestion-improvement-46332.rs index bed74e3138a..3dd686a66b0 100644 --- a/tests/ui/issues/issue-46332.rs +++ b/tests/ui/did_you_mean/typo-suggestion-improvement-46332.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/46332 // Original Levenshtein distance for both of this is 1. We improved accuracy with // additional case insensitive comparison. diff --git a/tests/ui/issues/issue-46332.stderr b/tests/ui/did_you_mean/typo-suggestion-improvement-46332.stderr index 8c0c1dfa6ee..502f8151878 100644 --- a/tests/ui/issues/issue-46332.stderr +++ b/tests/ui/did_you_mean/typo-suggestion-improvement-46332.stderr @@ -1,5 +1,5 @@ error[E0422]: cannot find struct, variant or union type `TyUInt` in this scope - --> $DIR/issue-46332.rs:9:5 + --> $DIR/typo-suggestion-improvement-46332.rs:10:5 | LL | struct TyUint {} | ------------- similarly named struct `TyUint` defined here diff --git a/tests/ui/drop/box-conditional-drop-allocator.rs b/tests/ui/drop/box-conditional-drop-allocator.rs new file mode 100644 index 00000000000..8f78da16473 --- /dev/null +++ b/tests/ui/drop/box-conditional-drop-allocator.rs @@ -0,0 +1,43 @@ +//@ run-pass +#![feature(allocator_api)] + +// Regression test for #131082. +// Testing that the allocator of a Box is dropped in conditional drops + +use std::alloc::{AllocError, Allocator, Global, Layout}; +use std::cell::Cell; +use std::ptr::NonNull; + +struct DropCheckingAllocator<'a>(&'a Cell<bool>); + +unsafe impl Allocator for DropCheckingAllocator<'_> { + fn allocate(&self, layout: Layout) -> Result<NonNull<[u8]>, AllocError> { + Global.allocate(layout) + } + unsafe fn deallocate(&self, ptr: NonNull<u8>, layout: Layout) { + Global.deallocate(ptr, layout); + } +} +impl Drop for DropCheckingAllocator<'_> { + fn drop(&mut self) { + self.0.set(true); + } +} + +struct HasDrop; +impl Drop for HasDrop { + fn drop(&mut self) {} +} + +fn main() { + let dropped = Cell::new(false); + { + let b = Box::new_in(HasDrop, DropCheckingAllocator(&dropped)); + if true { + drop(*b); + } else { + drop(b); + } + } + assert!(dropped.get()); +} diff --git a/tests/ui/issues/issue-4734.rs b/tests/ui/drop/destructor-run-for-expression-4734.rs index 58aa0179693..57971ee5ef7 100644 --- a/tests/ui/issues/issue-4734.rs +++ b/tests/ui/drop/destructor-run-for-expression-4734.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/4734 //@ run-pass #![allow(dead_code)] // Ensures that destructors are run for expressions of the form "e;" where diff --git a/tests/ui/issues/issue-6892.rs b/tests/ui/drop/destructor-run-for-let-ignore-6892.rs index 7d99aef4ac5..0fcf133c2b1 100644 --- a/tests/ui/issues/issue-6892.rs +++ b/tests/ui/drop/destructor-run-for-let-ignore-6892.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/6892 //@ run-pass #![allow(dead_code)] // Ensures that destructors are run for expressions of the form "let _ = e;" diff --git a/tests/ui/issues/issue-16151.rs b/tests/ui/drop/drop-count-assertion-16151.rs index b18108e0a8a..ede6bc23e73 100644 --- a/tests/ui/issues/issue-16151.rs +++ b/tests/ui/drop/drop-count-assertion-16151.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/16151 //@ run-pass // FIXME(static_mut_refs): Do not allow `static_mut_refs` lint diff --git a/tests/ui/issues/issue-20939.rs b/tests/ui/dyn-compatibility/dyn-compatible-trait-implementation-20939.rs index c0c22297897..c7938b275e9 100644 --- a/tests/ui/issues/issue-20939.rs +++ b/tests/ui/dyn-compatibility/dyn-compatible-trait-implementation-20939.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/20939 trait Foo {} impl<'a> Foo for dyn Foo + 'a {} diff --git a/tests/ui/issues/issue-20939.stderr b/tests/ui/dyn-compatibility/dyn-compatible-trait-implementation-20939.stderr index 00357155c8a..196d8b6a880 100644 --- a/tests/ui/issues/issue-20939.stderr +++ b/tests/ui/dyn-compatibility/dyn-compatible-trait-implementation-20939.stderr @@ -1,5 +1,5 @@ error[E0371]: the object type `(dyn Foo + 'a)` automatically implements the trait `Foo` - --> $DIR/issue-20939.rs:3:1 + --> $DIR/dyn-compatible-trait-implementation-20939.rs:4:1 | LL | impl<'a> Foo for dyn Foo + 'a {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `(dyn Foo + 'a)` automatically implements trait `Foo` diff --git a/tests/ui/error-codes/E0423.stderr b/tests/ui/error-codes/E0423.stderr index e50b8bd820c..b699e53fb48 100644 --- a/tests/ui/error-codes/E0423.stderr +++ b/tests/ui/error-codes/E0423.stderr @@ -54,7 +54,7 @@ help: use struct literal syntax instead LL - let f = Foo(); LL + let f = Foo { a: val }; | -help: a function with a similar name exists (notice the capitalization difference) +help: a function with a similar name exists (notice the capitalization) | LL - let f = Foo(); LL + let f = foo(); diff --git a/tests/ui/error-emitter/auxiliary/close_window.rs b/tests/ui/error-emitter/auxiliary/close_window.rs new file mode 100644 index 00000000000..e41313b6ab3 --- /dev/null +++ b/tests/ui/error-emitter/auxiliary/close_window.rs @@ -0,0 +1,4 @@ +pub struct S; +impl S { + fn method(&self) {} +} diff --git a/tests/ui/error-emitter/close_window.ascii.stderr b/tests/ui/error-emitter/close_window.ascii.stderr new file mode 100644 index 00000000000..e208b709393 --- /dev/null +++ b/tests/ui/error-emitter/close_window.ascii.stderr @@ -0,0 +1,14 @@ +error[E0624]: method `method` is private + --> $DIR/close_window.rs:9:7 + | +LL | s.method(); + | ^^^^^^ private method + | + ::: $DIR/auxiliary/close_window.rs:3:5 + | +LL | fn method(&self) {} + | ---------------- private method defined here + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0624`. diff --git a/tests/ui/error-emitter/close_window.rs b/tests/ui/error-emitter/close_window.rs new file mode 100644 index 00000000000..879507c287a --- /dev/null +++ b/tests/ui/error-emitter/close_window.rs @@ -0,0 +1,11 @@ +//@ aux-build:close_window.rs +//@ revisions: ascii unicode +//@[unicode] compile-flags: -Zunstable-options --error-format=human-unicode + +extern crate close_window; + +fn main() { + let s = close_window::S; + s.method(); + //[ascii]~^ ERROR method `method` is private +} diff --git a/tests/ui/error-emitter/close_window.unicode.stderr b/tests/ui/error-emitter/close_window.unicode.stderr new file mode 100644 index 00000000000..b4aa78a5ac9 --- /dev/null +++ b/tests/ui/error-emitter/close_window.unicode.stderr @@ -0,0 +1,14 @@ +error[E0624]: method `method` is private + ╭▸ $DIR/close_window.rs:9:7 + │ +LL │ s.method(); + │ ━━━━━━ private method + │ + ⸬ $DIR/auxiliary/close_window.rs:3:5 + │ +LL │ fn method(&self) {} + ╰╴ ──────────────── private method defined here + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0624`. diff --git a/tests/ui/explicit-tail-calls/callee_is_ref.fixed b/tests/ui/explicit-tail-calls/callee_is_ref.fixed new file mode 100644 index 00000000000..7525e5c5df8 --- /dev/null +++ b/tests/ui/explicit-tail-calls/callee_is_ref.fixed @@ -0,0 +1,26 @@ +//@ run-rustfix +#![feature(explicit_tail_calls)] +#![expect(incomplete_features)] + +fn f() {} + +fn g() { + become (*(&f))() //~ error: tail calls can only be performed with function definitions or pointers +} + +fn h() { + let table = [f as fn()]; + if let Some(fun) = table.get(0) { + become (*fun)(); //~ error: tail calls can only be performed with function definitions or pointers + } +} + +fn i() { + become (***Box::new(&mut &f))(); //~ error: tail calls can only be performed with function definitions or pointers +} + +fn main() { + g(); + h(); + i(); +} diff --git a/tests/ui/explicit-tail-calls/callee_is_ref.rs b/tests/ui/explicit-tail-calls/callee_is_ref.rs new file mode 100644 index 00000000000..36bf9efb952 --- /dev/null +++ b/tests/ui/explicit-tail-calls/callee_is_ref.rs @@ -0,0 +1,26 @@ +//@ run-rustfix +#![feature(explicit_tail_calls)] +#![expect(incomplete_features)] + +fn f() {} + +fn g() { + become (&f)() //~ error: tail calls can only be performed with function definitions or pointers +} + +fn h() { + let table = [f as fn()]; + if let Some(fun) = table.get(0) { + become fun(); //~ error: tail calls can only be performed with function definitions or pointers + } +} + +fn i() { + become Box::new(&mut &f)(); //~ error: tail calls can only be performed with function definitions or pointers +} + +fn main() { + g(); + h(); + i(); +} diff --git a/tests/ui/explicit-tail-calls/callee_is_ref.stderr b/tests/ui/explicit-tail-calls/callee_is_ref.stderr new file mode 100644 index 00000000000..4a2ff465e68 --- /dev/null +++ b/tests/ui/explicit-tail-calls/callee_is_ref.stderr @@ -0,0 +1,38 @@ +error: tail calls can only be performed with function definitions or pointers + --> $DIR/callee_is_ref.rs:8:12 + | +LL | become (&f)() + | ^^^^^^ + | + = note: callee has type `&fn() {f}` +help: consider dereferencing the expression to get a function definition + | +LL | become (*(&f))() + | ++ + + +error: tail calls can only be performed with function definitions or pointers + --> $DIR/callee_is_ref.rs:14:16 + | +LL | become fun(); + | ^^^^^ + | + = note: callee has type `&fn()` +help: consider dereferencing the expression to get a function pointer + | +LL | become (*fun)(); + | ++ + + +error: tail calls can only be performed with function definitions or pointers + --> $DIR/callee_is_ref.rs:19:12 + | +LL | become Box::new(&mut &f)(); + | ^^^^^^^^^^^^^^^^^^^ + | + = note: callee has type `Box<&mut &fn() {f}>` +help: consider dereferencing the expression to get a function definition + | +LL | become (***Box::new(&mut &f))(); + | ++++ + + +error: aborting due to 3 previous errors + diff --git a/tests/ui/explicit-tail-calls/callee_is_weird.rs b/tests/ui/explicit-tail-calls/callee_is_weird.rs new file mode 100644 index 00000000000..b3ca878c232 --- /dev/null +++ b/tests/ui/explicit-tail-calls/callee_is_weird.rs @@ -0,0 +1,29 @@ +#![feature(explicit_tail_calls, exclusive_wrapper, fn_traits, unboxed_closures)] +#![expect(incomplete_features)] + +fn f() {} + +fn g() { + become std::sync::Exclusive::new(f)() //~ error: tail calls can only be performed with function definitions or pointers +} + +fn h() { + become (&mut &std::sync::Exclusive::new(f))() //~ error: tail calls can only be performed with function definitions or pointers +} + +fn i() { + struct J; + + impl FnOnce<()> for J { + type Output = (); + extern "rust-call" fn call_once(self, (): ()) -> Self::Output {} + } + + become J(); //~ error: tail calls can only be performed with function definitions or pointers +} + +fn main() { + g(); + h(); + i(); +} diff --git a/tests/ui/explicit-tail-calls/callee_is_weird.stderr b/tests/ui/explicit-tail-calls/callee_is_weird.stderr new file mode 100644 index 00000000000..a4e5a38ce33 --- /dev/null +++ b/tests/ui/explicit-tail-calls/callee_is_weird.stderr @@ -0,0 +1,26 @@ +error: tail calls can only be performed with function definitions or pointers + --> $DIR/callee_is_weird.rs:7:12 + | +LL | become std::sync::Exclusive::new(f)() + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: callee has type `Exclusive<fn() {f}>` + +error: tail calls can only be performed with function definitions or pointers + --> $DIR/callee_is_weird.rs:11:12 + | +LL | become (&mut &std::sync::Exclusive::new(f))() + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: callee has type `Exclusive<fn() {f}>` + +error: tail calls can only be performed with function definitions or pointers + --> $DIR/callee_is_weird.rs:22:12 + | +LL | become J(); + | ^^^ + | + = note: callee has type `J` + +error: aborting due to 3 previous errors + diff --git a/tests/ui/explicit-tail-calls/higher-ranked-arg.rs b/tests/ui/explicit-tail-calls/higher-ranked-arg.rs new file mode 100644 index 00000000000..e60686ab511 --- /dev/null +++ b/tests/ui/explicit-tail-calls/higher-ranked-arg.rs @@ -0,0 +1,13 @@ +// Regression test for <https://github.com/rust-lang/rust/issues/144826>. +//@ check-pass + +#![feature(explicit_tail_calls)] +#![expect(incomplete_features)] + +fn foo(x: fn(&i32)) { + become bar(x); +} + +fn bar(_: fn(&i32)) {} + +fn main() {} diff --git a/tests/ui/explicit-tail-calls/infinite-recursion-in-ctfe.rs b/tests/ui/explicit-tail-calls/infinite-recursion-in-ctfe.rs new file mode 100644 index 00000000000..0c55f13c16c --- /dev/null +++ b/tests/ui/explicit-tail-calls/infinite-recursion-in-ctfe.rs @@ -0,0 +1,10 @@ +#![feature(explicit_tail_calls)] +#![expect(incomplete_features)] + +const _: () = f(); + +const fn f() { + become f(); //~ error: constant evaluation is taking a long time +} + +fn main() {} diff --git a/tests/ui/explicit-tail-calls/infinite-recursion-in-ctfe.stderr b/tests/ui/explicit-tail-calls/infinite-recursion-in-ctfe.stderr new file mode 100644 index 00000000000..b5a96114a58 --- /dev/null +++ b/tests/ui/explicit-tail-calls/infinite-recursion-in-ctfe.stderr @@ -0,0 +1,17 @@ +error: constant evaluation is taking a long time + --> $DIR/infinite-recursion-in-ctfe.rs:7:5 + | +LL | become f(); + | ^^^^^^^^^^ + | + = note: this lint makes sure the compiler doesn't get stuck due to infinite loops in const eval. + If your compilation actually takes a long time, you can safely allow the lint. +help: the constant being evaluated + --> $DIR/infinite-recursion-in-ctfe.rs:4:1 + | +LL | const _: () = f(); + | ^^^^^^^^^^^ + = note: `#[deny(long_running_const_eval)]` on by default + +error: aborting due to 1 previous error + diff --git a/tests/ui/explicit-tail-calls/intrinsics.rs b/tests/ui/explicit-tail-calls/intrinsics.rs new file mode 100644 index 00000000000..6fc521fa27d --- /dev/null +++ b/tests/ui/explicit-tail-calls/intrinsics.rs @@ -0,0 +1,13 @@ +#![feature(explicit_tail_calls, core_intrinsics)] +#![expect(incomplete_features, internal_features)] + +fn trans((): ()) { + unsafe { become std::mem::transmute(()) } //~ error: tail calling intrinsics is not allowed + +} + +fn cats(x: u64) -> u32 { + become std::intrinsics::ctlz(x) //~ error: tail calling intrinsics is not allowed +} + +fn main() {} diff --git a/tests/ui/explicit-tail-calls/intrinsics.stderr b/tests/ui/explicit-tail-calls/intrinsics.stderr new file mode 100644 index 00000000000..b012e3629dd --- /dev/null +++ b/tests/ui/explicit-tail-calls/intrinsics.stderr @@ -0,0 +1,14 @@ +error: tail calling intrinsics is not allowed + --> $DIR/intrinsics.rs:5:14 + | +LL | unsafe { become std::mem::transmute(()) } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: tail calling intrinsics is not allowed + --> $DIR/intrinsics.rs:10:5 + | +LL | become std::intrinsics::ctlz(x) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 2 previous errors + diff --git a/tests/ui/explicit-tail-calls/recursion-etc.rs b/tests/ui/explicit-tail-calls/recursion-etc.rs new file mode 100644 index 00000000000..8c89ceb7869 --- /dev/null +++ b/tests/ui/explicit-tail-calls/recursion-etc.rs @@ -0,0 +1,17 @@ +//@ run-pass +#![expect(incomplete_features)] +#![feature(explicit_tail_calls)] + +use std::hint::black_box; + +pub fn count(curr: u64, top: u64) -> u64 { + if black_box(curr) >= top { + curr + } else { + become count(curr + 1, top) + } +} + +fn main() { + println!("{}", count(0, black_box(1000000))); +} diff --git a/tests/ui/explicit-tail-calls/ret-ty-borrowck-constraints.rs b/tests/ui/explicit-tail-calls/ret-ty-borrowck-constraints.rs new file mode 100644 index 00000000000..111ae849c0f --- /dev/null +++ b/tests/ui/explicit-tail-calls/ret-ty-borrowck-constraints.rs @@ -0,0 +1,16 @@ +#![feature(explicit_tail_calls)] +#![expect(incomplete_features)] + +fn link(x: &str) -> &'static str { + become passthrough(x); + //~^ ERROR lifetime may not live long enough +} + +fn passthrough<T>(t: T) -> T { t } + +fn main() { + let x = String::from("hello, world"); + let s = link(&x); + drop(x); + println!("{s}"); +} diff --git a/tests/ui/explicit-tail-calls/ret-ty-borrowck-constraints.stderr b/tests/ui/explicit-tail-calls/ret-ty-borrowck-constraints.stderr new file mode 100644 index 00000000000..26a8e1f0122 --- /dev/null +++ b/tests/ui/explicit-tail-calls/ret-ty-borrowck-constraints.stderr @@ -0,0 +1,10 @@ +error: lifetime may not live long enough + --> $DIR/ret-ty-borrowck-constraints.rs:5:5 + | +LL | fn link(x: &str) -> &'static str { + | - let's call the lifetime of this reference `'1` +LL | become passthrough(x); + | ^^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'1` must outlive `'static` + +error: aborting due to 1 previous error + diff --git a/tests/ui/extern/extern-types-field-offset.run.stderr b/tests/ui/extern/extern-types-field-offset.run.stderr index 07bd4fcb13f..b096e8044a7 100644 --- a/tests/ui/extern/extern-types-field-offset.run.stderr +++ b/tests/ui/extern/extern-types-field-offset.run.stderr @@ -1,5 +1,5 @@ -thread 'main' panicked at library/core/src/panicking.rs:$LINE:$COL: +thread 'main' ($TID) panicked at library/core/src/panicking.rs:$LINE:$COL: attempted to compute the size or alignment of extern type `Opaque` note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace thread caused non-unwinding panic. aborting. diff --git a/tests/ui/extern/extern-types-size_of_val.align.run.stderr b/tests/ui/extern/extern-types-size_of_val.align.run.stderr index 5ba372d60fa..66206f37501 100644 --- a/tests/ui/extern/extern-types-size_of_val.align.run.stderr +++ b/tests/ui/extern/extern-types-size_of_val.align.run.stderr @@ -1,5 +1,5 @@ -thread 'main' panicked at library/core/src/panicking.rs:$LINE:$COL: +thread 'main' ($TID) panicked at library/core/src/panicking.rs:$LINE:$COL: attempted to compute the size or alignment of extern type `A` note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace thread caused non-unwinding panic. aborting. diff --git a/tests/ui/extern/extern-types-size_of_val.size.run.stderr b/tests/ui/extern/extern-types-size_of_val.size.run.stderr index 5ba372d60fa..66206f37501 100644 --- a/tests/ui/extern/extern-types-size_of_val.size.run.stderr +++ b/tests/ui/extern/extern-types-size_of_val.size.run.stderr @@ -1,5 +1,5 @@ -thread 'main' panicked at library/core/src/panicking.rs:$LINE:$COL: +thread 'main' ($TID) panicked at library/core/src/panicking.rs:$LINE:$COL: attempted to compute the size or alignment of extern type `A` note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace thread caused non-unwinding panic. aborting. diff --git a/tests/ui/extern/windows-tcb-trash-13259.rs b/tests/ui/extern/windows-tcb-trash-13259.rs new file mode 100644 index 00000000000..0852e31251a --- /dev/null +++ b/tests/ui/extern/windows-tcb-trash-13259.rs @@ -0,0 +1,49 @@ +//! Regression test for https://github.com/rust-lang/rust/issues/13259 + +//@ run-pass + +#[cfg(windows)] +mod imp { + type LPVOID = *mut u8; + type DWORD = u32; + type LPWSTR = *mut u16; + + extern "system" { + fn FormatMessageW( + flags: DWORD, + lpSrc: LPVOID, + msgId: DWORD, + langId: DWORD, + buf: LPWSTR, + nsize: DWORD, + args: *const u8, + ) -> DWORD; + } + + pub fn test() { + let mut buf: [u16; 50] = [0; 50]; + let ret = unsafe { + FormatMessageW( + 0x1000, + core::ptr::null_mut(), + 1, + 0x400, + buf.as_mut_ptr(), + buf.len() as u32, + core::ptr::null(), + ) + }; + // On some 32-bit Windowses (Win7-8 at least) this will panic with segmented + // stacks taking control of pvArbitrary + assert!(ret != 0); + } +} + +#[cfg(not(windows))] +mod imp { + pub fn test() {} +} + +fn main() { + imp::test() +} diff --git a/tests/ui/feature-gates/feature-gate-omit-gdb-pretty-printer-section.rs b/tests/ui/feature-gates/feature-gate-omit-gdb-pretty-printer-section.rs deleted file mode 100644 index 66bf7973832..00000000000 --- a/tests/ui/feature-gates/feature-gate-omit-gdb-pretty-printer-section.rs +++ /dev/null @@ -1,2 +0,0 @@ -#[omit_gdb_pretty_printer_section] //~ ERROR the `#[omit_gdb_pretty_printer_section]` attribute is -fn main() {} diff --git a/tests/ui/feature-gates/feature-gate-omit-gdb-pretty-printer-section.stderr b/tests/ui/feature-gates/feature-gate-omit-gdb-pretty-printer-section.stderr deleted file mode 100644 index 2e1d27fb776..00000000000 --- a/tests/ui/feature-gates/feature-gate-omit-gdb-pretty-printer-section.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0658]: the `#[omit_gdb_pretty_printer_section]` attribute is just used for the Rust test suite - --> $DIR/feature-gate-omit-gdb-pretty-printer-section.rs:1:1 - | -LL | #[omit_gdb_pretty_printer_section] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = help: add `#![feature(omit_gdb_pretty_printer_section)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/issues/issue-13105.rs b/tests/ui/fn/anonymous-parameters-trait-13105.rs index d119aa9c788..171dab15fe7 100644 --- a/tests/ui/issues/issue-13105.rs +++ b/tests/ui/fn/anonymous-parameters-trait-13105.rs @@ -1,3 +1,5 @@ +//! Regression test for https://github.com/rust-lang/rust/issues/13105 + //@ edition: 2015 //@ check-pass diff --git a/tests/ui/generic-associated-types/type-param-defaults.rs b/tests/ui/generic-associated-types/type-param-defaults.rs index eea54c46073..6e9a62b96c4 100644 --- a/tests/ui/generic-associated-types/type-param-defaults.rs +++ b/tests/ui/generic-associated-types/type-param-defaults.rs @@ -4,17 +4,17 @@ trait Trait { type Assoc<T = u32>; - //~^ ERROR defaults for type parameters are only allowed + //~^ ERROR defaults for generic parameters are not allowed here } impl Trait for () { type Assoc<T = u32> = u64; - //~^ ERROR defaults for type parameters are only allowed + //~^ ERROR defaults for generic parameters are not allowed here } impl Trait for u32 { type Assoc<T = u32> = T; - //~^ ERROR defaults for type parameters are only allowed + //~^ ERROR defaults for generic parameters are not allowed here } trait Other {} diff --git a/tests/ui/generic-associated-types/type-param-defaults.stderr b/tests/ui/generic-associated-types/type-param-defaults.stderr index 3c094d45fff..d9872dadbdb 100644 --- a/tests/ui/generic-associated-types/type-param-defaults.stderr +++ b/tests/ui/generic-associated-types/type-param-defaults.stderr @@ -1,16 +1,16 @@ -error: defaults for type parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions +error: defaults for generic parameters are not allowed here --> $DIR/type-param-defaults.rs:6:16 | LL | type Assoc<T = u32>; | ^^^^^^^ -error: defaults for type parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions +error: defaults for generic parameters are not allowed here --> $DIR/type-param-defaults.rs:11:16 | LL | type Assoc<T = u32> = u64; | ^^^^^^^ -error: defaults for type parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions +error: defaults for generic parameters are not allowed here --> $DIR/type-param-defaults.rs:16:16 | LL | type Assoc<T = u32> = T; diff --git a/tests/ui/generic-const-items/parameter-defaults.rs b/tests/ui/generic-const-items/parameter-defaults.rs index c933db17fa2..b52cb0fd002 100644 --- a/tests/ui/generic-const-items/parameter-defaults.rs +++ b/tests/ui/generic-const-items/parameter-defaults.rs @@ -7,9 +7,17 @@ // FIXME(default_type_parameter_fallback): Consider reallowing them once they work properly. -const NONE<T = ()>: Option<T> = None::<T>; //~ ERROR defaults for type parameters are only allowed +const NONE<T = ()>: Option<T> = None::<T>; +//~^ ERROR defaults for generic parameters are not allowed here -fn main() { - let _ = NONE; - //~^ ERROR type annotations needed +impl Host { + const NADA<T = ()>: Option<T> = None::<T>; + //~^ ERROR defaults for generic parameters are not allowed here } + +enum Host {} + +fn body0() { let _ = NONE; } //~ ERROR type annotations needed +fn body1() { let _ = Host::NADA; } //~ ERROR type annotations needed + +fn main() {} diff --git a/tests/ui/generic-const-items/parameter-defaults.stderr b/tests/ui/generic-const-items/parameter-defaults.stderr index 13562c98f6d..9bf1f6412f5 100644 --- a/tests/ui/generic-const-items/parameter-defaults.stderr +++ b/tests/ui/generic-const-items/parameter-defaults.stderr @@ -1,20 +1,37 @@ -error: defaults for type parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions +error: defaults for generic parameters are not allowed here --> $DIR/parameter-defaults.rs:10:12 | LL | const NONE<T = ()>: Option<T> = None::<T>; | ^^^^^^ +error: defaults for generic parameters are not allowed here + --> $DIR/parameter-defaults.rs:14:16 + | +LL | const NADA<T = ()>: Option<T> = None::<T>; + | ^^^^^^ + +error[E0282]: type annotations needed for `Option<_>` + --> $DIR/parameter-defaults.rs:20:18 + | +LL | fn body0() { let _ = NONE; } + | ^ ---- type must be known at this point + | +help: consider giving this pattern a type, where the type for type parameter `T` is specified + | +LL | fn body0() { let _: Option<T> = NONE; } + | +++++++++++ + error[E0282]: type annotations needed for `Option<_>` - --> $DIR/parameter-defaults.rs:13:9 + --> $DIR/parameter-defaults.rs:21:18 | -LL | let _ = NONE; - | ^ ---- type must be known at this point +LL | fn body1() { let _ = Host::NADA; } + | ^ ---------- type must be known at this point | help: consider giving this pattern a type, where the type for type parameter `T` is specified | -LL | let _: Option<T> = NONE; - | +++++++++++ +LL | fn body1() { let _: Option<T> = Host::NADA; } + | +++++++++++ -error: aborting due to 2 previous errors +error: aborting due to 4 previous errors For more information about this error, try `rustc --explain E0282`. diff --git a/tests/ui/generics/generic-extern.rs b/tests/ui/generics/generic-extern.rs index 36fa5eaafd6..b4f00fc1187 100644 --- a/tests/ui/generics/generic-extern.rs +++ b/tests/ui/generics/generic-extern.rs @@ -1,7 +1,15 @@ +// Ensure that we reject generic parameters on foreign items. + extern "C" { fn foo<T>(); //~ ERROR foreign items may not have type parameters + + // Furthermore, check that type parameter defaults lead to a *hard* error, + // not just a lint error, for maximum forward compatibility. + #[allow(invalid_type_param_default)] // Should have no effect here. + fn bar<T = ()>(); //~ ERROR foreign items may not have type parameters + //~^ ERROR defaults for generic parameters are not allowed here } fn main() { - foo::<i32>(); //~ ERROR requires unsafe + unsafe { foo::<i32>() }; } diff --git a/tests/ui/generics/generic-extern.stderr b/tests/ui/generics/generic-extern.stderr index a3f28825316..6e837156812 100644 --- a/tests/ui/generics/generic-extern.stderr +++ b/tests/ui/generics/generic-extern.stderr @@ -1,20 +1,25 @@ error[E0044]: foreign items may not have type parameters - --> $DIR/generic-extern.rs:2:5 + --> $DIR/generic-extern.rs:4:5 | LL | fn foo<T>(); | ^^^^^^^^^^^^ can't have type parameters | = help: replace the type parameters with concrete types like `u32` -error[E0133]: call to unsafe function `foo` is unsafe and requires unsafe function or block - --> $DIR/generic-extern.rs:6:5 +error: defaults for generic parameters are not allowed here + --> $DIR/generic-extern.rs:9:12 | -LL | foo::<i32>(); - | ^^^^^^^^^^^^ call to unsafe function +LL | fn bar<T = ()>(); + | ^^^^^^ + +error[E0044]: foreign items may not have type parameters + --> $DIR/generic-extern.rs:9:5 | - = note: consult the function's documentation for information on how to avoid undefined behavior +LL | fn bar<T = ()>(); + | ^^^^^^^^^^^^^^^^^ can't have type parameters + | + = help: replace the type parameters with concrete types like `u32` -error: aborting due to 2 previous errors +error: aborting due to 3 previous errors -Some errors have detailed explanations: E0044, E0133. -For more information about an error, try `rustc --explain E0044`. +For more information about this error, try `rustc --explain E0044`. diff --git a/tests/ui/generics/invalid-type-param-default.rs b/tests/ui/generics/invalid-type-param-default.rs new file mode 100644 index 00000000000..b47e142605c --- /dev/null +++ b/tests/ui/generics/invalid-type-param-default.rs @@ -0,0 +1,22 @@ +// Ensure that we emit the deny-by-default lint `invalid_type_param_default` in locations where +// type parameter defaults were accidentally allowed but don't have any effect whatsoever. +// +// Tracked in <https://github.com/rust-lang/rust/issues/36887>. +// FIXME(default_type_parameter_fallback): Consider reallowing them once they work properly. + +fn avg<T = i32>(_: T) {} +//~^ ERROR defaults for generic parameters are not allowed here [invalid_type_param_default] +//~| WARN this was previously accepted + +// issue: <https://github.com/rust-lang/rust/issues/26812> +fn mdn<T = T::Item>(_: T) {} +//~^ ERROR generic parameter defaults cannot reference parameters before they are declared +//~| ERROR defaults for generic parameters are not allowed here [invalid_type_param_default] +//~| WARN this was previously accepted + +struct S<T>(T); +impl<T = i32> S<T> {} +//~^ ERROR defaults for generic parameters are not allowed here [invalid_type_param_default] +//~| WARN this was previously accepted + +fn main() {} diff --git a/tests/ui/generics/invalid-type-param-default.stderr b/tests/ui/generics/invalid-type-param-default.stderr new file mode 100644 index 00000000000..1c8fdd8ab5c --- /dev/null +++ b/tests/ui/generics/invalid-type-param-default.stderr @@ -0,0 +1,70 @@ +error[E0128]: generic parameter defaults cannot reference parameters before they are declared + --> $DIR/invalid-type-param-default.rs:12:12 + | +LL | fn mdn<T = T::Item>(_: T) {} + | ^^^^^^^ cannot reference `T` before it is declared + +error: defaults for generic parameters are not allowed here + --> $DIR/invalid-type-param-default.rs:7:8 + | +LL | fn avg<T = i32>(_: T) {} + | ^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #36887 <https://github.com/rust-lang/rust/issues/36887> + = note: `#[deny(invalid_type_param_default)]` on by default + +error: defaults for generic parameters are not allowed here + --> $DIR/invalid-type-param-default.rs:12:8 + | +LL | fn mdn<T = T::Item>(_: T) {} + | ^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #36887 <https://github.com/rust-lang/rust/issues/36887> + +error: defaults for generic parameters are not allowed here + --> $DIR/invalid-type-param-default.rs:18:6 + | +LL | impl<T = i32> S<T> {} + | ^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #36887 <https://github.com/rust-lang/rust/issues/36887> + +error: aborting due to 4 previous errors + +For more information about this error, try `rustc --explain E0128`. +Future incompatibility report: Future breakage diagnostic: +error: defaults for generic parameters are not allowed here + --> $DIR/invalid-type-param-default.rs:7:8 + | +LL | fn avg<T = i32>(_: T) {} + | ^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #36887 <https://github.com/rust-lang/rust/issues/36887> + = note: `#[deny(invalid_type_param_default)]` on by default + +Future breakage diagnostic: +error: defaults for generic parameters are not allowed here + --> $DIR/invalid-type-param-default.rs:12:8 + | +LL | fn mdn<T = T::Item>(_: T) {} + | ^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #36887 <https://github.com/rust-lang/rust/issues/36887> + = note: `#[deny(invalid_type_param_default)]` on by default + +Future breakage diagnostic: +error: defaults for generic parameters are not allowed here + --> $DIR/invalid-type-param-default.rs:18:6 + | +LL | impl<T = i32> S<T> {} + | ^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #36887 <https://github.com/rust-lang/rust/issues/36887> + = note: `#[deny(invalid_type_param_default)]` on by default + diff --git a/tests/ui/generics/overlapping-errors-span-issue-123861.rs b/tests/ui/generics/overlapping-errors-span-issue-123861.rs index e0a27f68748..2549f4b3714 100644 --- a/tests/ui/generics/overlapping-errors-span-issue-123861.rs +++ b/tests/ui/generics/overlapping-errors-span-issue-123861.rs @@ -1,7 +1,7 @@ fn mainIterator<_ = _> {} //~^ ERROR expected identifier, found reserved identifier `_` //~| ERROR missing parameters for function definition -//~| ERROR defaults for type parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions [invalid_type_param_default] +//~| ERROR defaults for generic parameters are not allowed here [invalid_type_param_default] //~| WARNING this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! //~| ERROR the placeholder `_` is not allowed within types on item signatures for functions [E0121] diff --git a/tests/ui/generics/overlapping-errors-span-issue-123861.stderr b/tests/ui/generics/overlapping-errors-span-issue-123861.stderr index 7d08d8fed9f..44e8b4a01e7 100644 --- a/tests/ui/generics/overlapping-errors-span-issue-123861.stderr +++ b/tests/ui/generics/overlapping-errors-span-issue-123861.stderr @@ -15,7 +15,7 @@ help: add a parameter list LL | fn mainIterator<_ = _>() {} | ++ -error: defaults for type parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions +error: defaults for generic parameters are not allowed here --> $DIR/overlapping-errors-span-issue-123861.rs:1:17 | LL | fn mainIterator<_ = _> {} @@ -35,7 +35,7 @@ error: aborting due to 4 previous errors For more information about this error, try `rustc --explain E0121`. Future incompatibility report: Future breakage diagnostic: -error: defaults for type parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions +error: defaults for generic parameters are not allowed here --> $DIR/overlapping-errors-span-issue-123861.rs:1:17 | LL | fn mainIterator<_ = _> {} diff --git a/tests/ui/issues/issue-36116.rs b/tests/ui/generics/unnecessary-path-disambiguator-36116.rs index 2313e189aff..c2dab605f59 100644 --- a/tests/ui/issues/issue-36116.rs +++ b/tests/ui/generics/unnecessary-path-disambiguator-36116.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/36116 // Unnecessary path disambiguator is ok //@ check-pass diff --git a/tests/ui/issues/issue-36075.rs b/tests/ui/generics/unused-type-parameter-regression-36075.rs index a563332ad78..4d6eb617b59 100644 --- a/tests/ui/issues/issue-36075.rs +++ b/tests/ui/generics/unused-type-parameter-regression-36075.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/36075 //@ check-pass #![allow(dead_code)] trait DeclarationParser { diff --git a/tests/ui/hygiene/panic-location.run.stderr b/tests/ui/hygiene/panic-location.run.stderr index 5cd07dcda4c..d28ab864183 100644 --- a/tests/ui/hygiene/panic-location.run.stderr +++ b/tests/ui/hygiene/panic-location.run.stderr @@ -1,4 +1,4 @@ -thread 'main' panicked at $DIR/panic-location.rs:LL:CC: +thread 'main' ($TID) panicked at $DIR/panic-location.rs:LL:CC: capacity overflow note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace diff --git a/tests/ui/impl-trait/issues/issue-55872-2.rs b/tests/ui/impl-trait/issues/issue-55872-2.rs index a3b2225126a..aea00dd9e3d 100644 --- a/tests/ui/impl-trait/issues/issue-55872-2.rs +++ b/tests/ui/impl-trait/issues/issue-55872-2.rs @@ -12,7 +12,6 @@ impl<S> Bar for S { type E = impl std::marker::Send; fn foo<T>() -> Self::E { //~^ ERROR type parameter `T` is part of concrete type but not used in parameter list for the `impl Trait` type alias - //~| ERROR type parameter `T` is part of concrete type but not used in parameter list for the `impl Trait` type alias async {} } } diff --git a/tests/ui/impl-trait/issues/issue-55872-2.stderr b/tests/ui/impl-trait/issues/issue-55872-2.stderr index 51a7dd00ade..91c2ecdc8a4 100644 --- a/tests/ui/impl-trait/issues/issue-55872-2.stderr +++ b/tests/ui/impl-trait/issues/issue-55872-2.stderr @@ -4,13 +4,5 @@ error: type parameter `T` is part of concrete type but not used in parameter lis LL | fn foo<T>() -> Self::E { | ^^^^^^^ -error: type parameter `T` is part of concrete type but not used in parameter list for the `impl Trait` type alias - --> $DIR/issue-55872-2.rs:13:20 - | -LL | fn foo<T>() -> Self::E { - | ^^^^^^^ - | - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - -error: aborting due to 2 previous errors +error: aborting due to 1 previous error diff --git a/tests/ui/impl-trait/issues/issue-55872-3.rs b/tests/ui/impl-trait/issues/issue-55872-3.rs index 763b4b9fd32..698e7f36234 100644 --- a/tests/ui/impl-trait/issues/issue-55872-3.rs +++ b/tests/ui/impl-trait/issues/issue-55872-3.rs @@ -14,7 +14,6 @@ impl<S> Bar for S { fn foo<T>() -> Self::E { //~^ ERROR : Copy` is not satisfied [E0277] //~| ERROR type parameter `T` is part of concrete type - //~| ERROR type parameter `T` is part of concrete type async {} } } diff --git a/tests/ui/impl-trait/issues/issue-55872-3.stderr b/tests/ui/impl-trait/issues/issue-55872-3.stderr index ce2dd7f02b4..5124c46baeb 100644 --- a/tests/ui/impl-trait/issues/issue-55872-3.stderr +++ b/tests/ui/impl-trait/issues/issue-55872-3.stderr @@ -1,26 +1,15 @@ -error[E0277]: the trait bound `{async block@$DIR/issue-55872-3.rs:18:9: 18:14}: Copy` is not satisfied - --> $DIR/issue-55872-3.rs:14:20 - | -LL | fn foo<T>() -> Self::E { - | ^^^^^^^ the trait `Copy` is not implemented for `{async block@$DIR/issue-55872-3.rs:18:9: 18:14}` -... -LL | async {} - | -------- return type was inferred to be `{async block@$DIR/issue-55872-3.rs:18:9: 18:14}` here - error: type parameter `T` is part of concrete type but not used in parameter list for the `impl Trait` type alias --> $DIR/issue-55872-3.rs:14:20 | LL | fn foo<T>() -> Self::E { | ^^^^^^^ -error: type parameter `T` is part of concrete type but not used in parameter list for the `impl Trait` type alias +error[E0277]: the trait bound `{async block@$DIR/issue-55872-3.rs:17:9: 17:14}: Copy` is not satisfied --> $DIR/issue-55872-3.rs:14:20 | LL | fn foo<T>() -> Self::E { - | ^^^^^^^ - | - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + | ^^^^^^^ the trait `Copy` is not implemented for `{async block@$DIR/issue-55872-3.rs:17:9: 17:14}` -error: aborting due to 3 previous errors +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/impl-trait/where-allowed.rs b/tests/ui/impl-trait/where-allowed.rs index 1c3c66c537f..04a95f7f6f0 100644 --- a/tests/ui/impl-trait/where-allowed.rs +++ b/tests/ui/impl-trait/where-allowed.rs @@ -236,17 +236,15 @@ type InTypeAliasGenericParamDefault<T = impl Debug> = T; //~^ ERROR `impl Trait` is not allowed in generic parameter defaults // Disallowed -impl <T = impl Debug> T {} -//~^ ERROR defaults for type parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions -//~| WARNING this was previously accepted by the compiler but is being phased out -//~| ERROR `impl Trait` is not allowed in generic parameter defaults +#[expect(invalid_type_param_default)] +impl<T = impl Debug> T {} +//~^ ERROR `impl Trait` is not allowed in generic parameter defaults //~| ERROR no nominal type found // Disallowed +#[expect(invalid_type_param_default)] fn in_method_generic_param_default<T = impl Debug>(_: T) {} -//~^ ERROR defaults for type parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions -//~| WARNING this was previously accepted by the compiler but is being phased out -//~| ERROR `impl Trait` is not allowed in generic parameter defaults +//~^ ERROR `impl Trait` is not allowed in generic parameter defaults fn main() { let _in_local_variable: impl Fn() = || {}; diff --git a/tests/ui/impl-trait/where-allowed.stderr b/tests/ui/impl-trait/where-allowed.stderr index 052ae5a9931..08caff326c4 100644 --- a/tests/ui/impl-trait/where-allowed.stderr +++ b/tests/ui/impl-trait/where-allowed.stderr @@ -311,10 +311,10 @@ LL | type InTypeAliasGenericParamDefault<T = impl Debug> = T; = note: `impl Trait` is only allowed in arguments and return types of functions and methods error[E0562]: `impl Trait` is not allowed in generic parameter defaults - --> $DIR/where-allowed.rs:239:11 + --> $DIR/where-allowed.rs:240:10 | -LL | impl <T = impl Debug> T {} - | ^^^^^^^^^^ +LL | impl<T = impl Debug> T {} + | ^^^^^^^^^^ | = note: `impl Trait` is only allowed in arguments and return types of functions and methods @@ -327,7 +327,7 @@ LL | fn in_method_generic_param_default<T = impl Debug>(_: T) {} = note: `impl Trait` is only allowed in arguments and return types of functions and methods error[E0562]: `impl Trait` is not allowed in the type of variable bindings - --> $DIR/where-allowed.rs:252:29 + --> $DIR/where-allowed.rs:250:29 | LL | let _in_local_variable: impl Fn() = || {}; | ^^^^^^^^^ @@ -338,7 +338,7 @@ LL | let _in_local_variable: impl Fn() = || {}; = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0562]: `impl Trait` is not allowed in closure return types - --> $DIR/where-allowed.rs:254:46 + --> $DIR/where-allowed.rs:252:46 | LL | let _in_return_in_local_variable = || -> impl Fn() { || {} }; | ^^^^^^^^^ @@ -368,25 +368,6 @@ LL - fn in_trait_impl_return() -> impl Debug { () } LL + fn in_trait_impl_return() -> <() as DummyTrait>::Out { () } | -error: defaults for type parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions - --> $DIR/where-allowed.rs:246:36 - | -LL | fn in_method_generic_param_default<T = impl Debug>(_: T) {} - | ^^^^^^^^^^^^^^ - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #36887 <https://github.com/rust-lang/rust/issues/36887> - = note: `#[deny(invalid_type_param_default)]` on by default - -error: defaults for type parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions - --> $DIR/where-allowed.rs:239:7 - | -LL | impl <T = impl Debug> T {} - | ^^^^^^^^^^^^^^ - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #36887 <https://github.com/rust-lang/rust/issues/36887> - error[E0283]: type annotations needed --> $DIR/where-allowed.rs:46:57 | @@ -408,10 +389,10 @@ LL | fn in_impl_Fn_return_in_return() -> &'static impl Fn() -> impl Debug { pani where Args: Tuple, F: Fn<Args>, A: Allocator, F: ?Sized; error[E0118]: no nominal type found for inherent implementation - --> $DIR/where-allowed.rs:239:1 + --> $DIR/where-allowed.rs:240:1 | -LL | impl <T = impl Debug> T {} - | ^^^^^^^^^^^^^^^^^^^^^^^ impl requires a nominal type +LL | impl<T = impl Debug> T {} + | ^^^^^^^^^^^^^^^^^^^^^^ impl requires a nominal type | = note: either implement a trait on it or create a newtype to wrap it instead @@ -431,29 +412,21 @@ LL | type InTypeAlias<R> = impl Debug; | = note: `InTypeAlias` must be used in combination with a concrete type within the same crate -error: aborting due to 50 previous errors +error: aborting due to 48 previous errors Some errors have detailed explanations: E0053, E0118, E0283, E0562, E0658, E0666. For more information about an error, try `rustc --explain E0053`. Future incompatibility report: Future breakage diagnostic: -error: defaults for type parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions +warning: defaults for generic parameters are not allowed here --> $DIR/where-allowed.rs:246:36 | LL | fn in_method_generic_param_default<T = impl Debug>(_: T) {} | ^^^^^^^^^^^^^^ - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #36887 <https://github.com/rust-lang/rust/issues/36887> - = note: `#[deny(invalid_type_param_default)]` on by default Future breakage diagnostic: -error: defaults for type parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions - --> $DIR/where-allowed.rs:239:7 - | -LL | impl <T = impl Debug> T {} - | ^^^^^^^^^^^^^^ +warning: defaults for generic parameters are not allowed here + --> $DIR/where-allowed.rs:240:6 | - = 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 #36887 <https://github.com/rust-lang/rust/issues/36887> - = note: `#[deny(invalid_type_param_default)]` on by default +LL | impl<T = impl Debug> T {} + | ^^^^^^^^^^^^^^ diff --git a/tests/ui/issues/issue-12909.rs b/tests/ui/inference/collection-type-copy-behavior-12909.rs index f2c33806aae..83536e8875c 100644 --- a/tests/ui/issues/issue-12909.rs +++ b/tests/ui/inference/collection-type-copy-behavior-12909.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/12909 //@ run-pass #![allow(unused_variables)] diff --git a/tests/ui/instrument-coverage/coverage-options.bad.stderr b/tests/ui/instrument-coverage/coverage-options.bad.stderr index 1a6b30dc832..4a272cf97fb 100644 --- a/tests/ui/instrument-coverage/coverage-options.bad.stderr +++ b/tests/ui/instrument-coverage/coverage-options.bad.stderr @@ -1,2 +1,2 @@ -error: incorrect value `bad` for unstable option `coverage-options` - `block` | `branch` | `condition` | `mcdc` | `no-mir-spans` was expected +error: incorrect value `bad` for unstable option `coverage-options` - `block` | `branch` | `condition` | `mcdc` was expected diff --git a/tests/ui/intrinsics/const-eval-select-backtrace-std.run.stderr b/tests/ui/intrinsics/const-eval-select-backtrace-std.run.stderr index 71d792b7f77..397eeaf600a 100644 --- a/tests/ui/intrinsics/const-eval-select-backtrace-std.run.stderr +++ b/tests/ui/intrinsics/const-eval-select-backtrace-std.run.stderr @@ -1,4 +1,4 @@ -thread 'main' panicked at $DIR/const-eval-select-backtrace-std.rs:6:8: +thread 'main' ($TID) panicked at $DIR/const-eval-select-backtrace-std.rs:6:8: byte index 1 is out of bounds of `` note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace diff --git a/tests/ui/intrinsics/const-eval-select-backtrace.run.stderr b/tests/ui/intrinsics/const-eval-select-backtrace.run.stderr index 4f11f5966ed..649174017e9 100644 --- a/tests/ui/intrinsics/const-eval-select-backtrace.run.stderr +++ b/tests/ui/intrinsics/const-eval-select-backtrace.run.stderr @@ -1,4 +1,4 @@ -thread 'main' panicked at $DIR/const-eval-select-backtrace.rs:15:5: +thread 'main' ($TID) panicked at $DIR/const-eval-select-backtrace.rs:15:5: Aaah! note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace diff --git a/tests/ui/intrinsics/not-overridden.rs b/tests/ui/intrinsics/not-overridden.rs index 2359eee8b26..ce855483527 100644 --- a/tests/ui/intrinsics/not-overridden.rs +++ b/tests/ui/intrinsics/not-overridden.rs @@ -4,7 +4,7 @@ //@ build-fail //@ failure-status:101 //@ normalize-stderr: ".*note: .*\n\n" -> "" -//@ normalize-stderr: "thread 'rustc' panicked.*:\n.*\n" -> "" +//@ normalize-stderr: "thread 'rustc'.*panicked.*:\n.*\n" -> "" //@ normalize-stderr: "internal compiler error:.*: intrinsic const_deallocate " -> "" //@ rustc-env:RUST_BACKTRACE=0 diff --git a/tests/ui/issues/auxiliary/issue-25185-2.rs b/tests/ui/issues/auxiliary/issue-25185-2.rs deleted file mode 100644 index 7ce3df255a3..00000000000 --- a/tests/ui/issues/auxiliary/issue-25185-2.rs +++ /dev/null @@ -1,3 +0,0 @@ -extern crate issue_25185_1; - -pub use issue_25185_1::rust_dbg_extern_identity_u32; diff --git a/tests/ui/issues/issue-13259-windows-tcb-trash.rs b/tests/ui/issues/issue-13259-windows-tcb-trash.rs deleted file mode 100644 index 381e3f15259..00000000000 --- a/tests/ui/issues/issue-13259-windows-tcb-trash.rs +++ /dev/null @@ -1,39 +0,0 @@ -//@ run-pass - -#[cfg(windows)] -mod imp { - type LPVOID = *mut u8; - type DWORD = u32; - type LPWSTR = *mut u16; - - extern "system" { - fn FormatMessageW(flags: DWORD, - lpSrc: LPVOID, - msgId: DWORD, - langId: DWORD, - buf: LPWSTR, - nsize: DWORD, - args: *const u8) - -> DWORD; - } - - pub fn test() { - let mut buf: [u16; 50] = [0; 50]; - let ret = unsafe { - FormatMessageW(0x1000, core::ptr::null_mut(), 1, 0x400, - buf.as_mut_ptr(), buf.len() as u32, core::ptr::null()) - }; - // On some 32-bit Windowses (Win7-8 at least) this will panic with segmented - // stacks taking control of pvArbitrary - assert!(ret != 0); - } -} - -#[cfg(not(windows))] -mod imp { - pub fn test() { } -} - -fn main() { - imp::test() -} diff --git a/tests/ui/issues/issue-25185.rs b/tests/ui/issues/issue-25185.rs deleted file mode 100644 index 7dc06ad96df..00000000000 --- a/tests/ui/issues/issue-25185.rs +++ /dev/null @@ -1,12 +0,0 @@ -//@ run-pass -//@ aux-build:issue-25185-1.rs -//@ aux-build:issue-25185-2.rs - -extern crate issue_25185_2; - -fn main() { - let x = unsafe { - issue_25185_2::rust_dbg_extern_identity_u32(1) - }; - assert_eq!(x, 1); -} diff --git a/tests/ui/issues/issue-26812.rs b/tests/ui/issues/issue-26812.rs deleted file mode 100644 index 8eb030a8ec9..00000000000 --- a/tests/ui/issues/issue-26812.rs +++ /dev/null @@ -1,6 +0,0 @@ -fn avg<T=T::Item>(_: T) {} -//~^ ERROR generic parameter defaults cannot reference parameters before they are declared -//~| ERROR defaults for type parameters -//~| WARN previously accepted - -fn main() {} diff --git a/tests/ui/issues/issue-26812.stderr b/tests/ui/issues/issue-26812.stderr deleted file mode 100644 index bb60d67e287..00000000000 --- a/tests/ui/issues/issue-26812.stderr +++ /dev/null @@ -1,30 +0,0 @@ -error[E0128]: generic parameter defaults cannot reference parameters before they are declared - --> $DIR/issue-26812.rs:1:10 - | -LL | fn avg<T=T::Item>(_: T) {} - | ^^^^^^^ cannot reference `T` before it is declared - -error: defaults for type parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions - --> $DIR/issue-26812.rs:1:8 - | -LL | fn avg<T=T::Item>(_: T) {} - | ^^^^^^^^^ - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #36887 <https://github.com/rust-lang/rust/issues/36887> - = note: `#[deny(invalid_type_param_default)]` on by default - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0128`. -Future incompatibility report: Future breakage diagnostic: -error: defaults for type parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions - --> $DIR/issue-26812.rs:1:8 - | -LL | fn avg<T=T::Item>(_: T) {} - | ^^^^^^^^^ - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #36887 <https://github.com/rust-lang/rust/issues/36887> - = note: `#[deny(invalid_type_param_default)]` on by default - diff --git a/tests/ui/issues/issue-32655.rs b/tests/ui/issues/issue-32655.rs deleted file mode 100644 index f52e0923129..00000000000 --- a/tests/ui/issues/issue-32655.rs +++ /dev/null @@ -1,19 +0,0 @@ -macro_rules! foo ( - () => ( - #[derive_Clone] //~ ERROR cannot find attribute `derive_Clone` in this scope - struct T; - ); -); - -macro_rules! bar ( - ($e:item) => ($e) -); - -foo!(); - -bar!( - #[derive_Clone] //~ ERROR cannot find attribute `derive_Clone` in this scope - struct S; -); - -fn main() {} diff --git a/tests/ui/issues/issue-32655.stderr b/tests/ui/issues/issue-32655.stderr deleted file mode 100644 index b8362499b2d..00000000000 --- a/tests/ui/issues/issue-32655.stderr +++ /dev/null @@ -1,25 +0,0 @@ -error: cannot find attribute `derive_Clone` in this scope - --> $DIR/issue-32655.rs:3:11 - | -LL | #[derive_Clone] - | ^^^^^^^^^^^^ help: an attribute macro with a similar name exists: `derive_const` -... -LL | foo!(); - | ------ in this macro invocation - --> $SRC_DIR/core/src/macros/mod.rs:LL:COL - | - = note: similarly named attribute macro `derive_const` defined here - | - = note: this error originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info) - -error: cannot find attribute `derive_Clone` in this scope - --> $DIR/issue-32655.rs:15:7 - | -LL | #[derive_Clone] - | ^^^^^^^^^^^^ help: an attribute macro with a similar name exists: `derive_const` - --> $SRC_DIR/core/src/macros/mod.rs:LL:COL - | - = note: similarly named attribute macro `derive_const` defined here - -error: aborting due to 2 previous errors - diff --git a/tests/ui/issues/issue-87707.run.stderr b/tests/ui/issues/issue-87707.run.stderr index eb1d65a081f..8485c0578b8 100644 --- a/tests/ui/issues/issue-87707.run.stderr +++ b/tests/ui/issues/issue-87707.run.stderr @@ -1,7 +1,7 @@ -thread 'main' panicked at $DIR/issue-87707.rs:14:24: +thread 'main' ($TID) panicked at $DIR/issue-87707.rs:14:24: Here Once instance is poisoned. note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace -thread 'main' panicked at $DIR/issue-87707.rs:16:7: +thread 'main' ($TID) panicked at $DIR/issue-87707.rs:16:7: Once instance has previously been poisoned diff --git a/tests/ui/issues/issue-9188.rs b/tests/ui/issues/issue-9188.rs deleted file mode 100644 index df2f90a0f16..00000000000 --- a/tests/ui/issues/issue-9188.rs +++ /dev/null @@ -1,11 +0,0 @@ -//@ run-pass -//@ aux-build:issue-9188.rs - - -extern crate issue_9188; - -pub fn main() { - let a = issue_9188::bar(); - let b = issue_9188::foo::<isize>(); - assert_eq!(*a, *b); -} diff --git a/tests/ui/issues/issue-12677.rs b/tests/ui/iterators/bytes-iterator-clone-12677.rs index dbc2dbc8527..cfbb85a3ecb 100644 --- a/tests/ui/issues/issue-12677.rs +++ b/tests/ui/iterators/bytes-iterator-clone-12677.rs @@ -1,3 +1,5 @@ +//! Regression test for https://github.com/rust-lang/rust/issues/12677 + //@ run-pass fn main() { diff --git a/tests/ui/issues/issue-23966.rs b/tests/ui/iterators/fold-iterator-error-23966.rs index 5fdec28ac2c..970c943da0b 100644 --- a/tests/ui/issues/issue-23966.rs +++ b/tests/ui/iterators/fold-iterator-error-23966.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/23966 fn main() { "".chars().fold(|_, _| (), ()); //~^ ERROR E0277 diff --git a/tests/ui/issues/issue-23966.stderr b/tests/ui/iterators/fold-iterator-error-23966.stderr index 3f7a4fa312f..15249a93597 100644 --- a/tests/ui/issues/issue-23966.stderr +++ b/tests/ui/iterators/fold-iterator-error-23966.stderr @@ -1,5 +1,5 @@ error[E0277]: expected a `FnMut(_, char)` closure, found `()` - --> $DIR/issue-23966.rs:2:32 + --> $DIR/fold-iterator-error-23966.rs:3:32 | LL | "".chars().fold(|_, _| (), ()); | ---- ^^ expected an `FnMut(_, char)` closure, found `()` diff --git a/tests/ui/issues/issue-15673.rs b/tests/ui/iterators/iterator-type-inference-sum-15673.rs index bb61c246276..aee027927f2 100644 --- a/tests/ui/issues/issue-15673.rs +++ b/tests/ui/iterators/iterator-type-inference-sum-15673.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/15673 //@ run-pass #![allow(stable_features)] diff --git a/tests/ui/layout/valid_range_oob.rs b/tests/ui/layout/valid_range_oob.rs index df816e74066..8ae9f6e9726 100644 --- a/tests/ui/layout/valid_range_oob.rs +++ b/tests/ui/layout/valid_range_oob.rs @@ -1,6 +1,6 @@ //@ failure-status: 101 //@ normalize-stderr: "note: .*\n\n" -> "" -//@ normalize-stderr: "thread 'rustc' panicked.*\n" -> "" +//@ normalize-stderr: "thread 'rustc'.*panicked.*\n" -> "" //@ rustc-env:RUST_BACKTRACE=0 #![feature(rustc_attrs)] diff --git a/tests/ui/issues/issue-13058.rs b/tests/ui/lifetimes/iterator-trait-lifetime-error-13058.rs index a5806feb720..6cfe440b43d 100644 --- a/tests/ui/issues/issue-13058.rs +++ b/tests/ui/lifetimes/iterator-trait-lifetime-error-13058.rs @@ -1,3 +1,5 @@ +//! Regression test for https://github.com/rust-lang/rust/issues/13058 + use std::ops::Range; trait Itble<'r, T, I: Iterator<Item=T>> { fn iter(&'r self) -> I; } diff --git a/tests/ui/issues/issue-13058.stderr b/tests/ui/lifetimes/iterator-trait-lifetime-error-13058.stderr index 4f4108fa182..e6564e36b21 100644 --- a/tests/ui/issues/issue-13058.stderr +++ b/tests/ui/lifetimes/iterator-trait-lifetime-error-13058.stderr @@ -1,5 +1,5 @@ error[E0621]: explicit lifetime required in the type of `cont` - --> $DIR/issue-13058.rs:14:21 + --> $DIR/iterator-trait-lifetime-error-13058.rs:16:21 | LL | let cont_iter = cont.iter(); | ^^^^^^^^^^^ lifetime `'r` required diff --git a/tests/ui/issues/issue-13167.rs b/tests/ui/lifetimes/lifetime-inference-destructuring-arg.rs index 5f733e85948..7a019a71d75 100644 --- a/tests/ui/issues/issue-13167.rs +++ b/tests/ui/lifetimes/lifetime-inference-destructuring-arg.rs @@ -1,3 +1,5 @@ +//! Regression test for https://github.com/rust-lang/rust/issues/13167 + //@ check-pass //@ revisions: current next //@ ignore-compare-mode-next-solver (explicit revisions) diff --git a/tests/ui/issues/issue-15735.rs b/tests/ui/lifetimes/lifetime-inference-miss-15735.rs index f5b3803f155..c75d59a2f4b 100644 --- a/tests/ui/issues/issue-15735.rs +++ b/tests/ui/lifetimes/lifetime-inference-miss-15735.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/15735 //@ check-pass #![allow(dead_code)] struct A<'a> { diff --git a/tests/ui/issues/issue-13323.rs b/tests/ui/lifetimes/matcher-trait-equality-13323.rs index 8f334404f9a..efd56294b39 100644 --- a/tests/ui/issues/issue-13323.rs +++ b/tests/ui/lifetimes/matcher-trait-equality-13323.rs @@ -1,3 +1,5 @@ +//! Regression test for https://github.com/rust-lang/rust/issues/13323 + //@ run-pass struct StrWrap { diff --git a/tests/ui/issues/issue-13405.rs b/tests/ui/lifetimes/struct-lifetime-field-assignment-13405.rs index 80b298d2f37..9482d89681b 100644 --- a/tests/ui/issues/issue-13405.rs +++ b/tests/ui/lifetimes/struct-lifetime-field-assignment-13405.rs @@ -1,3 +1,5 @@ +//! Regression test for https://github.com/rust-lang/rust/issues/13405 + //@ check-pass #![allow(dead_code)] #![allow(unused_variables)] diff --git a/tests/ui/issues/issue-11740.rs b/tests/ui/lifetimes/unsafe-transmute-in-find-11740.rs index c6099c2a0c0..eeecd2e9e40 100644 --- a/tests/ui/issues/issue-11740.rs +++ b/tests/ui/lifetimes/unsafe-transmute-in-find-11740.rs @@ -1,3 +1,5 @@ +//! Regression test for https://github.com/rust-lang/rust/issues/11740 + //@ check-pass struct Attr { diff --git a/tests/ui/lifetimes/unusual-rib-combinations.rs b/tests/ui/lifetimes/unusual-rib-combinations.rs index 0e92b41ae1e..b3e9642332b 100644 --- a/tests/ui/lifetimes/unusual-rib-combinations.rs +++ b/tests/ui/lifetimes/unusual-rib-combinations.rs @@ -14,7 +14,7 @@ fn b<const C: u8()>() {} // Paren generic args in AnonymousReportError fn c<T = u8()>() {} //~^ ERROR parenthesized type parameters may only be used with a `Fn` trait -//~| ERROR defaults for type parameters are only allowed in +//~| ERROR defaults for generic parameters are not allowed here //~| WARN this was previously accepted // Elided lifetime in path in ConstGeneric diff --git a/tests/ui/lifetimes/unusual-rib-combinations.stderr b/tests/ui/lifetimes/unusual-rib-combinations.stderr index 7373ca8cf84..bd68479c58c 100644 --- a/tests/ui/lifetimes/unusual-rib-combinations.stderr +++ b/tests/ui/lifetimes/unusual-rib-combinations.stderr @@ -22,7 +22,7 @@ error[E0214]: parenthesized type parameters may only be used with a `Fn` trait LL | fn c<T = u8()>() {} | ^^^^ only `Fn` traits may use parentheses -error: defaults for type parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions +error: defaults for generic parameters are not allowed here --> $DIR/unusual-rib-combinations.rs:15:6 | LL | fn c<T = u8()>() {} @@ -43,7 +43,7 @@ error: aborting due to 6 previous errors Some errors have detailed explanations: E0106, E0214, E0308, E0770. For more information about an error, try `rustc --explain E0106`. Future incompatibility report: Future breakage diagnostic: -error: defaults for type parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions +error: defaults for generic parameters are not allowed here --> $DIR/unusual-rib-combinations.rs:15:6 | LL | fn c<T = u8()>() {} diff --git a/tests/ui/linkage-attr/propagate-generic-issue-18804/main.rs b/tests/ui/linkage-attr/propagate-generic-issue-18804/main.rs index 8c194ec50df..ad7b0674478 100644 --- a/tests/ui/linkage-attr/propagate-generic-issue-18804/main.rs +++ b/tests/ui/linkage-attr/propagate-generic-issue-18804/main.rs @@ -4,6 +4,7 @@ //@ ignore-emscripten no weak symbol support //@ ignore-apple no extern_weak linkage +//@ ignore-aix no extern_weak linkage //@ aux-build:lib.rs diff --git a/tests/ui/issues/auxiliary/issue-25185-1.rs b/tests/ui/linking/auxiliary/aux-25185-1.rs index 032d7d5de34..032d7d5de34 100644 --- a/tests/ui/issues/auxiliary/issue-25185-1.rs +++ b/tests/ui/linking/auxiliary/aux-25185-1.rs diff --git a/tests/ui/linking/auxiliary/aux-25185-2.rs b/tests/ui/linking/auxiliary/aux-25185-2.rs new file mode 100644 index 00000000000..96c73f623e4 --- /dev/null +++ b/tests/ui/linking/auxiliary/aux-25185-2.rs @@ -0,0 +1,3 @@ +extern crate aux_25185_1; + +pub use aux_25185_1::rust_dbg_extern_identity_u32; diff --git a/tests/ui/linking/rlib-to-dylib-native-deps-inclusion-25185.rs b/tests/ui/linking/rlib-to-dylib-native-deps-inclusion-25185.rs new file mode 100644 index 00000000000..bbcfcb75106 --- /dev/null +++ b/tests/ui/linking/rlib-to-dylib-native-deps-inclusion-25185.rs @@ -0,0 +1,13 @@ +// https://github.com/rust-lang/rust/issues/25185 +//@ run-pass +//@ aux-build:aux-25185-1.rs +//@ aux-build:aux-25185-2.rs + +extern crate aux_25185_2; + +fn main() { + let x = unsafe { + aux_25185_2::rust_dbg_extern_identity_u32(1) + }; + assert_eq!(x, 1); +} diff --git a/tests/ui/lint/dangling-pointers-from-locals.rs b/tests/ui/lint/dangling-pointers-from-locals.rs new file mode 100644 index 00000000000..e321df2f427 --- /dev/null +++ b/tests/ui/lint/dangling-pointers-from-locals.rs @@ -0,0 +1,188 @@ +//@ check-pass + +struct Zst((), ()); +struct Adt(u8); + +const X: u8 = 5; + +fn simple() -> *const u8 { + let x = 0; + &x + //~^ WARN a dangling pointer will be produced +} + +fn bindings() -> *const u8 { + let x = 0; + let x = &x; + x + //~^ WARN a dangling pointer will be produced +} + +fn bindings_with_return() -> *const u8 { + let x = 42; + let y = &x; + return y; + //~^ WARN a dangling pointer will be produced +} + +fn with_simple_cast() -> *const u8 { + let x = 0u8; + &x as *const u8 + //~^ WARN a dangling pointer will be produced +} + +fn bindings_and_casts() -> *const u8 { + let x = 0u8; + let x = &x as *const u8; + x as *const u8 + //~^ WARN a dangling pointer will be produced +} + +fn return_with_complex_cast() -> *mut u8 { + let mut x = 0u8; + return &mut x as *mut u8 as *const u8 as *mut u8; + //~^ WARN a dangling pointer will be produced +} + +fn with_block() -> *const u8 { + let x = 0; + &{ x } + //~^ WARN a dangling pointer will be produced +} + +fn with_many_blocks() -> *const u8 { + let x = 0; + { + { + &{ + //~^ WARN a dangling pointer will be produced + { x } + } + } + } +} + +fn simple_return() -> *const u8 { + let x = 0; + return &x; + //~^ WARN a dangling pointer will be produced +} + +fn return_mut() -> *mut u8 { + let mut x = 0; + return &mut x; + //~^ WARN a dangling pointer will be produced +} + +fn const_and_flow() -> *const u8 { + if false { + let x = 8; + return &x; + //~^ WARN a dangling pointer will be produced + } + &X // not dangling +} + +fn vector<T: Default>() -> *const Vec<T> { + let x = vec![T::default()]; + &x + //~^ WARN a dangling pointer will be produced +} + +fn local_adt() -> *const Adt { + let x = Adt(5); + return &x; + //~^ WARN a dangling pointer will be produced +} + +fn closure() -> *const u8 { + let _x = || -> *const u8 { + let x = 8; + return &x; + //~^ WARN a dangling pointer will be produced + }; + &X // not dangling +} + +fn fn_ptr() -> *const fn() -> u8 { + fn ret_u8() -> u8 { + 0 + } + + let x = ret_u8 as fn() -> u8; + &x + //~^ WARN a dangling pointer will be produced +} + +fn as_arg(a: Adt) -> *const Adt { + &a + //~^ WARN a dangling pointer will be produced +} + +fn fn_ptr_as_arg(a: fn() -> u8) -> *const fn() -> u8 { + &a + //~^ WARN a dangling pointer will be produced +} + +fn ptr_as_arg(a: *const Adt) -> *const *const Adt { + &a + //~^ WARN a dangling pointer will be produced +} + +fn adt_as_arg(a: &Adt) -> *const &Adt { + &a + //~^ WARN a dangling pointer will be produced +} + +fn unit() -> *const () { + let x = (); + &x // not dangling +} + +fn zst() -> *const Zst { + let x = Zst((), ()); + &x // not dangling +} + +fn ref_implicit(a: &Adt) -> *const Adt { + a // not dangling +} + +fn ref_explicit(a: &Adt) -> *const Adt { + &*a // not dangling +} + +fn identity(a: *const Adt) -> *const Adt { + a // not dangling +} + +fn from_ref(a: &Adt) -> *const Adt { + std::ptr::from_ref(a) // not dangling +} + +fn inner_static() -> *const u8 { + static U: u8 = 5; + if false { + return &U as *const u8; // not dangling + } + &U // not dangling +} + +fn return_in_closure() { + let x = 0; + let c = || -> *const u8 { + &x // not dangling by it-self + }; +} + +fn option<T: Default>() -> *const Option<T> { + let x = Some(T::default()); + &x // can't compute layout of `Option<T>`, so cnat' be sure it won't be a ZST +} + +fn generic<T: Default>() -> *const T { + let x = T::default(); + &x // can't compute layout of `T`, so can't be sure it won't be a ZST +} + +fn main() {} diff --git a/tests/ui/lint/dangling-pointers-from-locals.stderr b/tests/ui/lint/dangling-pointers-from-locals.stderr new file mode 100644 index 00000000000..e1d28bf22a0 --- /dev/null +++ b/tests/ui/lint/dangling-pointers-from-locals.stderr @@ -0,0 +1,247 @@ +warning: a dangling pointer will be produced because the local variable `x` will be dropped + --> $DIR/dangling-pointers-from-locals.rs:10:5 + | +LL | fn simple() -> *const u8 { + | --------- return type of the function is `*const u8` +LL | let x = 0; + | - `x` is part the function and will be dropped at the end of the function +LL | &x + | ^^ + | + = note: pointers do not have a lifetime; after returning, the `u8` will be deallocated at the end of the function because nothing is referencing it as far as the type system is concerned + = note: `#[warn(dangling_pointers_from_locals)]` on by default + +warning: a dangling pointer will be produced because the local variable `x` will be dropped + --> $DIR/dangling-pointers-from-locals.rs:17:5 + | +LL | fn bindings() -> *const u8 { + | --------- return type of the function is `*const u8` +LL | let x = 0; + | - `x` is part the function and will be dropped at the end of the function +LL | let x = &x; + | -- dangling pointer created here +LL | x + | ^ + | + = note: pointers do not have a lifetime; after returning, the `u8` will be deallocated at the end of the function because nothing is referencing it as far as the type system is concerned + +warning: a dangling pointer will be produced because the local variable `x` will be dropped + --> $DIR/dangling-pointers-from-locals.rs:24:12 + | +LL | fn bindings_with_return() -> *const u8 { + | --------- return type of the function is `*const u8` +LL | let x = 42; + | - `x` is part the function and will be dropped at the end of the function +LL | let y = &x; + | -- dangling pointer created here +LL | return y; + | ^ + | + = note: pointers do not have a lifetime; after returning, the `u8` will be deallocated at the end of the function because nothing is referencing it as far as the type system is concerned + +warning: a dangling pointer will be produced because the local variable `x` will be dropped + --> $DIR/dangling-pointers-from-locals.rs:30:5 + | +LL | fn with_simple_cast() -> *const u8 { + | --------- return type of the function is `*const u8` +LL | let x = 0u8; + | - `x` is part the function and will be dropped at the end of the function +LL | &x as *const u8 + | --^^^^^^^^^^^^^ + | | + | dangling pointer created here + | + = note: pointers do not have a lifetime; after returning, the `u8` will be deallocated at the end of the function because nothing is referencing it as far as the type system is concerned + +warning: a dangling pointer will be produced because the local variable `x` will be dropped + --> $DIR/dangling-pointers-from-locals.rs:37:5 + | +LL | fn bindings_and_casts() -> *const u8 { + | --------- return type of the function is `*const u8` +LL | let x = 0u8; + | - `x` is part the function and will be dropped at the end of the function +LL | let x = &x as *const u8; + | -- dangling pointer created here +LL | x as *const u8 + | ^^^^^^^^^^^^^^ + | + = note: pointers do not have a lifetime; after returning, the `u8` will be deallocated at the end of the function because nothing is referencing it as far as the type system is concerned + +warning: a dangling pointer will be produced because the local variable `x` will be dropped + --> $DIR/dangling-pointers-from-locals.rs:43:12 + | +LL | fn return_with_complex_cast() -> *mut u8 { + | ------- return type of the function is `*mut u8` +LL | let mut x = 0u8; + | ----- `x` is part the function and will be dropped at the end of the function +LL | return &mut x as *mut u8 as *const u8 as *mut u8; + | ------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | | + | dangling pointer created here + | + = note: pointers do not have a lifetime; after returning, the `u8` will be deallocated at the end of the function because nothing is referencing it as far as the type system is concerned + +warning: a dangling pointer will be produced because the local variable `x` will be dropped + --> $DIR/dangling-pointers-from-locals.rs:49:5 + | +LL | fn with_block() -> *const u8 { + | --------- return type of the function is `*const u8` +LL | let x = 0; + | - `x` is part the function and will be dropped at the end of the function +LL | &{ x } + | ^^^^^^ + | + = note: pointers do not have a lifetime; after returning, the `u8` will be deallocated at the end of the function because nothing is referencing it as far as the type system is concerned + +warning: a dangling pointer will be produced because the local variable `x` will be dropped + --> $DIR/dangling-pointers-from-locals.rs:57:13 + | +LL | fn with_many_blocks() -> *const u8 { + | --------- return type of the function is `*const u8` +LL | let x = 0; + | - `x` is part the function and will be dropped at the end of the function +... +LL | / &{ +LL | | +LL | | { x } +LL | | } + | |_____________^ + | + = note: pointers do not have a lifetime; after returning, the `u8` will be deallocated at the end of the function because nothing is referencing it as far as the type system is concerned + +warning: a dangling pointer will be produced because the local variable `x` will be dropped + --> $DIR/dangling-pointers-from-locals.rs:67:12 + | +LL | fn simple_return() -> *const u8 { + | --------- return type of the function is `*const u8` +LL | let x = 0; + | - `x` is part the function and will be dropped at the end of the function +LL | return &x; + | ^^ + | + = note: pointers do not have a lifetime; after returning, the `u8` will be deallocated at the end of the function because nothing is referencing it as far as the type system is concerned + +warning: a dangling pointer will be produced because the local variable `x` will be dropped + --> $DIR/dangling-pointers-from-locals.rs:73:12 + | +LL | fn return_mut() -> *mut u8 { + | ------- return type of the function is `*mut u8` +LL | let mut x = 0; + | ----- `x` is part the function and will be dropped at the end of the function +LL | return &mut x; + | ^^^^^^ + | + = note: pointers do not have a lifetime; after returning, the `u8` will be deallocated at the end of the function because nothing is referencing it as far as the type system is concerned + +warning: a dangling pointer will be produced because the local variable `x` will be dropped + --> $DIR/dangling-pointers-from-locals.rs:80:16 + | +LL | fn const_and_flow() -> *const u8 { + | --------- return type of the function is `*const u8` +LL | if false { +LL | let x = 8; + | - `x` is part the function and will be dropped at the end of the function +LL | return &x; + | ^^ + | + = note: pointers do not have a lifetime; after returning, the `u8` will be deallocated at the end of the function because nothing is referencing it as far as the type system is concerned + +warning: a dangling pointer will be produced because the local variable `x` will be dropped + --> $DIR/dangling-pointers-from-locals.rs:88:5 + | +LL | fn vector<T: Default>() -> *const Vec<T> { + | ------------- return type of the function is `*const Vec<T>` +LL | let x = vec![T::default()]; + | - `x` is part the function and will be dropped at the end of the function +LL | &x + | ^^ + | + = note: pointers do not have a lifetime; after returning, the `Vec<T>` will be deallocated at the end of the function because nothing is referencing it as far as the type system is concerned + +warning: a dangling pointer will be produced because the local variable `x` will be dropped + --> $DIR/dangling-pointers-from-locals.rs:94:12 + | +LL | fn local_adt() -> *const Adt { + | ---------- return type of the function is `*const Adt` +LL | let x = Adt(5); + | - `x` is part the function and will be dropped at the end of the function +LL | return &x; + | ^^ + | + = note: pointers do not have a lifetime; after returning, the `Adt` will be deallocated at the end of the function because nothing is referencing it as far as the type system is concerned + +warning: a dangling pointer will be produced because the local variable `x` will be dropped + --> $DIR/dangling-pointers-from-locals.rs:101:16 + | +LL | let _x = || -> *const u8 { + | --------- return type of the closure is `*const u8` +LL | let x = 8; + | - `x` is part the closure and will be dropped at the end of the closure +LL | return &x; + | ^^ + | + = note: pointers do not have a lifetime; after returning, the `u8` will be deallocated at the end of the closure because nothing is referencing it as far as the type system is concerned + +warning: a dangling pointer will be produced because the local variable `x` will be dropped + --> $DIR/dangling-pointers-from-locals.rs:113:5 + | +LL | fn fn_ptr() -> *const fn() -> u8 { + | ----------------- return type of the function is `*const fn() -> u8` +... +LL | let x = ret_u8 as fn() -> u8; + | - `x` is part the function and will be dropped at the end of the function +LL | &x + | ^^ + | + = note: pointers do not have a lifetime; after returning, the `fn() -> u8` will be deallocated at the end of the function because nothing is referencing it as far as the type system is concerned + +warning: a dangling pointer will be produced because the local variable `a` will be dropped + --> $DIR/dangling-pointers-from-locals.rs:118:5 + | +LL | fn as_arg(a: Adt) -> *const Adt { + | - ---------- return type of the function is `*const Adt` + | | + | `a` is part the function and will be dropped at the end of the function +LL | &a + | ^^ + | + = note: pointers do not have a lifetime; after returning, the `Adt` will be deallocated at the end of the function because nothing is referencing it as far as the type system is concerned + +warning: a dangling pointer will be produced because the local variable `a` will be dropped + --> $DIR/dangling-pointers-from-locals.rs:123:5 + | +LL | fn fn_ptr_as_arg(a: fn() -> u8) -> *const fn() -> u8 { + | - ----------------- return type of the function is `*const fn() -> u8` + | | + | `a` is part the function and will be dropped at the end of the function +LL | &a + | ^^ + | + = note: pointers do not have a lifetime; after returning, the `fn() -> u8` will be deallocated at the end of the function because nothing is referencing it as far as the type system is concerned + +warning: a dangling pointer will be produced because the local variable `a` will be dropped + --> $DIR/dangling-pointers-from-locals.rs:128:5 + | +LL | fn ptr_as_arg(a: *const Adt) -> *const *const Adt { + | - ----------------- return type of the function is `*const *const Adt` + | | + | `a` is part the function and will be dropped at the end of the function +LL | &a + | ^^ + | + = note: pointers do not have a lifetime; after returning, the `*const Adt` will be deallocated at the end of the function because nothing is referencing it as far as the type system is concerned + +warning: a dangling pointer will be produced because the local variable `a` will be dropped + --> $DIR/dangling-pointers-from-locals.rs:133:5 + | +LL | fn adt_as_arg(a: &Adt) -> *const &Adt { + | - ----------- return type of the function is `*const &Adt` + | | + | `a` is part the function and will be dropped at the end of the function +LL | &a + | ^^ + | + = note: pointers do not have a lifetime; after returning, the `&Adt` will be deallocated at the end of the function because nothing is referencing it as far as the type system is concerned + +warning: 19 warnings emitted + diff --git a/tests/ui/lint/lint-non-uppercase-usages.stderr b/tests/ui/lint/lint-non-uppercase-usages.stderr index 7c7e573a88e..b34be31216d 100644 --- a/tests/ui/lint/lint-non-uppercase-usages.stderr +++ b/tests/ui/lint/lint-non-uppercase-usages.stderr @@ -29,7 +29,7 @@ warning: const parameter `foo` should have an upper case name LL | fn foo<const foo: u32>() { | ^^^ | -help: convert the identifier to upper case (notice the capitalization difference) +help: convert the identifier to upper case (notice the capitalization) | LL - fn foo<const foo: u32>() { LL + fn foo<const FOO: u32>() { diff --git a/tests/ui/lint/wide_pointer_comparisons.rs b/tests/ui/lint/wide_pointer_comparisons.rs index 05097cbf1e3..a5e3f4754b8 100644 --- a/tests/ui/lint/wide_pointer_comparisons.rs +++ b/tests/ui/lint/wide_pointer_comparisons.rs @@ -146,12 +146,10 @@ fn main() { { macro_rules! cmp { ($a:tt, $b:tt) => { $a == $b } + //~^ WARN ambiguous wide pointer comparison } - // FIXME: This lint uses some custom span combination logic. - // Rewrite it to adapt to the new metavariable span rules. cmp!(a, b); - //~^ WARN ambiguous wide pointer comparison } { diff --git a/tests/ui/lint/wide_pointer_comparisons.stderr b/tests/ui/lint/wide_pointer_comparisons.stderr index 4f5238e8252..4199ff62e2a 100644 --- a/tests/ui/lint/wide_pointer_comparisons.stderr +++ b/tests/ui/lint/wide_pointer_comparisons.stderr @@ -720,18 +720,20 @@ LL + std::ptr::eq(*a, *b) | warning: ambiguous wide pointer comparison, the comparison includes metadata which may not be expected - --> $DIR/wide_pointer_comparisons.rs:153:14 + --> $DIR/wide_pointer_comparisons.rs:148:33 | +LL | ($a:tt, $b:tt) => { $a == $b } + | ^^^^^^^^ +... LL | cmp!(a, b); - | ^^^^ - | -help: use `std::ptr::addr_eq` or untyped pointers to only compare their addresses + | ---------- in this macro invocation | -LL | cmp!(std::ptr::addr_eq(a, b)); - | ++++++++++++++++++ + + = help: use explicit `std::ptr::eq` method to compare metadata and addresses + = help: use `std::ptr::addr_eq` or untyped pointers to only compare their addresses + = note: this warning originates in the macro `cmp` (in Nightly builds, run with -Z macro-backtrace for more info) warning: ambiguous wide pointer comparison, the comparison includes metadata which may not be expected - --> $DIR/wide_pointer_comparisons.rs:159:39 + --> $DIR/wide_pointer_comparisons.rs:157:39 | LL | ($a:ident, $b:ident) => { $a == $b } | ^^^^^^^^ @@ -747,7 +749,7 @@ LL + ($a:ident, $b:ident) => { std::ptr::addr_eq($a, $b) } | warning: ambiguous wide pointer comparison, the comparison includes metadata which may not be expected - --> $DIR/wide_pointer_comparisons.rs:169:37 + --> $DIR/wide_pointer_comparisons.rs:167:37 | LL | ($a:expr, $b:expr) => { $a == $b } | ^^^^^^^^ diff --git a/tests/ui/loop-match/const-continue-to-block.rs b/tests/ui/loop-match/const-continue-to-block.rs index fd7ebeefeb6..a0f60aaec33 100644 --- a/tests/ui/loop-match/const-continue-to-block.rs +++ b/tests/ui/loop-match/const-continue-to-block.rs @@ -24,3 +24,24 @@ fn const_continue_to_block() -> u8 { } } } + +fn const_continue_to_shadowed_block() -> u8 { + let state = 0; + #[loop_match] + loop { + state = 'blk: { + match state { + 0 => { + #[const_continue] + break 'blk 1; + } + _ => 'blk: { + //~^ WARN label name `'blk` shadows a label name that is already in scope + #[const_continue] + break 'blk 2; + //~^ ERROR `#[const_continue]` must break to a labeled block that participates in a `#[loop_match]` + } + } + } + } +} diff --git a/tests/ui/loop-match/const-continue-to-block.stderr b/tests/ui/loop-match/const-continue-to-block.stderr index 3a5339a0394..f4e223bcff1 100644 --- a/tests/ui/loop-match/const-continue-to-block.stderr +++ b/tests/ui/loop-match/const-continue-to-block.stderr @@ -1,8 +1,23 @@ +warning: label name `'blk` shadows a label name that is already in scope + --> $DIR/const-continue-to-block.rs:38:22 + | +LL | state = 'blk: { + | ---- first declared here +... +LL | _ => 'blk: { + | ^^^^ label `'blk` already in scope + error: `#[const_continue]` must break to a labeled block that participates in a `#[loop_match]` --> $DIR/const-continue-to-block.rs:20:27 | LL | break 'b 2; | ^^ -error: aborting due to 1 previous error +error: `#[const_continue]` must break to a labeled block that participates in a `#[loop_match]` + --> $DIR/const-continue-to-block.rs:41:27 + | +LL | break 'blk 2; + | ^^^^ + +error: aborting due to 2 previous errors; 1 warning emitted diff --git a/tests/ui/loop-match/invalid.rs b/tests/ui/loop-match/invalid.rs index 0c47b1e0057..08eaf832f56 100644 --- a/tests/ui/loop-match/invalid.rs +++ b/tests/ui/loop-match/invalid.rs @@ -142,6 +142,25 @@ fn break_without_value_unit() { } } +fn break_without_label() { + let mut state = State::A; + let _ = { + #[loop_match] + loop { + state = 'blk: { + match state { + _ => { + #[const_continue] + break State::A; + //~^ ERROR unlabeled `break` inside of a labeled block + //~| ERROR a `#[const_continue]` must break to a label with a value + } + } + } + } + }; +} + fn arm_has_guard(cond: bool) { let mut state = State::A; #[loop_match] diff --git a/tests/ui/loop-match/invalid.stderr b/tests/ui/loop-match/invalid.stderr index 70f246caa9c..9e9796a2ea7 100644 --- a/tests/ui/loop-match/invalid.stderr +++ b/tests/ui/loop-match/invalid.stderr @@ -9,6 +9,12 @@ help: give the `break` a value of the expected type LL | break 'blk /* value */; | +++++++++++ +error[E0695]: unlabeled `break` inside of a labeled block + --> $DIR/invalid.rs:154:25 + | +LL | break State::A; + | ^^^^^^^^^^^^^^ `break` statements that would diverge to or through a labeled block need to bear a label + error: invalid update of the `#[loop_match]` state --> $DIR/invalid.rs:18:9 | @@ -80,14 +86,20 @@ error: a `#[const_continue]` must break to a label with a value LL | break 'blk; | ^^^^^^^^^^ +error: a `#[const_continue]` must break to a label with a value + --> $DIR/invalid.rs:154:25 + | +LL | break State::A; + | ^^^^^^^^^^^^^^ + error: match arms that are part of a `#[loop_match]` cannot have guards - --> $DIR/invalid.rs:155:29 + --> $DIR/invalid.rs:174:29 | LL | State::B if cond => break 'a, | ^^^^ error[E0004]: non-exhaustive patterns: `State::B` and `State::C` not covered - --> $DIR/invalid.rs:168:19 + --> $DIR/invalid.rs:187:19 | LL | match state { | ^^^^^ patterns `State::B` and `State::C` not covered @@ -110,12 +122,12 @@ LL ~ State::B | State::C => todo!(), | error[E0579]: lower range bound must be less than upper - --> $DIR/invalid.rs:185:17 + --> $DIR/invalid.rs:204:17 | LL | 4.0..3.0 => { | ^^^^^^^^ -error: aborting due to 14 previous errors +error: aborting due to 16 previous errors -Some errors have detailed explanations: E0004, E0308, E0579. +Some errors have detailed explanations: E0004, E0308, E0579, E0695. For more information about an error, try `rustc --explain E0004`. diff --git a/tests/ui/issues/issue-75704.rs b/tests/ui/loops/infinite-loop-simplify-cfg-75704.rs index 1672bf0b4c3..8bc5fba7a68 100644 --- a/tests/ui/issues/issue-75704.rs +++ b/tests/ui/loops/infinite-loop-simplify-cfg-75704.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/75704 // Caused an infinite loop during SimlifyCfg MIR transform previously. // //@ build-pass diff --git a/tests/ui/macros/assert-long-condition.run.stderr b/tests/ui/macros/assert-long-condition.run.stderr index c2c5fe5d7d5..a9fac037143 100644 --- a/tests/ui/macros/assert-long-condition.run.stderr +++ b/tests/ui/macros/assert-long-condition.run.stderr @@ -1,5 +1,5 @@ -thread 'main' panicked at $DIR/assert-long-condition.rs:7:5: +thread 'main' ($TID) panicked at $DIR/assert-long-condition.rs:7:5: assertion failed: 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17 + 18 + 19 + 20 + 21 + 22 + 23 + 24 + 25 == 0 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace diff --git a/tests/ui/macros/builtin-std-paths-fail.stderr b/tests/ui/macros/builtin-std-paths-fail.stderr index 49034c3987b..85d2bd2132f 100644 --- a/tests/ui/macros/builtin-std-paths-fail.stderr +++ b/tests/ui/macros/builtin-std-paths-fail.stderr @@ -104,8 +104,8 @@ LL | #[std::test] | note: found an item that was configured out --> $SRC_DIR/std/src/lib.rs:LL:COL -note: the item is gated here - --> $SRC_DIR/std/src/lib.rs:LL:COL + | + = note: the item is gated here error: aborting due to 16 previous errors diff --git a/tests/ui/issues/issue-26093.rs b/tests/ui/macros/invalid-assignment-in-macro-26093.rs index c838515caf9..686a13a3eec 100644 --- a/tests/ui/issues/issue-26093.rs +++ b/tests/ui/macros/invalid-assignment-in-macro-26093.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/26093 macro_rules! not_a_place { ($thing:expr) => { $thing = 42; diff --git a/tests/ui/issues/issue-26093.stderr b/tests/ui/macros/invalid-assignment-in-macro-26093.stderr index 1a08d0fef41..99f188c7183 100644 --- a/tests/ui/issues/issue-26093.stderr +++ b/tests/ui/macros/invalid-assignment-in-macro-26093.stderr @@ -1,5 +1,5 @@ error[E0070]: invalid left-hand side of assignment - --> $DIR/issue-26093.rs:3:16 + --> $DIR/invalid-assignment-in-macro-26093.rs:4:16 | LL | $thing = 42; | ^ @@ -13,7 +13,7 @@ LL | not_a_place!(99); = note: this error originates in the macro `not_a_place` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0067]: invalid left-hand side of assignment - --> $DIR/issue-26093.rs:5:16 + --> $DIR/invalid-assignment-in-macro-26093.rs:6:16 | LL | $thing += 42; | ^^ diff --git a/tests/ui/macros/macro-inner-attributes.stderr b/tests/ui/macros/macro-inner-attributes.stderr index d74b64db5ac..3c043c38abb 100644 --- a/tests/ui/macros/macro-inner-attributes.stderr +++ b/tests/ui/macros/macro-inner-attributes.stderr @@ -4,6 +4,13 @@ error[E0433]: failed to resolve: use of unresolved module or unlinked crate `a` LL | a::bar(); | ^ use of unresolved module or unlinked crate `a` | +note: found an item that was configured out + --> $DIR/macro-inner-attributes.rs:7:7 + | +LL | test!(a, + | ^ +LL | #[cfg(false)], + | ----- the item is gated here help: there is a crate or module with a similar name | LL - a::bar(); diff --git a/tests/ui/macros/macro-outer-attributes.stderr b/tests/ui/macros/macro-outer-attributes.stderr index 9215754d4bb..4696bb774e3 100644 --- a/tests/ui/macros/macro-outer-attributes.stderr +++ b/tests/ui/macros/macro-outer-attributes.stderr @@ -7,13 +7,10 @@ LL | a::bar(); note: found an item that was configured out --> $DIR/macro-outer-attributes.rs:9:14 | +LL | #[cfg(false)], + | ----- the item is gated here LL | pub fn bar() { }); | ^^^ -note: the item is gated here - --> $DIR/macro-outer-attributes.rs:8:13 - | -LL | #[cfg(false)], - | ^^^^^ help: consider importing this function | LL + use b::bar; diff --git a/tests/ui/issues/issue-11844.rs b/tests/ui/match/option-result-mismatch-11844.rs index f974a470296..24a2004134d 100644 --- a/tests/ui/issues/issue-11844.rs +++ b/tests/ui/match/option-result-mismatch-11844.rs @@ -1,3 +1,5 @@ +//! Regression test for https://github.com/rust-lang/rust/issues/11844 + fn main() { let a = Some(Box::new(1)); match a { diff --git a/tests/ui/issues/issue-11844.stderr b/tests/ui/match/option-result-mismatch-11844.stderr index 9ff66eaef49..8a84b7b8a48 100644 --- a/tests/ui/issues/issue-11844.stderr +++ b/tests/ui/match/option-result-mismatch-11844.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/issue-11844.rs:4:9 + --> $DIR/option-result-mismatch-11844.rs:6:9 | LL | match a { | - this expression has type `Option<Box<{integer}>>` diff --git a/tests/ui/issues/issue-13466.rs b/tests/ui/match/option-result-type-param-mismatch-13466.rs index 78ce4c1d2f6..05dbdfdee0e 100644 --- a/tests/ui/issues/issue-13466.rs +++ b/tests/ui/match/option-result-type-param-mismatch-13466.rs @@ -1,3 +1,5 @@ +//! Regression test for https://github.com/rust-lang/rust/issues/13466 + // Regression test for #13466 //@ dont-require-annotations: NOTE diff --git a/tests/ui/issues/issue-13466.stderr b/tests/ui/match/option-result-type-param-mismatch-13466.stderr index 68a555a1626..b0cf1591f5e 100644 --- a/tests/ui/issues/issue-13466.stderr +++ b/tests/ui/match/option-result-type-param-mismatch-13466.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/issue-13466.rs:10:9 + --> $DIR/option-result-type-param-mismatch-13466.rs:12:9 | LL | let _x: usize = match Some(1) { | ------- this expression has type `Option<{integer}>` @@ -10,7 +10,7 @@ LL | Ok(u) => u, found enum `Result<_, _>` error[E0308]: mismatched types - --> $DIR/issue-13466.rs:16:9 + --> $DIR/option-result-type-param-mismatch-13466.rs:18:9 | LL | let _x: usize = match Some(1) { | ------- this expression has type `Option<{integer}>` diff --git a/tests/ui/issues/issue-13027.rs b/tests/ui/match/overeager-sub-match-pruning-13027.rs index fbd1d75067b..c4feb697f7d 100644 --- a/tests/ui/issues/issue-13027.rs +++ b/tests/ui/match/overeager-sub-match-pruning-13027.rs @@ -1,3 +1,5 @@ +//! Regression test for https://github.com/rust-lang/rust/issues/13027 + //@ run-pass // Tests that match expression handles overlapped literal and range diff --git a/tests/ui/issues/issue-12567.rs b/tests/ui/match/slice-move-out-error-12567.rs index 1b2a37de475..3f9bf9c76cf 100644 --- a/tests/ui/issues/issue-12567.rs +++ b/tests/ui/match/slice-move-out-error-12567.rs @@ -1,3 +1,5 @@ +//! Regression test for https://github.com/rust-lang/rust/issues/12567 + fn match_vecs<'a, T>(l1: &'a [T], l2: &'a [T]) { match (l1, l2) { //~^ ERROR: cannot move out of type `[T]`, a non-copy slice diff --git a/tests/ui/issues/issue-12567.stderr b/tests/ui/match/slice-move-out-error-12567.stderr index 0b19299ece3..ab5377d4701 100644 --- a/tests/ui/issues/issue-12567.stderr +++ b/tests/ui/match/slice-move-out-error-12567.stderr @@ -1,5 +1,5 @@ error[E0508]: cannot move out of type `[T]`, a non-copy slice - --> $DIR/issue-12567.rs:2:11 + --> $DIR/slice-move-out-error-12567.rs:4:11 | LL | match (l1, l2) { | ^^^^^^^^ cannot move out of here @@ -23,7 +23,7 @@ LL + (&[hd1, ..], [hd2, ..]) | error[E0508]: cannot move out of type `[T]`, a non-copy slice - --> $DIR/issue-12567.rs:2:11 + --> $DIR/slice-move-out-error-12567.rs:4:11 | LL | match (l1, l2) { | ^^^^^^^^ cannot move out of here diff --git a/tests/ui/issues/issue-12285.rs b/tests/ui/match/struct-reference-patterns-12285.rs index fe199147128..246e230b0de 100644 --- a/tests/ui/issues/issue-12285.rs +++ b/tests/ui/match/struct-reference-patterns-12285.rs @@ -1,3 +1,5 @@ +//! Regression test for https://github.com/rust-lang/rust/issues/12285 + //@ run-pass struct S; diff --git a/tests/ui/issues/issue-19100.fixed b/tests/ui/match/unreachable-pattern-if-variant-not-imported-19100.fixed index 1162490048c..40c92322519 100644 --- a/tests/ui/issues/issue-19100.fixed +++ b/tests/ui/match/unreachable-pattern-if-variant-not-imported-19100.fixed @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/19100 //@ run-rustfix #![allow(non_snake_case)] diff --git a/tests/ui/issues/issue-19100.rs b/tests/ui/match/unreachable-pattern-if-variant-not-imported-19100.rs index fefed0daa72..9ef6fd77b50 100644 --- a/tests/ui/issues/issue-19100.rs +++ b/tests/ui/match/unreachable-pattern-if-variant-not-imported-19100.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/19100 //@ run-rustfix #![allow(non_snake_case)] diff --git a/tests/ui/issues/issue-19100.stderr b/tests/ui/match/unreachable-pattern-if-variant-not-imported-19100.stderr index ebbf083b7de..7356a4a003b 100644 --- a/tests/ui/issues/issue-19100.stderr +++ b/tests/ui/match/unreachable-pattern-if-variant-not-imported-19100.stderr @@ -1,5 +1,5 @@ error[E0170]: pattern binding `Bar` is named the same as one of the variants of the type `Foo` - --> $DIR/issue-19100.rs:17:1 + --> $DIR/unreachable-pattern-if-variant-not-imported-19100.rs:18:1 | LL | Bar if true | ^^^ help: to match on the variant, qualify the path: `Foo::Bar` @@ -7,7 +7,7 @@ LL | Bar if true = note: `#[deny(bindings_with_variant_name)]` on by default error[E0170]: pattern binding `Baz` is named the same as one of the variants of the type `Foo` - --> $DIR/issue-19100.rs:21:1 + --> $DIR/unreachable-pattern-if-variant-not-imported-19100.rs:22:1 | LL | Baz if false | ^^^ help: to match on the variant, qualify the path: `Foo::Baz` diff --git a/tests/ui/issues/issue-22684.rs b/tests/ui/methods/trait-method-resolution-over-inherent-22684.rs index a5b042706ed..9f317b576e6 100644 --- a/tests/ui/issues/issue-22684.rs +++ b/tests/ui/methods/trait-method-resolution-over-inherent-22684.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/22684 mod foo { pub struct Foo; impl Foo { diff --git a/tests/ui/issues/issue-22684.stderr b/tests/ui/methods/trait-method-resolution-over-inherent-22684.stderr index e2ca54caeac..0ab7701fa9e 100644 --- a/tests/ui/issues/issue-22684.stderr +++ b/tests/ui/methods/trait-method-resolution-over-inherent-22684.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/issue-22684.rs:17:17 + --> $DIR/trait-method-resolution-over-inherent-22684.rs:18:17 | LL | let _: () = foo::Foo.bar(); | -- ^^^^^^^^^^^^^^ expected `()`, found `bool` diff --git a/tests/ui/mir/lint/storage-live.rs b/tests/ui/mir/lint/storage-live.rs index 252e3b8456c..32bd32754dd 100644 --- a/tests/ui/mir/lint/storage-live.rs +++ b/tests/ui/mir/lint/storage-live.rs @@ -1,7 +1,7 @@ //@ compile-flags: -Zlint-mir -Ztreat-err-as-bug //@ failure-status: 101 //@ normalize-stderr: "note: .*\n\n" -> "" -//@ normalize-stderr: "thread 'rustc' panicked.*\n" -> "" +//@ normalize-stderr: "thread 'rustc'.*panicked.*\n" -> "" //@ normalize-stderr: "storage_live\[....\]" -> "storage_live[HASH]" //@ normalize-stderr: "(delayed at [^:]+):\d+:\d+ - " -> "$1:LL:CC - " //@ rustc-env:RUST_BACKTRACE=0 diff --git a/tests/ui/issues/issue-24352.rs b/tests/ui/mismatched_types/float-integer-subtraction-error-24352.rs index 5c8246d179f..eb632398c62 100644 --- a/tests/ui/issues/issue-24352.rs +++ b/tests/ui/mismatched_types/float-integer-subtraction-error-24352.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/24352 fn main() { 1.0f64 - 1.0; 1.0f64 - 1 //~ ERROR E0277 diff --git a/tests/ui/issues/issue-24352.stderr b/tests/ui/mismatched_types/float-integer-subtraction-error-24352.stderr index 3e0f812b5c7..7dc1fa777fc 100644 --- a/tests/ui/issues/issue-24352.stderr +++ b/tests/ui/mismatched_types/float-integer-subtraction-error-24352.stderr @@ -1,5 +1,5 @@ error[E0277]: cannot subtract `{integer}` from `f64` - --> $DIR/issue-24352.rs:3:12 + --> $DIR/float-integer-subtraction-error-24352.rs:4:12 | LL | 1.0f64 - 1 | ^ no implementation for `f64 - {integer}` diff --git a/tests/ui/issues/issue-50585.rs b/tests/ui/mismatched_types/for-loop-in-vec-type-mismatchrs-50585.rs index ca2ece8d53b..4abef0bee81 100644 --- a/tests/ui/issues/issue-50585.rs +++ b/tests/ui/mismatched_types/for-loop-in-vec-type-mismatchrs-50585.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/50585 fn main() { |y: Vec<[(); for x in 0..2 {}]>| {}; //~^ ERROR mismatched types diff --git a/tests/ui/issues/issue-50585.stderr b/tests/ui/mismatched_types/for-loop-in-vec-type-mismatchrs-50585.stderr index 7e83ea35fbb..d60d97a02ab 100644 --- a/tests/ui/issues/issue-50585.stderr +++ b/tests/ui/mismatched_types/for-loop-in-vec-type-mismatchrs-50585.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/issue-50585.rs:2:18 + --> $DIR/for-loop-in-vec-type-mismatchrs-50585.rs:3:18 | LL | |y: Vec<[(); for x in 0..2 {}]>| {}; | ^^^^^^^^^^^^^^^^ expected `usize`, found `()` diff --git a/tests/ui/issues/issue-48364.rs b/tests/ui/mismatched_types/starts-with-stringify-type-mismatch-48364.rs index 14ee75e7c9c..13ba8b1e59c 100644 --- a/tests/ui/issues/issue-48364.rs +++ b/tests/ui/mismatched_types/starts-with-stringify-type-mismatch-48364.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/48364 fn foo() -> bool { b"".starts_with(stringify!(foo)) //~^ ERROR mismatched types diff --git a/tests/ui/issues/issue-48364.stderr b/tests/ui/mismatched_types/starts-with-stringify-type-mismatch-48364.stderr index 74bfa1e0693..bb767d50bb0 100644 --- a/tests/ui/issues/issue-48364.stderr +++ b/tests/ui/mismatched_types/starts-with-stringify-type-mismatch-48364.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/issue-48364.rs:2:21 + --> $DIR/starts-with-stringify-type-mismatch-48364.rs:3:21 | LL | b"".starts_with(stringify!(foo)) | ----------- ^^^^^^^^^^^^^^^ expected `&[u8]`, found `&str` diff --git a/tests/ui/missing/missing-items/missing-type-parameter2.rs b/tests/ui/missing/missing-items/missing-type-parameter2.rs index e9b32fb7198..772e60b1376 100644 --- a/tests/ui/missing/missing-items/missing-type-parameter2.rs +++ b/tests/ui/missing/missing-items/missing-type-parameter2.rs @@ -5,7 +5,7 @@ impl X<N> {} //~| ERROR unresolved item provided when a constant was expected impl<T, const A: u8 = 2> X<N> {} //~^ ERROR cannot find type `N` in this scope -//~| ERROR defaults for const parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions +//~| ERROR defaults for generic parameters are not allowed here //~| ERROR unresolved item provided when a constant was expected fn foo(_: T) where T: Send {} diff --git a/tests/ui/missing/missing-items/missing-type-parameter2.stderr b/tests/ui/missing/missing-items/missing-type-parameter2.stderr index f6418de20b6..3c132e769ea 100644 --- a/tests/ui/missing/missing-items/missing-type-parameter2.stderr +++ b/tests/ui/missing/missing-items/missing-type-parameter2.stderr @@ -103,7 +103,7 @@ help: if this generic argument was intended as a const parameter, surround it wi LL | impl X<{ N }> {} | + + -error: defaults for const parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions +error: defaults for generic parameters are not allowed here --> $DIR/missing-type-parameter2.rs:6:9 | LL | impl<T, const A: u8 = 2> X<N> {} diff --git a/tests/ui/issues/issue-32797.rs b/tests/ui/modules/circular-module-imports-32797.rs index 470d661cb28..5a2f2990795 100644 --- a/tests/ui/issues/issue-32797.rs +++ b/tests/ui/modules/circular-module-imports-32797.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/32797 //@ check-pass pub use bar::*; diff --git a/tests/ui/issues/issue-17385.rs b/tests/ui/moves/matching-partially-moved-value-17385.rs index 7400aadb059..c50fe048bfb 100644 --- a/tests/ui/issues/issue-17385.rs +++ b/tests/ui/moves/matching-partially-moved-value-17385.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/17385 struct X(isize); enum Enum { diff --git a/tests/ui/issues/issue-17385.stderr b/tests/ui/moves/matching-partially-moved-value-17385.stderr index 3c451a859e9..906f7868bcc 100644 --- a/tests/ui/issues/issue-17385.stderr +++ b/tests/ui/moves/matching-partially-moved-value-17385.stderr @@ -1,5 +1,5 @@ error[E0382]: use of moved value: `foo` - --> $DIR/issue-17385.rs:18:5 + --> $DIR/matching-partially-moved-value-17385.rs:19:5 | LL | let foo = X(1); | --- move occurs because `foo` has type `X`, which does not implement the `Copy` trait @@ -9,7 +9,7 @@ LL | match foo { | ^^^^^^^^^ value used here after move | note: if `X` implemented `Clone`, you could clone the value - --> $DIR/issue-17385.rs:1:1 + --> $DIR/matching-partially-moved-value-17385.rs:2:1 | LL | struct X(isize); | ^^^^^^^^ consider implementing `Clone` for this type @@ -18,7 +18,7 @@ LL | drop(foo); | --- you could clone this value error[E0382]: use of moved value: `e` - --> $DIR/issue-17385.rs:25:11 + --> $DIR/matching-partially-moved-value-17385.rs:26:11 | LL | let e = Enum::Variant2; | - move occurs because `e` has type `Enum`, which does not implement the `Copy` trait @@ -28,7 +28,7 @@ LL | match e { | ^ value used here after move | note: if `Enum` implemented `Clone`, you could clone the value - --> $DIR/issue-17385.rs:3:1 + --> $DIR/matching-partially-moved-value-17385.rs:4:1 | LL | enum Enum { | ^^^^^^^^^ consider implementing `Clone` for this type diff --git a/tests/ui/nll/issue-51345-2.rs b/tests/ui/nll/issue-51345-2.rs index 39871d56a9a..6c424d436f1 100644 --- a/tests/ui/nll/issue-51345-2.rs +++ b/tests/ui/nll/issue-51345-2.rs @@ -1,6 +1,6 @@ //@ run-fail -//@ error-pattern:thread 'main' panicked -//@ error-pattern:explicit panic +//@ regex-error-pattern: thread 'main'.*panicked +//@ error-pattern: explicit panic //@ needs-subprocess fn main() { diff --git a/tests/ui/issues/issue-32805.rs b/tests/ui/numbers-arithmetic/f32-literal-rounding-32805.rs index 717c00a248a..59efdb9a1aa 100644 --- a/tests/ui/issues/issue-32805.rs +++ b/tests/ui/numbers-arithmetic/f32-literal-rounding-32805.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/32805 //@ run-pass fn const_mir() -> f32 { 9007199791611905.0 } diff --git a/tests/ui/numbers-arithmetic/overflowing-add.rs b/tests/ui/numbers-arithmetic/overflowing-add.rs index c1f498c802b..a63fc3bccf1 100644 --- a/tests/ui/numbers-arithmetic/overflowing-add.rs +++ b/tests/ui/numbers-arithmetic/overflowing-add.rs @@ -1,6 +1,6 @@ //@ run-fail -//@ error-pattern:thread 'main' panicked -//@ error-pattern:attempt to add with overflow +//@ regex-error-pattern: thread 'main'.*panicked +//@ error-pattern: attempt to add with overflow //@ compile-flags: -C debug-assertions //@ needs-subprocess diff --git a/tests/ui/numbers-arithmetic/overflowing-mul.rs b/tests/ui/numbers-arithmetic/overflowing-mul.rs index 0eece536929..2645a32d5ad 100644 --- a/tests/ui/numbers-arithmetic/overflowing-mul.rs +++ b/tests/ui/numbers-arithmetic/overflowing-mul.rs @@ -1,6 +1,6 @@ //@ run-fail -//@ error-pattern:thread 'main' panicked -//@ error-pattern:attempt to multiply with overflow +//@ regex-error-pattern: thread 'main'.*panicked +//@ error-pattern: attempt to multiply with overflow //@ needs-subprocess //@ compile-flags: -C debug-assertions diff --git a/tests/ui/numbers-arithmetic/overflowing-pow-signed.rs b/tests/ui/numbers-arithmetic/overflowing-pow-signed.rs index 28deb7cf6ba..6db6682e16f 100644 --- a/tests/ui/numbers-arithmetic/overflowing-pow-signed.rs +++ b/tests/ui/numbers-arithmetic/overflowing-pow-signed.rs @@ -1,6 +1,6 @@ //@ run-fail -//@ error-pattern:thread 'main' panicked -//@ error-pattern:attempt to multiply with overflow +//@ regex-error-pattern: thread 'main'.*panicked +//@ error-pattern: attempt to multiply with overflow //@ needs-subprocess //@ compile-flags: -C debug-assertions diff --git a/tests/ui/numbers-arithmetic/overflowing-pow-unsigned.rs b/tests/ui/numbers-arithmetic/overflowing-pow-unsigned.rs index dea9a4d5428..bde0de6f6f5 100644 --- a/tests/ui/numbers-arithmetic/overflowing-pow-unsigned.rs +++ b/tests/ui/numbers-arithmetic/overflowing-pow-unsigned.rs @@ -1,6 +1,6 @@ //@ run-fail -//@ error-pattern:thread 'main' panicked -//@ error-pattern:attempt to multiply with overflow +//@ regex-error-pattern: thread 'main'.*panicked +//@ error-pattern: attempt to multiply with overflow //@ needs-subprocess //@ compile-flags: -C debug-assertions diff --git a/tests/ui/numbers-arithmetic/overflowing-sub.rs b/tests/ui/numbers-arithmetic/overflowing-sub.rs index 88b1b693f63..1718fccad7a 100644 --- a/tests/ui/numbers-arithmetic/overflowing-sub.rs +++ b/tests/ui/numbers-arithmetic/overflowing-sub.rs @@ -1,6 +1,6 @@ //@ run-fail -//@ error-pattern:thread 'main' panicked -//@ error-pattern:attempt to subtract with overflow +//@ regex-error-pattern: thread 'main'.*panicked +//@ error-pattern: attempt to subtract with overflow //@ needs-subprocess //@ compile-flags: -C debug-assertions diff --git a/tests/ui/panics/fmt-only-once.run.stderr b/tests/ui/panics/fmt-only-once.run.stderr index faa3cc91151..f0124e4cb77 100644 --- a/tests/ui/panics/fmt-only-once.run.stderr +++ b/tests/ui/panics/fmt-only-once.run.stderr @@ -1,5 +1,5 @@ fmt -thread 'main' panicked at $DIR/fmt-only-once.rs:20:5: +thread 'main' ($TID) panicked at $DIR/fmt-only-once.rs:20:5: PrintOnFmt note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace diff --git a/tests/ui/panics/issue-47429-short-backtraces.run.stderr b/tests/ui/panics/issue-47429-short-backtraces.run.stderr index 32dc6592271..13b59a7c7af 100644 --- a/tests/ui/panics/issue-47429-short-backtraces.run.stderr +++ b/tests/ui/panics/issue-47429-short-backtraces.run.stderr @@ -1,5 +1,5 @@ -thread 'main' panicked at $DIR/issue-47429-short-backtraces.rs:24:5: +thread 'main' ($TID) panicked at $DIR/issue-47429-short-backtraces.rs:24:5: explicit panic stack backtrace: 0: std::panicking::begin_panic diff --git a/tests/ui/panics/location-detail-panic-no-column.run.stderr b/tests/ui/panics/location-detail-panic-no-column.run.stderr index f63c09652b8..8f43936a0af 100644 --- a/tests/ui/panics/location-detail-panic-no-column.run.stderr +++ b/tests/ui/panics/location-detail-panic-no-column.run.stderr @@ -1,4 +1,4 @@ -thread 'main' panicked at $DIR/location-detail-panic-no-column.rs:7:0: +thread 'main' ($TID) panicked at $DIR/location-detail-panic-no-column.rs:7:0: column-redacted note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace diff --git a/tests/ui/panics/location-detail-panic-no-file.run.stderr b/tests/ui/panics/location-detail-panic-no-file.run.stderr index 3d1c6defa31..8d0ee148006 100644 --- a/tests/ui/panics/location-detail-panic-no-file.run.stderr +++ b/tests/ui/panics/location-detail-panic-no-file.run.stderr @@ -1,4 +1,4 @@ -thread 'main' panicked at <redacted>:7:5: +thread 'main' ($TID) panicked at <redacted>:7:5: file-redacted note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace diff --git a/tests/ui/panics/location-detail-panic-no-line.run.stderr b/tests/ui/panics/location-detail-panic-no-line.run.stderr index 9809ab5e2b4..79f5c012b8a 100644 --- a/tests/ui/panics/location-detail-panic-no-line.run.stderr +++ b/tests/ui/panics/location-detail-panic-no-line.run.stderr @@ -1,4 +1,4 @@ -thread 'main' panicked at $DIR/location-detail-panic-no-line.rs:0:5: +thread 'main' ($TID) panicked at $DIR/location-detail-panic-no-line.rs:0:5: line-redacted note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace diff --git a/tests/ui/panics/location-detail-panic-no-location-info.run.stderr b/tests/ui/panics/location-detail-panic-no-location-info.run.stderr index f68a0d663c0..12b3e1b53e3 100644 --- a/tests/ui/panics/location-detail-panic-no-location-info.run.stderr +++ b/tests/ui/panics/location-detail-panic-no-location-info.run.stderr @@ -1,4 +1,4 @@ -thread 'main' panicked at <redacted>:0:0: +thread 'main' ($TID) panicked at <redacted>:0:0: no location info note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace diff --git a/tests/ui/panics/location-detail-unwrap-no-file.run.stderr b/tests/ui/panics/location-detail-unwrap-no-file.run.stderr index af4a4997fae..a4a87423cdc 100644 --- a/tests/ui/panics/location-detail-unwrap-no-file.run.stderr +++ b/tests/ui/panics/location-detail-unwrap-no-file.run.stderr @@ -1,4 +1,4 @@ -thread 'main' panicked at <redacted>:8:9: +thread 'main' ($TID) panicked at <redacted>:8:9: called `Option::unwrap()` on a `None` value note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace diff --git a/tests/ui/panics/main-panic.rs b/tests/ui/panics/main-panic.rs index 0b3d5c3aaec..9f2a92da90f 100644 --- a/tests/ui/panics/main-panic.rs +++ b/tests/ui/panics/main-panic.rs @@ -1,5 +1,5 @@ //@ run-fail -//@ error-pattern:thread 'main' panicked at +//@ regex-error-pattern: thread 'main' \(\d+\) panicked at //@ needs-subprocess fn main() { diff --git a/tests/ui/panics/panic-in-cleanup.run.stderr b/tests/ui/panics/panic-in-cleanup.run.stderr index 34383562c36..bfe3dc8c9d7 100644 --- a/tests/ui/panics/panic-in-cleanup.run.stderr +++ b/tests/ui/panics/panic-in-cleanup.run.stderr @@ -1,12 +1,12 @@ -thread 'main' panicked at $DIR/panic-in-cleanup.rs:22:5: +thread 'main' ($TID) panicked at $DIR/panic-in-cleanup.rs:22:5: explicit panic note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace -thread 'main' panicked at $DIR/panic-in-cleanup.rs:16:9: +thread 'main' ($TID) panicked at $DIR/panic-in-cleanup.rs:16:9: BOOM stack backtrace: -thread 'main' panicked at library/core/src/panicking.rs:$LINE:$COL: +thread 'main' ($TID) panicked at library/core/src/panicking.rs:$LINE:$COL: panic in a destructor during cleanup thread caused non-unwinding panic. aborting. diff --git a/tests/ui/panics/panic-in-ffi.run.stderr b/tests/ui/panics/panic-in-ffi.run.stderr index a6f3ebe5657..ce907d64358 100644 --- a/tests/ui/panics/panic-in-ffi.run.stderr +++ b/tests/ui/panics/panic-in-ffi.run.stderr @@ -1,10 +1,10 @@ -thread 'main' panicked at $DIR/panic-in-ffi.rs:21:5: +thread 'main' ($TID) panicked at $DIR/panic-in-ffi.rs:21:5: Test note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace Noisy Drop -thread 'main' panicked at library/core/src/panicking.rs:$LINE:$COL: +thread 'main' ($TID) panicked at library/core/src/panicking.rs:$LINE:$COL: panic in a function that cannot unwind stack backtrace: thread caused non-unwinding panic. aborting. diff --git a/tests/ui/panics/panic-set-unset-handler.rs b/tests/ui/panics/panic-set-unset-handler.rs index 66d5003d0f1..4f646020037 100644 --- a/tests/ui/panics/panic-set-unset-handler.rs +++ b/tests/ui/panics/panic-set-unset-handler.rs @@ -1,6 +1,6 @@ //@ run-fail -//@ error-pattern:thread 'main' panicked -//@ error-pattern:foobar +//@ regex-error-pattern: thread 'main' \(\d+\) panicked +//@ error-pattern: foobar //@ needs-subprocess use std::panic; diff --git a/tests/ui/panics/panic-short-backtrace-windows-x86_64.run.stderr b/tests/ui/panics/panic-short-backtrace-windows-x86_64.run.stderr index 799a8b30e99..c3c1ce16a4b 100644 --- a/tests/ui/panics/panic-short-backtrace-windows-x86_64.run.stderr +++ b/tests/ui/panics/panic-short-backtrace-windows-x86_64.run.stderr @@ -1,4 +1,4 @@ -thread 'main' panicked at 'd was called', $DIR/panic-short-backtrace-windows-x86_64.rs:48:5 +thread 'main' ($TID) panicked at 'd was called', $DIR/panic-short-backtrace-windows-x86_64.rs:48:5 stack backtrace: 0: std::panicking::begin_panic 1: d diff --git a/tests/ui/panics/panic-take-handler-nop.rs b/tests/ui/panics/panic-take-handler-nop.rs index f10582872df..ebea3ef0685 100644 --- a/tests/ui/panics/panic-take-handler-nop.rs +++ b/tests/ui/panics/panic-take-handler-nop.rs @@ -1,6 +1,6 @@ //@ run-fail -//@ error-pattern:thread 'main' panicked -//@ error-pattern:foobar +//@ regex-error-pattern: thread 'main' \(\d+\) panicked +//@ error-pattern: foobar //@ needs-subprocess use std::panic; diff --git a/tests/ui/panics/panic-task-name-none.rs b/tests/ui/panics/panic-task-name-none.rs index 8695771ff5e..4471cd6795c 100644 --- a/tests/ui/panics/panic-task-name-none.rs +++ b/tests/ui/panics/panic-task-name-none.rs @@ -1,14 +1,14 @@ //@ run-fail -//@ error-pattern:thread '<unnamed>' panicked -//@ error-pattern:test +//@ regex-error-pattern: thread '<unnamed>' \(\d+\) panicked +//@ error-pattern: test //@ needs-threads use std::thread; fn main() { let r: Result<(), _> = thread::spawn(move || { - panic!("test"); - }) - .join(); + panic!("test"); + }) + .join(); assert!(r.is_ok()); } diff --git a/tests/ui/panics/panic-task-name-owned.rs b/tests/ui/panics/panic-task-name-owned.rs index 42ae33b5d35..084ac90512a 100644 --- a/tests/ui/panics/panic-task-name-owned.rs +++ b/tests/ui/panics/panic-task-name-owned.rs @@ -1,19 +1,19 @@ //@ run-fail -//@ error-pattern:thread 'owned name' panicked -//@ error-pattern:test +//@ regex-error-pattern: thread 'owned name' \(\d+\) panicked +//@ error-pattern: test //@ needs-threads use std::thread::Builder; fn main() { let r: () = Builder::new() - .name("owned name".to_string()) - .spawn(move || { - panic!("test"); - () - }) - .unwrap() - .join() - .unwrap(); + .name("owned name".to_string()) + .spawn(move || { + panic!("test"); + () + }) + .unwrap() + .join() + .unwrap(); panic!(); } diff --git a/tests/ui/panics/runtime-switch.run.stderr b/tests/ui/panics/runtime-switch.run.stderr index 70ed127af86..f3f60445952 100644 --- a/tests/ui/panics/runtime-switch.run.stderr +++ b/tests/ui/panics/runtime-switch.run.stderr @@ -1,5 +1,5 @@ -thread 'main' panicked at $DIR/runtime-switch.rs:28:5: +thread 'main' ($TID) panicked at $DIR/runtime-switch.rs:28:5: explicit panic stack backtrace: 0: std::panicking::begin_panic diff --git a/tests/ui/panics/short-ice-remove-middle-frames-2.run.stderr b/tests/ui/panics/short-ice-remove-middle-frames-2.run.stderr index 664d51e185d..584b477f3a7 100644 --- a/tests/ui/panics/short-ice-remove-middle-frames-2.run.stderr +++ b/tests/ui/panics/short-ice-remove-middle-frames-2.run.stderr @@ -1,5 +1,5 @@ -thread 'main' panicked at $DIR/short-ice-remove-middle-frames-2.rs:62:5: +thread 'main' ($TID) panicked at $DIR/short-ice-remove-middle-frames-2.rs:62:5: debug!!! stack backtrace: 0: std::panicking::begin_panic diff --git a/tests/ui/panics/short-ice-remove-middle-frames.run.stderr b/tests/ui/panics/short-ice-remove-middle-frames.run.stderr index e966462331f..1efcb7d5304 100644 --- a/tests/ui/panics/short-ice-remove-middle-frames.run.stderr +++ b/tests/ui/panics/short-ice-remove-middle-frames.run.stderr @@ -1,5 +1,5 @@ -thread 'main' panicked at $DIR/short-ice-remove-middle-frames.rs:58:5: +thread 'main' ($TID) panicked at $DIR/short-ice-remove-middle-frames.rs:58:5: debug!!! stack backtrace: 0: std::panicking::begin_panic diff --git a/tests/ui/parser/attribute-on-empty.rs b/tests/ui/parser/attribute-on-empty.rs new file mode 100644 index 00000000000..5932377f73e --- /dev/null +++ b/tests/ui/parser/attribute-on-empty.rs @@ -0,0 +1,29 @@ +//! Regression test for: <https://github.com/rust-lang/rust/issues/144132> +//! <https://github.com/rust-lang/rust/issues/135017> + +struct Baz<const N: usize>(i32); + +fn main() { + let _: Baz<#[cfg(any())]> = todo!(); + //~^ ERROR attributes cannot be applied here +} + +fn f(_param: #[attr]) {} +//~^ ERROR attributes cannot be applied to a function parameter's type +//~| ERROR expected type, found `)` + +fn g() -> #[attr] { 0 } +//~^ ERROR attributes cannot be applied here + +struct S { + field: #[attr], + //~^ ERROR attributes cannot be applied here + field1: (#[attr], i32), + //~^ ERROR attributes cannot be applied here +} + +type Tuple = (#[attr], String); +//~^ ERROR attributes cannot be applied here + +impl #[attr] {} +//~^ ERROR attributes cannot be applied here diff --git a/tests/ui/parser/attribute-on-empty.stderr b/tests/ui/parser/attribute-on-empty.stderr new file mode 100644 index 00000000000..7c4806c8704 --- /dev/null +++ b/tests/ui/parser/attribute-on-empty.stderr @@ -0,0 +1,52 @@ +error: attributes cannot be applied here + --> $DIR/attribute-on-empty.rs:7:16 + | +LL | let _: Baz<#[cfg(any())]> = todo!(); + | - ^^^^^^^^^^^^^ attributes are not allowed here + | | + | while parsing the type for `_` + +error: attributes cannot be applied to a function parameter's type + --> $DIR/attribute-on-empty.rs:11:14 + | +LL | fn f(_param: #[attr]) {} + | ^^^^^^^ attributes are not allowed here + +error: expected type, found `)` + --> $DIR/attribute-on-empty.rs:11:21 + | +LL | fn f(_param: #[attr]) {} + | ^ expected type + +error: attributes cannot be applied here + --> $DIR/attribute-on-empty.rs:15:11 + | +LL | fn g() -> #[attr] { 0 } + | ^^^^^^^ attributes are not allowed here + +error: attributes cannot be applied here + --> $DIR/attribute-on-empty.rs:19:12 + | +LL | field: #[attr], + | ^^^^^^^ attributes are not allowed here + +error: attributes cannot be applied here + --> $DIR/attribute-on-empty.rs:21:14 + | +LL | field1: (#[attr], i32), + | ^^^^^^^ attributes are not allowed here + +error: attributes cannot be applied here + --> $DIR/attribute-on-empty.rs:25:15 + | +LL | type Tuple = (#[attr], String); + | ^^^^^^^ attributes are not allowed here + +error: attributes cannot be applied here + --> $DIR/attribute-on-empty.rs:28:6 + | +LL | impl #[attr] {} + | ^^^^^^^ attributes are not allowed here + +error: aborting due to 8 previous errors + diff --git a/tests/ui/parser/attribute-on-type.fixed b/tests/ui/parser/attribute-on-type.fixed new file mode 100644 index 00000000000..5024bfdc2bc --- /dev/null +++ b/tests/ui/parser/attribute-on-type.fixed @@ -0,0 +1,58 @@ +//! Regression test for: <https://github.com/rust-lang/rust/issues/144132> +//! <https://github.com/rust-lang/rust/issues/135017> + +//@ run-rustfix + +#![allow(dead_code, unused_variables)] + +struct Foo<T>(T); +struct Bar<'a>(&'a i32); +struct Baz<const N: usize>(i32); + +fn main() { + let foo: Foo<i32> = Foo(2i32); + //~^ ERROR attributes cannot be applied to generic arguments + + let _: &'static str = "123"; + //~^ ERROR attributes cannot be applied to types + + let _: Bar<'static> = Bar(&123); + //~^ ERROR attributes cannot be applied to generic arguments + + let _: Baz<42> = Baz(42); + //~^ ERROR attributes cannot be applied to generic arguments + + let _: Foo<String> = Foo(String::new()); + //~^ ERROR attributes cannot be applied to generic arguments + + let _: Bar<'static> = Bar(&456); + //~^ ERROR attributes cannot be applied to generic arguments + + let _generic: Box<i32> = Box::new(1); + //~^ ERROR attributes cannot be applied to generic arguments + + let _assignment: i32 = *Box::new(1); + //~^ ERROR attributes cannot be applied to types + + let _complex: Vec<String> = vec![]; + //~^ ERROR attributes cannot be applied to generic arguments + + let _nested: Box<Vec<u64>> = Box::new(vec![]); + //~^ ERROR attributes cannot be applied to generic arguments +} + +fn g() -> i32 { 0 } +//~^ ERROR attributes cannot be applied to types + +struct S { + field: i32, + //~^ ERROR attributes cannot be applied to types + field1: (i32, i32), + //~^ ERROR attributes cannot be applied to types +} + +type Tuple = (i32, String); +//~^ ERROR attributes cannot be applied to types + +impl S {} +//~^ ERROR attributes cannot be applied to types diff --git a/tests/ui/parser/attribute-on-type.rs b/tests/ui/parser/attribute-on-type.rs new file mode 100644 index 00000000000..196d322bdf8 --- /dev/null +++ b/tests/ui/parser/attribute-on-type.rs @@ -0,0 +1,58 @@ +//! Regression test for: <https://github.com/rust-lang/rust/issues/144132> +//! <https://github.com/rust-lang/rust/issues/135017> + +//@ run-rustfix + +#![allow(dead_code, unused_variables)] + +struct Foo<T>(T); +struct Bar<'a>(&'a i32); +struct Baz<const N: usize>(i32); + +fn main() { + let foo: Foo<#[cfg(not(wrong))] i32> = Foo(2i32); + //~^ ERROR attributes cannot be applied to generic arguments + + let _: #[attr] &'static str = "123"; + //~^ ERROR attributes cannot be applied to types + + let _: Bar<#[cfg(any())] 'static> = Bar(&123); + //~^ ERROR attributes cannot be applied to generic arguments + + let _: Baz<#[cfg(any())] 42> = Baz(42); + //~^ ERROR attributes cannot be applied to generic arguments + + let _: Foo<#[cfg(not(wrong))]String> = Foo(String::new()); + //~^ ERROR attributes cannot be applied to generic arguments + + let _: Bar<#[cfg(any())] 'static> = Bar(&456); + //~^ ERROR attributes cannot be applied to generic arguments + + let _generic: Box<#[attr] i32> = Box::new(1); + //~^ ERROR attributes cannot be applied to generic arguments + + let _assignment: #[attr] i32 = *Box::new(1); + //~^ ERROR attributes cannot be applied to types + + let _complex: Vec<#[derive(Debug)] String> = vec![]; + //~^ ERROR attributes cannot be applied to generic arguments + + let _nested: Box<Vec<#[cfg(feature = "test")] u64>> = Box::new(vec![]); + //~^ ERROR attributes cannot be applied to generic arguments +} + +fn g() -> #[attr] i32 { 0 } +//~^ ERROR attributes cannot be applied to types + +struct S { + field: #[attr] i32, + //~^ ERROR attributes cannot be applied to types + field1: (#[attr] i32, i32), + //~^ ERROR attributes cannot be applied to types +} + +type Tuple = (#[attr] i32, String); +//~^ ERROR attributes cannot be applied to types + +impl #[attr] S {} +//~^ ERROR attributes cannot be applied to types diff --git a/tests/ui/parser/attribute-on-type.stderr b/tests/ui/parser/attribute-on-type.stderr new file mode 100644 index 00000000000..603c7e2be51 --- /dev/null +++ b/tests/ui/parser/attribute-on-type.stderr @@ -0,0 +1,92 @@ +error: attributes cannot be applied to generic arguments + --> $DIR/attribute-on-type.rs:13:18 + | +LL | let foo: Foo<#[cfg(not(wrong))] i32> = Foo(2i32); + | ^^^^^^^^^^^^^^^^^^ attributes are not allowed here + +error: attributes cannot be applied to types + --> $DIR/attribute-on-type.rs:16:12 + | +LL | let _: #[attr] &'static str = "123"; + | ^^^^^^^ attributes are not allowed here + +error: attributes cannot be applied to generic arguments + --> $DIR/attribute-on-type.rs:19:16 + | +LL | let _: Bar<#[cfg(any())] 'static> = Bar(&123); + | ^^^^^^^^^^^^^ attributes are not allowed here + +error: attributes cannot be applied to generic arguments + --> $DIR/attribute-on-type.rs:22:16 + | +LL | let _: Baz<#[cfg(any())] 42> = Baz(42); + | ^^^^^^^^^^^^^ attributes are not allowed here + +error: attributes cannot be applied to generic arguments + --> $DIR/attribute-on-type.rs:25:16 + | +LL | let _: Foo<#[cfg(not(wrong))]String> = Foo(String::new()); + | ^^^^^^^^^^^^^^^^^^ attributes are not allowed here + +error: attributes cannot be applied to generic arguments + --> $DIR/attribute-on-type.rs:28:16 + | +LL | let _: Bar<#[cfg(any())] 'static> = Bar(&456); + | ^^^^^^^^^^^^^ attributes are not allowed here + +error: attributes cannot be applied to generic arguments + --> $DIR/attribute-on-type.rs:31:23 + | +LL | let _generic: Box<#[attr] i32> = Box::new(1); + | ^^^^^^^ attributes are not allowed here + +error: attributes cannot be applied to types + --> $DIR/attribute-on-type.rs:34:22 + | +LL | let _assignment: #[attr] i32 = *Box::new(1); + | ^^^^^^^ attributes are not allowed here + +error: attributes cannot be applied to generic arguments + --> $DIR/attribute-on-type.rs:37:23 + | +LL | let _complex: Vec<#[derive(Debug)] String> = vec![]; + | ^^^^^^^^^^^^^^^^ attributes are not allowed here + +error: attributes cannot be applied to generic arguments + --> $DIR/attribute-on-type.rs:40:26 + | +LL | let _nested: Box<Vec<#[cfg(feature = "test")] u64>> = Box::new(vec![]); + | ^^^^^^^^^^^^^^^^^^^^^^^^ attributes are not allowed here + +error: attributes cannot be applied to types + --> $DIR/attribute-on-type.rs:44:11 + | +LL | fn g() -> #[attr] i32 { 0 } + | ^^^^^^^ attributes are not allowed here + +error: attributes cannot be applied to types + --> $DIR/attribute-on-type.rs:48:12 + | +LL | field: #[attr] i32, + | ^^^^^^^ attributes are not allowed here + +error: attributes cannot be applied to types + --> $DIR/attribute-on-type.rs:50:14 + | +LL | field1: (#[attr] i32, i32), + | ^^^^^^^ attributes are not allowed here + +error: attributes cannot be applied to types + --> $DIR/attribute-on-type.rs:54:15 + | +LL | type Tuple = (#[attr] i32, String); + | ^^^^^^^ attributes are not allowed here + +error: attributes cannot be applied to types + --> $DIR/attribute-on-type.rs:57:6 + | +LL | impl #[attr] S {} + | ^^^^^^^ attributes are not allowed here + +error: aborting due to 15 previous errors + diff --git a/tests/ui/issues/issue-12920.rs b/tests/ui/parser/encode-symbol-ice-12920.rs index f3b1b643c45..87389c0ffb4 100644 --- a/tests/ui/issues/issue-12920.rs +++ b/tests/ui/parser/encode-symbol-ice-12920.rs @@ -1,3 +1,5 @@ +//! Regression test for https://github.com/rust-lang/rust/issues/12920 + //@ run-fail //@ error-pattern:explicit panic //@ needs-subprocess diff --git a/tests/ui/parser/issues/issue-103143.rs b/tests/ui/parser/issues/issue-103143.rs index a584274c405..90f10fc1a08 100644 --- a/tests/ui/parser/issues/issue-103143.rs +++ b/tests/ui/parser/issues/issue-103143.rs @@ -1,5 +1,5 @@ fn main() { x::<#[a]y::<z>> - //~^ ERROR invalid const generic expression + //~^ ERROR attributes cannot be applied to generic arguments //~| ERROR cannot find value `x` in this scope } diff --git a/tests/ui/parser/issues/issue-103143.stderr b/tests/ui/parser/issues/issue-103143.stderr index 4035c69afa7..168a2077396 100644 --- a/tests/ui/parser/issues/issue-103143.stderr +++ b/tests/ui/parser/issues/issue-103143.stderr @@ -1,13 +1,8 @@ -error: invalid const generic expression - --> $DIR/issue-103143.rs:2:13 +error: attributes cannot be applied to generic arguments + --> $DIR/issue-103143.rs:2:9 | LL | x::<#[a]y::<z>> - | ^^^^^^ - | -help: expressions must be enclosed in braces to be used as const generic arguments - | -LL | x::<#[a]{ y::<z> }> - | + + + | ^^^^ attributes are not allowed here error[E0425]: cannot find value `x` in this scope --> $DIR/issue-103143.rs:2:5 diff --git a/tests/ui/parser/item-kw-case-mismatch.stderr b/tests/ui/parser/item-kw-case-mismatch.stderr index df39eb10fdb..d2a1eb7f2f5 100644 --- a/tests/ui/parser/item-kw-case-mismatch.stderr +++ b/tests/ui/parser/item-kw-case-mismatch.stderr @@ -4,7 +4,7 @@ error: keyword `use` is written in the wrong case LL | Use std::ptr::read; | ^^^ | -help: write it in the correct case (notice the capitalization difference) +help: write it in the correct case (notice the capitalization) | LL - Use std::ptr::read; LL + use std::ptr::read; @@ -28,7 +28,7 @@ error: keyword `fn` is written in the wrong case LL | async Fn _a() {} | ^^ | -help: write it in the correct case (notice the capitalization difference) +help: write it in the correct case (notice the capitalization) | LL - async Fn _a() {} LL + async fn _a() {} @@ -40,7 +40,7 @@ error: keyword `fn` is written in the wrong case LL | Fn _b() {} | ^^ | -help: write it in the correct case (notice the capitalization difference) +help: write it in the correct case (notice the capitalization) | LL - Fn _b() {} LL + fn _b() {} diff --git a/tests/ui/parser/kw-in-trait-bounds.stderr b/tests/ui/parser/kw-in-trait-bounds.stderr index 1892d0b6226..5a4adf3e37b 100644 --- a/tests/ui/parser/kw-in-trait-bounds.stderr +++ b/tests/ui/parser/kw-in-trait-bounds.stderr @@ -4,7 +4,7 @@ error: expected identifier, found keyword `fn` LL | fn _f<F: fn(), G>(_: impl fn(), _: &dyn fn()) | ^^ | -help: use `Fn` to refer to the trait (notice the capitalization difference) +help: use `Fn` to refer to the trait (notice the capitalization) | LL - fn _f<F: fn(), G>(_: impl fn(), _: &dyn fn()) LL + fn _f<F: Fn(), G>(_: impl fn(), _: &dyn fn()) @@ -16,7 +16,7 @@ error: expected identifier, found keyword `fn` LL | fn _f<F: fn(), G>(_: impl fn(), _: &dyn fn()) | ^^ | -help: use `Fn` to refer to the trait (notice the capitalization difference) +help: use `Fn` to refer to the trait (notice the capitalization) | LL - fn _f<F: fn(), G>(_: impl fn(), _: &dyn fn()) LL + fn _f<F: fn(), G>(_: impl Fn(), _: &dyn fn()) @@ -28,7 +28,7 @@ error: expected identifier, found keyword `fn` LL | fn _f<F: fn(), G>(_: impl fn(), _: &dyn fn()) | ^^ | -help: use `Fn` to refer to the trait (notice the capitalization difference) +help: use `Fn` to refer to the trait (notice the capitalization) | LL - fn _f<F: fn(), G>(_: impl fn(), _: &dyn fn()) LL + fn _f<F: fn(), G>(_: impl fn(), _: &dyn Fn()) @@ -40,7 +40,7 @@ error: expected identifier, found keyword `fn` LL | G: fn(), | ^^ | -help: use `Fn` to refer to the trait (notice the capitalization difference) +help: use `Fn` to refer to the trait (notice the capitalization) | LL - G: fn(), LL + G: Fn(), diff --git a/tests/ui/parser/misspelled-keywords/hrdt.stderr b/tests/ui/parser/misspelled-keywords/hrdt.stderr index e5fc1a50382..497bd613bf4 100644 --- a/tests/ui/parser/misspelled-keywords/hrdt.stderr +++ b/tests/ui/parser/misspelled-keywords/hrdt.stderr @@ -4,7 +4,7 @@ error: expected one of `!`, `(`, `+`, `::`, `<`, `where`, or `{`, found keyword LL | Where for<'a> F: Fn(&'a (u8, u16)) -> &'a u8, | ^^^ expected one of 7 possible tokens | -help: write keyword `where` in lowercase (notice the capitalization difference) +help: write keyword `where` in lowercase (notice the capitalization) | LL - Where for<'a> F: Fn(&'a (u8, u16)) -> &'a u8, LL + where for<'a> F: Fn(&'a (u8, u16)) -> &'a u8, diff --git a/tests/ui/parser/misspelled-keywords/impl-return.stderr b/tests/ui/parser/misspelled-keywords/impl-return.stderr index ff5391461a9..d49d962d7e9 100644 --- a/tests/ui/parser/misspelled-keywords/impl-return.stderr +++ b/tests/ui/parser/misspelled-keywords/impl-return.stderr @@ -4,7 +4,7 @@ error: expected one of `!`, `(`, `+`, `::`, `<`, `where`, or `{`, found `Display LL | fn code() -> Impl Display {} | ^^^^^^^ expected one of 7 possible tokens | -help: write keyword `impl` in lowercase (notice the capitalization difference) +help: write keyword `impl` in lowercase (notice the capitalization) | LL - fn code() -> Impl Display {} LL + fn code() -> impl Display {} diff --git a/tests/ui/parser/misspelled-keywords/static.stderr b/tests/ui/parser/misspelled-keywords/static.stderr index e559f2be109..0df40bcdc33 100644 --- a/tests/ui/parser/misspelled-keywords/static.stderr +++ b/tests/ui/parser/misspelled-keywords/static.stderr @@ -4,7 +4,7 @@ error: expected one of `!` or `::`, found `a` LL | Static a = 0; | ^ expected one of `!` or `::` | -help: write keyword `static` in lowercase (notice the capitalization difference) +help: write keyword `static` in lowercase (notice the capitalization) | LL - Static a = 0; LL + static a = 0; diff --git a/tests/ui/parser/misspelled-keywords/struct.stderr b/tests/ui/parser/misspelled-keywords/struct.stderr index edbec3b9456..af8614ef14b 100644 --- a/tests/ui/parser/misspelled-keywords/struct.stderr +++ b/tests/ui/parser/misspelled-keywords/struct.stderr @@ -4,7 +4,7 @@ error: expected one of `!` or `::`, found `Foor` LL | Struct Foor { | ^^^^ expected one of `!` or `::` | -help: write keyword `struct` in lowercase (notice the capitalization difference) +help: write keyword `struct` in lowercase (notice the capitalization) | LL - Struct Foor { LL + struct Foor { diff --git a/tests/ui/parser/recover/recover-fn-trait-from-fn-kw.stderr b/tests/ui/parser/recover/recover-fn-trait-from-fn-kw.stderr index 4e1fcaf4936..bd809e77a8f 100644 --- a/tests/ui/parser/recover/recover-fn-trait-from-fn-kw.stderr +++ b/tests/ui/parser/recover/recover-fn-trait-from-fn-kw.stderr @@ -4,7 +4,7 @@ error: expected identifier, found keyword `fn` LL | fn foo(_: impl fn() -> i32) {} | ^^ | -help: use `Fn` to refer to the trait (notice the capitalization difference) +help: use `Fn` to refer to the trait (notice the capitalization) | LL - fn foo(_: impl fn() -> i32) {} LL + fn foo(_: impl Fn() -> i32) {} @@ -16,7 +16,7 @@ error: expected identifier, found keyword `fn` LL | fn foo2<T: fn(i32)>(_: T) {} | ^^ | -help: use `Fn` to refer to the trait (notice the capitalization difference) +help: use `Fn` to refer to the trait (notice the capitalization) | LL - fn foo2<T: fn(i32)>(_: T) {} LL + fn foo2<T: Fn(i32)>(_: T) {} diff --git a/tests/ui/parser/recover/recover-where-clause-before-tuple-struct-body-0.fixed b/tests/ui/parser/recover/recover-where-clause-before-tuple-struct-body-0.fixed index a851300a982..40028307a8c 100644 --- a/tests/ui/parser/recover/recover-where-clause-before-tuple-struct-body-0.fixed +++ b/tests/ui/parser/recover/recover-where-clause-before-tuple-struct-body-0.fixed @@ -1,7 +1,9 @@ // Regression test for issues #100790 and #106439. //@ run-rustfix -pub struct Example(#[allow(dead_code)] usize) +#![allow(dead_code)] + +pub struct Example(usize) where (): Sized; //~^^^ ERROR where clauses are not allowed before tuple struct bodies diff --git a/tests/ui/parser/recover/recover-where-clause-before-tuple-struct-body-0.rs b/tests/ui/parser/recover/recover-where-clause-before-tuple-struct-body-0.rs index 10f435859f1..d8dbb4238d2 100644 --- a/tests/ui/parser/recover/recover-where-clause-before-tuple-struct-body-0.rs +++ b/tests/ui/parser/recover/recover-where-clause-before-tuple-struct-body-0.rs @@ -1,10 +1,12 @@ // Regression test for issues #100790 and #106439. //@ run-rustfix +#![allow(dead_code)] + pub struct Example where (): Sized, -(#[allow(dead_code)] usize); +(usize); //~^^^ ERROR where clauses are not allowed before tuple struct bodies struct _Demo diff --git a/tests/ui/parser/recover/recover-where-clause-before-tuple-struct-body-0.stderr b/tests/ui/parser/recover/recover-where-clause-before-tuple-struct-body-0.stderr index ddbf237e866..66dadd9fd4c 100644 --- a/tests/ui/parser/recover/recover-where-clause-before-tuple-struct-body-0.stderr +++ b/tests/ui/parser/recover/recover-where-clause-before-tuple-struct-body-0.stderr @@ -1,23 +1,23 @@ error: where clauses are not allowed before tuple struct bodies - --> $DIR/recover-where-clause-before-tuple-struct-body-0.rs:5:1 + --> $DIR/recover-where-clause-before-tuple-struct-body-0.rs:7:1 | LL | pub struct Example | ------- while parsing this tuple struct LL | / where LL | | (): Sized, | |______________^ unexpected where clause -LL | (#[allow(dead_code)] usize); - | --------------------------- the struct body +LL | (usize); + | ------- the struct body | help: move the body before the where clause | -LL ~ pub struct Example(#[allow(dead_code)] usize) +LL ~ pub struct Example(usize) LL | where LL ~ (): Sized; | error: where clauses are not allowed before tuple struct bodies - --> $DIR/recover-where-clause-before-tuple-struct-body-0.rs:11:1 + --> $DIR/recover-where-clause-before-tuple-struct-body-0.rs:13:1 | LL | struct _Demo | ----- while parsing this tuple struct diff --git a/tests/ui/parser/typod-const-in-const-param-def.stderr b/tests/ui/parser/typod-const-in-const-param-def.stderr index bf7168a0157..cc1600fe5cb 100644 --- a/tests/ui/parser/typod-const-in-const-param-def.stderr +++ b/tests/ui/parser/typod-const-in-const-param-def.stderr @@ -4,7 +4,7 @@ error: `const` keyword was mistyped as `Const` LL | pub fn foo<Const N: u8>() {} | ^^^^^ | -help: use the `const` keyword (notice the capitalization difference) +help: use the `const` keyword (notice the capitalization) | LL - pub fn foo<Const N: u8>() {} LL + pub fn foo<const N: u8>() {} @@ -16,7 +16,7 @@ error: `const` keyword was mistyped as `Const` LL | pub fn baz<Const N: u8, T>() {} | ^^^^^ | -help: use the `const` keyword (notice the capitalization difference) +help: use the `const` keyword (notice the capitalization) | LL - pub fn baz<Const N: u8, T>() {} LL + pub fn baz<const N: u8, T>() {} @@ -28,7 +28,7 @@ error: `const` keyword was mistyped as `Const` LL | pub fn qux<T, Const N: u8>() {} | ^^^^^ | -help: use the `const` keyword (notice the capitalization difference) +help: use the `const` keyword (notice the capitalization) | LL - pub fn qux<T, Const N: u8>() {} LL + pub fn qux<T, const N: u8>() {} @@ -40,7 +40,7 @@ error: `const` keyword was mistyped as `Const` LL | pub fn quux<T, Const N: u8, U>() {} | ^^^^^ | -help: use the `const` keyword (notice the capitalization difference) +help: use the `const` keyword (notice the capitalization) | LL - pub fn quux<T, Const N: u8, U>() {} LL + pub fn quux<T, const N: u8, U>() {} diff --git a/tests/ui/issues/issue-7519-match-unit-in-arg.rs b/tests/ui/pattern/unit-pattern-matching-in-function-argument-7519.rs index a7cea577b22..7bfa9ee6625 100644 --- a/tests/ui/issues/issue-7519-match-unit-in-arg.rs +++ b/tests/ui/pattern/unit-pattern-matching-in-function-argument-7519.rs @@ -2,6 +2,7 @@ /* #7519 ICE pattern matching unit in function argument +https://github.com/rust-lang/rust/issues/7519 */ fn foo(():()) { } diff --git a/tests/ui/issues/issue-3763.rs b/tests/ui/privacy/private-field-access-violation-3763.rs index 893009a2cd9..3fc2337086d 100644 --- a/tests/ui/issues/issue-3763.rs +++ b/tests/ui/privacy/private-field-access-violation-3763.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/3763 // Regression test for #3763 mod my_mod { diff --git a/tests/ui/issues/issue-3763.stderr b/tests/ui/privacy/private-field-access-violation-3763.stderr index d101e4c33ad..6ba83dc4d78 100644 --- a/tests/ui/issues/issue-3763.stderr +++ b/tests/ui/privacy/private-field-access-violation-3763.stderr @@ -1,17 +1,17 @@ error[E0616]: field `priv_field` of struct `MyStruct` is private - --> $DIR/issue-3763.rs:17:32 + --> $DIR/private-field-access-violation-3763.rs:18:32 | LL | let _woohoo = (&my_struct).priv_field; | ^^^^^^^^^^ private field error[E0616]: field `priv_field` of struct `MyStruct` is private - --> $DIR/issue-3763.rs:20:41 + --> $DIR/private-field-access-violation-3763.rs:21:41 | LL | let _woohoo = (Box::new(my_struct)).priv_field; | ^^^^^^^^^^ private field error[E0624]: method `happyfun` is private - --> $DIR/issue-3763.rs:23:18 + --> $DIR/private-field-access-violation-3763.rs:24:18 | LL | fn happyfun(&self) {} | ------------------ private method defined here @@ -20,7 +20,7 @@ LL | (&my_struct).happyfun(); | ^^^^^^^^ private method error[E0624]: method `happyfun` is private - --> $DIR/issue-3763.rs:25:27 + --> $DIR/private-field-access-violation-3763.rs:26:27 | LL | fn happyfun(&self) {} | ------------------ private method defined here @@ -29,7 +29,7 @@ LL | (Box::new(my_struct)).happyfun(); | ^^^^^^^^ private method error[E0616]: field `priv_field` of struct `MyStruct` is private - --> $DIR/issue-3763.rs:26:26 + --> $DIR/private-field-access-violation-3763.rs:27:26 | LL | let nope = my_struct.priv_field; | ^^^^^^^^^^ private field diff --git a/tests/ui/privacy/private-in-public-warn.stderr b/tests/ui/privacy/private-in-public-warn.stderr index 86f6be85a07..edcffaf6b70 100644 --- a/tests/ui/privacy/private-in-public-warn.stderr +++ b/tests/ui/privacy/private-in-public-warn.stderr @@ -93,6 +93,42 @@ LL | struct Priv; LL | type Alias = Priv; | ^^^^^^^^^^ can't leak private type +error: type `types::Priv` is more private than the item `types::ES` + --> $DIR/private-in-public-warn.rs:27:9 + | +LL | pub static ES: Priv; + | ^^^^^^^^^^^^^^^^^^^ static `types::ES` is reachable at visibility `pub(crate)` + | +note: but type `types::Priv` is only usable at visibility `pub(self)` + --> $DIR/private-in-public-warn.rs:9:5 + | +LL | struct Priv; + | ^^^^^^^^^^^ + +error: type `types::Priv` is more private than the item `types::ef1` + --> $DIR/private-in-public-warn.rs:28:9 + | +LL | pub fn ef1(arg: Priv); + | ^^^^^^^^^^^^^^^^^^^^^^ function `types::ef1` is reachable at visibility `pub(crate)` + | +note: but type `types::Priv` is only usable at visibility `pub(self)` + --> $DIR/private-in-public-warn.rs:9:5 + | +LL | struct Priv; + | ^^^^^^^^^^^ + +error: type `types::Priv` is more private than the item `types::ef2` + --> $DIR/private-in-public-warn.rs:29:9 + | +LL | pub fn ef2() -> Priv; + | ^^^^^^^^^^^^^^^^^^^^^ function `types::ef2` is reachable at visibility `pub(crate)` + | +note: but type `types::Priv` is only usable at visibility `pub(self)` + --> $DIR/private-in-public-warn.rs:9:5 + | +LL | struct Priv; + | ^^^^^^^^^^^ + error: trait `traits::PrivTr` is more private than the item `traits::Alias` --> $DIR/private-in-public-warn.rs:42:5 | @@ -359,42 +395,6 @@ note: but type `Priv2` is only usable at visibility `pub(self)` LL | struct Priv2; | ^^^^^^^^^^^^ -error: type `types::Priv` is more private than the item `types::ES` - --> $DIR/private-in-public-warn.rs:27:9 - | -LL | pub static ES: Priv; - | ^^^^^^^^^^^^^^^^^^^ static `types::ES` is reachable at visibility `pub(crate)` - | -note: but type `types::Priv` is only usable at visibility `pub(self)` - --> $DIR/private-in-public-warn.rs:9:5 - | -LL | struct Priv; - | ^^^^^^^^^^^ - -error: type `types::Priv` is more private than the item `types::ef1` - --> $DIR/private-in-public-warn.rs:28:9 - | -LL | pub fn ef1(arg: Priv); - | ^^^^^^^^^^^^^^^^^^^^^^ function `types::ef1` is reachable at visibility `pub(crate)` - | -note: but type `types::Priv` is only usable at visibility `pub(self)` - --> $DIR/private-in-public-warn.rs:9:5 - | -LL | struct Priv; - | ^^^^^^^^^^^ - -error: type `types::Priv` is more private than the item `types::ef2` - --> $DIR/private-in-public-warn.rs:29:9 - | -LL | pub fn ef2() -> Priv; - | ^^^^^^^^^^^^^^^^^^^^^ function `types::ef2` is reachable at visibility `pub(crate)` - | -note: but type `types::Priv` is only usable at visibility `pub(self)` - --> $DIR/private-in-public-warn.rs:9:5 - | -LL | struct Priv; - | ^^^^^^^^^^^ - warning: bounds on generic parameters in type aliases are not enforced --> $DIR/private-in-public-warn.rs:42:23 | diff --git a/tests/ui/issues/issue-13407.rs b/tests/ui/privacy/private-unit-struct-assignment.rs index 7794be37b85..b8e1c4ecb18 100644 --- a/tests/ui/issues/issue-13407.rs +++ b/tests/ui/privacy/private-unit-struct-assignment.rs @@ -1,3 +1,5 @@ +//! Regression test for https://github.com/rust-lang/rust/issues/13407 + mod A { struct C; } diff --git a/tests/ui/issues/issue-13407.stderr b/tests/ui/privacy/private-unit-struct-assignment.stderr index ac2eb6581fe..8c36a08846d 100644 --- a/tests/ui/issues/issue-13407.stderr +++ b/tests/ui/privacy/private-unit-struct-assignment.stderr @@ -1,17 +1,17 @@ error[E0603]: unit struct `C` is private - --> $DIR/issue-13407.rs:6:8 + --> $DIR/private-unit-struct-assignment.rs:8:8 | LL | A::C = 1; | ^ private unit struct | note: the unit struct `C` is defined here - --> $DIR/issue-13407.rs:2:5 + --> $DIR/private-unit-struct-assignment.rs:4:5 | LL | struct C; | ^^^^^^^^^ error[E0308]: mismatched types - --> $DIR/issue-13407.rs:6:5 + --> $DIR/private-unit-struct-assignment.rs:8:5 | LL | struct C; | -------- unit struct defined here diff --git a/tests/ui/privacy/projections.stderr b/tests/ui/privacy/projections.stderr index 010d77998e3..addb6a075a2 100644 --- a/tests/ui/privacy/projections.stderr +++ b/tests/ui/privacy/projections.stderr @@ -1,16 +1,3 @@ -warning: type `Priv` is more private than the item `Leak` - --> $DIR/projections.rs:3:5 - | -LL | pub type Leak = Priv; - | ^^^^^^^^^^^^^ type alias `Leak` is reachable at visibility `pub(crate)` - | -note: but type `Priv` is only usable at visibility `pub(self)` - --> $DIR/projections.rs:2:5 - | -LL | struct Priv; - | ^^^^^^^^^^^ - = note: `#[warn(private_interfaces)]` on by default - error[E0446]: private type `Priv` in public interface --> $DIR/projections.rs:24:5 | @@ -29,6 +16,19 @@ LL | struct Priv; LL | type A<T: Trait> = T::A<m::Leak>; | ^^^^^^^^^^^^^^^^ can't leak private type +warning: type `Priv` is more private than the item `Leak` + --> $DIR/projections.rs:3:5 + | +LL | pub type Leak = Priv; + | ^^^^^^^^^^^^^ type alias `Leak` is reachable at visibility `pub(crate)` + | +note: but type `Priv` is only usable at visibility `pub(self)` + --> $DIR/projections.rs:2:5 + | +LL | struct Priv; + | ^^^^^^^^^^^ + = note: `#[warn(private_interfaces)]` on by default + error: type `Priv` is private --> $DIR/projections.rs:14:15 | diff --git a/tests/ui/issues/issue-12729.rs b/tests/ui/privacy/use-in-impl-scope-12729.rs index 4d45846bc60..58fe042beec 100644 --- a/tests/ui/issues/issue-12729.rs +++ b/tests/ui/privacy/use-in-impl-scope-12729.rs @@ -1,3 +1,5 @@ +//! Regression test for https://github.com/rust-lang/rust/issues/12729 + //@ edition: 2015 //@ check-pass #![allow(dead_code)] diff --git a/tests/ui/proc-macro/load-panic-backtrace.rs b/tests/ui/proc-macro/load-panic-backtrace.rs index 848bdaf9f37..82645eb4e9f 100644 --- a/tests/ui/proc-macro/load-panic-backtrace.rs +++ b/tests/ui/proc-macro/load-panic-backtrace.rs @@ -1,7 +1,7 @@ //@ proc-macro: test-macros.rs //@ compile-flags: -Z proc-macro-backtrace //@ rustc-env:RUST_BACKTRACE=0 -//@ normalize-stderr: "thread '.*' panicked " -> "" +//@ normalize-stderr: "thread '.*' \(0x[[:xdigit:]]+\) panicked " -> "" //@ normalize-stderr: "note:.*RUST_BACKTRACE=1.*\n" -> "" //@ needs-unwind proc macro panics to report errors diff --git a/tests/ui/proc-macro/load-panic-backtrace.stderr b/tests/ui/proc-macro/load-panic-backtrace.stderr index a1049f5a324..b8872eb12b7 100644 --- a/tests/ui/proc-macro/load-panic-backtrace.stderr +++ b/tests/ui/proc-macro/load-panic-backtrace.stderr @@ -1,5 +1,5 @@ -at $DIR/auxiliary/test-macros.rs:38:5: +thread '<unnamed>' ($TID) panicked at $DIR/auxiliary/test-macros.rs:38:5: panic-derive error: proc-macro derive panicked --> $DIR/load-panic-backtrace.rs:11:10 diff --git a/tests/ui/process/multi-panic.rs b/tests/ui/process/multi-panic.rs index 481fe75c731..1fddffeb770 100644 --- a/tests/ui/process/multi-panic.rs +++ b/tests/ui/process/multi-panic.rs @@ -7,18 +7,27 @@ fn check_for_no_backtrace(test: std::process::Output) { let err = String::from_utf8_lossy(&test.stderr); let mut it = err.lines().filter(|l| !l.is_empty()); - assert_eq!(it.next().map(|l| l.starts_with("thread '<unnamed>' panicked")), Some(true)); - assert_eq!(it.next().is_some(), true); + assert_eq!( + it.next().map(|l| l.starts_with("thread '<unnamed>' (") && l.contains("panicked")), + Some(true), + "out: ```{err}```", + ); + assert_eq!(it.next().is_some(), true, "out: ```{err}```"); assert_eq!( it.next(), Some( "note: run with `RUST_BACKTRACE=1` \ environment variable to display a backtrace" - ) + ), + "out: ```{err}```", + ); + assert_eq!( + it.next().map(|l| l.starts_with("thread 'main' (") && l.contains("panicked at")), + Some(true), + "out: ```{err}```", ); - assert_eq!(it.next().map(|l| l.starts_with("thread 'main' panicked at")), Some(true)); - assert_eq!(it.next().is_some(), true); - assert_eq!(it.next(), None); + assert_eq!(it.next().is_some(), true, "out: ```{err}```"); + assert_eq!(it.next(), None, "out: ```{err}```"); } fn main() { diff --git a/tests/ui/process/println-with-broken-pipe.run.stderr b/tests/ui/process/println-with-broken-pipe.run.stderr index ab414994b56..c56793de525 100644 --- a/tests/ui/process/println-with-broken-pipe.run.stderr +++ b/tests/ui/process/println-with-broken-pipe.run.stderr @@ -1,4 +1,4 @@ -thread 'main' panicked at library/std/src/io/stdio.rs:LL:CC: +thread 'main' ($TID) panicked at library/std/src/io/stdio.rs:LL:CC: failed printing to stdout: Broken pipe (os error 32) note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace diff --git a/tests/ui/issues/issue-2281-part1.rs b/tests/ui/resolve/cannot-find-value-in-scope-22811.rs index 8340ade2239..fc07ae5e60e 100644 --- a/tests/ui/issues/issue-2281-part1.rs +++ b/tests/ui/resolve/cannot-find-value-in-scope-22811.rs @@ -1 +1,2 @@ +// https://github.com/rust-lang/rust/issues/22811 fn main() { println!("{}", foobar); } //~ ERROR cannot find value `foobar` in this scope diff --git a/tests/ui/issues/issue-2281-part1.stderr b/tests/ui/resolve/cannot-find-value-in-scope-22811.stderr index 47a1ef8cc02..529fd7e8f49 100644 --- a/tests/ui/issues/issue-2281-part1.stderr +++ b/tests/ui/resolve/cannot-find-value-in-scope-22811.stderr @@ -1,5 +1,5 @@ error[E0425]: cannot find value `foobar` in this scope - --> $DIR/issue-2281-part1.rs:1:28 + --> $DIR/cannot-find-value-in-scope-22811.rs:2:28 | LL | fn main() { println!("{}", foobar); } | ^^^^^^ not found in this scope diff --git a/tests/ui/resolve/multiple_definitions_attribute_merging.rs b/tests/ui/resolve/multiple_definitions_attribute_merging.rs index 155abafdd9d..519b989fbe8 100644 --- a/tests/ui/resolve/multiple_definitions_attribute_merging.rs +++ b/tests/ui/resolve/multiple_definitions_attribute_merging.rs @@ -5,7 +5,7 @@ //@known-bug: #120873 //@ failure-status: 101 //@ normalize-stderr: "note: .*\n\n" -> "" -//@ normalize-stderr: "thread 'rustc' panicked.*\n" -> "" +//@ normalize-stderr: "thread 'rustc'.*panicked.*\n" -> "" //@ normalize-stderr: "(error: internal compiler error: [^:]+):\d+:\d+: " -> "$1:LL:CC: " //@ rustc-env:RUST_BACKTRACE=0 diff --git a/tests/ui/resolve/proc_macro_generated_packed.rs b/tests/ui/resolve/proc_macro_generated_packed.rs index 0cba3c1616d..41236c732bb 100644 --- a/tests/ui/resolve/proc_macro_generated_packed.rs +++ b/tests/ui/resolve/proc_macro_generated_packed.rs @@ -5,7 +5,7 @@ //@known-bug: #120873 //@ failure-status: 101 //@ normalize-stderr: "note: .*\n\n" -> "" -//@ normalize-stderr: "thread 'rustc' panicked.*\n" -> "" +//@ normalize-stderr: "thread 'rustc'.*panicked.*\n" -> "" //@ normalize-stderr: "(error: internal compiler error: [^:]+):\d+:\d+: " -> "$1:LL:CC: " //@ rustc-env:RUST_BACKTRACE=0 diff --git a/tests/ui/issues/issue-11820.rs b/tests/ui/resolve/reference-clone-nonclone-11820.rs index ada844f8ee1..74dad96da94 100644 --- a/tests/ui/issues/issue-11820.rs +++ b/tests/ui/resolve/reference-clone-nonclone-11820.rs @@ -1,3 +1,5 @@ +//! Regression test for https://github.com/rust-lang/rust/issues/11820 + //@ run-pass #![allow(noop_method_call)] diff --git a/tests/ui/issues/issue-33293.rs b/tests/ui/resolve/unresolved-module-error-33293.rs index 115ae3aad20..354f9914d44 100644 --- a/tests/ui/issues/issue-33293.rs +++ b/tests/ui/resolve/unresolved-module-error-33293.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/33293 fn main() { match 0 { aaa::bbb(_) => () diff --git a/tests/ui/issues/issue-33293.stderr b/tests/ui/resolve/unresolved-module-error-33293.stderr index a82813194d7..28528148387 100644 --- a/tests/ui/issues/issue-33293.stderr +++ b/tests/ui/resolve/unresolved-module-error-33293.stderr @@ -1,5 +1,5 @@ error[E0433]: failed to resolve: use of unresolved module or unlinked crate `aaa` - --> $DIR/issue-33293.rs:3:9 + --> $DIR/unresolved-module-error-33293.rs:4:9 | LL | aaa::bbb(_) => () | ^^^ use of unresolved module or unlinked crate `aaa` diff --git a/tests/ui/rustdoc/cfg-rustdoc.rs b/tests/ui/rustdoc/cfg-rustdoc.rs index dd8e1ed97c4..11c48d07552 100644 --- a/tests/ui/rustdoc/cfg-rustdoc.rs +++ b/tests/ui/rustdoc/cfg-rustdoc.rs @@ -1,6 +1,7 @@ -#[cfg(doc)] -pub struct Foo; +#[cfg(doc)] //~ NOTE the item is gated here +pub struct Foo; //~ NOTE found an item that was configured out fn main() { - let f = Foo; //~ ERROR + let f = Foo; //~ ERROR cannot find value `Foo` in this scope + //~^ NOTE not found in this scope } diff --git a/tests/ui/rustdoc/cfg-rustdoc.stderr b/tests/ui/rustdoc/cfg-rustdoc.stderr index 340a8e22482..0e8a5dfea61 100644 --- a/tests/ui/rustdoc/cfg-rustdoc.stderr +++ b/tests/ui/rustdoc/cfg-rustdoc.stderr @@ -3,6 +3,14 @@ error[E0425]: cannot find value `Foo` in this scope | LL | let f = Foo; | ^^^ not found in this scope + | +note: found an item that was configured out + --> $DIR/cfg-rustdoc.rs:2:12 + | +LL | #[cfg(doc)] + | --- the item is gated here +LL | pub struct Foo; + | ^^^ error: aborting due to 1 previous error diff --git a/tests/ui/issues/issue-13214.rs b/tests/ui/statics/enum-with-static-str-variant-13214.rs index 8140ec943a0..1db37da632d 100644 --- a/tests/ui/issues/issue-13214.rs +++ b/tests/ui/statics/enum-with-static-str-variant-13214.rs @@ -1,3 +1,5 @@ +//! Regression test for https://github.com/rust-lang/rust/issues/13214 + //@ build-pass #![allow(dead_code)] // defining static with struct that contains enum diff --git a/tests/ui/issues/issue-47073-zero-padded-tuple-struct-indices.rs b/tests/ui/structs/tuple-struct-field-naming-47073.rs index 6cd1f144359..6cf27e55c4b 100644 --- a/tests/ui/issues/issue-47073-zero-padded-tuple-struct-indices.rs +++ b/tests/ui/structs/tuple-struct-field-naming-47073.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/47073 type Guilty = bool; type FineDollars = u32; diff --git a/tests/ui/issues/issue-47073-zero-padded-tuple-struct-indices.stderr b/tests/ui/structs/tuple-struct-field-naming-47073.stderr index 0a6fe24d5e3..efbdaeca4ea 100644 --- a/tests/ui/issues/issue-47073-zero-padded-tuple-struct-indices.stderr +++ b/tests/ui/structs/tuple-struct-field-naming-47073.stderr @@ -1,5 +1,5 @@ error[E0609]: no field `00` on type `Verdict` - --> $DIR/issue-47073-zero-padded-tuple-struct-indices.rs:8:30 + --> $DIR/tuple-struct-field-naming-47073.rs:9:30 | LL | let _condemned = justice.00; | ^^ unknown field @@ -11,7 +11,7 @@ LL + let _condemned = justice.0; | error[E0609]: no field `001` on type `Verdict` - --> $DIR/issue-47073-zero-padded-tuple-struct-indices.rs:10:31 + --> $DIR/tuple-struct-field-naming-47073.rs:11:31 | LL | let _punishment = justice.001; | ^^^ unknown field diff --git a/tests/ui/suggestions/assoc-ct-for-assoc-method.stderr b/tests/ui/suggestions/assoc-ct-for-assoc-method.stderr index 6d6fd983038..47efe69cfc2 100644 --- a/tests/ui/suggestions/assoc-ct-for-assoc-method.stderr +++ b/tests/ui/suggestions/assoc-ct-for-assoc-method.stderr @@ -8,7 +8,7 @@ LL | let x: i32 = MyS::foo; | = note: expected type `i32` found fn item `fn() -> MyS {MyS::foo}` -help: try referring to the associated const `FOO` instead (notice the capitalization difference) +help: try referring to the associated const `FOO` instead (notice the capitalization) | LL - let x: i32 = MyS::foo; LL + let x: i32 = MyS::FOO; diff --git a/tests/ui/suggestions/bool_typo_err_suggest.stderr b/tests/ui/suggestions/bool_typo_err_suggest.stderr index faf799d0fda..d46ce1ad8a9 100644 --- a/tests/ui/suggestions/bool_typo_err_suggest.stderr +++ b/tests/ui/suggestions/bool_typo_err_suggest.stderr @@ -16,7 +16,7 @@ error[E0425]: cannot find value `False` in this scope LL | let y = False; | ^^^^^ not found in this scope | -help: you may want to use a bool value instead (notice the capitalization difference) +help: you may want to use a bool value instead (notice the capitalization) | LL - let y = False; LL + let y = false; diff --git a/tests/ui/suggestions/case-difference-suggestions.rs b/tests/ui/suggestions/case-difference-suggestions.rs new file mode 100644 index 00000000000..d554b6e9367 --- /dev/null +++ b/tests/ui/suggestions/case-difference-suggestions.rs @@ -0,0 +1,57 @@ +fn main() { + + // Simple case difference, no hit + let hello = "hello"; + println!("{}", Hello); //~ ERROR cannot find value `Hello` in this scope + + // Multiple case differences, hit + let myVariable = 10; + println!("{}", myvariable); //~ ERROR cannot find value `myvariable` in this scope + + // Case difference with special characters, hit + let user_name = "john"; + println!("{}", User_Name); //~ ERROR cannot find value `User_Name` in this scope + + // All uppercase vs all lowercase, hit + let FOO = 42; + println!("{}", foo); //~ ERROR cannot find value `foo` in this scope + + + // 0 vs O + let FFO0 = 100; + println!("{}", FFOO); //~ ERROR cannot find value `FFOO` in this scope + + let l1st = vec![1, 2, 3]; + println!("{}", list); //~ ERROR cannot find value `list` in this scope + + let S5 = "test"; + println!("{}", SS); //~ ERROR cannot find value `SS` in this scope + + let aS5 = "test"; + println!("{}", a55); //~ ERROR cannot find value `a55` in this scope + + let B8 = 8; + println!("{}", BB); //~ ERROR cannot find value `BB` in this scope + + let g9 = 9; + println!("{}", gg); //~ ERROR cannot find value `gg` in this scope + + let o1d = "old"; + println!("{}", old); //~ ERROR cannot find value `old` in this scope + + let new1 = "new"; + println!("{}", newl); //~ ERROR cannot find value `newl` in this scope + + let apple = "apple"; + println!("{}", app1e); //~ ERROR cannot find value `app1e` in this scope + + let a = 1; + println!("{}", A); //~ ERROR cannot find value `A` in this scope + + let worldlu = "world"; + println!("{}", world1U); //~ ERROR cannot find value `world1U` in this scope + + let myV4rlable = 42; + println!("{}", myv4r1able); //~ ERROR cannot find value `myv4r1able` in this scope + +} diff --git a/tests/ui/suggestions/case-difference-suggestions.stderr b/tests/ui/suggestions/case-difference-suggestions.stderr new file mode 100644 index 00000000000..c3d2410a6eb --- /dev/null +++ b/tests/ui/suggestions/case-difference-suggestions.stderr @@ -0,0 +1,99 @@ +error[E0425]: cannot find value `Hello` in this scope + --> $DIR/case-difference-suggestions.rs:5:20 + | +LL | println!("{}", Hello); + | ^^^^^ help: a local variable with a similar name exists: `hello` + +error[E0425]: cannot find value `myvariable` in this scope + --> $DIR/case-difference-suggestions.rs:9:20 + | +LL | println!("{}", myvariable); + | ^^^^^^^^^^ help: a local variable with a similar name exists (notice the capitalization): `myVariable` + +error[E0425]: cannot find value `User_Name` in this scope + --> $DIR/case-difference-suggestions.rs:13:20 + | +LL | println!("{}", User_Name); + | ^^^^^^^^^ help: a local variable with a similar name exists: `user_name` + +error[E0425]: cannot find value `foo` in this scope + --> $DIR/case-difference-suggestions.rs:17:20 + | +LL | println!("{}", foo); + | ^^^ help: a local variable with a similar name exists (notice the capitalization): `FOO` + +error[E0425]: cannot find value `FFOO` in this scope + --> $DIR/case-difference-suggestions.rs:22:20 + | +LL | println!("{}", FFOO); + | ^^^^ help: a local variable with a similar name exists (notice the digit/letter confusion): `FFO0` + +error[E0425]: cannot find value `list` in this scope + --> $DIR/case-difference-suggestions.rs:25:20 + | +LL | println!("{}", list); + | ^^^^ help: a local variable with a similar name exists: `l1st` + +error[E0425]: cannot find value `SS` in this scope + --> $DIR/case-difference-suggestions.rs:28:20 + | +LL | println!("{}", SS); + | ^^ help: a local variable with a similar name exists (notice the digit/letter confusion): `S5` + +error[E0425]: cannot find value `a55` in this scope + --> $DIR/case-difference-suggestions.rs:31:20 + | +LL | println!("{}", a55); + | ^^^ help: a local variable with a similar name exists (notice the digit/letter confusion): `aS5` + +error[E0425]: cannot find value `BB` in this scope + --> $DIR/case-difference-suggestions.rs:34:20 + | +LL | println!("{}", BB); + | ^^ help: a local variable with a similar name exists (notice the digit/letter confusion): `B8` + +error[E0425]: cannot find value `gg` in this scope + --> $DIR/case-difference-suggestions.rs:37:20 + | +LL | println!("{}", gg); + | ^^ help: a local variable with a similar name exists (notice the digit/letter confusion): `g9` + +error[E0425]: cannot find value `old` in this scope + --> $DIR/case-difference-suggestions.rs:40:20 + | +LL | println!("{}", old); + | ^^^ help: a local variable with a similar name exists (notice the digit/letter confusion): `o1d` + +error[E0425]: cannot find value `newl` in this scope + --> $DIR/case-difference-suggestions.rs:43:20 + | +LL | println!("{}", newl); + | ^^^^ help: a local variable with a similar name exists (notice the digit/letter confusion): `new1` + +error[E0425]: cannot find value `app1e` in this scope + --> $DIR/case-difference-suggestions.rs:46:20 + | +LL | println!("{}", app1e); + | ^^^^^ help: a local variable with a similar name exists (notice the digit/letter confusion): `apple` + +error[E0425]: cannot find value `A` in this scope + --> $DIR/case-difference-suggestions.rs:49:20 + | +LL | println!("{}", A); + | ^ help: a local variable with a similar name exists: `a` + +error[E0425]: cannot find value `world1U` in this scope + --> $DIR/case-difference-suggestions.rs:52:20 + | +LL | println!("{}", world1U); + | ^^^^^^^ help: a local variable with a similar name exists (notice the capitalization and digit/letter confusion): `worldlu` + +error[E0425]: cannot find value `myv4r1able` in this scope + --> $DIR/case-difference-suggestions.rs:55:20 + | +LL | println!("{}", myv4r1able); + | ^^^^^^^^^^ help: a local variable with a similar name exists (notice the capitalization and digit/letter confusion): `myV4rlable` + +error: aborting due to 16 previous errors + +For more information about this error, try `rustc --explain E0425`. diff --git a/tests/ui/suggestions/incorrect-variant-literal.svg b/tests/ui/suggestions/incorrect-variant-literal.svg index 279fd30f216..2cab1f4b60f 100644 --- a/tests/ui/suggestions/incorrect-variant-literal.svg +++ b/tests/ui/suggestions/incorrect-variant-literal.svg @@ -455,7 +455,7 @@ </tspan> <tspan x="10px" y="3916px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> </tspan> - <tspan x="10px" y="3934px"><tspan class="fg-ansi256-014 bold">help</tspan><tspan>: there is a variant with a similar name (notice the capitalization difference)</tspan> + <tspan x="10px" y="3934px"><tspan class="fg-ansi256-014 bold">help</tspan><tspan>: there is a variant with a similar name (notice the capitalization)</tspan> </tspan> <tspan x="10px" y="3952px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> </tspan> diff --git a/tests/ui/issues/auxiliary/issue-9188.rs b/tests/ui/symbol-names/auxiliary/aux-9188.rs index 3bc5697a1a6..3bc5697a1a6 100644 --- a/tests/ui/issues/auxiliary/issue-9188.rs +++ b/tests/ui/symbol-names/auxiliary/aux-9188.rs diff --git a/tests/ui/symbol-names/same-symbol-name-for-inner-statics-9188.rs b/tests/ui/symbol-names/same-symbol-name-for-inner-statics-9188.rs new file mode 100644 index 00000000000..a1014bb813f --- /dev/null +++ b/tests/ui/symbol-names/same-symbol-name-for-inner-statics-9188.rs @@ -0,0 +1,11 @@ +// https://github.com/rust-lang/rust/issues/9188 +//@ run-pass +//@ aux-build:aux-9188.rs + +extern crate aux_9188 as lib; + +pub fn main() { + let a = lib::bar(); + let b = lib::foo::<isize>(); + assert_eq!(*a, *b); +} diff --git a/tests/ui/test-attrs/terse.run.stdout b/tests/ui/test-attrs/terse.run.stdout index ac1ac28c98d..381d3cbe675 100644 --- a/tests/ui/test-attrs/terse.run.stdout +++ b/tests/ui/test-attrs/terse.run.stdout @@ -10,18 +10,18 @@ failures: ---- abc stdout ---- -thread 'abc' panicked at $DIR/terse.rs:12:5: +thread 'abc' ($TID) panicked at $DIR/terse.rs:12:5: explicit panic note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace ---- foo stdout ---- -thread 'foo' panicked at $DIR/terse.rs:17:5: +thread 'foo' ($TID) panicked at $DIR/terse.rs:17:5: explicit panic ---- foo2 stdout ---- -thread 'foo2' panicked at $DIR/terse.rs:22:5: +thread 'foo2' ($TID) panicked at $DIR/terse.rs:22:5: explicit panic diff --git a/tests/ui/test-attrs/test-panic-abort-nocapture.run.stderr b/tests/ui/test-attrs/test-panic-abort-nocapture.run.stderr index b9f267838b1..8d7c62f8ec7 100644 --- a/tests/ui/test-attrs/test-panic-abort-nocapture.run.stderr +++ b/tests/ui/test-attrs/test-panic-abort-nocapture.run.stderr @@ -1,11 +1,11 @@ -thread 'main' panicked at $DIR/test-panic-abort-nocapture.rs:32:5: +thread 'main' ($TID) panicked at $DIR/test-panic-abort-nocapture.rs:32:5: assertion `left == right` failed left: 2 right: 4 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace -thread 'main' panicked at $DIR/test-panic-abort-nocapture.rs:26:5: +thread 'main' ($TID) panicked at $DIR/test-panic-abort-nocapture.rs:26:5: assertion `left == right` failed left: 2 right: 4 diff --git a/tests/ui/test-attrs/test-panic-abort.run.stdout b/tests/ui/test-attrs/test-panic-abort.run.stdout index 0faa7f0dfce..4d65c05b944 100644 --- a/tests/ui/test-attrs/test-panic-abort.run.stdout +++ b/tests/ui/test-attrs/test-panic-abort.run.stdout @@ -18,7 +18,7 @@ testing123 ---- it_fails stderr ---- testing321 -thread 'main' panicked at $DIR/test-panic-abort.rs:37:5: +thread 'main' ($TID) panicked at $DIR/test-panic-abort.rs:37:5: assertion `left == right` failed left: 2 right: 5 diff --git a/tests/ui/test-attrs/test-should-panic-failed-show-span.run.stderr b/tests/ui/test-attrs/test-should-panic-failed-show-span.run.stderr index db379a16b52..63bc10ef5ea 100644 --- a/tests/ui/test-attrs/test-should-panic-failed-show-span.run.stderr +++ b/tests/ui/test-attrs/test-should-panic-failed-show-span.run.stderr @@ -1,13 +1,13 @@ -thread 'should_panic_with_any_message' panicked at $DIR/test-should-panic-failed-show-span.rs:14:5: +thread 'should_panic_with_any_message' ($TID) panicked at $DIR/test-should-panic-failed-show-span.rs:14:5: Panic! note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace -thread 'should_panic_with_message' panicked at $DIR/test-should-panic-failed-show-span.rs:20:5: +thread 'should_panic_with_message' ($TID) panicked at $DIR/test-should-panic-failed-show-span.rs:20:5: message -thread 'should_panic_with_substring_panics_with_incorrect_string' panicked at $DIR/test-should-panic-failed-show-span.rs:38:5: +thread 'should_panic_with_substring_panics_with_incorrect_string' ($TID) panicked at $DIR/test-should-panic-failed-show-span.rs:38:5: ZOMGWTFBBQ -thread 'should_panic_with_substring_panics_with_non_string_value' panicked at $DIR/test-should-panic-failed-show-span.rs:45:5: +thread 'should_panic_with_substring_panics_with_non_string_value' ($TID) panicked at $DIR/test-should-panic-failed-show-span.rs:45:5: Box<dyn Any> diff --git a/tests/ui/test-attrs/test-thread-capture.run.stdout b/tests/ui/test-attrs/test-thread-capture.run.stdout index f9b9757f861..bea3dcb1041 100644 --- a/tests/ui/test-attrs/test-thread-capture.run.stdout +++ b/tests/ui/test-attrs/test-thread-capture.run.stdout @@ -11,7 +11,7 @@ fie foe fum -thread 'thready_fail' panicked at $DIR/test-thread-capture.rs:32:5: +thread 'thready_fail' ($TID) panicked at $DIR/test-thread-capture.rs:32:5: explicit panic note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace diff --git a/tests/ui/test-attrs/test-thread-nocapture.run.stderr b/tests/ui/test-attrs/test-thread-nocapture.run.stderr index 59560015fca..b9905b0c2f9 100644 --- a/tests/ui/test-attrs/test-thread-nocapture.run.stderr +++ b/tests/ui/test-attrs/test-thread-nocapture.run.stderr @@ -1,4 +1,4 @@ -thread 'thready_fail' panicked at $DIR/test-thread-nocapture.rs:32:5: +thread 'thready_fail' ($TID) panicked at $DIR/test-thread-nocapture.rs:32:5: explicit panic note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace diff --git a/tests/ui/threads-sendsync/tcp-stress.rs b/tests/ui/threads-sendsync/tcp-stress.rs deleted file mode 100644 index b2f76a55fb9..00000000000 --- a/tests/ui/threads-sendsync/tcp-stress.rs +++ /dev/null @@ -1,64 +0,0 @@ -//@ run-pass -//@ ignore-android needs extra network permissions -//@ needs-threads -//@ ignore-netbsd system ulimit (Too many open files) -//@ ignore-openbsd system ulimit (Too many open files) - -use std::io::prelude::*; -use std::net::{TcpListener, TcpStream}; -use std::process; -use std::sync::mpsc::channel; -use std::thread::{self, Builder}; -use std::time::Duration; - -const TARGET_CNT: usize = 200; - -fn main() { - // This test has a chance to time out, try to not let it time out - thread::spawn(move || -> () { - thread::sleep(Duration::from_secs(30)); - process::exit(1); - }); - - let listener = TcpListener::bind("127.0.0.1:0").unwrap(); - let addr = listener.local_addr().unwrap(); - thread::spawn(move || -> () { - loop { - let mut stream = match listener.accept() { - Ok(stream) => stream.0, - Err(_) => continue, - }; - let _ = stream.read(&mut [0]); - let _ = stream.write(&[2]); - } - }); - - let (tx, rx) = channel(); - - let mut spawned_cnt = 0; - for _ in 0..TARGET_CNT { - let tx = tx.clone(); - let res = Builder::new().stack_size(64 * 1024).spawn(move || { - match TcpStream::connect(addr) { - Ok(mut stream) => { - let _ = stream.write(&[1]); - let _ = stream.read(&mut [0]); - } - Err(..) => {} - } - tx.send(()).unwrap(); - }); - if let Ok(_) = res { - spawned_cnt += 1; - }; - } - - // Wait for all clients to exit, but don't wait for the server to exit. The - // server just runs infinitely. - drop(tx); - for _ in 0..spawned_cnt { - rx.recv().unwrap(); - } - assert_eq!(spawned_cnt, TARGET_CNT); - process::exit(0); -} diff --git a/tests/ui/track-diagnostics/track.rs b/tests/ui/track-diagnostics/track.rs index 1b2558c724b..9ce0a4a555a 100644 --- a/tests/ui/track-diagnostics/track.rs +++ b/tests/ui/track-diagnostics/track.rs @@ -13,6 +13,11 @@ // top of this file are present, then assume all args are present. //@ normalize-stderr: "note: compiler flags: .*-Z ui-testing.*-Z track-diagnostics" -> "note: compiler flags: ... -Z ui-testing ... -Z track-diagnostics" +// FIXME: this tests a crash in rustc. For stage1, rustc is built with the downloaded standard +// library which doesn't yet print the thread ID. Normalization can be removed at the stage bump. +// For the grep: cfg(bootstrap) +//@normalize-stderr: "thread 'rustc' panicked" -> "thread 'rustc' ($$TID) panicked" + fn main() { break rust //~^ ERROR cannot find value `rust` in this scope diff --git a/tests/ui/track-diagnostics/track.stderr b/tests/ui/track-diagnostics/track.stderr index f82764958d4..bc04ded379d 100644 --- a/tests/ui/track-diagnostics/track.stderr +++ b/tests/ui/track-diagnostics/track.stderr @@ -27,7 +27,7 @@ LL | break rust = note: compiler flags: ... -Z ui-testing ... -Z track-diagnostics -thread 'rustc' panicked at compiler/rustc_hir_typeck/src/lib.rs:LL:CC: +thread 'rustc' ($TID) panicked at compiler/rustc_hir_typeck/src/lib.rs:LL:CC: Box<dyn Any> note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace diff --git a/tests/ui/issues/issue-72839-error-overflow.rs b/tests/ui/trait-bounds/trait-selection-overflow-prevention-72839.rs index 6562d228409..436657e3de5 100644 --- a/tests/ui/issues/issue-72839-error-overflow.rs +++ b/tests/ui/trait-bounds/trait-selection-overflow-prevention-72839.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/72839 // Regression test for issue #72839 // Tests that we do not overflow during trait selection after // a type error occurs diff --git a/tests/ui/issues/issue-72839-error-overflow.stderr b/tests/ui/trait-bounds/trait-selection-overflow-prevention-72839.stderr index 35be632f579..da7500f77e1 100644 --- a/tests/ui/issues/issue-72839-error-overflow.stderr +++ b/tests/ui/trait-bounds/trait-selection-overflow-prevention-72839.stderr @@ -1,5 +1,5 @@ error[E0425]: cannot find value `missing_var` in this scope - --> $DIR/issue-72839-error-overflow.rs:18:8 + --> $DIR/trait-selection-overflow-prevention-72839.rs:19:8 | LL | if missing_var % 8 == 0 {} | ^^^^^^^^^^^ not found in this scope diff --git a/tests/ui/issues/issue-47638.rs b/tests/ui/trait-objects/trait-object-lifetime-conversion-47638.rs index e5a51ce0c06..c70dc74f3e5 100644 --- a/tests/ui/issues/issue-47638.rs +++ b/tests/ui/trait-objects/trait-object-lifetime-conversion-47638.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/47638 //@ run-pass #![allow(unused_variables)] fn id<'c, 'b>(f: &'c &'b dyn Fn(&i32)) -> &'c &'b dyn Fn(&'static i32) { diff --git a/tests/ui/traits/const-traits/conditionally-const-in-anon-const.rs b/tests/ui/traits/const-traits/conditionally-const-in-anon-const.rs new file mode 100644 index 00000000000..5aebcceb7c7 --- /dev/null +++ b/tests/ui/traits/const-traits/conditionally-const-in-anon-const.rs @@ -0,0 +1,28 @@ +#![feature(const_trait_impl, impl_trait_in_bindings)] + +struct S; +#[const_trait] +trait Trait<const N: u32> {} + +impl const Trait<0> for () {} + +const fn f< + T: Trait< + { + const fn g<U: [const] Trait<0>>() {} + + struct I<U: [const] Trait<0>>(U); + //~^ ERROR `[const]` is not allowed here + + let x: &impl [const] Trait<0> = &(); + //~^ ERROR `[const]` is not allowed here + + 0 + }, + >, +>(x: &T) { + // Should be allowed here + let y: &impl [const] Trait<0> = x; +} + +pub fn main() {} diff --git a/tests/ui/traits/const-traits/conditionally-const-in-anon-const.stderr b/tests/ui/traits/const-traits/conditionally-const-in-anon-const.stderr new file mode 100644 index 00000000000..c6be249b95a --- /dev/null +++ b/tests/ui/traits/const-traits/conditionally-const-in-anon-const.stderr @@ -0,0 +1,32 @@ +error: `[const]` is not allowed here + --> $DIR/conditionally-const-in-anon-const.rs:14:25 + | +LL | struct I<U: [const] Trait<0>>(U); + | ^^^^^^^ + | +note: structs cannot have `[const]` trait bounds + --> $DIR/conditionally-const-in-anon-const.rs:14:13 + | +LL | struct I<U: [const] Trait<0>>(U); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: `[const]` is not allowed here + --> $DIR/conditionally-const-in-anon-const.rs:17:26 + | +LL | let x: &impl [const] Trait<0> = &(); + | ^^^^^^^ + | +note: anonymous constants cannot have `[const]` trait bounds + --> $DIR/conditionally-const-in-anon-const.rs:11:9 + | +LL | / { +LL | | const fn g<U: [const] Trait<0>>() {} +LL | | +LL | | struct I<U: [const] Trait<0>>(U); +... | +LL | | 0 +LL | | }, + | |_________^ + +error: aborting due to 2 previous errors + diff --git a/tests/ui/traits/const-traits/conditionally-const-in-struct-args.rs b/tests/ui/traits/const-traits/conditionally-const-in-struct-args.rs deleted file mode 100644 index 0c644694585..00000000000 --- a/tests/ui/traits/const-traits/conditionally-const-in-struct-args.rs +++ /dev/null @@ -1,21 +0,0 @@ -//@ compile-flags: -Znext-solver -//@ known-bug: #132067 -//@ check-pass - -#![feature(const_trait_impl)] - -struct S; -#[const_trait] -trait Trait<const N: u32> {} - -const fn f< - T: Trait< - { - struct I<U: [const] Trait<0>>(U); - 0 - }, - >, ->() { -} - -pub fn main() {} diff --git a/tests/ui/traits/const-traits/conditionally-const-invalid-places.stderr b/tests/ui/traits/const-traits/conditionally-const-invalid-places.stderr index 010b1584643..5c3bb236967 100644 --- a/tests/ui/traits/const-traits/conditionally-const-invalid-places.stderr +++ b/tests/ui/traits/const-traits/conditionally-const-invalid-places.stderr @@ -16,7 +16,11 @@ error: `[const]` is not allowed here LL | struct Struct<T: [const] Trait> { field: T } | ^^^^^^^ | - = note: this item cannot have `[const]` trait bounds +note: structs cannot have `[const]` trait bounds + --> $DIR/conditionally-const-invalid-places.rs:9:1 + | +LL | struct Struct<T: [const] Trait> { field: T } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: `[const]` is not allowed here --> $DIR/conditionally-const-invalid-places.rs:10:23 @@ -24,7 +28,11 @@ error: `[const]` is not allowed here LL | struct TupleStruct<T: [const] Trait>(T); | ^^^^^^^ | - = note: this item cannot have `[const]` trait bounds +note: structs cannot have `[const]` trait bounds + --> $DIR/conditionally-const-invalid-places.rs:10:1 + | +LL | struct TupleStruct<T: [const] Trait>(T); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: `[const]` is not allowed here --> $DIR/conditionally-const-invalid-places.rs:11:22 @@ -32,7 +40,11 @@ error: `[const]` is not allowed here LL | struct UnitStruct<T: [const] Trait>; | ^^^^^^^ | - = note: this item cannot have `[const]` trait bounds +note: structs cannot have `[const]` trait bounds + --> $DIR/conditionally-const-invalid-places.rs:11:1 + | +LL | struct UnitStruct<T: [const] Trait>; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: `[const]` is not allowed here --> $DIR/conditionally-const-invalid-places.rs:14:14 @@ -40,7 +52,11 @@ error: `[const]` is not allowed here LL | enum Enum<T: [const] Trait> { Variant(T) } | ^^^^^^^ | - = note: this item cannot have `[const]` trait bounds +note: enums cannot have `[const]` trait bounds + --> $DIR/conditionally-const-invalid-places.rs:14:1 + | +LL | enum Enum<T: [const] Trait> { Variant(T) } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: `[const]` is not allowed here --> $DIR/conditionally-const-invalid-places.rs:16:16 @@ -48,7 +64,11 @@ error: `[const]` is not allowed here LL | union Union<T: [const] Trait> { field: T } | ^^^^^^^ | - = note: this item cannot have `[const]` trait bounds +note: unions cannot have `[const]` trait bounds + --> $DIR/conditionally-const-invalid-places.rs:16:1 + | +LL | union Union<T: [const] Trait> { field: T } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: `[const]` is not allowed here --> $DIR/conditionally-const-invalid-places.rs:19:14 diff --git a/tests/ui/traits/const-traits/const-closure-issue-125866-error.rs b/tests/ui/traits/const-traits/const-closure-issue-125866-error.rs new file mode 100644 index 00000000000..7a44920bb72 --- /dev/null +++ b/tests/ui/traits/const-traits/const-closure-issue-125866-error.rs @@ -0,0 +1,24 @@ +#![allow(incomplete_features)] +#![feature(const_closures, const_trait_impl)] + +const fn create_array<const N: usize>(mut f: impl FnMut(usize) -> u32 + Copy) -> [u32; N] { + let mut array = [0; N]; + let mut i = 0; + loop { + array[i] = f(i); + //~^ ERROR the trait bound `impl FnMut(usize) -> u32 + Copy: [const] FnMut(usize)` is not satisfied [E0277] + i += 1; + if i == N { + break; + } + } + array +} + +fn main() { + let x = create_array(const |i| 2 * i as u32); + assert_eq!(x, [0, 2, 4, 6, 8]); + + let y = create_array(const |i| 2 * i as u32 + 1); + assert_eq!(y, [1, 3, 5, 7, 9]); +} diff --git a/tests/ui/traits/const-traits/const-closure-issue-125866-error.stderr b/tests/ui/traits/const-traits/const-closure-issue-125866-error.stderr new file mode 100644 index 00000000000..1eadd1d8426 --- /dev/null +++ b/tests/ui/traits/const-traits/const-closure-issue-125866-error.stderr @@ -0,0 +1,11 @@ +error[E0277]: the trait bound `impl FnMut(usize) -> u32 + Copy: [const] FnMut(usize)` is not satisfied + --> $DIR/const-closure-issue-125866-error.rs:8:22 + | +LL | array[i] = f(i); + | - ^ + | | + | required by a bound introduced by this call + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/traits/const-traits/const-closure-issue-125866-pass.rs b/tests/ui/traits/const-traits/const-closure-issue-125866-pass.rs new file mode 100644 index 00000000000..af7375172e6 --- /dev/null +++ b/tests/ui/traits/const-traits/const-closure-issue-125866-pass.rs @@ -0,0 +1,25 @@ +//@ check-pass + +#![allow(incomplete_features)] +#![feature(const_closures, const_trait_impl)] + +const fn create_array<const N: usize>(mut f: impl [const] FnMut(usize) -> u32 + Copy) -> [u32; N] { + let mut array = [0; N]; + let mut i = 0; + loop { + array[i] = f(i); + i += 1; + if i == N { + break; + } + } + array +} + +fn main() { + let x = create_array(const |i| 2 * i as u32); + assert_eq!(x, [0, 2, 4, 6, 8]); + + let y = create_array(const |i| 2 * i as u32 + 1); + assert_eq!(y, [1, 3, 5, 7, 9]); +} diff --git a/tests/ui/traits/const-traits/const-fn-trait-bound-issue-104314.rs b/tests/ui/traits/const-traits/const-fn-trait-bound-issue-104314.rs new file mode 100644 index 00000000000..09c89c9cecd --- /dev/null +++ b/tests/ui/traits/const-traits/const-fn-trait-bound-issue-104314.rs @@ -0,0 +1,13 @@ +//@ check-pass + +#![feature(const_trait_impl, const_destruct, const_clone)] + +use std::marker::Destruct; + +const fn f<T, F: [const] Fn(&T) -> T + [const] Destruct>(_: F) {} + +const fn g<T: [const] Clone>() { + f(<T as Clone>::clone); +} + +fn main() {} diff --git a/tests/ui/traits/const-traits/feature-gate.rs b/tests/ui/traits/const-traits/feature-gate.rs index 5ad56ddcd33..c2918f0249b 100644 --- a/tests/ui/traits/const-traits/feature-gate.rs +++ b/tests/ui/traits/const-traits/feature-gate.rs @@ -13,6 +13,9 @@ impl const T for S {} const fn f<A: [const] T>() {} //[stock]~ ERROR const trait impls are experimental fn g<A: const T>() {} //[stock]~ ERROR const trait impls are experimental +const trait Trait {} //[stock]~ ERROR const trait impls are experimental +#[cfg(false)] const trait Trait {} //[stock]~ ERROR const trait impls are experimental + macro_rules! discard { ($ty:ty) => {} } discard! { impl [const] T } //[stock]~ ERROR const trait impls are experimental diff --git a/tests/ui/traits/const-traits/feature-gate.stock.stderr b/tests/ui/traits/const-traits/feature-gate.stock.stderr index f3ba3039a23..551c7ced7c1 100644 --- a/tests/ui/traits/const-traits/feature-gate.stock.stderr +++ b/tests/ui/traits/const-traits/feature-gate.stock.stderr @@ -29,7 +29,27 @@ LL | fn g<A: const T>() {} = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: const trait impls are experimental - --> $DIR/feature-gate.rs:18:17 + --> $DIR/feature-gate.rs:16:1 + | +LL | const trait Trait {} + | ^^^^^ + | + = note: see issue #143874 <https://github.com/rust-lang/rust/issues/143874> for more information + = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error[E0658]: const trait impls are experimental + --> $DIR/feature-gate.rs:17:15 + | +LL | #[cfg(false)] const trait Trait {} + | ^^^^^ + | + = note: see issue #143874 <https://github.com/rust-lang/rust/issues/143874> for more information + = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error[E0658]: const trait impls are experimental + --> $DIR/feature-gate.rs:21:17 | LL | discard! { impl [const] T } | ^^^^^^^ @@ -39,7 +59,7 @@ LL | discard! { impl [const] T } = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: const trait impls are experimental - --> $DIR/feature-gate.rs:19:17 + --> $DIR/feature-gate.rs:22:17 | LL | discard! { impl const T } | ^^^^^ @@ -58,6 +78,6 @@ LL | #[const_trait] = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error: aborting due to 6 previous errors +error: aborting due to 8 previous errors For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/issues/issue-13204.rs b/tests/ui/traits/default-method-lifetime-params-13204.rs index 01362f6fe61..cdf34ab773c 100644 --- a/tests/ui/issues/issue-13204.rs +++ b/tests/ui/traits/default-method-lifetime-params-13204.rs @@ -1,3 +1,5 @@ +//! Regression test for https://github.com/rust-lang/rust/issues/13204 + //@ run-pass #![allow(unused_mut)] // Test that when instantiating trait default methods, typeck handles diff --git a/tests/ui/issues/issue-13434.rs b/tests/ui/traits/fnonce-repro-trait-impl-13434.rs index caf7b632393..61d5a1d74ae 100644 --- a/tests/ui/issues/issue-13434.rs +++ b/tests/ui/traits/fnonce-repro-trait-impl-13434.rs @@ -1,3 +1,5 @@ +//! Regression test for https://github.com/rust-lang/rust/issues/13434 + //@ run-pass #[derive(Debug)] struct MyStruct; diff --git a/tests/ui/traits/next-solver/assembly/ambiguity-due-to-uniquification-1.next.stderr b/tests/ui/traits/next-solver/assembly/ambiguity-due-to-uniquification-1.next.stderr new file mode 100644 index 00000000000..141a07b4be7 --- /dev/null +++ b/tests/ui/traits/next-solver/assembly/ambiguity-due-to-uniquification-1.next.stderr @@ -0,0 +1,19 @@ +error[E0283]: type annotations needed: cannot satisfy `dyn D<&(), &()>: B<&()>` + --> $DIR/ambiguity-due-to-uniquification-1.rs:15:31 + | +LL | (&() as &dyn D<&(), &()>).f() + | ^ + | + = note: cannot satisfy `dyn D<&(), &()>: B<&()>` + = help: the trait `B<C>` is implemented for `()` +note: required by a bound in `D::f` + --> $DIR/ambiguity-due-to-uniquification-1.rs:10:16 + | +LL | trait D<C, E>: B<C> + B<E> { + | ^^^^ required by this bound in `D::f` +LL | fn f(&self) {} + | - required by a bound in this associated function + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0283`. diff --git a/tests/ui/traits/next-solver/assembly/ambiguity-due-to-uniquification-1.rs b/tests/ui/traits/next-solver/assembly/ambiguity-due-to-uniquification-1.rs new file mode 100644 index 00000000000..cfdf74046fb --- /dev/null +++ b/tests/ui/traits/next-solver/assembly/ambiguity-due-to-uniquification-1.rs @@ -0,0 +1,17 @@ +//@ revisions: current next +//@[next] compile-flags: -Znext-solver +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[current] check-pass + +// Regression test for #139409 and trait-system-refactor-initiative#27. + +trait B<C> {} +impl<C> B<C> for () {} +trait D<C, E>: B<C> + B<E> { + fn f(&self) {} +} +impl<C, E> D<C, E> for () {} +fn main() { + (&() as &dyn D<&(), &()>).f() + //[next]~^ ERROR type annotations needed: cannot satisfy `dyn D<&(), &()>: B<&()>` +} diff --git a/tests/ui/traits/next-solver/assembly/ambiguity-due-to-uniquification-2.next.stderr b/tests/ui/traits/next-solver/assembly/ambiguity-due-to-uniquification-2.next.stderr new file mode 100644 index 00000000000..3b478889996 --- /dev/null +++ b/tests/ui/traits/next-solver/assembly/ambiguity-due-to-uniquification-2.next.stderr @@ -0,0 +1,17 @@ +error[E0283]: type annotations needed: cannot satisfy `impl Trait<'x> + Trait<'y>: Trait<'y>` + --> $DIR/ambiguity-due-to-uniquification-2.rs:16:23 + | +LL | impls_trait::<'y, _>(foo::<'x, 'y>()); + | ^ + | + = note: cannot satisfy `impl Trait<'x> + Trait<'y>: Trait<'y>` + = help: the trait `Trait<'t>` is implemented for `()` +note: required by a bound in `impls_trait` + --> $DIR/ambiguity-due-to-uniquification-2.rs:13:23 + | +LL | fn impls_trait<'x, T: Trait<'x>>(_: T) {} + | ^^^^^^^^^ required by this bound in `impls_trait` + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0283`. diff --git a/tests/ui/traits/next-solver/assembly/ambiguity-due-to-uniquification-2.rs b/tests/ui/traits/next-solver/assembly/ambiguity-due-to-uniquification-2.rs new file mode 100644 index 00000000000..2a9a8b80cc0 --- /dev/null +++ b/tests/ui/traits/next-solver/assembly/ambiguity-due-to-uniquification-2.rs @@ -0,0 +1,20 @@ +//@ revisions: current next +//@[next] compile-flags: -Znext-solver +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[current] check-pass + +// Regression test from trait-system-refactor-initiative#27. + +trait Trait<'t> {} +impl<'t> Trait<'t> for () {} + +fn foo<'x, 'y>() -> impl Trait<'x> + Trait<'y> {} + +fn impls_trait<'x, T: Trait<'x>>(_: T) {} + +fn bar<'x, 'y>() { + impls_trait::<'y, _>(foo::<'x, 'y>()); + //[next]~^ ERROR type annotations needed: cannot satisfy `impl Trait<'x> + Trait<'y>: Trait<'y>` +} + +fn main() {} diff --git a/tests/ui/traits/next-solver/assembly/ambiguity-due-to-uniquification-3.next.stderr b/tests/ui/traits/next-solver/assembly/ambiguity-due-to-uniquification-3.next.stderr new file mode 100644 index 00000000000..e25f892b365 --- /dev/null +++ b/tests/ui/traits/next-solver/assembly/ambiguity-due-to-uniquification-3.next.stderr @@ -0,0 +1,19 @@ +error[E0283]: type annotations needed: cannot satisfy `(dyn Object<&(), &()> + 'static): Trait<&()>` + --> $DIR/ambiguity-due-to-uniquification-3.rs:28:17 + | +LL | impls_trait(obj, t); + | ----------- ^^^ + | | + | required by a bound introduced by this call + | + = note: cannot satisfy `(dyn Object<&(), &()> + 'static): Trait<&()>` + = help: the trait `Trait<T>` is implemented for `()` +note: required by a bound in `impls_trait` + --> $DIR/ambiguity-due-to-uniquification-3.rs:24:19 + | +LL | fn impls_trait<T: Trait<U>, U>(_: Inv<T>, _: Inv<U>) {} + | ^^^^^^^^ required by this bound in `impls_trait` + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0283`. diff --git a/tests/ui/traits/next-solver/assembly/ambiguity-due-to-uniquification-3.rs b/tests/ui/traits/next-solver/assembly/ambiguity-due-to-uniquification-3.rs new file mode 100644 index 00000000000..6dcd9d5bdf4 --- /dev/null +++ b/tests/ui/traits/next-solver/assembly/ambiguity-due-to-uniquification-3.rs @@ -0,0 +1,33 @@ +//@ revisions: current next +//@[next] compile-flags: -Znext-solver +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[current] check-pass + +// Regression test from trait-system-refactor-initiative#27. +// +// Unlike in the previous two tests, `dyn Object<?x, ?y>: Trait<?x>` relies +// on structural identity of type inference variables. This inference variable +// gets constrained to a type containing a region later on. To prevent this +// from causing an ICE during MIR borrowck, we stash goals which depend on +// inference variables and then reprove them at the end of HIR typeck. + +#![feature(rustc_attrs)] +#![rustc_no_implicit_bounds] +trait Trait<T> {} +impl<T> Trait<T> for () {} + +trait Object<T, U>: Trait<T> + Trait<U> {} + +#[derive(Clone, Copy)] +struct Inv<T>(*mut T); +fn foo<T: Sized, U: Sized>() -> (Inv<dyn Object<T, U>>, Inv<T>) { todo!() } +fn impls_trait<T: Trait<U>, U>(_: Inv<T>, _: Inv<U>) {} + +fn bar() { + let (obj, t) = foo(); + impls_trait(obj, t); + //[next]~^ ERROR type annotations needed + let _: Inv<dyn Object<&(), &()>> = obj; +} + +fn main() {} diff --git a/tests/ui/traits/next-solver/cycles/rayon-hang-1.rs b/tests/ui/traits/next-solver/cycles/rayon-hang-1.rs new file mode 100644 index 00000000000..61e1f1b200f --- /dev/null +++ b/tests/ui/traits/next-solver/cycles/rayon-hang-1.rs @@ -0,0 +1,32 @@ +//@ compile-flags: -Znext-solver +//@ check-pass + +// A regression test for trait-system-refactor-initiative#109. + +trait ParallelIterator: Sized { + type Item; +} +trait IntoParallelIterator { + type Iter: ParallelIterator<Item = Self::Item>; + type Item; +} +impl<T: ParallelIterator> IntoParallelIterator for T { + type Iter = T; + type Item = T::Item; +} + +macro_rules! multizip_impls { + ($($T:ident),+) => { + fn foo<$( $T, )+>() where + $( + $T: IntoParallelIterator, + $T::Iter: ParallelIterator, + )+ + ($( $T, )+): IntoParallelIterator<Item = ($( $T::Item, )+)>, + {} + } +} + +multizip_impls! { A, B, C, D, E, F, G, H, I, J, K, L } + +fn main() {} diff --git a/tests/ui/traits/next-solver/cycles/rayon-hang-2.rs b/tests/ui/traits/next-solver/cycles/rayon-hang-2.rs new file mode 100644 index 00000000000..bb5d8335dd6 --- /dev/null +++ b/tests/ui/traits/next-solver/cycles/rayon-hang-2.rs @@ -0,0 +1,49 @@ +//@ compile-flags: -Znext-solver +//@ check-pass + +// A regression test for trait-system-refactor-initiative#109. +// Unlike `rayon-hang-1.rs` the cycles in this test are not +// unproductive, which causes the `AliasRelate` goal when trying +// to apply where-clauses to only error in the second iteration. +// +// This makes the exponential blowup to be significantly harder +// to avoid. + +trait ParallelIterator: Sized { + type Item; +} + +trait IntoParallelIteratorIndir { + type Iter: ParallelIterator<Item = Self::Item>; + type Item; +} +impl<I> IntoParallelIteratorIndir for I +where + Box<I>: IntoParallelIterator, +{ + type Iter = <Box<I> as IntoParallelIterator>::Iter; + type Item = <Box<I> as IntoParallelIterator>::Item; +} +trait IntoParallelIterator { + type Iter: ParallelIterator<Item = Self::Item>; + type Item; +} +impl<T: ParallelIterator> IntoParallelIterator for T { + type Iter = T; + type Item = T::Item; +} + +macro_rules! multizip_impls { + ($($T:ident),+) => { + fn foo<'a, $( $T, )+>() where + $( + $T: IntoParallelIteratorIndir, + $T::Iter: ParallelIterator, + )+ + {} + } +} + +multizip_impls! { A, B, C, D, E, F, G, H, I, J, K, L } + +fn main() {} diff --git a/tests/ui/issues/issue-20413.rs b/tests/ui/traits/trait-impl-overflow-with-where-clause-20413.rs index 138a235e675..e8c27ff5cc8 100644 --- a/tests/ui/issues/issue-20413.rs +++ b/tests/ui/traits/trait-impl-overflow-with-where-clause-20413.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/20413 trait Foo { fn answer(self); } diff --git a/tests/ui/issues/issue-20413.stderr b/tests/ui/traits/trait-impl-overflow-with-where-clause-20413.stderr index 42f3cd2d062..72aff1b9ee8 100644 --- a/tests/ui/issues/issue-20413.stderr +++ b/tests/ui/traits/trait-impl-overflow-with-where-clause-20413.stderr @@ -1,5 +1,5 @@ error[E0392]: type parameter `T` is never used - --> $DIR/issue-20413.rs:5:15 + --> $DIR/trait-impl-overflow-with-where-clause-20413.rs:6:15 | LL | struct NoData<T>; | ^ unused type parameter @@ -8,14 +8,14 @@ LL | struct NoData<T>; = help: if you intended `T` to be a const parameter, use `const T: /* Type */` instead error[E0275]: overflow evaluating the requirement `NoData<NoData<NoData<NoData<NoData<NoData<NoData<...>>>>>>>: Foo` - --> $DIR/issue-20413.rs:8:36 + --> $DIR/trait-impl-overflow-with-where-clause-20413.rs:9:36 | LL | impl<T> Foo for T where NoData<T>: Foo { | ^^^ | - = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`issue_20413`) + = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`trait_impl_overflow_with_where_clause_20413`) note: required for `NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<T>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` to implement `Foo` - --> $DIR/issue-20413.rs:8:9 + --> $DIR/trait-impl-overflow-with-where-clause-20413.rs:9:9 | LL | impl<T> Foo for T where NoData<T>: Foo { | ^^^ ^ --- unsatisfied trait bound introduced here @@ -23,19 +23,19 @@ LL | impl<T> Foo for T where NoData<T>: Foo { = note: required for `NoData<T>` to implement `Foo` error[E0275]: overflow evaluating the requirement `AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<...>>>>>>>: Bar` - --> $DIR/issue-20413.rs:27:42 + --> $DIR/trait-impl-overflow-with-where-clause-20413.rs:28:42 | LL | impl<T> Bar for T where EvenLessData<T>: Baz { | ^^^ | - = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`issue_20413`) + = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`trait_impl_overflow_with_where_clause_20413`) note: required for `EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<T>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` to implement `Baz` - --> $DIR/issue-20413.rs:34:9 + --> $DIR/trait-impl-overflow-with-where-clause-20413.rs:35:9 | LL | impl<T> Baz for T where AlmostNoData<T>: Bar { | ^^^ ^ --- unsatisfied trait bound introduced here note: required for `AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<T>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` to implement `Bar` - --> $DIR/issue-20413.rs:27:9 + --> $DIR/trait-impl-overflow-with-where-clause-20413.rs:28:9 | LL | impl<T> Bar for T where EvenLessData<T>: Baz { | ^^^ ^ --- unsatisfied trait bound introduced here @@ -43,19 +43,19 @@ LL | impl<T> Bar for T where EvenLessData<T>: Baz { = note: required for `EvenLessData<T>` to implement `Baz` error[E0275]: overflow evaluating the requirement `EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<...>>>>>>>: Baz` - --> $DIR/issue-20413.rs:34:42 + --> $DIR/trait-impl-overflow-with-where-clause-20413.rs:35:42 | LL | impl<T> Baz for T where AlmostNoData<T>: Bar { | ^^^ | - = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`issue_20413`) + = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`trait_impl_overflow_with_where_clause_20413`) note: required for `AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<T>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` to implement `Bar` - --> $DIR/issue-20413.rs:27:9 + --> $DIR/trait-impl-overflow-with-where-clause-20413.rs:28:9 | LL | impl<T> Bar for T where EvenLessData<T>: Baz { | ^^^ ^ --- unsatisfied trait bound introduced here note: required for `EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<T>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` to implement `Baz` - --> $DIR/issue-20413.rs:34:9 + --> $DIR/trait-impl-overflow-with-where-clause-20413.rs:35:9 | LL | impl<T> Baz for T where AlmostNoData<T>: Bar { | ^^^ ^ --- unsatisfied trait bound introduced here diff --git a/tests/ui/treat-err-as-bug/err.rs b/tests/ui/treat-err-as-bug/err.rs index 6f0e3c55fbb..f297a5773cb 100644 --- a/tests/ui/treat-err-as-bug/err.rs +++ b/tests/ui/treat-err-as-bug/err.rs @@ -1,7 +1,7 @@ //@ compile-flags: -Ztreat-err-as-bug //@ failure-status: 101 //@ normalize-stderr: "note: .*\n\n" -> "" -//@ normalize-stderr: "thread 'rustc' panicked.*:\n.*\n" -> "" +//@ normalize-stderr: "thread 'rustc'.*panicked.*:\n.*\n" -> "" //@ rustc-env:RUST_BACKTRACE=0 #![crate_type = "rlib"] diff --git a/tests/ui/treat-err-as-bug/span_delayed_bug.rs b/tests/ui/treat-err-as-bug/span_delayed_bug.rs index 4681a8fc1ee..ff5a595899a 100644 --- a/tests/ui/treat-err-as-bug/span_delayed_bug.rs +++ b/tests/ui/treat-err-as-bug/span_delayed_bug.rs @@ -1,7 +1,7 @@ //@ compile-flags: -Ztreat-err-as-bug -Zeagerly-emit-delayed-bugs //@ failure-status: 101 //@ normalize-stderr: "note: .*\n\n" -> "" -//@ normalize-stderr: "thread 'rustc' panicked.*:\n.*\n" -> "" +//@ normalize-stderr: "thread 'rustc'.*panicked.*:\n.*\n" -> "" //@ rustc-env:RUST_BACKTRACE=0 #![feature(rustc_attrs)] diff --git a/tests/ui/issues/issue-51632-try-desugar-incompatible-types.rs b/tests/ui/try-trait/incompatible-types-with-question-mark-51632.rs index 35402dff675..4b2081d14d0 100644 --- a/tests/ui/issues/issue-51632-try-desugar-incompatible-types.rs +++ b/tests/ui/try-trait/incompatible-types-with-question-mark-51632.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/51632 #![allow(dead_code)] fn missing_discourses() -> Result<isize, ()> { diff --git a/tests/ui/issues/issue-51632-try-desugar-incompatible-types.stderr b/tests/ui/try-trait/incompatible-types-with-question-mark-51632.stderr index 99fce1eeea6..c624605d76a 100644 --- a/tests/ui/issues/issue-51632-try-desugar-incompatible-types.stderr +++ b/tests/ui/try-trait/incompatible-types-with-question-mark-51632.stderr @@ -1,5 +1,5 @@ error[E0308]: `?` operator has incompatible types - --> $DIR/issue-51632-try-desugar-incompatible-types.rs:8:5 + --> $DIR/incompatible-types-with-question-mark-51632.rs:9:5 | LL | fn forbidden_narratives() -> Result<isize, ()> { | ----------------- expected `Result<isize, ()>` because of return type diff --git a/tests/ui/issues/issue-22434.rs b/tests/ui/type-alias/missing-associated-type-in-trait-object-22434.rs index d9f7b987c64..35b30374c15 100644 --- a/tests/ui/issues/issue-22434.rs +++ b/tests/ui/type-alias/missing-associated-type-in-trait-object-22434.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/22434 pub trait Foo { type A; } diff --git a/tests/ui/issues/issue-22434.stderr b/tests/ui/type-alias/missing-associated-type-in-trait-object-22434.stderr index 172ae386c3e..73afefa5a1f 100644 --- a/tests/ui/issues/issue-22434.stderr +++ b/tests/ui/type-alias/missing-associated-type-in-trait-object-22434.stderr @@ -1,5 +1,5 @@ error[E0191]: the value of the associated type `A` in `Foo` must be specified - --> $DIR/issue-22434.rs:5:23 + --> $DIR/missing-associated-type-in-trait-object-22434.rs:6:23 | LL | type A; | ------ `A` defined here diff --git a/tests/ui/type-inference/partial-type-hint-12909.rs b/tests/ui/type-inference/partial-type-hint-12909.rs new file mode 100644 index 00000000000..d7017f451e3 --- /dev/null +++ b/tests/ui/type-inference/partial-type-hint-12909.rs @@ -0,0 +1,21 @@ +//! Regression test for https://github.com/rust-lang/rust/issues/12909 + +//@ run-pass +#![allow(unused_variables)] + +use std::collections::HashMap; + +fn copy<T: Copy>(&x: &T) -> T { + x +} + +fn main() { + let arr = [(1, 1), (2, 2), (3, 3)]; + + let v1: Vec<&_> = arr.iter().collect(); + let v2: Vec<_> = arr.iter().map(copy).collect(); + + let m1: HashMap<_, _> = arr.iter().map(copy).collect(); + let m2: HashMap<isize, _> = arr.iter().map(copy).collect(); + let m3: HashMap<_, usize> = arr.iter().map(copy).collect(); +} diff --git a/tests/ui/type-inference/unbounded-type-param-in-fn-with-assoc-type.stderr b/tests/ui/type-inference/unbounded-type-param-in-fn-with-assoc-type.stderr index bf8829c0925..e8bbdaaacbf 100644 --- a/tests/ui/type-inference/unbounded-type-param-in-fn-with-assoc-type.stderr +++ b/tests/ui/type-inference/unbounded-type-param-in-fn-with-assoc-type.stderr @@ -13,7 +13,7 @@ error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0282`. Future incompatibility report: Future breakage diagnostic: -warning: defaults for type parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions +warning: defaults for generic parameters are not allowed here --> $DIR/unbounded-type-param-in-fn-with-assoc-type.rs:3:11 | LL | fn foo<T, U = u64>() -> (T, U) { diff --git a/tests/ui/type/default_type_parameter_in_fn_or_impl.rs b/tests/ui/type/default_type_parameter_in_fn_or_impl.rs deleted file mode 100644 index 33038e24bc6..00000000000 --- a/tests/ui/type/default_type_parameter_in_fn_or_impl.rs +++ /dev/null @@ -1,12 +0,0 @@ -#![allow(unused)] - -fn avg<T=i32>(_: T) {} -//~^ ERROR defaults for type parameters are only allowed -//~| WARN this was previously accepted - -struct S<T>(T); -impl<T=i32> S<T> {} -//~^ ERROR defaults for type parameters are only allowed -//~| WARN this was previously accepted - -fn main() {} diff --git a/tests/ui/type/default_type_parameter_in_fn_or_impl.stderr b/tests/ui/type/default_type_parameter_in_fn_or_impl.stderr deleted file mode 100644 index a3205cd3c29..00000000000 --- a/tests/ui/type/default_type_parameter_in_fn_or_impl.stderr +++ /dev/null @@ -1,43 +0,0 @@ -error: defaults for type parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions - --> $DIR/default_type_parameter_in_fn_or_impl.rs:3:8 - | -LL | fn avg<T=i32>(_: T) {} - | ^^^^^ - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #36887 <https://github.com/rust-lang/rust/issues/36887> - = note: `#[deny(invalid_type_param_default)]` on by default - -error: defaults for type parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions - --> $DIR/default_type_parameter_in_fn_or_impl.rs:8:6 - | -LL | impl<T=i32> S<T> {} - | ^^^^^ - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #36887 <https://github.com/rust-lang/rust/issues/36887> - -error: aborting due to 2 previous errors - -Future incompatibility report: Future breakage diagnostic: -error: defaults for type parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions - --> $DIR/default_type_parameter_in_fn_or_impl.rs:3:8 - | -LL | fn avg<T=i32>(_: T) {} - | ^^^^^ - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #36887 <https://github.com/rust-lang/rust/issues/36887> - = note: `#[deny(invalid_type_param_default)]` on by default - -Future breakage diagnostic: -error: defaults for type parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions - --> $DIR/default_type_parameter_in_fn_or_impl.rs:8:6 - | -LL | impl<T=i32> S<T> {} - | ^^^^^ - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #36887 <https://github.com/rust-lang/rust/issues/36887> - = note: `#[deny(invalid_type_param_default)]` on by default - diff --git a/tests/ui/type/pattern_types/bad_const_generics_args_on_const_param.rs b/tests/ui/type/pattern_types/bad_const_generics_args_on_const_param.rs index c28fda6f91a..ff99ac98926 100644 --- a/tests/ui/type/pattern_types/bad_const_generics_args_on_const_param.rs +++ b/tests/ui/type/pattern_types/bad_const_generics_args_on_const_param.rs @@ -1,7 +1,7 @@ //@known-bug: #127972 //@ failure-status: 101 //@ normalize-stderr: "note: .*\n\n" -> "" -//@ normalize-stderr: "thread 'rustc' panicked.*\n" -> "" +//@ normalize-stderr: "thread 'rustc'.*panicked.*\n" -> "" //@ normalize-stderr: "(error: internal compiler error: [^:]+):\d+:\d+: " -> "$1:LL:CC: " //@ rustc-env:RUST_BACKTRACE=0 diff --git a/tests/ui/issues/issue-12863.rs b/tests/ui/typeck/function-in-pattern-error-12863.rs index 1ac1c3d818e..d2fa2555658 100644 --- a/tests/ui/issues/issue-12863.rs +++ b/tests/ui/typeck/function-in-pattern-error-12863.rs @@ -1,3 +1,5 @@ +//! Regression test for https://github.com/rust-lang/rust/issues/12863 + mod foo { pub fn bar() {} } fn main() { diff --git a/tests/ui/issues/issue-12863.stderr b/tests/ui/typeck/function-in-pattern-error-12863.stderr index 95d4a704e72..f28874b5d48 100644 --- a/tests/ui/issues/issue-12863.stderr +++ b/tests/ui/typeck/function-in-pattern-error-12863.stderr @@ -1,5 +1,5 @@ error[E0532]: expected unit struct, unit variant or constant, found function `foo::bar` - --> $DIR/issue-12863.rs:5:9 + --> $DIR/function-in-pattern-error-12863.rs:7:9 | LL | foo::bar => {} | ^^^^^^^^ not a unit struct, unit variant or constant diff --git a/tests/ui/issues/issue-48276.rs b/tests/ui/typeck/incorrect-self-type-in-trait-impl-48276.rs index f55c056fa67..1cff2078755 100644 --- a/tests/ui/issues/issue-48276.rs +++ b/tests/ui/typeck/incorrect-self-type-in-trait-impl-48276.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/48276 // Regression test for issue #48276 - ICE when self type does not match what is // required by a trait and regions are involved. diff --git a/tests/ui/issues/issue-48276.stderr b/tests/ui/typeck/incorrect-self-type-in-trait-impl-48276.stderr index 370905ee0df..124dc459237 100644 --- a/tests/ui/issues/issue-48276.stderr +++ b/tests/ui/typeck/incorrect-self-type-in-trait-impl-48276.stderr @@ -1,5 +1,5 @@ error[E0185]: method `from` has a `&self` declaration in the impl, but not in the trait - --> $DIR/issue-48276.rs:11:5 + --> $DIR/incorrect-self-type-in-trait-impl-48276.rs:12:5 | LL | fn from(a: A) -> Self; | ---------------------- trait method declared without `&self` @@ -8,7 +8,7 @@ LL | fn from(self: &'a Self) -> &'b str { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `&self` used in impl error[E0185]: method `from` has a `&self` declaration in the impl, but not in the trait - --> $DIR/issue-48276.rs:20:5 + --> $DIR/incorrect-self-type-in-trait-impl-48276.rs:21:5 | LL | fn from(&self) -> B { | ^^^^^^^^^^^^^^^^^^^ `&self` used in impl @@ -16,7 +16,7 @@ LL | fn from(&self) -> B { = note: `from` from trait: `fn(T) -> Self` error[E0185]: method `from` has a `&self` declaration in the impl, but not in the trait - --> $DIR/issue-48276.rs:27:5 + --> $DIR/incorrect-self-type-in-trait-impl-48276.rs:28:5 | LL | fn from(&self) -> &'static str { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `&self` used in impl diff --git a/tests/ui/issues/issue-13359.rs b/tests/ui/typeck/isize-usize-mismatch-error.rs index 5d31d7f861c..2fb5cf489c0 100644 --- a/tests/ui/issues/issue-13359.rs +++ b/tests/ui/typeck/isize-usize-mismatch-error.rs @@ -1,3 +1,5 @@ +//! Regression test for https://github.com/rust-lang/rust/issues/13359 + //@ dont-require-annotations: NOTE fn foo(_s: i16) { } diff --git a/tests/ui/issues/issue-13359.stderr b/tests/ui/typeck/isize-usize-mismatch-error.stderr index 91f5de8e8f3..d5724665a03 100644 --- a/tests/ui/issues/issue-13359.stderr +++ b/tests/ui/typeck/isize-usize-mismatch-error.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/issue-13359.rs:8:9 + --> $DIR/isize-usize-mismatch-error.rs:10:9 | LL | foo(1*(1 as isize)); | --- ^^^^^^^^^^^^^^ expected `i16`, found `isize` @@ -7,7 +7,7 @@ LL | foo(1*(1 as isize)); | arguments to this function are incorrect | note: function defined here - --> $DIR/issue-13359.rs:3:4 + --> $DIR/isize-usize-mismatch-error.rs:5:4 | LL | fn foo(_s: i16) { } | ^^^ ------- @@ -17,7 +17,7 @@ LL | foo((1*(1 as isize)).try_into().unwrap()); | + +++++++++++++++++++++ error[E0308]: mismatched types - --> $DIR/issue-13359.rs:12:9 + --> $DIR/isize-usize-mismatch-error.rs:14:9 | LL | bar(1*(1 as usize)); | --- ^^^^^^^^^^^^^^ expected `u32`, found `usize` @@ -25,7 +25,7 @@ LL | bar(1*(1 as usize)); | arguments to this function are incorrect | note: function defined here - --> $DIR/issue-13359.rs:5:4 + --> $DIR/isize-usize-mismatch-error.rs:7:4 | LL | fn bar(_s: u32) { } | ^^^ ------- diff --git a/tests/ui/issues/issue-32995-2.rs b/tests/ui/typeck/parenthesized-type-parameters-error-32995.rs index e713a64d3f5..e0c2ab5f303 100644 --- a/tests/ui/issues/issue-32995-2.rs +++ b/tests/ui/typeck/parenthesized-type-parameters-error-32995.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/32995 fn main() { { fn f<X: ::std::marker()::Send>() {} } //~^ ERROR parenthesized type parameters may only be used with a `Fn` trait diff --git a/tests/ui/issues/issue-32995-2.stderr b/tests/ui/typeck/parenthesized-type-parameters-error-32995.stderr index 6c2d772a233..590cdcdb43b 100644 --- a/tests/ui/issues/issue-32995-2.stderr +++ b/tests/ui/typeck/parenthesized-type-parameters-error-32995.stderr @@ -1,17 +1,17 @@ error[E0214]: parenthesized type parameters may only be used with a `Fn` trait - --> $DIR/issue-32995-2.rs:2:22 + --> $DIR/parenthesized-type-parameters-error-32995.rs:3:22 | LL | { fn f<X: ::std::marker()::Send>() {} } | ^^^^^^^^ only `Fn` traits may use parentheses error[E0214]: parenthesized type parameters may only be used with a `Fn` trait - --> $DIR/issue-32995-2.rs:5:29 + --> $DIR/parenthesized-type-parameters-error-32995.rs:6:29 | LL | { fn f() -> impl ::std::marker()::Send { } } | ^^^^^^^^ only `Fn` traits may use parentheses error[E0214]: parenthesized type parameters may only be used with a `Fn` trait - --> $DIR/issue-32995-2.rs:12:13 + --> $DIR/parenthesized-type-parameters-error-32995.rs:13:13 | LL | impl ::std::marker()::Copy for X {} | ^^^^^^^^ only `Fn` traits may use parentheses diff --git a/tests/ui/issues/issue-11771.rs b/tests/ui/typeck/unit-type-add-error-11771.rs index c69cd1e79e3..d009f50f4b9 100644 --- a/tests/ui/issues/issue-11771.rs +++ b/tests/ui/typeck/unit-type-add-error-11771.rs @@ -1,3 +1,5 @@ +//! Regression test for https://github.com/rust-lang/rust/issues/11771 + fn main() { let x = (); 1 + diff --git a/tests/ui/issues/issue-11771.stderr b/tests/ui/typeck/unit-type-add-error-11771.stderr index 5603dc18b63..155cc093524 100644 --- a/tests/ui/issues/issue-11771.stderr +++ b/tests/ui/typeck/unit-type-add-error-11771.stderr @@ -1,5 +1,5 @@ error[E0277]: cannot add `()` to `{integer}` - --> $DIR/issue-11771.rs:3:7 + --> $DIR/unit-type-add-error-11771.rs:5:7 | LL | 1 + | ^ no implementation for `{integer} + ()` @@ -17,7 +17,7 @@ LL | 1 + and 56 others error[E0277]: cannot add `()` to `{integer}` - --> $DIR/issue-11771.rs:8:7 + --> $DIR/unit-type-add-error-11771.rs:10:7 | LL | 1 + | ^ no implementation for `{integer} + ()` diff --git a/tests/ui/issues/issue-13202.rs b/tests/ui/typeck/unwrap-or-panic-input-13202.rs index 99ffba3fba5..29833a727c5 100644 --- a/tests/ui/issues/issue-13202.rs +++ b/tests/ui/typeck/unwrap-or-panic-input-13202.rs @@ -1,3 +1,5 @@ +//! Regression test for https://github.com/rust-lang/rust/issues/13202 + //@ run-fail //@ error-pattern:bad input //@ needs-subprocess diff --git a/tests/ui/issues/issue-18685.rs b/tests/ui/unboxed-closures/self-param-space-conflict-in-unboxed-closure-18685.rs index 3dab341f615..38cf26c2777 100644 --- a/tests/ui/issues/issue-18685.rs +++ b/tests/ui/unboxed-closures/self-param-space-conflict-in-unboxed-closure-18685.rs @@ -1,8 +1,8 @@ +// https://github.com/rust-lang/rust/issues/18685 //@ run-pass // Test that the self param space is not used in a conflicting // manner by unboxed closures within a default method on a trait - trait Tr { fn foo(&self); diff --git a/tests/ui/wf/ice-hir-wf-check-anon-const-issue-122199.rs b/tests/ui/wf/ice-hir-wf-check-anon-const-issue-122199.rs index ad7d972879f..072a699a6b5 100644 --- a/tests/ui/wf/ice-hir-wf-check-anon-const-issue-122199.rs +++ b/tests/ui/wf/ice-hir-wf-check-anon-const-issue-122199.rs @@ -4,7 +4,7 @@ trait Trait<const N: dyn Trait = bar> { fn fnc<const N: dyn Trait = u32>(&self) -> dyn Trait { //~^ ERROR the name `N` is already used for a generic parameter in this item's generic parameters //~| ERROR expected value, found builtin type `u32` - //~| ERROR defaults for const parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions + //~| ERROR defaults for generic parameters are not allowed here bar //~^ ERROR cannot find value `bar` in this scope } diff --git a/tests/ui/wf/ice-hir-wf-check-anon-const-issue-122199.stderr b/tests/ui/wf/ice-hir-wf-check-anon-const-issue-122199.stderr index dc5a1cf3485..47f3e83fae2 100644 --- a/tests/ui/wf/ice-hir-wf-check-anon-const-issue-122199.stderr +++ b/tests/ui/wf/ice-hir-wf-check-anon-const-issue-122199.stderr @@ -39,7 +39,7 @@ LL | trait Trait<const N: dyn Trait = bar> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information -error: defaults for const parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions +error: defaults for generic parameters are not allowed here --> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:4:12 | LL | fn fnc<const N: dyn Trait = u32>(&self) -> dyn Trait { |
