diff options
Diffstat (limited to 'tests')
420 files changed, 6727 insertions, 2447 deletions
diff --git a/tests/codegen/async-closure-debug.rs b/tests/codegen/async-closure-debug.rs index 644df169a36..2d67e02eb9c 100644 --- a/tests/codegen/async-closure-debug.rs +++ b/tests/codegen/async-closure-debug.rs @@ -7,8 +7,6 @@ // CHECK-DAG: [[CLOSURE:!.*]] = !DICompositeType(tag: DW_TAG_structure_type, name: "{closure_env#0}", scope: [[GEN_FN]] // CHECK-DAG: [[UPVAR:!.*]] = !DIDerivedType(tag: DW_TAG_member, name: "upvar", scope: [[CLOSURE]] -#![feature(async_closure)] - fn async_closure_test(upvar: &str) -> impl AsyncFn() + '_ { async move || { let hello = String::from("hello"); diff --git a/tests/codegen/instrument-coverage/testprog.rs b/tests/codegen/instrument-coverage/testprog.rs index 655fe779fca..9e918499d57 100644 --- a/tests/codegen/instrument-coverage/testprog.rs +++ b/tests/codegen/instrument-coverage/testprog.rs @@ -73,11 +73,9 @@ fn main() { // WIN: $__llvm_profile_runtime_user = comdat any -// CHECK: @__llvm_coverage_mapping = private constant -// CHECK-SAME: section "[[INSTR_PROF_COVMAP]]", align 8 +// CHECK-DAG: @__llvm_coverage_mapping = private constant {{.*}}, section "[[INSTR_PROF_COVMAP]]", align 8 -// CHECK: @__covrec_{{[A-F0-9]+}}u = linkonce_odr hidden constant -// CHECK-SAME: section "[[INSTR_PROF_COVFUN]]"[[COMDAT_IF_SUPPORTED]], align 8 +// CHECK-DAG: @__covrec_{{[A-F0-9]+}}u = linkonce_odr hidden constant {{.*}}, section "[[INSTR_PROF_COVFUN]]"[[COMDAT_IF_SUPPORTED]], align 8 // WIN: @__llvm_profile_runtime = external{{.*}}global i32 diff --git a/tests/codegen/mem-replace-big-type.rs b/tests/codegen/mem-replace-big-type.rs index e62adfa0ba6..0b2229ba7d1 100644 --- a/tests/codegen/mem-replace-big-type.rs +++ b/tests/codegen/mem-replace-big-type.rs @@ -25,9 +25,10 @@ pub fn replace_big(dst: &mut Big, src: Big) -> Big { // CHECK-NOT: call void @llvm.memcpy // For a large type, we expect exactly three `memcpy`s -// CHECK-LABEL: define internal void @{{.+}}mem{{.+}}replace{{.+}}sret([56 x i8]) +// CHECK-LABEL: define internal void @{{.+}}mem{{.+}}replace{{.+}}(ptr +// CHECK-SAME: sret([56 x i8]){{.+}}[[RESULT:%.+]], ptr{{.+}}%dest, ptr{{.+}}%src) // CHECK-NOT: call void @llvm.memcpy -// CHECK: call void @llvm.memcpy.{{.+}}(ptr align 8 %result, ptr align 8 %dest, i{{.*}} 56, i1 false) +// CHECK: call void @llvm.memcpy.{{.+}}(ptr align 8 [[RESULT]], ptr align 8 %dest, i{{.*}} 56, i1 false) // CHECK-NOT: call void @llvm.memcpy // CHECK: call void @llvm.memcpy.{{.+}}(ptr align 8 %dest, ptr align 8 %src, i{{.*}} 56, i1 false) // CHECK-NOT: call void @llvm.memcpy diff --git a/tests/codegen/naked-asan.rs b/tests/codegen/naked-asan.rs index bcaa60baeff..8efedab6ea5 100644 --- a/tests/codegen/naked-asan.rs +++ b/tests/codegen/naked-asan.rs @@ -8,14 +8,15 @@ #![no_std] #![feature(abi_x86_interrupt, naked_functions)] -// CHECK: define x86_intrcc void @page_fault_handler(ptr {{.*}}%0, i64 {{.*}}%1){{.*}}#[[ATTRS:[0-9]+]] { -// CHECK-NOT: memcpy +pub fn caller() { + page_fault_handler(1, 2); +} + +// CHECK: declare x86_intrcc void @page_fault_handler(ptr {{.*}}, i64{{.*}}){{.*}}#[[ATTRS:[0-9]+]] #[naked] #[no_mangle] pub extern "x86-interrupt" fn page_fault_handler(_: u64, _: u64) { - unsafe { - core::arch::naked_asm!("ud2"); - } + unsafe { core::arch::naked_asm!("ud2") }; } // CHECK: #[[ATTRS]] = diff --git a/tests/codegen/naked-fn/aligned.rs b/tests/codegen/naked-fn/aligned.rs index 3bbd67981e5..d9dcd7f6c3e 100644 --- a/tests/codegen/naked-fn/aligned.rs +++ b/tests/codegen/naked-fn/aligned.rs @@ -6,15 +6,12 @@ #![feature(naked_functions, fn_align)] use std::arch::naked_asm; -// CHECK: Function Attrs: naked -// CHECK-NEXT: define{{.*}}void @naked_empty() -// CHECK: align 16 +// CHECK: .balign 16 +// CHECK-LABEL: naked_empty: #[repr(align(16))] #[no_mangle] #[naked] pub unsafe extern "C" fn naked_empty() { - // CHECK-NEXT: start: - // CHECK-NEXT: call void asm - // CHECK-NEXT: unreachable + // CHECK: ret naked_asm!("ret"); } diff --git a/tests/codegen/naked-fn/generics.rs b/tests/codegen/naked-fn/generics.rs new file mode 100644 index 00000000000..a33d213617a --- /dev/null +++ b/tests/codegen/naked-fn/generics.rs @@ -0,0 +1,116 @@ +//@ compile-flags: -O +//@ only-x86_64 + +#![crate_type = "lib"] +#![feature(naked_functions, asm_const)] + +use std::arch::naked_asm; + +#[no_mangle] +fn test(x: u64) { + // just making sure these symbols get used + using_const_generics::<1>(x); + using_const_generics::<2>(x); + + generic_function::<i64>(x as i64); + + let foo = Foo(x); + + foo.method(); + foo.trait_method(); +} + +// CHECK: .balign 4 +// CHECK: add rax, 2 +// CHECK: add rax, 42 + +// CHECK: .balign 4 +// CHECK: add rax, 1 +// CHECK: add rax, 42 + +#[naked] +pub extern "C" fn using_const_generics<const N: u64>(x: u64) -> u64 { + const M: u64 = 42; + + unsafe { + naked_asm!( + "xor rax, rax", + "add rax, rdi", + "add rax, {}", + "add rax, {}", + "ret", + const N, + const M, + ) + } +} + +trait Invert { + fn invert(self) -> Self; +} + +impl Invert for i64 { + fn invert(self) -> Self { + -1 * self + } +} + +// CHECK: .balign 4 +// CHECK-LABEL: generic_function: +// CHECK: call +// CHECK: ret + +#[naked] +#[no_mangle] +pub extern "C" fn generic_function<T: Invert>(x: i64) -> i64 { + unsafe { + naked_asm!( + "call {}", + "ret", + sym <T as Invert>::invert, + ) + } +} + +#[derive(Copy, Clone)] +#[repr(transparent)] +struct Foo(u64); + +// CHECK: .balign 4 +// CHECK-LABEL: method: +// CHECK: mov rax, rdi + +impl Foo { + #[naked] + #[no_mangle] + extern "C" fn method(self) -> u64 { + unsafe { naked_asm!("mov rax, rdi", "ret") } + } +} + +// CHECK: .balign 4 +// CHECK-LABEL: trait_method: +// CHECK: mov rax, rdi + +trait Bar { + extern "C" fn trait_method(self) -> u64; +} + +impl Bar for Foo { + #[naked] + #[no_mangle] + extern "C" fn trait_method(self) -> u64 { + unsafe { naked_asm!("mov rax, rdi", "ret") } + } +} + +// CHECK: .balign 4 +// CHECK-LABEL: naked_with_args_and_return: +// CHECK: lea rax, [rdi + rsi] + +// this previously ICE'd, see https://github.com/rust-lang/rust/issues/124375 +#[naked] +#[no_mangle] +pub unsafe extern "C" fn naked_with_args_and_return(a: isize, b: isize) -> isize { + naked_asm!("lea rax, [rdi + rsi]", "ret"); +} diff --git a/tests/codegen/naked-fn/instruction-set.rs b/tests/codegen/naked-fn/instruction-set.rs new file mode 100644 index 00000000000..5b790b2034c --- /dev/null +++ b/tests/codegen/naked-fn/instruction-set.rs @@ -0,0 +1,59 @@ +//@ revisions: arm-mode thumb-mode +//@ [arm-mode] compile-flags: --target armv5te-none-eabi +//@ [thumb-mode] compile-flags: --target thumbv5te-none-eabi +//@ [arm-mode] needs-llvm-components: arm +//@ [thumb-mode] needs-llvm-components: arm + +#![crate_type = "lib"] +#![feature(no_core, lang_items, rustc_attrs, naked_functions)] +#![no_core] + +#[rustc_builtin_macro] +macro_rules! naked_asm { + () => {}; +} + +#[lang = "sized"] +trait Sized {} +#[lang = "copy"] +trait Copy {} + +// arm-mode: .arm +// thumb-mode: .thumb +// CHECK-LABEL: test_unspecified: +// CHECK: bx lr +// CHECK: .popsection +// arm-mode: .arm +// thumb-mode: .thumb +#[no_mangle] +#[naked] +unsafe extern "C" fn test_unspecified() { + naked_asm!("bx lr"); +} + +// CHECK: .thumb +// CHECK: .thumb_func +// CHECK-LABEL: test_thumb: +// CHECK: bx lr +// CHECK: .popsection +// arm-mode: .arm +// thumb-mode: .thumb +#[no_mangle] +#[naked] +#[instruction_set(arm::t32)] +unsafe extern "C" fn test_thumb() { + naked_asm!("bx lr"); +} + +// CHECK: .arm +// CHECK-LABEL: test_arm: +// CHECK: bx lr +// CHECK: .popsection +// arm-mode: .arm +// thumb-mode: .thumb +#[no_mangle] +#[naked] +#[instruction_set(arm::a32)] +unsafe extern "C" fn test_arm() { + naked_asm!("bx lr"); +} diff --git a/tests/codegen/naked-fn/naked-functions.rs b/tests/codegen/naked-fn/naked-functions.rs index 3f7447af599..f505d27d48c 100644 --- a/tests/codegen/naked-fn/naked-functions.rs +++ b/tests/codegen/naked-fn/naked-functions.rs @@ -1,29 +1,147 @@ -//@ compile-flags: -C no-prepopulate-passes -Copt-level=0 -//@ needs-asm-support -//@ only-x86_64 +//@ revisions: linux win macos thumb +// +//@[linux] compile-flags: --target x86_64-unknown-linux-gnu +//@[linux] needs-llvm-components: x86 +//@[win] compile-flags: --target x86_64-pc-windows-gnu +//@[win] needs-llvm-components: x86 +//@[macos] compile-flags: --target aarch64-apple-darwin +//@[macos] needs-llvm-components: arm +//@[thumb] compile-flags: --target thumbv7em-none-eabi +//@[thumb] needs-llvm-components: arm #![crate_type = "lib"] -#![feature(naked_functions)] -use std::arch::naked_asm; +#![feature(no_core, lang_items, rustc_attrs, naked_functions)] +#![no_core] + +#[rustc_builtin_macro] +macro_rules! naked_asm { + () => {}; +} + +#[lang = "sized"] +trait Sized {} +#[lang = "copy"] +trait Copy {} + +// linux,win: .intel_syntax +// +// linux: .pushsection .text.naked_empty,\22ax\22, @progbits +// macos: .pushsection __TEXT,__text,regular,pure_instructions +// win: .pushsection .text.naked_empty,\22xr\22 +// thumb: .pushsection .text.naked_empty,\22ax\22, %progbits +// +// CHECK: .balign 4 +// +// linux,win,thumb: .globl naked_empty +// macos: .globl _naked_empty +// +// CHECK-NOT: .private_extern +// CHECK-NOT: .hidden +// +// linux: .type naked_empty, @function +// +// win: .def naked_empty +// win: .scl 2 +// win: .type 32 +// win: .endef naked_empty +// +// thumb: .type naked_empty, %function +// thumb: .thumb +// thumb: .thumb_func +// +// CHECK-LABEL: naked_empty: +// +// linux,macos,win: ret +// thumb: bx lr +// +// CHECK: .popsection +// +// thumb: .thumb +// +// linux,win: .att_syntax -// CHECK: Function Attrs: naked -// CHECK-NEXT: define{{.*}}void @naked_empty() #[no_mangle] #[naked] pub unsafe extern "C" fn naked_empty() { - // CHECK-NEXT: {{.+}}: - // CHECK-NEXT: call void asm - // CHECK-NEXT: unreachable + #[cfg(not(all(target_arch = "arm", target_feature = "thumb-mode")))] naked_asm!("ret"); + + #[cfg(all(target_arch = "arm", target_feature = "thumb-mode"))] + naked_asm!("bx lr"); } -// CHECK: Function Attrs: naked -// CHECK-NEXT: define{{.*}}i{{[0-9]+}} @naked_with_args_and_return(i64 %0, i64 %1) +// linux,win: .intel_syntax +// +// linux: .pushsection .text.naked_with_args_and_return,\22ax\22, @progbits +// macos: .pushsection __TEXT,__text,regular,pure_instructions +// win: .pushsection .text.naked_with_args_and_return,\22xr\22 +// thumb: .pushsection .text.naked_with_args_and_return,\22ax\22, %progbits +// +// CHECK: .balign 4 +// +// linux,win,thumb: .globl naked_with_args_and_return +// macos: .globl _naked_with_args_and_return +// +// CHECK-NOT: .private_extern +// CHECK-NOT: .hidden +// +// linux: .type naked_with_args_and_return, @function +// +// win: .def naked_with_args_and_return +// win: .scl 2 +// win: .type 32 +// win: .endef naked_with_args_and_return +// +// thumb: .type naked_with_args_and_return, %function +// thumb: .thumb +// thumb: .thumb_func +// +// CHECK-LABEL: naked_with_args_and_return: +// +// linux, win: lea rax, [rdi + rsi] +// macos: add x0, x0, x1 +// thumb: adds r0, r0, r1 +// +// linux,macos,win: ret +// thumb: bx lr +// +// CHECK: .popsection +// +// thumb: .thumb +// +// linux,win: .att_syntax + #[no_mangle] #[naked] pub unsafe extern "C" fn naked_with_args_and_return(a: isize, b: isize) -> isize { - // CHECK-NEXT: {{.+}}: - // CHECK-NEXT: call void asm - // CHECK-NEXT: unreachable - naked_asm!("lea rax, [rdi + rsi]", "ret"); + #[cfg(any(target_os = "windows", target_os = "linux"))] + { + naked_asm!("lea rax, [rdi + rsi]", "ret") + } + + #[cfg(target_os = "macos")] + { + naked_asm!("add x0, x0, x1", "ret") + } + + #[cfg(all(target_arch = "arm", target_feature = "thumb-mode"))] + { + naked_asm!("adds r0, r0, r1", "bx lr") + } +} + +// linux: .pushsection .text.some_different_name,\22ax\22, @progbits +// macos: .pushsection .text.some_different_name,regular,pure_instructions +// win: .pushsection .text.some_different_name,\22xr\22 +// thumb: .pushsection .text.some_different_name,\22ax\22, %progbits +// CHECK-LABEL: test_link_section: +#[no_mangle] +#[naked] +#[link_section = ".text.some_different_name"] +pub unsafe extern "C" fn test_link_section() { + #[cfg(not(all(target_arch = "arm", target_feature = "thumb-mode")))] + naked_asm!("ret"); + + #[cfg(all(target_arch = "arm", target_feature = "thumb-mode"))] + naked_asm!("bx lr"); } diff --git a/tests/codegen/naked-fn/naked-nocoverage.rs b/tests/codegen/naked-fn/naked-nocoverage.rs deleted file mode 100644 index f63661bcd3a..00000000000 --- a/tests/codegen/naked-fn/naked-nocoverage.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Checks that naked functions are not instrumented by -Cinstrument-coverage. -// Regression test for issue #105170. -// -//@ needs-asm-support -//@ compile-flags: -Zno-profiler-runtime -//@ compile-flags: -Cinstrument-coverage -#![crate_type = "lib"] -#![feature(naked_functions)] -use std::arch::naked_asm; - -#[naked] -#[no_mangle] -pub unsafe extern "C" fn f() { - // CHECK: define {{(dso_local )?}}void @f() - // CHECK-NEXT: start: - // CHECK-NEXT: call void asm - // CHECK-NEXT: unreachable - naked_asm!(""); -} diff --git a/tests/codegen/naked-fn/naked-noinline.rs b/tests/codegen/naked-fn/naked-noinline.rs deleted file mode 100644 index 6ea36d96783..00000000000 --- a/tests/codegen/naked-fn/naked-noinline.rs +++ /dev/null @@ -1,31 +0,0 @@ -// Checks that naked functions are never inlined. -//@ compile-flags: -O -Zmir-opt-level=3 -//@ needs-asm-support -//@ ignore-wasm32 -#![crate_type = "lib"] -#![feature(naked_functions)] - -use std::arch::naked_asm; - -#[naked] -#[no_mangle] -pub unsafe extern "C" fn f() { - // Check that f has naked and noinline attributes. - // - // CHECK: define {{(dso_local )?}}void @f() unnamed_addr [[ATTR:#[0-9]+]] - // CHECK-NEXT: start: - // CHECK-NEXT: call void asm - naked_asm!(""); -} - -#[no_mangle] -pub unsafe fn g() { - // Check that call to f is not inlined. - // - // CHECK-LABEL: define {{(dso_local )?}}void @g() - // CHECK-NEXT: start: - // CHECK-NEXT: call void @f() - f(); -} - -// CHECK: attributes [[ATTR]] = { naked{{.*}}noinline{{.*}} } diff --git a/tests/coverage/async_closure.cov-map b/tests/coverage/async_closure.cov-map index 9ff29af8e8e..04c05ba098b 100644 --- a/tests/coverage/async_closure.cov-map +++ b/tests/coverage/async_closure.cov-map @@ -1,56 +1,56 @@ Function name: async_closure::call_once::<async_closure::main::{closure#0}> -Raw bytes (9): 0x[01, 01, 00, 01, 01, 07, 01, 00, 2b] +Raw bytes (9): 0x[01, 01, 00, 01, 01, 06, 01, 00, 2b] Number of files: 1 - file 0 => global file 1 Number of expressions: 0 Number of file 0 mappings: 1 -- Code(Counter(0)) at (prev + 7, 1) to (start + 0, 43) +- Code(Counter(0)) at (prev + 6, 1) to (start + 0, 43) Highest counter ID seen: c0 Function name: async_closure::call_once::<async_closure::main::{closure#0}>::{closure#0} -Raw bytes (14): 0x[01, 01, 00, 02, 01, 07, 2b, 01, 0e, 05, 02, 01, 00, 02] +Raw bytes (14): 0x[01, 01, 00, 02, 01, 06, 2b, 01, 0e, 05, 02, 01, 00, 02] Number of files: 1 - file 0 => global file 1 Number of expressions: 0 Number of file 0 mappings: 2 -- Code(Counter(0)) at (prev + 7, 43) to (start + 1, 14) +- Code(Counter(0)) at (prev + 6, 43) to (start + 1, 14) - Code(Counter(1)) at (prev + 2, 1) to (start + 0, 2) Highest counter ID seen: c1 Function name: async_closure::main -Raw bytes (14): 0x[01, 01, 00, 02, 01, 0b, 01, 01, 16, 01, 02, 05, 02, 02] +Raw bytes (14): 0x[01, 01, 00, 02, 01, 0a, 01, 01, 16, 01, 02, 05, 02, 02] Number of files: 1 - file 0 => global file 1 Number of expressions: 0 Number of file 0 mappings: 2 -- Code(Counter(0)) at (prev + 11, 1) to (start + 1, 22) +- Code(Counter(0)) at (prev + 10, 1) to (start + 1, 22) - Code(Counter(0)) at (prev + 2, 5) to (start + 2, 2) Highest counter ID seen: c0 Function name: async_closure::main::{closure#0} -Raw bytes (9): 0x[01, 01, 00, 01, 01, 0c, 23, 00, 24] +Raw bytes (9): 0x[01, 01, 00, 01, 01, 0b, 23, 00, 24] Number of files: 1 - file 0 => global file 1 Number of expressions: 0 Number of file 0 mappings: 1 -- Code(Counter(0)) at (prev + 12, 35) to (start + 0, 36) +- Code(Counter(0)) at (prev + 11, 35) to (start + 0, 36) Highest counter ID seen: c0 Function name: async_closure::main::{closure#0}::{closure#0}::<i16> -Raw bytes (9): 0x[01, 01, 00, 01, 01, 0c, 22, 00, 24] +Raw bytes (9): 0x[01, 01, 00, 01, 01, 0b, 22, 00, 24] Number of files: 1 - file 0 => global file 1 Number of expressions: 0 Number of file 0 mappings: 1 -- Code(Counter(0)) at (prev + 12, 34) to (start + 0, 36) +- Code(Counter(0)) at (prev + 11, 34) to (start + 0, 36) Highest counter ID seen: c0 Function name: async_closure::main::{closure#0}::{closure#1}::<i32> -Raw bytes (9): 0x[01, 01, 00, 01, 01, 0c, 23, 00, 24] +Raw bytes (9): 0x[01, 01, 00, 01, 01, 0b, 23, 00, 24] Number of files: 1 - file 0 => global file 1 Number of expressions: 0 Number of file 0 mappings: 1 -- Code(Counter(0)) at (prev + 12, 35) to (start + 0, 36) +- Code(Counter(0)) at (prev + 11, 35) to (start + 0, 36) Highest counter ID seen: c0 diff --git a/tests/coverage/async_closure.coverage b/tests/coverage/async_closure.coverage index 75da1a01fc1..7fbea265812 100644 --- a/tests/coverage/async_closure.coverage +++ b/tests/coverage/async_closure.coverage @@ -1,4 +1,3 @@ - LL| |#![feature(async_closure)] LL| |//@ edition: 2021 LL| | LL| |//@ aux-build: executor.rs diff --git a/tests/coverage/async_closure.rs b/tests/coverage/async_closure.rs index cbac592d957..85c5df1f1ab 100644 --- a/tests/coverage/async_closure.rs +++ b/tests/coverage/async_closure.rs @@ -1,4 +1,3 @@ -#![feature(async_closure)] //@ edition: 2021 //@ aux-build: executor.rs diff --git a/tests/coverage/branch/guard.cov-map b/tests/coverage/branch/guard.cov-map index 1ba1c6e1228..7ca499bd847 100644 --- a/tests/coverage/branch/guard.cov-map +++ b/tests/coverage/branch/guard.cov-map @@ -1,35 +1,37 @@ Function name: guard::branch_match_guard -Raw bytes (85): 0x[01, 01, 06, 19, 0d, 05, 09, 0f, 15, 13, 11, 17, 0d, 05, 09, 0d, 01, 0c, 01, 01, 10, 02, 03, 0b, 00, 0c, 15, 01, 14, 02, 0a, 0d, 03, 0e, 00, 0f, 19, 00, 14, 00, 19, 20, 0d, 02, 00, 14, 00, 1e, 0d, 00, 1d, 02, 0a, 11, 03, 0e, 00, 0f, 02, 00, 14, 00, 19, 20, 11, 05, 00, 14, 00, 1e, 11, 00, 1d, 02, 0a, 17, 03, 0e, 02, 0a, 0b, 04, 01, 00, 02] +Raw bytes (89): 0x[01, 01, 08, 05, 0d, 05, 17, 0d, 11, 1f, 17, 05, 09, 0d, 11, 1f, 15, 05, 09, 0d, 01, 0c, 01, 01, 10, 02, 03, 0b, 00, 0c, 15, 01, 14, 02, 0a, 0d, 03, 0e, 00, 0f, 05, 00, 14, 00, 19, 20, 0d, 02, 00, 14, 00, 1e, 0d, 00, 1d, 02, 0a, 11, 03, 0e, 00, 0f, 02, 00, 14, 00, 19, 20, 11, 06, 00, 14, 00, 1e, 11, 00, 1d, 02, 0a, 0e, 03, 0e, 02, 0a, 1b, 04, 01, 00, 02] Number of files: 1 - file 0 => global file 1 -Number of expressions: 6 -- expression 0 operands: lhs = Counter(6), rhs = Counter(3) -- expression 1 operands: lhs = Counter(1), rhs = Counter(2) -- expression 2 operands: lhs = Expression(3, Add), rhs = Counter(5) -- expression 3 operands: lhs = Expression(4, Add), rhs = Counter(4) -- expression 4 operands: lhs = Expression(5, Add), rhs = Counter(3) -- expression 5 operands: lhs = Counter(1), rhs = Counter(2) +Number of expressions: 8 +- expression 0 operands: lhs = Counter(1), rhs = Counter(3) +- expression 1 operands: lhs = Counter(1), rhs = Expression(5, Add) +- expression 2 operands: lhs = Counter(3), rhs = Counter(4) +- expression 3 operands: lhs = Expression(7, Add), rhs = Expression(5, Add) +- expression 4 operands: lhs = Counter(1), rhs = Counter(2) +- expression 5 operands: lhs = Counter(3), rhs = Counter(4) +- expression 6 operands: lhs = Expression(7, Add), rhs = Counter(5) +- expression 7 operands: lhs = Counter(1), rhs = Counter(2) Number of file 0 mappings: 13 - Code(Counter(0)) at (prev + 12, 1) to (start + 1, 16) - Code(Expression(0, Sub)) at (prev + 3, 11) to (start + 0, 12) - = (c6 - c3) + = (c1 - c3) - Code(Counter(5)) at (prev + 1, 20) to (start + 2, 10) - Code(Counter(3)) at (prev + 3, 14) to (start + 0, 15) -- Code(Counter(6)) at (prev + 0, 20) to (start + 0, 25) +- Code(Counter(1)) at (prev + 0, 20) to (start + 0, 25) - Branch { true: Counter(3), false: Expression(0, Sub) } at (prev + 0, 20) to (start + 0, 30) true = c3 - false = (c6 - c3) + false = (c1 - c3) - Code(Counter(3)) at (prev + 0, 29) to (start + 2, 10) - Code(Counter(4)) at (prev + 3, 14) to (start + 0, 15) - Code(Expression(0, Sub)) at (prev + 0, 20) to (start + 0, 25) - = (c6 - c3) -- Branch { true: Counter(4), false: Counter(1) } at (prev + 0, 20) to (start + 0, 30) + = (c1 - c3) +- Branch { true: Counter(4), false: Expression(1, Sub) } at (prev + 0, 20) to (start + 0, 30) true = c4 - false = c1 + false = (c1 - (c3 + c4)) - Code(Counter(4)) at (prev + 0, 29) to (start + 2, 10) -- Code(Expression(5, Add)) at (prev + 3, 14) to (start + 2, 10) - = (c1 + c2) -- Code(Expression(2, Add)) at (prev + 4, 1) to (start + 0, 2) - = ((((c1 + c2) + c3) + c4) + c5) -Highest counter ID seen: c6 +- Code(Expression(3, Sub)) at (prev + 3, 14) to (start + 2, 10) + = ((c1 + c2) - (c3 + c4)) +- Code(Expression(6, Add)) at (prev + 4, 1) to (start + 0, 2) + = ((c1 + c2) + c5) +Highest counter ID seen: c5 diff --git a/tests/coverage/branch/if-let.cov-map b/tests/coverage/branch/if-let.cov-map index 380765c7af4..773c5392465 100644 --- a/tests/coverage/branch/if-let.cov-map +++ b/tests/coverage/branch/if-let.cov-map @@ -19,14 +19,18 @@ Number of file 0 mappings: 7 Highest counter ID seen: c2 Function name: if_let::if_let_chain -Raw bytes (66): 0x[01, 01, 04, 01, 05, 05, 09, 0f, 0d, 05, 09, 0a, 01, 17, 01, 00, 33, 20, 02, 05, 01, 0c, 00, 13, 02, 00, 11, 00, 12, 01, 00, 16, 00, 17, 20, 0d, 09, 01, 10, 00, 17, 0d, 00, 15, 00, 16, 02, 00, 1a, 00, 1b, 0d, 01, 05, 03, 06, 0f, 03, 0c, 02, 06, 0b, 03, 05, 01, 02] +Raw bytes (74): 0x[01, 01, 08, 01, 05, 01, 1f, 05, 09, 01, 1f, 05, 09, 01, 1f, 05, 09, 05, 09, 0a, 01, 17, 01, 00, 33, 20, 02, 05, 01, 0c, 00, 13, 02, 00, 11, 00, 12, 01, 00, 16, 00, 17, 20, 16, 09, 01, 10, 00, 17, 16, 00, 15, 00, 16, 02, 00, 1a, 00, 1b, 16, 01, 05, 03, 06, 1f, 03, 0c, 02, 06, 01, 03, 05, 01, 02] Number of files: 1 - file 0 => global file 1 -Number of expressions: 4 +Number of expressions: 8 - expression 0 operands: lhs = Counter(0), rhs = Counter(1) -- expression 1 operands: lhs = Counter(1), rhs = Counter(2) -- expression 2 operands: lhs = Expression(3, Add), rhs = Counter(3) -- expression 3 operands: lhs = Counter(1), rhs = Counter(2) +- expression 1 operands: lhs = Counter(0), rhs = Expression(7, Add) +- expression 2 operands: lhs = Counter(1), rhs = Counter(2) +- expression 3 operands: lhs = Counter(0), rhs = Expression(7, Add) +- expression 4 operands: lhs = Counter(1), rhs = Counter(2) +- expression 5 operands: lhs = Counter(0), rhs = Expression(7, Add) +- expression 6 operands: lhs = Counter(1), rhs = Counter(2) +- expression 7 operands: lhs = Counter(1), rhs = Counter(2) Number of file 0 mappings: 10 - Code(Counter(0)) at (prev + 23, 1) to (start + 0, 51) - Branch { true: Expression(0, Sub), false: Counter(1) } at (prev + 1, 12) to (start + 0, 19) @@ -35,16 +39,17 @@ Number of file 0 mappings: 10 - Code(Expression(0, Sub)) at (prev + 0, 17) to (start + 0, 18) = (c0 - c1) - Code(Counter(0)) at (prev + 0, 22) to (start + 0, 23) -- Branch { true: Counter(3), false: Counter(2) } at (prev + 1, 16) to (start + 0, 23) - true = c3 +- Branch { true: Expression(5, Sub), false: Counter(2) } at (prev + 1, 16) to (start + 0, 23) + true = (c0 - (c1 + c2)) false = c2 -- Code(Counter(3)) at (prev + 0, 21) to (start + 0, 22) +- Code(Expression(5, Sub)) at (prev + 0, 21) to (start + 0, 22) + = (c0 - (c1 + c2)) - Code(Expression(0, Sub)) at (prev + 0, 26) to (start + 0, 27) = (c0 - c1) -- Code(Counter(3)) at (prev + 1, 5) to (start + 3, 6) -- Code(Expression(3, Add)) at (prev + 3, 12) to (start + 2, 6) +- Code(Expression(5, Sub)) at (prev + 1, 5) to (start + 3, 6) + = (c0 - (c1 + c2)) +- Code(Expression(7, Add)) at (prev + 3, 12) to (start + 2, 6) = (c1 + c2) -- Code(Expression(2, Add)) at (prev + 3, 5) to (start + 1, 2) - = ((c1 + c2) + c3) -Highest counter ID seen: c3 +- Code(Counter(0)) at (prev + 3, 5) to (start + 1, 2) +Highest counter ID seen: c2 diff --git a/tests/coverage/branch/if.cov-map b/tests/coverage/branch/if.cov-map index bab982dd44c..3d9a1d2e1ab 100644 --- a/tests/coverage/branch/if.cov-map +++ b/tests/coverage/branch/if.cov-map @@ -1,14 +1,11 @@ Function name: if::branch_and -Raw bytes (60): 0x[01, 01, 06, 05, 09, 0b, 09, 05, 11, 13, 09, 17, 11, 05, 0d, 08, 01, 2b, 01, 01, 10, 05, 03, 08, 00, 09, 20, 09, 02, 00, 08, 00, 09, 09, 00, 0d, 00, 0e, 20, 0d, 11, 00, 0d, 00, 0e, 0d, 00, 0f, 02, 06, 06, 02, 0c, 02, 06, 0e, 03, 01, 00, 02] +Raw bytes (54): 0x[01, 01, 03, 05, 09, 09, 0d, 05, 0d, 08, 01, 2b, 01, 01, 10, 05, 03, 08, 00, 09, 20, 09, 02, 00, 08, 00, 09, 09, 00, 0d, 00, 0e, 20, 0d, 06, 00, 0d, 00, 0e, 0d, 00, 0f, 02, 06, 0a, 02, 0c, 02, 06, 05, 03, 01, 00, 02] Number of files: 1 - file 0 => global file 1 -Number of expressions: 6 +Number of expressions: 3 - expression 0 operands: lhs = Counter(1), rhs = Counter(2) -- expression 1 operands: lhs = Expression(2, Add), rhs = Counter(2) -- expression 2 operands: lhs = Counter(1), rhs = Counter(4) -- expression 3 operands: lhs = Expression(4, Add), rhs = Counter(2) -- expression 4 operands: lhs = Expression(5, Add), rhs = Counter(4) -- expression 5 operands: lhs = Counter(1), rhs = Counter(3) +- expression 1 operands: lhs = Counter(2), rhs = Counter(3) +- expression 2 operands: lhs = Counter(1), rhs = Counter(3) Number of file 0 mappings: 8 - Code(Counter(0)) at (prev + 43, 1) to (start + 1, 16) - Code(Counter(1)) at (prev + 3, 8) to (start + 0, 9) @@ -16,15 +13,14 @@ Number of file 0 mappings: 8 true = c2 false = (c1 - c2) - Code(Counter(2)) at (prev + 0, 13) to (start + 0, 14) -- Branch { true: Counter(3), false: Counter(4) } at (prev + 0, 13) to (start + 0, 14) +- Branch { true: Counter(3), false: Expression(1, Sub) } at (prev + 0, 13) to (start + 0, 14) true = c3 - false = c4 + false = (c2 - c3) - Code(Counter(3)) at (prev + 0, 15) to (start + 2, 6) -- Code(Expression(1, Sub)) at (prev + 2, 12) to (start + 2, 6) - = ((c1 + c4) - c2) -- Code(Expression(3, Sub)) at (prev + 3, 1) to (start + 0, 2) - = (((c1 + c3) + c4) - c2) -Highest counter ID seen: c4 +- Code(Expression(2, Sub)) at (prev + 2, 12) to (start + 2, 6) + = (c1 - c3) +- Code(Counter(1)) at (prev + 3, 1) to (start + 0, 2) +Highest counter ID seen: c3 Function name: if::branch_not Raw bytes (116): 0x[01, 01, 07, 05, 09, 05, 0d, 05, 0d, 05, 11, 05, 11, 05, 15, 05, 15, 12, 01, 0c, 01, 01, 10, 05, 03, 08, 00, 09, 20, 09, 02, 00, 08, 00, 09, 09, 01, 09, 00, 11, 02, 01, 05, 00, 06, 05, 01, 08, 00, 0a, 20, 0a, 0d, 00, 08, 00, 0a, 0a, 00, 0b, 02, 06, 0d, 02, 05, 00, 06, 05, 01, 08, 00, 0b, 20, 11, 12, 00, 08, 00, 0b, 11, 00, 0c, 02, 06, 12, 02, 05, 00, 06, 05, 01, 08, 00, 0c, 20, 1a, 15, 00, 08, 00, 0c, 1a, 00, 0d, 02, 06, 15, 02, 05, 00, 06, 05, 01, 01, 00, 02] @@ -108,14 +104,16 @@ Number of file 0 mappings: 14 Highest counter ID seen: c4 Function name: if::branch_or -Raw bytes (56): 0x[01, 01, 04, 05, 09, 09, 0d, 0f, 11, 09, 0d, 08, 01, 35, 01, 01, 10, 05, 03, 08, 00, 09, 20, 09, 02, 00, 08, 00, 09, 02, 00, 0d, 00, 0e, 20, 0d, 11, 00, 0d, 00, 0e, 0f, 00, 0f, 02, 06, 11, 02, 0c, 02, 06, 0b, 03, 01, 00, 02] +Raw bytes (60): 0x[01, 01, 06, 05, 09, 05, 17, 09, 0d, 09, 0d, 05, 17, 09, 0d, 08, 01, 35, 01, 01, 10, 05, 03, 08, 00, 09, 20, 09, 02, 00, 08, 00, 09, 02, 00, 0d, 00, 0e, 20, 0d, 12, 00, 0d, 00, 0e, 17, 00, 0f, 02, 06, 12, 02, 0c, 02, 06, 05, 03, 01, 00, 02] Number of files: 1 - file 0 => global file 1 -Number of expressions: 4 +Number of expressions: 6 - expression 0 operands: lhs = Counter(1), rhs = Counter(2) -- expression 1 operands: lhs = Counter(2), rhs = Counter(3) -- expression 2 operands: lhs = Expression(3, Add), rhs = Counter(4) +- expression 1 operands: lhs = Counter(1), rhs = Expression(5, Add) +- expression 2 operands: lhs = Counter(2), rhs = Counter(3) - expression 3 operands: lhs = Counter(2), rhs = Counter(3) +- expression 4 operands: lhs = Counter(1), rhs = Expression(5, Add) +- expression 5 operands: lhs = Counter(2), rhs = Counter(3) Number of file 0 mappings: 8 - Code(Counter(0)) at (prev + 53, 1) to (start + 1, 16) - Code(Counter(1)) at (prev + 3, 8) to (start + 0, 9) @@ -124,13 +122,13 @@ Number of file 0 mappings: 8 false = (c1 - c2) - Code(Expression(0, Sub)) at (prev + 0, 13) to (start + 0, 14) = (c1 - c2) -- Branch { true: Counter(3), false: Counter(4) } at (prev + 0, 13) to (start + 0, 14) +- Branch { true: Counter(3), false: Expression(4, Sub) } at (prev + 0, 13) to (start + 0, 14) true = c3 - false = c4 -- Code(Expression(3, Add)) at (prev + 0, 15) to (start + 2, 6) + false = (c1 - (c2 + c3)) +- Code(Expression(5, Add)) at (prev + 0, 15) to (start + 2, 6) = (c2 + c3) -- Code(Counter(4)) at (prev + 2, 12) to (start + 2, 6) -- Code(Expression(2, Add)) at (prev + 3, 1) to (start + 0, 2) - = ((c2 + c3) + c4) -Highest counter ID seen: c4 +- Code(Expression(4, Sub)) at (prev + 2, 12) to (start + 2, 6) + = (c1 - (c2 + c3)) +- Code(Counter(1)) at (prev + 3, 1) to (start + 0, 2) +Highest counter ID seen: c3 diff --git a/tests/coverage/branch/lazy-boolean.cov-map b/tests/coverage/branch/lazy-boolean.cov-map index decb847f60e..94522734bcd 100644 --- a/tests/coverage/branch/lazy-boolean.cov-map +++ b/tests/coverage/branch/lazy-boolean.cov-map @@ -34,85 +34,67 @@ Number of file 0 mappings: 6 Highest counter ID seen: c2 Function name: lazy_boolean::chain -Raw bytes (169): 0x[01, 01, 1d, 5b, 0d, 5f, 15, 05, 11, 05, 09, 09, 0d, 6f, 25, 73, 21, 19, 1d, 5b, 67, 5f, 15, 05, 11, 0d, 19, 5b, 67, 5f, 15, 05, 11, 0d, 19, 5b, 63, 5f, 15, 05, 11, 67, 1d, 0d, 19, 5b, 63, 5f, 15, 05, 11, 67, 1d, 0d, 19, 6f, 25, 73, 21, 19, 1d, 13, 01, 24, 01, 01, 10, 02, 04, 09, 00, 0a, 05, 00, 0d, 00, 12, 20, 09, 0e, 00, 0d, 00, 12, 09, 00, 16, 00, 1b, 20, 0d, 12, 00, 16, 00, 1b, 0d, 00, 1f, 00, 24, 20, 11, 15, 00, 1f, 00, 24, 11, 00, 28, 00, 2d, 02, 01, 05, 00, 11, 6b, 03, 09, 00, 0a, 02, 00, 0d, 00, 12, 20, 19, 32, 00, 0d, 00, 12, 32, 00, 16, 00, 1b, 20, 1d, 56, 00, 16, 00, 1b, 56, 00, 1f, 00, 24, 20, 21, 25, 00, 1f, 00, 24, 25, 00, 28, 00, 2d, 6b, 01, 05, 01, 02] +Raw bytes (141): 0x[01, 01, 0f, 05, 09, 09, 0d, 0d, 11, 05, 15, 05, 15, 05, 3b, 15, 19, 05, 3b, 15, 19, 05, 37, 3b, 1d, 15, 19, 05, 37, 3b, 1d, 15, 19, 13, 01, 24, 01, 01, 10, 05, 04, 09, 00, 0a, 05, 00, 0d, 00, 12, 20, 09, 02, 00, 0d, 00, 12, 09, 00, 16, 00, 1b, 20, 0d, 06, 00, 16, 00, 1b, 0d, 00, 1f, 00, 24, 20, 11, 0a, 00, 1f, 00, 24, 11, 00, 28, 00, 2d, 05, 01, 05, 00, 11, 05, 03, 09, 00, 0a, 05, 00, 0d, 00, 12, 20, 15, 12, 00, 0d, 00, 12, 12, 00, 16, 00, 1b, 20, 19, 1e, 00, 16, 00, 1b, 1e, 00, 1f, 00, 24, 20, 1d, 32, 00, 1f, 00, 24, 32, 00, 28, 00, 2d, 05, 01, 05, 01, 02] Number of files: 1 - file 0 => global file 1 -Number of expressions: 29 -- expression 0 operands: lhs = Expression(22, Add), rhs = Counter(3) -- expression 1 operands: lhs = Expression(23, Add), rhs = Counter(5) -- expression 2 operands: lhs = Counter(1), rhs = Counter(4) -- expression 3 operands: lhs = Counter(1), rhs = Counter(2) -- expression 4 operands: lhs = Counter(2), rhs = Counter(3) -- expression 5 operands: lhs = Expression(27, Add), rhs = Counter(9) -- expression 6 operands: lhs = Expression(28, Add), rhs = Counter(8) -- expression 7 operands: lhs = Counter(6), rhs = Counter(7) -- expression 8 operands: lhs = Expression(22, Add), rhs = Expression(25, Add) -- expression 9 operands: lhs = Expression(23, Add), rhs = Counter(5) -- expression 10 operands: lhs = Counter(1), rhs = Counter(4) -- expression 11 operands: lhs = Counter(3), rhs = Counter(6) -- expression 12 operands: lhs = Expression(22, Add), rhs = Expression(25, Add) -- expression 13 operands: lhs = Expression(23, Add), rhs = Counter(5) -- expression 14 operands: lhs = Counter(1), rhs = Counter(4) -- expression 15 operands: lhs = Counter(3), rhs = Counter(6) -- expression 16 operands: lhs = Expression(22, Add), rhs = Expression(24, Add) -- expression 17 operands: lhs = Expression(23, Add), rhs = Counter(5) -- expression 18 operands: lhs = Counter(1), rhs = Counter(4) -- expression 19 operands: lhs = Expression(25, Add), rhs = Counter(7) -- expression 20 operands: lhs = Counter(3), rhs = Counter(6) -- expression 21 operands: lhs = Expression(22, Add), rhs = Expression(24, Add) -- expression 22 operands: lhs = Expression(23, Add), rhs = Counter(5) -- expression 23 operands: lhs = Counter(1), rhs = Counter(4) -- expression 24 operands: lhs = Expression(25, Add), rhs = Counter(7) -- expression 25 operands: lhs = Counter(3), rhs = Counter(6) -- expression 26 operands: lhs = Expression(27, Add), rhs = Counter(9) -- expression 27 operands: lhs = Expression(28, Add), rhs = Counter(8) -- expression 28 operands: lhs = Counter(6), rhs = Counter(7) +Number of expressions: 15 +- expression 0 operands: lhs = Counter(1), rhs = Counter(2) +- expression 1 operands: lhs = Counter(2), rhs = Counter(3) +- expression 2 operands: lhs = Counter(3), rhs = Counter(4) +- expression 3 operands: lhs = Counter(1), rhs = Counter(5) +- expression 4 operands: lhs = Counter(1), rhs = Counter(5) +- expression 5 operands: lhs = Counter(1), rhs = Expression(14, Add) +- expression 6 operands: lhs = Counter(5), rhs = Counter(6) +- expression 7 operands: lhs = Counter(1), rhs = Expression(14, Add) +- expression 8 operands: lhs = Counter(5), rhs = Counter(6) +- expression 9 operands: lhs = Counter(1), rhs = Expression(13, Add) +- expression 10 operands: lhs = Expression(14, Add), rhs = Counter(7) +- expression 11 operands: lhs = Counter(5), rhs = Counter(6) +- expression 12 operands: lhs = Counter(1), rhs = Expression(13, Add) +- expression 13 operands: lhs = Expression(14, Add), rhs = Counter(7) +- expression 14 operands: lhs = Counter(5), rhs = Counter(6) Number of file 0 mappings: 19 - Code(Counter(0)) at (prev + 36, 1) to (start + 1, 16) -- Code(Expression(0, Sub)) at (prev + 4, 9) to (start + 0, 10) - = (((c1 + c4) + c5) - c3) +- Code(Counter(1)) at (prev + 4, 9) to (start + 0, 10) - Code(Counter(1)) at (prev + 0, 13) to (start + 0, 18) -- Branch { true: Counter(2), false: Expression(3, Sub) } at (prev + 0, 13) to (start + 0, 18) +- Branch { true: Counter(2), false: Expression(0, Sub) } at (prev + 0, 13) to (start + 0, 18) true = c2 false = (c1 - c2) - Code(Counter(2)) at (prev + 0, 22) to (start + 0, 27) -- Branch { true: Counter(3), false: Expression(4, Sub) } at (prev + 0, 22) to (start + 0, 27) +- Branch { true: Counter(3), false: Expression(1, Sub) } at (prev + 0, 22) to (start + 0, 27) true = c3 false = (c2 - c3) - Code(Counter(3)) at (prev + 0, 31) to (start + 0, 36) -- Branch { true: Counter(4), false: Counter(5) } at (prev + 0, 31) to (start + 0, 36) +- Branch { true: Counter(4), false: Expression(2, Sub) } at (prev + 0, 31) to (start + 0, 36) true = c4 - false = c5 + false = (c3 - c4) - Code(Counter(4)) at (prev + 0, 40) to (start + 0, 45) -- Code(Expression(0, Sub)) at (prev + 1, 5) to (start + 0, 17) - = (((c1 + c4) + c5) - c3) -- Code(Expression(26, Add)) at (prev + 3, 9) to (start + 0, 10) - = (((c6 + c7) + c8) + c9) -- Code(Expression(0, Sub)) at (prev + 0, 13) to (start + 0, 18) - = (((c1 + c4) + c5) - c3) -- Branch { true: Counter(6), false: Expression(12, Sub) } at (prev + 0, 13) to (start + 0, 18) +- Code(Counter(1)) at (prev + 1, 5) to (start + 0, 17) +- Code(Counter(1)) at (prev + 3, 9) to (start + 0, 10) +- Code(Counter(1)) at (prev + 0, 13) to (start + 0, 18) +- Branch { true: Counter(5), false: Expression(4, Sub) } at (prev + 0, 13) to (start + 0, 18) + true = c5 + false = (c1 - c5) +- Code(Expression(4, Sub)) at (prev + 0, 22) to (start + 0, 27) + = (c1 - c5) +- Branch { true: Counter(6), false: Expression(7, Sub) } at (prev + 0, 22) to (start + 0, 27) true = c6 - false = (((c1 + c4) + c5) - (c3 + c6)) -- Code(Expression(12, Sub)) at (prev + 0, 22) to (start + 0, 27) - = (((c1 + c4) + c5) - (c3 + c6)) -- Branch { true: Counter(7), false: Expression(21, Sub) } at (prev + 0, 22) to (start + 0, 27) + false = (c1 - (c5 + c6)) +- Code(Expression(7, Sub)) at (prev + 0, 31) to (start + 0, 36) + = (c1 - (c5 + c6)) +- Branch { true: Counter(7), false: Expression(12, Sub) } at (prev + 0, 31) to (start + 0, 36) true = c7 - false = (((c1 + c4) + c5) - ((c3 + c6) + c7)) -- Code(Expression(21, Sub)) at (prev + 0, 31) to (start + 0, 36) - = (((c1 + c4) + c5) - ((c3 + c6) + c7)) -- Branch { true: Counter(8), false: Counter(9) } at (prev + 0, 31) to (start + 0, 36) - true = c8 - false = c9 -- Code(Counter(9)) at (prev + 0, 40) to (start + 0, 45) -- Code(Expression(26, Add)) at (prev + 1, 5) to (start + 1, 2) - = (((c6 + c7) + c8) + c9) -Highest counter ID seen: c9 + false = (c1 - ((c5 + c6) + c7)) +- Code(Expression(12, Sub)) at (prev + 0, 40) to (start + 0, 45) + = (c1 - ((c5 + c6) + c7)) +- Code(Counter(1)) at (prev + 1, 5) to (start + 1, 2) +Highest counter ID seen: c7 Function name: lazy_boolean::nested_mixed -Raw bytes (141): 0x[01, 01, 0f, 05, 09, 05, 1f, 09, 0d, 09, 0d, 1f, 11, 09, 0d, 1f, 11, 09, 0d, 3b, 21, 19, 1d, 05, 15, 15, 19, 05, 19, 3b, 21, 19, 1d, 13, 01, 31, 01, 01, 10, 05, 04, 09, 00, 0a, 05, 00, 0e, 00, 13, 20, 09, 02, 00, 0e, 00, 13, 02, 00, 17, 00, 1d, 20, 0d, 06, 00, 17, 00, 1d, 1f, 00, 23, 00, 28, 20, 11, 1a, 00, 23, 00, 28, 1a, 00, 2c, 00, 33, 05, 01, 05, 00, 11, 37, 03, 09, 00, 0a, 05, 00, 0e, 00, 13, 20, 15, 2a, 00, 0e, 00, 13, 15, 00, 17, 00, 1c, 20, 19, 2e, 00, 17, 00, 1c, 32, 00, 22, 00, 28, 20, 1d, 21, 00, 22, 00, 28, 1d, 00, 2c, 00, 33, 37, 01, 05, 01, 02] +Raw bytes (137): 0x[01, 01, 0d, 05, 09, 05, 1f, 09, 0d, 09, 0d, 1f, 11, 09, 0d, 1f, 11, 09, 0d, 05, 15, 15, 19, 05, 19, 05, 33, 19, 1d, 13, 01, 31, 01, 01, 10, 05, 04, 09, 00, 0a, 05, 00, 0e, 00, 13, 20, 09, 02, 00, 0e, 00, 13, 02, 00, 17, 00, 1d, 20, 0d, 06, 00, 17, 00, 1d, 1f, 00, 23, 00, 28, 20, 11, 1a, 00, 23, 00, 28, 1a, 00, 2c, 00, 33, 05, 01, 05, 00, 11, 05, 03, 09, 00, 0a, 05, 00, 0e, 00, 13, 20, 15, 22, 00, 0e, 00, 13, 15, 00, 17, 00, 1c, 20, 19, 26, 00, 17, 00, 1c, 2a, 00, 22, 00, 28, 20, 1d, 2e, 00, 22, 00, 28, 1d, 00, 2c, 00, 33, 05, 01, 05, 01, 02] Number of files: 1 - file 0 => global file 1 -Number of expressions: 15 +Number of expressions: 13 - expression 0 operands: lhs = Counter(1), rhs = Counter(2) - expression 1 operands: lhs = Counter(1), rhs = Expression(7, Add) - expression 2 operands: lhs = Counter(2), rhs = Counter(3) @@ -121,13 +103,11 @@ Number of expressions: 15 - expression 5 operands: lhs = Counter(2), rhs = Counter(3) - expression 6 operands: lhs = Expression(7, Add), rhs = Counter(4) - expression 7 operands: lhs = Counter(2), rhs = Counter(3) -- expression 8 operands: lhs = Expression(14, Add), rhs = Counter(8) -- expression 9 operands: lhs = Counter(6), rhs = Counter(7) -- expression 10 operands: lhs = Counter(1), rhs = Counter(5) -- expression 11 operands: lhs = Counter(5), rhs = Counter(6) -- expression 12 operands: lhs = Counter(1), rhs = Counter(6) -- expression 13 operands: lhs = Expression(14, Add), rhs = Counter(8) -- expression 14 operands: lhs = Counter(6), rhs = Counter(7) +- expression 8 operands: lhs = Counter(1), rhs = Counter(5) +- expression 9 operands: lhs = Counter(5), rhs = Counter(6) +- expression 10 operands: lhs = Counter(1), rhs = Counter(6) +- expression 11 operands: lhs = Counter(1), rhs = Expression(12, Add) +- expression 12 operands: lhs = Counter(6), rhs = Counter(7) Number of file 0 mappings: 19 - Code(Counter(0)) at (prev + 49, 1) to (start + 1, 16) - Code(Counter(1)) at (prev + 4, 9) to (start + 0, 10) @@ -148,23 +128,21 @@ Number of file 0 mappings: 19 - Code(Expression(6, Sub)) at (prev + 0, 44) to (start + 0, 51) = ((c2 + c3) - c4) - Code(Counter(1)) at (prev + 1, 5) to (start + 0, 17) -- Code(Expression(13, Add)) at (prev + 3, 9) to (start + 0, 10) - = ((c6 + c7) + c8) +- Code(Counter(1)) at (prev + 3, 9) to (start + 0, 10) - Code(Counter(1)) at (prev + 0, 14) to (start + 0, 19) -- Branch { true: Counter(5), false: Expression(10, Sub) } at (prev + 0, 14) to (start + 0, 19) +- Branch { true: Counter(5), false: Expression(8, Sub) } at (prev + 0, 14) to (start + 0, 19) true = c5 false = (c1 - c5) - Code(Counter(5)) at (prev + 0, 23) to (start + 0, 28) -- Branch { true: Counter(6), false: Expression(11, Sub) } at (prev + 0, 23) to (start + 0, 28) +- Branch { true: Counter(6), false: Expression(9, Sub) } at (prev + 0, 23) to (start + 0, 28) true = c6 false = (c5 - c6) -- Code(Expression(12, Sub)) at (prev + 0, 34) to (start + 0, 40) +- Code(Expression(10, Sub)) at (prev + 0, 34) to (start + 0, 40) = (c1 - c6) -- Branch { true: Counter(7), false: Counter(8) } at (prev + 0, 34) to (start + 0, 40) +- Branch { true: Counter(7), false: Expression(11, Sub) } at (prev + 0, 34) to (start + 0, 40) true = c7 - false = c8 + false = (c1 - (c6 + c7)) - Code(Counter(7)) at (prev + 0, 44) to (start + 0, 51) -- Code(Expression(13, Add)) at (prev + 1, 5) to (start + 1, 2) - = ((c6 + c7) + c8) -Highest counter ID seen: c8 +- Code(Counter(1)) at (prev + 1, 5) to (start + 1, 2) +Highest counter ID seen: c7 diff --git a/tests/coverage/branch/match-arms.cov-map b/tests/coverage/branch/match-arms.cov-map index a93df9814ee..53d0a4edbd0 100644 --- a/tests/coverage/branch/match-arms.cov-map +++ b/tests/coverage/branch/match-arms.cov-map @@ -1,40 +1,45 @@ Function name: match_arms::guards -Raw bytes (88): 0x[01, 01, 08, 07, 00, 0b, 11, 0f, 0d, 05, 09, 17, 25, 1b, 21, 1f, 1d, 03, 19, 0c, 01, 30, 01, 01, 10, 29, 03, 0b, 00, 10, 19, 01, 11, 00, 29, 20, 19, 05, 00, 17, 00, 1b, 1d, 01, 11, 00, 29, 20, 1d, 09, 00, 17, 00, 1b, 21, 01, 11, 00, 29, 20, 21, 0d, 00, 17, 00, 1b, 25, 01, 11, 00, 29, 20, 25, 11, 00, 17, 00, 1b, 03, 01, 0e, 00, 18, 13, 03, 05, 01, 02] +Raw bytes (98): 0x[01, 01, 0d, 11, 19, 27, 19, 2b, 00, 2f, 11, 33, 0d, 05, 09, 1f, 25, 23, 21, 27, 1d, 2b, 00, 2f, 11, 33, 0d, 05, 09, 0c, 01, 30, 01, 01, 10, 11, 03, 0b, 00, 10, 1d, 01, 11, 00, 29, 20, 1d, 05, 00, 17, 00, 1b, 21, 01, 11, 00, 29, 20, 21, 09, 00, 17, 00, 1b, 25, 01, 11, 00, 29, 20, 25, 0d, 00, 17, 00, 1b, 19, 01, 11, 00, 29, 20, 19, 02, 00, 17, 00, 1b, 06, 01, 0e, 00, 18, 1b, 03, 05, 01, 02] Number of files: 1 - file 0 => global file 1 -Number of expressions: 8 -- expression 0 operands: lhs = Expression(1, Add), rhs = Zero -- expression 1 operands: lhs = Expression(2, Add), rhs = Counter(4) -- expression 2 operands: lhs = Expression(3, Add), rhs = Counter(3) -- expression 3 operands: lhs = Counter(1), rhs = Counter(2) -- expression 4 operands: lhs = Expression(5, Add), rhs = Counter(9) -- expression 5 operands: lhs = Expression(6, Add), rhs = Counter(8) -- expression 6 operands: lhs = Expression(7, Add), rhs = Counter(7) -- expression 7 operands: lhs = Expression(0, Add), rhs = Counter(6) +Number of expressions: 13 +- expression 0 operands: lhs = Counter(4), rhs = Counter(6) +- expression 1 operands: lhs = Expression(9, Add), rhs = Counter(6) +- expression 2 operands: lhs = Expression(10, Add), rhs = Zero +- expression 3 operands: lhs = Expression(11, Add), rhs = Counter(4) +- expression 4 operands: lhs = Expression(12, Add), rhs = Counter(3) +- expression 5 operands: lhs = Counter(1), rhs = Counter(2) +- expression 6 operands: lhs = Expression(7, Add), rhs = Counter(9) +- expression 7 operands: lhs = Expression(8, Add), rhs = Counter(8) +- expression 8 operands: lhs = Expression(9, Add), rhs = Counter(7) +- expression 9 operands: lhs = Expression(10, Add), rhs = Zero +- expression 10 operands: lhs = Expression(11, Add), rhs = Counter(4) +- expression 11 operands: lhs = Expression(12, Add), rhs = Counter(3) +- expression 12 operands: lhs = Counter(1), rhs = Counter(2) Number of file 0 mappings: 12 - Code(Counter(0)) at (prev + 48, 1) to (start + 1, 16) -- Code(Counter(10)) at (prev + 3, 11) to (start + 0, 16) -- Code(Counter(6)) at (prev + 1, 17) to (start + 0, 41) -- Branch { true: Counter(6), false: Counter(1) } at (prev + 0, 23) to (start + 0, 27) - true = c6 - false = c1 +- Code(Counter(4)) at (prev + 3, 11) to (start + 0, 16) - Code(Counter(7)) at (prev + 1, 17) to (start + 0, 41) -- Branch { true: Counter(7), false: Counter(2) } at (prev + 0, 23) to (start + 0, 27) +- Branch { true: Counter(7), false: Counter(1) } at (prev + 0, 23) to (start + 0, 27) true = c7 - false = c2 + false = c1 - Code(Counter(8)) at (prev + 1, 17) to (start + 0, 41) -- Branch { true: Counter(8), false: Counter(3) } at (prev + 0, 23) to (start + 0, 27) +- Branch { true: Counter(8), false: Counter(2) } at (prev + 0, 23) to (start + 0, 27) true = c8 - false = c3 + false = c2 - Code(Counter(9)) at (prev + 1, 17) to (start + 0, 41) -- Branch { true: Counter(9), false: Counter(4) } at (prev + 0, 23) to (start + 0, 27) +- Branch { true: Counter(9), false: Counter(3) } at (prev + 0, 23) to (start + 0, 27) true = c9 - false = c4 -- Code(Expression(0, Add)) at (prev + 1, 14) to (start + 0, 24) - = ((((c1 + c2) + c3) + c4) + Zero) -- Code(Expression(4, Add)) at (prev + 3, 5) to (start + 1, 2) - = ((((((((c1 + c2) + c3) + c4) + Zero) + c6) + c7) + c8) + c9) -Highest counter ID seen: c10 + false = c3 +- Code(Counter(6)) at (prev + 1, 17) to (start + 0, 41) +- Branch { true: Counter(6), false: Expression(0, Sub) } at (prev + 0, 23) to (start + 0, 27) + true = c6 + false = (c4 - c6) +- Code(Expression(1, Sub)) at (prev + 1, 14) to (start + 0, 24) + = (((((c1 + c2) + c3) + c4) + Zero) - c6) +- Code(Expression(6, Add)) at (prev + 3, 5) to (start + 1, 2) + = (((((((c1 + c2) + c3) + c4) + Zero) + c7) + c8) + c9) +Highest counter ID seen: c9 Function name: match_arms::match_arms Raw bytes (45): 0x[01, 01, 03, 05, 07, 0b, 11, 09, 0d, 07, 01, 18, 01, 01, 10, 05, 03, 0b, 00, 10, 09, 01, 11, 00, 21, 0d, 01, 11, 00, 21, 11, 01, 11, 00, 21, 02, 01, 11, 00, 21, 05, 03, 05, 01, 02] diff --git a/tests/coverage/branch/while.cov-map b/tests/coverage/branch/while.cov-map index 305f6bc74d8..5eb08a42803 100644 --- a/tests/coverage/branch/while.cov-map +++ b/tests/coverage/branch/while.cov-map @@ -35,14 +35,14 @@ Number of file 0 mappings: 6 Highest counter ID seen: c2 Function name: while::while_op_and -Raw bytes (56): 0x[01, 01, 04, 05, 09, 03, 0d, 03, 0d, 0d, 11, 08, 01, 1e, 01, 01, 10, 05, 03, 09, 01, 12, 03, 02, 0b, 00, 10, 20, 0a, 0d, 00, 0b, 00, 10, 0a, 00, 14, 00, 19, 20, 09, 11, 00, 14, 00, 19, 09, 00, 1a, 03, 06, 0f, 04, 01, 00, 02] +Raw bytes (56): 0x[01, 01, 04, 05, 09, 03, 0d, 03, 0d, 05, 0d, 08, 01, 1e, 01, 01, 10, 05, 03, 09, 01, 12, 03, 02, 0b, 00, 10, 20, 0a, 0d, 00, 0b, 00, 10, 0a, 00, 14, 00, 19, 20, 09, 0e, 00, 14, 00, 19, 09, 00, 1a, 03, 06, 05, 04, 01, 00, 02] Number of files: 1 - file 0 => global file 1 Number of expressions: 4 - expression 0 operands: lhs = Counter(1), rhs = Counter(2) - expression 1 operands: lhs = Expression(0, Add), rhs = Counter(3) - expression 2 operands: lhs = Expression(0, Add), rhs = Counter(3) -- expression 3 operands: lhs = Counter(3), rhs = Counter(4) +- expression 3 operands: lhs = Counter(1), rhs = Counter(3) Number of file 0 mappings: 8 - Code(Counter(0)) at (prev + 30, 1) to (start + 1, 16) - Code(Counter(1)) at (prev + 3, 9) to (start + 1, 18) @@ -53,13 +53,12 @@ Number of file 0 mappings: 8 false = c3 - Code(Expression(2, Sub)) at (prev + 0, 20) to (start + 0, 25) = ((c1 + c2) - c3) -- Branch { true: Counter(2), false: Counter(4) } at (prev + 0, 20) to (start + 0, 25) +- Branch { true: Counter(2), false: Expression(3, Sub) } at (prev + 0, 20) to (start + 0, 25) true = c2 - false = c4 + false = (c1 - c3) - Code(Counter(2)) at (prev + 0, 26) to (start + 3, 6) -- Code(Expression(3, Add)) at (prev + 4, 1) to (start + 0, 2) - = (c3 + c4) -Highest counter ID seen: c4 +- Code(Counter(1)) at (prev + 4, 1) to (start + 0, 2) +Highest counter ID seen: c3 Function name: while::while_op_or Raw bytes (58): 0x[01, 01, 05, 07, 0d, 05, 09, 05, 0d, 05, 0d, 09, 0d, 08, 01, 29, 01, 01, 10, 05, 03, 09, 01, 12, 03, 02, 0b, 00, 10, 20, 09, 0f, 00, 0b, 00, 10, 0f, 00, 14, 00, 19, 20, 0d, 05, 00, 14, 00, 19, 13, 00, 1a, 03, 06, 05, 04, 01, 00, 02] diff --git a/tests/coverage/closure_macro.cov-map b/tests/coverage/closure_macro.cov-map index aedb924eca8..653848dd6ff 100644 --- a/tests/coverage/closure_macro.cov-map +++ b/tests/coverage/closure_macro.cov-map @@ -25,20 +25,20 @@ Number of file 0 mappings: 6 Highest counter ID seen: c1 Function name: closure_macro::main::{closure#0} -Raw bytes (35): 0x[01, 01, 03, 01, 05, 0b, 0d, 05, 09, 05, 01, 10, 1c, 03, 21, 05, 04, 11, 01, 27, 02, 03, 11, 00, 16, 0d, 00, 17, 00, 1e, 07, 02, 09, 00, 0a] +Raw bytes (35): 0x[01, 01, 03, 01, 05, 01, 0b, 05, 09, 05, 01, 10, 1c, 03, 21, 05, 04, 11, 01, 27, 02, 03, 11, 00, 16, 06, 00, 17, 00, 1e, 01, 02, 09, 00, 0a] Number of files: 1 - file 0 => global file 1 Number of expressions: 3 - expression 0 operands: lhs = Counter(0), rhs = Counter(1) -- expression 1 operands: lhs = Expression(2, Add), rhs = Counter(3) +- expression 1 operands: lhs = Counter(0), rhs = Expression(2, Add) - expression 2 operands: lhs = Counter(1), rhs = Counter(2) Number of file 0 mappings: 5 - Code(Counter(0)) at (prev + 16, 28) to (start + 3, 33) - Code(Counter(1)) at (prev + 4, 17) to (start + 1, 39) - Code(Expression(0, Sub)) at (prev + 3, 17) to (start + 0, 22) = (c0 - c1) -- Code(Counter(3)) at (prev + 0, 23) to (start + 0, 30) -- Code(Expression(1, Add)) at (prev + 2, 9) to (start + 0, 10) - = ((c1 + c2) + c3) -Highest counter ID seen: c3 +- Code(Expression(1, Sub)) at (prev + 0, 23) to (start + 0, 30) + = (c0 - (c1 + c2)) +- Code(Counter(0)) at (prev + 2, 9) to (start + 0, 10) +Highest counter ID seen: c1 diff --git a/tests/coverage/closure_macro_async.cov-map b/tests/coverage/closure_macro_async.cov-map index df4652ac9ce..1bd1460a147 100644 --- a/tests/coverage/closure_macro_async.cov-map +++ b/tests/coverage/closure_macro_async.cov-map @@ -34,20 +34,20 @@ Number of file 0 mappings: 6 Highest counter ID seen: c1 Function name: closure_macro_async::test::{closure#0}::{closure#0} -Raw bytes (35): 0x[01, 01, 03, 01, 05, 0b, 0d, 05, 09, 05, 01, 14, 1c, 03, 21, 05, 04, 11, 01, 27, 02, 03, 11, 00, 16, 0d, 00, 17, 00, 1e, 07, 02, 09, 00, 0a] +Raw bytes (35): 0x[01, 01, 03, 01, 05, 01, 0b, 05, 09, 05, 01, 14, 1c, 03, 21, 05, 04, 11, 01, 27, 02, 03, 11, 00, 16, 06, 00, 17, 00, 1e, 01, 02, 09, 00, 0a] Number of files: 1 - file 0 => global file 1 Number of expressions: 3 - expression 0 operands: lhs = Counter(0), rhs = Counter(1) -- expression 1 operands: lhs = Expression(2, Add), rhs = Counter(3) +- expression 1 operands: lhs = Counter(0), rhs = Expression(2, Add) - expression 2 operands: lhs = Counter(1), rhs = Counter(2) Number of file 0 mappings: 5 - Code(Counter(0)) at (prev + 20, 28) to (start + 3, 33) - Code(Counter(1)) at (prev + 4, 17) to (start + 1, 39) - Code(Expression(0, Sub)) at (prev + 3, 17) to (start + 0, 22) = (c0 - c1) -- Code(Counter(3)) at (prev + 0, 23) to (start + 0, 30) -- Code(Expression(1, Add)) at (prev + 2, 9) to (start + 0, 10) - = ((c1 + c2) + c3) -Highest counter ID seen: c3 +- Code(Expression(1, Sub)) at (prev + 0, 23) to (start + 0, 30) + = (c0 - (c1 + c2)) +- Code(Counter(0)) at (prev + 2, 9) to (start + 0, 10) +Highest counter ID seen: c1 diff --git a/tests/coverage/condition/conditions.cov-map b/tests/coverage/condition/conditions.cov-map index 72f39b88c6a..417637f2d2e 100644 --- a/tests/coverage/condition/conditions.cov-map +++ b/tests/coverage/condition/conditions.cov-map @@ -1,120 +1,103 @@ Function name: conditions::assign_3_and_or -Raw bytes (65): 0x[01, 01, 05, 07, 11, 09, 0d, 01, 05, 05, 09, 01, 09, 09, 01, 1c, 01, 00, 2f, 03, 01, 09, 00, 0a, 01, 00, 0d, 00, 0e, 20, 05, 0a, 00, 0d, 00, 0e, 05, 00, 12, 00, 13, 20, 09, 0e, 00, 12, 00, 13, 12, 00, 17, 00, 18, 20, 0d, 11, 00, 17, 00, 18, 03, 01, 05, 01, 02] +Raw bytes (65): 0x[01, 01, 05, 01, 05, 05, 09, 01, 09, 01, 13, 09, 0d, 09, 01, 1c, 01, 00, 2f, 01, 01, 09, 00, 0a, 01, 00, 0d, 00, 0e, 20, 05, 02, 00, 0d, 00, 0e, 05, 00, 12, 00, 13, 20, 09, 06, 00, 12, 00, 13, 0a, 00, 17, 00, 18, 20, 0d, 0e, 00, 17, 00, 18, 01, 01, 05, 01, 02] Number of files: 1 - file 0 => global file 1 Number of expressions: 5 -- expression 0 operands: lhs = Expression(1, Add), rhs = Counter(4) -- expression 1 operands: lhs = Counter(2), rhs = Counter(3) -- expression 2 operands: lhs = Counter(0), rhs = Counter(1) -- expression 3 operands: lhs = Counter(1), rhs = Counter(2) -- expression 4 operands: lhs = Counter(0), rhs = Counter(2) +- expression 0 operands: lhs = Counter(0), rhs = Counter(1) +- expression 1 operands: lhs = Counter(1), rhs = Counter(2) +- expression 2 operands: lhs = Counter(0), rhs = Counter(2) +- expression 3 operands: lhs = Counter(0), rhs = Expression(4, Add) +- expression 4 operands: lhs = Counter(2), rhs = Counter(3) Number of file 0 mappings: 9 - Code(Counter(0)) at (prev + 28, 1) to (start + 0, 47) -- Code(Expression(0, Add)) at (prev + 1, 9) to (start + 0, 10) - = ((c2 + c3) + c4) +- Code(Counter(0)) at (prev + 1, 9) to (start + 0, 10) - Code(Counter(0)) at (prev + 0, 13) to (start + 0, 14) -- Branch { true: Counter(1), false: Expression(2, Sub) } at (prev + 0, 13) to (start + 0, 14) +- Branch { true: Counter(1), false: Expression(0, Sub) } at (prev + 0, 13) to (start + 0, 14) true = c1 false = (c0 - c1) - Code(Counter(1)) at (prev + 0, 18) to (start + 0, 19) -- Branch { true: Counter(2), false: Expression(3, Sub) } at (prev + 0, 18) to (start + 0, 19) +- Branch { true: Counter(2), false: Expression(1, Sub) } at (prev + 0, 18) to (start + 0, 19) true = c2 false = (c1 - c2) -- Code(Expression(4, Sub)) at (prev + 0, 23) to (start + 0, 24) +- Code(Expression(2, Sub)) at (prev + 0, 23) to (start + 0, 24) = (c0 - c2) -- Branch { true: Counter(3), false: Counter(4) } at (prev + 0, 23) to (start + 0, 24) +- Branch { true: Counter(3), false: Expression(3, Sub) } at (prev + 0, 23) to (start + 0, 24) true = c3 - false = c4 -- Code(Expression(0, Add)) at (prev + 1, 5) to (start + 1, 2) - = ((c2 + c3) + c4) -Highest counter ID seen: c4 + false = (c0 - (c2 + c3)) +- Code(Counter(0)) at (prev + 1, 5) to (start + 1, 2) +Highest counter ID seen: c3 Function name: conditions::assign_3_or_and -Raw bytes (73): 0x[01, 01, 09, 07, 11, 0b, 0d, 05, 09, 01, 05, 01, 05, 01, 23, 05, 11, 01, 23, 05, 11, 09, 01, 17, 01, 00, 2f, 03, 01, 09, 00, 0a, 01, 00, 0d, 00, 0e, 20, 05, 12, 00, 0d, 00, 0e, 12, 00, 12, 00, 13, 20, 1e, 11, 00, 12, 00, 13, 1e, 00, 17, 00, 18, 20, 09, 0d, 00, 17, 00, 18, 03, 01, 05, 01, 02] +Raw bytes (63): 0x[01, 01, 04, 01, 05, 01, 0b, 05, 09, 09, 0d, 09, 01, 17, 01, 00, 2f, 01, 01, 09, 00, 0a, 01, 00, 0d, 00, 0e, 20, 05, 02, 00, 0d, 00, 0e, 02, 00, 12, 00, 13, 20, 09, 06, 00, 12, 00, 13, 09, 00, 17, 00, 18, 20, 0d, 0e, 00, 17, 00, 18, 01, 01, 05, 01, 02] Number of files: 1 - file 0 => global file 1 -Number of expressions: 9 -- expression 0 operands: lhs = Expression(1, Add), rhs = Counter(4) -- expression 1 operands: lhs = Expression(2, Add), rhs = Counter(3) +Number of expressions: 4 +- expression 0 operands: lhs = Counter(0), rhs = Counter(1) +- expression 1 operands: lhs = Counter(0), rhs = Expression(2, Add) - expression 2 operands: lhs = Counter(1), rhs = Counter(2) -- expression 3 operands: lhs = Counter(0), rhs = Counter(1) -- expression 4 operands: lhs = Counter(0), rhs = Counter(1) -- expression 5 operands: lhs = Counter(0), rhs = Expression(8, Add) -- expression 6 operands: lhs = Counter(1), rhs = Counter(4) -- expression 7 operands: lhs = Counter(0), rhs = Expression(8, Add) -- expression 8 operands: lhs = Counter(1), rhs = Counter(4) +- expression 3 operands: lhs = Counter(2), rhs = Counter(3) Number of file 0 mappings: 9 - Code(Counter(0)) at (prev + 23, 1) to (start + 0, 47) -- Code(Expression(0, Add)) at (prev + 1, 9) to (start + 0, 10) - = (((c1 + c2) + c3) + c4) +- Code(Counter(0)) at (prev + 1, 9) to (start + 0, 10) - Code(Counter(0)) at (prev + 0, 13) to (start + 0, 14) -- Branch { true: Counter(1), false: Expression(4, Sub) } at (prev + 0, 13) to (start + 0, 14) +- Branch { true: Counter(1), false: Expression(0, Sub) } at (prev + 0, 13) to (start + 0, 14) true = c1 false = (c0 - c1) -- Code(Expression(4, Sub)) at (prev + 0, 18) to (start + 0, 19) +- Code(Expression(0, Sub)) at (prev + 0, 18) to (start + 0, 19) = (c0 - c1) -- Branch { true: Expression(7, Sub), false: Counter(4) } at (prev + 0, 18) to (start + 0, 19) - true = (c0 - (c1 + c4)) - false = c4 -- Code(Expression(7, Sub)) at (prev + 0, 23) to (start + 0, 24) - = (c0 - (c1 + c4)) -- Branch { true: Counter(2), false: Counter(3) } at (prev + 0, 23) to (start + 0, 24) +- Branch { true: Counter(2), false: Expression(1, Sub) } at (prev + 0, 18) to (start + 0, 19) true = c2 - false = c3 -- Code(Expression(0, Add)) at (prev + 1, 5) to (start + 1, 2) - = (((c1 + c2) + c3) + c4) -Highest counter ID seen: c4 + false = (c0 - (c1 + c2)) +- Code(Counter(2)) at (prev + 0, 23) to (start + 0, 24) +- Branch { true: Counter(3), false: Expression(3, Sub) } at (prev + 0, 23) to (start + 0, 24) + true = c3 + false = (c2 - c3) +- Code(Counter(0)) at (prev + 1, 5) to (start + 1, 2) +Highest counter ID seen: c3 Function name: conditions::assign_and -Raw bytes (51): 0x[01, 01, 04, 07, 05, 0b, 0d, 01, 09, 01, 05, 07, 01, 0d, 01, 00, 21, 02, 01, 09, 00, 0a, 01, 00, 0d, 00, 0e, 20, 05, 0e, 00, 0d, 00, 0e, 05, 00, 12, 00, 13, 20, 09, 0d, 00, 12, 00, 13, 02, 01, 05, 01, 02] +Raw bytes (47): 0x[01, 01, 02, 01, 05, 05, 09, 07, 01, 0d, 01, 00, 21, 01, 01, 09, 00, 0a, 01, 00, 0d, 00, 0e, 20, 05, 02, 00, 0d, 00, 0e, 05, 00, 12, 00, 13, 20, 09, 06, 00, 12, 00, 13, 01, 01, 05, 01, 02] Number of files: 1 - file 0 => global file 1 -Number of expressions: 4 -- expression 0 operands: lhs = Expression(1, Add), rhs = Counter(1) -- expression 1 operands: lhs = Expression(2, Add), rhs = Counter(3) -- expression 2 operands: lhs = Counter(0), rhs = Counter(2) -- expression 3 operands: lhs = Counter(0), rhs = Counter(1) +Number of expressions: 2 +- expression 0 operands: lhs = Counter(0), rhs = Counter(1) +- expression 1 operands: lhs = Counter(1), rhs = Counter(2) Number of file 0 mappings: 7 - Code(Counter(0)) at (prev + 13, 1) to (start + 0, 33) -- Code(Expression(0, Sub)) at (prev + 1, 9) to (start + 0, 10) - = (((c0 + c2) + c3) - c1) +- Code(Counter(0)) at (prev + 1, 9) to (start + 0, 10) - Code(Counter(0)) at (prev + 0, 13) to (start + 0, 14) -- Branch { true: Counter(1), false: Expression(3, Sub) } at (prev + 0, 13) to (start + 0, 14) +- Branch { true: Counter(1), false: Expression(0, Sub) } at (prev + 0, 13) to (start + 0, 14) true = c1 false = (c0 - c1) - Code(Counter(1)) at (prev + 0, 18) to (start + 0, 19) -- Branch { true: Counter(2), false: Counter(3) } at (prev + 0, 18) to (start + 0, 19) +- Branch { true: Counter(2), false: Expression(1, Sub) } at (prev + 0, 18) to (start + 0, 19) true = c2 - false = c3 -- Code(Expression(0, Sub)) at (prev + 1, 5) to (start + 1, 2) - = (((c0 + c2) + c3) - c1) -Highest counter ID seen: c3 + false = (c1 - c2) +- Code(Counter(0)) at (prev + 1, 5) to (start + 1, 2) +Highest counter ID seen: c2 Function name: conditions::assign_or -Raw bytes (51): 0x[01, 01, 04, 07, 0d, 05, 09, 01, 05, 01, 05, 07, 01, 12, 01, 00, 20, 03, 01, 09, 00, 0a, 01, 00, 0d, 00, 0e, 20, 05, 0e, 00, 0d, 00, 0e, 0e, 00, 12, 00, 13, 20, 09, 0d, 00, 12, 00, 13, 03, 01, 05, 01, 02] +Raw bytes (49): 0x[01, 01, 03, 01, 05, 01, 0b, 05, 09, 07, 01, 12, 01, 00, 20, 01, 01, 09, 00, 0a, 01, 00, 0d, 00, 0e, 20, 05, 02, 00, 0d, 00, 0e, 02, 00, 12, 00, 13, 20, 09, 06, 00, 12, 00, 13, 01, 01, 05, 01, 02] Number of files: 1 - file 0 => global file 1 -Number of expressions: 4 -- expression 0 operands: lhs = Expression(1, Add), rhs = Counter(3) -- expression 1 operands: lhs = Counter(1), rhs = Counter(2) -- expression 2 operands: lhs = Counter(0), rhs = Counter(1) -- expression 3 operands: lhs = Counter(0), rhs = Counter(1) +Number of expressions: 3 +- expression 0 operands: lhs = Counter(0), rhs = Counter(1) +- expression 1 operands: lhs = Counter(0), rhs = Expression(2, Add) +- expression 2 operands: lhs = Counter(1), rhs = Counter(2) Number of file 0 mappings: 7 - Code(Counter(0)) at (prev + 18, 1) to (start + 0, 32) -- Code(Expression(0, Add)) at (prev + 1, 9) to (start + 0, 10) - = ((c1 + c2) + c3) +- Code(Counter(0)) at (prev + 1, 9) to (start + 0, 10) - Code(Counter(0)) at (prev + 0, 13) to (start + 0, 14) -- Branch { true: Counter(1), false: Expression(3, Sub) } at (prev + 0, 13) to (start + 0, 14) +- Branch { true: Counter(1), false: Expression(0, Sub) } at (prev + 0, 13) to (start + 0, 14) true = c1 false = (c0 - c1) -- Code(Expression(3, Sub)) at (prev + 0, 18) to (start + 0, 19) +- Code(Expression(0, Sub)) at (prev + 0, 18) to (start + 0, 19) = (c0 - c1) -- Branch { true: Counter(2), false: Counter(3) } at (prev + 0, 18) to (start + 0, 19) +- Branch { true: Counter(2), false: Expression(1, Sub) } at (prev + 0, 18) to (start + 0, 19) true = c2 - false = c3 -- Code(Expression(0, Add)) at (prev + 1, 5) to (start + 1, 2) - = ((c1 + c2) + c3) -Highest counter ID seen: c3 + false = (c0 - (c1 + c2)) +- Code(Counter(0)) at (prev + 1, 5) to (start + 1, 2) +Highest counter ID seen: c2 Function name: conditions::foo Raw bytes (9): 0x[01, 01, 00, 01, 01, 21, 01, 02, 02] @@ -126,26 +109,23 @@ Number of file 0 mappings: 1 Highest counter ID seen: c0 Function name: conditions::func_call -Raw bytes (41): 0x[01, 01, 04, 01, 05, 0b, 05, 0f, 0d, 01, 09, 05, 01, 25, 01, 01, 0a, 20, 05, 02, 01, 09, 00, 0a, 05, 00, 0e, 00, 0f, 20, 09, 0d, 00, 0e, 00, 0f, 06, 01, 01, 00, 02] +Raw bytes (37): 0x[01, 01, 02, 01, 05, 05, 09, 05, 01, 25, 01, 01, 0a, 20, 05, 02, 01, 09, 00, 0a, 05, 00, 0e, 00, 0f, 20, 09, 06, 00, 0e, 00, 0f, 01, 01, 01, 00, 02] Number of files: 1 - file 0 => global file 1 -Number of expressions: 4 +Number of expressions: 2 - expression 0 operands: lhs = Counter(0), rhs = Counter(1) -- expression 1 operands: lhs = Expression(2, Add), rhs = Counter(1) -- expression 2 operands: lhs = Expression(3, Add), rhs = Counter(3) -- expression 3 operands: lhs = Counter(0), rhs = Counter(2) +- expression 1 operands: lhs = Counter(1), rhs = Counter(2) Number of file 0 mappings: 5 - Code(Counter(0)) at (prev + 37, 1) to (start + 1, 10) - Branch { true: Counter(1), false: Expression(0, Sub) } at (prev + 1, 9) to (start + 0, 10) true = c1 false = (c0 - c1) - Code(Counter(1)) at (prev + 0, 14) to (start + 0, 15) -- Branch { true: Counter(2), false: Counter(3) } at (prev + 0, 14) to (start + 0, 15) +- Branch { true: Counter(2), false: Expression(1, Sub) } at (prev + 0, 14) to (start + 0, 15) true = c2 - false = c3 -- Code(Expression(1, Sub)) at (prev + 1, 1) to (start + 0, 2) - = (((c0 + c2) + c3) - c1) -Highest counter ID seen: c3 + false = (c1 - c2) +- Code(Counter(0)) at (prev + 1, 1) to (start + 0, 2) +Highest counter ID seen: c2 Function name: conditions::simple_assign Raw bytes (9): 0x[01, 01, 00, 01, 01, 08, 01, 03, 02] diff --git a/tests/coverage/conditions.cov-map b/tests/coverage/conditions.cov-map index 21b2ec9a19e..549b8bb0a20 100644 --- a/tests/coverage/conditions.cov-map +++ b/tests/coverage/conditions.cov-map @@ -1,294 +1,192 @@ Function name: conditions::main -Raw bytes (873): 0x[01, 01, b2, 01, 07, 19, 0b, 15, 0f, 11, 09, 0d, 01, 09, 8d, 01, 0d, 8d, 01, 33, 0d, 11, 33, 15, 0d, 11, 2f, 19, 33, 15, 0d, 11, 01, c7, 05, 09, 8d, 01, 03, 21, 03, 47, 21, 89, 01, 03, 4f, db, 03, 89, 01, 21, 25, 03, 5b, d7, 03, 89, 01, db, 03, 29, 21, 25, 77, 2d, 25, 29, 73, 31, 77, 2d, 25, 29, d3, 03, 31, d7, 03, 2d, db, 03, 29, 21, 25, 35, 3d, 35, 93, 01, 3d, 85, 01, 35, 9b, 01, af, 01, 85, 01, 3d, 41, 35, a7, 01, ab, 01, 85, 01, af, 01, 45, 3d, 41, c3, 01, 49, 41, 45, bf, 01, 4d, c3, 01, 49, 41, 45, bb, 03, 35, bf, 03, 4d, c3, 03, 49, c7, 03, 45, cb, 03, 41, cf, 03, 3d, d3, 03, 31, d7, 03, 2d, db, 03, 29, 21, 25, f3, 04, 65, f7, 04, 61, fb, 04, 5d, 55, 59, bb, 03, 35, bf, 03, 4d, c3, 03, 49, c7, 03, 45, cb, 03, 41, cf, 03, 3d, d3, 03, 31, d7, 03, 2d, db, 03, 29, 21, 25, bb, 03, eb, 03, bf, 03, 4d, c3, 03, 49, c7, 03, 45, cb, 03, 41, cf, 03, 3d, d3, 03, 31, d7, 03, 2d, db, 03, 29, 21, 25, 35, 55, bb, 03, fb, 02, bf, 03, 4d, c3, 03, 49, c7, 03, 45, cb, 03, 41, cf, 03, 3d, d3, 03, 31, d7, 03, 2d, db, 03, 29, 21, 25, eb, 03, 81, 01, 35, 55, bb, 03, ab, 03, bf, 03, 4d, c3, 03, 49, c7, 03, 45, cb, 03, 41, cf, 03, 3d, d3, 03, 31, d7, 03, 2d, db, 03, 29, 21, 25, e7, 03, 81, 01, eb, 03, 59, 35, 55, bb, 03, df, 03, bf, 03, 4d, c3, 03, 49, c7, 03, 45, cb, 03, 41, cf, 03, 3d, d3, 03, 31, d7, 03, 2d, db, 03, 29, 21, 25, e3, 03, 81, 01, e7, 03, 5d, eb, 03, 59, 35, 55, ff, 03, 61, 59, 5d, fb, 03, 65, ff, 03, 61, 59, 5d, 87, 04, 79, 83, 05, 75, 87, 05, 71, 69, 6d, f3, 04, 65, f7, 04, 61, fb, 04, 5d, 55, 59, ef, 04, 69, f3, 04, 65, f7, 04, 61, fb, 04, 5d, 55, 59, ef, 04, cb, 04, f3, 04, 65, f7, 04, 61, fb, 04, 5d, 55, 59, 69, 7d, ef, 04, e3, 04, f3, 04, 65, f7, 04, 61, fb, 04, 5d, 55, 59, 87, 05, 7d, 69, 6d, ef, 04, ff, 04, f3, 04, 65, f7, 04, 61, fb, 04, 5d, 55, 59, 83, 05, 7d, 87, 05, 71, 69, 6d, 9b, 05, 75, 6d, 71, 97, 05, 79, 9b, 05, 75, 6d, 71, a3, 05, c7, 05, a7, 05, 89, 01, ab, 05, 85, 01, af, 05, 81, 01, b3, 05, 7d, b7, 05, 79, bb, 05, 75, bf, 05, 71, c3, 05, 6d, 01, 69, 09, 8d, 01, 44, 01, 03, 01, 02, 0c, 05, 02, 0d, 02, 06, 00, 02, 05, 00, 06, 03, 03, 09, 00, 0a, 01, 00, 10, 00, 1d, 09, 01, 09, 01, 0a, 12, 02, 0f, 00, 1c, 8d, 01, 01, 0c, 00, 19, 16, 00, 1d, 00, 2a, 1a, 00, 2e, 00, 3c, 2f, 00, 3d, 02, 0a, 19, 02, 09, 00, 0a, 2b, 01, 09, 01, 12, 36, 03, 09, 00, 0f, 03, 03, 09, 01, 0c, 1d, 01, 0d, 02, 06, 00, 02, 05, 00, 06, 03, 02, 08, 00, 15, 21, 00, 16, 02, 06, 3e, 02, 0f, 00, 1c, 42, 01, 0c, 00, 19, 4a, 00, 1d, 00, 2a, 56, 00, 2e, 00, 3c, 73, 00, 3d, 02, 0a, 31, 02, 09, 00, 0a, 6f, 01, 09, 00, 17, 89, 01, 02, 09, 00, 0f, cf, 03, 03, 08, 00, 0c, 35, 01, 0d, 01, 10, 39, 01, 11, 02, 0a, 00, 02, 09, 00, 0a, 35, 02, 0c, 00, 19, 3d, 00, 1a, 02, 0a, 8a, 01, 04, 11, 00, 1e, 8e, 01, 01, 10, 00, 1d, 96, 01, 00, 21, 00, 2e, a2, 01, 00, 32, 00, 40, bf, 01, 00, 41, 02, 0e, 4d, 02, 0d, 00, 0e, bb, 01, 01, 0d, 00, 1b, 85, 01, 02, 0d, 00, 13, 00, 02, 05, 00, 06, fe, 01, 02, 09, 01, 0c, 51, 01, 0d, 02, 06, 00, 02, 05, 00, 06, ef, 04, 02, 09, 00, 0a, fe, 01, 00, 10, 00, 1d, 55, 00, 1e, 02, 06, a6, 02, 02, 0f, 00, 1c, d2, 02, 01, 0c, 00, 19, 82, 03, 00, 1d, 00, 2a, b6, 03, 00, 2e, 00, 3c, fb, 03, 00, 3d, 02, 0a, 65, 02, 09, 00, 0a, f7, 03, 01, 09, 00, 17, 81, 01, 02, 0d, 02, 0f, 83, 04, 05, 09, 00, 0a, ef, 04, 00, 10, 00, 1d, 69, 00, 1e, 02, 06, a2, 04, 02, 0f, 00, 1c, b6, 04, 01, 0c, 00, 19, ce, 04, 00, 1d, 00, 2a, ea, 04, 00, 2e, 00, 3c, 97, 05, 00, 3d, 02, 0a, 79, 02, 09, 00, 0a, 93, 05, 01, 09, 00, 17, 7d, 02, 09, 00, 0f, 9e, 05, 02, 01, 00, 02] +Raw bytes (545): 0x[01, 01, 4d, 09, 0d, 01, 09, 0d, 71, 0d, 27, 71, 75, 27, 79, 71, 75, 0d, 23, 27, 79, 71, 75, 01, 03, 03, 15, 19, 65, 19, 4f, 65, 69, 4f, 6d, 65, 69, 19, 4b, 4f, 6d, 65, 69, 03, ef, 01, 15, 19, 15, 19, 1d, 25, 29, 59, 29, 7f, 59, 5d, 7f, 61, 59, 5d, 29, 7b, 7f, 61, 59, 5d, 1d, 87, 01, 25, 29, e7, 01, 1d, eb, 01, 29, ef, 01, 25, 15, 19, 31, 35, e7, 01, 1d, eb, 01, 29, ef, 01, 25, 15, 19, e7, 01, f7, 01, eb, 01, 29, ef, 01, 25, 15, 19, 1d, 31, 35, 4d, 35, df, 01, 4d, 51, df, 01, 55, 4d, 51, 35, db, 01, df, 01, 55, 4d, 51, e7, 01, f3, 01, eb, 01, 29, ef, 01, 25, 15, 19, f7, 01, 35, 1d, 31, 39, 3d, 31, 35, af, 02, 39, 31, 35, 3d, 41, 3d, a7, 02, 41, 45, a7, 02, 49, 41, 45, 3d, a3, 02, a7, 02, 49, 41, 45, af, 02, b3, 02, 31, 35, 39, 3d, 44, 01, 03, 01, 02, 0c, 05, 02, 0d, 02, 06, 00, 02, 05, 00, 06, 03, 03, 09, 00, 0a, 01, 00, 10, 00, 1d, 09, 01, 09, 01, 0a, 06, 02, 0f, 00, 1c, 0d, 01, 0c, 00, 19, 0a, 00, 1d, 00, 2a, 0e, 00, 2e, 00, 3c, 23, 00, 3d, 02, 0a, 1e, 02, 09, 00, 0a, 0d, 01, 09, 01, 12, 2a, 03, 09, 00, 0f, 03, 03, 09, 01, 0c, 11, 01, 0d, 02, 06, 00, 02, 05, 00, 06, 03, 02, 08, 00, 15, 15, 00, 16, 02, 06, 2e, 02, 0f, 00, 1c, 19, 01, 0c, 00, 19, 32, 00, 1d, 00, 2a, 36, 00, 2e, 00, 3c, 4b, 00, 3d, 02, 0a, 46, 02, 09, 00, 0a, 19, 01, 09, 00, 17, 52, 02, 09, 00, 0f, ef, 01, 03, 08, 00, 0c, 1d, 01, 0d, 01, 10, 21, 01, 11, 02, 0a, 00, 02, 09, 00, 0a, 1d, 02, 0c, 00, 19, 25, 00, 1a, 02, 0a, 5e, 04, 11, 00, 1e, 29, 01, 10, 00, 1d, 62, 00, 21, 00, 2e, 66, 00, 32, 00, 40, 7b, 00, 41, 02, 0e, 76, 02, 0d, 00, 0e, 29, 01, 0d, 00, 1b, 82, 01, 02, 0d, 00, 13, 00, 02, 05, 00, 06, 9e, 01, 02, 09, 01, 0c, 2d, 01, 0d, 02, 06, 00, 02, 05, 00, 06, af, 02, 02, 09, 00, 0a, 9e, 01, 00, 10, 00, 1d, 31, 00, 1e, 02, 06, ae, 01, 02, 0f, 00, 1c, 35, 01, 0c, 00, 19, c2, 01, 00, 1d, 00, 2a, c6, 01, 00, 2e, 00, 3c, db, 01, 00, 3d, 02, 0a, d6, 01, 02, 09, 00, 0a, 35, 01, 09, 00, 17, e2, 01, 02, 0d, 02, 0f, b3, 02, 05, 09, 00, 0a, af, 02, 00, 10, 00, 1d, 39, 00, 1e, 02, 06, 82, 02, 02, 0f, 00, 1c, 3d, 01, 0c, 00, 19, 8a, 02, 00, 1d, 00, 2a, 8e, 02, 00, 2e, 00, 3c, a3, 02, 00, 3d, 02, 0a, 9e, 02, 02, 09, 00, 0a, 3d, 01, 09, 00, 17, aa, 02, 02, 09, 00, 0f, 01, 02, 01, 00, 02] Number of files: 1 - file 0 => global file 1 -Number of expressions: 178 -- expression 0 operands: lhs = Expression(1, Add), rhs = Counter(6) -- expression 1 operands: lhs = Expression(2, Add), rhs = Counter(5) -- expression 2 operands: lhs = Expression(3, Add), rhs = Counter(4) -- expression 3 operands: lhs = Counter(2), rhs = Counter(3) -- expression 4 operands: lhs = Counter(0), rhs = Counter(2) -- expression 5 operands: lhs = Counter(35), rhs = Counter(3) -- expression 6 operands: lhs = Counter(35), rhs = Expression(12, Add) -- expression 7 operands: lhs = Counter(3), rhs = Counter(4) -- expression 8 operands: lhs = Expression(12, Add), rhs = Counter(5) -- expression 9 operands: lhs = Counter(3), rhs = Counter(4) -- expression 10 operands: lhs = Expression(11, Add), rhs = Counter(6) -- expression 11 operands: lhs = Expression(12, Add), rhs = Counter(5) -- expression 12 operands: lhs = Counter(3), rhs = Counter(4) -- expression 13 operands: lhs = Counter(0), rhs = Expression(177, Add) -- expression 14 operands: lhs = Counter(2), rhs = Counter(35) -- expression 15 operands: lhs = Expression(0, Add), rhs = Counter(8) -- expression 16 operands: lhs = Expression(0, Add), rhs = Expression(17, Add) -- expression 17 operands: lhs = Counter(8), rhs = Counter(34) -- expression 18 operands: lhs = Expression(0, Add), rhs = Expression(19, Add) -- expression 19 operands: lhs = Expression(118, Add), rhs = Counter(34) -- expression 20 operands: lhs = Counter(8), rhs = Counter(9) -- expression 21 operands: lhs = Expression(0, Add), rhs = Expression(22, Add) -- expression 22 operands: lhs = Expression(117, Add), rhs = Counter(34) -- expression 23 operands: lhs = Expression(118, Add), rhs = Counter(10) -- expression 24 operands: lhs = Counter(8), rhs = Counter(9) -- expression 25 operands: lhs = Expression(29, Add), rhs = Counter(11) -- expression 26 operands: lhs = Counter(9), rhs = Counter(10) -- expression 27 operands: lhs = Expression(28, Add), rhs = Counter(12) -- expression 28 operands: lhs = Expression(29, Add), rhs = Counter(11) -- expression 29 operands: lhs = Counter(9), rhs = Counter(10) -- expression 30 operands: lhs = Expression(116, Add), rhs = Counter(12) -- expression 31 operands: lhs = Expression(117, Add), rhs = Counter(11) -- expression 32 operands: lhs = Expression(118, Add), rhs = Counter(10) -- expression 33 operands: lhs = Counter(8), rhs = Counter(9) -- expression 34 operands: lhs = Counter(13), rhs = Counter(15) -- expression 35 operands: lhs = Counter(13), rhs = Expression(36, Add) -- expression 36 operands: lhs = Counter(15), rhs = Counter(33) -- expression 37 operands: lhs = Counter(13), rhs = Expression(38, Add) -- expression 38 operands: lhs = Expression(43, Add), rhs = Counter(33) -- expression 39 operands: lhs = Counter(15), rhs = Counter(16) -- expression 40 operands: lhs = Counter(13), rhs = Expression(41, Add) -- expression 41 operands: lhs = Expression(42, Add), rhs = Counter(33) -- expression 42 operands: lhs = Expression(43, Add), rhs = Counter(17) -- expression 43 operands: lhs = Counter(15), rhs = Counter(16) -- expression 44 operands: lhs = Expression(48, Add), rhs = Counter(18) -- expression 45 operands: lhs = Counter(16), rhs = Counter(17) -- expression 46 operands: lhs = Expression(47, Add), rhs = Counter(19) -- expression 47 operands: lhs = Expression(48, Add), rhs = Counter(18) -- expression 48 operands: lhs = Counter(16), rhs = Counter(17) -- expression 49 operands: lhs = Expression(110, Add), rhs = Counter(13) -- expression 50 operands: lhs = Expression(111, Add), rhs = Counter(19) -- expression 51 operands: lhs = Expression(112, Add), rhs = Counter(18) -- expression 52 operands: lhs = Expression(113, Add), rhs = Counter(17) -- expression 53 operands: lhs = Expression(114, Add), rhs = Counter(16) -- expression 54 operands: lhs = Expression(115, Add), rhs = Counter(15) -- expression 55 operands: lhs = Expression(116, Add), rhs = Counter(12) -- expression 56 operands: lhs = Expression(117, Add), rhs = Counter(11) -- expression 57 operands: lhs = Expression(118, Add), rhs = Counter(10) -- expression 58 operands: lhs = Counter(8), rhs = Counter(9) -- expression 59 operands: lhs = Expression(156, Add), rhs = Counter(25) -- expression 60 operands: lhs = Expression(157, Add), rhs = Counter(24) -- expression 61 operands: lhs = Expression(158, Add), rhs = Counter(23) -- expression 62 operands: lhs = Counter(21), rhs = Counter(22) -- expression 63 operands: lhs = Expression(110, Add), rhs = Counter(13) -- expression 64 operands: lhs = Expression(111, Add), rhs = Counter(19) -- expression 65 operands: lhs = Expression(112, Add), rhs = Counter(18) -- expression 66 operands: lhs = Expression(113, Add), rhs = Counter(17) -- expression 67 operands: lhs = Expression(114, Add), rhs = Counter(16) -- expression 68 operands: lhs = Expression(115, Add), rhs = Counter(15) -- expression 69 operands: lhs = Expression(116, Add), rhs = Counter(12) -- expression 70 operands: lhs = Expression(117, Add), rhs = Counter(11) -- expression 71 operands: lhs = Expression(118, Add), rhs = Counter(10) -- expression 72 operands: lhs = Counter(8), rhs = Counter(9) -- expression 73 operands: lhs = Expression(110, Add), rhs = Expression(122, Add) -- expression 74 operands: lhs = Expression(111, Add), rhs = Counter(19) -- expression 75 operands: lhs = Expression(112, Add), rhs = Counter(18) -- expression 76 operands: lhs = Expression(113, Add), rhs = Counter(17) -- expression 77 operands: lhs = Expression(114, Add), rhs = Counter(16) -- expression 78 operands: lhs = Expression(115, Add), rhs = Counter(15) -- expression 79 operands: lhs = Expression(116, Add), rhs = Counter(12) -- expression 80 operands: lhs = Expression(117, Add), rhs = Counter(11) -- expression 81 operands: lhs = Expression(118, Add), rhs = Counter(10) -- expression 82 operands: lhs = Counter(8), rhs = Counter(9) -- expression 83 operands: lhs = Counter(13), rhs = Counter(21) -- expression 84 operands: lhs = Expression(110, Add), rhs = Expression(94, Add) -- expression 85 operands: lhs = Expression(111, Add), rhs = Counter(19) -- expression 86 operands: lhs = Expression(112, Add), rhs = Counter(18) -- expression 87 operands: lhs = Expression(113, Add), rhs = Counter(17) -- expression 88 operands: lhs = Expression(114, Add), rhs = Counter(16) -- expression 89 operands: lhs = Expression(115, Add), rhs = Counter(15) -- expression 90 operands: lhs = Expression(116, Add), rhs = Counter(12) -- expression 91 operands: lhs = Expression(117, Add), rhs = Counter(11) -- expression 92 operands: lhs = Expression(118, Add), rhs = Counter(10) -- expression 93 operands: lhs = Counter(8), rhs = Counter(9) -- expression 94 operands: lhs = Expression(122, Add), rhs = Counter(32) -- expression 95 operands: lhs = Counter(13), rhs = Counter(21) -- expression 96 operands: lhs = Expression(110, Add), rhs = Expression(106, Add) -- expression 97 operands: lhs = Expression(111, Add), rhs = Counter(19) -- expression 98 operands: lhs = Expression(112, Add), rhs = Counter(18) -- expression 99 operands: lhs = Expression(113, Add), rhs = Counter(17) -- expression 100 operands: lhs = Expression(114, Add), rhs = Counter(16) -- expression 101 operands: lhs = Expression(115, Add), rhs = Counter(15) -- expression 102 operands: lhs = Expression(116, Add), rhs = Counter(12) -- expression 103 operands: lhs = Expression(117, Add), rhs = Counter(11) -- expression 104 operands: lhs = Expression(118, Add), rhs = Counter(10) -- expression 105 operands: lhs = Counter(8), rhs = Counter(9) -- expression 106 operands: lhs = Expression(121, Add), rhs = Counter(32) -- expression 107 operands: lhs = Expression(122, Add), rhs = Counter(22) -- expression 108 operands: lhs = Counter(13), rhs = Counter(21) -- expression 109 operands: lhs = Expression(110, Add), rhs = Expression(119, Add) -- expression 110 operands: lhs = Expression(111, Add), rhs = Counter(19) -- expression 111 operands: lhs = Expression(112, Add), rhs = Counter(18) -- expression 112 operands: lhs = Expression(113, Add), rhs = Counter(17) -- expression 113 operands: lhs = Expression(114, Add), rhs = Counter(16) -- expression 114 operands: lhs = Expression(115, Add), rhs = Counter(15) -- expression 115 operands: lhs = Expression(116, Add), rhs = Counter(12) -- expression 116 operands: lhs = Expression(117, Add), rhs = Counter(11) -- expression 117 operands: lhs = Expression(118, Add), rhs = Counter(10) -- expression 118 operands: lhs = Counter(8), rhs = Counter(9) -- expression 119 operands: lhs = Expression(120, Add), rhs = Counter(32) -- expression 120 operands: lhs = Expression(121, Add), rhs = Counter(23) -- expression 121 operands: lhs = Expression(122, Add), rhs = Counter(22) -- expression 122 operands: lhs = Counter(13), rhs = Counter(21) -- expression 123 operands: lhs = Expression(127, Add), rhs = Counter(24) -- expression 124 operands: lhs = Counter(22), rhs = Counter(23) -- expression 125 operands: lhs = Expression(126, Add), rhs = Counter(25) -- expression 126 operands: lhs = Expression(127, Add), rhs = Counter(24) -- expression 127 operands: lhs = Counter(22), rhs = Counter(23) -- expression 128 operands: lhs = Expression(129, Add), rhs = Counter(30) -- expression 129 operands: lhs = Expression(160, Add), rhs = Counter(29) -- expression 130 operands: lhs = Expression(161, Add), rhs = Counter(28) -- expression 131 operands: lhs = Counter(26), rhs = Counter(27) -- expression 132 operands: lhs = Expression(156, Add), rhs = Counter(25) -- expression 133 operands: lhs = Expression(157, Add), rhs = Counter(24) -- expression 134 operands: lhs = Expression(158, Add), rhs = Counter(23) -- expression 135 operands: lhs = Counter(21), rhs = Counter(22) -- expression 136 operands: lhs = Expression(155, Add), rhs = Counter(26) -- expression 137 operands: lhs = Expression(156, Add), rhs = Counter(25) -- expression 138 operands: lhs = Expression(157, Add), rhs = Counter(24) -- expression 139 operands: lhs = Expression(158, Add), rhs = Counter(23) -- expression 140 operands: lhs = Counter(21), rhs = Counter(22) -- expression 141 operands: lhs = Expression(155, Add), rhs = Expression(146, Add) -- expression 142 operands: lhs = Expression(156, Add), rhs = Counter(25) -- expression 143 operands: lhs = Expression(157, Add), rhs = Counter(24) -- expression 144 operands: lhs = Expression(158, Add), rhs = Counter(23) -- expression 145 operands: lhs = Counter(21), rhs = Counter(22) -- expression 146 operands: lhs = Counter(26), rhs = Counter(31) -- expression 147 operands: lhs = Expression(155, Add), rhs = Expression(152, Add) -- expression 148 operands: lhs = Expression(156, Add), rhs = Counter(25) -- expression 149 operands: lhs = Expression(157, Add), rhs = Counter(24) -- expression 150 operands: lhs = Expression(158, Add), rhs = Counter(23) -- expression 151 operands: lhs = Counter(21), rhs = Counter(22) -- expression 152 operands: lhs = Expression(161, Add), rhs = Counter(31) -- expression 153 operands: lhs = Counter(26), rhs = Counter(27) -- expression 154 operands: lhs = Expression(155, Add), rhs = Expression(159, Add) -- expression 155 operands: lhs = Expression(156, Add), rhs = Counter(25) -- expression 156 operands: lhs = Expression(157, Add), rhs = Counter(24) -- expression 157 operands: lhs = Expression(158, Add), rhs = Counter(23) -- expression 158 operands: lhs = Counter(21), rhs = Counter(22) -- expression 159 operands: lhs = Expression(160, Add), rhs = Counter(31) -- expression 160 operands: lhs = Expression(161, Add), rhs = Counter(28) -- expression 161 operands: lhs = Counter(26), rhs = Counter(27) -- expression 162 operands: lhs = Expression(166, Add), rhs = Counter(29) -- expression 163 operands: lhs = Counter(27), rhs = Counter(28) -- expression 164 operands: lhs = Expression(165, Add), rhs = Counter(30) -- expression 165 operands: lhs = Expression(166, Add), rhs = Counter(29) -- expression 166 operands: lhs = Counter(27), rhs = Counter(28) -- expression 167 operands: lhs = Expression(168, Add), rhs = Expression(177, Add) -- expression 168 operands: lhs = Expression(169, Add), rhs = Counter(34) -- expression 169 operands: lhs = Expression(170, Add), rhs = Counter(33) -- expression 170 operands: lhs = Expression(171, Add), rhs = Counter(32) -- expression 171 operands: lhs = Expression(172, Add), rhs = Counter(31) -- expression 172 operands: lhs = Expression(173, Add), rhs = Counter(30) -- expression 173 operands: lhs = Expression(174, Add), rhs = Counter(29) -- expression 174 operands: lhs = Expression(175, Add), rhs = Counter(28) -- expression 175 operands: lhs = Expression(176, Add), rhs = Counter(27) -- expression 176 operands: lhs = Counter(0), rhs = Counter(26) -- expression 177 operands: lhs = Counter(2), rhs = Counter(35) +Number of expressions: 77 +- expression 0 operands: lhs = Counter(2), rhs = Counter(3) +- expression 1 operands: lhs = Counter(0), rhs = Counter(2) +- expression 2 operands: lhs = Counter(3), rhs = Counter(28) +- expression 3 operands: lhs = Counter(3), rhs = Expression(9, Add) +- expression 4 operands: lhs = Counter(28), rhs = Counter(29) +- expression 5 operands: lhs = Expression(9, Add), rhs = Counter(30) +- expression 6 operands: lhs = Counter(28), rhs = Counter(29) +- expression 7 operands: lhs = Counter(3), rhs = Expression(8, Add) +- expression 8 operands: lhs = Expression(9, Add), rhs = Counter(30) +- expression 9 operands: lhs = Counter(28), rhs = Counter(29) +- expression 10 operands: lhs = Counter(0), rhs = Expression(0, Add) +- expression 11 operands: lhs = Expression(0, Add), rhs = Counter(5) +- expression 12 operands: lhs = Counter(6), rhs = Counter(25) +- expression 13 operands: lhs = Counter(6), rhs = Expression(19, Add) +- expression 14 operands: lhs = Counter(25), rhs = Counter(26) +- expression 15 operands: lhs = Expression(19, Add), rhs = Counter(27) +- expression 16 operands: lhs = Counter(25), rhs = Counter(26) +- expression 17 operands: lhs = Counter(6), rhs = Expression(18, Add) +- expression 18 operands: lhs = Expression(19, Add), rhs = Counter(27) +- expression 19 operands: lhs = Counter(25), rhs = Counter(26) +- expression 20 operands: lhs = Expression(0, Add), rhs = Expression(59, Add) +- expression 21 operands: lhs = Counter(5), rhs = Counter(6) +- expression 22 operands: lhs = Counter(5), rhs = Counter(6) +- expression 23 operands: lhs = Counter(7), rhs = Counter(9) +- expression 24 operands: lhs = Counter(10), rhs = Counter(22) +- expression 25 operands: lhs = Counter(10), rhs = Expression(31, Add) +- expression 26 operands: lhs = Counter(22), rhs = Counter(23) +- expression 27 operands: lhs = Expression(31, Add), rhs = Counter(24) +- expression 28 operands: lhs = Counter(22), rhs = Counter(23) +- expression 29 operands: lhs = Counter(10), rhs = Expression(30, Add) +- expression 30 operands: lhs = Expression(31, Add), rhs = Counter(24) +- expression 31 operands: lhs = Counter(22), rhs = Counter(23) +- expression 32 operands: lhs = Counter(7), rhs = Expression(33, Add) +- expression 33 operands: lhs = Counter(9), rhs = Counter(10) +- expression 34 operands: lhs = Expression(57, Add), rhs = Counter(7) +- expression 35 operands: lhs = Expression(58, Add), rhs = Counter(10) +- expression 36 operands: lhs = Expression(59, Add), rhs = Counter(9) +- expression 37 operands: lhs = Counter(5), rhs = Counter(6) +- expression 38 operands: lhs = Counter(12), rhs = Counter(13) +- expression 39 operands: lhs = Expression(57, Add), rhs = Counter(7) +- expression 40 operands: lhs = Expression(58, Add), rhs = Counter(10) +- expression 41 operands: lhs = Expression(59, Add), rhs = Counter(9) +- expression 42 operands: lhs = Counter(5), rhs = Counter(6) +- expression 43 operands: lhs = Expression(57, Add), rhs = Expression(61, Add) +- expression 44 operands: lhs = Expression(58, Add), rhs = Counter(10) +- expression 45 operands: lhs = Expression(59, Add), rhs = Counter(9) +- expression 46 operands: lhs = Counter(5), rhs = Counter(6) +- expression 47 operands: lhs = Counter(7), rhs = Counter(12) +- expression 48 operands: lhs = Counter(13), rhs = Counter(19) +- expression 49 operands: lhs = Counter(13), rhs = Expression(55, Add) +- expression 50 operands: lhs = Counter(19), rhs = Counter(20) +- expression 51 operands: lhs = Expression(55, Add), rhs = Counter(21) +- expression 52 operands: lhs = Counter(19), rhs = Counter(20) +- expression 53 operands: lhs = Counter(13), rhs = Expression(54, Add) +- expression 54 operands: lhs = Expression(55, Add), rhs = Counter(21) +- expression 55 operands: lhs = Counter(19), rhs = Counter(20) +- expression 56 operands: lhs = Expression(57, Add), rhs = Expression(60, Add) +- expression 57 operands: lhs = Expression(58, Add), rhs = Counter(10) +- expression 58 operands: lhs = Expression(59, Add), rhs = Counter(9) +- expression 59 operands: lhs = Counter(5), rhs = Counter(6) +- expression 60 operands: lhs = Expression(61, Add), rhs = Counter(13) +- expression 61 operands: lhs = Counter(7), rhs = Counter(12) +- expression 62 operands: lhs = Counter(14), rhs = Counter(15) +- expression 63 operands: lhs = Counter(12), rhs = Counter(13) +- expression 64 operands: lhs = Expression(75, Add), rhs = Counter(14) +- expression 65 operands: lhs = Counter(12), rhs = Counter(13) +- expression 66 operands: lhs = Counter(15), rhs = Counter(16) +- expression 67 operands: lhs = Counter(15), rhs = Expression(73, Add) +- expression 68 operands: lhs = Counter(16), rhs = Counter(17) +- expression 69 operands: lhs = Expression(73, Add), rhs = Counter(18) +- expression 70 operands: lhs = Counter(16), rhs = Counter(17) +- expression 71 operands: lhs = Counter(15), rhs = Expression(72, Add) +- expression 72 operands: lhs = Expression(73, Add), rhs = Counter(18) +- expression 73 operands: lhs = Counter(16), rhs = Counter(17) +- expression 74 operands: lhs = Expression(75, Add), rhs = Expression(76, Add) +- expression 75 operands: lhs = Counter(12), rhs = Counter(13) +- expression 76 operands: lhs = Counter(14), rhs = Counter(15) Number of file 0 mappings: 68 - Code(Counter(0)) at (prev + 3, 1) to (start + 2, 12) - Code(Counter(1)) at (prev + 2, 13) to (start + 2, 6) - Code(Zero) at (prev + 2, 5) to (start + 0, 6) - Code(Expression(0, Add)) at (prev + 3, 9) to (start + 0, 10) - = ((((c2 + c3) + c4) + c5) + c6) + = (c2 + c3) - Code(Counter(0)) at (prev + 0, 16) to (start + 0, 29) - Code(Counter(2)) at (prev + 1, 9) to (start + 1, 10) -- Code(Expression(4, Sub)) at (prev + 2, 15) to (start + 0, 28) +- Code(Expression(1, Sub)) at (prev + 2, 15) to (start + 0, 28) = (c0 - c2) -- Code(Counter(35)) at (prev + 1, 12) to (start + 0, 25) -- Code(Expression(5, Sub)) at (prev + 0, 29) to (start + 0, 42) - = (c35 - c3) -- Code(Expression(6, Sub)) at (prev + 0, 46) to (start + 0, 60) - = (c35 - (c3 + c4)) -- Code(Expression(11, Add)) at (prev + 0, 61) to (start + 2, 10) - = ((c3 + c4) + c5) -- Code(Counter(6)) at (prev + 2, 9) to (start + 0, 10) -- Code(Expression(10, Add)) at (prev + 1, 9) to (start + 1, 18) - = (((c3 + c4) + c5) + c6) -- Code(Expression(13, Sub)) at (prev + 3, 9) to (start + 0, 15) - = (c0 - (c2 + c35)) +- Code(Counter(3)) at (prev + 1, 12) to (start + 0, 25) +- Code(Expression(2, Sub)) at (prev + 0, 29) to (start + 0, 42) + = (c3 - c28) +- Code(Expression(3, Sub)) at (prev + 0, 46) to (start + 0, 60) + = (c3 - (c28 + c29)) +- Code(Expression(8, Add)) at (prev + 0, 61) to (start + 2, 10) + = ((c28 + c29) + c30) +- Code(Expression(7, Sub)) at (prev + 2, 9) to (start + 0, 10) + = (c3 - ((c28 + c29) + c30)) +- Code(Counter(3)) at (prev + 1, 9) to (start + 1, 18) +- Code(Expression(10, Sub)) at (prev + 3, 9) to (start + 0, 15) + = (c0 - (c2 + c3)) - Code(Expression(0, Add)) at (prev + 3, 9) to (start + 1, 12) - = ((((c2 + c3) + c4) + c5) + c6) -- Code(Counter(7)) at (prev + 1, 13) to (start + 2, 6) + = (c2 + c3) +- Code(Counter(4)) at (prev + 1, 13) to (start + 2, 6) - Code(Zero) at (prev + 2, 5) to (start + 0, 6) - Code(Expression(0, Add)) at (prev + 2, 8) to (start + 0, 21) - = ((((c2 + c3) + c4) + c5) + c6) -- Code(Counter(8)) at (prev + 0, 22) to (start + 2, 6) -- Code(Expression(15, Sub)) at (prev + 2, 15) to (start + 0, 28) - = (((((c2 + c3) + c4) + c5) + c6) - c8) -- Code(Expression(16, Sub)) at (prev + 1, 12) to (start + 0, 25) - = (((((c2 + c3) + c4) + c5) + c6) - (c8 + c34)) -- Code(Expression(18, Sub)) at (prev + 0, 29) to (start + 0, 42) - = (((((c2 + c3) + c4) + c5) + c6) - ((c8 + c9) + c34)) -- Code(Expression(21, Sub)) at (prev + 0, 46) to (start + 0, 60) - = (((((c2 + c3) + c4) + c5) + c6) - (((c8 + c9) + c10) + c34)) -- Code(Expression(28, Add)) at (prev + 0, 61) to (start + 2, 10) - = ((c9 + c10) + c11) -- Code(Counter(12)) at (prev + 2, 9) to (start + 0, 10) -- Code(Expression(27, Add)) at (prev + 1, 9) to (start + 0, 23) - = (((c9 + c10) + c11) + c12) -- Code(Counter(34)) at (prev + 2, 9) to (start + 0, 15) -- Code(Expression(115, Add)) at (prev + 3, 8) to (start + 0, 12) - = ((((c8 + c9) + c10) + c11) + c12) -- Code(Counter(13)) at (prev + 1, 13) to (start + 1, 16) -- Code(Counter(14)) at (prev + 1, 17) to (start + 2, 10) + = (c2 + c3) +- Code(Counter(5)) at (prev + 0, 22) to (start + 2, 6) +- Code(Expression(11, Sub)) at (prev + 2, 15) to (start + 0, 28) + = ((c2 + c3) - c5) +- Code(Counter(6)) at (prev + 1, 12) to (start + 0, 25) +- Code(Expression(12, Sub)) at (prev + 0, 29) to (start + 0, 42) + = (c6 - c25) +- Code(Expression(13, Sub)) at (prev + 0, 46) to (start + 0, 60) + = (c6 - (c25 + c26)) +- Code(Expression(18, Add)) at (prev + 0, 61) to (start + 2, 10) + = ((c25 + c26) + c27) +- Code(Expression(17, Sub)) at (prev + 2, 9) to (start + 0, 10) + = (c6 - ((c25 + c26) + c27)) +- Code(Counter(6)) at (prev + 1, 9) to (start + 0, 23) +- Code(Expression(20, Sub)) at (prev + 2, 9) to (start + 0, 15) + = ((c2 + c3) - (c5 + c6)) +- Code(Expression(59, Add)) at (prev + 3, 8) to (start + 0, 12) + = (c5 + c6) +- Code(Counter(7)) at (prev + 1, 13) to (start + 1, 16) +- Code(Counter(8)) at (prev + 1, 17) to (start + 2, 10) - Code(Zero) at (prev + 2, 9) to (start + 0, 10) -- Code(Counter(13)) at (prev + 2, 12) to (start + 0, 25) -- Code(Counter(15)) at (prev + 0, 26) to (start + 2, 10) -- Code(Expression(34, Sub)) at (prev + 4, 17) to (start + 0, 30) - = (c13 - c15) -- Code(Expression(35, Sub)) at (prev + 1, 16) to (start + 0, 29) - = (c13 - (c15 + c33)) -- Code(Expression(37, Sub)) at (prev + 0, 33) to (start + 0, 46) - = (c13 - ((c15 + c16) + c33)) -- Code(Expression(40, Sub)) at (prev + 0, 50) to (start + 0, 64) - = (c13 - (((c15 + c16) + c17) + c33)) -- Code(Expression(47, Add)) at (prev + 0, 65) to (start + 2, 14) - = ((c16 + c17) + c18) -- Code(Counter(19)) at (prev + 2, 13) to (start + 0, 14) -- Code(Expression(46, Add)) at (prev + 1, 13) to (start + 0, 27) - = (((c16 + c17) + c18) + c19) -- Code(Counter(33)) at (prev + 2, 13) to (start + 0, 19) +- Code(Counter(7)) at (prev + 2, 12) to (start + 0, 25) +- Code(Counter(9)) at (prev + 0, 26) to (start + 2, 10) +- Code(Expression(23, Sub)) at (prev + 4, 17) to (start + 0, 30) + = (c7 - c9) +- Code(Counter(10)) at (prev + 1, 16) to (start + 0, 29) +- Code(Expression(24, Sub)) at (prev + 0, 33) to (start + 0, 46) + = (c10 - c22) +- Code(Expression(25, Sub)) at (prev + 0, 50) to (start + 0, 64) + = (c10 - (c22 + c23)) +- Code(Expression(30, Add)) at (prev + 0, 65) to (start + 2, 14) + = ((c22 + c23) + c24) +- Code(Expression(29, Sub)) at (prev + 2, 13) to (start + 0, 14) + = (c10 - ((c22 + c23) + c24)) +- Code(Counter(10)) at (prev + 1, 13) to (start + 0, 27) +- Code(Expression(32, Sub)) at (prev + 2, 13) to (start + 0, 19) + = (c7 - (c9 + c10)) - Code(Zero) at (prev + 2, 5) to (start + 0, 6) -- Code(Expression(63, Sub)) at (prev + 2, 9) to (start + 1, 12) - = ((((((((((c8 + c9) + c10) + c11) + c12) + c15) + c16) + c17) + c18) + c19) - c13) -- Code(Counter(20)) at (prev + 1, 13) to (start + 2, 6) +- Code(Expression(39, Sub)) at (prev + 2, 9) to (start + 1, 12) + = ((((c5 + c6) + c9) + c10) - c7) +- Code(Counter(11)) at (prev + 1, 13) to (start + 2, 6) - Code(Zero) at (prev + 2, 5) to (start + 0, 6) -- Code(Expression(155, Add)) at (prev + 2, 9) to (start + 0, 10) - = ((((c21 + c22) + c23) + c24) + c25) -- Code(Expression(63, Sub)) at (prev + 0, 16) to (start + 0, 29) - = ((((((((((c8 + c9) + c10) + c11) + c12) + c15) + c16) + c17) + c18) + c19) - c13) -- Code(Counter(21)) at (prev + 0, 30) to (start + 2, 6) -- Code(Expression(73, Sub)) at (prev + 2, 15) to (start + 0, 28) - = ((((((((((c8 + c9) + c10) + c11) + c12) + c15) + c16) + c17) + c18) + c19) - (c13 + c21)) -- Code(Expression(84, Sub)) at (prev + 1, 12) to (start + 0, 25) - = ((((((((((c8 + c9) + c10) + c11) + c12) + c15) + c16) + c17) + c18) + c19) - ((c13 + c21) + c32)) -- Code(Expression(96, Sub)) at (prev + 0, 29) to (start + 0, 42) - = ((((((((((c8 + c9) + c10) + c11) + c12) + c15) + c16) + c17) + c18) + c19) - (((c13 + c21) + c22) + c32)) -- Code(Expression(109, Sub)) at (prev + 0, 46) to (start + 0, 60) - = ((((((((((c8 + c9) + c10) + c11) + c12) + c15) + c16) + c17) + c18) + c19) - ((((c13 + c21) + c22) + c23) + c32)) -- Code(Expression(126, Add)) at (prev + 0, 61) to (start + 2, 10) - = ((c22 + c23) + c24) -- Code(Counter(25)) at (prev + 2, 9) to (start + 0, 10) -- Code(Expression(125, Add)) at (prev + 1, 9) to (start + 0, 23) - = (((c22 + c23) + c24) + c25) -- Code(Counter(32)) at (prev + 2, 13) to (start + 2, 15) -- Code(Expression(128, Add)) at (prev + 5, 9) to (start + 0, 10) - = ((((c26 + c27) + c28) + c29) + c30) -- Code(Expression(155, Add)) at (prev + 0, 16) to (start + 0, 29) - = ((((c21 + c22) + c23) + c24) + c25) -- Code(Counter(26)) at (prev + 0, 30) to (start + 2, 6) -- Code(Expression(136, Sub)) at (prev + 2, 15) to (start + 0, 28) - = (((((c21 + c22) + c23) + c24) + c25) - c26) -- Code(Expression(141, Sub)) at (prev + 1, 12) to (start + 0, 25) - = (((((c21 + c22) + c23) + c24) + c25) - (c26 + c31)) -- Code(Expression(147, Sub)) at (prev + 0, 29) to (start + 0, 42) - = (((((c21 + c22) + c23) + c24) + c25) - ((c26 + c27) + c31)) -- Code(Expression(154, Sub)) at (prev + 0, 46) to (start + 0, 60) - = (((((c21 + c22) + c23) + c24) + c25) - (((c26 + c27) + c28) + c31)) -- Code(Expression(165, Add)) at (prev + 0, 61) to (start + 2, 10) - = ((c27 + c28) + c29) -- Code(Counter(30)) at (prev + 2, 9) to (start + 0, 10) -- Code(Expression(164, Add)) at (prev + 1, 9) to (start + 0, 23) - = (((c27 + c28) + c29) + c30) -- Code(Counter(31)) at (prev + 2, 9) to (start + 0, 15) -- Code(Expression(167, Sub)) at (prev + 2, 1) to (start + 0, 2) - = ((((((((((c0 + c26) + c27) + c28) + c29) + c30) + c31) + c32) + c33) + c34) - (c2 + c35)) -Highest counter ID seen: c35 +- Code(Expression(75, Add)) at (prev + 2, 9) to (start + 0, 10) + = (c12 + c13) +- Code(Expression(39, Sub)) at (prev + 0, 16) to (start + 0, 29) + = ((((c5 + c6) + c9) + c10) - c7) +- Code(Counter(12)) at (prev + 0, 30) to (start + 2, 6) +- Code(Expression(43, Sub)) at (prev + 2, 15) to (start + 0, 28) + = ((((c5 + c6) + c9) + c10) - (c7 + c12)) +- Code(Counter(13)) at (prev + 1, 12) to (start + 0, 25) +- Code(Expression(48, Sub)) at (prev + 0, 29) to (start + 0, 42) + = (c13 - c19) +- Code(Expression(49, Sub)) at (prev + 0, 46) to (start + 0, 60) + = (c13 - (c19 + c20)) +- Code(Expression(54, Add)) at (prev + 0, 61) to (start + 2, 10) + = ((c19 + c20) + c21) +- Code(Expression(53, Sub)) at (prev + 2, 9) to (start + 0, 10) + = (c13 - ((c19 + c20) + c21)) +- Code(Counter(13)) at (prev + 1, 9) to (start + 0, 23) +- Code(Expression(56, Sub)) at (prev + 2, 13) to (start + 2, 15) + = ((((c5 + c6) + c9) + c10) - ((c7 + c12) + c13)) +- Code(Expression(76, Add)) at (prev + 5, 9) to (start + 0, 10) + = (c14 + c15) +- Code(Expression(75, Add)) at (prev + 0, 16) to (start + 0, 29) + = (c12 + c13) +- Code(Counter(14)) at (prev + 0, 30) to (start + 2, 6) +- Code(Expression(64, Sub)) at (prev + 2, 15) to (start + 0, 28) + = ((c12 + c13) - c14) +- Code(Counter(15)) at (prev + 1, 12) to (start + 0, 25) +- Code(Expression(66, Sub)) at (prev + 0, 29) to (start + 0, 42) + = (c15 - c16) +- Code(Expression(67, Sub)) at (prev + 0, 46) to (start + 0, 60) + = (c15 - (c16 + c17)) +- Code(Expression(72, Add)) at (prev + 0, 61) to (start + 2, 10) + = ((c16 + c17) + c18) +- Code(Expression(71, Sub)) at (prev + 2, 9) to (start + 0, 10) + = (c15 - ((c16 + c17) + c18)) +- Code(Counter(15)) at (prev + 1, 9) to (start + 0, 23) +- Code(Expression(74, Sub)) at (prev + 2, 9) to (start + 0, 15) + = ((c12 + c13) - (c14 + c15)) +- Code(Counter(0)) at (prev + 2, 1) to (start + 0, 2) +Highest counter ID seen: c15 diff --git a/tests/coverage/continue.cov-map b/tests/coverage/continue.cov-map index 55313d7db49..eb968fbb747 100644 --- a/tests/coverage/continue.cov-map +++ b/tests/coverage/continue.cov-map @@ -1,5 +1,5 @@ Function name: continue::main -Raw bytes (210): 0x[01, 01, 1c, 07, 09, 01, 05, 03, 0d, 1f, 15, 0d, 11, 1b, 19, 1f, 15, 0d, 11, 33, 21, 19, 1d, 2f, 25, 33, 21, 19, 1d, 47, 2d, 25, 29, 43, 31, 47, 2d, 25, 29, 5b, 39, 31, 35, 57, 3d, 5b, 39, 31, 35, 35, 39, 3d, 41, 6b, 45, 3d, 41, 45, 49, 1e, 01, 03, 01, 03, 12, 03, 04, 0e, 00, 13, 0a, 01, 0f, 00, 16, 05, 02, 11, 00, 19, 09, 02, 12, 04, 0e, 1b, 06, 0e, 00, 13, 16, 01, 0f, 00, 16, 15, 01, 16, 02, 0e, 11, 04, 11, 00, 19, 15, 03, 09, 00, 0e, 2f, 02, 0e, 00, 13, 2a, 01, 0f, 00, 16, 1d, 01, 15, 02, 0e, 21, 04, 11, 00, 19, 1d, 03, 09, 00, 0e, 43, 02, 0e, 00, 13, 3e, 01, 0c, 00, 13, 29, 01, 0d, 00, 15, 2d, 01, 0a, 01, 0e, 57, 03, 0e, 00, 13, 52, 01, 0f, 00, 16, 39, 01, 16, 02, 0e, 35, 03, 12, 02, 0e, 5f, 04, 09, 00, 0e, 6b, 02, 0e, 00, 13, 66, 01, 0f, 00, 16, 41, 01, 16, 02, 0e, 49, 04, 11, 00, 16, 41, 03, 09, 00, 0e, 6f, 02, 0d, 01, 02] +Raw bytes (210): 0x[01, 01, 1c, 07, 09, 01, 05, 03, 0d, 1f, 15, 0d, 11, 1b, 19, 1f, 15, 0d, 11, 33, 21, 19, 1d, 2f, 25, 33, 21, 19, 1d, 47, 2d, 25, 29, 43, 31, 47, 2d, 25, 29, 5b, 39, 31, 35, 57, 3d, 5b, 39, 31, 35, 35, 39, 3d, 41, 6b, 45, 3d, 41, 3d, 45, 1e, 01, 03, 01, 03, 12, 03, 04, 0e, 00, 13, 0a, 01, 0f, 00, 16, 05, 02, 11, 00, 19, 09, 02, 12, 04, 0e, 1b, 06, 0e, 00, 13, 16, 01, 0f, 00, 16, 15, 01, 16, 02, 0e, 11, 04, 11, 00, 19, 15, 03, 09, 00, 0e, 2f, 02, 0e, 00, 13, 2a, 01, 0f, 00, 16, 1d, 01, 15, 02, 0e, 21, 04, 11, 00, 19, 1d, 03, 09, 00, 0e, 43, 02, 0e, 00, 13, 3e, 01, 0c, 00, 13, 29, 01, 0d, 00, 15, 2d, 01, 0a, 01, 0e, 57, 03, 0e, 00, 13, 52, 01, 0f, 00, 16, 39, 01, 16, 02, 0e, 35, 03, 12, 02, 0e, 5f, 04, 09, 00, 0e, 6b, 02, 0e, 00, 13, 66, 01, 0f, 00, 16, 41, 01, 16, 02, 0e, 6e, 04, 11, 00, 16, 41, 03, 09, 00, 0e, 3d, 02, 0d, 01, 02] Number of files: 1 - file 0 => global file 1 Number of expressions: 28 @@ -30,7 +30,7 @@ Number of expressions: 28 - expression 24 operands: lhs = Counter(15), rhs = Counter(16) - expression 25 operands: lhs = Expression(26, Add), rhs = Counter(17) - expression 26 operands: lhs = Counter(15), rhs = Counter(16) -- expression 27 operands: lhs = Counter(17), rhs = Counter(18) +- expression 27 operands: lhs = Counter(15), rhs = Counter(17) Number of file 0 mappings: 30 - Code(Counter(0)) at (prev + 3, 1) to (start + 3, 18) - Code(Expression(0, Add)) at (prev + 4, 14) to (start + 0, 19) @@ -72,9 +72,9 @@ Number of file 0 mappings: 30 - Code(Expression(25, Sub)) at (prev + 1, 15) to (start + 0, 22) = ((c15 + c16) - c17) - Code(Counter(16)) at (prev + 1, 22) to (start + 2, 14) -- Code(Counter(18)) at (prev + 4, 17) to (start + 0, 22) +- Code(Expression(27, Sub)) at (prev + 4, 17) to (start + 0, 22) + = (c15 - c17) - Code(Counter(16)) at (prev + 3, 9) to (start + 0, 14) -- Code(Expression(27, Add)) at (prev + 2, 13) to (start + 1, 2) - = (c17 + c18) -Highest counter ID seen: c18 +- Code(Counter(15)) at (prev + 2, 13) to (start + 1, 2) +Highest counter ID seen: c16 diff --git a/tests/coverage/coroutine.cov-map b/tests/coverage/coroutine.cov-map index 21f6787e9f2..7457a528a86 100644 --- a/tests/coverage/coroutine.cov-map +++ b/tests/coverage/coroutine.cov-map @@ -13,18 +13,14 @@ Number of file 0 mappings: 4 Highest counter ID seen: c1 Function name: coroutine::main -Raw bytes (65): 0x[01, 01, 08, 07, 0d, 05, 09, 11, 15, 11, 1f, 15, 19, 15, 19, 11, 1f, 15, 19, 09, 01, 13, 01, 02, 16, 01, 08, 0b, 00, 2e, 11, 01, 2b, 00, 2d, 03, 01, 0e, 00, 35, 11, 02, 0b, 00, 2e, 0a, 01, 22, 00, 27, 1a, 00, 2c, 00, 2e, 1f, 01, 0e, 00, 35, 1a, 02, 01, 00, 02] +Raw bytes (57): 0x[01, 01, 04, 07, 0d, 05, 09, 11, 19, 11, 15, 09, 01, 13, 01, 02, 16, 01, 08, 0b, 00, 2e, 11, 01, 2b, 00, 2d, 03, 01, 0e, 00, 35, 11, 02, 0b, 00, 2e, 0a, 01, 22, 00, 27, 15, 00, 2c, 00, 2e, 0e, 01, 0e, 00, 35, 15, 02, 01, 00, 02] Number of files: 1 - file 0 => global file 1 -Number of expressions: 8 +Number of expressions: 4 - expression 0 operands: lhs = Expression(1, Add), rhs = Counter(3) - expression 1 operands: lhs = Counter(1), rhs = Counter(2) -- expression 2 operands: lhs = Counter(4), rhs = Counter(5) -- expression 3 operands: lhs = Counter(4), rhs = Expression(7, Add) -- expression 4 operands: lhs = Counter(5), rhs = Counter(6) -- expression 5 operands: lhs = Counter(5), rhs = Counter(6) -- expression 6 operands: lhs = Counter(4), rhs = Expression(7, Add) -- expression 7 operands: lhs = Counter(5), rhs = Counter(6) +- expression 2 operands: lhs = Counter(4), rhs = Counter(6) +- expression 3 operands: lhs = Counter(4), rhs = Counter(5) Number of file 0 mappings: 9 - Code(Counter(0)) at (prev + 19, 1) to (start + 2, 22) - Code(Counter(0)) at (prev + 8, 11) to (start + 0, 46) @@ -33,14 +29,12 @@ Number of file 0 mappings: 9 = ((c1 + c2) + c3) - Code(Counter(4)) at (prev + 2, 11) to (start + 0, 46) - Code(Expression(2, Sub)) at (prev + 1, 34) to (start + 0, 39) + = (c4 - c6) +- Code(Counter(5)) at (prev + 0, 44) to (start + 0, 46) +- Code(Expression(3, Sub)) at (prev + 1, 14) to (start + 0, 53) = (c4 - c5) -- Code(Expression(6, Sub)) at (prev + 0, 44) to (start + 0, 46) - = (c4 - (c5 + c6)) -- Code(Expression(7, Add)) at (prev + 1, 14) to (start + 0, 53) - = (c5 + c6) -- Code(Expression(6, Sub)) at (prev + 2, 1) to (start + 0, 2) - = (c4 - (c5 + c6)) -Highest counter ID seen: c4 +- Code(Counter(5)) at (prev + 2, 1) to (start + 0, 2) +Highest counter ID seen: c5 Function name: coroutine::main::{closure#0} Raw bytes (14): 0x[01, 01, 00, 02, 01, 16, 08, 01, 1f, 05, 02, 10, 01, 06] diff --git a/tests/coverage/inline.cov-map b/tests/coverage/inline.cov-map index 1b5b45695dc..39ba2b2d99b 100644 --- a/tests/coverage/inline.cov-map +++ b/tests/coverage/inline.cov-map @@ -41,7 +41,7 @@ Number of file 0 mappings: 1 Highest counter ID seen: c0 Function name: inline::permutate::<char> -Raw bytes (54): 0x[01, 01, 05, 01, 05, 01, 0b, 05, 0d, 13, 0d, 05, 09, 08, 01, 0f, 01, 02, 0e, 05, 02, 0f, 02, 06, 02, 02, 0f, 00, 14, 11, 01, 0d, 00, 0e, 06, 00, 12, 00, 16, 11, 00, 17, 04, 0a, 0d, 05, 0c, 02, 06, 0f, 03, 01, 00, 02] +Raw bytes (54): 0x[01, 01, 05, 01, 05, 01, 0b, 05, 0d, 13, 0d, 01, 09, 08, 01, 0f, 01, 02, 0e, 05, 02, 0f, 02, 06, 02, 02, 0f, 00, 14, 11, 01, 0d, 00, 0e, 0d, 00, 12, 00, 16, 11, 00, 17, 04, 0a, 06, 05, 0c, 02, 06, 0e, 03, 01, 00, 02] Number of files: 1 - file 0 => global file 1 Number of expressions: 5 @@ -49,19 +49,19 @@ Number of expressions: 5 - expression 1 operands: lhs = Counter(0), rhs = Expression(2, Add) - expression 2 operands: lhs = Counter(1), rhs = Counter(3) - expression 3 operands: lhs = Expression(4, Add), rhs = Counter(3) -- expression 4 operands: lhs = Counter(1), rhs = Counter(2) +- expression 4 operands: lhs = Counter(0), rhs = Counter(2) Number of file 0 mappings: 8 - Code(Counter(0)) at (prev + 15, 1) to (start + 2, 14) - Code(Counter(1)) at (prev + 2, 15) to (start + 2, 6) - Code(Expression(0, Sub)) at (prev + 2, 15) to (start + 0, 20) = (c0 - c1) - Code(Counter(4)) at (prev + 1, 13) to (start + 0, 14) -- Code(Expression(1, Sub)) at (prev + 0, 18) to (start + 0, 22) - = (c0 - (c1 + c3)) +- Code(Counter(3)) at (prev + 0, 18) to (start + 0, 22) - Code(Counter(4)) at (prev + 0, 23) to (start + 4, 10) -- Code(Counter(3)) at (prev + 5, 12) to (start + 2, 6) -- Code(Expression(3, Add)) at (prev + 3, 1) to (start + 0, 2) - = ((c1 + c2) + c3) +- Code(Expression(1, Sub)) at (prev + 5, 12) to (start + 2, 6) + = (c0 - (c1 + c3)) +- Code(Expression(3, Sub)) at (prev + 3, 1) to (start + 0, 2) + = ((c0 + c2) - c3) Highest counter ID seen: c4 Function name: inline::permutations::<char> diff --git a/tests/coverage/loops_branches.cov-map b/tests/coverage/loops_branches.cov-map index 14707701d8a..0279a1a5157 100644 --- a/tests/coverage/loops_branches.cov-map +++ b/tests/coverage/loops_branches.cov-map @@ -1,42 +1,32 @@ Function name: <loops_branches::DebugTest as core::fmt::Debug>::fmt -Raw bytes (174): 0x[01, 01, 22, 05, 00, 2f, 7b, 67, 00, 77, 19, 01, 15, 05, 21, 2f, 05, 67, 00, 77, 19, 01, 15, 2f, 7b, 67, 00, 77, 19, 01, 15, 05, 21, 67, 7b, 77, 19, 01, 15, 05, 21, 67, 5b, 77, 19, 01, 15, 7b, 00, 05, 21, 67, 7b, 77, 19, 01, 15, 05, 21, 77, 7b, 01, 15, 05, 21, 83, 01, 05, 87, 01, 15, 01, 11, 14, 01, 09, 05, 01, 10, 05, 02, 10, 00, 15, 00, 01, 17, 00, 1b, 00, 00, 1c, 00, 1e, 02, 01, 0d, 00, 0e, 05, 01, 0d, 00, 1e, 11, 00, 1e, 00, 1f, 00, 01, 10, 01, 0a, 2a, 03, 0d, 00, 0e, 1a, 00, 12, 00, 17, 2a, 01, 10, 00, 14, 62, 01, 14, 00, 19, 00, 01, 1b, 00, 1f, 00, 00, 20, 00, 22, 4e, 01, 11, 00, 12, 62, 01, 11, 00, 22, 72, 00, 22, 00, 23, 00, 01, 14, 01, 0e, 21, 03, 09, 00, 0f, 7e, 01, 05, 00, 06] +Raw bytes (152): 0x[01, 01, 18, 05, 00, 27, 57, 53, 00, 01, 1d, 11, 19, 27, 11, 53, 00, 01, 1d, 27, 57, 53, 00, 01, 1d, 11, 19, 53, 57, 01, 1d, 11, 19, 53, 47, 01, 1d, 57, 00, 11, 19, 53, 57, 01, 1d, 11, 19, 5f, 19, 11, 15, 14, 01, 09, 05, 01, 10, 05, 02, 10, 00, 15, 00, 01, 17, 00, 1b, 00, 00, 1c, 00, 1e, 02, 01, 0d, 00, 0e, 05, 01, 0d, 00, 1e, 11, 00, 1e, 00, 1f, 00, 01, 10, 01, 0a, 22, 03, 0d, 00, 0e, 16, 00, 12, 00, 17, 22, 01, 10, 00, 14, 4e, 01, 14, 00, 19, 00, 01, 1b, 00, 1f, 00, 00, 20, 00, 22, 3e, 01, 11, 00, 12, 4e, 01, 11, 00, 22, 15, 00, 22, 00, 23, 00, 01, 14, 01, 0e, 19, 03, 09, 00, 0f, 5b, 01, 05, 00, 06] Number of files: 1 - file 0 => global file 1 -Number of expressions: 34 +Number of expressions: 24 - expression 0 operands: lhs = Counter(1), rhs = Zero -- expression 1 operands: lhs = Expression(11, Add), rhs = Expression(30, Add) -- expression 2 operands: lhs = Expression(25, Add), rhs = Zero -- expression 3 operands: lhs = Expression(29, Add), rhs = Counter(6) -- expression 4 operands: lhs = Counter(0), rhs = Counter(5) -- expression 5 operands: lhs = Counter(1), rhs = Counter(8) -- expression 6 operands: lhs = Expression(11, Add), rhs = Counter(1) -- expression 7 operands: lhs = Expression(25, Add), rhs = Zero -- expression 8 operands: lhs = Expression(29, Add), rhs = Counter(6) -- expression 9 operands: lhs = Counter(0), rhs = Counter(5) -- expression 10 operands: lhs = Expression(11, Add), rhs = Expression(30, Add) -- expression 11 operands: lhs = Expression(25, Add), rhs = Zero -- expression 12 operands: lhs = Expression(29, Add), rhs = Counter(6) -- expression 13 operands: lhs = Counter(0), rhs = Counter(5) -- expression 14 operands: lhs = Counter(1), rhs = Counter(8) -- expression 15 operands: lhs = Expression(25, Add), rhs = Expression(30, Add) -- expression 16 operands: lhs = Expression(29, Add), rhs = Counter(6) -- expression 17 operands: lhs = Counter(0), rhs = Counter(5) -- expression 18 operands: lhs = Counter(1), rhs = Counter(8) -- expression 19 operands: lhs = Expression(25, Add), rhs = Expression(22, Add) -- expression 20 operands: lhs = Expression(29, Add), rhs = Counter(6) -- expression 21 operands: lhs = Counter(0), rhs = Counter(5) -- expression 22 operands: lhs = Expression(30, Add), rhs = Zero -- expression 23 operands: lhs = Counter(1), rhs = Counter(8) -- expression 24 operands: lhs = Expression(25, Add), rhs = Expression(30, Add) -- expression 25 operands: lhs = Expression(29, Add), rhs = Counter(6) -- expression 26 operands: lhs = Counter(0), rhs = Counter(5) -- expression 27 operands: lhs = Counter(1), rhs = Counter(8) -- expression 28 operands: lhs = Expression(29, Add), rhs = Expression(30, Add) -- expression 29 operands: lhs = Counter(0), rhs = Counter(5) -- expression 30 operands: lhs = Counter(1), rhs = Counter(8) -- expression 31 operands: lhs = Expression(32, Add), rhs = Counter(1) -- expression 32 operands: lhs = Expression(33, Add), rhs = Counter(5) -- expression 33 operands: lhs = Counter(0), rhs = Counter(4) +- expression 1 operands: lhs = Expression(9, Add), rhs = Expression(21, Add) +- expression 2 operands: lhs = Expression(20, Add), rhs = Zero +- expression 3 operands: lhs = Counter(0), rhs = Counter(7) +- expression 4 operands: lhs = Counter(4), rhs = Counter(6) +- expression 5 operands: lhs = Expression(9, Add), rhs = Counter(4) +- expression 6 operands: lhs = Expression(20, Add), rhs = Zero +- expression 7 operands: lhs = Counter(0), rhs = Counter(7) +- expression 8 operands: lhs = Expression(9, Add), rhs = Expression(21, Add) +- expression 9 operands: lhs = Expression(20, Add), rhs = Zero +- expression 10 operands: lhs = Counter(0), rhs = Counter(7) +- expression 11 operands: lhs = Counter(4), rhs = Counter(6) +- expression 12 operands: lhs = Expression(20, Add), rhs = Expression(21, Add) +- expression 13 operands: lhs = Counter(0), rhs = Counter(7) +- expression 14 operands: lhs = Counter(4), rhs = Counter(6) +- expression 15 operands: lhs = Expression(20, Add), rhs = Expression(17, Add) +- expression 16 operands: lhs = Counter(0), rhs = Counter(7) +- expression 17 operands: lhs = Expression(21, Add), rhs = Zero +- expression 18 operands: lhs = Counter(4), rhs = Counter(6) +- expression 19 operands: lhs = Expression(20, Add), rhs = Expression(21, Add) +- expression 20 operands: lhs = Counter(0), rhs = Counter(7) +- expression 21 operands: lhs = Counter(4), rhs = Counter(6) +- expression 22 operands: lhs = Expression(23, Add), rhs = Counter(6) +- expression 23 operands: lhs = Counter(4), rhs = Counter(5) Number of file 0 mappings: 20 - Code(Counter(0)) at (prev + 9, 5) to (start + 1, 16) - Code(Counter(1)) at (prev + 2, 16) to (start + 0, 21) @@ -47,57 +37,57 @@ Number of file 0 mappings: 20 - Code(Counter(1)) at (prev + 1, 13) to (start + 0, 30) - Code(Counter(4)) at (prev + 0, 30) to (start + 0, 31) - Code(Zero) at (prev + 1, 16) to (start + 1, 10) -- Code(Expression(10, Sub)) at (prev + 3, 13) to (start + 0, 14) - = ((((c0 + c5) + c6) + Zero) - (c1 + c8)) -- Code(Expression(6, Sub)) at (prev + 0, 18) to (start + 0, 23) - = ((((c0 + c5) + c6) + Zero) - c1) -- Code(Expression(10, Sub)) at (prev + 1, 16) to (start + 0, 20) - = ((((c0 + c5) + c6) + Zero) - (c1 + c8)) -- Code(Expression(24, Sub)) at (prev + 1, 20) to (start + 0, 25) - = (((c0 + c5) + c6) - (c1 + c8)) +- Code(Expression(8, Sub)) at (prev + 3, 13) to (start + 0, 14) + = (((c0 + c7) + Zero) - (c4 + c6)) +- Code(Expression(5, Sub)) at (prev + 0, 18) to (start + 0, 23) + = (((c0 + c7) + Zero) - c4) +- Code(Expression(8, Sub)) at (prev + 1, 16) to (start + 0, 20) + = (((c0 + c7) + Zero) - (c4 + c6)) +- Code(Expression(19, Sub)) at (prev + 1, 20) to (start + 0, 25) + = ((c0 + c7) - (c4 + c6)) - Code(Zero) at (prev + 1, 27) to (start + 0, 31) - Code(Zero) at (prev + 0, 32) to (start + 0, 34) -- Code(Expression(19, Sub)) at (prev + 1, 17) to (start + 0, 18) - = (((c0 + c5) + c6) - ((c1 + c8) + Zero)) -- Code(Expression(24, Sub)) at (prev + 1, 17) to (start + 0, 34) - = (((c0 + c5) + c6) - (c1 + c8)) -- Code(Expression(28, Sub)) at (prev + 0, 34) to (start + 0, 35) - = ((c0 + c5) - (c1 + c8)) +- Code(Expression(15, Sub)) at (prev + 1, 17) to (start + 0, 18) + = ((c0 + c7) - ((c4 + c6) + Zero)) +- Code(Expression(19, Sub)) at (prev + 1, 17) to (start + 0, 34) + = ((c0 + c7) - (c4 + c6)) +- Code(Counter(5)) at (prev + 0, 34) to (start + 0, 35) - Code(Zero) at (prev + 1, 20) to (start + 1, 14) -- Code(Counter(8)) at (prev + 3, 9) to (start + 0, 15) -- Code(Expression(31, Sub)) at (prev + 1, 5) to (start + 0, 6) - = (((c0 + c4) + c5) - c1) -Highest counter ID seen: c8 +- Code(Counter(6)) at (prev + 3, 9) to (start + 0, 15) +- Code(Expression(22, Add)) at (prev + 1, 5) to (start + 0, 6) + = ((c4 + c5) + c6) +Highest counter ID seen: c6 Function name: <loops_branches::DisplayTest as core::fmt::Display>::fmt -Raw bytes (152): 0x[01, 01, 18, 01, 00, 01, 00, 23, 15, 27, 11, 00, 0d, 27, 11, 00, 0d, 23, 15, 27, 11, 00, 0d, 4b, 15, 4f, 11, 00, 0d, 4b, 43, 4f, 11, 00, 0d, 15, 00, 4b, 15, 4f, 11, 00, 0d, 5f, 15, 00, 11, 5f, 21, 00, 11, 14, 01, 22, 05, 01, 11, 00, 01, 12, 01, 0a, 02, 02, 10, 00, 15, 00, 01, 17, 00, 1b, 00, 00, 1c, 00, 1e, 06, 01, 0d, 00, 0e, 02, 01, 0d, 00, 1e, 21, 00, 1e, 00, 1f, 1e, 02, 0d, 00, 0e, 23, 00, 12, 00, 17, 1e, 01, 10, 00, 15, 00, 00, 16, 01, 0e, 46, 02, 14, 00, 19, 00, 01, 1b, 00, 1f, 00, 00, 20, 00, 22, 36, 01, 11, 00, 12, 46, 01, 11, 00, 22, 52, 00, 22, 00, 23, 15, 03, 09, 00, 0f, 5b, 01, 05, 00, 06] +Raw bytes (154): 0x[01, 01, 19, 01, 00, 01, 00, 2b, 63, 2f, 0d, 01, 00, 11, 15, 2b, 11, 2f, 0d, 01, 00, 2b, 63, 2f, 0d, 01, 00, 11, 15, 57, 63, 01, 0d, 11, 15, 57, 4b, 01, 0d, 63, 00, 11, 15, 57, 63, 01, 0d, 11, 15, 63, 21, 11, 15, 14, 01, 22, 05, 01, 11, 00, 01, 12, 01, 0a, 02, 02, 10, 00, 15, 00, 01, 17, 00, 1b, 00, 00, 1c, 00, 1e, 06, 01, 0d, 00, 0e, 02, 01, 0d, 00, 1e, 11, 00, 1e, 00, 1f, 26, 02, 0d, 00, 0e, 1a, 00, 12, 00, 17, 26, 01, 10, 00, 15, 00, 00, 16, 01, 0e, 52, 02, 14, 00, 19, 00, 01, 1b, 00, 1f, 00, 00, 20, 00, 22, 42, 01, 11, 00, 12, 52, 01, 11, 00, 22, 21, 00, 22, 00, 23, 15, 03, 09, 00, 0f, 5f, 01, 05, 00, 06] Number of files: 1 - file 0 => global file 1 -Number of expressions: 24 +Number of expressions: 25 - expression 0 operands: lhs = Counter(0), rhs = Zero - expression 1 operands: lhs = Counter(0), rhs = Zero -- expression 2 operands: lhs = Expression(8, Add), rhs = Counter(5) -- expression 3 operands: lhs = Expression(9, Add), rhs = Counter(4) -- expression 4 operands: lhs = Zero, rhs = Counter(3) -- expression 5 operands: lhs = Expression(9, Add), rhs = Counter(4) -- expression 6 operands: lhs = Zero, rhs = Counter(3) -- expression 7 operands: lhs = Expression(8, Add), rhs = Counter(5) -- expression 8 operands: lhs = Expression(9, Add), rhs = Counter(4) -- expression 9 operands: lhs = Zero, rhs = Counter(3) -- expression 10 operands: lhs = Expression(18, Add), rhs = Counter(5) -- expression 11 operands: lhs = Expression(19, Add), rhs = Counter(4) -- expression 12 operands: lhs = Zero, rhs = Counter(3) -- expression 13 operands: lhs = Expression(18, Add), rhs = Expression(16, Add) -- expression 14 operands: lhs = Expression(19, Add), rhs = Counter(4) -- expression 15 operands: lhs = Zero, rhs = Counter(3) -- expression 16 operands: lhs = Counter(5), rhs = Zero -- expression 17 operands: lhs = Expression(18, Add), rhs = Counter(5) -- expression 18 operands: lhs = Expression(19, Add), rhs = Counter(4) -- expression 19 operands: lhs = Zero, rhs = Counter(3) -- expression 20 operands: lhs = Expression(23, Add), rhs = Counter(5) -- expression 21 operands: lhs = Zero, rhs = Counter(4) -- expression 22 operands: lhs = Expression(23, Add), rhs = Counter(8) -- expression 23 operands: lhs = Zero, rhs = Counter(4) +- expression 2 operands: lhs = Expression(10, Add), rhs = Expression(24, Add) +- expression 3 operands: lhs = Expression(11, Add), rhs = Counter(3) +- expression 4 operands: lhs = Counter(0), rhs = Zero +- expression 5 operands: lhs = Counter(4), rhs = Counter(5) +- expression 6 operands: lhs = Expression(10, Add), rhs = Counter(4) +- expression 7 operands: lhs = Expression(11, Add), rhs = Counter(3) +- expression 8 operands: lhs = Counter(0), rhs = Zero +- expression 9 operands: lhs = Expression(10, Add), rhs = Expression(24, Add) +- expression 10 operands: lhs = Expression(11, Add), rhs = Counter(3) +- expression 11 operands: lhs = Counter(0), rhs = Zero +- expression 12 operands: lhs = Counter(4), rhs = Counter(5) +- expression 13 operands: lhs = Expression(21, Add), rhs = Expression(24, Add) +- expression 14 operands: lhs = Counter(0), rhs = Counter(3) +- expression 15 operands: lhs = Counter(4), rhs = Counter(5) +- expression 16 operands: lhs = Expression(21, Add), rhs = Expression(18, Add) +- expression 17 operands: lhs = Counter(0), rhs = Counter(3) +- expression 18 operands: lhs = Expression(24, Add), rhs = Zero +- expression 19 operands: lhs = Counter(4), rhs = Counter(5) +- expression 20 operands: lhs = Expression(21, Add), rhs = Expression(24, Add) +- expression 21 operands: lhs = Counter(0), rhs = Counter(3) +- expression 22 operands: lhs = Counter(4), rhs = Counter(5) +- expression 23 operands: lhs = Expression(24, Add), rhs = Counter(8) +- expression 24 operands: lhs = Counter(4), rhs = Counter(5) Number of file 0 mappings: 20 - Code(Counter(0)) at (prev + 34, 5) to (start + 1, 17) - Code(Zero) at (prev + 1, 18) to (start + 1, 10) @@ -109,27 +99,26 @@ Number of file 0 mappings: 20 = (c0 - Zero) - Code(Expression(0, Sub)) at (prev + 1, 13) to (start + 0, 30) = (c0 - Zero) -- Code(Counter(8)) at (prev + 0, 30) to (start + 0, 31) -- Code(Expression(7, Sub)) at (prev + 2, 13) to (start + 0, 14) - = (((Zero + c3) + c4) - c5) -- Code(Expression(8, Add)) at (prev + 0, 18) to (start + 0, 23) - = ((Zero + c3) + c4) -- Code(Expression(7, Sub)) at (prev + 1, 16) to (start + 0, 21) - = (((Zero + c3) + c4) - c5) +- Code(Counter(4)) at (prev + 0, 30) to (start + 0, 31) +- Code(Expression(9, Sub)) at (prev + 2, 13) to (start + 0, 14) + = (((c0 + Zero) + c3) - (c4 + c5)) +- Code(Expression(6, Sub)) at (prev + 0, 18) to (start + 0, 23) + = (((c0 + Zero) + c3) - c4) +- Code(Expression(9, Sub)) at (prev + 1, 16) to (start + 0, 21) + = (((c0 + Zero) + c3) - (c4 + c5)) - Code(Zero) at (prev + 0, 22) to (start + 1, 14) -- Code(Expression(17, Sub)) at (prev + 2, 20) to (start + 0, 25) - = (((Zero + c3) + c4) - c5) +- Code(Expression(20, Sub)) at (prev + 2, 20) to (start + 0, 25) + = ((c0 + c3) - (c4 + c5)) - Code(Zero) at (prev + 1, 27) to (start + 0, 31) - Code(Zero) at (prev + 0, 32) to (start + 0, 34) -- Code(Expression(13, Sub)) at (prev + 1, 17) to (start + 0, 18) - = (((Zero + c3) + c4) - (c5 + Zero)) -- Code(Expression(17, Sub)) at (prev + 1, 17) to (start + 0, 34) - = (((Zero + c3) + c4) - c5) -- Code(Expression(20, Sub)) at (prev + 0, 34) to (start + 0, 35) - = ((Zero + c4) - c5) +- Code(Expression(16, Sub)) at (prev + 1, 17) to (start + 0, 18) + = ((c0 + c3) - ((c4 + c5) + Zero)) +- Code(Expression(20, Sub)) at (prev + 1, 17) to (start + 0, 34) + = ((c0 + c3) - (c4 + c5)) +- Code(Counter(8)) at (prev + 0, 34) to (start + 0, 35) - Code(Counter(5)) at (prev + 3, 9) to (start + 0, 15) -- Code(Expression(22, Add)) at (prev + 1, 5) to (start + 0, 6) - = ((Zero + c4) + c8) +- Code(Expression(23, Add)) at (prev + 1, 5) to (start + 0, 6) + = ((c4 + c5) + c8) Highest counter ID seen: c8 Function name: loops_branches::main diff --git a/tests/coverage/mcdc/condition-limit.cov-map b/tests/coverage/mcdc/condition-limit.cov-map index 19716878600..8ff5d6360f6 100644 --- a/tests/coverage/mcdc/condition-limit.cov-map +++ b/tests/coverage/mcdc/condition-limit.cov-map @@ -1,54 +1,16 @@ Function name: condition_limit::accept_7_conditions -Raw bytes (237): 0x[01, 01, 2e, 01, 05, 05, 09, 05, 09, 05, 7b, 09, 0d, 05, 7b, 09, 0d, 05, 77, 7b, 11, 09, 0d, 05, 77, 7b, 11, 09, 0d, 05, 73, 77, 15, 7b, 11, 09, 0d, 05, 73, 77, 15, 7b, 11, 09, 0d, 05, 6f, 73, 19, 77, 15, 7b, 11, 09, 0d, 05, 6f, 73, 19, 77, 15, 7b, 11, 09, 0d, 83, 01, 05, a7, 01, 21, ab, 01, 19, af, 01, 15, b3, 01, 11, b7, 01, 0d, 01, 09, 9f, 01, 05, a3, 01, 21, a7, 01, 1d, ab, 01, 19, af, 01, 15, b3, 01, 11, b7, 01, 0d, 01, 09, 12, 01, 07, 01, 02, 09, 28, 08, 07, 02, 08, 00, 27, 30, 05, 02, 01, 07, 00, 00, 08, 00, 09, 05, 00, 0d, 00, 0e, 30, 0a, 09, 07, 06, 00, 00, 0d, 00, 0e, 0a, 00, 12, 00, 13, 30, 16, 0d, 06, 05, 00, 00, 12, 00, 13, 16, 00, 17, 00, 18, 30, 2a, 11, 05, 04, 00, 00, 17, 00, 18, 2a, 00, 1c, 00, 1d, 30, 46, 15, 04, 03, 00, 00, 1c, 00, 1d, 46, 00, 21, 00, 22, 30, 6a, 19, 03, 02, 00, 00, 21, 00, 22, 6a, 00, 26, 00, 27, 30, 1d, 21, 02, 00, 00, 00, 26, 00, 27, 1d, 00, 28, 02, 06, 7e, 02, 05, 00, 06, 9a, 01, 01, 01, 00, 02] +Raw bytes (147): 0x[01, 01, 08, 01, 05, 05, 09, 09, 0d, 0d, 11, 11, 15, 15, 19, 19, 1d, 01, 1d, 12, 01, 07, 01, 02, 09, 28, 08, 07, 02, 08, 00, 27, 30, 05, 02, 01, 07, 00, 00, 08, 00, 09, 05, 00, 0d, 00, 0e, 30, 09, 06, 07, 06, 00, 00, 0d, 00, 0e, 09, 00, 12, 00, 13, 30, 0d, 0a, 06, 05, 00, 00, 12, 00, 13, 0d, 00, 17, 00, 18, 30, 11, 0e, 05, 04, 00, 00, 17, 00, 18, 11, 00, 1c, 00, 1d, 30, 15, 12, 04, 03, 00, 00, 1c, 00, 1d, 15, 00, 21, 00, 22, 30, 19, 16, 03, 02, 00, 00, 21, 00, 22, 19, 00, 26, 00, 27, 30, 1d, 1a, 02, 00, 00, 00, 26, 00, 27, 1d, 00, 28, 02, 06, 1e, 02, 05, 00, 06, 01, 01, 01, 00, 02] Number of files: 1 - file 0 => global file 1 -Number of expressions: 46 +Number of expressions: 8 - expression 0 operands: lhs = Counter(0), rhs = Counter(1) - expression 1 operands: lhs = Counter(1), rhs = Counter(2) -- expression 2 operands: lhs = Counter(1), rhs = Counter(2) -- expression 3 operands: lhs = Counter(1), rhs = Expression(30, Add) -- expression 4 operands: lhs = Counter(2), rhs = Counter(3) -- expression 5 operands: lhs = Counter(1), rhs = Expression(30, Add) -- expression 6 operands: lhs = Counter(2), rhs = Counter(3) -- expression 7 operands: lhs = Counter(1), rhs = Expression(29, Add) -- expression 8 operands: lhs = Expression(30, Add), rhs = Counter(4) -- expression 9 operands: lhs = Counter(2), rhs = Counter(3) -- expression 10 operands: lhs = Counter(1), rhs = Expression(29, Add) -- expression 11 operands: lhs = Expression(30, Add), rhs = Counter(4) -- expression 12 operands: lhs = Counter(2), rhs = Counter(3) -- expression 13 operands: lhs = Counter(1), rhs = Expression(28, Add) -- expression 14 operands: lhs = Expression(29, Add), rhs = Counter(5) -- expression 15 operands: lhs = Expression(30, Add), rhs = Counter(4) -- expression 16 operands: lhs = Counter(2), rhs = Counter(3) -- expression 17 operands: lhs = Counter(1), rhs = Expression(28, Add) -- expression 18 operands: lhs = Expression(29, Add), rhs = Counter(5) -- expression 19 operands: lhs = Expression(30, Add), rhs = Counter(4) -- expression 20 operands: lhs = Counter(2), rhs = Counter(3) -- expression 21 operands: lhs = Counter(1), rhs = Expression(27, Add) -- expression 22 operands: lhs = Expression(28, Add), rhs = Counter(6) -- expression 23 operands: lhs = Expression(29, Add), rhs = Counter(5) -- expression 24 operands: lhs = Expression(30, Add), rhs = Counter(4) -- expression 25 operands: lhs = Counter(2), rhs = Counter(3) -- expression 26 operands: lhs = Counter(1), rhs = Expression(27, Add) -- expression 27 operands: lhs = Expression(28, Add), rhs = Counter(6) -- expression 28 operands: lhs = Expression(29, Add), rhs = Counter(5) -- expression 29 operands: lhs = Expression(30, Add), rhs = Counter(4) -- expression 30 operands: lhs = Counter(2), rhs = Counter(3) -- expression 31 operands: lhs = Expression(32, Add), rhs = Counter(1) -- expression 32 operands: lhs = Expression(41, Add), rhs = Counter(8) -- expression 33 operands: lhs = Expression(42, Add), rhs = Counter(6) -- expression 34 operands: lhs = Expression(43, Add), rhs = Counter(5) -- expression 35 operands: lhs = Expression(44, Add), rhs = Counter(4) -- expression 36 operands: lhs = Expression(45, Add), rhs = Counter(3) -- expression 37 operands: lhs = Counter(0), rhs = Counter(2) -- expression 38 operands: lhs = Expression(39, Add), rhs = Counter(1) -- expression 39 operands: lhs = Expression(40, Add), rhs = Counter(8) -- expression 40 operands: lhs = Expression(41, Add), rhs = Counter(7) -- expression 41 operands: lhs = Expression(42, Add), rhs = Counter(6) -- expression 42 operands: lhs = Expression(43, Add), rhs = Counter(5) -- expression 43 operands: lhs = Expression(44, Add), rhs = Counter(4) -- expression 44 operands: lhs = Expression(45, Add), rhs = Counter(3) -- expression 45 operands: lhs = Counter(0), rhs = Counter(2) +- expression 2 operands: lhs = Counter(2), rhs = Counter(3) +- expression 3 operands: lhs = Counter(3), rhs = Counter(4) +- expression 4 operands: lhs = Counter(4), rhs = Counter(5) +- expression 5 operands: lhs = Counter(5), rhs = Counter(6) +- expression 6 operands: lhs = Counter(6), rhs = Counter(7) +- expression 7 operands: lhs = Counter(0), rhs = Counter(7) Number of file 0 mappings: 18 - Code(Counter(0)) at (prev + 7, 1) to (start + 2, 9) - MCDCDecision { bitmap_idx: 8, conditions_num: 7 } at (prev + 2, 8) to (start + 0, 39) @@ -56,38 +18,32 @@ Number of file 0 mappings: 18 true = c1 false = (c0 - c1) - Code(Counter(1)) at (prev + 0, 13) to (start + 0, 14) -- MCDCBranch { true: Expression(2, Sub), false: Counter(2), condition_id: 7, true_next_id: 6, false_next_id: 0 } at (prev + 0, 13) to (start + 0, 14) - true = (c1 - c2) - false = c2 -- Code(Expression(2, Sub)) at (prev + 0, 18) to (start + 0, 19) - = (c1 - c2) -- MCDCBranch { true: Expression(5, Sub), false: Counter(3), condition_id: 6, true_next_id: 5, false_next_id: 0 } at (prev + 0, 18) to (start + 0, 19) - true = (c1 - (c2 + c3)) - false = c3 -- Code(Expression(5, Sub)) at (prev + 0, 23) to (start + 0, 24) - = (c1 - (c2 + c3)) -- MCDCBranch { true: Expression(10, Sub), false: Counter(4), condition_id: 5, true_next_id: 4, false_next_id: 0 } at (prev + 0, 23) to (start + 0, 24) - true = (c1 - ((c2 + c3) + c4)) - false = c4 -- Code(Expression(10, Sub)) at (prev + 0, 28) to (start + 0, 29) - = (c1 - ((c2 + c3) + c4)) -- MCDCBranch { true: Expression(17, Sub), false: Counter(5), condition_id: 4, true_next_id: 3, false_next_id: 0 } at (prev + 0, 28) to (start + 0, 29) - true = (c1 - (((c2 + c3) + c4) + c5)) - false = c5 -- Code(Expression(17, Sub)) at (prev + 0, 33) to (start + 0, 34) - = (c1 - (((c2 + c3) + c4) + c5)) -- MCDCBranch { true: Expression(26, Sub), false: Counter(6), condition_id: 3, true_next_id: 2, false_next_id: 0 } at (prev + 0, 33) to (start + 0, 34) - true = (c1 - ((((c2 + c3) + c4) + c5) + c6)) - false = c6 -- Code(Expression(26, Sub)) at (prev + 0, 38) to (start + 0, 39) - = (c1 - ((((c2 + c3) + c4) + c5) + c6)) -- MCDCBranch { true: Counter(7), false: Counter(8), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 38) to (start + 0, 39) +- MCDCBranch { true: Counter(2), false: Expression(1, Sub), condition_id: 7, true_next_id: 6, false_next_id: 0 } at (prev + 0, 13) to (start + 0, 14) + true = c2 + false = (c1 - c2) +- Code(Counter(2)) at (prev + 0, 18) to (start + 0, 19) +- MCDCBranch { true: Counter(3), false: Expression(2, Sub), condition_id: 6, true_next_id: 5, false_next_id: 0 } at (prev + 0, 18) to (start + 0, 19) + true = c3 + false = (c2 - c3) +- Code(Counter(3)) at (prev + 0, 23) to (start + 0, 24) +- MCDCBranch { true: Counter(4), false: Expression(3, Sub), condition_id: 5, true_next_id: 4, false_next_id: 0 } at (prev + 0, 23) to (start + 0, 24) + true = c4 + false = (c3 - c4) +- Code(Counter(4)) at (prev + 0, 28) to (start + 0, 29) +- MCDCBranch { true: Counter(5), false: Expression(4, Sub), condition_id: 4, true_next_id: 3, false_next_id: 0 } at (prev + 0, 28) to (start + 0, 29) + true = c5 + false = (c4 - c5) +- Code(Counter(5)) at (prev + 0, 33) to (start + 0, 34) +- MCDCBranch { true: Counter(6), false: Expression(5, Sub), condition_id: 3, true_next_id: 2, false_next_id: 0 } at (prev + 0, 33) to (start + 0, 34) + true = c6 + false = (c5 - c6) +- Code(Counter(6)) at (prev + 0, 38) to (start + 0, 39) +- MCDCBranch { true: Counter(7), false: Expression(6, Sub), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 38) to (start + 0, 39) true = c7 - false = c8 + false = (c6 - c7) - Code(Counter(7)) at (prev + 0, 40) to (start + 2, 6) -- Code(Expression(31, Sub)) at (prev + 2, 5) to (start + 0, 6) - = (((((((c0 + c2) + c3) + c4) + c5) + c6) + c8) - c1) -- Code(Expression(38, Sub)) at (prev + 1, 1) to (start + 0, 2) - = ((((((((c0 + c2) + c3) + c4) + c5) + c6) + c7) + c8) - c1) -Highest counter ID seen: c8 +- Code(Expression(7, Sub)) at (prev + 2, 5) to (start + 0, 6) + = (c0 - c7) +- Code(Counter(0)) at (prev + 1, 1) to (start + 0, 2) +Highest counter ID seen: c7 diff --git a/tests/coverage/mcdc/if.cov-map b/tests/coverage/mcdc/if.cov-map index acb8aac63de..771351f649f 100644 --- a/tests/coverage/mcdc/if.cov-map +++ b/tests/coverage/mcdc/if.cov-map @@ -1,14 +1,11 @@ Function name: if::mcdc_check_a -Raw bytes (68): 0x[01, 01, 06, 01, 05, 0b, 05, 01, 0d, 13, 05, 17, 0d, 01, 09, 08, 01, 0f, 01, 01, 09, 28, 03, 02, 01, 08, 00, 0e, 30, 05, 02, 01, 02, 00, 00, 08, 00, 09, 05, 00, 0d, 00, 0e, 30, 09, 0d, 02, 00, 00, 00, 0d, 00, 0e, 09, 00, 0f, 02, 06, 06, 02, 0c, 02, 06, 0e, 03, 01, 00, 02] +Raw bytes (62): 0x[01, 01, 03, 01, 05, 05, 09, 01, 09, 08, 01, 0f, 01, 01, 09, 28, 03, 02, 01, 08, 00, 0e, 30, 05, 02, 01, 02, 00, 00, 08, 00, 09, 05, 00, 0d, 00, 0e, 30, 09, 06, 02, 00, 00, 00, 0d, 00, 0e, 09, 00, 0f, 02, 06, 0a, 02, 0c, 02, 06, 01, 03, 01, 00, 02] Number of files: 1 - file 0 => global file 1 -Number of expressions: 6 +Number of expressions: 3 - expression 0 operands: lhs = Counter(0), rhs = Counter(1) -- expression 1 operands: lhs = Expression(2, Add), rhs = Counter(1) -- expression 2 operands: lhs = Counter(0), rhs = Counter(3) -- expression 3 operands: lhs = Expression(4, Add), rhs = Counter(1) -- expression 4 operands: lhs = Expression(5, Add), rhs = Counter(3) -- expression 5 operands: lhs = Counter(0), rhs = Counter(2) +- expression 1 operands: lhs = Counter(1), rhs = Counter(2) +- expression 2 operands: lhs = Counter(0), rhs = Counter(2) Number of file 0 mappings: 8 - Code(Counter(0)) at (prev + 15, 1) to (start + 1, 9) - MCDCDecision { bitmap_idx: 3, conditions_num: 2 } at (prev + 1, 8) to (start + 0, 14) @@ -16,27 +13,23 @@ Number of file 0 mappings: 8 true = c1 false = (c0 - c1) - Code(Counter(1)) at (prev + 0, 13) to (start + 0, 14) -- MCDCBranch { true: Counter(2), false: Counter(3), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 13) to (start + 0, 14) +- MCDCBranch { true: Counter(2), false: Expression(1, Sub), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 13) to (start + 0, 14) true = c2 - false = c3 + false = (c1 - c2) - Code(Counter(2)) at (prev + 0, 15) to (start + 2, 6) -- Code(Expression(1, Sub)) at (prev + 2, 12) to (start + 2, 6) - = ((c0 + c3) - c1) -- Code(Expression(3, Sub)) at (prev + 3, 1) to (start + 0, 2) - = (((c0 + c2) + c3) - c1) -Highest counter ID seen: c3 +- Code(Expression(2, Sub)) at (prev + 2, 12) to (start + 2, 6) + = (c0 - c2) +- Code(Counter(0)) at (prev + 3, 1) to (start + 0, 2) +Highest counter ID seen: c2 Function name: if::mcdc_check_b -Raw bytes (68): 0x[01, 01, 06, 01, 05, 0b, 05, 01, 0d, 13, 05, 17, 0d, 01, 09, 08, 01, 17, 01, 01, 09, 28, 03, 02, 01, 08, 00, 0e, 30, 05, 02, 01, 02, 00, 00, 08, 00, 09, 05, 00, 0d, 00, 0e, 30, 09, 0d, 02, 00, 00, 00, 0d, 00, 0e, 09, 00, 0f, 02, 06, 06, 02, 0c, 02, 06, 0e, 03, 01, 00, 02] +Raw bytes (62): 0x[01, 01, 03, 01, 05, 05, 09, 01, 09, 08, 01, 17, 01, 01, 09, 28, 03, 02, 01, 08, 00, 0e, 30, 05, 02, 01, 02, 00, 00, 08, 00, 09, 05, 00, 0d, 00, 0e, 30, 09, 06, 02, 00, 00, 00, 0d, 00, 0e, 09, 00, 0f, 02, 06, 0a, 02, 0c, 02, 06, 01, 03, 01, 00, 02] Number of files: 1 - file 0 => global file 1 -Number of expressions: 6 +Number of expressions: 3 - expression 0 operands: lhs = Counter(0), rhs = Counter(1) -- expression 1 operands: lhs = Expression(2, Add), rhs = Counter(1) -- expression 2 operands: lhs = Counter(0), rhs = Counter(3) -- expression 3 operands: lhs = Expression(4, Add), rhs = Counter(1) -- expression 4 operands: lhs = Expression(5, Add), rhs = Counter(3) -- expression 5 operands: lhs = Counter(0), rhs = Counter(2) +- expression 1 operands: lhs = Counter(1), rhs = Counter(2) +- expression 2 operands: lhs = Counter(0), rhs = Counter(2) Number of file 0 mappings: 8 - Code(Counter(0)) at (prev + 23, 1) to (start + 1, 9) - MCDCDecision { bitmap_idx: 3, conditions_num: 2 } at (prev + 1, 8) to (start + 0, 14) @@ -44,27 +37,23 @@ Number of file 0 mappings: 8 true = c1 false = (c0 - c1) - Code(Counter(1)) at (prev + 0, 13) to (start + 0, 14) -- MCDCBranch { true: Counter(2), false: Counter(3), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 13) to (start + 0, 14) +- MCDCBranch { true: Counter(2), false: Expression(1, Sub), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 13) to (start + 0, 14) true = c2 - false = c3 + false = (c1 - c2) - Code(Counter(2)) at (prev + 0, 15) to (start + 2, 6) -- Code(Expression(1, Sub)) at (prev + 2, 12) to (start + 2, 6) - = ((c0 + c3) - c1) -- Code(Expression(3, Sub)) at (prev + 3, 1) to (start + 0, 2) - = (((c0 + c2) + c3) - c1) -Highest counter ID seen: c3 +- Code(Expression(2, Sub)) at (prev + 2, 12) to (start + 2, 6) + = (c0 - c2) +- Code(Counter(0)) at (prev + 3, 1) to (start + 0, 2) +Highest counter ID seen: c2 Function name: if::mcdc_check_both -Raw bytes (68): 0x[01, 01, 06, 01, 05, 0b, 05, 01, 0d, 13, 05, 17, 0d, 01, 09, 08, 01, 1f, 01, 01, 09, 28, 03, 02, 01, 08, 00, 0e, 30, 05, 02, 01, 02, 00, 00, 08, 00, 09, 05, 00, 0d, 00, 0e, 30, 09, 0d, 02, 00, 00, 00, 0d, 00, 0e, 09, 00, 0f, 02, 06, 06, 02, 0c, 02, 06, 0e, 03, 01, 00, 02] +Raw bytes (62): 0x[01, 01, 03, 01, 05, 05, 09, 01, 09, 08, 01, 1f, 01, 01, 09, 28, 03, 02, 01, 08, 00, 0e, 30, 05, 02, 01, 02, 00, 00, 08, 00, 09, 05, 00, 0d, 00, 0e, 30, 09, 06, 02, 00, 00, 00, 0d, 00, 0e, 09, 00, 0f, 02, 06, 0a, 02, 0c, 02, 06, 01, 03, 01, 00, 02] Number of files: 1 - file 0 => global file 1 -Number of expressions: 6 +Number of expressions: 3 - expression 0 operands: lhs = Counter(0), rhs = Counter(1) -- expression 1 operands: lhs = Expression(2, Add), rhs = Counter(1) -- expression 2 operands: lhs = Counter(0), rhs = Counter(3) -- expression 3 operands: lhs = Expression(4, Add), rhs = Counter(1) -- expression 4 operands: lhs = Expression(5, Add), rhs = Counter(3) -- expression 5 operands: lhs = Counter(0), rhs = Counter(2) +- expression 1 operands: lhs = Counter(1), rhs = Counter(2) +- expression 2 operands: lhs = Counter(0), rhs = Counter(2) Number of file 0 mappings: 8 - Code(Counter(0)) at (prev + 31, 1) to (start + 1, 9) - MCDCDecision { bitmap_idx: 3, conditions_num: 2 } at (prev + 1, 8) to (start + 0, 14) @@ -72,27 +61,23 @@ Number of file 0 mappings: 8 true = c1 false = (c0 - c1) - Code(Counter(1)) at (prev + 0, 13) to (start + 0, 14) -- MCDCBranch { true: Counter(2), false: Counter(3), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 13) to (start + 0, 14) +- MCDCBranch { true: Counter(2), false: Expression(1, Sub), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 13) to (start + 0, 14) true = c2 - false = c3 + false = (c1 - c2) - Code(Counter(2)) at (prev + 0, 15) to (start + 2, 6) -- Code(Expression(1, Sub)) at (prev + 2, 12) to (start + 2, 6) - = ((c0 + c3) - c1) -- Code(Expression(3, Sub)) at (prev + 3, 1) to (start + 0, 2) - = (((c0 + c2) + c3) - c1) -Highest counter ID seen: c3 +- Code(Expression(2, Sub)) at (prev + 2, 12) to (start + 2, 6) + = (c0 - c2) +- Code(Counter(0)) at (prev + 3, 1) to (start + 0, 2) +Highest counter ID seen: c2 Function name: if::mcdc_check_neither -Raw bytes (68): 0x[01, 01, 06, 01, 05, 0b, 05, 01, 0d, 13, 05, 17, 0d, 01, 09, 08, 01, 07, 01, 01, 09, 28, 03, 02, 01, 08, 00, 0e, 30, 05, 02, 01, 02, 00, 00, 08, 00, 09, 05, 00, 0d, 00, 0e, 30, 09, 0d, 02, 00, 00, 00, 0d, 00, 0e, 09, 00, 0f, 02, 06, 06, 02, 0c, 02, 06, 0e, 03, 01, 00, 02] +Raw bytes (62): 0x[01, 01, 03, 01, 05, 05, 09, 01, 09, 08, 01, 07, 01, 01, 09, 28, 03, 02, 01, 08, 00, 0e, 30, 05, 02, 01, 02, 00, 00, 08, 00, 09, 05, 00, 0d, 00, 0e, 30, 09, 06, 02, 00, 00, 00, 0d, 00, 0e, 09, 00, 0f, 02, 06, 0a, 02, 0c, 02, 06, 01, 03, 01, 00, 02] Number of files: 1 - file 0 => global file 1 -Number of expressions: 6 +Number of expressions: 3 - expression 0 operands: lhs = Counter(0), rhs = Counter(1) -- expression 1 operands: lhs = Expression(2, Add), rhs = Counter(1) -- expression 2 operands: lhs = Counter(0), rhs = Counter(3) -- expression 3 operands: lhs = Expression(4, Add), rhs = Counter(1) -- expression 4 operands: lhs = Expression(5, Add), rhs = Counter(3) -- expression 5 operands: lhs = Counter(0), rhs = Counter(2) +- expression 1 operands: lhs = Counter(1), rhs = Counter(2) +- expression 2 operands: lhs = Counter(0), rhs = Counter(2) Number of file 0 mappings: 8 - Code(Counter(0)) at (prev + 7, 1) to (start + 1, 9) - MCDCDecision { bitmap_idx: 3, conditions_num: 2 } at (prev + 1, 8) to (start + 0, 14) @@ -100,32 +85,27 @@ Number of file 0 mappings: 8 true = c1 false = (c0 - c1) - Code(Counter(1)) at (prev + 0, 13) to (start + 0, 14) -- MCDCBranch { true: Counter(2), false: Counter(3), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 13) to (start + 0, 14) +- MCDCBranch { true: Counter(2), false: Expression(1, Sub), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 13) to (start + 0, 14) true = c2 - false = c3 + false = (c1 - c2) - Code(Counter(2)) at (prev + 0, 15) to (start + 2, 6) -- Code(Expression(1, Sub)) at (prev + 2, 12) to (start + 2, 6) - = ((c0 + c3) - c1) -- Code(Expression(3, Sub)) at (prev + 3, 1) to (start + 0, 2) - = (((c0 + c2) + c3) - c1) -Highest counter ID seen: c3 +- Code(Expression(2, Sub)) at (prev + 2, 12) to (start + 2, 6) + = (c0 - c2) +- Code(Counter(0)) at (prev + 3, 1) to (start + 0, 2) +Highest counter ID seen: c2 Function name: if::mcdc_check_not_tree_decision -Raw bytes (93): 0x[01, 01, 0b, 01, 05, 01, 2b, 05, 09, 05, 09, 17, 2b, 01, 11, 05, 09, 23, 2b, 27, 11, 01, 0d, 05, 09, 0a, 01, 31, 01, 03, 0a, 28, 05, 03, 03, 08, 00, 15, 30, 05, 02, 01, 02, 03, 00, 09, 00, 0a, 02, 00, 0e, 00, 0f, 30, 09, 06, 03, 02, 00, 00, 0e, 00, 0f, 2b, 00, 14, 00, 15, 30, 0d, 11, 02, 00, 00, 00, 14, 00, 15, 0d, 00, 16, 02, 06, 12, 02, 0c, 02, 06, 1e, 03, 01, 00, 02] +Raw bytes (85): 0x[01, 01, 07, 01, 05, 01, 17, 05, 09, 05, 09, 17, 0d, 05, 09, 01, 0d, 0a, 01, 31, 01, 03, 0a, 28, 05, 03, 03, 08, 00, 15, 30, 05, 02, 01, 02, 03, 00, 09, 00, 0a, 02, 00, 0e, 00, 0f, 30, 09, 06, 03, 02, 00, 00, 0e, 00, 0f, 17, 00, 14, 00, 15, 30, 0d, 12, 02, 00, 00, 00, 14, 00, 15, 0d, 00, 16, 02, 06, 1a, 02, 0c, 02, 06, 01, 03, 01, 00, 02] Number of files: 1 - file 0 => global file 1 -Number of expressions: 11 +Number of expressions: 7 - expression 0 operands: lhs = Counter(0), rhs = Counter(1) -- expression 1 operands: lhs = Counter(0), rhs = Expression(10, Add) +- expression 1 operands: lhs = Counter(0), rhs = Expression(5, Add) - expression 2 operands: lhs = Counter(1), rhs = Counter(2) - expression 3 operands: lhs = Counter(1), rhs = Counter(2) -- expression 4 operands: lhs = Expression(5, Add), rhs = Expression(10, Add) -- expression 5 operands: lhs = Counter(0), rhs = Counter(4) -- expression 6 operands: lhs = Counter(1), rhs = Counter(2) -- expression 7 operands: lhs = Expression(8, Add), rhs = Expression(10, Add) -- expression 8 operands: lhs = Expression(9, Add), rhs = Counter(4) -- expression 9 operands: lhs = Counter(0), rhs = Counter(3) -- expression 10 operands: lhs = Counter(1), rhs = Counter(2) +- expression 4 operands: lhs = Expression(5, Add), rhs = Counter(3) +- expression 5 operands: lhs = Counter(1), rhs = Counter(2) +- expression 6 operands: lhs = Counter(0), rhs = Counter(3) Number of file 0 mappings: 10 - Code(Counter(0)) at (prev + 49, 1) to (start + 3, 10) - MCDCDecision { bitmap_idx: 5, conditions_num: 3 } at (prev + 3, 8) to (start + 0, 21) @@ -137,33 +117,30 @@ Number of file 0 mappings: 10 - MCDCBranch { true: Counter(2), false: Expression(1, Sub), condition_id: 3, true_next_id: 2, false_next_id: 0 } at (prev + 0, 14) to (start + 0, 15) true = c2 false = (c0 - (c1 + c2)) -- Code(Expression(10, Add)) at (prev + 0, 20) to (start + 0, 21) +- Code(Expression(5, Add)) at (prev + 0, 20) to (start + 0, 21) = (c1 + c2) -- MCDCBranch { true: Counter(3), false: Counter(4), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 20) to (start + 0, 21) +- MCDCBranch { true: Counter(3), false: Expression(4, Sub), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 20) to (start + 0, 21) true = c3 - false = c4 + false = ((c1 + c2) - c3) - Code(Counter(3)) at (prev + 0, 22) to (start + 2, 6) -- Code(Expression(4, Sub)) at (prev + 2, 12) to (start + 2, 6) - = ((c0 + c4) - (c1 + c2)) -- Code(Expression(7, Sub)) at (prev + 3, 1) to (start + 0, 2) - = (((c0 + c3) + c4) - (c1 + c2)) -Highest counter ID seen: c4 +- Code(Expression(6, Sub)) at (prev + 2, 12) to (start + 2, 6) + = (c0 - c3) +- Code(Counter(0)) at (prev + 3, 1) to (start + 0, 2) +Highest counter ID seen: c3 Function name: if::mcdc_check_tree_decision -Raw bytes (91): 0x[01, 01, 0a, 01, 05, 05, 09, 05, 09, 09, 0d, 17, 05, 01, 11, 1f, 05, 23, 11, 27, 0d, 01, 09, 0a, 01, 27, 01, 03, 09, 28, 04, 03, 03, 08, 00, 15, 30, 05, 02, 01, 02, 00, 00, 08, 00, 09, 05, 00, 0e, 00, 0f, 30, 09, 0a, 02, 00, 03, 00, 0e, 00, 0f, 0a, 00, 13, 00, 14, 30, 0d, 11, 03, 00, 00, 00, 13, 00, 14, 0f, 00, 16, 02, 06, 12, 02, 0c, 02, 06, 1a, 03, 01, 00, 02] +Raw bytes (87): 0x[01, 01, 08, 01, 05, 05, 09, 05, 09, 05, 1f, 09, 0d, 09, 0d, 01, 1f, 09, 0d, 0a, 01, 27, 01, 03, 09, 28, 04, 03, 03, 08, 00, 15, 30, 05, 02, 01, 02, 00, 00, 08, 00, 09, 05, 00, 0e, 00, 0f, 30, 09, 0a, 02, 00, 03, 00, 0e, 00, 0f, 0a, 00, 13, 00, 14, 30, 0d, 0e, 03, 00, 00, 00, 13, 00, 14, 1f, 00, 16, 02, 06, 1a, 02, 0c, 02, 06, 01, 03, 01, 00, 02] Number of files: 1 - file 0 => global file 1 -Number of expressions: 10 +Number of expressions: 8 - expression 0 operands: lhs = Counter(0), rhs = Counter(1) - expression 1 operands: lhs = Counter(1), rhs = Counter(2) - expression 2 operands: lhs = Counter(1), rhs = Counter(2) -- expression 3 operands: lhs = Counter(2), rhs = Counter(3) -- expression 4 operands: lhs = Expression(5, Add), rhs = Counter(1) -- expression 5 operands: lhs = Counter(0), rhs = Counter(4) -- expression 6 operands: lhs = Expression(7, Add), rhs = Counter(1) -- expression 7 operands: lhs = Expression(8, Add), rhs = Counter(4) -- expression 8 operands: lhs = Expression(9, Add), rhs = Counter(3) -- expression 9 operands: lhs = Counter(0), rhs = Counter(2) +- expression 3 operands: lhs = Counter(1), rhs = Expression(7, Add) +- expression 4 operands: lhs = Counter(2), rhs = Counter(3) +- expression 5 operands: lhs = Counter(2), rhs = Counter(3) +- expression 6 operands: lhs = Counter(0), rhs = Expression(7, Add) +- expression 7 operands: lhs = Counter(2), rhs = Counter(3) Number of file 0 mappings: 10 - Code(Counter(0)) at (prev + 39, 1) to (start + 3, 9) - MCDCDecision { bitmap_idx: 4, conditions_num: 3 } at (prev + 3, 8) to (start + 0, 21) @@ -176,38 +153,32 @@ Number of file 0 mappings: 10 false = (c1 - c2) - Code(Expression(2, Sub)) at (prev + 0, 19) to (start + 0, 20) = (c1 - c2) -- MCDCBranch { true: Counter(3), false: Counter(4), condition_id: 3, true_next_id: 0, false_next_id: 0 } at (prev + 0, 19) to (start + 0, 20) +- MCDCBranch { true: Counter(3), false: Expression(3, Sub), condition_id: 3, true_next_id: 0, false_next_id: 0 } at (prev + 0, 19) to (start + 0, 20) true = c3 - false = c4 -- Code(Expression(3, Add)) at (prev + 0, 22) to (start + 2, 6) + false = (c1 - (c2 + c3)) +- Code(Expression(7, Add)) at (prev + 0, 22) to (start + 2, 6) = (c2 + c3) -- Code(Expression(4, Sub)) at (prev + 2, 12) to (start + 2, 6) - = ((c0 + c4) - c1) -- Code(Expression(6, Sub)) at (prev + 3, 1) to (start + 0, 2) - = ((((c0 + c2) + c3) + c4) - c1) -Highest counter ID seen: c4 +- Code(Expression(6, Sub)) at (prev + 2, 12) to (start + 2, 6) + = (c0 - (c2 + c3)) +- Code(Counter(0)) at (prev + 3, 1) to (start + 0, 2) +Highest counter ID seen: c3 Function name: if::mcdc_nested_if -Raw bytes (130): 0x[01, 01, 10, 01, 05, 01, 3f, 05, 09, 05, 09, 3f, 0d, 05, 09, 3f, 0d, 05, 09, 0d, 15, 01, 3f, 05, 09, 33, 3f, 37, 15, 3b, 11, 01, 0d, 05, 09, 0e, 01, 3b, 01, 01, 09, 28, 03, 02, 01, 08, 00, 0e, 30, 05, 02, 01, 00, 02, 00, 08, 00, 09, 02, 00, 0d, 00, 0e, 30, 09, 26, 02, 00, 00, 00, 0d, 00, 0e, 3f, 01, 09, 01, 0d, 28, 06, 02, 01, 0c, 00, 12, 30, 1a, 0d, 01, 02, 00, 00, 0c, 00, 0d, 1a, 00, 11, 00, 12, 30, 11, 15, 02, 00, 00, 00, 11, 00, 12, 11, 00, 13, 02, 0a, 23, 02, 09, 00, 0a, 26, 01, 0c, 02, 06, 2e, 03, 01, 00, 02] +Raw bytes (120): 0x[01, 01, 0b, 01, 05, 01, 2b, 05, 09, 05, 09, 2b, 0d, 05, 09, 0d, 11, 2b, 11, 05, 09, 01, 2b, 05, 09, 0e, 01, 3b, 01, 01, 09, 28, 03, 02, 01, 08, 00, 0e, 30, 05, 02, 01, 00, 02, 00, 08, 00, 09, 02, 00, 0d, 00, 0e, 30, 09, 26, 02, 00, 00, 00, 0d, 00, 0e, 2b, 01, 09, 01, 0d, 28, 06, 02, 01, 0c, 00, 12, 30, 0d, 12, 01, 02, 00, 00, 0c, 00, 0d, 0d, 00, 11, 00, 12, 30, 11, 1a, 02, 00, 00, 00, 11, 00, 12, 11, 00, 13, 02, 0a, 1e, 02, 09, 00, 0a, 26, 01, 0c, 02, 06, 01, 03, 01, 00, 02] Number of files: 1 - file 0 => global file 1 -Number of expressions: 16 +Number of expressions: 11 - expression 0 operands: lhs = Counter(0), rhs = Counter(1) -- expression 1 operands: lhs = Counter(0), rhs = Expression(15, Add) +- expression 1 operands: lhs = Counter(0), rhs = Expression(10, Add) - expression 2 operands: lhs = Counter(1), rhs = Counter(2) - expression 3 operands: lhs = Counter(1), rhs = Counter(2) -- expression 4 operands: lhs = Expression(15, Add), rhs = Counter(3) +- expression 4 operands: lhs = Expression(10, Add), rhs = Counter(3) - expression 5 operands: lhs = Counter(1), rhs = Counter(2) -- expression 6 operands: lhs = Expression(15, Add), rhs = Counter(3) -- expression 7 operands: lhs = Counter(1), rhs = Counter(2) -- expression 8 operands: lhs = Counter(3), rhs = Counter(5) -- expression 9 operands: lhs = Counter(0), rhs = Expression(15, Add) +- expression 6 operands: lhs = Counter(3), rhs = Counter(4) +- expression 7 operands: lhs = Expression(10, Add), rhs = Counter(4) +- expression 8 operands: lhs = Counter(1), rhs = Counter(2) +- expression 9 operands: lhs = Counter(0), rhs = Expression(10, Add) - expression 10 operands: lhs = Counter(1), rhs = Counter(2) -- expression 11 operands: lhs = Expression(12, Add), rhs = Expression(15, Add) -- expression 12 operands: lhs = Expression(13, Add), rhs = Counter(5) -- expression 13 operands: lhs = Expression(14, Add), rhs = Counter(4) -- expression 14 operands: lhs = Counter(0), rhs = Counter(3) -- expression 15 operands: lhs = Counter(1), rhs = Counter(2) Number of file 0 mappings: 14 - Code(Counter(0)) at (prev + 59, 1) to (start + 1, 9) - MCDCDecision { bitmap_idx: 3, conditions_num: 2 } at (prev + 1, 8) to (start + 0, 14) @@ -219,23 +190,21 @@ Number of file 0 mappings: 14 - MCDCBranch { true: Counter(2), false: Expression(9, Sub), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 13) to (start + 0, 14) true = c2 false = (c0 - (c1 + c2)) -- Code(Expression(15, Add)) at (prev + 1, 9) to (start + 1, 13) +- Code(Expression(10, Add)) at (prev + 1, 9) to (start + 1, 13) = (c1 + c2) - MCDCDecision { bitmap_idx: 6, conditions_num: 2 } at (prev + 1, 12) to (start + 0, 18) -- MCDCBranch { true: Expression(6, Sub), false: Counter(3), condition_id: 1, true_next_id: 2, false_next_id: 0 } at (prev + 0, 12) to (start + 0, 13) - true = ((c1 + c2) - c3) - false = c3 -- Code(Expression(6, Sub)) at (prev + 0, 17) to (start + 0, 18) - = ((c1 + c2) - c3) -- MCDCBranch { true: Counter(4), false: Counter(5), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 17) to (start + 0, 18) +- MCDCBranch { true: Counter(3), false: Expression(4, Sub), condition_id: 1, true_next_id: 2, false_next_id: 0 } at (prev + 0, 12) to (start + 0, 13) + true = c3 + false = ((c1 + c2) - c3) +- Code(Counter(3)) at (prev + 0, 17) to (start + 0, 18) +- MCDCBranch { true: Counter(4), false: Expression(6, Sub), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 17) to (start + 0, 18) true = c4 - false = c5 + false = (c3 - c4) - Code(Counter(4)) at (prev + 0, 19) to (start + 2, 10) -- Code(Expression(8, Add)) at (prev + 2, 9) to (start + 0, 10) - = (c3 + c5) +- Code(Expression(7, Sub)) at (prev + 2, 9) to (start + 0, 10) + = ((c1 + c2) - c4) - Code(Expression(9, Sub)) at (prev + 1, 12) to (start + 2, 6) = (c0 - (c1 + c2)) -- Code(Expression(11, Sub)) at (prev + 3, 1) to (start + 0, 2) - = ((((c0 + c3) + c4) + c5) - (c1 + c2)) -Highest counter ID seen: c5 +- Code(Counter(0)) at (prev + 3, 1) to (start + 0, 2) +Highest counter ID seen: c4 diff --git a/tests/coverage/mcdc/inlined_expressions.cov-map b/tests/coverage/mcdc/inlined_expressions.cov-map index 92ec60dc23c..6a112b66e88 100644 --- a/tests/coverage/mcdc/inlined_expressions.cov-map +++ b/tests/coverage/mcdc/inlined_expressions.cov-map @@ -1,12 +1,10 @@ Function name: inlined_expressions::inlined_instance -Raw bytes (54): 0x[01, 01, 04, 01, 05, 0b, 05, 0f, 0d, 01, 09, 06, 01, 08, 01, 01, 06, 28, 03, 02, 01, 05, 00, 0b, 30, 05, 02, 01, 02, 00, 00, 05, 00, 06, 05, 00, 0a, 00, 0b, 30, 09, 0d, 02, 00, 00, 00, 0a, 00, 0b, 06, 01, 01, 00, 02] +Raw bytes (50): 0x[01, 01, 02, 01, 05, 05, 09, 06, 01, 08, 01, 01, 06, 28, 03, 02, 01, 05, 00, 0b, 30, 05, 02, 01, 02, 00, 00, 05, 00, 06, 05, 00, 0a, 00, 0b, 30, 09, 06, 02, 00, 00, 00, 0a, 00, 0b, 01, 01, 01, 00, 02] Number of files: 1 - file 0 => global file 1 -Number of expressions: 4 +Number of expressions: 2 - expression 0 operands: lhs = Counter(0), rhs = Counter(1) -- expression 1 operands: lhs = Expression(2, Add), rhs = Counter(1) -- expression 2 operands: lhs = Expression(3, Add), rhs = Counter(3) -- expression 3 operands: lhs = Counter(0), rhs = Counter(2) +- expression 1 operands: lhs = Counter(1), rhs = Counter(2) Number of file 0 mappings: 6 - Code(Counter(0)) at (prev + 8, 1) to (start + 1, 6) - MCDCDecision { bitmap_idx: 3, conditions_num: 2 } at (prev + 1, 5) to (start + 0, 11) @@ -14,10 +12,9 @@ Number of file 0 mappings: 6 true = c1 false = (c0 - c1) - Code(Counter(1)) at (prev + 0, 10) to (start + 0, 11) -- MCDCBranch { true: Counter(2), false: Counter(3), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 10) to (start + 0, 11) +- MCDCBranch { true: Counter(2), false: Expression(1, Sub), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 10) to (start + 0, 11) true = c2 - false = c3 -- Code(Expression(1, Sub)) at (prev + 1, 1) to (start + 0, 2) - = (((c0 + c2) + c3) - c1) -Highest counter ID seen: c3 + false = (c1 - c2) +- Code(Counter(0)) at (prev + 1, 1) to (start + 0, 2) +Highest counter ID seen: c2 diff --git a/tests/coverage/mcdc/nested_if.cov-map b/tests/coverage/mcdc/nested_if.cov-map index 72daecabc77..72c7d68840d 100644 --- a/tests/coverage/mcdc/nested_if.cov-map +++ b/tests/coverage/mcdc/nested_if.cov-map @@ -1,24 +1,22 @@ Function name: nested_if::doubly_nested_if_in_condition -Raw bytes (172): 0x[01, 01, 10, 01, 05, 05, 09, 05, 09, 05, 27, 09, 19, 19, 1d, 19, 1d, 23, 27, 05, 1d, 09, 19, 09, 0d, 33, 05, 01, 15, 3b, 05, 3f, 15, 01, 11, 14, 01, 0f, 01, 01, 09, 28, 09, 02, 01, 08, 00, 4e, 30, 05, 02, 01, 02, 00, 00, 08, 00, 09, 30, 11, 15, 02, 00, 00, 00, 0d, 00, 4e, 05, 00, 10, 00, 11, 28, 06, 02, 00, 10, 00, 36, 30, 09, 0a, 01, 00, 02, 00, 10, 00, 11, 30, 0d, 21, 02, 00, 00, 00, 15, 00, 36, 0a, 00, 18, 00, 19, 28, 03, 02, 00, 18, 00, 1e, 30, 19, 0e, 01, 02, 00, 00, 18, 00, 19, 19, 00, 1d, 00, 1e, 30, 1a, 1d, 02, 00, 00, 00, 1d, 00, 1e, 1a, 00, 21, 00, 25, 1e, 00, 2f, 00, 34, 2b, 00, 39, 00, 3e, 21, 00, 48, 00, 4c, 11, 00, 4f, 02, 06, 2e, 02, 0c, 02, 06, 36, 03, 01, 00, 02] +Raw bytes (168): 0x[01, 01, 0e, 01, 05, 05, 09, 05, 09, 05, 13, 09, 19, 19, 1d, 05, 1f, 09, 1d, 09, 0d, 2b, 05, 01, 15, 33, 05, 37, 15, 01, 11, 14, 01, 0f, 01, 01, 09, 28, 09, 02, 01, 08, 00, 4e, 30, 05, 02, 01, 02, 00, 00, 08, 00, 09, 30, 11, 15, 02, 00, 00, 00, 0d, 00, 4e, 05, 00, 10, 00, 11, 28, 06, 02, 00, 10, 00, 36, 30, 09, 0a, 01, 00, 02, 00, 10, 00, 11, 30, 0d, 21, 02, 00, 00, 00, 15, 00, 36, 0a, 00, 18, 00, 19, 28, 03, 02, 00, 18, 00, 1e, 30, 19, 0e, 01, 02, 00, 00, 18, 00, 19, 19, 00, 1d, 00, 1e, 30, 1d, 16, 02, 00, 00, 00, 1d, 00, 1e, 1d, 00, 21, 00, 25, 1a, 00, 2f, 00, 34, 23, 00, 39, 00, 3e, 21, 00, 48, 00, 4c, 11, 00, 4f, 02, 06, 26, 02, 0c, 02, 06, 2e, 03, 01, 00, 02] Number of files: 1 - file 0 => global file 1 -Number of expressions: 16 +Number of expressions: 14 - expression 0 operands: lhs = Counter(0), rhs = Counter(1) - expression 1 operands: lhs = Counter(1), rhs = Counter(2) - expression 2 operands: lhs = Counter(1), rhs = Counter(2) -- expression 3 operands: lhs = Counter(1), rhs = Expression(9, Add) +- expression 3 operands: lhs = Counter(1), rhs = Expression(4, Add) - expression 4 operands: lhs = Counter(2), rhs = Counter(6) - expression 5 operands: lhs = Counter(6), rhs = Counter(7) -- expression 6 operands: lhs = Counter(6), rhs = Counter(7) -- expression 7 operands: lhs = Expression(8, Add), rhs = Expression(9, Add) -- expression 8 operands: lhs = Counter(1), rhs = Counter(7) -- expression 9 operands: lhs = Counter(2), rhs = Counter(6) -- expression 10 operands: lhs = Counter(2), rhs = Counter(3) +- expression 6 operands: lhs = Counter(1), rhs = Expression(7, Add) +- expression 7 operands: lhs = Counter(2), rhs = Counter(7) +- expression 8 operands: lhs = Counter(2), rhs = Counter(3) +- expression 9 operands: lhs = Expression(10, Add), rhs = Counter(1) +- expression 10 operands: lhs = Counter(0), rhs = Counter(5) - expression 11 operands: lhs = Expression(12, Add), rhs = Counter(1) -- expression 12 operands: lhs = Counter(0), rhs = Counter(5) -- expression 13 operands: lhs = Expression(14, Add), rhs = Counter(1) -- expression 14 operands: lhs = Expression(15, Add), rhs = Counter(5) -- expression 15 operands: lhs = Counter(0), rhs = Counter(4) +- expression 12 operands: lhs = Expression(13, Add), rhs = Counter(5) +- expression 13 operands: lhs = Counter(0), rhs = Counter(4) Number of file 0 mappings: 20 - Code(Counter(0)) at (prev + 15, 1) to (start + 1, 9) - MCDCDecision { bitmap_idx: 9, conditions_num: 2 } at (prev + 1, 8) to (start + 0, 78) @@ -43,20 +41,19 @@ Number of file 0 mappings: 20 true = c6 false = (c1 - (c2 + c6)) - Code(Counter(6)) at (prev + 0, 29) to (start + 0, 30) -- MCDCBranch { true: Expression(6, Sub), false: Counter(7), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 29) to (start + 0, 30) - true = (c6 - c7) - false = c7 -- Code(Expression(6, Sub)) at (prev + 0, 33) to (start + 0, 37) - = (c6 - c7) -- Code(Expression(7, Sub)) at (prev + 0, 47) to (start + 0, 52) - = ((c1 + c7) - (c2 + c6)) -- Code(Expression(10, Add)) at (prev + 0, 57) to (start + 0, 62) +- MCDCBranch { true: Counter(7), false: Expression(5, Sub), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 29) to (start + 0, 30) + true = c7 + false = (c6 - c7) +- Code(Counter(7)) at (prev + 0, 33) to (start + 0, 37) +- Code(Expression(6, Sub)) at (prev + 0, 47) to (start + 0, 52) + = (c1 - (c2 + c7)) +- Code(Expression(8, Add)) at (prev + 0, 57) to (start + 0, 62) = (c2 + c3) - Code(Counter(8)) at (prev + 0, 72) to (start + 0, 76) - Code(Counter(4)) at (prev + 0, 79) to (start + 2, 6) -- Code(Expression(11, Sub)) at (prev + 2, 12) to (start + 2, 6) +- Code(Expression(9, Sub)) at (prev + 2, 12) to (start + 2, 6) = ((c0 + c5) - c1) -- Code(Expression(13, Sub)) at (prev + 3, 1) to (start + 0, 2) +- Code(Expression(11, Sub)) at (prev + 3, 1) to (start + 0, 2) = (((c0 + c4) + c5) - c1) Highest counter ID seen: c8 @@ -109,30 +106,28 @@ Number of file 0 mappings: 14 Highest counter ID seen: c5 Function name: nested_if::nested_in_then_block_in_condition -Raw bytes (180): 0x[01, 01, 14, 01, 05, 05, 09, 05, 09, 05, 3b, 09, 0d, 09, 0d, 3b, 11, 09, 0d, 11, 15, 11, 15, 2f, 11, 3b, 15, 09, 0d, 05, 3b, 09, 0d, 43, 05, 01, 1d, 4b, 05, 4f, 1d, 01, 19, 14, 01, 22, 01, 01, 09, 28, 09, 02, 01, 08, 00, 4b, 30, 05, 02, 01, 02, 00, 00, 08, 00, 09, 30, 19, 1d, 02, 00, 00, 00, 0d, 00, 4b, 05, 00, 10, 00, 11, 28, 03, 02, 00, 10, 00, 16, 30, 09, 0a, 01, 00, 02, 00, 10, 00, 11, 0a, 00, 15, 00, 16, 30, 0d, 36, 02, 00, 00, 00, 15, 00, 16, 3b, 00, 1c, 00, 1d, 28, 06, 02, 00, 1c, 00, 22, 30, 11, 1a, 01, 02, 00, 00, 1c, 00, 1d, 11, 00, 21, 00, 22, 30, 26, 15, 02, 00, 00, 00, 21, 00, 22, 26, 00, 25, 00, 29, 2a, 00, 33, 00, 38, 36, 00, 44, 00, 49, 19, 00, 4c, 02, 06, 3e, 02, 0c, 02, 06, 46, 03, 01, 00, 02] +Raw bytes (176): 0x[01, 01, 12, 01, 05, 05, 09, 05, 09, 05, 33, 09, 0d, 09, 0d, 33, 11, 09, 0d, 11, 15, 33, 15, 09, 0d, 05, 33, 09, 0d, 3b, 05, 01, 1d, 43, 05, 47, 1d, 01, 19, 14, 01, 22, 01, 01, 09, 28, 09, 02, 01, 08, 00, 4b, 30, 05, 02, 01, 02, 00, 00, 08, 00, 09, 30, 19, 1d, 02, 00, 00, 00, 0d, 00, 4b, 05, 00, 10, 00, 11, 28, 03, 02, 00, 10, 00, 16, 30, 09, 0a, 01, 00, 02, 00, 10, 00, 11, 0a, 00, 15, 00, 16, 30, 0d, 2e, 02, 00, 00, 00, 15, 00, 16, 33, 00, 1c, 00, 1d, 28, 06, 02, 00, 1c, 00, 22, 30, 11, 1a, 01, 02, 00, 00, 1c, 00, 1d, 11, 00, 21, 00, 22, 30, 15, 22, 02, 00, 00, 00, 21, 00, 22, 15, 00, 25, 00, 29, 26, 00, 33, 00, 38, 2e, 00, 44, 00, 49, 19, 00, 4c, 02, 06, 36, 02, 0c, 02, 06, 3e, 03, 01, 00, 02] Number of files: 1 - file 0 => global file 1 -Number of expressions: 20 +Number of expressions: 18 - expression 0 operands: lhs = Counter(0), rhs = Counter(1) - expression 1 operands: lhs = Counter(1), rhs = Counter(2) - expression 2 operands: lhs = Counter(1), rhs = Counter(2) -- expression 3 operands: lhs = Counter(1), rhs = Expression(14, Add) +- expression 3 operands: lhs = Counter(1), rhs = Expression(12, Add) - expression 4 operands: lhs = Counter(2), rhs = Counter(3) - expression 5 operands: lhs = Counter(2), rhs = Counter(3) -- expression 6 operands: lhs = Expression(14, Add), rhs = Counter(4) +- expression 6 operands: lhs = Expression(12, Add), rhs = Counter(4) - expression 7 operands: lhs = Counter(2), rhs = Counter(3) - expression 8 operands: lhs = Counter(4), rhs = Counter(5) -- expression 9 operands: lhs = Counter(4), rhs = Counter(5) -- expression 10 operands: lhs = Expression(11, Add), rhs = Counter(4) -- expression 11 operands: lhs = Expression(14, Add), rhs = Counter(5) +- expression 9 operands: lhs = Expression(12, Add), rhs = Counter(5) +- expression 10 operands: lhs = Counter(2), rhs = Counter(3) +- expression 11 operands: lhs = Counter(1), rhs = Expression(12, Add) - expression 12 operands: lhs = Counter(2), rhs = Counter(3) -- expression 13 operands: lhs = Counter(1), rhs = Expression(14, Add) -- expression 14 operands: lhs = Counter(2), rhs = Counter(3) +- expression 13 operands: lhs = Expression(14, Add), rhs = Counter(1) +- expression 14 operands: lhs = Counter(0), rhs = Counter(7) - expression 15 operands: lhs = Expression(16, Add), rhs = Counter(1) -- expression 16 operands: lhs = Counter(0), rhs = Counter(7) -- expression 17 operands: lhs = Expression(18, Add), rhs = Counter(1) -- expression 18 operands: lhs = Expression(19, Add), rhs = Counter(7) -- expression 19 operands: lhs = Counter(0), rhs = Counter(6) +- expression 16 operands: lhs = Expression(17, Add), rhs = Counter(7) +- expression 17 operands: lhs = Counter(0), rhs = Counter(6) Number of file 0 mappings: 20 - Code(Counter(0)) at (prev + 34, 1) to (start + 1, 9) - MCDCDecision { bitmap_idx: 9, conditions_num: 2 } at (prev + 1, 8) to (start + 0, 75) @@ -149,29 +144,28 @@ Number of file 0 mappings: 20 false = (c1 - c2) - Code(Expression(2, Sub)) at (prev + 0, 21) to (start + 0, 22) = (c1 - c2) -- MCDCBranch { true: Counter(3), false: Expression(13, Sub), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 21) to (start + 0, 22) +- MCDCBranch { true: Counter(3), false: Expression(11, Sub), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 21) to (start + 0, 22) true = c3 false = (c1 - (c2 + c3)) -- Code(Expression(14, Add)) at (prev + 0, 28) to (start + 0, 29) +- Code(Expression(12, Add)) at (prev + 0, 28) to (start + 0, 29) = (c2 + c3) - MCDCDecision { bitmap_idx: 6, conditions_num: 2 } at (prev + 0, 28) to (start + 0, 34) - MCDCBranch { true: Counter(4), false: Expression(6, Sub), condition_id: 1, true_next_id: 2, false_next_id: 0 } at (prev + 0, 28) to (start + 0, 29) true = c4 false = ((c2 + c3) - c4) - Code(Counter(4)) at (prev + 0, 33) to (start + 0, 34) -- MCDCBranch { true: Expression(9, Sub), false: Counter(5), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 33) to (start + 0, 34) - true = (c4 - c5) - false = c5 -- Code(Expression(9, Sub)) at (prev + 0, 37) to (start + 0, 41) - = (c4 - c5) -- Code(Expression(10, Sub)) at (prev + 0, 51) to (start + 0, 56) - = (((c2 + c3) + c5) - c4) -- Code(Expression(13, Sub)) at (prev + 0, 68) to (start + 0, 73) +- MCDCBranch { true: Counter(5), false: Expression(8, Sub), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 33) to (start + 0, 34) + true = c5 + false = (c4 - c5) +- Code(Counter(5)) at (prev + 0, 37) to (start + 0, 41) +- Code(Expression(9, Sub)) at (prev + 0, 51) to (start + 0, 56) + = ((c2 + c3) - c5) +- Code(Expression(11, Sub)) at (prev + 0, 68) to (start + 0, 73) = (c1 - (c2 + c3)) - Code(Counter(6)) at (prev + 0, 76) to (start + 2, 6) -- Code(Expression(15, Sub)) at (prev + 2, 12) to (start + 2, 6) +- Code(Expression(13, Sub)) at (prev + 2, 12) to (start + 2, 6) = ((c0 + c7) - c1) -- Code(Expression(17, Sub)) at (prev + 3, 1) to (start + 0, 2) +- Code(Expression(15, Sub)) at (prev + 3, 1) to (start + 0, 2) = (((c0 + c6) + c7) - c1) Highest counter ID seen: c7 diff --git a/tests/coverage/mcdc/non_control_flow.cov-map b/tests/coverage/mcdc/non_control_flow.cov-map index 0edeff9a586..c282d53c5ac 100644 --- a/tests/coverage/mcdc/non_control_flow.cov-map +++ b/tests/coverage/mcdc/non_control_flow.cov-map @@ -1,124 +1,107 @@ Function name: non_control_flow::assign_3 -Raw bytes (89): 0x[01, 01, 09, 07, 11, 0b, 0d, 05, 09, 01, 05, 01, 05, 01, 23, 05, 11, 01, 23, 05, 11, 0a, 01, 16, 01, 00, 28, 03, 01, 09, 00, 0a, 01, 00, 0d, 00, 0e, 28, 04, 03, 00, 0d, 00, 18, 30, 05, 12, 01, 00, 02, 00, 0d, 00, 0e, 12, 00, 12, 00, 13, 30, 1e, 11, 02, 03, 00, 00, 12, 00, 13, 1e, 00, 17, 00, 18, 30, 09, 0d, 03, 00, 00, 00, 17, 00, 18, 03, 01, 05, 01, 02] +Raw bytes (79): 0x[01, 01, 04, 01, 05, 01, 0b, 05, 09, 09, 0d, 0a, 01, 16, 01, 00, 28, 01, 01, 09, 00, 0a, 01, 00, 0d, 00, 0e, 28, 04, 03, 00, 0d, 00, 18, 30, 05, 02, 01, 00, 02, 00, 0d, 00, 0e, 02, 00, 12, 00, 13, 30, 09, 06, 02, 03, 00, 00, 12, 00, 13, 09, 00, 17, 00, 18, 30, 0d, 0e, 03, 00, 00, 00, 17, 00, 18, 01, 01, 05, 01, 02] Number of files: 1 - file 0 => global file 1 -Number of expressions: 9 -- expression 0 operands: lhs = Expression(1, Add), rhs = Counter(4) -- expression 1 operands: lhs = Expression(2, Add), rhs = Counter(3) +Number of expressions: 4 +- expression 0 operands: lhs = Counter(0), rhs = Counter(1) +- expression 1 operands: lhs = Counter(0), rhs = Expression(2, Add) - expression 2 operands: lhs = Counter(1), rhs = Counter(2) -- expression 3 operands: lhs = Counter(0), rhs = Counter(1) -- expression 4 operands: lhs = Counter(0), rhs = Counter(1) -- expression 5 operands: lhs = Counter(0), rhs = Expression(8, Add) -- expression 6 operands: lhs = Counter(1), rhs = Counter(4) -- expression 7 operands: lhs = Counter(0), rhs = Expression(8, Add) -- expression 8 operands: lhs = Counter(1), rhs = Counter(4) +- expression 3 operands: lhs = Counter(2), rhs = Counter(3) Number of file 0 mappings: 10 - Code(Counter(0)) at (prev + 22, 1) to (start + 0, 40) -- Code(Expression(0, Add)) at (prev + 1, 9) to (start + 0, 10) - = (((c1 + c2) + c3) + c4) +- Code(Counter(0)) at (prev + 1, 9) to (start + 0, 10) - Code(Counter(0)) at (prev + 0, 13) to (start + 0, 14) - MCDCDecision { bitmap_idx: 4, conditions_num: 3 } at (prev + 0, 13) to (start + 0, 24) -- MCDCBranch { true: Counter(1), false: Expression(4, Sub), condition_id: 1, true_next_id: 0, false_next_id: 2 } at (prev + 0, 13) to (start + 0, 14) +- MCDCBranch { true: Counter(1), false: Expression(0, Sub), condition_id: 1, true_next_id: 0, false_next_id: 2 } at (prev + 0, 13) to (start + 0, 14) true = c1 false = (c0 - c1) -- Code(Expression(4, Sub)) at (prev + 0, 18) to (start + 0, 19) +- Code(Expression(0, Sub)) at (prev + 0, 18) to (start + 0, 19) = (c0 - c1) -- MCDCBranch { true: Expression(7, Sub), false: Counter(4), condition_id: 2, true_next_id: 3, false_next_id: 0 } at (prev + 0, 18) to (start + 0, 19) - true = (c0 - (c1 + c4)) - false = c4 -- Code(Expression(7, Sub)) at (prev + 0, 23) to (start + 0, 24) - = (c0 - (c1 + c4)) -- MCDCBranch { true: Counter(2), false: Counter(3), condition_id: 3, true_next_id: 0, false_next_id: 0 } at (prev + 0, 23) to (start + 0, 24) +- MCDCBranch { true: Counter(2), false: Expression(1, Sub), condition_id: 2, true_next_id: 3, false_next_id: 0 } at (prev + 0, 18) to (start + 0, 19) true = c2 - false = c3 -- Code(Expression(0, Add)) at (prev + 1, 5) to (start + 1, 2) - = (((c1 + c2) + c3) + c4) -Highest counter ID seen: c4 + false = (c0 - (c1 + c2)) +- Code(Counter(2)) at (prev + 0, 23) to (start + 0, 24) +- MCDCBranch { true: Counter(3), false: Expression(3, Sub), condition_id: 3, true_next_id: 0, false_next_id: 0 } at (prev + 0, 23) to (start + 0, 24) + true = c3 + false = (c2 - c3) +- Code(Counter(0)) at (prev + 1, 5) to (start + 1, 2) +Highest counter ID seen: c3 Function name: non_control_flow::assign_3_bis -Raw bytes (81): 0x[01, 01, 05, 07, 11, 09, 0d, 01, 05, 05, 09, 01, 09, 0a, 01, 1b, 01, 00, 2c, 03, 01, 09, 00, 0a, 01, 00, 0d, 00, 0e, 28, 05, 03, 00, 0d, 00, 18, 30, 05, 0a, 01, 03, 02, 00, 0d, 00, 0e, 05, 00, 12, 00, 13, 30, 09, 0e, 03, 00, 02, 00, 12, 00, 13, 12, 00, 17, 00, 18, 30, 0d, 11, 02, 00, 00, 00, 17, 00, 18, 03, 01, 05, 01, 02] +Raw bytes (81): 0x[01, 01, 05, 01, 05, 05, 09, 01, 09, 01, 13, 09, 0d, 0a, 01, 1b, 01, 00, 2c, 01, 01, 09, 00, 0a, 01, 00, 0d, 00, 0e, 28, 05, 03, 00, 0d, 00, 18, 30, 05, 02, 01, 03, 02, 00, 0d, 00, 0e, 05, 00, 12, 00, 13, 30, 09, 06, 03, 00, 02, 00, 12, 00, 13, 0a, 00, 17, 00, 18, 30, 0d, 0e, 02, 00, 00, 00, 17, 00, 18, 01, 01, 05, 01, 02] Number of files: 1 - file 0 => global file 1 Number of expressions: 5 -- expression 0 operands: lhs = Expression(1, Add), rhs = Counter(4) -- expression 1 operands: lhs = Counter(2), rhs = Counter(3) -- expression 2 operands: lhs = Counter(0), rhs = Counter(1) -- expression 3 operands: lhs = Counter(1), rhs = Counter(2) -- expression 4 operands: lhs = Counter(0), rhs = Counter(2) +- expression 0 operands: lhs = Counter(0), rhs = Counter(1) +- expression 1 operands: lhs = Counter(1), rhs = Counter(2) +- expression 2 operands: lhs = Counter(0), rhs = Counter(2) +- expression 3 operands: lhs = Counter(0), rhs = Expression(4, Add) +- expression 4 operands: lhs = Counter(2), rhs = Counter(3) Number of file 0 mappings: 10 - Code(Counter(0)) at (prev + 27, 1) to (start + 0, 44) -- Code(Expression(0, Add)) at (prev + 1, 9) to (start + 0, 10) - = ((c2 + c3) + c4) +- Code(Counter(0)) at (prev + 1, 9) to (start + 0, 10) - Code(Counter(0)) at (prev + 0, 13) to (start + 0, 14) - MCDCDecision { bitmap_idx: 5, conditions_num: 3 } at (prev + 0, 13) to (start + 0, 24) -- MCDCBranch { true: Counter(1), false: Expression(2, Sub), condition_id: 1, true_next_id: 3, false_next_id: 2 } at (prev + 0, 13) to (start + 0, 14) +- MCDCBranch { true: Counter(1), false: Expression(0, Sub), condition_id: 1, true_next_id: 3, false_next_id: 2 } at (prev + 0, 13) to (start + 0, 14) true = c1 false = (c0 - c1) - Code(Counter(1)) at (prev + 0, 18) to (start + 0, 19) -- MCDCBranch { true: Counter(2), false: Expression(3, Sub), condition_id: 3, true_next_id: 0, false_next_id: 2 } at (prev + 0, 18) to (start + 0, 19) +- MCDCBranch { true: Counter(2), false: Expression(1, Sub), condition_id: 3, true_next_id: 0, false_next_id: 2 } at (prev + 0, 18) to (start + 0, 19) true = c2 false = (c1 - c2) -- Code(Expression(4, Sub)) at (prev + 0, 23) to (start + 0, 24) +- Code(Expression(2, Sub)) at (prev + 0, 23) to (start + 0, 24) = (c0 - c2) -- MCDCBranch { true: Counter(3), false: Counter(4), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 23) to (start + 0, 24) +- MCDCBranch { true: Counter(3), false: Expression(3, Sub), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 23) to (start + 0, 24) true = c3 - false = c4 -- Code(Expression(0, Add)) at (prev + 1, 5) to (start + 1, 2) - = ((c2 + c3) + c4) -Highest counter ID seen: c4 + false = (c0 - (c2 + c3)) +- Code(Counter(0)) at (prev + 1, 5) to (start + 1, 2) +Highest counter ID seen: c3 Function name: non_control_flow::assign_and -Raw bytes (64): 0x[01, 01, 04, 07, 05, 0b, 0d, 01, 09, 01, 05, 08, 01, 0c, 01, 00, 21, 02, 01, 09, 00, 0a, 01, 00, 0d, 00, 0e, 28, 03, 02, 00, 0d, 00, 13, 30, 05, 0e, 01, 02, 00, 00, 0d, 00, 0e, 05, 00, 12, 00, 13, 30, 09, 0d, 02, 00, 00, 00, 12, 00, 13, 02, 01, 05, 01, 02] +Raw bytes (60): 0x[01, 01, 02, 01, 05, 05, 09, 08, 01, 0c, 01, 00, 21, 01, 01, 09, 00, 0a, 01, 00, 0d, 00, 0e, 28, 03, 02, 00, 0d, 00, 13, 30, 05, 02, 01, 02, 00, 00, 0d, 00, 0e, 05, 00, 12, 00, 13, 30, 09, 06, 02, 00, 00, 00, 12, 00, 13, 01, 01, 05, 01, 02] Number of files: 1 - file 0 => global file 1 -Number of expressions: 4 -- expression 0 operands: lhs = Expression(1, Add), rhs = Counter(1) -- expression 1 operands: lhs = Expression(2, Add), rhs = Counter(3) -- expression 2 operands: lhs = Counter(0), rhs = Counter(2) -- expression 3 operands: lhs = Counter(0), rhs = Counter(1) +Number of expressions: 2 +- expression 0 operands: lhs = Counter(0), rhs = Counter(1) +- expression 1 operands: lhs = Counter(1), rhs = Counter(2) Number of file 0 mappings: 8 - Code(Counter(0)) at (prev + 12, 1) to (start + 0, 33) -- Code(Expression(0, Sub)) at (prev + 1, 9) to (start + 0, 10) - = (((c0 + c2) + c3) - c1) +- Code(Counter(0)) at (prev + 1, 9) to (start + 0, 10) - Code(Counter(0)) at (prev + 0, 13) to (start + 0, 14) - MCDCDecision { bitmap_idx: 3, conditions_num: 2 } at (prev + 0, 13) to (start + 0, 19) -- MCDCBranch { true: Counter(1), false: Expression(3, Sub), condition_id: 1, true_next_id: 2, false_next_id: 0 } at (prev + 0, 13) to (start + 0, 14) +- MCDCBranch { true: Counter(1), false: Expression(0, Sub), condition_id: 1, true_next_id: 2, false_next_id: 0 } at (prev + 0, 13) to (start + 0, 14) true = c1 false = (c0 - c1) - Code(Counter(1)) at (prev + 0, 18) to (start + 0, 19) -- MCDCBranch { true: Counter(2), false: Counter(3), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 18) to (start + 0, 19) +- MCDCBranch { true: Counter(2), false: Expression(1, Sub), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 18) to (start + 0, 19) true = c2 - false = c3 -- Code(Expression(0, Sub)) at (prev + 1, 5) to (start + 1, 2) - = (((c0 + c2) + c3) - c1) -Highest counter ID seen: c3 + false = (c1 - c2) +- Code(Counter(0)) at (prev + 1, 5) to (start + 1, 2) +Highest counter ID seen: c2 Function name: non_control_flow::assign_or -Raw bytes (64): 0x[01, 01, 04, 07, 0d, 05, 09, 01, 05, 01, 05, 08, 01, 11, 01, 00, 20, 03, 01, 09, 00, 0a, 01, 00, 0d, 00, 0e, 28, 03, 02, 00, 0d, 00, 13, 30, 05, 0e, 01, 00, 02, 00, 0d, 00, 0e, 0e, 00, 12, 00, 13, 30, 09, 0d, 02, 00, 00, 00, 12, 00, 13, 03, 01, 05, 01, 02] +Raw bytes (62): 0x[01, 01, 03, 01, 05, 01, 0b, 05, 09, 08, 01, 11, 01, 00, 20, 01, 01, 09, 00, 0a, 01, 00, 0d, 00, 0e, 28, 03, 02, 00, 0d, 00, 13, 30, 05, 02, 01, 00, 02, 00, 0d, 00, 0e, 02, 00, 12, 00, 13, 30, 09, 06, 02, 00, 00, 00, 12, 00, 13, 01, 01, 05, 01, 02] Number of files: 1 - file 0 => global file 1 -Number of expressions: 4 -- expression 0 operands: lhs = Expression(1, Add), rhs = Counter(3) -- expression 1 operands: lhs = Counter(1), rhs = Counter(2) -- expression 2 operands: lhs = Counter(0), rhs = Counter(1) -- expression 3 operands: lhs = Counter(0), rhs = Counter(1) +Number of expressions: 3 +- expression 0 operands: lhs = Counter(0), rhs = Counter(1) +- expression 1 operands: lhs = Counter(0), rhs = Expression(2, Add) +- expression 2 operands: lhs = Counter(1), rhs = Counter(2) Number of file 0 mappings: 8 - Code(Counter(0)) at (prev + 17, 1) to (start + 0, 32) -- Code(Expression(0, Add)) at (prev + 1, 9) to (start + 0, 10) - = ((c1 + c2) + c3) +- Code(Counter(0)) at (prev + 1, 9) to (start + 0, 10) - Code(Counter(0)) at (prev + 0, 13) to (start + 0, 14) - MCDCDecision { bitmap_idx: 3, conditions_num: 2 } at (prev + 0, 13) to (start + 0, 19) -- MCDCBranch { true: Counter(1), false: Expression(3, Sub), condition_id: 1, true_next_id: 0, false_next_id: 2 } at (prev + 0, 13) to (start + 0, 14) +- MCDCBranch { true: Counter(1), false: Expression(0, Sub), condition_id: 1, true_next_id: 0, false_next_id: 2 } at (prev + 0, 13) to (start + 0, 14) true = c1 false = (c0 - c1) -- Code(Expression(3, Sub)) at (prev + 0, 18) to (start + 0, 19) +- Code(Expression(0, Sub)) at (prev + 0, 18) to (start + 0, 19) = (c0 - c1) -- MCDCBranch { true: Counter(2), false: Counter(3), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 18) to (start + 0, 19) +- MCDCBranch { true: Counter(2), false: Expression(1, Sub), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 18) to (start + 0, 19) true = c2 - false = c3 -- Code(Expression(0, Add)) at (prev + 1, 5) to (start + 1, 2) - = ((c1 + c2) + c3) -Highest counter ID seen: c3 + false = (c0 - (c1 + c2)) +- Code(Counter(0)) at (prev + 1, 5) to (start + 1, 2) +Highest counter ID seen: c2 Function name: non_control_flow::foo Raw bytes (9): 0x[01, 01, 00, 01, 01, 25, 01, 02, 02] @@ -130,14 +113,12 @@ Number of file 0 mappings: 1 Highest counter ID seen: c0 Function name: non_control_flow::func_call -Raw bytes (54): 0x[01, 01, 04, 01, 05, 0b, 05, 0f, 0d, 01, 09, 06, 01, 29, 01, 01, 0a, 28, 03, 02, 01, 09, 00, 0f, 30, 05, 02, 01, 02, 00, 00, 09, 00, 0a, 05, 00, 0e, 00, 0f, 30, 09, 0d, 02, 00, 00, 00, 0e, 00, 0f, 06, 01, 01, 00, 02] +Raw bytes (50): 0x[01, 01, 02, 01, 05, 05, 09, 06, 01, 29, 01, 01, 0a, 28, 03, 02, 01, 09, 00, 0f, 30, 05, 02, 01, 02, 00, 00, 09, 00, 0a, 05, 00, 0e, 00, 0f, 30, 09, 06, 02, 00, 00, 00, 0e, 00, 0f, 01, 01, 01, 00, 02] Number of files: 1 - file 0 => global file 1 -Number of expressions: 4 +Number of expressions: 2 - expression 0 operands: lhs = Counter(0), rhs = Counter(1) -- expression 1 operands: lhs = Expression(2, Add), rhs = Counter(1) -- expression 2 operands: lhs = Expression(3, Add), rhs = Counter(3) -- expression 3 operands: lhs = Counter(0), rhs = Counter(2) +- expression 1 operands: lhs = Counter(1), rhs = Counter(2) Number of file 0 mappings: 6 - Code(Counter(0)) at (prev + 41, 1) to (start + 1, 10) - MCDCDecision { bitmap_idx: 3, conditions_num: 2 } at (prev + 1, 9) to (start + 0, 15) @@ -145,66 +126,46 @@ Number of file 0 mappings: 6 true = c1 false = (c0 - c1) - Code(Counter(1)) at (prev + 0, 14) to (start + 0, 15) -- MCDCBranch { true: Counter(2), false: Counter(3), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 14) to (start + 0, 15) +- MCDCBranch { true: Counter(2), false: Expression(1, Sub), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 14) to (start + 0, 15) true = c2 - false = c3 -- Code(Expression(1, Sub)) at (prev + 1, 1) to (start + 0, 2) - = (((c0 + c2) + c3) - c1) -Highest counter ID seen: c3 + false = (c1 - c2) +- Code(Counter(0)) at (prev + 1, 1) to (start + 0, 2) +Highest counter ID seen: c2 Function name: non_control_flow::right_comb_tree -Raw bytes (139): 0x[01, 01, 13, 07, 05, 0b, 19, 0f, 15, 13, 11, 17, 0d, 01, 09, 01, 05, 05, 09, 05, 09, 05, 4b, 09, 0d, 05, 4b, 09, 0d, 05, 47, 4b, 11, 09, 0d, 05, 47, 4b, 11, 09, 0d, 0e, 01, 20, 01, 00, 41, 02, 01, 09, 00, 0a, 01, 00, 0d, 00, 0e, 28, 06, 05, 00, 0d, 00, 2a, 30, 05, 1a, 01, 02, 00, 00, 0d, 00, 0e, 05, 00, 13, 00, 14, 30, 22, 09, 02, 03, 00, 00, 13, 00, 14, 22, 00, 19, 00, 1a, 30, 2e, 0d, 03, 04, 00, 00, 19, 00, 1a, 2e, 00, 1f, 00, 20, 30, 42, 11, 04, 05, 00, 00, 1f, 00, 20, 42, 00, 24, 00, 27, 30, 15, 19, 05, 00, 00, 00, 24, 00, 27, 02, 01, 05, 01, 02] +Raw bytes (111): 0x[01, 01, 05, 01, 05, 05, 09, 09, 0d, 0d, 11, 11, 15, 0e, 01, 20, 01, 00, 41, 01, 01, 09, 00, 0a, 01, 00, 0d, 00, 0e, 28, 06, 05, 00, 0d, 00, 2a, 30, 05, 02, 01, 02, 00, 00, 0d, 00, 0e, 05, 00, 13, 00, 14, 30, 09, 06, 02, 03, 00, 00, 13, 00, 14, 09, 00, 19, 00, 1a, 30, 0d, 0a, 03, 04, 00, 00, 19, 00, 1a, 0d, 00, 1f, 00, 20, 30, 11, 0e, 04, 05, 00, 00, 1f, 00, 20, 11, 00, 24, 00, 27, 30, 15, 12, 05, 00, 00, 00, 24, 00, 27, 01, 01, 05, 01, 02] Number of files: 1 - file 0 => global file 1 -Number of expressions: 19 -- expression 0 operands: lhs = Expression(1, Add), rhs = Counter(1) -- expression 1 operands: lhs = Expression(2, Add), rhs = Counter(6) -- expression 2 operands: lhs = Expression(3, Add), rhs = Counter(5) -- expression 3 operands: lhs = Expression(4, Add), rhs = Counter(4) -- expression 4 operands: lhs = Expression(5, Add), rhs = Counter(3) -- expression 5 operands: lhs = Counter(0), rhs = Counter(2) -- expression 6 operands: lhs = Counter(0), rhs = Counter(1) -- expression 7 operands: lhs = Counter(1), rhs = Counter(2) -- expression 8 operands: lhs = Counter(1), rhs = Counter(2) -- expression 9 operands: lhs = Counter(1), rhs = Expression(18, Add) -- expression 10 operands: lhs = Counter(2), rhs = Counter(3) -- expression 11 operands: lhs = Counter(1), rhs = Expression(18, Add) -- expression 12 operands: lhs = Counter(2), rhs = Counter(3) -- expression 13 operands: lhs = Counter(1), rhs = Expression(17, Add) -- expression 14 operands: lhs = Expression(18, Add), rhs = Counter(4) -- expression 15 operands: lhs = Counter(2), rhs = Counter(3) -- expression 16 operands: lhs = Counter(1), rhs = Expression(17, Add) -- expression 17 operands: lhs = Expression(18, Add), rhs = Counter(4) -- expression 18 operands: lhs = Counter(2), rhs = Counter(3) +Number of expressions: 5 +- expression 0 operands: lhs = Counter(0), rhs = Counter(1) +- expression 1 operands: lhs = Counter(1), rhs = Counter(2) +- expression 2 operands: lhs = Counter(2), rhs = Counter(3) +- expression 3 operands: lhs = Counter(3), rhs = Counter(4) +- expression 4 operands: lhs = Counter(4), rhs = Counter(5) Number of file 0 mappings: 14 - Code(Counter(0)) at (prev + 32, 1) to (start + 0, 65) -- Code(Expression(0, Sub)) at (prev + 1, 9) to (start + 0, 10) - = ((((((c0 + c2) + c3) + c4) + c5) + c6) - c1) +- Code(Counter(0)) at (prev + 1, 9) to (start + 0, 10) - Code(Counter(0)) at (prev + 0, 13) to (start + 0, 14) - MCDCDecision { bitmap_idx: 6, conditions_num: 5 } at (prev + 0, 13) to (start + 0, 42) -- MCDCBranch { true: Counter(1), false: Expression(6, Sub), condition_id: 1, true_next_id: 2, false_next_id: 0 } at (prev + 0, 13) to (start + 0, 14) +- MCDCBranch { true: Counter(1), false: Expression(0, Sub), condition_id: 1, true_next_id: 2, false_next_id: 0 } at (prev + 0, 13) to (start + 0, 14) true = c1 false = (c0 - c1) - Code(Counter(1)) at (prev + 0, 19) to (start + 0, 20) -- MCDCBranch { true: Expression(8, Sub), false: Counter(2), condition_id: 2, true_next_id: 3, false_next_id: 0 } at (prev + 0, 19) to (start + 0, 20) - true = (c1 - c2) - false = c2 -- Code(Expression(8, Sub)) at (prev + 0, 25) to (start + 0, 26) - = (c1 - c2) -- MCDCBranch { true: Expression(11, Sub), false: Counter(3), condition_id: 3, true_next_id: 4, false_next_id: 0 } at (prev + 0, 25) to (start + 0, 26) - true = (c1 - (c2 + c3)) - false = c3 -- Code(Expression(11, Sub)) at (prev + 0, 31) to (start + 0, 32) - = (c1 - (c2 + c3)) -- MCDCBranch { true: Expression(16, Sub), false: Counter(4), condition_id: 4, true_next_id: 5, false_next_id: 0 } at (prev + 0, 31) to (start + 0, 32) - true = (c1 - ((c2 + c3) + c4)) - false = c4 -- Code(Expression(16, Sub)) at (prev + 0, 36) to (start + 0, 39) - = (c1 - ((c2 + c3) + c4)) -- MCDCBranch { true: Counter(5), false: Counter(6), condition_id: 5, true_next_id: 0, false_next_id: 0 } at (prev + 0, 36) to (start + 0, 39) +- MCDCBranch { true: Counter(2), false: Expression(1, Sub), condition_id: 2, true_next_id: 3, false_next_id: 0 } at (prev + 0, 19) to (start + 0, 20) + true = c2 + false = (c1 - c2) +- Code(Counter(2)) at (prev + 0, 25) to (start + 0, 26) +- MCDCBranch { true: Counter(3), false: Expression(2, Sub), condition_id: 3, true_next_id: 4, false_next_id: 0 } at (prev + 0, 25) to (start + 0, 26) + true = c3 + false = (c2 - c3) +- Code(Counter(3)) at (prev + 0, 31) to (start + 0, 32) +- MCDCBranch { true: Counter(4), false: Expression(3, Sub), condition_id: 4, true_next_id: 5, false_next_id: 0 } at (prev + 0, 31) to (start + 0, 32) + true = c4 + false = (c3 - c4) +- Code(Counter(4)) at (prev + 0, 36) to (start + 0, 39) +- MCDCBranch { true: Counter(5), false: Expression(4, Sub), condition_id: 5, true_next_id: 0, false_next_id: 0 } at (prev + 0, 36) to (start + 0, 39) true = c5 - false = c6 -- Code(Expression(0, Sub)) at (prev + 1, 5) to (start + 1, 2) - = ((((((c0 + c2) + c3) + c4) + c5) + c6) - c1) -Highest counter ID seen: c6 + false = (c4 - c5) +- Code(Counter(0)) at (prev + 1, 5) to (start + 1, 2) +Highest counter ID seen: c5 diff --git a/tests/coverage/try_error_result.cov-map b/tests/coverage/try_error_result.cov-map index 7fbd2cc642e..f90b73592bd 100644 --- a/tests/coverage/try_error_result.cov-map +++ b/tests/coverage/try_error_result.cov-map @@ -55,18 +55,15 @@ Number of file 0 mappings: 4 Highest counter ID seen: c1 Function name: try_error_result::test1 -Raw bytes (75): 0x[01, 01, 08, 07, 09, 01, 00, 03, 0d, 03, 13, 0d, 11, 1b, 00, 1f, 00, 0d, 15, 0b, 01, 0d, 01, 02, 17, 03, 07, 09, 00, 0e, 0a, 02, 09, 04, 1a, 11, 06, 0d, 00, 29, 15, 00, 29, 00, 2a, 00, 01, 0d, 00, 2a, 00, 00, 2a, 00, 2b, 0e, 04, 0d, 00, 2a, 00, 00, 2a, 00, 2b, 0d, 03, 05, 00, 0b, 17, 01, 01, 00, 02] +Raw bytes (69): 0x[01, 01, 05, 07, 09, 01, 00, 03, 0d, 03, 13, 0d, 11, 0b, 01, 0d, 01, 02, 17, 03, 07, 09, 00, 0e, 0a, 02, 09, 04, 1a, 11, 06, 0d, 00, 29, 15, 00, 29, 00, 2a, 00, 01, 0d, 00, 2a, 00, 00, 2a, 00, 2b, 0e, 04, 0d, 00, 2a, 00, 00, 2a, 00, 2b, 0d, 03, 05, 00, 0b, 01, 01, 01, 00, 02] Number of files: 1 - file 0 => global file 1 -Number of expressions: 8 +Number of expressions: 5 - expression 0 operands: lhs = Expression(1, Add), rhs = Counter(2) - expression 1 operands: lhs = Counter(0), rhs = Zero - expression 2 operands: lhs = Expression(0, Add), rhs = Counter(3) - expression 3 operands: lhs = Expression(0, Add), rhs = Expression(4, Add) - expression 4 operands: lhs = Counter(3), rhs = Counter(4) -- expression 5 operands: lhs = Expression(6, Add), rhs = Zero -- expression 6 operands: lhs = Expression(7, Add), rhs = Zero -- expression 7 operands: lhs = Counter(3), rhs = Counter(5) Number of file 0 mappings: 11 - Code(Counter(0)) at (prev + 13, 1) to (start + 2, 23) - Code(Expression(0, Add)) at (prev + 7, 9) to (start + 0, 14) @@ -81,8 +78,7 @@ Number of file 0 mappings: 11 = (((c0 + Zero) + c2) - (c3 + c4)) - Code(Zero) at (prev + 0, 42) to (start + 0, 43) - Code(Counter(3)) at (prev + 3, 5) to (start + 0, 11) -- Code(Expression(5, Add)) at (prev + 1, 1) to (start + 0, 2) - = (((c3 + c5) + Zero) + Zero) +- Code(Counter(0)) at (prev + 1, 1) to (start + 0, 2) Highest counter ID seen: c5 Function name: try_error_result::test2 diff --git a/tests/coverage/unicode.cov-map b/tests/coverage/unicode.cov-map index 630ab4ce47e..0a4e367bb9e 100644 --- a/tests/coverage/unicode.cov-map +++ b/tests/coverage/unicode.cov-map @@ -1,14 +1,10 @@ Function name: unicode::main -Raw bytes (61): 0x[01, 01, 06, 01, 05, 0b, 09, 01, 11, 13, 09, 17, 11, 01, 0d, 09, 01, 0e, 01, 00, 0b, 05, 01, 09, 00, 0c, 03, 00, 10, 00, 1b, 05, 00, 1c, 00, 28, 01, 02, 08, 00, 25, 09, 00, 29, 00, 46, 0d, 00, 47, 02, 06, 06, 02, 05, 00, 06, 0e, 02, 05, 01, 02] +Raw bytes (53): 0x[01, 01, 02, 01, 05, 01, 0d, 09, 01, 0e, 01, 00, 0b, 05, 01, 09, 00, 0c, 03, 00, 10, 00, 1b, 05, 00, 1c, 00, 28, 01, 02, 08, 00, 25, 09, 00, 29, 00, 46, 0d, 00, 47, 02, 06, 06, 02, 05, 00, 06, 01, 02, 05, 01, 02] Number of files: 1 - file 0 => global file 1 -Number of expressions: 6 +Number of expressions: 2 - expression 0 operands: lhs = Counter(0), rhs = Counter(1) -- expression 1 operands: lhs = Expression(2, Add), rhs = Counter(2) -- expression 2 operands: lhs = Counter(0), rhs = Counter(4) -- expression 3 operands: lhs = Expression(4, Add), rhs = Counter(2) -- expression 4 operands: lhs = Expression(5, Add), rhs = Counter(4) -- expression 5 operands: lhs = Counter(0), rhs = Counter(3) +- expression 1 operands: lhs = Counter(0), rhs = Counter(3) Number of file 0 mappings: 9 - Code(Counter(0)) at (prev + 14, 1) to (start + 0, 11) - Code(Counter(1)) at (prev + 1, 9) to (start + 0, 12) @@ -19,9 +15,8 @@ Number of file 0 mappings: 9 - Code(Counter(2)) at (prev + 0, 41) to (start + 0, 70) - Code(Counter(3)) at (prev + 0, 71) to (start + 2, 6) - Code(Expression(1, Sub)) at (prev + 2, 5) to (start + 0, 6) - = ((c0 + c4) - c2) -- Code(Expression(3, Sub)) at (prev + 2, 5) to (start + 1, 2) - = (((c0 + c3) + c4) - c2) + = (c0 - c3) +- Code(Counter(0)) at (prev + 2, 5) to (start + 1, 2) Highest counter ID seen: c3 Function name: unicode::ä»– (unused) diff --git a/tests/coverage/while_early_ret.cov-map b/tests/coverage/while_early_ret.cov-map index ade770597e2..554056fa801 100644 --- a/tests/coverage/while_early_ret.cov-map +++ b/tests/coverage/while_early_ret.cov-map @@ -1,12 +1,12 @@ Function name: while_early_ret::main -Raw bytes (59): 0x[01, 01, 05, 01, 05, 03, 09, 01, 09, 13, 11, 09, 0d, 09, 01, 05, 01, 01, 1b, 03, 03, 09, 02, 0a, 06, 05, 0d, 02, 0e, 0a, 06, 15, 02, 16, 0d, 04, 15, 00, 1b, 11, 04, 15, 00, 1b, 05, 03, 0a, 03, 0a, 09, 06, 05, 00, 0b, 0f, 01, 01, 00, 02] +Raw bytes (59): 0x[01, 01, 05, 01, 05, 03, 09, 01, 09, 01, 13, 09, 0d, 09, 01, 05, 01, 01, 1b, 03, 03, 09, 02, 0a, 06, 05, 0d, 02, 0e, 0a, 06, 15, 02, 16, 0d, 04, 15, 00, 1b, 0e, 04, 15, 00, 1b, 05, 03, 0a, 03, 0a, 09, 06, 05, 00, 0b, 01, 01, 01, 00, 02] Number of files: 1 - file 0 => global file 1 Number of expressions: 5 - expression 0 operands: lhs = Counter(0), rhs = Counter(1) - expression 1 operands: lhs = Expression(0, Add), rhs = Counter(2) - expression 2 operands: lhs = Counter(0), rhs = Counter(2) -- expression 3 operands: lhs = Expression(4, Add), rhs = Counter(4) +- expression 3 operands: lhs = Counter(0), rhs = Expression(4, Add) - expression 4 operands: lhs = Counter(2), rhs = Counter(3) Number of file 0 mappings: 9 - Code(Counter(0)) at (prev + 5, 1) to (start + 1, 27) @@ -17,10 +17,10 @@ Number of file 0 mappings: 9 - Code(Expression(2, Sub)) at (prev + 6, 21) to (start + 2, 22) = (c0 - c2) - Code(Counter(3)) at (prev + 4, 21) to (start + 0, 27) -- Code(Counter(4)) at (prev + 4, 21) to (start + 0, 27) +- Code(Expression(3, Sub)) at (prev + 4, 21) to (start + 0, 27) + = (c0 - (c2 + c3)) - Code(Counter(1)) at (prev + 3, 10) to (start + 3, 10) - Code(Counter(2)) at (prev + 6, 5) to (start + 0, 11) -- Code(Expression(3, Add)) at (prev + 1, 1) to (start + 0, 2) - = ((c2 + c3) + c4) -Highest counter ID seen: c4 +- Code(Counter(0)) at (prev + 1, 1) to (start + 0, 2) +Highest counter ID seen: c3 diff --git a/tests/coverage/yield.cov-map b/tests/coverage/yield.cov-map index e01ec8f9edb..868fec4b107 100644 --- a/tests/coverage/yield.cov-map +++ b/tests/coverage/yield.cov-map @@ -1,19 +1,13 @@ Function name: yield::main -Raw bytes (106): 0x[01, 01, 0b, 05, 00, 0d, 11, 0d, 23, 11, 15, 11, 15, 0d, 23, 11, 15, 0d, 23, 11, 15, 19, 1d, 25, 29, 10, 01, 07, 01, 01, 16, 01, 07, 0b, 00, 2e, 0d, 01, 27, 00, 29, 03, 01, 0e, 00, 34, 0d, 02, 0b, 00, 2e, 06, 01, 22, 00, 27, 1e, 00, 2c, 00, 2e, 23, 01, 0e, 00, 34, 1e, 03, 09, 00, 16, 1e, 08, 0b, 00, 2e, 21, 01, 27, 00, 29, 27, 01, 0e, 00, 34, 21, 02, 0b, 00, 2e, 2d, 01, 27, 00, 29, 2b, 01, 0e, 00, 34, 2d, 02, 01, 00, 02] +Raw bytes (94): 0x[01, 01, 05, 05, 00, 0d, 15, 0d, 11, 19, 1d, 25, 29, 10, 01, 07, 01, 01, 16, 01, 07, 0b, 00, 2e, 0d, 01, 27, 00, 29, 03, 01, 0e, 00, 34, 0d, 02, 0b, 00, 2e, 06, 01, 22, 00, 27, 11, 00, 2c, 00, 2e, 0a, 01, 0e, 00, 34, 11, 03, 09, 00, 16, 11, 08, 0b, 00, 2e, 21, 01, 27, 00, 29, 0f, 01, 0e, 00, 34, 21, 02, 0b, 00, 2e, 2d, 01, 27, 00, 29, 13, 01, 0e, 00, 34, 2d, 02, 01, 00, 02] Number of files: 1 - file 0 => global file 1 -Number of expressions: 11 +Number of expressions: 5 - expression 0 operands: lhs = Counter(1), rhs = Zero -- expression 1 operands: lhs = Counter(3), rhs = Counter(4) -- expression 2 operands: lhs = Counter(3), rhs = Expression(8, Add) -- expression 3 operands: lhs = Counter(4), rhs = Counter(5) -- expression 4 operands: lhs = Counter(4), rhs = Counter(5) -- expression 5 operands: lhs = Counter(3), rhs = Expression(8, Add) -- expression 6 operands: lhs = Counter(4), rhs = Counter(5) -- expression 7 operands: lhs = Counter(3), rhs = Expression(8, Add) -- expression 8 operands: lhs = Counter(4), rhs = Counter(5) -- expression 9 operands: lhs = Counter(6), rhs = Counter(7) -- expression 10 operands: lhs = Counter(9), rhs = Counter(10) +- expression 1 operands: lhs = Counter(3), rhs = Counter(5) +- expression 2 operands: lhs = Counter(3), rhs = Counter(4) +- expression 3 operands: lhs = Counter(6), rhs = Counter(7) +- expression 4 operands: lhs = Counter(9), rhs = Counter(10) Number of file 0 mappings: 16 - Code(Counter(0)) at (prev + 7, 1) to (start + 1, 22) - Code(Counter(0)) at (prev + 7, 11) to (start + 0, 46) @@ -22,21 +16,18 @@ Number of file 0 mappings: 16 = (c1 + Zero) - Code(Counter(3)) at (prev + 2, 11) to (start + 0, 46) - Code(Expression(1, Sub)) at (prev + 1, 34) to (start + 0, 39) + = (c3 - c5) +- Code(Counter(4)) at (prev + 0, 44) to (start + 0, 46) +- Code(Expression(2, Sub)) at (prev + 1, 14) to (start + 0, 52) = (c3 - c4) -- Code(Expression(7, Sub)) at (prev + 0, 44) to (start + 0, 46) - = (c3 - (c4 + c5)) -- Code(Expression(8, Add)) at (prev + 1, 14) to (start + 0, 52) - = (c4 + c5) -- Code(Expression(7, Sub)) at (prev + 3, 9) to (start + 0, 22) - = (c3 - (c4 + c5)) -- Code(Expression(7, Sub)) at (prev + 8, 11) to (start + 0, 46) - = (c3 - (c4 + c5)) +- Code(Counter(4)) at (prev + 3, 9) to (start + 0, 22) +- Code(Counter(4)) at (prev + 8, 11) to (start + 0, 46) - Code(Counter(8)) at (prev + 1, 39) to (start + 0, 41) -- Code(Expression(9, Add)) at (prev + 1, 14) to (start + 0, 52) +- Code(Expression(3, Add)) at (prev + 1, 14) to (start + 0, 52) = (c6 + c7) - Code(Counter(8)) at (prev + 2, 11) to (start + 0, 46) - Code(Counter(11)) at (prev + 1, 39) to (start + 0, 41) -- Code(Expression(10, Add)) at (prev + 1, 14) to (start + 0, 52) +- Code(Expression(4, Add)) at (prev + 1, 14) to (start + 0, 52) = (c9 + c10) - Code(Counter(11)) at (prev + 2, 1) to (start + 0, 2) Highest counter ID seen: c11 diff --git a/tests/crashes/116979.rs b/tests/crashes/116979.rs new file mode 100644 index 00000000000..28bbc972ea3 --- /dev/null +++ b/tests/crashes/116979.rs @@ -0,0 +1,14 @@ +//@ known-bug: #116979 +//@ compile-flags: -Csymbol-mangling-version=v0 +//@ needs-rustc-debug-assertions + +#![feature(dyn_star)] +#![allow(incomplete_features)] + +use std::fmt::Display; + +pub fn require_dyn_star_display(_: dyn* Display) {} + +fn main() { + require_dyn_star_display(1usize); +} diff --git a/tests/crashes/117808.rs b/tests/crashes/117808.rs new file mode 100644 index 00000000000..2c727986dd0 --- /dev/null +++ b/tests/crashes/117808.rs @@ -0,0 +1,27 @@ +//@ known-bug: #117808 +//@ edition:2021 +//@ needs-rustc-debug-assertions + +use std::future::Future; + +fn hrc<R, F: for<'a> AsyncClosure<'a, (), R>>(f: F) -> F { + f +} + +fn main() { + hrc(|x| async {}); +} + +trait AsyncClosure<'a, I, R> +where + I: 'a, +{ +} + +impl<'a, I, R, Fut, F> AsyncClosure<'a, I, R> for F +where + I: 'a, + F: Fn(&'a I) -> Fut, + Fut: Future<Output = R> + Send + 'a, +{ +} diff --git a/tests/crashes/117877.rs b/tests/crashes/117877.rs new file mode 100644 index 00000000000..b1effc0cbcb --- /dev/null +++ b/tests/crashes/117877.rs @@ -0,0 +1,13 @@ +//@ known-bug: #117877 +//@ edition:2021 +//@ needs-rustc-debug-assertions +//@ only-x86_64 +#![feature(asm_const)] + +use std::arch::asm; + +async unsafe fn foo<'a>() { + asm!("/* {0} */", const N); +} + +fn main() {} diff --git a/tests/crashes/118778.rs b/tests/crashes/118778.rs new file mode 100644 index 00000000000..9914e76022d --- /dev/null +++ b/tests/crashes/118778.rs @@ -0,0 +1,24 @@ +//@ known-bug: #118778 +//@ edition:2021 +//@ needs-rustc-debug-assertions + +#![feature(generic_const_exprs)] +#![allow(incomplete_features)] + +trait Owner { + type T<const N: u16>; +} + +impl Owner for () { + type T<const N: u32> = U32<{ N + 1 }> + where + U32<{ N + 1 }>:; +} + +struct U32<const N: u32>; + +fn take1(_: impl Owner<T<1> = U32<1>>) {} + +fn main() { + take1(()); +} diff --git a/tests/crashes/118784.rs b/tests/crashes/118784.rs new file mode 100644 index 00000000000..7bf943c8177 --- /dev/null +++ b/tests/crashes/118784.rs @@ -0,0 +1,19 @@ +//@ known-bug: #118784 +//@ needs-rustc-debug-assertions + +use std::collections::HashMap; + +macro_rules! all_sync_send { + ($ctor:expr, $($iter:expr),+) => ({ + $( + let mut x = $ctor; + is_sync(x.$iter()); + let mut y = $ctor; + is_send(y.$iter()); + )+ + }) +} + +fn main() { + all_sync_send!(HashMap, HashMap); +} diff --git a/tests/crashes/120175.rs b/tests/crashes/120175.rs new file mode 100644 index 00000000000..c6e7203ff98 --- /dev/null +++ b/tests/crashes/120175.rs @@ -0,0 +1,11 @@ +//@ known-bug: #120175 +//@ needs-rustc-debug-assertions + +#![feature(extern_types)] + +#[link(name = "bar", import_name_type = "decorated", kind = "raw-dylib")] +extern "C" { + pub type CrossCrate; +} + +fn main() {} diff --git a/tests/crashes/121176.rs b/tests/crashes/121176.rs new file mode 100644 index 00000000000..4d82e51de8f --- /dev/null +++ b/tests/crashes/121176.rs @@ -0,0 +1,9 @@ +//@ known-bug: #121176 +//@ needs-rustc-debug-assertions +use std::fmt::Debug; + +static STATIC_1: dyn Debug + Sync = *(); + +fn main() { + println!("{:?}", &STATIC_1); +} diff --git a/tests/crashes/123861.rs b/tests/crashes/123861.rs new file mode 100644 index 00000000000..60245960af0 --- /dev/null +++ b/tests/crashes/123861.rs @@ -0,0 +1,5 @@ +//@ known-bug: #123861 +//@ needs-rustc-debug-assertions + +struct _; +fn mainIterator<_ = _> {} diff --git a/tests/crashes/123862.rs b/tests/crashes/123862.rs new file mode 100644 index 00000000000..075e0e6fc8f --- /dev/null +++ b/tests/crashes/123862.rs @@ -0,0 +1,14 @@ +//@ known-bug: #123862 +//@ needs-rustc-debug-assertions + +macro_rules! pos { + () => { + (file![$($pos,)* pos!()], line!()) + }; +} + +fn outer() { + inner_inlined(main_pos, pos!()); +} + +fn inner_inlined() {} diff --git a/tests/crashes/124375.rs b/tests/crashes/124375.rs deleted file mode 100644 index 1d877caeb8b..00000000000 --- a/tests/crashes/124375.rs +++ /dev/null @@ -1,11 +0,0 @@ -//@ known-bug: #124375 -//@ compile-flags: -Zmir-opt-level=0 -//@ only-x86_64 -#![crate_type = "lib"] -#![feature(naked_functions)] -use std::arch::naked_asm; - -#[naked] -pub unsafe extern "C" fn naked_with_args_and_return(a: isize, b: isize) -> isize { - naked_asm!("lea rax, [rdi + rsi]", "ret"); -} diff --git a/tests/crashes/130395.rs b/tests/crashes/130395.rs new file mode 100644 index 00000000000..c1d189c79ba --- /dev/null +++ b/tests/crashes/130395.rs @@ -0,0 +1,10 @@ +//@ known-bug: #130395 +//@ needs-rustc-debug-assertions + +enum U { + B(isize, usize), +} + +fn main() { + let x = T::A(U::C); +} diff --git a/tests/crashes/132765.rs b/tests/crashes/132765.rs new file mode 100644 index 00000000000..01e8fdaacff --- /dev/null +++ b/tests/crashes/132765.rs @@ -0,0 +1,12 @@ +//@ known-bug: #132765 + +trait LendingIterator { + type Item<'q>; + fn for_each(&self, _f: Box<fn(Self::Item<'_>)>) {} +} + +fn f(_: ()) {} + +fn main() { + LendingIterator::for_each(&(), f); +} diff --git a/tests/crashes/132766.rs b/tests/crashes/132766.rs new file mode 100644 index 00000000000..5f5117d77a5 --- /dev/null +++ b/tests/crashes/132766.rs @@ -0,0 +1,9 @@ +//@ known-bug: #132766 + +trait Trait {} +impl<'a> Trait for () { + fn pass2<'a>() -> impl Trait2 {} +} + +trait Trait2 {} +impl Trait2 for () {} diff --git a/tests/crashes/132882.rs b/tests/crashes/132882.rs new file mode 100644 index 00000000000..6b5e4dba803 --- /dev/null +++ b/tests/crashes/132882.rs @@ -0,0 +1,13 @@ +//@ known-bug: #132882 + +use std::ops::Add; + +pub trait Numoid +where + for<N: Numoid> &'a Self: Add<Self>, +{ +} + +pub fn compute<N: Numoid>(a: N) -> N { + &a + a +} diff --git a/tests/crashes/132981.rs b/tests/crashes/132981.rs new file mode 100644 index 00000000000..8ff4fa36fd0 --- /dev/null +++ b/tests/crashes/132981.rs @@ -0,0 +1,7 @@ +//@ known-bug: #132981 +//@compile-flags: -Clink-dead-code=true --crate-type lib +//@ only-x86_64 +//@ ignore-windows + +#![feature(rust_cold_cc)] +pub extern "rust-cold" fn foo(_: [usize; 3]) {} diff --git a/tests/crashes/133063.rs b/tests/crashes/133063.rs new file mode 100644 index 00000000000..132b5486170 --- /dev/null +++ b/tests/crashes/133063.rs @@ -0,0 +1,8 @@ +//@ known-bug: #133063 + +fn foo(x: !) { + match x { + (! | !) if false => {} + _ => {} + } +} diff --git a/tests/crashes/133066.rs b/tests/crashes/133066.rs new file mode 100644 index 00000000000..732ebb7079f --- /dev/null +++ b/tests/crashes/133066.rs @@ -0,0 +1,12 @@ +//@ known-bug: #133066 +trait Owner { + const C<const N: u32>: u32; +} + +impl Owner for () {;} + +fn take0<const N: u64>(_: impl Owner<C<N> = { N }>) {} + +fn main() { + take0::<f32, >(()); +} diff --git a/tests/crashes/133199.rs b/tests/crashes/133199.rs new file mode 100644 index 00000000000..76535fa83a6 --- /dev/null +++ b/tests/crashes/133199.rs @@ -0,0 +1,11 @@ +//@ known-bug: #133199 +//@ aux-build: aux133199.rs + +extern crate aux133199; + +use aux133199::FixedBitSet; + +fn main() { + FixedBitSet::<7>::new(); + //~^ ERROR +} diff --git a/tests/crashes/133275-1.rs b/tests/crashes/133275-1.rs new file mode 100644 index 00000000000..73c04f5d6e4 --- /dev/null +++ b/tests/crashes/133275-1.rs @@ -0,0 +1,13 @@ +//@ known-bug: #133275 +#![feature(const_trait_impl)] +#![feature(associated_type_defaults)] + +#[const_trait] +trait Foo3<T> +where + Self::Baz: Clone, +{ + type Baz = T; +} + +pub fn main() {} diff --git a/tests/crashes/133275-2.rs b/tests/crashes/133275-2.rs new file mode 100644 index 00000000000..a774b3cdb69 --- /dev/null +++ b/tests/crashes/133275-2.rs @@ -0,0 +1,15 @@ +//@ known-bug: #133275 +#![feature(const_trait_impl)] +#[const_trait] +pub trait Owo<X = <IntEnum as Uwu>::T> {} + +#[const_trait] +trait Foo3<T> +where + Self::Bar: Clone, + Self::Baz: Clone, +{ + type Bar = Vec<Self::Baz>; + type Baz = T; + //~^ ERROR the trait bound `T: Clone` is not satisfied +} diff --git a/tests/crashes/auxiliary/aux133199.rs b/tests/crashes/auxiliary/aux133199.rs new file mode 100644 index 00000000000..40765d92fbf --- /dev/null +++ b/tests/crashes/auxiliary/aux133199.rs @@ -0,0 +1,13 @@ +#![allow(incomplete_features)] +#![feature(generic_const_exprs)] + +pub struct FixedBitSet<const N: usize>; + +impl<const N: usize> FixedBitSet<N> +where + [u8; N.div_ceil(8)]: Sized, +{ + pub fn new() -> Self { + todo!() + } +} diff --git a/tests/mir-opt/async_closure_shims.main-{closure#0}-{closure#0}-{closure#0}.built.after.mir b/tests/mir-opt/async_closure_shims.main-{closure#0}-{closure#0}-{closure#0}.built.after.mir index 7da33b8a094..8a584853e00 100644 --- a/tests/mir-opt/async_closure_shims.main-{closure#0}-{closure#0}-{closure#0}.built.after.mir +++ b/tests/mir-opt/async_closure_shims.main-{closure#0}-{closure#0}-{closure#0}.built.after.mir @@ -1,6 +1,6 @@ // MIR for `main::{closure#0}::{closure#0}::{closure#0}` after built -fn main::{closure#0}::{closure#0}::{closure#0}(_1: {async closure body@$DIR/async_closure_shims.rs:54:53: 57:10}, _2: ResumeTy) -> () +fn main::{closure#0}::{closure#0}::{closure#0}(_1: {async closure body@$DIR/async_closure_shims.rs:53:53: 56:10}, _2: ResumeTy) -> () yields () { debug _task_context => _2; diff --git a/tests/mir-opt/async_closure_shims.main-{closure#0}-{closure#0}-{closure#1}.built.after.mir b/tests/mir-opt/async_closure_shims.main-{closure#0}-{closure#0}-{closure#1}.built.after.mir index a21e82ef5b6..a9e08d2e8f6 100644 --- a/tests/mir-opt/async_closure_shims.main-{closure#0}-{closure#0}-{closure#1}.built.after.mir +++ b/tests/mir-opt/async_closure_shims.main-{closure#0}-{closure#0}-{closure#1}.built.after.mir @@ -1,6 +1,6 @@ // MIR for `main::{closure#0}::{closure#0}::{closure#1}` after built -fn main::{closure#0}::{closure#0}::{closure#1}(_1: {async closure body@$DIR/async_closure_shims.rs:54:53: 57:10}, _2: ResumeTy) -> () +fn main::{closure#0}::{closure#0}::{closure#1}(_1: {async closure body@$DIR/async_closure_shims.rs:53:53: 56:10}, _2: ResumeTy) -> () yields () { debug _task_context => _2; diff --git a/tests/mir-opt/async_closure_shims.main-{closure#0}-{closure#0}.coroutine_closure_by_move.0.mir b/tests/mir-opt/async_closure_shims.main-{closure#0}-{closure#0}.coroutine_closure_by_move.0.mir index c1566360995..a984845fd2c 100644 --- a/tests/mir-opt/async_closure_shims.main-{closure#0}-{closure#0}.coroutine_closure_by_move.0.mir +++ b/tests/mir-opt/async_closure_shims.main-{closure#0}-{closure#0}.coroutine_closure_by_move.0.mir @@ -1,10 +1,10 @@ // MIR for `main::{closure#0}::{closure#0}` 0 coroutine_closure_by_move -fn main::{closure#0}::{closure#0}(_1: {async closure@$DIR/async_closure_shims.rs:54:33: 54:52}, _2: i32) -> {async closure body@$DIR/async_closure_shims.rs:54:53: 57:10} { - let mut _0: {async closure body@$DIR/async_closure_shims.rs:54:53: 57:10}; +fn main::{closure#0}::{closure#0}(_1: {async closure@$DIR/async_closure_shims.rs:53:33: 53:52}, _2: i32) -> {async closure body@$DIR/async_closure_shims.rs:53:53: 56:10} { + let mut _0: {async closure body@$DIR/async_closure_shims.rs:53:53: 56:10}; bb0: { - _0 = {coroutine@$DIR/async_closure_shims.rs:54:53: 57:10 (#0)} { a: move _2, b: move (_1.0: i32) }; + _0 = {coroutine@$DIR/async_closure_shims.rs:53:53: 56:10 (#0)} { a: move _2, b: move (_1.0: i32) }; return; } } diff --git a/tests/mir-opt/async_closure_shims.main-{closure#0}-{closure#1}-{closure#0}.built.after.mir b/tests/mir-opt/async_closure_shims.main-{closure#0}-{closure#1}-{closure#0}.built.after.mir index a4a6a535a23..c6721085eb2 100644 --- a/tests/mir-opt/async_closure_shims.main-{closure#0}-{closure#1}-{closure#0}.built.after.mir +++ b/tests/mir-opt/async_closure_shims.main-{closure#0}-{closure#1}-{closure#0}.built.after.mir @@ -1,6 +1,6 @@ // MIR for `main::{closure#0}::{closure#1}::{closure#0}` after built -fn main::{closure#0}::{closure#1}::{closure#0}(_1: {async closure body@$DIR/async_closure_shims.rs:63:48: 66:10}, _2: ResumeTy) -> () +fn main::{closure#0}::{closure#1}::{closure#0}(_1: {async closure body@$DIR/async_closure_shims.rs:62:48: 65:10}, _2: ResumeTy) -> () yields () { debug _task_context => _2; diff --git a/tests/mir-opt/async_closure_shims.main-{closure#0}-{closure#1}-{closure#1}.built.after.mir b/tests/mir-opt/async_closure_shims.main-{closure#0}-{closure#1}-{closure#1}.built.after.mir index 69bba6f5194..4452ae7812e 100644 --- a/tests/mir-opt/async_closure_shims.main-{closure#0}-{closure#1}-{closure#1}.built.after.mir +++ b/tests/mir-opt/async_closure_shims.main-{closure#0}-{closure#1}-{closure#1}.built.after.mir @@ -1,6 +1,6 @@ // MIR for `main::{closure#0}::{closure#1}::{closure#1}` after built -fn main::{closure#0}::{closure#1}::{closure#1}(_1: {async closure body@$DIR/async_closure_shims.rs:63:48: 66:10}, _2: ResumeTy) -> () +fn main::{closure#0}::{closure#1}::{closure#1}(_1: {async closure body@$DIR/async_closure_shims.rs:62:48: 65:10}, _2: ResumeTy) -> () yields () { debug _task_context => _2; diff --git a/tests/mir-opt/async_closure_shims.main-{closure#0}-{closure#1}.coroutine_closure_by_move.0.mir b/tests/mir-opt/async_closure_shims.main-{closure#0}-{closure#1}.coroutine_closure_by_move.0.mir index 134fe145bae..aab9f7b03b9 100644 --- a/tests/mir-opt/async_closure_shims.main-{closure#0}-{closure#1}.coroutine_closure_by_move.0.mir +++ b/tests/mir-opt/async_closure_shims.main-{closure#0}-{closure#1}.coroutine_closure_by_move.0.mir @@ -1,10 +1,10 @@ // MIR for `main::{closure#0}::{closure#1}` 0 coroutine_closure_by_move -fn main::{closure#0}::{closure#1}(_1: {async closure@$DIR/async_closure_shims.rs:63:33: 63:47}, _2: i32) -> {async closure body@$DIR/async_closure_shims.rs:63:48: 66:10} { - let mut _0: {async closure body@$DIR/async_closure_shims.rs:63:48: 66:10}; +fn main::{closure#0}::{closure#1}(_1: {async closure@$DIR/async_closure_shims.rs:62:33: 62:47}, _2: i32) -> {async closure body@$DIR/async_closure_shims.rs:62:48: 65:10} { + let mut _0: {async closure body@$DIR/async_closure_shims.rs:62:48: 65:10}; bb0: { - _0 = {coroutine@$DIR/async_closure_shims.rs:63:48: 66:10 (#0)} { a: move _2, b: move (_1.0: &i32) }; + _0 = {coroutine@$DIR/async_closure_shims.rs:62:48: 65:10 (#0)} { a: move _2, b: move (_1.0: &i32) }; return; } } diff --git a/tests/mir-opt/async_closure_shims.main-{closure#0}-{closure#1}.coroutine_closure_by_ref.0.mir b/tests/mir-opt/async_closure_shims.main-{closure#0}-{closure#1}.coroutine_closure_by_ref.0.mir index f267d93bd60..3fdc81791de 100644 --- a/tests/mir-opt/async_closure_shims.main-{closure#0}-{closure#1}.coroutine_closure_by_ref.0.mir +++ b/tests/mir-opt/async_closure_shims.main-{closure#0}-{closure#1}.coroutine_closure_by_ref.0.mir @@ -1,10 +1,10 @@ // MIR for `main::{closure#0}::{closure#1}` 0 coroutine_closure_by_ref -fn main::{closure#0}::{closure#1}(_1: &{async closure@$DIR/async_closure_shims.rs:63:33: 63:47}, _2: i32) -> {async closure body@$DIR/async_closure_shims.rs:63:48: 66:10} { - let mut _0: {async closure body@$DIR/async_closure_shims.rs:63:48: 66:10}; +fn main::{closure#0}::{closure#1}(_1: &{async closure@$DIR/async_closure_shims.rs:62:33: 62:47}, _2: i32) -> {async closure body@$DIR/async_closure_shims.rs:62:48: 65:10} { + let mut _0: {async closure body@$DIR/async_closure_shims.rs:62:48: 65:10}; bb0: { - _0 = {coroutine@$DIR/async_closure_shims.rs:63:48: 66:10 (#0)} { a: move _2, b: copy ((*_1).0: &i32) }; + _0 = {coroutine@$DIR/async_closure_shims.rs:62:48: 65:10 (#0)} { a: move _2, b: copy ((*_1).0: &i32) }; return; } } diff --git a/tests/mir-opt/async_closure_shims.rs b/tests/mir-opt/async_closure_shims.rs index f28400e298f..cd2e83e939a 100644 --- a/tests/mir-opt/async_closure_shims.rs +++ b/tests/mir-opt/async_closure_shims.rs @@ -1,7 +1,6 @@ //@ edition:2021 // skip-filecheck -#![feature(async_closure, async_fn_traits)] #![allow(unused)] use std::future::Future; diff --git a/tests/mir-opt/inline/inline_coroutine.main.Inline.panic-abort.diff b/tests/mir-opt/inline/inline_coroutine.main.Inline.panic-abort.diff index 94017f028cc..56d4d50e967 100644 --- a/tests/mir-opt/inline/inline_coroutine.main.Inline.panic-abort.diff +++ b/tests/mir-opt/inline/inline_coroutine.main.Inline.panic-abort.diff @@ -16,7 +16,6 @@ + scope 3 (inlined Pin::<&mut {coroutine@$DIR/inline_coroutine.rs:20:5: 20:8}>::new) { + debug pointer => _3; + scope 4 (inlined Pin::<&mut {coroutine@$DIR/inline_coroutine.rs:20:5: 20:8}>::new_unchecked) { -+ debug pointer => _3; + } + } + scope 5 (inlined g::{closure#0}) { diff --git a/tests/mir-opt/inline/inline_coroutine.main.Inline.panic-unwind.diff b/tests/mir-opt/inline/inline_coroutine.main.Inline.panic-unwind.diff index 858f9ace9b4..751916a00f1 100644 --- a/tests/mir-opt/inline/inline_coroutine.main.Inline.panic-unwind.diff +++ b/tests/mir-opt/inline/inline_coroutine.main.Inline.panic-unwind.diff @@ -16,7 +16,6 @@ + scope 3 (inlined Pin::<&mut {coroutine@$DIR/inline_coroutine.rs:20:5: 20:8}>::new) { + debug pointer => _3; + scope 4 (inlined Pin::<&mut {coroutine@$DIR/inline_coroutine.rs:20:5: 20:8}>::new_unchecked) { -+ debug pointer => _3; + } + } + scope 5 (inlined g::{closure#0}) { diff --git a/tests/mir-opt/pre-codegen/vec_deref.vec_deref_to_slice.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/vec_deref.vec_deref_to_slice.PreCodegen.after.panic-abort.mir index 2efbb6d9904..3f0d60b46f4 100644 --- a/tests/mir-opt/pre-codegen/vec_deref.vec_deref_to_slice.PreCodegen.after.panic-abort.mir +++ b/tests/mir-opt/pre-codegen/vec_deref.vec_deref_to_slice.PreCodegen.after.panic-abort.mir @@ -7,48 +7,36 @@ fn vec_deref_to_slice(_1: &Vec<u8>) -> &[u8] { debug self => _1; scope 2 (inlined Vec::<u8>::as_slice) { debug self => _1; - let mut _9: *const u8; - let mut _10: usize; + let mut _7: *const u8; + let mut _8: usize; scope 3 (inlined Vec::<u8>::as_ptr) { debug self => _1; - let mut _2: &alloc::raw_vec::RawVec<u8>; - let mut _8: *mut u8; + let mut _6: *mut u8; scope 4 (inlined alloc::raw_vec::RawVec::<u8>::ptr) { - debug self => _2; - let mut _3: &alloc::raw_vec::RawVecInner; scope 5 (inlined alloc::raw_vec::RawVecInner::ptr::<u8>) { - debug self => _3; - let mut _7: std::ptr::NonNull<u8>; + let mut _5: std::ptr::NonNull<u8>; scope 6 (inlined alloc::raw_vec::RawVecInner::non_null::<u8>) { - debug self => _3; - let mut _4: std::ptr::NonNull<u8>; + let mut _2: std::ptr::NonNull<u8>; scope 7 (inlined Unique::<u8>::cast::<u8>) { - debug ((self: Unique<u8>).0: std::ptr::NonNull<u8>) => _4; - debug ((self: Unique<u8>).1: std::marker::PhantomData<u8>) => const PhantomData::<u8>; scope 8 (inlined NonNull::<u8>::cast::<u8>) { - debug self => _4; - let mut _5: *mut u8; - let mut _6: *const u8; + let mut _3: *mut u8; + let mut _4: *const u8; scope 9 (inlined NonNull::<u8>::as_ptr) { - debug self => _4; } } } scope 10 (inlined Unique::<u8>::as_non_null_ptr) { - debug ((self: Unique<u8>).0: std::ptr::NonNull<u8>) => _7; - debug ((self: Unique<u8>).1: std::marker::PhantomData<u8>) => const PhantomData::<u8>; } } scope 11 (inlined NonNull::<u8>::as_ptr) { - debug self => _7; } } } } scope 12 (inlined std::slice::from_raw_parts::<'_, u8>) { - debug data => _9; - debug len => _10; - let _11: *const [u8]; + debug data => _7; + debug len => _8; + let _9: *const [u8]; scope 13 (inlined core::ub_checks::check_language_ub) { scope 14 (inlined core::ub_checks::check_language_ub::runtime) { } @@ -58,11 +46,10 @@ fn vec_deref_to_slice(_1: &Vec<u8>) -> &[u8] { scope 16 (inlined align_of::<u8>) { } scope 17 (inlined slice_from_raw_parts::<u8>) { - debug data => _9; - debug len => _10; + debug data => _7; + debug len => _8; scope 18 (inlined std::ptr::from_raw_parts::<[u8], u8>) { - debug data_pointer => _9; - debug metadata => _10; + debug data_pointer => _7; } } } @@ -70,37 +57,31 @@ fn vec_deref_to_slice(_1: &Vec<u8>) -> &[u8] { } bb0: { - StorageLive(_8); - StorageLive(_9); + StorageLive(_6); + StorageLive(_7); + StorageLive(_5); StorageLive(_2); - _2 = &((*_1).0: alloc::raw_vec::RawVec<u8>); + _2 = copy (((((*_1).0: alloc::raw_vec::RawVec<u8>).0: alloc::raw_vec::RawVecInner).0: std::ptr::Unique<u8>).0: std::ptr::NonNull<u8>); StorageLive(_3); - _3 = &(((*_1).0: alloc::raw_vec::RawVec<u8>).0: alloc::raw_vec::RawVecInner); - StorageLive(_7); StorageLive(_4); - _4 = copy (((((*_1).0: alloc::raw_vec::RawVec<u8>).0: alloc::raw_vec::RawVecInner).0: std::ptr::Unique<u8>).0: std::ptr::NonNull<u8>); - StorageLive(_5); - StorageLive(_6); - _5 = copy _4 as *mut u8 (Transmute); - _6 = copy _5 as *const u8 (PtrToPtr); - _7 = NonNull::<u8> { pointer: move _6 }; - StorageDead(_6); - StorageDead(_5); + _3 = copy _2 as *mut u8 (Transmute); + _4 = copy _3 as *const u8 (PtrToPtr); + _5 = NonNull::<u8> { pointer: move _4 }; StorageDead(_4); - _8 = copy _7 as *mut u8 (Transmute); - StorageDead(_7); StorageDead(_3); - _9 = copy _8 as *const u8 (PtrToPtr); StorageDead(_2); - StorageLive(_10); - _10 = copy ((*_1).1: usize); - StorageLive(_11); - _11 = *const [u8] from (copy _9, copy _10); - _0 = &(*_11); - StorageDead(_11); - StorageDead(_10); + _6 = copy _5 as *mut u8 (Transmute); + StorageDead(_5); + _7 = copy _6 as *const u8 (PtrToPtr); + StorageLive(_8); + _8 = copy ((*_1).1: usize); + StorageLive(_9); + _9 = *const [u8] from (copy _7, copy _8); + _0 = &(*_9); StorageDead(_9); StorageDead(_8); + StorageDead(_7); + StorageDead(_6); return; } } diff --git a/tests/mir-opt/pre-codegen/vec_deref.vec_deref_to_slice.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/vec_deref.vec_deref_to_slice.PreCodegen.after.panic-unwind.mir index 2efbb6d9904..3f0d60b46f4 100644 --- a/tests/mir-opt/pre-codegen/vec_deref.vec_deref_to_slice.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/vec_deref.vec_deref_to_slice.PreCodegen.after.panic-unwind.mir @@ -7,48 +7,36 @@ fn vec_deref_to_slice(_1: &Vec<u8>) -> &[u8] { debug self => _1; scope 2 (inlined Vec::<u8>::as_slice) { debug self => _1; - let mut _9: *const u8; - let mut _10: usize; + let mut _7: *const u8; + let mut _8: usize; scope 3 (inlined Vec::<u8>::as_ptr) { debug self => _1; - let mut _2: &alloc::raw_vec::RawVec<u8>; - let mut _8: *mut u8; + let mut _6: *mut u8; scope 4 (inlined alloc::raw_vec::RawVec::<u8>::ptr) { - debug self => _2; - let mut _3: &alloc::raw_vec::RawVecInner; scope 5 (inlined alloc::raw_vec::RawVecInner::ptr::<u8>) { - debug self => _3; - let mut _7: std::ptr::NonNull<u8>; + let mut _5: std::ptr::NonNull<u8>; scope 6 (inlined alloc::raw_vec::RawVecInner::non_null::<u8>) { - debug self => _3; - let mut _4: std::ptr::NonNull<u8>; + let mut _2: std::ptr::NonNull<u8>; scope 7 (inlined Unique::<u8>::cast::<u8>) { - debug ((self: Unique<u8>).0: std::ptr::NonNull<u8>) => _4; - debug ((self: Unique<u8>).1: std::marker::PhantomData<u8>) => const PhantomData::<u8>; scope 8 (inlined NonNull::<u8>::cast::<u8>) { - debug self => _4; - let mut _5: *mut u8; - let mut _6: *const u8; + let mut _3: *mut u8; + let mut _4: *const u8; scope 9 (inlined NonNull::<u8>::as_ptr) { - debug self => _4; } } } scope 10 (inlined Unique::<u8>::as_non_null_ptr) { - debug ((self: Unique<u8>).0: std::ptr::NonNull<u8>) => _7; - debug ((self: Unique<u8>).1: std::marker::PhantomData<u8>) => const PhantomData::<u8>; } } scope 11 (inlined NonNull::<u8>::as_ptr) { - debug self => _7; } } } } scope 12 (inlined std::slice::from_raw_parts::<'_, u8>) { - debug data => _9; - debug len => _10; - let _11: *const [u8]; + debug data => _7; + debug len => _8; + let _9: *const [u8]; scope 13 (inlined core::ub_checks::check_language_ub) { scope 14 (inlined core::ub_checks::check_language_ub::runtime) { } @@ -58,11 +46,10 @@ fn vec_deref_to_slice(_1: &Vec<u8>) -> &[u8] { scope 16 (inlined align_of::<u8>) { } scope 17 (inlined slice_from_raw_parts::<u8>) { - debug data => _9; - debug len => _10; + debug data => _7; + debug len => _8; scope 18 (inlined std::ptr::from_raw_parts::<[u8], u8>) { - debug data_pointer => _9; - debug metadata => _10; + debug data_pointer => _7; } } } @@ -70,37 +57,31 @@ fn vec_deref_to_slice(_1: &Vec<u8>) -> &[u8] { } bb0: { - StorageLive(_8); - StorageLive(_9); + StorageLive(_6); + StorageLive(_7); + StorageLive(_5); StorageLive(_2); - _2 = &((*_1).0: alloc::raw_vec::RawVec<u8>); + _2 = copy (((((*_1).0: alloc::raw_vec::RawVec<u8>).0: alloc::raw_vec::RawVecInner).0: std::ptr::Unique<u8>).0: std::ptr::NonNull<u8>); StorageLive(_3); - _3 = &(((*_1).0: alloc::raw_vec::RawVec<u8>).0: alloc::raw_vec::RawVecInner); - StorageLive(_7); StorageLive(_4); - _4 = copy (((((*_1).0: alloc::raw_vec::RawVec<u8>).0: alloc::raw_vec::RawVecInner).0: std::ptr::Unique<u8>).0: std::ptr::NonNull<u8>); - StorageLive(_5); - StorageLive(_6); - _5 = copy _4 as *mut u8 (Transmute); - _6 = copy _5 as *const u8 (PtrToPtr); - _7 = NonNull::<u8> { pointer: move _6 }; - StorageDead(_6); - StorageDead(_5); + _3 = copy _2 as *mut u8 (Transmute); + _4 = copy _3 as *const u8 (PtrToPtr); + _5 = NonNull::<u8> { pointer: move _4 }; StorageDead(_4); - _8 = copy _7 as *mut u8 (Transmute); - StorageDead(_7); StorageDead(_3); - _9 = copy _8 as *const u8 (PtrToPtr); StorageDead(_2); - StorageLive(_10); - _10 = copy ((*_1).1: usize); - StorageLive(_11); - _11 = *const [u8] from (copy _9, copy _10); - _0 = &(*_11); - StorageDead(_11); - StorageDead(_10); + _6 = copy _5 as *mut u8 (Transmute); + StorageDead(_5); + _7 = copy _6 as *const u8 (PtrToPtr); + StorageLive(_8); + _8 = copy ((*_1).1: usize); + StorageLive(_9); + _9 = *const [u8] from (copy _7, copy _8); + _0 = &(*_9); StorageDead(_9); StorageDead(_8); + StorageDead(_7); + StorageDead(_6); return; } } diff --git a/tests/mir-opt/strip_debuginfo.rs b/tests/mir-opt/strip_debuginfo.rs new file mode 100644 index 00000000000..310609e1e9d --- /dev/null +++ b/tests/mir-opt/strip_debuginfo.rs @@ -0,0 +1,39 @@ +//@ revisions: NONE TINY ALL +//@[NONE] compile-flags: -Zmir_strip_debuginfo=none +//@[TINY] compile-flags: -Zmir_strip_debuginfo=locals-in-tiny-functions +//@[ALL] compile-flags: -Zmir_strip_debuginfo=all-locals + +// CHECK: fn tiny_function +fn tiny_function(end: u32) -> u32 { + // CHECK: debug end => _1; + // NONE: debug a => + // NONE: debug b => + // TINY-NOT: debug a => + // TINY-NOT: debug b => + // ALL-NOT: debug a => + // ALL-NOT: debug b => + let a = !end; + let b = a ^ 1; + b +} + +#[inline(never)] +fn opaque(_: u32) {} + +// CHECK: fn looping_function +fn looping_function(end: u32) { + // CHECK: debug end => _1; + // NONE: debug i => + // NONE: debug x => + // TINY: debug i => + // TINY: debug x => + // ALL-NOT: debug i => + // ALL-NOT: debug x => + let mut i = 0; + while i < end { + let x = i ^ 1; + opaque(x); + } +} + +fn main() {} diff --git a/tests/run-make/const-trait-stable-toolchain/const-super-trait-nightly-disabled.stderr b/tests/run-make/const-trait-stable-toolchain/const-super-trait-nightly-disabled.stderr new file mode 100644 index 00000000000..596f7c510be --- /dev/null +++ b/tests/run-make/const-trait-stable-toolchain/const-super-trait-nightly-disabled.stderr @@ -0,0 +1,66 @@ +error: `~const` is not allowed here + --> const-super-trait.rs:7:12 + | +LL | trait Bar: ~const Foo {} + | ^^^^^^ + | +note: this trait is not a `#[const_trait]`, so it cannot have `~const` trait bounds + --> const-super-trait.rs:7:1 + | +LL | trait Bar: ~const Foo {} + | ^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0658]: const trait impls are experimental + --> const-super-trait.rs:7:12 + | +LL | trait Bar: ~const Foo {} + | ^^^^^^ + | + = note: see issue #67792 <https://github.com/rust-lang/rust/issues/67792> 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 + --> const-super-trait.rs:9:17 + | +LL | const fn foo<T: ~const Bar>(x: &T) { + | ^^^^^^ + | + = note: see issue #67792 <https://github.com/rust-lang/rust/issues/67792> 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: `~const` can only be applied to `#[const_trait]` traits + --> const-super-trait.rs:7:12 + | +LL | trait Bar: ~const Foo {} + | ^^^^^^ can't be applied to `Foo` + | +help: enable `#![feature(const_trait_impl)]` in your crate and mark `Foo` as `#[const_trait]` to allow it to have `const` implementations + | +LL | #[const_trait] trait Foo { + | ++++++++++++++ + +error: `~const` can only be applied to `#[const_trait]` traits + --> const-super-trait.rs:9:17 + | +LL | const fn foo<T: ~const Bar>(x: &T) { + | ^^^^^^ can't be applied to `Bar` + | +help: enable `#![feature(const_trait_impl)]` in your crate and mark `Bar` as `#[const_trait]` to allow it to have `const` implementations + | +LL | #[const_trait] trait Bar: ~const Foo {} + | ++++++++++++++ + +error[E0015]: cannot call non-const fn `<T as Foo>::a` in constant functions + --> const-super-trait.rs:10:7 + | +LL | x.a(); + | ^^^ + | + = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants + +error: aborting due to 6 previous errors + +Some errors have detailed explanations: E0015, E0658. +For more information about an error, try `rustc --explain E0015`. diff --git a/tests/run-make/const-trait-stable-toolchain/const-super-trait-nightly-enabled.stderr b/tests/run-make/const-trait-stable-toolchain/const-super-trait-nightly-enabled.stderr new file mode 100644 index 00000000000..7235278d1bd --- /dev/null +++ b/tests/run-make/const-trait-stable-toolchain/const-super-trait-nightly-enabled.stderr @@ -0,0 +1,45 @@ +error: `~const` is not allowed here + --> const-super-trait.rs:7:12 + | +LL | trait Bar: ~const Foo {} + | ^^^^^^ + | +note: this trait is not a `#[const_trait]`, so it cannot have `~const` trait bounds + --> const-super-trait.rs:7:1 + | +LL | trait Bar: ~const Foo {} + | ^^^^^^^^^^^^^^^^^^^^^^^^ + +error: `~const` can only be applied to `#[const_trait]` traits + --> const-super-trait.rs:7:12 + | +LL | trait Bar: ~const Foo {} + | ^^^^^^ can't be applied to `Foo` + | +help: mark `Foo` as `#[const_trait]` to allow it to have `const` implementations + | +LL | #[const_trait] trait Foo { + | ++++++++++++++ + +error: `~const` can only be applied to `#[const_trait]` traits + --> const-super-trait.rs:9:17 + | +LL | const fn foo<T: ~const Bar>(x: &T) { + | ^^^^^^ can't be applied to `Bar` + | +help: mark `Bar` as `#[const_trait]` to allow it to have `const` implementations + | +LL | #[const_trait] trait Bar: ~const Foo {} + | ++++++++++++++ + +error[E0015]: cannot call non-const fn `<T as Foo>::a` in constant functions + --> const-super-trait.rs:10:7 + | +LL | x.a(); + | ^^^ + | + = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants + +error: aborting due to 4 previous errors + +For more information about this error, try `rustc --explain E0015`. diff --git a/tests/run-make/const-trait-stable-toolchain/const-super-trait-stable-disabled.stderr b/tests/run-make/const-trait-stable-toolchain/const-super-trait-stable-disabled.stderr new file mode 100644 index 00000000000..eacdaf5e369 --- /dev/null +++ b/tests/run-make/const-trait-stable-toolchain/const-super-trait-stable-disabled.stderr @@ -0,0 +1,64 @@ +error: `~const` is not allowed here + --> const-super-trait.rs:7:12 + | +7 | trait Bar: ~const Foo {} + | ^^^^^^ + | +note: this trait is not a `#[const_trait]`, so it cannot have `~const` trait bounds + --> const-super-trait.rs:7:1 + | +7 | trait Bar: ~const Foo {} + | ^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0658]: const trait impls are experimental + --> const-super-trait.rs:7:12 + | +7 | trait Bar: ~const Foo {} + | ^^^^^^ + | + = note: see issue #67792 <https://github.com/rust-lang/rust/issues/67792> for more information + +error[E0658]: const trait impls are experimental + --> const-super-trait.rs:9:17 + | +9 | const fn foo<T: ~const Bar>(x: &T) { + | ^^^^^^ + | + = note: see issue #67792 <https://github.com/rust-lang/rust/issues/67792> for more information + +error: `~const` can only be applied to `#[const_trait]` traits + --> const-super-trait.rs:7:12 + | +7 | trait Bar: ~const Foo {} + | ^^^^^^ can't be applied to `Foo` + | +note: `Foo` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> const-super-trait.rs:3:1 + | +3 | trait Foo { + | ^^^^^^^^^ + +error: `~const` can only be applied to `#[const_trait]` traits + --> const-super-trait.rs:9:17 + | +9 | const fn foo<T: ~const Bar>(x: &T) { + | ^^^^^^ can't be applied to `Bar` + | +note: `Bar` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> const-super-trait.rs:7:1 + | +7 | trait Bar: ~const Foo {} + | ^^^^^^^^^^^^^^^^^^^^^ + +error[E0015]: cannot call non-const fn `<T as Foo>::a` in constant functions + --> const-super-trait.rs:10:7 + | +10 | x.a(); + | ^^^ + | + = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants + +error: aborting due to 6 previous errors + +Some errors have detailed explanations: E0015, E0658. +For more information about an error, try `rustc --explain E0015`. diff --git a/tests/run-make/const-trait-stable-toolchain/const-super-trait-stable-enabled.stderr b/tests/run-make/const-trait-stable-toolchain/const-super-trait-stable-enabled.stderr new file mode 100644 index 00000000000..9ddec6e422c --- /dev/null +++ b/tests/run-make/const-trait-stable-toolchain/const-super-trait-stable-enabled.stderr @@ -0,0 +1,54 @@ +error: `~const` is not allowed here + --> const-super-trait.rs:7:12 + | +7 | trait Bar: ~const Foo {} + | ^^^^^^ + | +note: this trait is not a `#[const_trait]`, so it cannot have `~const` trait bounds + --> const-super-trait.rs:7:1 + | +7 | trait Bar: ~const Foo {} + | ^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0554]: `#![feature]` may not be used on the NIGHTLY release channel + --> const-super-trait.rs:1:30 + | +1 | #![cfg_attr(feature_enabled, feature(const_trait_impl))] + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: `~const` can only be applied to `#[const_trait]` traits + --> const-super-trait.rs:7:12 + | +7 | trait Bar: ~const Foo {} + | ^^^^^^ can't be applied to `Foo` + | +note: `Foo` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> const-super-trait.rs:3:1 + | +3 | trait Foo { + | ^^^^^^^^^ + +error: `~const` can only be applied to `#[const_trait]` traits + --> const-super-trait.rs:9:17 + | +9 | const fn foo<T: ~const Bar>(x: &T) { + | ^^^^^^ can't be applied to `Bar` + | +note: `Bar` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> const-super-trait.rs:7:1 + | +7 | trait Bar: ~const Foo {} + | ^^^^^^^^^^^^^^^^^^^^^ + +error[E0015]: cannot call non-const fn `<T as Foo>::a` in constant functions + --> const-super-trait.rs:10:7 + | +10 | x.a(); + | ^^^ + | + = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants + +error: aborting due to 5 previous errors + +Some errors have detailed explanations: E0015, E0554. +For more information about an error, try `rustc --explain E0015`. diff --git a/tests/run-make/const-trait-stable-toolchain/const-super-trait.rs b/tests/run-make/const-trait-stable-toolchain/const-super-trait.rs new file mode 100644 index 00000000000..b2ee96d79f7 --- /dev/null +++ b/tests/run-make/const-trait-stable-toolchain/const-super-trait.rs @@ -0,0 +1,13 @@ +#![cfg_attr(feature_enabled, feature(const_trait_impl))] + +trait Foo { + fn a(&self); +} + +trait Bar: ~const Foo {} + +const fn foo<T: ~const Bar>(x: &T) { + x.a(); +} + +fn main() {} diff --git a/tests/run-make/const-trait-stable-toolchain/rmake.rs b/tests/run-make/const-trait-stable-toolchain/rmake.rs new file mode 100644 index 00000000000..241de11ed59 --- /dev/null +++ b/tests/run-make/const-trait-stable-toolchain/rmake.rs @@ -0,0 +1,59 @@ +// Test output of const super trait errors in both stable and nightly. +// We don't want to provide suggestions on stable that only make sense in nightly. + +use run_make_support::{diff, rustc}; + +fn main() { + let out = rustc() + .input("const-super-trait.rs") + .env("RUSTC_BOOTSTRAP", "-1") + .cfg("feature_enabled") + .run_fail() + .assert_stderr_not_contains( + "as `#[const_trait]` to allow it to have `const` implementations", + ) + .stderr_utf8(); + diff() + .expected_file("const-super-trait-stable-enabled.stderr") + .normalize( + "may not be used on the .* release channel", + "may not be used on the NIGHTLY release channel", + ) + .actual_text("(rustc)", &out) + .run(); + let out = rustc() + .input("const-super-trait.rs") + .cfg("feature_enabled") + .ui_testing() + .run_fail() + .assert_stderr_not_contains("enable `#![feature(const_trait_impl)]` in your crate and mark") + .assert_stderr_contains("as `#[const_trait]` to allow it to have `const` implementations") + .stderr_utf8(); + diff() + .expected_file("const-super-trait-nightly-enabled.stderr") + .actual_text("(rustc)", &out) + .run(); + let out = rustc() + .input("const-super-trait.rs") + .env("RUSTC_BOOTSTRAP", "-1") + .run_fail() + .assert_stderr_not_contains("enable `#![feature(const_trait_impl)]` in your crate and mark") + .assert_stderr_not_contains( + "as `#[const_trait]` to allow it to have `const` implementations", + ) + .stderr_utf8(); + diff() + .expected_file("const-super-trait-stable-disabled.stderr") + .actual_text("(rustc)", &out) + .run(); + let out = rustc() + .input("const-super-trait.rs") + .ui_testing() + .run_fail() + .assert_stderr_contains("enable `#![feature(const_trait_impl)]` in your crate and mark") + .stderr_utf8(); + diff() + .expected_file("const-super-trait-nightly-disabled.stderr") + .actual_text("(rustc)", &out) + .run(); +} diff --git a/tests/run-make/libs-through-symlinks/Makefile b/tests/run-make/libs-through-symlinks/Makefile index 592eae663a4..c6ff566a0e8 100644 --- a/tests/run-make/libs-through-symlinks/Makefile +++ b/tests/run-make/libs-through-symlinks/Makefile @@ -3,10 +3,20 @@ include ../tools.mk # ignore-windows +# The option -n for the AIX ln command has a different purpose than it does +# on Linux. On Linux, the -n option is used to treat the destination path as +# normal file if it is a symbolic link to a directory, which is the default +# behavior of the AIX ln command. +ifeq ($(UNAME),AIX) +LN_FLAGS := -sf +else +LN_FLAGS := -nsf +endif + NAME := $(shell $(RUSTC) --print file-names foo.rs) all: mkdir -p $(TMPDIR)/outdir $(RUSTC) foo.rs -o $(TMPDIR)/outdir/$(NAME) - ln -nsf outdir/$(NAME) $(TMPDIR) + ln $(LN_FLAGS) outdir/$(NAME) $(TMPDIR) RUSTC_LOG=rustc_metadata::loader $(RUSTC) bar.rs diff --git a/tests/rustdoc/inline_cross/auxiliary/assoc_item_trait_bounds.rs b/tests/rustdoc/inline_cross/auxiliary/assoc_item_trait_bounds.rs index 56708ec9310..6ab3cc6f6fe 100644 --- a/tests/rustdoc/inline_cross/auxiliary/assoc_item_trait_bounds.rs +++ b/tests/rustdoc/inline_cross/auxiliary/assoc_item_trait_bounds.rs @@ -1,5 +1,3 @@ -#![feature(async_closure)] - use std::ops::AsyncFnMut; pub trait Main { diff --git a/tests/ui/alias-uninit-value.rs b/tests/ui/alias-uninit-value.rs deleted file mode 100644 index 0084a98e627..00000000000 --- a/tests/ui/alias-uninit-value.rs +++ /dev/null @@ -1,19 +0,0 @@ -//@ run-pass - -#![allow(non_camel_case_types)] -#![allow(dead_code)] - - - -// Regression test for issue #374 - - -enum sty { ty_nil, } - -struct RawT {struct_: sty, cname: Option<String>, hash: usize} - -fn mk_raw_ty(st: sty, cname: Option<String>) -> RawT { - return RawT {struct_: st, cname: cname, hash: 0}; -} - -pub fn main() { mk_raw_ty(sty::ty_nil, None::<String>); } diff --git a/tests/ui/allow-non-lint-warnings.rs b/tests/ui/allow-non-lint-warnings.rs deleted file mode 100644 index f8f5a78ebff..00000000000 --- a/tests/ui/allow-non-lint-warnings.rs +++ /dev/null @@ -1,8 +0,0 @@ -//@ compile-flags: -Awarnings -//@ check-pass - -#[derive()] -#[derive(Copy, Clone)] -pub struct Foo; - -pub fn main() {} diff --git a/tests/ui/artificial-block.rs b/tests/ui/artificial-block.rs deleted file mode 100644 index 037163b4174..00000000000 --- a/tests/ui/artificial-block.rs +++ /dev/null @@ -1,5 +0,0 @@ -//@ run-pass - -fn f() -> isize { { return 3; } } - -pub fn main() { assert_eq!(f(), 3); } diff --git a/tests/ui/as-precedence.rs b/tests/ui/as-precedence.rs deleted file mode 100644 index 5021a3b677f..00000000000 --- a/tests/ui/as-precedence.rs +++ /dev/null @@ -1,10 +0,0 @@ -//@ run-pass - -#[allow(unused_parens)] -fn main() { - assert_eq!(3 as usize * 3, 9); - assert_eq!(3 as (usize) * 3, 9); - assert_eq!(3 as (usize) / 3, 1); - assert_eq!(3 as usize + 3, 6); - assert_eq!(3 as (usize) + 3, 6); -} diff --git a/tests/ui/asm/aarch64/srcloc.new.stderr b/tests/ui/asm/aarch64/srcloc.new.stderr new file mode 100644 index 00000000000..b92a07e5fb1 --- /dev/null +++ b/tests/ui/asm/aarch64/srcloc.new.stderr @@ -0,0 +1,320 @@ +error: unrecognized instruction mnemonic + --> $DIR/srcloc.rs:15:15 + | +LL | asm!("invalid_instruction"); + | ^^^^^^^^^^^^^^^^^^^ + | +note: instantiated into assembly here + --> <inline asm>:1:2 + | +LL | invalid_instruction + | ^ + +error: unrecognized instruction mnemonic + --> $DIR/srcloc.rs:19:13 + | +LL | invalid_instruction + | ^^^^^^^^^^^^^^^^^^^ + | +note: instantiated into assembly here + --> <inline asm>:2:13 + | +LL | invalid_instruction + | ^ + +error: unrecognized instruction mnemonic + --> $DIR/srcloc.rs:24:13 + | +LL | invalid_instruction + | ^^^^^^^^^^^^^^^^^^^ + | +note: instantiated into assembly here + --> <inline asm>:2:13 + | +LL | invalid_instruction + | ^ + +error: unrecognized instruction mnemonic + --> $DIR/srcloc.rs:30:13 + | +LL | invalid_instruction + | ^^^^^^^^^^^^^^^^^^^ + | +note: instantiated into assembly here + --> <inline asm>:3:13 + | +LL | invalid_instruction + | ^ + +error: unrecognized instruction mnemonic + --> $DIR/srcloc.rs:37:13 + | +LL | invalid_instruction + | ^^^^^^^^^^^^^^^^^^^ + | +note: instantiated into assembly here + --> <inline asm>:3:13 + | +LL | invalid_instruction + | ^ + +error: unrecognized instruction mnemonic + --> $DIR/srcloc.rs:42:14 + | +LL | asm!(concat!("invalid", "_", "instruction")); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +note: instantiated into assembly here + --> <inline asm>:1:2 + | +LL | invalid_instruction + | ^ + +error: unrecognized instruction mnemonic + --> $DIR/srcloc.rs:46:14 + | +LL | "invalid_instruction", + | ^^^^^^^^^^^^^^^^^^^ + | +note: instantiated into assembly here + --> <inline asm>:1:2 + | +LL | invalid_instruction + | ^ + +error: unrecognized instruction mnemonic + --> $DIR/srcloc.rs:52:14 + | +LL | "invalid_instruction", + | ^^^^^^^^^^^^^^^^^^^ + | +note: instantiated into assembly here + --> <inline asm>:2:1 + | +LL | invalid_instruction + | ^ + +error: unrecognized instruction mnemonic + --> $DIR/srcloc.rs:59:14 + | +LL | "invalid_instruction", + | ^^^^^^^^^^^^^^^^^^^ + | +note: instantiated into assembly here + --> <inline asm>:3:1 + | +LL | invalid_instruction + | ^ + +error: unrecognized instruction mnemonic + --> $DIR/srcloc.rs:66:13 + | +LL | concat!("invalid", "_", "instruction"), + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +note: instantiated into assembly here + --> <inline asm>:2:1 + | +LL | invalid_instruction + | ^ + +error: unrecognized instruction mnemonic + --> $DIR/srcloc.rs:73:13 + | +LL | concat!("invalid", "_", "instruction"), + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +note: instantiated into assembly here + --> <inline asm>:2:1 + | +LL | invalid_instruction + | ^ + +error: unrecognized instruction mnemonic + --> $DIR/srcloc.rs:80:14 + | +LL | "invalid_instruction1", + | ^^^^^^^^^^^^^^^^^^^^ + | +note: instantiated into assembly here + --> <inline asm>:1:2 + | +LL | invalid_instruction1 + | ^ + +error: unrecognized instruction mnemonic + --> $DIR/srcloc.rs:81:14 + | +LL | "invalid_instruction2", + | ^^^^^^^^^^^^^^^^^^^^ + | +note: instantiated into assembly here + --> <inline asm>:2:1 + | +LL | invalid_instruction2 + | ^ + +error: unrecognized instruction mnemonic + --> $DIR/srcloc.rs:87:13 + | +LL | / concat!( +LL | | "invalid", "_", "instruction1", "\n", +LL | | "invalid", "_", "instruction2", +LL | | ), + | |_____________^ + | +note: instantiated into assembly here + --> <inline asm>:1:2 + | +LL | invalid_instruction1 + | ^ + +error: unrecognized instruction mnemonic + --> $DIR/srcloc.rs:87:13 + | +LL | / concat!( +LL | | "invalid", "_", "instruction1", "\n", +LL | | "invalid", "_", "instruction2", +LL | | ), + | |_____________^ + | +note: instantiated into assembly here + --> <inline asm>:2:1 + | +LL | invalid_instruction2 + | ^ + +error: unrecognized instruction mnemonic + --> $DIR/srcloc.rs:96:13 + | +LL | / concat!( +LL | | "invalid", "_", "instruction1", "\n", +LL | | "invalid", "_", "instruction2", +LL | | ), + | |_____________^ + | +note: instantiated into assembly here + --> <inline asm>:1:2 + | +LL | invalid_instruction1 + | ^ + +error: unrecognized instruction mnemonic + --> $DIR/srcloc.rs:96:13 + | +LL | / concat!( +LL | | "invalid", "_", "instruction1", "\n", +LL | | "invalid", "_", "instruction2", +LL | | ), + | |_____________^ + | +note: instantiated into assembly here + --> <inline asm>:2:1 + | +LL | invalid_instruction2 + | ^ + +error: unrecognized instruction mnemonic + --> $DIR/srcloc.rs:100:13 + | +LL | / concat!( +LL | | "invalid", "_", "instruction3", "\n", +LL | | "invalid", "_", "instruction4", +LL | | ), + | |_____________^ + | +note: instantiated into assembly here + --> <inline asm>:3:1 + | +LL | invalid_instruction3 + | ^ + +error: unrecognized instruction mnemonic + --> $DIR/srcloc.rs:100:13 + | +LL | / concat!( +LL | | "invalid", "_", "instruction3", "\n", +LL | | "invalid", "_", "instruction4", +LL | | ), + | |_____________^ + | +note: instantiated into assembly here + --> <inline asm>:4:1 + | +LL | invalid_instruction4 + | ^ + +error: unrecognized instruction mnemonic + --> $DIR/srcloc.rs:111:13 + | +LL | / concat!( +LL | | "invalid", "_", "instruction1", "\n", +LL | | "invalid", "_", "instruction2", "\n", +LL | | ), + | |_____________^ + | +note: instantiated into assembly here + --> <inline asm>:1:2 + | +LL | invalid_instruction1 + | ^ + +error: unrecognized instruction mnemonic + --> $DIR/srcloc.rs:111:13 + | +LL | / concat!( +LL | | "invalid", "_", "instruction1", "\n", +LL | | "invalid", "_", "instruction2", "\n", +LL | | ), + | |_____________^ + | +note: instantiated into assembly here + --> <inline asm>:2:1 + | +LL | invalid_instruction2 + | ^ + +error: unrecognized instruction mnemonic + --> $DIR/srcloc.rs:115:13 + | +LL | / concat!( +LL | | "invalid", "_", "instruction3", "\n", +LL | | "invalid", "_", "instruction4", "\n", +LL | | ), + | |_____________^ + | +note: instantiated into assembly here + --> <inline asm>:4:1 + | +LL | invalid_instruction3 + | ^ + +error: unrecognized instruction mnemonic + --> $DIR/srcloc.rs:115:13 + | +LL | / concat!( +LL | | "invalid", "_", "instruction3", "\n", +LL | | "invalid", "_", "instruction4", "\n", +LL | | ), + | |_____________^ + | +note: instantiated into assembly here + --> <inline asm>:5:1 + | +LL | invalid_instruction4 + | ^ + +error: unrecognized instruction mnemonic + --> $DIR/srcloc.rs:128:14 + | +LL | "invalid_instruction" + | ^^^^^^^^^^^^^^^^^^^ + | +note: instantiated into assembly here + --> <inline asm>:4:1 + | +LL | invalid_instruction + | ^ + +error: aborting due to 24 previous errors + diff --git a/tests/ui/asm/aarch64/srcloc.stderr b/tests/ui/asm/aarch64/srcloc.old.stderr index 2e17b60b912..2a15e48f025 100644 --- a/tests/ui/asm/aarch64/srcloc.stderr +++ b/tests/ui/asm/aarch64/srcloc.old.stderr @@ -1,5 +1,5 @@ error: unrecognized instruction mnemonic - --> $DIR/srcloc.rs:12:15 + --> $DIR/srcloc.rs:15:15 | LL | asm!("invalid_instruction"); | ^ @@ -11,7 +11,7 @@ LL | invalid_instruction | ^ error: unrecognized instruction mnemonic - --> $DIR/srcloc.rs:16:13 + --> $DIR/srcloc.rs:19:13 | LL | invalid_instruction | ^ @@ -23,7 +23,7 @@ LL | invalid_instruction | ^ error: unrecognized instruction mnemonic - --> $DIR/srcloc.rs:21:13 + --> $DIR/srcloc.rs:24:13 | LL | invalid_instruction | ^ @@ -35,7 +35,7 @@ LL | invalid_instruction | ^ error: unrecognized instruction mnemonic - --> $DIR/srcloc.rs:27:13 + --> $DIR/srcloc.rs:30:13 | LL | invalid_instruction | ^ @@ -47,7 +47,7 @@ LL | invalid_instruction | ^ error: unrecognized instruction mnemonic - --> $DIR/srcloc.rs:34:13 + --> $DIR/srcloc.rs:37:13 | LL | invalid_instruction | ^ @@ -59,7 +59,7 @@ LL | invalid_instruction | ^ error: unrecognized instruction mnemonic - --> $DIR/srcloc.rs:39:14 + --> $DIR/srcloc.rs:42:14 | LL | asm!(concat!("invalid", "_", "instruction")); | ^ @@ -71,7 +71,7 @@ LL | invalid_instruction | ^ error: unrecognized instruction mnemonic - --> $DIR/srcloc.rs:43:14 + --> $DIR/srcloc.rs:46:14 | LL | "invalid_instruction", | ^ @@ -83,7 +83,7 @@ LL | invalid_instruction | ^ error: unrecognized instruction mnemonic - --> $DIR/srcloc.rs:49:14 + --> $DIR/srcloc.rs:52:14 | LL | "invalid_instruction", | ^ @@ -95,7 +95,7 @@ LL | invalid_instruction | ^ error: unrecognized instruction mnemonic - --> $DIR/srcloc.rs:56:14 + --> $DIR/srcloc.rs:59:14 | LL | "invalid_instruction", | ^ @@ -107,7 +107,7 @@ LL | invalid_instruction | ^ error: unrecognized instruction mnemonic - --> $DIR/srcloc.rs:63:13 + --> $DIR/srcloc.rs:66:13 | LL | concat!("invalid", "_", "instruction"), | ^ @@ -119,7 +119,7 @@ LL | invalid_instruction | ^ error: unrecognized instruction mnemonic - --> $DIR/srcloc.rs:70:13 + --> $DIR/srcloc.rs:73:13 | LL | concat!("invalid", "_", "instruction"), | ^ @@ -131,7 +131,7 @@ LL | invalid_instruction | ^ error: unrecognized instruction mnemonic - --> $DIR/srcloc.rs:77:14 + --> $DIR/srcloc.rs:80:14 | LL | "invalid_instruction1", | ^ @@ -143,7 +143,7 @@ LL | invalid_instruction1 | ^ error: unrecognized instruction mnemonic - --> $DIR/srcloc.rs:78:14 + --> $DIR/srcloc.rs:81:14 | LL | "invalid_instruction2", | ^ @@ -155,7 +155,7 @@ LL | invalid_instruction2 | ^ error: unrecognized instruction mnemonic - --> $DIR/srcloc.rs:84:13 + --> $DIR/srcloc.rs:87:13 | LL | concat!( | ^ @@ -167,7 +167,7 @@ LL | invalid_instruction1 | ^ error: unrecognized instruction mnemonic - --> $DIR/srcloc.rs:84:13 + --> $DIR/srcloc.rs:87:13 | LL | concat!( | ^ @@ -179,7 +179,7 @@ LL | invalid_instruction2 | ^ error: unrecognized instruction mnemonic - --> $DIR/srcloc.rs:93:13 + --> $DIR/srcloc.rs:96:13 | LL | concat!( | ^ @@ -191,7 +191,7 @@ LL | invalid_instruction1 | ^ error: unrecognized instruction mnemonic - --> $DIR/srcloc.rs:93:13 + --> $DIR/srcloc.rs:96:13 | LL | concat!( | ^ @@ -203,7 +203,7 @@ LL | invalid_instruction2 | ^ error: unrecognized instruction mnemonic - --> $DIR/srcloc.rs:97:13 + --> $DIR/srcloc.rs:100:13 | LL | concat!( | ^ @@ -215,7 +215,7 @@ LL | invalid_instruction3 | ^ error: unrecognized instruction mnemonic - --> $DIR/srcloc.rs:97:13 + --> $DIR/srcloc.rs:100:13 | LL | concat!( | ^ @@ -227,7 +227,7 @@ LL | invalid_instruction4 | ^ error: unrecognized instruction mnemonic - --> $DIR/srcloc.rs:108:13 + --> $DIR/srcloc.rs:111:13 | LL | concat!( | ^ @@ -239,7 +239,7 @@ LL | invalid_instruction1 | ^ error: unrecognized instruction mnemonic - --> $DIR/srcloc.rs:108:13 + --> $DIR/srcloc.rs:111:13 | LL | concat!( | ^ @@ -251,7 +251,7 @@ LL | invalid_instruction2 | ^ error: unrecognized instruction mnemonic - --> $DIR/srcloc.rs:112:13 + --> $DIR/srcloc.rs:115:13 | LL | concat!( | ^ @@ -263,7 +263,7 @@ LL | invalid_instruction3 | ^ error: unrecognized instruction mnemonic - --> $DIR/srcloc.rs:112:13 + --> $DIR/srcloc.rs:115:13 | LL | concat!( | ^ @@ -275,7 +275,7 @@ LL | invalid_instruction4 | ^ error: unrecognized instruction mnemonic - --> $DIR/srcloc.rs:125:14 + --> $DIR/srcloc.rs:128:14 | LL | "invalid_instruction" | ^ diff --git a/tests/ui/asm/aarch64/srcloc.rs b/tests/ui/asm/aarch64/srcloc.rs index c635fa6ba70..9b92dfef056 100644 --- a/tests/ui/asm/aarch64/srcloc.rs +++ b/tests/ui/asm/aarch64/srcloc.rs @@ -1,7 +1,10 @@ +//@ revisions: old new //@ only-aarch64 //@ build-fail //@ needs-asm-support //@ compile-flags: -Ccodegen-units=1 +//@[old] ignore-llvm-version: 19 - 99 +//@[new] min-llvm-version: 19 use std::arch::asm; diff --git a/tests/ui/asm/generic_const_simd_vec_len.rs b/tests/ui/asm/generic_const_simd_vec_len.rs new file mode 100644 index 00000000000..fb8c5274ddb --- /dev/null +++ b/tests/ui/asm/generic_const_simd_vec_len.rs @@ -0,0 +1,21 @@ +//! This is a regression test to ensure that we emit a diagnostic pointing to the +//! reason the type was rejected in inline assembly. + +//@ only-x86_64 + +#![feature(repr_simd)] + +#[repr(simd)] +#[derive(Copy, Clone)] +pub struct Foo<const C: usize>([u8; C]); +//~^ ERROR: cannot evaluate SIMD vector length + +pub unsafe fn foo<const C: usize>(a: Foo<C>) { + std::arch::asm!( + "movaps {src}, {src}", + src = in(xmm_reg) a, + //~^ NOTE: SIMD vector length needs to be known statically + ); +} + +fn main() {} diff --git a/tests/ui/asm/generic_const_simd_vec_len.stderr b/tests/ui/asm/generic_const_simd_vec_len.stderr new file mode 100644 index 00000000000..486281b6062 --- /dev/null +++ b/tests/ui/asm/generic_const_simd_vec_len.stderr @@ -0,0 +1,14 @@ +error: cannot evaluate SIMD vector length `C` + --> $DIR/generic_const_simd_vec_len.rs:10:32 + | +LL | pub struct Foo<const C: usize>([u8; C]); + | ^^^^^^^ + | +note: SIMD vector length needs to be known statically for use in `asm!` + --> $DIR/generic_const_simd_vec_len.rs:16:27 + | +LL | src = in(xmm_reg) a, + | ^ + +error: aborting due to 1 previous error + diff --git a/tests/ui/asm/inline-syntax.arm.stderr b/tests/ui/asm/inline-syntax.arm.stderr index 61e5078d6d9..e36ec125d13 100644 --- a/tests/ui/asm/inline-syntax.arm.stderr +++ b/tests/ui/asm/inline-syntax.arm.stderr @@ -15,10 +15,10 @@ LL | .intel_syntax noprefix | ^ error: unknown directive - --> $DIR/inline-syntax.rs:29:15 + --> $DIR/inline-syntax.rs:35:15 | LL | asm!(".intel_syntax noprefix", "nop"); - | ^ + | ^^^^^^^^^^^^^^^^^^^^^^ | note: instantiated into assembly here --> <inline asm>:1:2 @@ -27,10 +27,10 @@ LL | .intel_syntax noprefix | ^ error: unknown directive - --> $DIR/inline-syntax.rs:32:15 + --> $DIR/inline-syntax.rs:39:15 | LL | asm!(".intel_syntax aaa noprefix", "nop"); - | ^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: instantiated into assembly here --> <inline asm>:1:2 @@ -39,10 +39,10 @@ LL | .intel_syntax aaa noprefix | ^ error: unknown directive - --> $DIR/inline-syntax.rs:35:15 + --> $DIR/inline-syntax.rs:43:15 | LL | asm!(".att_syntax noprefix", "nop"); - | ^ + | ^^^^^^^^^^^^^^^^^^^^ | note: instantiated into assembly here --> <inline asm>:1:2 @@ -51,10 +51,10 @@ LL | .att_syntax noprefix | ^ error: unknown directive - --> $DIR/inline-syntax.rs:38:15 + --> $DIR/inline-syntax.rs:47:15 | LL | asm!(".att_syntax bbb noprefix", "nop"); - | ^ + | ^^^^^^^^^^^^^^^^^^^^^^^^ | note: instantiated into assembly here --> <inline asm>:1:2 @@ -63,10 +63,10 @@ LL | .att_syntax bbb noprefix | ^ error: unknown directive - --> $DIR/inline-syntax.rs:41:15 + --> $DIR/inline-syntax.rs:51:15 | LL | asm!(".intel_syntax noprefix; nop"); - | ^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: instantiated into assembly here --> <inline asm>:1:2 @@ -75,10 +75,10 @@ LL | .intel_syntax noprefix; nop | ^ error: unknown directive - --> $DIR/inline-syntax.rs:47:13 + --> $DIR/inline-syntax.rs:58:13 | LL | .intel_syntax noprefix - | ^ + | ^^^^^^^^^^^^^^^^^^^^^^ | note: instantiated into assembly here --> <inline asm>:2:13 diff --git a/tests/ui/asm/inline-syntax.arm_llvm_18.stderr b/tests/ui/asm/inline-syntax.arm_llvm_18.stderr new file mode 100644 index 00000000000..ada3f4891d3 --- /dev/null +++ b/tests/ui/asm/inline-syntax.arm_llvm_18.stderr @@ -0,0 +1,90 @@ +error: unknown directive + | +note: instantiated into assembly here + --> <inline asm>:1:1 + | +LL | .intel_syntax noprefix + | ^ + +error: unknown directive + | +note: instantiated into assembly here + --> <inline asm>:1:1 + | +LL | .intel_syntax noprefix + | ^ + +error: unknown directive + --> $DIR/inline-syntax.rs:35:15 + | +LL | asm!(".intel_syntax noprefix", "nop"); + | ^ + | +note: instantiated into assembly here + --> <inline asm>:1:2 + | +LL | .intel_syntax noprefix + | ^ + +error: unknown directive + --> $DIR/inline-syntax.rs:39:15 + | +LL | asm!(".intel_syntax aaa noprefix", "nop"); + | ^ + | +note: instantiated into assembly here + --> <inline asm>:1:2 + | +LL | .intel_syntax aaa noprefix + | ^ + +error: unknown directive + --> $DIR/inline-syntax.rs:43:15 + | +LL | asm!(".att_syntax noprefix", "nop"); + | ^ + | +note: instantiated into assembly here + --> <inline asm>:1:2 + | +LL | .att_syntax noprefix + | ^ + +error: unknown directive + --> $DIR/inline-syntax.rs:47:15 + | +LL | asm!(".att_syntax bbb noprefix", "nop"); + | ^ + | +note: instantiated into assembly here + --> <inline asm>:1:2 + | +LL | .att_syntax bbb noprefix + | ^ + +error: unknown directive + --> $DIR/inline-syntax.rs:51:15 + | +LL | asm!(".intel_syntax noprefix; nop"); + | ^ + | +note: instantiated into assembly here + --> <inline asm>:1:2 + | +LL | .intel_syntax noprefix; nop + | ^ + +error: unknown directive + --> $DIR/inline-syntax.rs:58:13 + | +LL | .intel_syntax noprefix + | ^ + | +note: instantiated into assembly here + --> <inline asm>:2:13 + | +LL | .intel_syntax noprefix + | ^ + +error: aborting due to 8 previous errors + diff --git a/tests/ui/asm/inline-syntax.rs b/tests/ui/asm/inline-syntax.rs index b8486527e6f..fda79b2afa3 100644 --- a/tests/ui/asm/inline-syntax.rs +++ b/tests/ui/asm/inline-syntax.rs @@ -1,10 +1,16 @@ -//@ revisions: x86_64 arm +//@ revisions: x86_64 arm_llvm_18 arm //@[x86_64] compile-flags: --target x86_64-unknown-linux-gnu //@[x86_64] check-pass //@[x86_64] needs-llvm-components: x86 +//@[arm_llvm_18] compile-flags: --target armv7-unknown-linux-gnueabihf +//@[arm_llvm_18] build-fail +//@[arm_llvm_18] needs-llvm-components: arm +//@[arm_llvm_18] ignore-llvm-version: 19 - 99 +// LLVM 19+ has full support for 64-bit cookies. //@[arm] compile-flags: --target armv7-unknown-linux-gnueabihf //@[arm] build-fail //@[arm] needs-llvm-components: arm +//@[arm] min-llvm-version: 19 //@ needs-asm-support #![feature(no_core, lang_items, rustc_attrs)] @@ -29,18 +35,23 @@ pub fn main() { asm!(".intel_syntax noprefix", "nop"); //[x86_64]~^ WARN avoid using `.intel_syntax` //[arm]~^^ ERROR unknown directive + //[arm_llvm_18]~^^^ ERROR unknown directive asm!(".intel_syntax aaa noprefix", "nop"); //[x86_64]~^ WARN avoid using `.intel_syntax` //[arm]~^^ ERROR unknown directive + //[arm_llvm_18]~^^^ ERROR unknown directive asm!(".att_syntax noprefix", "nop"); //[x86_64]~^ WARN avoid using `.att_syntax` //[arm]~^^ ERROR unknown directive + //[arm_llvm_18]~^^^ ERROR unknown directive asm!(".att_syntax bbb noprefix", "nop"); //[x86_64]~^ WARN avoid using `.att_syntax` //[arm]~^^ ERROR unknown directive + //[arm_llvm_18]~^^^ ERROR unknown directive asm!(".intel_syntax noprefix; nop"); //[x86_64]~^ WARN avoid using `.intel_syntax` //[arm]~^^ ERROR unknown directive + //[arm_llvm_18]~^^^ ERROR unknown directive asm!( r" @@ -49,9 +60,10 @@ pub fn main() { ); //[x86_64]~^^^ WARN avoid using `.intel_syntax` //[arm]~^^^^ ERROR unknown directive + //[arm_llvm_18]~^^^^^ ERROR unknown directive } } global_asm!(".intel_syntax noprefix", "nop"); //[x86_64]~^ WARN avoid using `.intel_syntax` -// Assembler errors don't have line numbers, so no error on ARM +// Global assembly errors don't have line numbers, so no error on ARM. diff --git a/tests/ui/asm/inline-syntax.x86_64.stderr b/tests/ui/asm/inline-syntax.x86_64.stderr index 59c95194322..66dc37f3089 100644 --- a/tests/ui/asm/inline-syntax.x86_64.stderr +++ b/tests/ui/asm/inline-syntax.x86_64.stderr @@ -1,5 +1,5 @@ warning: avoid using `.intel_syntax`, Intel syntax is the default - --> $DIR/inline-syntax.rs:55:14 + --> $DIR/inline-syntax.rs:67:14 | LL | global_asm!(".intel_syntax noprefix", "nop"); | ^^^^^^^^^^^^^^^^^^^^^^ @@ -7,37 +7,37 @@ LL | global_asm!(".intel_syntax noprefix", "nop"); = note: `#[warn(bad_asm_style)]` on by default warning: avoid using `.intel_syntax`, Intel syntax is the default - --> $DIR/inline-syntax.rs:29:15 + --> $DIR/inline-syntax.rs:35:15 | LL | asm!(".intel_syntax noprefix", "nop"); | ^^^^^^^^^^^^^^^^^^^^^^ warning: avoid using `.intel_syntax`, Intel syntax is the default - --> $DIR/inline-syntax.rs:32:15 + --> $DIR/inline-syntax.rs:39:15 | LL | asm!(".intel_syntax aaa noprefix", "nop"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: avoid using `.att_syntax`, prefer using `options(att_syntax)` instead - --> $DIR/inline-syntax.rs:35:15 + --> $DIR/inline-syntax.rs:43:15 | LL | asm!(".att_syntax noprefix", "nop"); | ^^^^^^^^^^^^^^^^^^^^ warning: avoid using `.att_syntax`, prefer using `options(att_syntax)` instead - --> $DIR/inline-syntax.rs:38:15 + --> $DIR/inline-syntax.rs:47:15 | LL | asm!(".att_syntax bbb noprefix", "nop"); | ^^^^^^^^^^^^^^^^^^^^^^^^ warning: avoid using `.intel_syntax`, Intel syntax is the default - --> $DIR/inline-syntax.rs:41:15 + --> $DIR/inline-syntax.rs:51:15 | LL | asm!(".intel_syntax noprefix; nop"); | ^^^^^^^^^^^^^^^^^^^^^^ warning: avoid using `.intel_syntax`, Intel syntax is the default - --> $DIR/inline-syntax.rs:47:13 + --> $DIR/inline-syntax.rs:58:13 | LL | .intel_syntax noprefix | ^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/asm/naked-functions-instruction-set.rs b/tests/ui/asm/naked-functions-instruction-set.rs index 37c7b52c191..3a6e7a46ce5 100644 --- a/tests/ui/asm/naked-functions-instruction-set.rs +++ b/tests/ui/asm/naked-functions-instruction-set.rs @@ -24,7 +24,7 @@ unsafe extern "C" fn test_thumb() { #[no_mangle] #[naked] -#[instruction_set(arm::t32)] +#[instruction_set(arm::a32)] unsafe extern "C" fn test_arm() { naked_asm!("bx lr"); } diff --git a/tests/ui/asm/naked-functions.rs b/tests/ui/asm/naked-functions.rs index 5c58f1498cc..e7e5d84f2a5 100644 --- a/tests/ui/asm/naked-functions.rs +++ b/tests/ui/asm/naked-functions.rs @@ -219,7 +219,6 @@ pub unsafe extern "C" fn compatible_must_use_attributes() -> u64 { #[export_name = "exported_function_name"] #[link_section = ".custom_section"] -#[no_mangle] #[naked] pub unsafe extern "C" fn compatible_ffi_attributes_1() { naked_asm!("", options(raw)); diff --git a/tests/ui/asm/named_const_simd_vec_len.rs b/tests/ui/asm/named_const_simd_vec_len.rs new file mode 100644 index 00000000000..7df4d922d5c --- /dev/null +++ b/tests/ui/asm/named_const_simd_vec_len.rs @@ -0,0 +1,22 @@ +//! This is a regression test to ensure that we evaluate +//! SIMD vector length constants instead of assuming they are literals. + +//@ only-x86_64 +//@ check-pass + +#![feature(repr_simd)] + +const C: usize = 16; + +#[repr(simd)] +#[derive(Copy, Clone)] +pub struct Foo([u8; C]); + +pub unsafe fn foo(a: Foo) { + std::arch::asm!( + "movaps {src}, {src}", + src = in(xmm_reg) a, + ); +} + +fn main() {} diff --git a/tests/ui/asm/riscv/riscv32e-registers.riscv32e.stderr b/tests/ui/asm/riscv/riscv32e-registers.riscv32e.stderr index e7a86805b26..ac1373f0e2d 100644 --- a/tests/ui/asm/riscv/riscv32e-registers.riscv32e.stderr +++ b/tests/ui/asm/riscv/riscv32e-registers.riscv32e.stderr @@ -1,8 +1,8 @@ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:46:11 + --> $DIR/riscv32e-registers.rs:58:11 | LL | asm!("li x16, 0"); - | ^ + | ^^^^^^^^^ | note: instantiated into assembly here --> <inline asm>:1:5 @@ -11,10 +11,10 @@ LL | li x16, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:49:11 + --> $DIR/riscv32e-registers.rs:61:11 | LL | asm!("li x17, 0"); - | ^ + | ^^^^^^^^^ | note: instantiated into assembly here --> <inline asm>:1:5 @@ -23,10 +23,10 @@ LL | li x17, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:52:11 + --> $DIR/riscv32e-registers.rs:64:11 | LL | asm!("li x18, 0"); - | ^ + | ^^^^^^^^^ | note: instantiated into assembly here --> <inline asm>:1:5 @@ -35,10 +35,10 @@ LL | li x18, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:55:11 + --> $DIR/riscv32e-registers.rs:67:11 | LL | asm!("li x19, 0"); - | ^ + | ^^^^^^^^^ | note: instantiated into assembly here --> <inline asm>:1:5 @@ -47,10 +47,10 @@ LL | li x19, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:58:11 + --> $DIR/riscv32e-registers.rs:70:11 | LL | asm!("li x20, 0"); - | ^ + | ^^^^^^^^^ | note: instantiated into assembly here --> <inline asm>:1:5 @@ -59,10 +59,10 @@ LL | li x20, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:61:11 + --> $DIR/riscv32e-registers.rs:73:11 | LL | asm!("li x21, 0"); - | ^ + | ^^^^^^^^^ | note: instantiated into assembly here --> <inline asm>:1:5 @@ -71,10 +71,10 @@ LL | li x21, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:64:11 + --> $DIR/riscv32e-registers.rs:76:11 | LL | asm!("li x22, 0"); - | ^ + | ^^^^^^^^^ | note: instantiated into assembly here --> <inline asm>:1:5 @@ -83,10 +83,10 @@ LL | li x22, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:67:11 + --> $DIR/riscv32e-registers.rs:79:11 | LL | asm!("li x23, 0"); - | ^ + | ^^^^^^^^^ | note: instantiated into assembly here --> <inline asm>:1:5 @@ -95,10 +95,10 @@ LL | li x23, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:70:11 + --> $DIR/riscv32e-registers.rs:82:11 | LL | asm!("li x24, 0"); - | ^ + | ^^^^^^^^^ | note: instantiated into assembly here --> <inline asm>:1:5 @@ -107,10 +107,10 @@ LL | li x24, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:73:11 + --> $DIR/riscv32e-registers.rs:85:11 | LL | asm!("li x25, 0"); - | ^ + | ^^^^^^^^^ | note: instantiated into assembly here --> <inline asm>:1:5 @@ -119,10 +119,10 @@ LL | li x25, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:76:11 + --> $DIR/riscv32e-registers.rs:88:11 | LL | asm!("li x26, 0"); - | ^ + | ^^^^^^^^^ | note: instantiated into assembly here --> <inline asm>:1:5 @@ -131,10 +131,10 @@ LL | li x26, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:79:11 + --> $DIR/riscv32e-registers.rs:91:11 | LL | asm!("li x27, 0"); - | ^ + | ^^^^^^^^^ | note: instantiated into assembly here --> <inline asm>:1:5 @@ -143,10 +143,10 @@ LL | li x27, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:82:11 + --> $DIR/riscv32e-registers.rs:94:11 | LL | asm!("li x28, 0"); - | ^ + | ^^^^^^^^^ | note: instantiated into assembly here --> <inline asm>:1:5 @@ -155,10 +155,10 @@ LL | li x28, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:85:11 + --> $DIR/riscv32e-registers.rs:97:11 | LL | asm!("li x29, 0"); - | ^ + | ^^^^^^^^^ | note: instantiated into assembly here --> <inline asm>:1:5 @@ -167,10 +167,10 @@ LL | li x29, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:88:11 + --> $DIR/riscv32e-registers.rs:100:11 | LL | asm!("li x30, 0"); - | ^ + | ^^^^^^^^^ | note: instantiated into assembly here --> <inline asm>:1:5 @@ -179,10 +179,10 @@ LL | li x30, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:91:11 + --> $DIR/riscv32e-registers.rs:103:11 | LL | asm!("li x31, 0"); - | ^ + | ^^^^^^^^^ | note: instantiated into assembly here --> <inline asm>:1:5 diff --git a/tests/ui/asm/riscv/riscv32e-registers.riscv32e_llvm_18.stderr b/tests/ui/asm/riscv/riscv32e-registers.riscv32e_llvm_18.stderr new file mode 100644 index 00000000000..f140f54adc5 --- /dev/null +++ b/tests/ui/asm/riscv/riscv32e-registers.riscv32e_llvm_18.stderr @@ -0,0 +1,194 @@ +error: invalid operand for instruction + --> $DIR/riscv32e-registers.rs:58:11 + | +LL | asm!("li x16, 0"); + | ^ + | +note: instantiated into assembly here + --> <inline asm>:1:5 + | +LL | li x16, 0 + | ^ + +error: invalid operand for instruction + --> $DIR/riscv32e-registers.rs:61:11 + | +LL | asm!("li x17, 0"); + | ^ + | +note: instantiated into assembly here + --> <inline asm>:1:5 + | +LL | li x17, 0 + | ^ + +error: invalid operand for instruction + --> $DIR/riscv32e-registers.rs:64:11 + | +LL | asm!("li x18, 0"); + | ^ + | +note: instantiated into assembly here + --> <inline asm>:1:5 + | +LL | li x18, 0 + | ^ + +error: invalid operand for instruction + --> $DIR/riscv32e-registers.rs:67:11 + | +LL | asm!("li x19, 0"); + | ^ + | +note: instantiated into assembly here + --> <inline asm>:1:5 + | +LL | li x19, 0 + | ^ + +error: invalid operand for instruction + --> $DIR/riscv32e-registers.rs:70:11 + | +LL | asm!("li x20, 0"); + | ^ + | +note: instantiated into assembly here + --> <inline asm>:1:5 + | +LL | li x20, 0 + | ^ + +error: invalid operand for instruction + --> $DIR/riscv32e-registers.rs:73:11 + | +LL | asm!("li x21, 0"); + | ^ + | +note: instantiated into assembly here + --> <inline asm>:1:5 + | +LL | li x21, 0 + | ^ + +error: invalid operand for instruction + --> $DIR/riscv32e-registers.rs:76:11 + | +LL | asm!("li x22, 0"); + | ^ + | +note: instantiated into assembly here + --> <inline asm>:1:5 + | +LL | li x22, 0 + | ^ + +error: invalid operand for instruction + --> $DIR/riscv32e-registers.rs:79:11 + | +LL | asm!("li x23, 0"); + | ^ + | +note: instantiated into assembly here + --> <inline asm>:1:5 + | +LL | li x23, 0 + | ^ + +error: invalid operand for instruction + --> $DIR/riscv32e-registers.rs:82:11 + | +LL | asm!("li x24, 0"); + | ^ + | +note: instantiated into assembly here + --> <inline asm>:1:5 + | +LL | li x24, 0 + | ^ + +error: invalid operand for instruction + --> $DIR/riscv32e-registers.rs:85:11 + | +LL | asm!("li x25, 0"); + | ^ + | +note: instantiated into assembly here + --> <inline asm>:1:5 + | +LL | li x25, 0 + | ^ + +error: invalid operand for instruction + --> $DIR/riscv32e-registers.rs:88:11 + | +LL | asm!("li x26, 0"); + | ^ + | +note: instantiated into assembly here + --> <inline asm>:1:5 + | +LL | li x26, 0 + | ^ + +error: invalid operand for instruction + --> $DIR/riscv32e-registers.rs:91:11 + | +LL | asm!("li x27, 0"); + | ^ + | +note: instantiated into assembly here + --> <inline asm>:1:5 + | +LL | li x27, 0 + | ^ + +error: invalid operand for instruction + --> $DIR/riscv32e-registers.rs:94:11 + | +LL | asm!("li x28, 0"); + | ^ + | +note: instantiated into assembly here + --> <inline asm>:1:5 + | +LL | li x28, 0 + | ^ + +error: invalid operand for instruction + --> $DIR/riscv32e-registers.rs:97:11 + | +LL | asm!("li x29, 0"); + | ^ + | +note: instantiated into assembly here + --> <inline asm>:1:5 + | +LL | li x29, 0 + | ^ + +error: invalid operand for instruction + --> $DIR/riscv32e-registers.rs:100:11 + | +LL | asm!("li x30, 0"); + | ^ + | +note: instantiated into assembly here + --> <inline asm>:1:5 + | +LL | li x30, 0 + | ^ + +error: invalid operand for instruction + --> $DIR/riscv32e-registers.rs:103:11 + | +LL | asm!("li x31, 0"); + | ^ + | +note: instantiated into assembly here + --> <inline asm>:1:5 + | +LL | li x31, 0 + | ^ + +error: aborting due to 16 previous errors + diff --git a/tests/ui/asm/riscv/riscv32e-registers.riscv32em.stderr b/tests/ui/asm/riscv/riscv32e-registers.riscv32em.stderr index e7a86805b26..ac1373f0e2d 100644 --- a/tests/ui/asm/riscv/riscv32e-registers.riscv32em.stderr +++ b/tests/ui/asm/riscv/riscv32e-registers.riscv32em.stderr @@ -1,8 +1,8 @@ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:46:11 + --> $DIR/riscv32e-registers.rs:58:11 | LL | asm!("li x16, 0"); - | ^ + | ^^^^^^^^^ | note: instantiated into assembly here --> <inline asm>:1:5 @@ -11,10 +11,10 @@ LL | li x16, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:49:11 + --> $DIR/riscv32e-registers.rs:61:11 | LL | asm!("li x17, 0"); - | ^ + | ^^^^^^^^^ | note: instantiated into assembly here --> <inline asm>:1:5 @@ -23,10 +23,10 @@ LL | li x17, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:52:11 + --> $DIR/riscv32e-registers.rs:64:11 | LL | asm!("li x18, 0"); - | ^ + | ^^^^^^^^^ | note: instantiated into assembly here --> <inline asm>:1:5 @@ -35,10 +35,10 @@ LL | li x18, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:55:11 + --> $DIR/riscv32e-registers.rs:67:11 | LL | asm!("li x19, 0"); - | ^ + | ^^^^^^^^^ | note: instantiated into assembly here --> <inline asm>:1:5 @@ -47,10 +47,10 @@ LL | li x19, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:58:11 + --> $DIR/riscv32e-registers.rs:70:11 | LL | asm!("li x20, 0"); - | ^ + | ^^^^^^^^^ | note: instantiated into assembly here --> <inline asm>:1:5 @@ -59,10 +59,10 @@ LL | li x20, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:61:11 + --> $DIR/riscv32e-registers.rs:73:11 | LL | asm!("li x21, 0"); - | ^ + | ^^^^^^^^^ | note: instantiated into assembly here --> <inline asm>:1:5 @@ -71,10 +71,10 @@ LL | li x21, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:64:11 + --> $DIR/riscv32e-registers.rs:76:11 | LL | asm!("li x22, 0"); - | ^ + | ^^^^^^^^^ | note: instantiated into assembly here --> <inline asm>:1:5 @@ -83,10 +83,10 @@ LL | li x22, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:67:11 + --> $DIR/riscv32e-registers.rs:79:11 | LL | asm!("li x23, 0"); - | ^ + | ^^^^^^^^^ | note: instantiated into assembly here --> <inline asm>:1:5 @@ -95,10 +95,10 @@ LL | li x23, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:70:11 + --> $DIR/riscv32e-registers.rs:82:11 | LL | asm!("li x24, 0"); - | ^ + | ^^^^^^^^^ | note: instantiated into assembly here --> <inline asm>:1:5 @@ -107,10 +107,10 @@ LL | li x24, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:73:11 + --> $DIR/riscv32e-registers.rs:85:11 | LL | asm!("li x25, 0"); - | ^ + | ^^^^^^^^^ | note: instantiated into assembly here --> <inline asm>:1:5 @@ -119,10 +119,10 @@ LL | li x25, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:76:11 + --> $DIR/riscv32e-registers.rs:88:11 | LL | asm!("li x26, 0"); - | ^ + | ^^^^^^^^^ | note: instantiated into assembly here --> <inline asm>:1:5 @@ -131,10 +131,10 @@ LL | li x26, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:79:11 + --> $DIR/riscv32e-registers.rs:91:11 | LL | asm!("li x27, 0"); - | ^ + | ^^^^^^^^^ | note: instantiated into assembly here --> <inline asm>:1:5 @@ -143,10 +143,10 @@ LL | li x27, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:82:11 + --> $DIR/riscv32e-registers.rs:94:11 | LL | asm!("li x28, 0"); - | ^ + | ^^^^^^^^^ | note: instantiated into assembly here --> <inline asm>:1:5 @@ -155,10 +155,10 @@ LL | li x28, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:85:11 + --> $DIR/riscv32e-registers.rs:97:11 | LL | asm!("li x29, 0"); - | ^ + | ^^^^^^^^^ | note: instantiated into assembly here --> <inline asm>:1:5 @@ -167,10 +167,10 @@ LL | li x29, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:88:11 + --> $DIR/riscv32e-registers.rs:100:11 | LL | asm!("li x30, 0"); - | ^ + | ^^^^^^^^^ | note: instantiated into assembly here --> <inline asm>:1:5 @@ -179,10 +179,10 @@ LL | li x30, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:91:11 + --> $DIR/riscv32e-registers.rs:103:11 | LL | asm!("li x31, 0"); - | ^ + | ^^^^^^^^^ | note: instantiated into assembly here --> <inline asm>:1:5 diff --git a/tests/ui/asm/riscv/riscv32e-registers.riscv32em_llvm_18.stderr b/tests/ui/asm/riscv/riscv32e-registers.riscv32em_llvm_18.stderr new file mode 100644 index 00000000000..f140f54adc5 --- /dev/null +++ b/tests/ui/asm/riscv/riscv32e-registers.riscv32em_llvm_18.stderr @@ -0,0 +1,194 @@ +error: invalid operand for instruction + --> $DIR/riscv32e-registers.rs:58:11 + | +LL | asm!("li x16, 0"); + | ^ + | +note: instantiated into assembly here + --> <inline asm>:1:5 + | +LL | li x16, 0 + | ^ + +error: invalid operand for instruction + --> $DIR/riscv32e-registers.rs:61:11 + | +LL | asm!("li x17, 0"); + | ^ + | +note: instantiated into assembly here + --> <inline asm>:1:5 + | +LL | li x17, 0 + | ^ + +error: invalid operand for instruction + --> $DIR/riscv32e-registers.rs:64:11 + | +LL | asm!("li x18, 0"); + | ^ + | +note: instantiated into assembly here + --> <inline asm>:1:5 + | +LL | li x18, 0 + | ^ + +error: invalid operand for instruction + --> $DIR/riscv32e-registers.rs:67:11 + | +LL | asm!("li x19, 0"); + | ^ + | +note: instantiated into assembly here + --> <inline asm>:1:5 + | +LL | li x19, 0 + | ^ + +error: invalid operand for instruction + --> $DIR/riscv32e-registers.rs:70:11 + | +LL | asm!("li x20, 0"); + | ^ + | +note: instantiated into assembly here + --> <inline asm>:1:5 + | +LL | li x20, 0 + | ^ + +error: invalid operand for instruction + --> $DIR/riscv32e-registers.rs:73:11 + | +LL | asm!("li x21, 0"); + | ^ + | +note: instantiated into assembly here + --> <inline asm>:1:5 + | +LL | li x21, 0 + | ^ + +error: invalid operand for instruction + --> $DIR/riscv32e-registers.rs:76:11 + | +LL | asm!("li x22, 0"); + | ^ + | +note: instantiated into assembly here + --> <inline asm>:1:5 + | +LL | li x22, 0 + | ^ + +error: invalid operand for instruction + --> $DIR/riscv32e-registers.rs:79:11 + | +LL | asm!("li x23, 0"); + | ^ + | +note: instantiated into assembly here + --> <inline asm>:1:5 + | +LL | li x23, 0 + | ^ + +error: invalid operand for instruction + --> $DIR/riscv32e-registers.rs:82:11 + | +LL | asm!("li x24, 0"); + | ^ + | +note: instantiated into assembly here + --> <inline asm>:1:5 + | +LL | li x24, 0 + | ^ + +error: invalid operand for instruction + --> $DIR/riscv32e-registers.rs:85:11 + | +LL | asm!("li x25, 0"); + | ^ + | +note: instantiated into assembly here + --> <inline asm>:1:5 + | +LL | li x25, 0 + | ^ + +error: invalid operand for instruction + --> $DIR/riscv32e-registers.rs:88:11 + | +LL | asm!("li x26, 0"); + | ^ + | +note: instantiated into assembly here + --> <inline asm>:1:5 + | +LL | li x26, 0 + | ^ + +error: invalid operand for instruction + --> $DIR/riscv32e-registers.rs:91:11 + | +LL | asm!("li x27, 0"); + | ^ + | +note: instantiated into assembly here + --> <inline asm>:1:5 + | +LL | li x27, 0 + | ^ + +error: invalid operand for instruction + --> $DIR/riscv32e-registers.rs:94:11 + | +LL | asm!("li x28, 0"); + | ^ + | +note: instantiated into assembly here + --> <inline asm>:1:5 + | +LL | li x28, 0 + | ^ + +error: invalid operand for instruction + --> $DIR/riscv32e-registers.rs:97:11 + | +LL | asm!("li x29, 0"); + | ^ + | +note: instantiated into assembly here + --> <inline asm>:1:5 + | +LL | li x29, 0 + | ^ + +error: invalid operand for instruction + --> $DIR/riscv32e-registers.rs:100:11 + | +LL | asm!("li x30, 0"); + | ^ + | +note: instantiated into assembly here + --> <inline asm>:1:5 + | +LL | li x30, 0 + | ^ + +error: invalid operand for instruction + --> $DIR/riscv32e-registers.rs:103:11 + | +LL | asm!("li x31, 0"); + | ^ + | +note: instantiated into assembly here + --> <inline asm>:1:5 + | +LL | li x31, 0 + | ^ + +error: aborting due to 16 previous errors + diff --git a/tests/ui/asm/riscv/riscv32e-registers.riscv32emc.stderr b/tests/ui/asm/riscv/riscv32e-registers.riscv32emc.stderr index e7a86805b26..ac1373f0e2d 100644 --- a/tests/ui/asm/riscv/riscv32e-registers.riscv32emc.stderr +++ b/tests/ui/asm/riscv/riscv32e-registers.riscv32emc.stderr @@ -1,8 +1,8 @@ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:46:11 + --> $DIR/riscv32e-registers.rs:58:11 | LL | asm!("li x16, 0"); - | ^ + | ^^^^^^^^^ | note: instantiated into assembly here --> <inline asm>:1:5 @@ -11,10 +11,10 @@ LL | li x16, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:49:11 + --> $DIR/riscv32e-registers.rs:61:11 | LL | asm!("li x17, 0"); - | ^ + | ^^^^^^^^^ | note: instantiated into assembly here --> <inline asm>:1:5 @@ -23,10 +23,10 @@ LL | li x17, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:52:11 + --> $DIR/riscv32e-registers.rs:64:11 | LL | asm!("li x18, 0"); - | ^ + | ^^^^^^^^^ | note: instantiated into assembly here --> <inline asm>:1:5 @@ -35,10 +35,10 @@ LL | li x18, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:55:11 + --> $DIR/riscv32e-registers.rs:67:11 | LL | asm!("li x19, 0"); - | ^ + | ^^^^^^^^^ | note: instantiated into assembly here --> <inline asm>:1:5 @@ -47,10 +47,10 @@ LL | li x19, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:58:11 + --> $DIR/riscv32e-registers.rs:70:11 | LL | asm!("li x20, 0"); - | ^ + | ^^^^^^^^^ | note: instantiated into assembly here --> <inline asm>:1:5 @@ -59,10 +59,10 @@ LL | li x20, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:61:11 + --> $DIR/riscv32e-registers.rs:73:11 | LL | asm!("li x21, 0"); - | ^ + | ^^^^^^^^^ | note: instantiated into assembly here --> <inline asm>:1:5 @@ -71,10 +71,10 @@ LL | li x21, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:64:11 + --> $DIR/riscv32e-registers.rs:76:11 | LL | asm!("li x22, 0"); - | ^ + | ^^^^^^^^^ | note: instantiated into assembly here --> <inline asm>:1:5 @@ -83,10 +83,10 @@ LL | li x22, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:67:11 + --> $DIR/riscv32e-registers.rs:79:11 | LL | asm!("li x23, 0"); - | ^ + | ^^^^^^^^^ | note: instantiated into assembly here --> <inline asm>:1:5 @@ -95,10 +95,10 @@ LL | li x23, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:70:11 + --> $DIR/riscv32e-registers.rs:82:11 | LL | asm!("li x24, 0"); - | ^ + | ^^^^^^^^^ | note: instantiated into assembly here --> <inline asm>:1:5 @@ -107,10 +107,10 @@ LL | li x24, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:73:11 + --> $DIR/riscv32e-registers.rs:85:11 | LL | asm!("li x25, 0"); - | ^ + | ^^^^^^^^^ | note: instantiated into assembly here --> <inline asm>:1:5 @@ -119,10 +119,10 @@ LL | li x25, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:76:11 + --> $DIR/riscv32e-registers.rs:88:11 | LL | asm!("li x26, 0"); - | ^ + | ^^^^^^^^^ | note: instantiated into assembly here --> <inline asm>:1:5 @@ -131,10 +131,10 @@ LL | li x26, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:79:11 + --> $DIR/riscv32e-registers.rs:91:11 | LL | asm!("li x27, 0"); - | ^ + | ^^^^^^^^^ | note: instantiated into assembly here --> <inline asm>:1:5 @@ -143,10 +143,10 @@ LL | li x27, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:82:11 + --> $DIR/riscv32e-registers.rs:94:11 | LL | asm!("li x28, 0"); - | ^ + | ^^^^^^^^^ | note: instantiated into assembly here --> <inline asm>:1:5 @@ -155,10 +155,10 @@ LL | li x28, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:85:11 + --> $DIR/riscv32e-registers.rs:97:11 | LL | asm!("li x29, 0"); - | ^ + | ^^^^^^^^^ | note: instantiated into assembly here --> <inline asm>:1:5 @@ -167,10 +167,10 @@ LL | li x29, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:88:11 + --> $DIR/riscv32e-registers.rs:100:11 | LL | asm!("li x30, 0"); - | ^ + | ^^^^^^^^^ | note: instantiated into assembly here --> <inline asm>:1:5 @@ -179,10 +179,10 @@ LL | li x30, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:91:11 + --> $DIR/riscv32e-registers.rs:103:11 | LL | asm!("li x31, 0"); - | ^ + | ^^^^^^^^^ | note: instantiated into assembly here --> <inline asm>:1:5 diff --git a/tests/ui/asm/riscv/riscv32e-registers.riscv32emc_llvm_18.stderr b/tests/ui/asm/riscv/riscv32e-registers.riscv32emc_llvm_18.stderr new file mode 100644 index 00000000000..f140f54adc5 --- /dev/null +++ b/tests/ui/asm/riscv/riscv32e-registers.riscv32emc_llvm_18.stderr @@ -0,0 +1,194 @@ +error: invalid operand for instruction + --> $DIR/riscv32e-registers.rs:58:11 + | +LL | asm!("li x16, 0"); + | ^ + | +note: instantiated into assembly here + --> <inline asm>:1:5 + | +LL | li x16, 0 + | ^ + +error: invalid operand for instruction + --> $DIR/riscv32e-registers.rs:61:11 + | +LL | asm!("li x17, 0"); + | ^ + | +note: instantiated into assembly here + --> <inline asm>:1:5 + | +LL | li x17, 0 + | ^ + +error: invalid operand for instruction + --> $DIR/riscv32e-registers.rs:64:11 + | +LL | asm!("li x18, 0"); + | ^ + | +note: instantiated into assembly here + --> <inline asm>:1:5 + | +LL | li x18, 0 + | ^ + +error: invalid operand for instruction + --> $DIR/riscv32e-registers.rs:67:11 + | +LL | asm!("li x19, 0"); + | ^ + | +note: instantiated into assembly here + --> <inline asm>:1:5 + | +LL | li x19, 0 + | ^ + +error: invalid operand for instruction + --> $DIR/riscv32e-registers.rs:70:11 + | +LL | asm!("li x20, 0"); + | ^ + | +note: instantiated into assembly here + --> <inline asm>:1:5 + | +LL | li x20, 0 + | ^ + +error: invalid operand for instruction + --> $DIR/riscv32e-registers.rs:73:11 + | +LL | asm!("li x21, 0"); + | ^ + | +note: instantiated into assembly here + --> <inline asm>:1:5 + | +LL | li x21, 0 + | ^ + +error: invalid operand for instruction + --> $DIR/riscv32e-registers.rs:76:11 + | +LL | asm!("li x22, 0"); + | ^ + | +note: instantiated into assembly here + --> <inline asm>:1:5 + | +LL | li x22, 0 + | ^ + +error: invalid operand for instruction + --> $DIR/riscv32e-registers.rs:79:11 + | +LL | asm!("li x23, 0"); + | ^ + | +note: instantiated into assembly here + --> <inline asm>:1:5 + | +LL | li x23, 0 + | ^ + +error: invalid operand for instruction + --> $DIR/riscv32e-registers.rs:82:11 + | +LL | asm!("li x24, 0"); + | ^ + | +note: instantiated into assembly here + --> <inline asm>:1:5 + | +LL | li x24, 0 + | ^ + +error: invalid operand for instruction + --> $DIR/riscv32e-registers.rs:85:11 + | +LL | asm!("li x25, 0"); + | ^ + | +note: instantiated into assembly here + --> <inline asm>:1:5 + | +LL | li x25, 0 + | ^ + +error: invalid operand for instruction + --> $DIR/riscv32e-registers.rs:88:11 + | +LL | asm!("li x26, 0"); + | ^ + | +note: instantiated into assembly here + --> <inline asm>:1:5 + | +LL | li x26, 0 + | ^ + +error: invalid operand for instruction + --> $DIR/riscv32e-registers.rs:91:11 + | +LL | asm!("li x27, 0"); + | ^ + | +note: instantiated into assembly here + --> <inline asm>:1:5 + | +LL | li x27, 0 + | ^ + +error: invalid operand for instruction + --> $DIR/riscv32e-registers.rs:94:11 + | +LL | asm!("li x28, 0"); + | ^ + | +note: instantiated into assembly here + --> <inline asm>:1:5 + | +LL | li x28, 0 + | ^ + +error: invalid operand for instruction + --> $DIR/riscv32e-registers.rs:97:11 + | +LL | asm!("li x29, 0"); + | ^ + | +note: instantiated into assembly here + --> <inline asm>:1:5 + | +LL | li x29, 0 + | ^ + +error: invalid operand for instruction + --> $DIR/riscv32e-registers.rs:100:11 + | +LL | asm!("li x30, 0"); + | ^ + | +note: instantiated into assembly here + --> <inline asm>:1:5 + | +LL | li x30, 0 + | ^ + +error: invalid operand for instruction + --> $DIR/riscv32e-registers.rs:103:11 + | +LL | asm!("li x31, 0"); + | ^ + | +note: instantiated into assembly here + --> <inline asm>:1:5 + | +LL | li x31, 0 + | ^ + +error: aborting due to 16 previous errors + diff --git a/tests/ui/asm/riscv/riscv32e-registers.rs b/tests/ui/asm/riscv/riscv32e-registers.rs index 57b1e169a04..c3fe19991b0 100644 --- a/tests/ui/asm/riscv/riscv32e-registers.rs +++ b/tests/ui/asm/riscv/riscv32e-registers.rs @@ -1,15 +1,27 @@ // Test that loads into registers x16..=x31 are never generated for riscv32{e,em,emc} targets // //@ build-fail -//@ revisions: riscv32e riscv32em riscv32emc +//@ revisions: riscv32e riscv32em riscv32emc riscv32e_llvm_18 riscv32em_llvm_18 riscv32emc_llvm_18 // //@ compile-flags: --crate-type=rlib //@ [riscv32e] needs-llvm-components: riscv //@ [riscv32e] compile-flags: --target=riscv32e-unknown-none-elf +//@ [riscv32e] min-llvm-version: 19 //@ [riscv32em] needs-llvm-components: riscv //@ [riscv32em] compile-flags: --target=riscv32em-unknown-none-elf +//@ [riscv32em] min-llvm-version: 19 //@ [riscv32emc] needs-llvm-components: riscv //@ [riscv32emc] compile-flags: --target=riscv32emc-unknown-none-elf +//@ [riscv32emc] min-llvm-version: 19 +//@ [riscv32e_llvm_18] needs-llvm-components: riscv +//@ [riscv32e_llvm_18] compile-flags: --target=riscv32e-unknown-none-elf +//@ [riscv32e_llvm_18] ignore-llvm-version: 19 - 99 +//@ [riscv32em_llvm_18] needs-llvm-components: riscv +//@ [riscv32em_llvm_18] compile-flags: --target=riscv32em-unknown-none-elf +//@ [riscv32em_llvm_18] ignore-llvm-version: 19 - 99 +//@ [riscv32emc_llvm_18] needs-llvm-components: riscv +//@ [riscv32emc_llvm_18] compile-flags: --target=riscv32emc-unknown-none-elf +//@ [riscv32emc_llvm_18] ignore-llvm-version: 19 - 99 // Unlike bad-reg.rs, this tests if the assembler can reject invalid registers // usage in assembly code. diff --git a/tests/ui/asm/x86_64/srcloc.new.stderr b/tests/ui/asm/x86_64/srcloc.new.stderr new file mode 100644 index 00000000000..7211f1ab69d --- /dev/null +++ b/tests/ui/asm/x86_64/srcloc.new.stderr @@ -0,0 +1,332 @@ +error: invalid instruction mnemonic 'invalid_instruction' + --> $DIR/srcloc.rs:14:15 + | +LL | asm!("invalid_instruction"); + | ^^^^^^^^^^^^^^^^^^^ + | +note: instantiated into assembly here + --> <inline asm>:2:2 + | +LL | invalid_instruction + | ^^^^^^^^^^^^^^^^^^^ + +error: invalid instruction mnemonic 'invalid_instruction' + --> $DIR/srcloc.rs:18:13 + | +LL | invalid_instruction + | ^^^^^^^^^^^^^^^^^^^ + | +note: instantiated into assembly here + --> <inline asm>:3:13 + | +LL | invalid_instruction + | ^^^^^^^^^^^^^^^^^^^ + +error: invalid instruction mnemonic 'invalid_instruction' + --> $DIR/srcloc.rs:23:13 + | +LL | invalid_instruction + | ^^^^^^^^^^^^^^^^^^^ + | +note: instantiated into assembly here + --> <inline asm>:3:13 + | +LL | invalid_instruction + | ^^^^^^^^^^^^^^^^^^^ + +error: invalid instruction mnemonic 'invalid_instruction' + --> $DIR/srcloc.rs:29:13 + | +LL | invalid_instruction + | ^^^^^^^^^^^^^^^^^^^ + | +note: instantiated into assembly here + --> <inline asm>:4:13 + | +LL | invalid_instruction + | ^^^^^^^^^^^^^^^^^^^ + +error: invalid instruction mnemonic 'invalid_instruction' + --> $DIR/srcloc.rs:36:13 + | +LL | invalid_instruction + | ^^^^^^^^^^^^^^^^^^^ + | +note: instantiated into assembly here + --> <inline asm>:4:13 + | +LL | invalid_instruction + | ^^^^^^^^^^^^^^^^^^^ + +error: invalid instruction mnemonic 'invalid_instruction' + --> $DIR/srcloc.rs:41:14 + | +LL | asm!(concat!("invalid", "_", "instruction")); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +note: instantiated into assembly here + --> <inline asm>:2:2 + | +LL | invalid_instruction + | ^^^^^^^^^^^^^^^^^^^ + +warning: scale factor without index register is ignored + --> $DIR/srcloc.rs:44:15 + | +LL | asm!("movaps %xmm3, (%esi, 2)", options(att_syntax)); + | ^^^^^^^^^^^^^^^^^^^^^^^ + | +note: instantiated into assembly here + --> <inline asm>:1:23 + | +LL | movaps %xmm3, (%esi, 2) + | ^ + +error: invalid instruction mnemonic 'invalid_instruction' + --> $DIR/srcloc.rs:48:14 + | +LL | "invalid_instruction", + | ^^^^^^^^^^^^^^^^^^^ + | +note: instantiated into assembly here + --> <inline asm>:2:2 + | +LL | invalid_instruction + | ^^^^^^^^^^^^^^^^^^^ + +error: invalid instruction mnemonic 'invalid_instruction' + --> $DIR/srcloc.rs:54:14 + | +LL | "invalid_instruction", + | ^^^^^^^^^^^^^^^^^^^ + | +note: instantiated into assembly here + --> <inline asm>:3:1 + | +LL | invalid_instruction + | ^^^^^^^^^^^^^^^^^^^ + +error: invalid instruction mnemonic 'invalid_instruction' + --> $DIR/srcloc.rs:61:14 + | +LL | "invalid_instruction", + | ^^^^^^^^^^^^^^^^^^^ + | +note: instantiated into assembly here + --> <inline asm>:4:1 + | +LL | invalid_instruction + | ^^^^^^^^^^^^^^^^^^^ + +error: invalid instruction mnemonic 'invalid_instruction' + --> $DIR/srcloc.rs:68:13 + | +LL | concat!("invalid", "_", "instruction"), + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +note: instantiated into assembly here + --> <inline asm>:3:1 + | +LL | invalid_instruction + | ^^^^^^^^^^^^^^^^^^^ + +error: invalid instruction mnemonic 'invalid_instruction' + --> $DIR/srcloc.rs:75:13 + | +LL | concat!("invalid", "_", "instruction"), + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +note: instantiated into assembly here + --> <inline asm>:3:1 + | +LL | invalid_instruction + | ^^^^^^^^^^^^^^^^^^^ + +error: invalid instruction mnemonic 'invalid_instruction1' + --> $DIR/srcloc.rs:82:14 + | +LL | "invalid_instruction1", + | ^^^^^^^^^^^^^^^^^^^^ + | +note: instantiated into assembly here + --> <inline asm>:2:2 + | +LL | invalid_instruction1 + | ^^^^^^^^^^^^^^^^^^^^ + +error: invalid instruction mnemonic 'invalid_instruction2' + --> $DIR/srcloc.rs:83:14 + | +LL | "invalid_instruction2", + | ^^^^^^^^^^^^^^^^^^^^ + | +note: instantiated into assembly here + --> <inline asm>:3:1 + | +LL | invalid_instruction2 + | ^^^^^^^^^^^^^^^^^^^^ + +error: invalid instruction mnemonic 'invalid_instruction1' + --> $DIR/srcloc.rs:89:13 + | +LL | / concat!( +LL | | "invalid", "_", "instruction1", "\n", +LL | | "invalid", "_", "instruction2", +LL | | ), + | |_____________^ + | +note: instantiated into assembly here + --> <inline asm>:2:2 + | +LL | invalid_instruction1 + | ^^^^^^^^^^^^^^^^^^^^ + +error: invalid instruction mnemonic 'invalid_instruction2' + --> $DIR/srcloc.rs:89:13 + | +LL | / concat!( +LL | | "invalid", "_", "instruction1", "\n", +LL | | "invalid", "_", "instruction2", +LL | | ), + | |_____________^ + | +note: instantiated into assembly here + --> <inline asm>:3:1 + | +LL | invalid_instruction2 + | ^^^^^^^^^^^^^^^^^^^^ + +error: invalid instruction mnemonic 'invalid_instruction1' + --> $DIR/srcloc.rs:98:13 + | +LL | / concat!( +LL | | "invalid", "_", "instruction1", "\n", +LL | | "invalid", "_", "instruction2", +LL | | ), + | |_____________^ + | +note: instantiated into assembly here + --> <inline asm>:2:2 + | +LL | invalid_instruction1 + | ^^^^^^^^^^^^^^^^^^^^ + +error: invalid instruction mnemonic 'invalid_instruction2' + --> $DIR/srcloc.rs:98:13 + | +LL | / concat!( +LL | | "invalid", "_", "instruction1", "\n", +LL | | "invalid", "_", "instruction2", +LL | | ), + | |_____________^ + | +note: instantiated into assembly here + --> <inline asm>:3:1 + | +LL | invalid_instruction2 + | ^^^^^^^^^^^^^^^^^^^^ + +error: invalid instruction mnemonic 'invalid_instruction3' + --> $DIR/srcloc.rs:102:13 + | +LL | / concat!( +LL | | "invalid", "_", "instruction3", "\n", +LL | | "invalid", "_", "instruction4", +LL | | ), + | |_____________^ + | +note: instantiated into assembly here + --> <inline asm>:4:1 + | +LL | invalid_instruction3 + | ^^^^^^^^^^^^^^^^^^^^ + +error: invalid instruction mnemonic 'invalid_instruction4' + --> $DIR/srcloc.rs:102:13 + | +LL | / concat!( +LL | | "invalid", "_", "instruction3", "\n", +LL | | "invalid", "_", "instruction4", +LL | | ), + | |_____________^ + | +note: instantiated into assembly here + --> <inline asm>:5:1 + | +LL | invalid_instruction4 + | ^^^^^^^^^^^^^^^^^^^^ + +error: invalid instruction mnemonic 'invalid_instruction1' + --> $DIR/srcloc.rs:113:13 + | +LL | / concat!( +LL | | "invalid", "_", "instruction1", "\n", +LL | | "invalid", "_", "instruction2", "\n", +LL | | ), + | |_____________^ + | +note: instantiated into assembly here + --> <inline asm>:2:2 + | +LL | invalid_instruction1 + | ^^^^^^^^^^^^^^^^^^^^ + +error: invalid instruction mnemonic 'invalid_instruction2' + --> $DIR/srcloc.rs:113:13 + | +LL | / concat!( +LL | | "invalid", "_", "instruction1", "\n", +LL | | "invalid", "_", "instruction2", "\n", +LL | | ), + | |_____________^ + | +note: instantiated into assembly here + --> <inline asm>:3:1 + | +LL | invalid_instruction2 + | ^^^^^^^^^^^^^^^^^^^^ + +error: invalid instruction mnemonic 'invalid_instruction3' + --> $DIR/srcloc.rs:117:13 + | +LL | / concat!( +LL | | "invalid", "_", "instruction3", "\n", +LL | | "invalid", "_", "instruction4", "\n", +LL | | ), + | |_____________^ + | +note: instantiated into assembly here + --> <inline asm>:5:1 + | +LL | invalid_instruction3 + | ^^^^^^^^^^^^^^^^^^^^ + +error: invalid instruction mnemonic 'invalid_instruction4' + --> $DIR/srcloc.rs:117:13 + | +LL | / concat!( +LL | | "invalid", "_", "instruction3", "\n", +LL | | "invalid", "_", "instruction4", "\n", +LL | | ), + | |_____________^ + | +note: instantiated into assembly here + --> <inline asm>:6:1 + | +LL | invalid_instruction4 + | ^^^^^^^^^^^^^^^^^^^^ + +error: invalid instruction mnemonic 'invalid_instruction' + --> $DIR/srcloc.rs:130:14 + | +LL | "invalid_instruction" + | ^^^^^^^^^^^^^^^^^^^ + | +note: instantiated into assembly here + --> <inline asm>:5:1 + | +LL | invalid_instruction + | ^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 24 previous errors; 1 warning emitted + diff --git a/tests/ui/asm/x86_64/srcloc.stderr b/tests/ui/asm/x86_64/srcloc.old.stderr index 8899c1b916b..edb9ee46812 100644 --- a/tests/ui/asm/x86_64/srcloc.stderr +++ b/tests/ui/asm/x86_64/srcloc.old.stderr @@ -1,5 +1,5 @@ error: invalid instruction mnemonic 'invalid_instruction' - --> $DIR/srcloc.rs:11:15 + --> $DIR/srcloc.rs:14:15 | LL | asm!("invalid_instruction"); | ^ @@ -11,7 +11,7 @@ LL | invalid_instruction | ^^^^^^^^^^^^^^^^^^^ error: invalid instruction mnemonic 'invalid_instruction' - --> $DIR/srcloc.rs:15:13 + --> $DIR/srcloc.rs:18:13 | LL | invalid_instruction | ^ @@ -23,7 +23,7 @@ LL | invalid_instruction | ^^^^^^^^^^^^^^^^^^^ error: invalid instruction mnemonic 'invalid_instruction' - --> $DIR/srcloc.rs:20:13 + --> $DIR/srcloc.rs:23:13 | LL | invalid_instruction | ^ @@ -35,7 +35,7 @@ LL | invalid_instruction | ^^^^^^^^^^^^^^^^^^^ error: invalid instruction mnemonic 'invalid_instruction' - --> $DIR/srcloc.rs:26:13 + --> $DIR/srcloc.rs:29:13 | LL | invalid_instruction | ^ @@ -47,7 +47,7 @@ LL | invalid_instruction | ^^^^^^^^^^^^^^^^^^^ error: invalid instruction mnemonic 'invalid_instruction' - --> $DIR/srcloc.rs:33:13 + --> $DIR/srcloc.rs:36:13 | LL | invalid_instruction | ^ @@ -59,7 +59,7 @@ LL | invalid_instruction | ^^^^^^^^^^^^^^^^^^^ error: invalid instruction mnemonic 'invalid_instruction' - --> $DIR/srcloc.rs:38:14 + --> $DIR/srcloc.rs:41:14 | LL | asm!(concat!("invalid", "_", "instruction")); | ^ @@ -71,7 +71,7 @@ LL | invalid_instruction | ^^^^^^^^^^^^^^^^^^^ warning: scale factor without index register is ignored - --> $DIR/srcloc.rs:41:15 + --> $DIR/srcloc.rs:44:15 | LL | asm!("movaps %xmm3, (%esi, 2)", options(att_syntax)); | ^ @@ -83,7 +83,7 @@ LL | movaps %xmm3, (%esi, 2) | ^ error: invalid instruction mnemonic 'invalid_instruction' - --> $DIR/srcloc.rs:45:14 + --> $DIR/srcloc.rs:48:14 | LL | "invalid_instruction", | ^ @@ -95,7 +95,7 @@ LL | invalid_instruction | ^^^^^^^^^^^^^^^^^^^ error: invalid instruction mnemonic 'invalid_instruction' - --> $DIR/srcloc.rs:51:14 + --> $DIR/srcloc.rs:54:14 | LL | "invalid_instruction", | ^ @@ -107,7 +107,7 @@ LL | invalid_instruction | ^^^^^^^^^^^^^^^^^^^ error: invalid instruction mnemonic 'invalid_instruction' - --> $DIR/srcloc.rs:58:14 + --> $DIR/srcloc.rs:61:14 | LL | "invalid_instruction", | ^ @@ -119,7 +119,7 @@ LL | invalid_instruction | ^^^^^^^^^^^^^^^^^^^ error: invalid instruction mnemonic 'invalid_instruction' - --> $DIR/srcloc.rs:65:13 + --> $DIR/srcloc.rs:68:13 | LL | concat!("invalid", "_", "instruction"), | ^ @@ -131,7 +131,7 @@ LL | invalid_instruction | ^^^^^^^^^^^^^^^^^^^ error: invalid instruction mnemonic 'invalid_instruction' - --> $DIR/srcloc.rs:72:13 + --> $DIR/srcloc.rs:75:13 | LL | concat!("invalid", "_", "instruction"), | ^ @@ -143,7 +143,7 @@ LL | invalid_instruction | ^^^^^^^^^^^^^^^^^^^ error: invalid instruction mnemonic 'invalid_instruction1' - --> $DIR/srcloc.rs:79:14 + --> $DIR/srcloc.rs:82:14 | LL | "invalid_instruction1", | ^ @@ -155,7 +155,7 @@ LL | invalid_instruction1 | ^^^^^^^^^^^^^^^^^^^^ error: invalid instruction mnemonic 'invalid_instruction2' - --> $DIR/srcloc.rs:80:14 + --> $DIR/srcloc.rs:83:14 | LL | "invalid_instruction2", | ^ @@ -167,7 +167,7 @@ LL | invalid_instruction2 | ^^^^^^^^^^^^^^^^^^^^ error: invalid instruction mnemonic 'invalid_instruction1' - --> $DIR/srcloc.rs:86:13 + --> $DIR/srcloc.rs:89:13 | LL | concat!( | ^ @@ -179,7 +179,7 @@ LL | invalid_instruction1 | ^^^^^^^^^^^^^^^^^^^^ error: invalid instruction mnemonic 'invalid_instruction2' - --> $DIR/srcloc.rs:86:13 + --> $DIR/srcloc.rs:89:13 | LL | concat!( | ^ @@ -191,7 +191,7 @@ LL | invalid_instruction2 | ^^^^^^^^^^^^^^^^^^^^ error: invalid instruction mnemonic 'invalid_instruction1' - --> $DIR/srcloc.rs:95:13 + --> $DIR/srcloc.rs:98:13 | LL | concat!( | ^ @@ -203,7 +203,7 @@ LL | invalid_instruction1 | ^^^^^^^^^^^^^^^^^^^^ error: invalid instruction mnemonic 'invalid_instruction2' - --> $DIR/srcloc.rs:95:13 + --> $DIR/srcloc.rs:98:13 | LL | concat!( | ^ @@ -215,7 +215,7 @@ LL | invalid_instruction2 | ^^^^^^^^^^^^^^^^^^^^ error: invalid instruction mnemonic 'invalid_instruction3' - --> $DIR/srcloc.rs:99:13 + --> $DIR/srcloc.rs:102:13 | LL | concat!( | ^ @@ -227,7 +227,7 @@ LL | invalid_instruction3 | ^^^^^^^^^^^^^^^^^^^^ error: invalid instruction mnemonic 'invalid_instruction4' - --> $DIR/srcloc.rs:99:13 + --> $DIR/srcloc.rs:102:13 | LL | concat!( | ^ @@ -239,7 +239,7 @@ LL | invalid_instruction4 | ^^^^^^^^^^^^^^^^^^^^ error: invalid instruction mnemonic 'invalid_instruction1' - --> $DIR/srcloc.rs:110:13 + --> $DIR/srcloc.rs:113:13 | LL | concat!( | ^ @@ -251,7 +251,7 @@ LL | invalid_instruction1 | ^^^^^^^^^^^^^^^^^^^^ error: invalid instruction mnemonic 'invalid_instruction2' - --> $DIR/srcloc.rs:110:13 + --> $DIR/srcloc.rs:113:13 | LL | concat!( | ^ @@ -263,7 +263,7 @@ LL | invalid_instruction2 | ^^^^^^^^^^^^^^^^^^^^ error: invalid instruction mnemonic 'invalid_instruction3' - --> $DIR/srcloc.rs:114:13 + --> $DIR/srcloc.rs:117:13 | LL | concat!( | ^ @@ -275,7 +275,7 @@ LL | invalid_instruction3 | ^^^^^^^^^^^^^^^^^^^^ error: invalid instruction mnemonic 'invalid_instruction4' - --> $DIR/srcloc.rs:114:13 + --> $DIR/srcloc.rs:117:13 | LL | concat!( | ^ @@ -287,7 +287,7 @@ LL | invalid_instruction4 | ^^^^^^^^^^^^^^^^^^^^ error: invalid instruction mnemonic 'invalid_instruction' - --> $DIR/srcloc.rs:127:14 + --> $DIR/srcloc.rs:130:14 | LL | "invalid_instruction" | ^ diff --git a/tests/ui/asm/x86_64/srcloc.rs b/tests/ui/asm/x86_64/srcloc.rs index 2938bafe5e7..40fc66cbc92 100644 --- a/tests/ui/asm/x86_64/srcloc.rs +++ b/tests/ui/asm/x86_64/srcloc.rs @@ -1,6 +1,9 @@ +//@ revisions: old new //@ only-x86_64 //@ build-fail //@ compile-flags: -Ccodegen-units=1 +//@[old] ignore-llvm-version: 19 - 99 +//@[new] min-llvm-version: 19 use std::arch::asm; diff --git a/tests/ui/async-await/async-borrowck-escaping-closure-error.rs b/tests/ui/async-await/async-borrowck-escaping-closure-error.rs index ffb97ca04ac..4489f344e6f 100644 --- a/tests/ui/async-await/async-borrowck-escaping-closure-error.rs +++ b/tests/ui/async-await/async-borrowck-escaping-closure-error.rs @@ -1,6 +1,5 @@ //@ edition:2018 -#![feature(async_closure)] fn foo() -> Box<dyn std::future::Future<Output = u32>> { let x = 0u32; Box::new((async || x)()) diff --git a/tests/ui/async-await/async-borrowck-escaping-closure-error.stderr b/tests/ui/async-await/async-borrowck-escaping-closure-error.stderr index 4b1ce300b56..967b3bf5a77 100644 --- a/tests/ui/async-await/async-borrowck-escaping-closure-error.stderr +++ b/tests/ui/async-await/async-borrowck-escaping-closure-error.stderr @@ -1,5 +1,5 @@ error[E0515]: cannot return value referencing local variable `x` - --> $DIR/async-borrowck-escaping-closure-error.rs:6:5 + --> $DIR/async-borrowck-escaping-closure-error.rs:5:5 | LL | Box::new((async || x)()) | ^^^^^^^^^------------^^^ diff --git a/tests/ui/async-await/async-closure-matches-expr.rs b/tests/ui/async-await/async-closure-matches-expr.rs index 75ce14a4947..3f1c70e691c 100644 --- a/tests/ui/async-await/async-closure-matches-expr.rs +++ b/tests/ui/async-await/async-closure-matches-expr.rs @@ -1,8 +1,6 @@ //@ build-pass //@ edition:2018 -#![feature(async_closure)] - macro_rules! match_expr { ($x:expr) => {} } diff --git a/tests/ui/async-await/async-closure.rs b/tests/ui/async-await/async-closure.rs index 77c00bbdc9f..3dd88fbf739 100644 --- a/tests/ui/async-await/async-closure.rs +++ b/tests/ui/async-await/async-closure.rs @@ -6,8 +6,6 @@ //@ edition:2018 //@ aux-build:arc_wake.rs -#![feature(async_closure)] - extern crate arc_wake; use std::pin::Pin; diff --git a/tests/ui/async-await/async-closures/ambiguous-arg.rs b/tests/ui/async-await/async-closures/ambiguous-arg.rs index d76a1cf953e..e8e6ff6d97c 100644 --- a/tests/ui/async-await/async-closures/ambiguous-arg.rs +++ b/tests/ui/async-await/async-closures/ambiguous-arg.rs @@ -3,8 +3,6 @@ // Regression test for #123901. We previously ICE'd as we silently // swallowed an in the `ExprUseVisitor`. -#![feature(async_closure)] - pub fn test(test: &u64, temp: &u64) { async |check, a, b| { //~^ ERROR type annotations needed diff --git a/tests/ui/async-await/async-closures/ambiguous-arg.stderr b/tests/ui/async-await/async-closures/ambiguous-arg.stderr index 01f72e94ecc..adb71d676dc 100644 --- a/tests/ui/async-await/async-closures/ambiguous-arg.stderr +++ b/tests/ui/async-await/async-closures/ambiguous-arg.stderr @@ -1,5 +1,5 @@ error[E0282]: type annotations needed - --> $DIR/ambiguous-arg.rs:9:25 + --> $DIR/ambiguous-arg.rs:7:25 | LL | async |check, a, b| { | _________________________^ diff --git a/tests/ui/async-await/async-closures/arg-mismatch.rs b/tests/ui/async-await/async-closures/arg-mismatch.rs index c8dddee6275..f69c8122d1d 100644 --- a/tests/ui/async-await/async-closures/arg-mismatch.rs +++ b/tests/ui/async-await/async-closures/arg-mismatch.rs @@ -1,8 +1,6 @@ //@ aux-build:block-on.rs //@ edition:2021 -#![feature(async_closure)] - extern crate block_on; fn main() { diff --git a/tests/ui/async-await/async-closures/arg-mismatch.stderr b/tests/ui/async-await/async-closures/arg-mismatch.stderr index 70853ae2815..5c8e6650293 100644 --- a/tests/ui/async-await/async-closures/arg-mismatch.stderr +++ b/tests/ui/async-await/async-closures/arg-mismatch.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/arg-mismatch.rs:12:11 + --> $DIR/arg-mismatch.rs:10:11 | LL | c(2usize).await; | - ^^^^^^ expected `i32`, found `usize` @@ -7,7 +7,7 @@ LL | c(2usize).await; | arguments to this function are incorrect | note: closure parameter defined here - --> $DIR/arg-mismatch.rs:10:24 + --> $DIR/arg-mismatch.rs:8:24 | LL | let c = async |x| {}; | ^ diff --git a/tests/ui/async-await/async-closures/async-fn-mut-for-async-fn.rs b/tests/ui/async-await/async-closures/async-fn-mut-for-async-fn.rs index 8309cfbd58f..e739230fd46 100644 --- a/tests/ui/async-await/async-closures/async-fn-mut-for-async-fn.rs +++ b/tests/ui/async-await/async-closures/async-fn-mut-for-async-fn.rs @@ -2,8 +2,6 @@ //@ edition:2021 //@ run-pass -#![feature(async_closure)] - extern crate block_on; fn main() { diff --git a/tests/ui/async-await/async-closures/async-fn-once-for-async-fn.rs b/tests/ui/async-await/async-closures/async-fn-once-for-async-fn.rs index e7644e3dfe0..078348eb4e6 100644 --- a/tests/ui/async-await/async-closures/async-fn-once-for-async-fn.rs +++ b/tests/ui/async-await/async-closures/async-fn-once-for-async-fn.rs @@ -2,8 +2,6 @@ //@ edition:2021 //@ run-pass -#![feature(async_closure)] - extern crate block_on; fn main() { diff --git a/tests/ui/async-await/async-closures/auxiliary/block-on.rs b/tests/ui/async-await/async-closures/auxiliary/block-on.rs index 8b50c5571c1..4ec45ddf333 100644 --- a/tests/ui/async-await/async-closures/auxiliary/block-on.rs +++ b/tests/ui/async-await/async-closures/auxiliary/block-on.rs @@ -1,7 +1,5 @@ //@ edition: 2021 -#![feature(async_closure)] - use std::future::Future; use std::pin::pin; use std::task::*; diff --git a/tests/ui/async-await/async-closures/auxiliary/foreign.rs b/tests/ui/async-await/async-closures/auxiliary/foreign.rs index 33548a1b30d..935b029a7c5 100644 --- a/tests/ui/async-await/async-closures/auxiliary/foreign.rs +++ b/tests/ui/async-await/async-closures/auxiliary/foreign.rs @@ -1,7 +1,5 @@ //@ edition:2021 -#![feature(async_closure)] - pub fn closure() -> impl AsyncFn() { async || { /* Don't really need to do anything here. */ } } diff --git a/tests/ui/async-await/async-closures/await-inference-guidance.rs b/tests/ui/async-await/async-closures/await-inference-guidance.rs index 1ddc1f8d1c5..f4f91e2e073 100644 --- a/tests/ui/async-await/async-closures/await-inference-guidance.rs +++ b/tests/ui/async-await/async-closures/await-inference-guidance.rs @@ -2,8 +2,6 @@ //@ edition:2021 //@ run-pass -#![feature(async_closure)] - extern crate block_on; fn main() { diff --git a/tests/ui/async-await/async-closures/body-check-on-non-fnmut.rs b/tests/ui/async-await/async-closures/body-check-on-non-fnmut.rs index a72ff8e5dce..0560d3b0867 100644 --- a/tests/ui/async-await/async-closures/body-check-on-non-fnmut.rs +++ b/tests/ui/async-await/async-closures/body-check-on-non-fnmut.rs @@ -2,8 +2,6 @@ //@ edition:2021 //@ build-pass -#![feature(async_closure)] - extern crate block_on; // Make sure that we don't call `coroutine_by_move_body_def_id` query diff --git a/tests/ui/async-await/async-closures/box-deref-in-debuginfo.rs b/tests/ui/async-await/async-closures/box-deref-in-debuginfo.rs index 5ec1c5ee50e..10f7636720c 100644 --- a/tests/ui/async-await/async-closures/box-deref-in-debuginfo.rs +++ b/tests/ui/async-await/async-closures/box-deref-in-debuginfo.rs @@ -2,8 +2,6 @@ //@ edition:2021 //@ run-pass -#![feature(async_closure)] - extern crate block_on; pub trait Trait { diff --git a/tests/ui/async-await/async-closures/brand.rs b/tests/ui/async-await/async-closures/brand.rs index db1f5d271c6..3b13506cf00 100644 --- a/tests/ui/async-await/async-closures/brand.rs +++ b/tests/ui/async-await/async-closures/brand.rs @@ -2,8 +2,6 @@ //@ edition:2021 //@ build-pass -#![feature(async_closure)] - extern crate block_on; use std::future::Future; diff --git a/tests/ui/async-await/async-closures/call-once-deduction.rs b/tests/ui/async-await/async-closures/call-once-deduction.rs new file mode 100644 index 00000000000..ed2830a5e82 --- /dev/null +++ b/tests/ui/async-await/async-closures/call-once-deduction.rs @@ -0,0 +1,14 @@ +//@ edition: 2021 +//@ check-pass + +#![feature(async_fn_traits, unboxed_closures)] + +fn bar<F, O>(_: F) +where + F: AsyncFnOnce<(), CallOnceFuture = O>, +{ +} + +fn main() { + bar(async move || {}); +} diff --git a/tests/ui/async-await/async-closures/captures.rs b/tests/ui/async-await/async-closures/captures.rs index 2bd4b685997..296fca6cb86 100644 --- a/tests/ui/async-await/async-closures/captures.rs +++ b/tests/ui/async-await/async-closures/captures.rs @@ -5,8 +5,6 @@ // Same as miri's `tests/pass/async-closure-captures.rs`, keep in sync -#![feature(async_closure)] - extern crate block_on; fn main() { diff --git a/tests/ui/async-await/async-closures/clone-closure.rs b/tests/ui/async-await/async-closures/clone-closure.rs index a9e1d6bccc7..b637ab45b9a 100644 --- a/tests/ui/async-await/async-closures/clone-closure.rs +++ b/tests/ui/async-await/async-closures/clone-closure.rs @@ -3,8 +3,6 @@ //@ run-pass //@ check-run-results -#![feature(async_closure)] - extern crate block_on; async fn for_each(f: impl AsyncFnOnce(&str) + Clone) { diff --git a/tests/ui/async-await/async-closures/closure-shim-borrowck-error.rs b/tests/ui/async-await/async-closures/closure-shim-borrowck-error.rs index 4cbbefb0f52..069744a3282 100644 --- a/tests/ui/async-await/async-closures/closure-shim-borrowck-error.rs +++ b/tests/ui/async-await/async-closures/closure-shim-borrowck-error.rs @@ -1,7 +1,5 @@ //@ compile-flags: -Zvalidate-mir --edition=2018 --crate-type=lib -Copt-level=3 -#![feature(async_closure)] - fn main() {} fn needs_fn_mut<T>(mut x: impl FnMut() -> T) { diff --git a/tests/ui/async-await/async-closures/closure-shim-borrowck-error.stderr b/tests/ui/async-await/async-closures/closure-shim-borrowck-error.stderr index bab26c19482..52697bac509 100644 --- a/tests/ui/async-await/async-closures/closure-shim-borrowck-error.stderr +++ b/tests/ui/async-await/async-closures/closure-shim-borrowck-error.stderr @@ -1,5 +1,5 @@ error[E0507]: cannot move out of `x` which is behind a mutable reference - --> $DIR/closure-shim-borrowck-error.rs:12:18 + --> $DIR/closure-shim-borrowck-error.rs:10:18 | LL | needs_fn_mut(async || { | ^^^^^^^^ `x` is moved here @@ -11,7 +11,7 @@ LL | x.hello(); | move occurs because `x` has type `Ty`, which does not implement the `Copy` trait | note: if `Ty` implemented `Clone`, you could clone the value - --> $DIR/closure-shim-borrowck-error.rs:18:1 + --> $DIR/closure-shim-borrowck-error.rs:16:1 | LL | x.hello(); | - you could clone this value diff --git a/tests/ui/async-await/async-closures/constrained-but-no-upvars-yet.rs b/tests/ui/async-await/async-closures/constrained-but-no-upvars-yet.rs index 1acbf0311b3..993f8378439 100644 --- a/tests/ui/async-await/async-closures/constrained-but-no-upvars-yet.rs +++ b/tests/ui/async-await/async-closures/constrained-but-no-upvars-yet.rs @@ -4,8 +4,6 @@ //@ ignore-compare-mode-next-solver (explicit revisions) //@[next] compile-flags: -Znext-solver -#![feature(async_closure)] - fn constrain<T: AsyncFnOnce()>(t: T) -> T { t } diff --git a/tests/ui/async-await/async-closures/debuginfo-by-move-body.rs b/tests/ui/async-await/async-closures/debuginfo-by-move-body.rs index f71cc1ef537..a1d6ce259e2 100644 --- a/tests/ui/async-await/async-closures/debuginfo-by-move-body.rs +++ b/tests/ui/async-await/async-closures/debuginfo-by-move-body.rs @@ -3,8 +3,6 @@ //@ build-pass //@ compile-flags: -Cdebuginfo=2 -#![feature(async_closure)] - extern crate block_on; async fn call_once(f: impl AsyncFnOnce()) { diff --git a/tests/ui/async-await/async-closures/def-path.rs b/tests/ui/async-await/async-closures/def-path.rs index 70450697816..838556966e8 100644 --- a/tests/ui/async-await/async-closures/def-path.rs +++ b/tests/ui/async-await/async-closures/def-path.rs @@ -1,8 +1,6 @@ //@ compile-flags: -Zverbose-internals //@ edition:2021 -#![feature(async_closure)] - fn main() { let x = async || {}; //~^ NOTE the expected `async` closure body diff --git a/tests/ui/async-await/async-closures/def-path.stderr b/tests/ui/async-await/async-closures/def-path.stderr index 0a1e30c1253..cf25b2d2d23 100644 --- a/tests/ui/async-await/async-closures/def-path.stderr +++ b/tests/ui/async-await/async-closures/def-path.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/def-path.rs:9:9 + --> $DIR/def-path.rs:7:9 | LL | let x = async || {}; | -- the expected `async` closure body diff --git a/tests/ui/async-await/async-closures/different-projection-lengths-for-different-upvars.rs b/tests/ui/async-await/async-closures/different-projection-lengths-for-different-upvars.rs index 2313db506be..d40c9548a3a 100644 --- a/tests/ui/async-await/async-closures/different-projection-lengths-for-different-upvars.rs +++ b/tests/ui/async-await/async-closures/different-projection-lengths-for-different-upvars.rs @@ -2,8 +2,6 @@ //@ edition: 2021 // issue: rust-lang/rust#123697 -#![feature(async_closure)] - struct S { t: i32 } fn test(s: &S, t: &i32) { diff --git a/tests/ui/async-await/async-closures/dont-ice-when-body-tainted-by-errors.rs b/tests/ui/async-await/async-closures/dont-ice-when-body-tainted-by-errors.rs index 8fc9924a12f..f90d10ebe85 100644 --- a/tests/ui/async-await/async-closures/dont-ice-when-body-tainted-by-errors.rs +++ b/tests/ui/async-await/async-closures/dont-ice-when-body-tainted-by-errors.rs @@ -1,7 +1,5 @@ //@ edition: 2021 -#![feature(async_closure)] - struct DropMe; trait Impossible {} diff --git a/tests/ui/async-await/async-closures/dont-ice-when-body-tainted-by-errors.stderr b/tests/ui/async-await/async-closures/dont-ice-when-body-tainted-by-errors.stderr index b4dc3e268bd..c93c1732a22 100644 --- a/tests/ui/async-await/async-closures/dont-ice-when-body-tainted-by-errors.stderr +++ b/tests/ui/async-await/async-closures/dont-ice-when-body-tainted-by-errors.stderr @@ -1,16 +1,16 @@ error[E0277]: the trait bound `(): Impossible` is not satisfied - --> $DIR/dont-ice-when-body-tainted-by-errors.rs:19:23 + --> $DIR/dont-ice-when-body-tainted-by-errors.rs:17:23 | LL | trait_error::<()>(); | ^^ the trait `Impossible` is not implemented for `()` | help: this trait has no implementations, consider adding one - --> $DIR/dont-ice-when-body-tainted-by-errors.rs:7:1 + --> $DIR/dont-ice-when-body-tainted-by-errors.rs:5:1 | LL | trait Impossible {} | ^^^^^^^^^^^^^^^^ note: required by a bound in `trait_error` - --> $DIR/dont-ice-when-body-tainted-by-errors.rs:8:19 + --> $DIR/dont-ice-when-body-tainted-by-errors.rs:6:19 | LL | fn trait_error<T: Impossible>() {} | ^^^^^^^^^^ required by this bound in `trait_error` diff --git a/tests/ui/async-await/async-closures/drop.rs b/tests/ui/async-await/async-closures/drop.rs index 9c99550e3b7..24c182d2c2d 100644 --- a/tests/ui/async-await/async-closures/drop.rs +++ b/tests/ui/async-await/async-closures/drop.rs @@ -3,7 +3,6 @@ //@ run-pass //@ check-run-results -#![feature(async_closure)] #![allow(unused)] extern crate block_on; diff --git a/tests/ui/async-await/async-closures/fn-exception-target-features.rs b/tests/ui/async-await/async-closures/fn-exception-target-features.rs index eb554650b7c..82fc776fd2c 100644 --- a/tests/ui/async-await/async-closures/fn-exception-target-features.rs +++ b/tests/ui/async-await/async-closures/fn-exception-target-features.rs @@ -1,7 +1,7 @@ //@ edition: 2021 //@ only-x86_64 -#![feature(async_closure, target_feature_11)] +#![feature(target_feature_11)] // `target_feature_11` just to test safe functions w/ target features. use std::pin::Pin; diff --git a/tests/ui/async-await/async-closures/fn-exception.rs b/tests/ui/async-await/async-closures/fn-exception.rs index 36cb955cd5c..8ff63983e79 100644 --- a/tests/ui/async-await/async-closures/fn-exception.rs +++ b/tests/ui/async-await/async-closures/fn-exception.rs @@ -1,7 +1,5 @@ //@ edition: 2021 -#![feature(async_closure)] - use std::pin::Pin; use std::future::Future; diff --git a/tests/ui/async-await/async-closures/fn-exception.stderr b/tests/ui/async-await/async-closures/fn-exception.stderr index b3118664c15..aa74ed234df 100644 --- a/tests/ui/async-await/async-closures/fn-exception.stderr +++ b/tests/ui/async-await/async-closures/fn-exception.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `unsafe fn() -> Pin<Box<(dyn Future<Output = ()> + 'static)>> {unsafety}: AsyncFn()` is not satisfied - --> $DIR/fn-exception.rs:19:10 + --> $DIR/fn-exception.rs:17:10 | LL | test(unsafety); | ---- ^^^^^^^^ the trait `AsyncFn()` is not implemented for fn item `unsafe fn() -> Pin<Box<(dyn Future<Output = ()> + 'static)>> {unsafety}` @@ -7,13 +7,13 @@ LL | test(unsafety); | required by a bound introduced by this call | note: required by a bound in `test` - --> $DIR/fn-exception.rs:16:17 + --> $DIR/fn-exception.rs:14:17 | LL | fn test(f: impl AsyncFn()) {} | ^^^^^^^^^ required by this bound in `test` error[E0277]: the trait bound `extern "C" fn() -> Pin<Box<(dyn Future<Output = ()> + 'static)>> {abi}: AsyncFn()` is not satisfied - --> $DIR/fn-exception.rs:20:10 + --> $DIR/fn-exception.rs:18:10 | LL | test(abi); | ---- ^^^ the trait `AsyncFn()` is not implemented for fn item `extern "C" fn() -> Pin<Box<(dyn Future<Output = ()> + 'static)>> {abi}` @@ -21,7 +21,7 @@ LL | test(abi); | required by a bound introduced by this call | note: required by a bound in `test` - --> $DIR/fn-exception.rs:16:17 + --> $DIR/fn-exception.rs:14:17 | LL | fn test(f: impl AsyncFn()) {} | ^^^^^^^^^ required by this bound in `test` diff --git a/tests/ui/async-await/async-closures/force-move-due-to-actually-fnonce.rs b/tests/ui/async-await/async-closures/force-move-due-to-actually-fnonce.rs index 7244a29673b..1347a4b259b 100644 --- a/tests/ui/async-await/async-closures/force-move-due-to-actually-fnonce.rs +++ b/tests/ui/async-await/async-closures/force-move-due-to-actually-fnonce.rs @@ -2,8 +2,6 @@ //@ edition:2021 //@ build-pass -#![feature(async_closure)] - extern crate block_on; fn consume(_: String) {} diff --git a/tests/ui/async-await/async-closures/force-move-due-to-inferred-kind.rs b/tests/ui/async-await/async-closures/force-move-due-to-inferred-kind.rs index c20e3664d8b..c963d282c4e 100644 --- a/tests/ui/async-await/async-closures/force-move-due-to-inferred-kind.rs +++ b/tests/ui/async-await/async-closures/force-move-due-to-inferred-kind.rs @@ -2,8 +2,6 @@ //@ edition:2021 //@ build-pass -#![feature(async_closure)] - extern crate block_on; fn force_fnonce<T: AsyncFnOnce()>(t: T) -> T { t } diff --git a/tests/ui/async-await/async-closures/foreign.rs b/tests/ui/async-await/async-closures/foreign.rs index a244eef4102..b0580a8f09d 100644 --- a/tests/ui/async-await/async-closures/foreign.rs +++ b/tests/ui/async-await/async-closures/foreign.rs @@ -3,8 +3,6 @@ //@ edition:2021 //@ build-pass -#![feature(async_closure)] - use std::future::Future; extern crate block_on; diff --git a/tests/ui/async-await/async-closures/higher-ranked-return.rs b/tests/ui/async-await/async-closures/higher-ranked-return.rs index d6bea5dd103..328c733d42d 100644 --- a/tests/ui/async-await/async-closures/higher-ranked-return.rs +++ b/tests/ui/async-await/async-closures/higher-ranked-return.rs @@ -4,8 +4,6 @@ //@ known-bug: unknown // Borrow checking doesn't like that higher-ranked output... -#![feature(async_closure)] - extern crate block_on; fn main() { diff --git a/tests/ui/async-await/async-closures/higher-ranked-return.stderr b/tests/ui/async-await/async-closures/higher-ranked-return.stderr index 268631f67cd..23ce3df6616 100644 --- a/tests/ui/async-await/async-closures/higher-ranked-return.stderr +++ b/tests/ui/async-await/async-closures/higher-ranked-return.stderr @@ -1,10 +1,10 @@ error: lifetime may not live long enough - --> $DIR/higher-ranked-return.rs:13:46 + --> $DIR/higher-ranked-return.rs:11:46 | LL | let x = async move |x: &str| -> &str { | ________________________________-________----_^ | | | | - | | | return type of async closure `{async closure body@$DIR/higher-ranked-return.rs:13:46: 15:10}` contains a lifetime `'2` + | | | return type of async closure `{async closure body@$DIR/higher-ranked-return.rs:11:46: 13:10}` contains a lifetime `'2` | | let's call the lifetime of this reference `'1` LL | | x LL | | }; diff --git a/tests/ui/async-await/async-closures/higher-ranked.rs b/tests/ui/async-await/async-closures/higher-ranked.rs index 5b34bfce961..28f9df60130 100644 --- a/tests/ui/async-await/async-closures/higher-ranked.rs +++ b/tests/ui/async-await/async-closures/higher-ranked.rs @@ -2,8 +2,6 @@ //@ edition:2021 //@ build-pass -#![feature(async_closure)] - extern crate block_on; fn main() { diff --git a/tests/ui/async-await/async-closures/implements-fnmut.rs b/tests/ui/async-await/async-closures/implements-fnmut.rs index f49d1423c40..a2e31bb9870 100644 --- a/tests/ui/async-await/async-closures/implements-fnmut.rs +++ b/tests/ui/async-await/async-closures/implements-fnmut.rs @@ -7,8 +7,6 @@ // `should_reborrow_from_env_of_parent_coroutine_closure` for more detail for when we // must borrow from the closure env. -#![feature(async_closure)] - fn main() { hello(&Ty); } diff --git a/tests/ui/async-await/async-closures/inline-body.rs b/tests/ui/async-await/async-closures/inline-body.rs index b7d7102c287..3f1b9c26601 100644 --- a/tests/ui/async-await/async-closures/inline-body.rs +++ b/tests/ui/async-await/async-closures/inline-body.rs @@ -6,8 +6,6 @@ // `mir_inliner_callees` for the synthetic by-move coroutine body since // its def-id wasn't previously being considered. -#![feature(async_closure)] - use std::future::Future; use std::pin::pin; use std::task::*; diff --git a/tests/ui/async-await/async-closures/is-fn.rs b/tests/ui/async-await/async-closures/is-fn.rs index 89c3a96bbbe..45c2b6ae342 100644 --- a/tests/ui/async-await/async-closures/is-fn.rs +++ b/tests/ui/async-await/async-closures/is-fn.rs @@ -5,8 +5,6 @@ //@ ignore-compare-mode-next-solver (explicit revisions) //@[next] compile-flags: -Znext-solver -#![feature(async_closure)] - use std::future::Future; extern crate block_on; diff --git a/tests/ui/async-await/async-closures/is-not-fn.rs b/tests/ui/async-await/async-closures/is-not-fn.rs index f877513043d..4acaa5d9809 100644 --- a/tests/ui/async-await/async-closures/is-not-fn.rs +++ b/tests/ui/async-await/async-closures/is-not-fn.rs @@ -1,9 +1,7 @@ //@ edition:2021 -#![feature(async_closure)] - fn main() { fn needs_fn(x: impl FnOnce()) {} needs_fn(async || {}); - //~^ ERROR expected `{async closure@is-not-fn.rs:7:14}` to be a closure that returns `()` + //~^ ERROR expected `{async closure@is-not-fn.rs:5:14}` to be a closure that returns `()` } diff --git a/tests/ui/async-await/async-closures/is-not-fn.stderr b/tests/ui/async-await/async-closures/is-not-fn.stderr index 130746ece67..bc1d5e6e9d1 100644 --- a/tests/ui/async-await/async-closures/is-not-fn.stderr +++ b/tests/ui/async-await/async-closures/is-not-fn.stderr @@ -1,5 +1,5 @@ -error[E0271]: expected `{async closure@is-not-fn.rs:7:14}` to be a closure that returns `()`, but it returns `{async closure body@$DIR/is-not-fn.rs:7:23: 7:25}` - --> $DIR/is-not-fn.rs:7:14 +error[E0271]: expected `{async closure@is-not-fn.rs:5:14}` to be a closure that returns `()`, but it returns `{async closure body@$DIR/is-not-fn.rs:5:23: 5:25}` + --> $DIR/is-not-fn.rs:5:14 | LL | needs_fn(async || {}); | -------- ^^^^^^^^^^^ expected `()`, found `async` closure body @@ -7,9 +7,9 @@ LL | needs_fn(async || {}); | required by a bound introduced by this call | = note: expected unit type `()` - found `async` closure body `{async closure body@$DIR/is-not-fn.rs:7:23: 7:25}` + found `async` closure body `{async closure body@$DIR/is-not-fn.rs:5:23: 5:25}` note: required by a bound in `needs_fn` - --> $DIR/is-not-fn.rs:6:25 + --> $DIR/is-not-fn.rs:4:25 | LL | fn needs_fn(x: impl FnOnce()) {} | ^^^^^^^^ required by this bound in `needs_fn` diff --git a/tests/ui/async-await/async-closures/lint-closure-returning-async-block.rs b/tests/ui/async-await/async-closures/lint-closure-returning-async-block.rs index 3e2ab8321a8..f05d918aef2 100644 --- a/tests/ui/async-await/async-closures/lint-closure-returning-async-block.rs +++ b/tests/ui/async-await/async-closures/lint-closure-returning-async-block.rs @@ -1,6 +1,5 @@ //@ edition: 2021 -#![feature(async_closure)] #![deny(closure_returning_async_block)] fn main() { diff --git a/tests/ui/async-await/async-closures/lint-closure-returning-async-block.stderr b/tests/ui/async-await/async-closures/lint-closure-returning-async-block.stderr index 4c0c4d797d8..287dc52c593 100644 --- a/tests/ui/async-await/async-closures/lint-closure-returning-async-block.stderr +++ b/tests/ui/async-await/async-closures/lint-closure-returning-async-block.stderr @@ -1,11 +1,11 @@ error: closure returning async block can be made into an async closure - --> $DIR/lint-closure-returning-async-block.rs:7:13 + --> $DIR/lint-closure-returning-async-block.rs:6:13 | LL | let x = || async {}; | ^^ ----- this async block can be removed, and the closure can be turned into an async closure | note: the lint level is defined here - --> $DIR/lint-closure-returning-async-block.rs:4:9 + --> $DIR/lint-closure-returning-async-block.rs:3:9 | LL | #![deny(closure_returning_async_block)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -16,7 +16,7 @@ LL + let x = async || {}; | error: closure returning async block can be made into an async closure - --> $DIR/lint-closure-returning-async-block.rs:10:13 + --> $DIR/lint-closure-returning-async-block.rs:9:13 | LL | let x = || async move {}; | ^^ ---------- this async block can be removed, and the closure can be turned into an async closure @@ -28,7 +28,7 @@ LL + let x = async || {}; | error: closure returning async block can be made into an async closure - --> $DIR/lint-closure-returning-async-block.rs:13:13 + --> $DIR/lint-closure-returning-async-block.rs:12:13 | LL | let x = move || async move {}; | ^^^^^^^ ---------- this async block can be removed, and the closure can be turned into an async closure @@ -40,7 +40,7 @@ LL + let x = async move || {}; | error: closure returning async block can be made into an async closure - --> $DIR/lint-closure-returning-async-block.rs:16:13 + --> $DIR/lint-closure-returning-async-block.rs:15:13 | LL | let x = move || async {}; | ^^^^^^^ ----- this async block can be removed, and the closure can be turned into an async closure @@ -52,7 +52,7 @@ LL + let x = async move || {}; | error: closure returning async block can be made into an async closure - --> $DIR/lint-closure-returning-async-block.rs:19:13 + --> $DIR/lint-closure-returning-async-block.rs:18:13 | LL | let x = || {{ async {} }}; | ^^ ----- this async block can be removed, and the closure can be turned into an async closure diff --git a/tests/ui/async-await/async-closures/mac-body.rs b/tests/ui/async-await/async-closures/mac-body.rs index a416227c390..51c077ba03f 100644 --- a/tests/ui/async-await/async-closures/mac-body.rs +++ b/tests/ui/async-await/async-closures/mac-body.rs @@ -1,8 +1,6 @@ //@ edition: 2021 //@ check-pass -#![feature(async_closure)] - // Make sure we don't ICE if an async closure has a macro body. // This happened because we were calling walk instead of visit // in the def collector, oops! diff --git a/tests/ui/async-await/async-closures/mangle.rs b/tests/ui/async-await/async-closures/mangle.rs index 1790f369c57..c8e5e52e1b2 100644 --- a/tests/ui/async-await/async-closures/mangle.rs +++ b/tests/ui/async-await/async-closures/mangle.rs @@ -5,8 +5,6 @@ //@[v0] compile-flags: -Csymbol-mangling-version=v0 //@[legacy] compile-flags: -Csymbol-mangling-version=legacy -Zunstable-options -#![feature(async_closure)] - extern crate block_on; use std::future::Future; diff --git a/tests/ui/async-await/async-closures/moro-example.rs b/tests/ui/async-await/async-closures/moro-example.rs index c331b8e5b5e..502b3e1bbf8 100644 --- a/tests/ui/async-await/async-closures/moro-example.rs +++ b/tests/ui/async-await/async-closures/moro-example.rs @@ -1,8 +1,6 @@ //@ check-pass //@ edition: 2021 -#![feature(async_closure)] - use std::future::Future; use std::pin::Pin; use std::{marker::PhantomData, sync::Mutex}; diff --git a/tests/ui/async-await/async-closures/move-consuming-capture.rs b/tests/ui/async-await/async-closures/move-consuming-capture.rs index 17925fc89ba..c833bc7e895 100644 --- a/tests/ui/async-await/async-closures/move-consuming-capture.rs +++ b/tests/ui/async-await/async-closures/move-consuming-capture.rs @@ -1,8 +1,6 @@ //@ aux-build:block-on.rs //@ edition:2021 -#![feature(async_closure)] - extern crate block_on; struct NoCopy; diff --git a/tests/ui/async-await/async-closures/move-consuming-capture.stderr b/tests/ui/async-await/async-closures/move-consuming-capture.stderr index 4ce71ec49d6..e28716ca213 100644 --- a/tests/ui/async-await/async-closures/move-consuming-capture.stderr +++ b/tests/ui/async-await/async-closures/move-consuming-capture.stderr @@ -1,8 +1,8 @@ error[E0382]: use of moved value: `x` - --> $DIR/move-consuming-capture.rs:17:9 + --> $DIR/move-consuming-capture.rs:15:9 | LL | let x = async move || { - | - move occurs because `x` has type `{async closure@$DIR/move-consuming-capture.rs:13:17: 13:30}`, which does not implement the `Copy` trait + | - move occurs because `x` has type `{async closure@$DIR/move-consuming-capture.rs:11:17: 11:30}`, which does not implement the `Copy` trait ... LL | x().await; | --- `x` moved due to this method call diff --git a/tests/ui/async-await/async-closures/move-is-async-fn.rs b/tests/ui/async-await/async-closures/move-is-async-fn.rs index d0e2bc24b52..2cbad0faffc 100644 --- a/tests/ui/async-await/async-closures/move-is-async-fn.rs +++ b/tests/ui/async-await/async-closures/move-is-async-fn.rs @@ -2,7 +2,7 @@ //@ edition:2021 //@ build-pass -#![feature(async_closure, async_fn_traits)] +#![feature(async_fn_traits)] extern crate block_on; diff --git a/tests/ui/async-await/async-closures/move-out-of-ref.rs b/tests/ui/async-await/async-closures/move-out-of-ref.rs index a05447232f6..34389d2d00a 100644 --- a/tests/ui/async-await/async-closures/move-out-of-ref.rs +++ b/tests/ui/async-await/async-closures/move-out-of-ref.rs @@ -1,8 +1,6 @@ //@ compile-flags: -Zvalidate-mir //@ edition: 2021 -#![feature(async_closure)] - // NOT copy. struct Ty; diff --git a/tests/ui/async-await/async-closures/move-out-of-ref.stderr b/tests/ui/async-await/async-closures/move-out-of-ref.stderr index 294905a481d..8a63515a8a9 100644 --- a/tests/ui/async-await/async-closures/move-out-of-ref.stderr +++ b/tests/ui/async-await/async-closures/move-out-of-ref.stderr @@ -1,11 +1,11 @@ error[E0507]: cannot move out of `*x` which is behind a shared reference - --> $DIR/move-out-of-ref.rs:11:9 + --> $DIR/move-out-of-ref.rs:9:9 | LL | *x; | ^^ move occurs because `*x` has type `Ty`, which does not implement the `Copy` trait | note: if `Ty` implemented `Clone`, you could clone the value - --> $DIR/move-out-of-ref.rs:7:1 + --> $DIR/move-out-of-ref.rs:5:1 | LL | struct Ty; | ^^^^^^^^^ consider implementing `Clone` for this type diff --git a/tests/ui/async-await/async-closures/mut-ref-reborrow.rs b/tests/ui/async-await/async-closures/mut-ref-reborrow.rs index c37048398e9..a1a90a1c9ad 100644 --- a/tests/ui/async-await/async-closures/mut-ref-reborrow.rs +++ b/tests/ui/async-await/async-closures/mut-ref-reborrow.rs @@ -5,8 +5,6 @@ //@[e2018] edition:2018 //@[e2021] edition:2021 -#![feature(async_closure)] - extern crate block_on; async fn call_once(f: impl AsyncFnOnce()) { f().await; } diff --git a/tests/ui/async-await/async-closures/mutate.rs b/tests/ui/async-await/async-closures/mutate.rs index 562a7271c66..7c1d8389eac 100644 --- a/tests/ui/async-await/async-closures/mutate.rs +++ b/tests/ui/async-await/async-closures/mutate.rs @@ -2,8 +2,6 @@ //@ edition:2021 //@ run-pass -#![feature(async_closure)] - extern crate block_on; fn main() { diff --git a/tests/ui/async-await/async-closures/no-borrow-from-env.rs b/tests/ui/async-await/async-closures/no-borrow-from-env.rs index 36b10c06dca..ce180631389 100644 --- a/tests/ui/async-await/async-closures/no-borrow-from-env.rs +++ b/tests/ui/async-await/async-closures/no-borrow-from-env.rs @@ -1,8 +1,6 @@ //@ edition: 2021 //@ check-pass -#![feature(async_closure)] - fn outlives<'a>(_: impl Sized + 'a) {} async fn call_once(f: impl AsyncFnOnce()) { diff --git a/tests/ui/async-await/async-closures/non-copy-arg-does-not-force-inner-move.rs b/tests/ui/async-await/async-closures/non-copy-arg-does-not-force-inner-move.rs index cfb50dd5574..0c22ac97265 100644 --- a/tests/ui/async-await/async-closures/non-copy-arg-does-not-force-inner-move.rs +++ b/tests/ui/async-await/async-closures/non-copy-arg-does-not-force-inner-move.rs @@ -2,8 +2,6 @@ //@ edition:2021 //@ build-pass -#![feature(async_closure)] - extern crate block_on; fn wrapper(f: impl Fn(String)) -> impl AsyncFn(String) { diff --git a/tests/ui/async-await/async-closures/not-clone-closure.rs b/tests/ui/async-await/async-closures/not-clone-closure.rs index 2776ce4690f..c96c50e85d8 100644 --- a/tests/ui/async-await/async-closures/not-clone-closure.rs +++ b/tests/ui/async-await/async-closures/not-clone-closure.rs @@ -1,7 +1,5 @@ //@ edition: 2021 -#![feature(async_closure)] - struct NotClonableArg; #[derive(Default)] struct NotClonableReturnType; diff --git a/tests/ui/async-await/async-closures/not-clone-closure.stderr b/tests/ui/async-await/async-closures/not-clone-closure.stderr index c2f963f9b92..a08ee45f970 100644 --- a/tests/ui/async-await/async-closures/not-clone-closure.stderr +++ b/tests/ui/async-await/async-closures/not-clone-closure.stderr @@ -1,12 +1,12 @@ -error[E0277]: the trait bound `NotClonableUpvar: Clone` is not satisfied in `{async closure@$DIR/not-clone-closure.rs:29:21: 29:34}` - --> $DIR/not-clone-closure.rs:32:15 +error[E0277]: the trait bound `NotClonableUpvar: Clone` is not satisfied in `{async closure@$DIR/not-clone-closure.rs:27:21: 27:34}` + --> $DIR/not-clone-closure.rs:30:15 | LL | not_clone.clone(); | ^^^^^ unsatisfied trait bound | - = help: within `{async closure@$DIR/not-clone-closure.rs:29:21: 29:34}`, the trait `Clone` is not implemented for `NotClonableUpvar` + = help: within `{async closure@$DIR/not-clone-closure.rs:27:21: 27:34}`, the trait `Clone` is not implemented for `NotClonableUpvar` note: required because it's used within this closure - --> $DIR/not-clone-closure.rs:29:21 + --> $DIR/not-clone-closure.rs:27:21 | LL | let not_clone = async move || { | ^^^^^^^^^^^^^ diff --git a/tests/ui/async-await/async-closures/not-fn.rs b/tests/ui/async-await/async-closures/not-fn.rs index 5f2d047c3e9..34dd2a22bbb 100644 --- a/tests/ui/async-await/async-closures/not-fn.rs +++ b/tests/ui/async-await/async-closures/not-fn.rs @@ -2,8 +2,6 @@ // FIXME(async_closures): This needs a better error message! -#![feature(async_closure)] - fn main() { fn needs_fn<T>(_: impl FnMut() -> T) {} diff --git a/tests/ui/async-await/async-closures/not-fn.stderr b/tests/ui/async-await/async-closures/not-fn.stderr index 9c40613599a..4b9d2db9a25 100644 --- a/tests/ui/async-await/async-closures/not-fn.stderr +++ b/tests/ui/async-await/async-closures/not-fn.stderr @@ -1,5 +1,5 @@ error: async closure does not implement `FnMut` because it captures state from its environment - --> $DIR/not-fn.rs:11:14 + --> $DIR/not-fn.rs:9:14 | LL | needs_fn(async || { | -------- ^^^^^^^^ @@ -7,7 +7,7 @@ LL | needs_fn(async || { | required by a bound introduced by this call | note: required by a bound in `needs_fn` - --> $DIR/not-fn.rs:8:28 + --> $DIR/not-fn.rs:6:28 | LL | fn needs_fn<T>(_: impl FnMut() -> T) {} | ^^^^^^^^^^^^ required by this bound in `needs_fn` diff --git a/tests/ui/async-await/async-closures/not-lending.rs b/tests/ui/async-await/async-closures/not-lending.rs index 2e5542207cf..7bf2d3ead52 100644 --- a/tests/ui/async-await/async-closures/not-lending.rs +++ b/tests/ui/async-await/async-closures/not-lending.rs @@ -1,8 +1,6 @@ //@ aux-build:block-on.rs //@ edition:2021 -#![feature(async_closure)] - extern crate block_on; // Make sure that we can't make an async closure that evaluates to a self-borrow. diff --git a/tests/ui/async-await/async-closures/not-lending.stderr b/tests/ui/async-await/async-closures/not-lending.stderr index 1713e49b551..f0028129caa 100644 --- a/tests/ui/async-await/async-closures/not-lending.stderr +++ b/tests/ui/async-await/async-closures/not-lending.stderr @@ -1,21 +1,21 @@ error: lifetime may not live long enough - --> $DIR/not-lending.rs:14:42 + --> $DIR/not-lending.rs:12:42 | LL | let x = async move || -> &String { &s }; | ------------------------ ^^^^^^ returning this value requires that `'1` must outlive `'2` | | | - | | return type of async closure `{async closure body@$DIR/not-lending.rs:14:42: 14:48}` contains a lifetime `'2` + | | return type of async closure `{async closure body@$DIR/not-lending.rs:12:42: 12:48}` contains a lifetime `'2` | lifetime `'1` represents this closure's body | = note: closure implements `Fn`, so references to captured variables can't escape the closure error: lifetime may not live long enough - --> $DIR/not-lending.rs:18:31 + --> $DIR/not-lending.rs:16:31 | LL | let x = async move || { &s }; | ------------- ^^^^^^ returning this value requires that `'1` must outlive `'2` | | | - | | return type of async closure `{async closure body@$DIR/not-lending.rs:18:31: 18:37}` contains a lifetime `'2` + | | return type of async closure `{async closure body@$DIR/not-lending.rs:16:31: 16:37}` contains a lifetime `'2` | lifetime `'1` represents this closure's body | = note: closure implements `Fn`, so references to captured variables can't escape the closure diff --git a/tests/ui/async-await/async-closures/once.rs b/tests/ui/async-await/async-closures/once.rs index 7009e0d132f..3cf70e16a12 100644 --- a/tests/ui/async-await/async-closures/once.rs +++ b/tests/ui/async-await/async-closures/once.rs @@ -5,8 +5,6 @@ //@ ignore-compare-mode-next-solver (explicit revisions) //@[next] compile-flags: -Znext-solver -#![feature(async_closure)] - use std::future::Future; extern crate block_on; diff --git a/tests/ui/async-await/async-closures/overlapping-projs.rs b/tests/ui/async-await/async-closures/overlapping-projs.rs index f778534cfe2..c37f24b4ff2 100644 --- a/tests/ui/async-await/async-closures/overlapping-projs.rs +++ b/tests/ui/async-await/async-closures/overlapping-projs.rs @@ -3,8 +3,6 @@ //@ run-pass //@ check-run-results -#![feature(async_closure)] - extern crate block_on; async fn call_once(f: impl AsyncFnOnce()) { diff --git a/tests/ui/async-await/async-closures/precise-captures.rs b/tests/ui/async-await/async-closures/precise-captures.rs index 7dcbf2595f0..638fb67c3a4 100644 --- a/tests/ui/async-await/async-closures/precise-captures.rs +++ b/tests/ui/async-await/async-closures/precise-captures.rs @@ -9,7 +9,6 @@ // force_once - Force the closure mode to `FnOnce`, so exercising what was fixed // in <https://github.com/rust-lang/rust/pull/123350>. -#![feature(async_closure)] #![allow(unused_mut)] extern crate block_on; diff --git a/tests/ui/async-await/async-closures/pretty-async-fn-opaque.rs b/tests/ui/async-await/async-closures/pretty-async-fn-opaque.rs index 2e7cf1b09fd..deae1c9376a 100644 --- a/tests/ui/async-await/async-closures/pretty-async-fn-opaque.rs +++ b/tests/ui/async-await/async-closures/pretty-async-fn-opaque.rs @@ -1,9 +1,5 @@ //@ edition: 2021 -#![feature(async_closure)] - -use std::ops::AsyncFnMut; - fn produce() -> impl AsyncFnMut() -> &'static str { async || "" } diff --git a/tests/ui/async-await/async-closures/pretty-async-fn-opaque.stderr b/tests/ui/async-await/async-closures/pretty-async-fn-opaque.stderr index 863e61eb35a..8bbd9fbec3e 100644 --- a/tests/ui/async-await/async-closures/pretty-async-fn-opaque.stderr +++ b/tests/ui/async-await/async-closures/pretty-async-fn-opaque.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/pretty-async-fn-opaque.rs:12:18 + --> $DIR/pretty-async-fn-opaque.rs:8:18 | LL | fn produce() -> impl AsyncFnMut() -> &'static str { | --------------------------------- the found opaque type diff --git a/tests/ui/async-await/async-closures/refd.rs b/tests/ui/async-await/async-closures/refd.rs index 8c16ecb1531..ae8a10a530a 100644 --- a/tests/ui/async-await/async-closures/refd.rs +++ b/tests/ui/async-await/async-closures/refd.rs @@ -2,8 +2,6 @@ //@ edition:2021 //@ build-pass -#![feature(async_closure)] - extern crate block_on; struct NoCopy; diff --git a/tests/ui/async-await/async-closures/return-type-mismatch.rs b/tests/ui/async-await/async-closures/return-type-mismatch.rs index 992f033180e..d3b4cb61cdf 100644 --- a/tests/ui/async-await/async-closures/return-type-mismatch.rs +++ b/tests/ui/async-await/async-closures/return-type-mismatch.rs @@ -1,8 +1,6 @@ //@ aux-build:block-on.rs //@ edition:2021 -#![feature(async_closure)] - extern crate block_on; fn main() { diff --git a/tests/ui/async-await/async-closures/return-type-mismatch.stderr b/tests/ui/async-await/async-closures/return-type-mismatch.stderr index 53841f62777..d7675aab953 100644 --- a/tests/ui/async-await/async-closures/return-type-mismatch.stderr +++ b/tests/ui/async-await/async-closures/return-type-mismatch.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/return-type-mismatch.rs:11:24 + --> $DIR/return-type-mismatch.rs:9:24 | LL | let y: usize = x().await; | ^^^^^^^^^ expected `usize`, found `i32` diff --git a/tests/ui/async-await/async-closures/sig-from-bare-fn.rs b/tests/ui/async-await/async-closures/sig-from-bare-fn.rs index a679471a3b3..72aac140256 100644 --- a/tests/ui/async-await/async-closures/sig-from-bare-fn.rs +++ b/tests/ui/async-await/async-closures/sig-from-bare-fn.rs @@ -5,8 +5,6 @@ // a function that requires the async closure implement `Fn*` but does *not* have // a `Future` bound on the return type. -#![feature(async_closure)] - use std::future::Future; trait TryStream { diff --git a/tests/ui/async-await/async-closures/signature-deduction.rs b/tests/ui/async-await/async-closures/signature-deduction.rs index 4e9a6747f1f..27ec54ba4f9 100644 --- a/tests/ui/async-await/async-closures/signature-deduction.rs +++ b/tests/ui/async-await/async-closures/signature-deduction.rs @@ -1,8 +1,6 @@ //@ build-pass //@ edition: 2021 -#![feature(async_closure)] - async fn foo(x: impl AsyncFn(&str) -> &str) {} fn main() { diff --git a/tests/ui/async-await/async-closures/signature-inference-from-two-part-bound.rs b/tests/ui/async-await/async-closures/signature-inference-from-two-part-bound.rs index 0e2d1ef1208..f66787bd6fc 100644 --- a/tests/ui/async-await/async-closures/signature-inference-from-two-part-bound.rs +++ b/tests/ui/async-await/async-closures/signature-inference-from-two-part-bound.rs @@ -4,8 +4,6 @@ //@ ignore-compare-mode-next-solver (explicit revisions) //@[next] compile-flags: -Znext-solver -#![feature(async_closure)] - use std::future::Future; use std::any::Any; diff --git a/tests/ui/async-await/async-closures/tainted-body-2.rs b/tests/ui/async-await/async-closures/tainted-body-2.rs index 73c6bdc30a0..8314f7e7f96 100644 --- a/tests/ui/async-await/async-closures/tainted-body-2.rs +++ b/tests/ui/async-await/async-closures/tainted-body-2.rs @@ -1,7 +1,5 @@ //@ edition: 2021 -#![feature(async_closure)] - // Ensure that building a by-ref async closure body doesn't ICE when the parent // body is tainted. diff --git a/tests/ui/async-await/async-closures/tainted-body-2.stderr b/tests/ui/async-await/async-closures/tainted-body-2.stderr index 798d47064d9..cffd67b6361 100644 --- a/tests/ui/async-await/async-closures/tainted-body-2.stderr +++ b/tests/ui/async-await/async-closures/tainted-body-2.stderr @@ -1,5 +1,5 @@ error[E0425]: cannot find value `missing` in this scope - --> $DIR/tainted-body-2.rs:9:5 + --> $DIR/tainted-body-2.rs:7:5 | LL | missing; | ^^^^^^^ not found in this scope diff --git a/tests/ui/async-await/async-closures/tainted-body.rs b/tests/ui/async-await/async-closures/tainted-body.rs index e42d9d6e36a..118c0887469 100644 --- a/tests/ui/async-await/async-closures/tainted-body.rs +++ b/tests/ui/async-await/async-closures/tainted-body.rs @@ -1,7 +1,5 @@ //@ edition:2021 -#![feature(async_closure)] - // Don't ICE in ByMove shim builder when MIR body is tainted by writeback errors fn main() { diff --git a/tests/ui/async-await/async-closures/tainted-body.stderr b/tests/ui/async-await/async-closures/tainted-body.stderr index b06a896b81f..617d87e9df2 100644 --- a/tests/ui/async-await/async-closures/tainted-body.stderr +++ b/tests/ui/async-await/async-closures/tainted-body.stderr @@ -1,5 +1,5 @@ error[E0425]: cannot find function `used_fn` in this scope - --> $DIR/tainted-body.rs:9:9 + --> $DIR/tainted-body.rs:7:9 | LL | used_fn(); | ^^^^^^^ not found in this scope diff --git a/tests/ui/async-await/async-closures/truncated-fields-when-imm.rs b/tests/ui/async-await/async-closures/truncated-fields-when-imm.rs index 5c718638d80..7d08cdb91e5 100644 --- a/tests/ui/async-await/async-closures/truncated-fields-when-imm.rs +++ b/tests/ui/async-await/async-closures/truncated-fields-when-imm.rs @@ -1,8 +1,6 @@ //@ edition: 2021 //@ check-pass -#![feature(async_closure)] - pub struct Struct { pub path: String, } diff --git a/tests/ui/async-await/async-closures/validate-synthetic-body.rs b/tests/ui/async-await/async-closures/validate-synthetic-body.rs index 67e683ac08a..3fd7382f7f9 100644 --- a/tests/ui/async-await/async-closures/validate-synthetic-body.rs +++ b/tests/ui/async-await/async-closures/validate-synthetic-body.rs @@ -1,8 +1,6 @@ //@ check-pass //@ edition: 2021 -#![feature(async_closure)] - // Make sure that we don't hit a query cycle when validating // the by-move coroutine body for an async closure. diff --git a/tests/ui/async-await/async-closures/without-precise-captures-we-are-powerless.rs b/tests/ui/async-await/async-closures/without-precise-captures-we-are-powerless.rs index 19f366cc903..19a31d1889b 100644 --- a/tests/ui/async-await/async-closures/without-precise-captures-we-are-powerless.rs +++ b/tests/ui/async-await/async-closures/without-precise-captures-we-are-powerless.rs @@ -4,8 +4,6 @@ // sure that we don't ICE or anything, even if precise closure captures means // that we can't actually borrowck successfully. -#![feature(async_closure)] - fn outlives<'a>(_: impl Sized + 'a) {} async fn call_once(f: impl AsyncFnOnce()) { diff --git a/tests/ui/async-await/async-closures/without-precise-captures-we-are-powerless.stderr b/tests/ui/async-await/async-closures/without-precise-captures-we-are-powerless.stderr index a70aece2dea..be39dbf313b 100644 --- a/tests/ui/async-await/async-closures/without-precise-captures-we-are-powerless.stderr +++ b/tests/ui/async-await/async-closures/without-precise-captures-we-are-powerless.stderr @@ -1,5 +1,5 @@ error[E0597]: `x` does not live long enough - --> $DIR/without-precise-captures-we-are-powerless.rs:16:13 + --> $DIR/without-precise-captures-we-are-powerless.rs:14:13 | LL | fn simple<'a>(x: &'a i32) { | -- lifetime `'a` defined here @@ -13,7 +13,7 @@ LL | } | - `x` dropped here while still borrowed error[E0597]: `c` does not live long enough - --> $DIR/without-precise-captures-we-are-powerless.rs:21:20 + --> $DIR/without-precise-captures-we-are-powerless.rs:19:20 | LL | fn simple<'a>(x: &'a i32) { | -- lifetime `'a` defined here @@ -30,7 +30,7 @@ LL | } | - `c` dropped here while still borrowed error[E0597]: `x` does not live long enough - --> $DIR/without-precise-captures-we-are-powerless.rs:28:13 + --> $DIR/without-precise-captures-we-are-powerless.rs:26:13 | LL | fn through_field<'a>(x: S<'a>) { | -- lifetime `'a` defined here @@ -44,7 +44,7 @@ LL | } | - `x` dropped here while still borrowed error[E0505]: cannot move out of `x` because it is borrowed - --> $DIR/without-precise-captures-we-are-powerless.rs:32:13 + --> $DIR/without-precise-captures-we-are-powerless.rs:30:13 | LL | fn through_field<'a>(x: S<'a>) { | -- lifetime `'a` defined here @@ -58,7 +58,7 @@ LL | let c = async move || { println!("{}", *x.0); }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ move out of `x` occurs here error[E0597]: `c` does not live long enough - --> $DIR/without-precise-captures-we-are-powerless.rs:33:20 + --> $DIR/without-precise-captures-we-are-powerless.rs:31:20 | LL | fn through_field<'a>(x: S<'a>) { | -- lifetime `'a` defined here @@ -75,7 +75,7 @@ LL | } | - `c` dropped here while still borrowed error[E0505]: cannot move out of `c` because it is borrowed - --> $DIR/without-precise-captures-we-are-powerless.rs:34:30 + --> $DIR/without-precise-captures-we-are-powerless.rs:32:30 | LL | fn through_field<'a>(x: S<'a>) { | -- lifetime `'a` defined here @@ -91,7 +91,7 @@ LL | outlives::<'a>(call_once(c)); | ^ move out of `c` occurs here error[E0597]: `x` does not live long enough - --> $DIR/without-precise-captures-we-are-powerless.rs:38:13 + --> $DIR/without-precise-captures-we-are-powerless.rs:36:13 | LL | fn through_field_and_ref<'a>(x: &S<'a>) { | -- lifetime `'a` defined here @@ -104,7 +104,7 @@ LL | } | - `x` dropped here while still borrowed error[E0621]: explicit lifetime required in the type of `x` - --> $DIR/without-precise-captures-we-are-powerless.rs:40:20 + --> $DIR/without-precise-captures-we-are-powerless.rs:38:20 | LL | fn through_field_and_ref<'a>(x: &S<'a>) { | ------ help: add explicit lifetime `'a` to the type of `x`: `&'a S<'a>` @@ -113,7 +113,7 @@ LL | outlives::<'a>(call_once(c)); | ^^^^^^^^^^^^ lifetime `'a` required error[E0597]: `c` does not live long enough - --> $DIR/without-precise-captures-we-are-powerless.rs:45:20 + --> $DIR/without-precise-captures-we-are-powerless.rs:43:20 | LL | fn through_field_and_ref_move<'a>(x: &S<'a>) { | -- lifetime `'a` defined here @@ -129,7 +129,7 @@ LL | } | - `c` dropped here while still borrowed error[E0621]: explicit lifetime required in the type of `x` - --> $DIR/without-precise-captures-we-are-powerless.rs:46:20 + --> $DIR/without-precise-captures-we-are-powerless.rs:44:20 | LL | fn through_field_and_ref_move<'a>(x: &S<'a>) { | ------ help: add explicit lifetime `'a` to the type of `x`: `&'a S<'a>` diff --git a/tests/ui/async-await/async-closures/wrong-fn-kind.rs b/tests/ui/async-await/async-closures/wrong-fn-kind.rs index a566b8aa663..2aed6dc6d80 100644 --- a/tests/ui/async-await/async-closures/wrong-fn-kind.rs +++ b/tests/ui/async-await/async-closures/wrong-fn-kind.rs @@ -1,7 +1,5 @@ //@ edition:2021 -#![feature(async_closure)] - fn needs_async_fn(_: impl AsyncFn()) {} fn a() { diff --git a/tests/ui/async-await/async-closures/wrong-fn-kind.stderr b/tests/ui/async-await/async-closures/wrong-fn-kind.stderr index d03b10ca2cc..95f314214cc 100644 --- a/tests/ui/async-await/async-closures/wrong-fn-kind.stderr +++ b/tests/ui/async-await/async-closures/wrong-fn-kind.stderr @@ -1,5 +1,5 @@ error[E0525]: expected a closure that implements the `AsyncFn` trait, but this closure only implements `AsyncFnOnce` - --> $DIR/wrong-fn-kind.rs:17:20 + --> $DIR/wrong-fn-kind.rs:15:20 | LL | needs_async_fn(move || async move { | -------------- -^^^^^^ @@ -14,13 +14,13 @@ LL | | }); | |_____- the requirement to implement `AsyncFn` derives from here | note: required by a bound in `needs_async_fn` - --> $DIR/wrong-fn-kind.rs:5:27 + --> $DIR/wrong-fn-kind.rs:3:27 | LL | fn needs_async_fn(_: impl AsyncFn()) {} | ^^^^^^^^^ required by this bound in `needs_async_fn` error[E0596]: cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure - --> $DIR/wrong-fn-kind.rs:9:20 + --> $DIR/wrong-fn-kind.rs:7:20 | LL | fn needs_async_fn(_: impl AsyncFn()) {} | -------------- change this to accept `FnMut` instead of `Fn` diff --git a/tests/ui/async-await/async-drop.rs b/tests/ui/async-await/async-drop.rs index d3884680e51..b1af81423ce 100644 --- a/tests/ui/async-await/async-drop.rs +++ b/tests/ui/async-await/async-drop.rs @@ -5,7 +5,7 @@ // please consider modifying miri's async drop test at // `src/tools/miri/tests/pass/async-drop.rs`. -#![feature(async_drop, impl_trait_in_assoc_type, async_closure)] +#![feature(async_drop, impl_trait_in_assoc_type)] #![allow(incomplete_features, dead_code)] //@ edition: 2021 diff --git a/tests/ui/async-await/async-fn/auxiliary/block-on.rs b/tests/ui/async-await/async-fn/auxiliary/block-on.rs index 8b50c5571c1..4ec45ddf333 100644 --- a/tests/ui/async-await/async-fn/auxiliary/block-on.rs +++ b/tests/ui/async-await/async-fn/auxiliary/block-on.rs @@ -1,7 +1,5 @@ //@ edition: 2021 -#![feature(async_closure)] - use std::future::Future; use std::pin::pin; use std::task::*; diff --git a/tests/ui/async-await/async-fn/dyn-pos.rs b/tests/ui/async-await/async-fn/dyn-pos.rs index 129ea282936..d71af1bd53e 100644 --- a/tests/ui/async-await/async-fn/dyn-pos.rs +++ b/tests/ui/async-await/async-fn/dyn-pos.rs @@ -1,7 +1,5 @@ //@ edition:2018 -#![feature(async_closure)] - fn foo(x: &dyn AsyncFn()) {} //~^ ERROR the trait `AsyncFnMut` cannot be made into an object diff --git a/tests/ui/async-await/async-fn/dyn-pos.stderr b/tests/ui/async-await/async-fn/dyn-pos.stderr index aaa8eb2634d..0c901846671 100644 --- a/tests/ui/async-await/async-fn/dyn-pos.stderr +++ b/tests/ui/async-await/async-fn/dyn-pos.stderr @@ -1,5 +1,5 @@ error[E0038]: the trait `AsyncFnMut` cannot be made into an object - --> $DIR/dyn-pos.rs:5:16 + --> $DIR/dyn-pos.rs:3:16 | LL | fn foo(x: &dyn AsyncFn()) {} | ^^^^^^^^^ `AsyncFnMut` cannot be made into an object diff --git a/tests/ui/async-await/async-fn/edition-2015.rs b/tests/ui/async-await/async-fn/edition-2015.rs index 7fc62a8dd93..341b9b10e67 100644 --- a/tests/ui/async-await/async-fn/edition-2015.rs +++ b/tests/ui/async-await/async-fn/edition-2015.rs @@ -3,7 +3,5 @@ fn foo(x: impl async Fn()) -> impl async Fn() { x } //~| ERROR `async` trait bounds are only allowed in Rust 2018 or later //~| ERROR `async` trait bounds are unstable //~| ERROR `async` trait bounds are unstable -//~| ERROR use of unstable library feature `async_closure` -//~| ERROR use of unstable library feature `async_closure` fn main() {} diff --git a/tests/ui/async-await/async-fn/edition-2015.stderr b/tests/ui/async-await/async-fn/edition-2015.stderr index 96fb4c9e979..ca9e64cd1bb 100644 --- a/tests/ui/async-await/async-fn/edition-2015.stderr +++ b/tests/ui/async-await/async-fn/edition-2015.stderr @@ -38,26 +38,6 @@ LL | fn foo(x: impl async Fn()) -> impl async Fn() { x } = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date = help: use the desugared name of the async trait, such as `AsyncFn` -error[E0658]: use of unstable library feature `async_closure` - --> $DIR/edition-2015.rs:1:42 - | -LL | fn foo(x: impl async Fn()) -> impl async Fn() { x } - | ^^^^ - | - = note: see issue #62290 <https://github.com/rust-lang/rust/issues/62290> for more information - = help: add `#![feature(async_closure)]` 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]: use of unstable library feature `async_closure` - --> $DIR/edition-2015.rs:1:22 - | -LL | fn foo(x: impl async Fn()) -> impl async Fn() { x } - | ^^^^ - | - = note: see issue #62290 <https://github.com/rust-lang/rust/issues/62290> for more information - = help: add `#![feature(async_closure)]` 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 4 previous errors For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/async-await/async-fn/higher-ranked-async-fn.rs b/tests/ui/async-await/async-fn/higher-ranked-async-fn.rs index 5d675921028..ac8e0d7c63e 100644 --- a/tests/ui/async-await/async-fn/higher-ranked-async-fn.rs +++ b/tests/ui/async-await/async-fn/higher-ranked-async-fn.rs @@ -5,8 +5,6 @@ //@[next] compile-flags: -Znext-solver //@ build-pass (since it ICEs during mono) -#![feature(async_closure)] - extern crate block_on; use std::future::Future; diff --git a/tests/ui/async-await/async-fn/impl-trait.rs b/tests/ui/async-await/async-fn/impl-trait.rs index 11faf9ac983..f284de8981a 100644 --- a/tests/ui/async-await/async-fn/impl-trait.rs +++ b/tests/ui/async-await/async-fn/impl-trait.rs @@ -1,7 +1,7 @@ //@ edition:2018 //@ check-pass -#![feature(async_closure, type_alias_impl_trait)] +#![feature(type_alias_impl_trait)] type Tait = impl AsyncFn(); fn tait() -> Tait { diff --git a/tests/ui/async-await/async-fn/project.rs b/tests/ui/async-await/async-fn/project.rs index b6068a916ae..8ee50724e4c 100644 --- a/tests/ui/async-await/async-fn/project.rs +++ b/tests/ui/async-await/async-fn/project.rs @@ -4,7 +4,7 @@ //@[next] compile-flags: -Znext-solver //@ check-pass -#![feature(async_closure, unboxed_closures, async_fn_traits)] +#![feature(unboxed_closures, async_fn_traits)] use std::ops::AsyncFn; diff --git a/tests/ui/async-await/async-fn/simple.rs b/tests/ui/async-await/async-fn/simple.rs index 3f15b08560a..89b68e12435 100644 --- a/tests/ui/async-await/async-fn/simple.rs +++ b/tests/ui/async-await/async-fn/simple.rs @@ -2,8 +2,6 @@ //@ edition: 2021 //@ build-pass -#![feature(async_closure)] - extern crate block_on; use std::ops::AsyncFn; diff --git a/tests/ui/async-await/async-fn/sugar.rs b/tests/ui/async-await/async-fn/sugar.rs index 0225b666ac5..d00965ee647 100644 --- a/tests/ui/async-await/async-fn/sugar.rs +++ b/tests/ui/async-await/async-fn/sugar.rs @@ -1,7 +1,7 @@ //@ edition: 2021 //@ check-pass -#![feature(async_closure, async_trait_bounds)] +#![feature(async_trait_bounds)] async fn foo() {} diff --git a/tests/ui/async-await/coroutine-desc.rs b/tests/ui/async-await/coroutine-desc.rs index 9a61c9719db..9a581049107 100644 --- a/tests/ui/async-await/coroutine-desc.rs +++ b/tests/ui/async-await/coroutine-desc.rs @@ -1,5 +1,4 @@ //@ edition:2018 -#![feature(async_closure)] use std::future::Future; async fn one() {} diff --git a/tests/ui/async-await/coroutine-desc.stderr b/tests/ui/async-await/coroutine-desc.stderr index 5434ff3d958..01482a9cb1f 100644 --- a/tests/ui/async-await/coroutine-desc.stderr +++ b/tests/ui/async-await/coroutine-desc.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/coroutine-desc.rs:10:19 + --> $DIR/coroutine-desc.rs:9:19 | LL | fun(async {}, async {}); | --- -------- ^^^^^^^^ expected `async` block, found a different `async` block @@ -8,12 +8,12 @@ LL | fun(async {}, async {}); | | expected all arguments to be this `async` block type because they need to match the type of this parameter | arguments to this function are incorrect | - = note: expected `async` block `{async block@$DIR/coroutine-desc.rs:10:9: 10:14}` - found `async` block `{async block@$DIR/coroutine-desc.rs:10:19: 10:24}` + = note: expected `async` block `{async block@$DIR/coroutine-desc.rs:9:9: 9:14}` + found `async` block `{async block@$DIR/coroutine-desc.rs:9:19: 9:24}` = 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: function defined here - --> $DIR/coroutine-desc.rs:8:4 + --> $DIR/coroutine-desc.rs:7:4 | LL | fn fun<F: Future<Output = ()>>(f1: F, f2: F) {} | ^^^ - ----- ----- this parameter needs to match the `async` block type of `f1` @@ -22,7 +22,7 @@ LL | fn fun<F: Future<Output = ()>>(f1: F, f2: F) {} | `f1` and `f2` both reference this parameter `F` error[E0308]: mismatched types - --> $DIR/coroutine-desc.rs:12:16 + --> $DIR/coroutine-desc.rs:11:16 | LL | fun(one(), two()); | --- ----- ^^^^^ expected future, found a different future @@ -33,7 +33,7 @@ LL | fun(one(), two()); = help: consider `await`ing on both `Future`s = note: distinct uses of `impl Trait` result in different opaque types note: function defined here - --> $DIR/coroutine-desc.rs:8:4 + --> $DIR/coroutine-desc.rs:7:4 | LL | fn fun<F: Future<Output = ()>>(f1: F, f2: F) {} | ^^^ - ----- ----- this parameter needs to match the future type of `f1` @@ -42,7 +42,7 @@ LL | fn fun<F: Future<Output = ()>>(f1: F, f2: F) {} | `f1` and `f2` both reference this parameter `F` error[E0308]: mismatched types - --> $DIR/coroutine-desc.rs:14:26 + --> $DIR/coroutine-desc.rs:13:26 | LL | fun((async || {})(), (async || {})()); | --- --------------- ^^^^^^^^^^^^^^^ expected `async` closure body, found a different `async` closure body @@ -51,12 +51,12 @@ LL | fun((async || {})(), (async || {})()); | | expected all arguments to be this `async` closure body type because they need to match the type of this parameter | arguments to this function are incorrect | - = note: expected `async` closure body `{async closure body@$DIR/coroutine-desc.rs:14:19: 14:21}` - found `async` closure body `{async closure body@$DIR/coroutine-desc.rs:14:36: 14:38}` + = note: expected `async` closure body `{async closure body@$DIR/coroutine-desc.rs:13:19: 13:21}` + found `async` closure body `{async closure body@$DIR/coroutine-desc.rs:13:36: 13:38}` = 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: function defined here - --> $DIR/coroutine-desc.rs:8:4 + --> $DIR/coroutine-desc.rs:7:4 | LL | fn fun<F: Future<Output = ()>>(f1: F, f2: F) {} | ^^^ - ----- ----- this parameter needs to match the `async` closure body type of `f1` diff --git a/tests/ui/async-await/dyn/auxiliary/block-on.rs b/tests/ui/async-await/dyn/auxiliary/block-on.rs new file mode 100644 index 00000000000..dcb710fc97c --- /dev/null +++ b/tests/ui/async-await/dyn/auxiliary/block-on.rs @@ -0,0 +1,20 @@ +//@ edition: 2021 + +#![feature(async_closure, noop_waker)] + +use std::future::Future; +use std::pin::pin; +use std::task::*; + +pub fn block_on<T>(fut: impl Future<Output = T>) -> T { + let mut fut = pin!(fut); + // Poll loop, just to test the future... + let ctx = &mut Context::from_waker(Waker::noop()); + + loop { + match unsafe { fut.as_mut().poll(ctx) } { + Poll::Pending => {} + Poll::Ready(t) => break t, + } + } +} diff --git a/tests/ui/async-await/dyn/mut-is-pointer-like.rs b/tests/ui/async-await/dyn/mut-is-pointer-like.rs new file mode 100644 index 00000000000..93e8281164c --- /dev/null +++ b/tests/ui/async-await/dyn/mut-is-pointer-like.rs @@ -0,0 +1,40 @@ +//@ aux-build:block-on.rs +//@ edition: 2021 +//@ run-pass +//@ check-run-results + +#![allow(refining_impl_trait)] +#![feature(async_fn_in_dyn_trait)] +//~^ WARN the feature `async_fn_in_dyn_trait` is incomplete + +extern crate block_on; + +use std::future::Future; +use std::pin::Pin; + +trait AsyncTrait { + type Output; + + async fn async_dispatch(self: Pin<&mut Self>) -> Self::Output; +} + +impl<F> AsyncTrait for F +where + F: Future, +{ + type Output = F::Output; + + fn async_dispatch(self: Pin<&mut Self>) -> Pin<&mut Self> { + self + } +} + +fn main() { + block_on::block_on(async { + let f = std::pin::pin!(async { + println!("hello, world"); + }); + let x: Pin<&mut dyn AsyncTrait<Output = ()>> = f; + x.async_dispatch().await; + }); +} diff --git a/tests/ui/async-await/dyn/mut-is-pointer-like.run.stdout b/tests/ui/async-await/dyn/mut-is-pointer-like.run.stdout new file mode 100644 index 00000000000..4b5fa63702d --- /dev/null +++ b/tests/ui/async-await/dyn/mut-is-pointer-like.run.stdout @@ -0,0 +1 @@ +hello, world diff --git a/tests/ui/async-await/dyn/mut-is-pointer-like.stderr b/tests/ui/async-await/dyn/mut-is-pointer-like.stderr new file mode 100644 index 00000000000..7c72ce43cf0 --- /dev/null +++ b/tests/ui/async-await/dyn/mut-is-pointer-like.stderr @@ -0,0 +1,11 @@ +warning: the feature `async_fn_in_dyn_trait` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/mut-is-pointer-like.rs:7:12 + | +LL | #![feature(async_fn_in_dyn_trait)] + | ^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #133119 <https://github.com/rust-lang/rust/issues/133119> for more information + = note: `#[warn(incomplete_features)]` on by default + +warning: 1 warning emitted + diff --git a/tests/ui/async-await/dyn/works.rs b/tests/ui/async-await/dyn/works.rs new file mode 100644 index 00000000000..0732a3ee2f2 --- /dev/null +++ b/tests/ui/async-await/dyn/works.rs @@ -0,0 +1,32 @@ +//@ aux-build:block-on.rs +//@ edition: 2021 +//@ run-pass +//@ check-run-results + +#![allow(refining_impl_trait)] +#![feature(async_fn_in_dyn_trait)] +//~^ WARN the feature `async_fn_in_dyn_trait` is incomplete + +extern crate block_on; + +use std::pin::Pin; +use std::future::Future; + +trait AsyncTrait { + async fn async_dispatch(&self); +} + +impl AsyncTrait for &'static str { + fn async_dispatch(&self) -> Pin<Box<impl Future<Output = ()>>> { + Box::pin(async move { + println!("message from the aether: {self}"); + }) + } +} + +fn main() { + block_on::block_on(async { + let x: &dyn AsyncTrait = &"hello, world!"; + x.async_dispatch().await; + }); +} diff --git a/tests/ui/async-await/dyn/works.run.stdout b/tests/ui/async-await/dyn/works.run.stdout new file mode 100644 index 00000000000..7b45a504e60 --- /dev/null +++ b/tests/ui/async-await/dyn/works.run.stdout @@ -0,0 +1 @@ +message from the aether: hello, world! diff --git a/tests/ui/async-await/dyn/works.stderr b/tests/ui/async-await/dyn/works.stderr new file mode 100644 index 00000000000..2c7db7c32f5 --- /dev/null +++ b/tests/ui/async-await/dyn/works.stderr @@ -0,0 +1,11 @@ +warning: the feature `async_fn_in_dyn_trait` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/works.rs:7:12 + | +LL | #![feature(async_fn_in_dyn_trait)] + | ^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #133119 <https://github.com/rust-lang/rust/issues/133119> for more information + = note: `#[warn(incomplete_features)]` on by default + +warning: 1 warning emitted + diff --git a/tests/ui/async-await/dyn/wrong-size.rs b/tests/ui/async-await/dyn/wrong-size.rs new file mode 100644 index 00000000000..ac15dd26067 --- /dev/null +++ b/tests/ui/async-await/dyn/wrong-size.rs @@ -0,0 +1,23 @@ +//@ edition: 2021 + +#![feature(async_fn_in_dyn_trait)] +//~^ WARN the feature `async_fn_in_dyn_trait` is incomplete + +use std::future::Future; + +trait AsyncTrait { + async fn async_dispatch(&self); +} + +impl AsyncTrait for &'static str { + fn async_dispatch(&self) -> impl Future<Output = ()> { + async move { + // The implementor must box the future... + } + } +} + +fn main() { + let x: &dyn AsyncTrait = &"hello, world!"; + //~^ ERROR `impl Future<Output = ()>` needs to have the same ABI as a pointer +} diff --git a/tests/ui/async-await/dyn/wrong-size.stderr b/tests/ui/async-await/dyn/wrong-size.stderr new file mode 100644 index 00000000000..0202b5f2409 --- /dev/null +++ b/tests/ui/async-await/dyn/wrong-size.stderr @@ -0,0 +1,21 @@ +warning: the feature `async_fn_in_dyn_trait` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/wrong-size.rs:3:12 + | +LL | #![feature(async_fn_in_dyn_trait)] + | ^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #133119 <https://github.com/rust-lang/rust/issues/133119> for more information + = note: `#[warn(incomplete_features)]` on by default + +error[E0277]: `impl Future<Output = ()>` needs to have the same ABI as a pointer + --> $DIR/wrong-size.rs:21:30 + | +LL | let x: &dyn AsyncTrait = &"hello, world!"; + | ^^^^^^^^^^^^^^^^ `impl Future<Output = ()>` needs to be a pointer-like type + | + = help: the trait `for<'a> PointerLike` is not implemented for `impl Future<Output = ()>` + = note: required for the cast from `&&'static str` to `&dyn AsyncTrait` + +error: aborting due to 1 previous error; 1 warning emitted + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/async-await/feature-async-closure.rs b/tests/ui/async-await/feature-async-closure.rs deleted file mode 100644 index 15108aa5a33..00000000000 --- a/tests/ui/async-await/feature-async-closure.rs +++ /dev/null @@ -1,8 +0,0 @@ -//@ edition:2018 -// gate-test-async_closure - -fn f() { - let _ = async || {}; //~ ERROR async closures are unstable -} - -fn main() {} diff --git a/tests/ui/async-await/feature-async-closure.stderr b/tests/ui/async-await/feature-async-closure.stderr deleted file mode 100644 index 650500b4890..00000000000 --- a/tests/ui/async-await/feature-async-closure.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error[E0658]: async closures are unstable - --> $DIR/feature-async-closure.rs:5:13 - | -LL | let _ = async || {}; - | ^^^^^ - | - = note: see issue #62290 <https://github.com/rust-lang/rust/issues/62290> for more information - = help: add `#![feature(async_closure)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - = help: to use an async block, remove the `||`: `async {` - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/async-await/inference_var_self_argument.stderr b/tests/ui/async-await/inference_var_self_argument.stderr index 7b7b3dbc757..a33c5f7b07d 100644 --- a/tests/ui/async-await/inference_var_self_argument.stderr +++ b/tests/ui/async-await/inference_var_self_argument.stderr @@ -4,8 +4,8 @@ error[E0307]: invalid `self` parameter type: `&dyn Foo` LL | async fn foo(self: &dyn Foo) { | ^^^^^^^^ | - = note: type of `self` must be `Self` or a type that dereferences to it - = help: consider changing to `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`) + = note: type of `self` must be `Self` or some type implementing `Receiver` + = help: consider changing to `self`, `&self`, `&mut self`, or a type implementing `Receiver` such as `self: Box<Self>`, `self: Rc<Self>`, or `self: Arc<Self>` error[E0038]: the trait `Foo` cannot be made into an object --> $DIR/inference_var_self_argument.rs:5:5 diff --git a/tests/ui/async-await/issue-66312.stderr b/tests/ui/async-await/issue-66312.stderr index c95ae1147df..f4db949a5f4 100644 --- a/tests/ui/async-await/issue-66312.stderr +++ b/tests/ui/async-await/issue-66312.stderr @@ -4,8 +4,8 @@ error[E0307]: invalid `self` parameter type: `T` LL | fn is_some(self: T); | ^ | - = note: type of `self` must be `Self` or a type that dereferences to it - = help: consider changing to `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`) + = note: type of `self` must be `Self` or some type implementing `Receiver` + = help: consider changing to `self`, `&self`, `&mut self`, or a type implementing `Receiver` such as `self: Box<Self>`, `self: Rc<Self>`, or `self: Arc<Self>` error[E0308]: mismatched types --> $DIR/issue-66312.rs:9:8 diff --git a/tests/ui/async-await/issue-74072-lifetime-name-annotations.rs b/tests/ui/async-await/issue-74072-lifetime-name-annotations.rs index 58509642b10..f6c9fdd6d68 100644 --- a/tests/ui/async-await/issue-74072-lifetime-name-annotations.rs +++ b/tests/ui/async-await/issue-74072-lifetime-name-annotations.rs @@ -1,5 +1,4 @@ //@ edition:2018 -#![feature(async_closure)] use std::future::Future; // test the quality of annotations giving lifetimes names (`'1`) when async constructs are involved diff --git a/tests/ui/async-await/issue-74072-lifetime-name-annotations.stderr b/tests/ui/async-await/issue-74072-lifetime-name-annotations.stderr index 9d963686dea..e1f268116fc 100644 --- a/tests/ui/async-await/issue-74072-lifetime-name-annotations.stderr +++ b/tests/ui/async-await/issue-74072-lifetime-name-annotations.stderr @@ -1,5 +1,5 @@ error[E0506]: cannot assign to `*x` because it is borrowed - --> $DIR/issue-74072-lifetime-name-annotations.rs:9:5 + --> $DIR/issue-74072-lifetime-name-annotations.rs:8:5 | LL | pub async fn async_fn(x: &mut i32) -> &i32 { | - let's call the lifetime of this reference `'1` @@ -11,7 +11,7 @@ LL | y | - returning this value requires that `*x` is borrowed for `'1` error[E0506]: cannot assign to `*x` because it is borrowed - --> $DIR/issue-74072-lifetime-name-annotations.rs:18:9 + --> $DIR/issue-74072-lifetime-name-annotations.rs:17:9 | LL | (async move || { | - return type of async closure is &'1 i32 @@ -24,12 +24,12 @@ LL | y | - returning this value requires that `*x` is borrowed for `'1` error: lifetime may not live long enough - --> $DIR/issue-74072-lifetime-name-annotations.rs:14:20 + --> $DIR/issue-74072-lifetime-name-annotations.rs:13:20 | LL | (async move || { | ______-------------_^ | | | | - | | | return type of async closure `{async closure body@$DIR/issue-74072-lifetime-name-annotations.rs:14:20: 20:6}` contains a lifetime `'2` + | | | return type of async closure `{async closure body@$DIR/issue-74072-lifetime-name-annotations.rs:13:20: 19:6}` contains a lifetime `'2` | | lifetime `'1` represents this closure's body LL | | LL | | @@ -42,7 +42,7 @@ LL | | })() = note: closure implements `FnMut`, so references to captured variables can't escape the closure error[E0716]: temporary value dropped while borrowed - --> $DIR/issue-74072-lifetime-name-annotations.rs:14:5 + --> $DIR/issue-74072-lifetime-name-annotations.rs:13:5 | LL | pub fn async_closure(x: &mut i32) -> impl Future<Output=&i32> { | - let's call the lifetime of this reference `'1` @@ -60,7 +60,7 @@ LL | } | - temporary value is freed at the end of this statement error[E0506]: cannot assign to `*x` because it is borrowed - --> $DIR/issue-74072-lifetime-name-annotations.rs:28:9 + --> $DIR/issue-74072-lifetime-name-annotations.rs:27:9 | LL | (async move || -> &i32 { | - return type of async closure is &'1 i32 @@ -73,12 +73,12 @@ LL | y | - returning this value requires that `*x` is borrowed for `'1` error: lifetime may not live long enough - --> $DIR/issue-74072-lifetime-name-annotations.rs:24:28 + --> $DIR/issue-74072-lifetime-name-annotations.rs:23:28 | LL | (async move || -> &i32 { | ______---------------------_^ | | | | - | | | return type of async closure `{async closure body@$DIR/issue-74072-lifetime-name-annotations.rs:24:28: 30:6}` contains a lifetime `'2` + | | | return type of async closure `{async closure body@$DIR/issue-74072-lifetime-name-annotations.rs:23:28: 29:6}` contains a lifetime `'2` | | lifetime `'1` represents this closure's body LL | | LL | | @@ -91,7 +91,7 @@ LL | | })() = note: closure implements `FnMut`, so references to captured variables can't escape the closure error[E0716]: temporary value dropped while borrowed - --> $DIR/issue-74072-lifetime-name-annotations.rs:24:5 + --> $DIR/issue-74072-lifetime-name-annotations.rs:23:5 | LL | pub fn async_closure_explicit_return_type(x: &mut i32) -> impl Future<Output=&i32> { | - let's call the lifetime of this reference `'1` @@ -109,7 +109,7 @@ LL | } | - temporary value is freed at the end of this statement error[E0506]: cannot assign to `*x` because it is borrowed - --> $DIR/issue-74072-lifetime-name-annotations.rs:36:9 + --> $DIR/issue-74072-lifetime-name-annotations.rs:35:9 | LL | async move { | - return type of async block is &'1 i32 diff --git a/tests/ui/async-await/issues/issue-62009-2.rs b/tests/ui/async-await/issues/issue-62009-2.rs index f7cba29a747..b660d8a206c 100644 --- a/tests/ui/async-await/issues/issue-62009-2.rs +++ b/tests/ui/async-await/issues/issue-62009-2.rs @@ -1,7 +1,5 @@ //@ edition:2018 -#![feature(async_closure)] - async fn print_dur() {} fn main() { diff --git a/tests/ui/async-await/issues/issue-62009-2.stderr b/tests/ui/async-await/issues/issue-62009-2.stderr index 0004f99f901..9377a02612b 100644 --- a/tests/ui/async-await/issues/issue-62009-2.stderr +++ b/tests/ui/async-await/issues/issue-62009-2.stderr @@ -1,5 +1,5 @@ error[E0728]: `await` is only allowed inside `async` functions and blocks - --> $DIR/issue-62009-2.rs:8:23 + --> $DIR/issue-62009-2.rs:6:23 | LL | fn main() { | --------- this is not `async` diff --git a/tests/ui/async-await/no-params-non-move-async-closure.rs b/tests/ui/async-await/no-params-non-move-async-closure.rs index e9e43b3484a..48651396d25 100644 --- a/tests/ui/async-await/no-params-non-move-async-closure.rs +++ b/tests/ui/async-await/no-params-non-move-async-closure.rs @@ -1,8 +1,6 @@ //@ edition:2018 //@ check-pass -#![feature(async_closure)] - fn main() { let _ = async |x: u8| {}; } diff --git a/tests/ui/async-await/suggest-missing-await-closure.fixed b/tests/ui/async-await/suggest-missing-await-closure.fixed index 1ec3456a265..9ab16d34175 100644 --- a/tests/ui/async-await/suggest-missing-await-closure.fixed +++ b/tests/ui/async-await/suggest-missing-await-closure.fixed @@ -1,8 +1,6 @@ //@ edition:2018 //@ run-rustfix -#![feature(async_closure)] - fn take_u32(_x: u32) {} async fn make_u32() -> u32 { diff --git a/tests/ui/async-await/suggest-missing-await-closure.rs b/tests/ui/async-await/suggest-missing-await-closure.rs index 3a448ad411b..172132fda33 100644 --- a/tests/ui/async-await/suggest-missing-await-closure.rs +++ b/tests/ui/async-await/suggest-missing-await-closure.rs @@ -1,8 +1,6 @@ //@ edition:2018 //@ run-rustfix -#![feature(async_closure)] - fn take_u32(_x: u32) {} async fn make_u32() -> u32 { diff --git a/tests/ui/async-await/suggest-missing-await-closure.stderr b/tests/ui/async-await/suggest-missing-await-closure.stderr index 47af270a03a..002c2024f21 100644 --- a/tests/ui/async-await/suggest-missing-await-closure.stderr +++ b/tests/ui/async-await/suggest-missing-await-closure.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/suggest-missing-await-closure.rs:16:18 + --> $DIR/suggest-missing-await-closure.rs:14:18 | LL | take_u32(x) | -------- ^ expected `u32`, found future @@ -7,12 +7,12 @@ LL | take_u32(x) | arguments to this function are incorrect | note: calling an async function returns a future - --> $DIR/suggest-missing-await-closure.rs:16:18 + --> $DIR/suggest-missing-await-closure.rs:14:18 | LL | take_u32(x) | ^ note: function defined here - --> $DIR/suggest-missing-await-closure.rs:6:4 + --> $DIR/suggest-missing-await-closure.rs:4:4 | LL | fn take_u32(_x: u32) {} | ^^^^^^^^ ------- diff --git a/tests/ui/async-await/track-caller/async-closure-gate.rs b/tests/ui/async-await/track-caller/async-closure-gate.rs index 4b88255bc36..e72ce2afa45 100644 --- a/tests/ui/async-await/track-caller/async-closure-gate.rs +++ b/tests/ui/async-await/track-caller/async-closure-gate.rs @@ -1,7 +1,7 @@ //@ edition:2021 //@ revisions: afn nofeat -#![feature(async_closure, stmt_expr_attributes)] +#![feature(stmt_expr_attributes)] #![cfg_attr(afn, feature(async_fn_track_caller))] fn main() { diff --git a/tests/ui/async-await/track-caller/panic-track-caller.rs b/tests/ui/async-await/track-caller/panic-track-caller.rs index c693a446eed..bd12bf11d6c 100644 --- a/tests/ui/async-await/track-caller/panic-track-caller.rs +++ b/tests/ui/async-await/track-caller/panic-track-caller.rs @@ -3,7 +3,7 @@ //@ revisions: afn cls nofeat //@ needs-unwind // gate-test-async_fn_track_caller -#![feature(async_closure, stmt_expr_attributes)] +#![feature(stmt_expr_attributes)] #![cfg_attr(afn, feature(async_fn_track_caller))] #![cfg_attr(cls, feature(closure_track_caller))] #![allow(unused)] diff --git a/tests/ui/async-await/try-on-option-in-async.rs b/tests/ui/async-await/try-on-option-in-async.rs index fda848141d3..4822197bf39 100644 --- a/tests/ui/async-await/try-on-option-in-async.rs +++ b/tests/ui/async-await/try-on-option-in-async.rs @@ -1,4 +1,3 @@ -#![feature(async_closure)] //@ edition:2018 fn main() {} diff --git a/tests/ui/async-await/try-on-option-in-async.stderr b/tests/ui/async-await/try-on-option-in-async.stderr index 65f63093728..9e0bb42a697 100644 --- a/tests/ui/async-await/try-on-option-in-async.stderr +++ b/tests/ui/async-await/try-on-option-in-async.stderr @@ -1,5 +1,5 @@ error[E0277]: the `?` operator can only be used in an async block that returns `Result` or `Option` (or another type that implements `FromResidual`) - --> $DIR/try-on-option-in-async.rs:8:10 + --> $DIR/try-on-option-in-async.rs:7:10 | LL | async { | ----- this function should return `Result` or `Option` to accept `?` @@ -10,7 +10,7 @@ LL | x?; = help: the trait `FromResidual<Option<Infallible>>` is not implemented for `{integer}` error[E0277]: the `?` operator can only be used in an async closure that returns `Result` or `Option` (or another type that implements `FromResidual`) - --> $DIR/try-on-option-in-async.rs:17:10 + --> $DIR/try-on-option-in-async.rs:16:10 | LL | let async_closure = async || { | __________________________________- @@ -24,7 +24,7 @@ LL | | }; = help: the trait `FromResidual<Option<Infallible>>` is not implemented for `u32` error[E0277]: the `?` operator can only be used in an async function that returns `Result` or `Option` (or another type that implements `FromResidual`) - --> $DIR/try-on-option-in-async.rs:26:6 + --> $DIR/try-on-option-in-async.rs:25:6 | LL | async fn an_async_function() -> u32 { | _____________________________________- diff --git a/tests/ui/attributes/mixed_export_name_and_no_mangle.fixed b/tests/ui/attributes/mixed_export_name_and_no_mangle.fixed new file mode 100644 index 00000000000..7224d4289e3 --- /dev/null +++ b/tests/ui/attributes/mixed_export_name_and_no_mangle.fixed @@ -0,0 +1,14 @@ +// issue: rust-lang/rust#47446 +//@ run-rustfix +//@ check-pass + +#![warn(unused_attributes)] +//~^ WARN `#[no_mangle]` attribute may not be used in combination with `#[export_name]` [unused_attributes] +#[export_name = "foo"] +pub fn bar() {} + +//~^ WARN `#[unsafe(no_mangle)]` attribute may not be used in combination with `#[export_name]` [unused_attributes] +#[export_name = "baz"] +pub fn bak() {} + +fn main() {} diff --git a/tests/ui/attributes/mixed_export_name_and_no_mangle.rs b/tests/ui/attributes/mixed_export_name_and_no_mangle.rs new file mode 100644 index 00000000000..149a7904e1e --- /dev/null +++ b/tests/ui/attributes/mixed_export_name_and_no_mangle.rs @@ -0,0 +1,16 @@ +// issue: rust-lang/rust#47446 +//@ run-rustfix +//@ check-pass + +#![warn(unused_attributes)] +#[no_mangle] +//~^ WARN `#[no_mangle]` attribute may not be used in combination with `#[export_name]` [unused_attributes] +#[export_name = "foo"] +pub fn bar() {} + +#[unsafe(no_mangle)] +//~^ WARN `#[unsafe(no_mangle)]` attribute may not be used in combination with `#[export_name]` [unused_attributes] +#[export_name = "baz"] +pub fn bak() {} + +fn main() {} diff --git a/tests/ui/attributes/mixed_export_name_and_no_mangle.stderr b/tests/ui/attributes/mixed_export_name_and_no_mangle.stderr new file mode 100644 index 00000000000..ba63127ba2d --- /dev/null +++ b/tests/ui/attributes/mixed_export_name_and_no_mangle.stderr @@ -0,0 +1,39 @@ +warning: `#[no_mangle]` attribute may not be used in combination with `#[export_name]` + --> $DIR/mixed_export_name_and_no_mangle.rs:6:1 + | +LL | #[no_mangle] + | ^^^^^^^^^^^^ `#[no_mangle]` is ignored + | +note: `#[export_name]` takes precedence + --> $DIR/mixed_export_name_and_no_mangle.rs:8:1 + | +LL | #[export_name = "foo"] + | ^^^^^^^^^^^^^^^^^^^^^^ +note: the lint level is defined here + --> $DIR/mixed_export_name_and_no_mangle.rs:5:9 + | +LL | #![warn(unused_attributes)] + | ^^^^^^^^^^^^^^^^^ +help: remove the `#[no_mangle]` attribute + | +LL - #[no_mangle] + | + +warning: `#[unsafe(no_mangle)]` attribute may not be used in combination with `#[export_name]` + --> $DIR/mixed_export_name_and_no_mangle.rs:11:1 + | +LL | #[unsafe(no_mangle)] + | ^^^^^^^^^^^^^^^^^^^^ `#[unsafe(no_mangle)]` is ignored + | +note: `#[export_name]` takes precedence + --> $DIR/mixed_export_name_and_no_mangle.rs:13:1 + | +LL | #[export_name = "baz"] + | ^^^^^^^^^^^^^^^^^^^^^^ +help: remove the `#[unsafe(no_mangle)]` attribute + | +LL - #[unsafe(no_mangle)] + | + +warning: 2 warnings emitted + diff --git a/tests/ui/check-cfg/target_feature.stderr b/tests/ui/check-cfg/target_feature.stderr index 2674a97a551..e2ceb669482 100644 --- a/tests/ui/check-cfg/target_feature.stderr +++ b/tests/ui/check-cfg/target_feature.stderr @@ -98,6 +98,7 @@ LL | cfg!(target_feature = "_UNEXPECTED_VALUE"); `fp8dot2` `fp8dot4` `fp8fma` +`fpregs` `fpuv2_df` `fpuv2_sf` `fpuv3_df` @@ -153,6 +154,7 @@ LL | cfg!(target_feature = "_UNEXPECTED_VALUE"); `popcnt` `power10-vector` `power8-altivec` +`power8-crypto` `power8-vector` `power9-altivec` `power9-vector` @@ -260,6 +262,7 @@ LL | cfg!(target_feature = "_UNEXPECTED_VALUE"); `vsx` `wfxt` `wide-arithmetic` +`x87` `xop` `xsave` `xsavec` diff --git a/tests/ui/closures/binder/async-closure-with-binder.rs b/tests/ui/closures/binder/async-closure-with-binder.rs index 24f4e8e4175..8f84f3074cd 100644 --- a/tests/ui/closures/binder/async-closure-with-binder.rs +++ b/tests/ui/closures/binder/async-closure-with-binder.rs @@ -2,7 +2,6 @@ //@ check-pass #![feature(closure_lifetime_binder)] -#![feature(async_closure)] fn main() { for<'a> async || -> () {}; diff --git a/tests/ui/closures/local-type-mix.rs b/tests/ui/closures/local-type-mix.rs index 823ceb211a3..edcdac2a611 100644 --- a/tests/ui/closures/local-type-mix.rs +++ b/tests/ui/closures/local-type-mix.rs @@ -1,8 +1,6 @@ // Check that using the parameter name in its type does not ICE. //@ edition:2018 -#![feature(async_closure)] - fn main() { let _ = |x: x| x; //~ ERROR expected type let _ = |x: bool| -> x { x }; //~ ERROR expected type diff --git a/tests/ui/closures/local-type-mix.stderr b/tests/ui/closures/local-type-mix.stderr index 68c320a065d..f3b6a73afd5 100644 --- a/tests/ui/closures/local-type-mix.stderr +++ b/tests/ui/closures/local-type-mix.stderr @@ -1,47 +1,47 @@ error[E0573]: expected type, found local variable `x` - --> $DIR/local-type-mix.rs:7:17 + --> $DIR/local-type-mix.rs:5:17 | LL | let _ = |x: x| x; | ^ not a type error[E0573]: expected type, found local variable `x` - --> $DIR/local-type-mix.rs:8:26 + --> $DIR/local-type-mix.rs:6:26 | LL | let _ = |x: bool| -> x { x }; | ^ not a type error[E0573]: expected type, found local variable `x` - --> $DIR/local-type-mix.rs:9:28 + --> $DIR/local-type-mix.rs:7:28 | LL | let _ = async move |x: x| x; | ^ not a type error[E0573]: expected type, found local variable `x` - --> $DIR/local-type-mix.rs:10:37 + --> $DIR/local-type-mix.rs:8:37 | LL | let _ = async move |x: bool| -> x { x }; | ^ not a type error[E0573]: expected type, found local variable `x` - --> $DIR/local-type-mix.rs:13:11 + --> $DIR/local-type-mix.rs:11:11 | LL | fn foo(x: x) {} | ^ not a type error[E0573]: expected type, found local variable `x` - --> $DIR/local-type-mix.rs:14:24 + --> $DIR/local-type-mix.rs:12:24 | LL | fn foo_ret(x: bool) -> x {} | ^ not a type error[E0573]: expected type, found local variable `x` - --> $DIR/local-type-mix.rs:16:23 + --> $DIR/local-type-mix.rs:14:23 | LL | async fn async_foo(x: x) {} | ^ not a type error[E0573]: expected type, found local variable `x` - --> $DIR/local-type-mix.rs:17:36 + --> $DIR/local-type-mix.rs:15:36 | LL | async fn async_foo_ret(x: bool) -> x {} | ^ not a type diff --git a/tests/ui/codegen/alias-uninit-value.rs b/tests/ui/codegen/alias-uninit-value.rs new file mode 100644 index 00000000000..a8aa94caaf2 --- /dev/null +++ b/tests/ui/codegen/alias-uninit-value.rs @@ -0,0 +1,26 @@ +//! Regression test for issue #374, where previously rustc performed conditional jumps or moves that +//! incorrectly depended on uninitialized values. +//! +//! Issue: <https://github.com/rust-lang/rust/issues/374>. + +//@ run-pass + +#![allow(dead_code)] + +enum TyS { + Nil, +} + +struct RawT { + struct_: TyS, + cname: Option<String>, + hash: usize, +} + +fn mk_raw_ty(st: TyS, cname: Option<String>) -> RawT { + return RawT { struct_: st, cname: cname, hash: 0 }; +} + +pub fn main() { + mk_raw_ty(TyS::Nil, None::<String>); +} diff --git a/tests/ui/const-generics/generic_const_exprs/unevaluated-const-ice-119731.stderr b/tests/ui/const-generics/generic_const_exprs/unevaluated-const-ice-119731.stderr index 4eb374b2020..30a45ce377e 100644 --- a/tests/ui/const-generics/generic_const_exprs/unevaluated-const-ice-119731.stderr +++ b/tests/ui/const-generics/generic_const_exprs/unevaluated-const-ice-119731.stderr @@ -72,20 +72,6 @@ help: add `#![feature(adt_const_params)]` to the crate attributes to enable more LL + #![feature(adt_const_params)] | -note: erroneous constant encountered - --> $DIR/unevaluated-const-ice-119731.rs:22:19 - | -LL | impl v17<512, v0> { - | ^^ - -note: erroneous constant encountered - --> $DIR/unevaluated-const-ice-119731.rs:22:19 - | -LL | impl v17<512, v0> { - | ^^ - | - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - error: maximum number of nodes exceeded in constant v20::v17::<v10, v2>::{constant#0} --> $DIR/unevaluated-const-ice-119731.rs:28:37 | diff --git a/tests/ui/consts/const-integer-bool-ops.stderr b/tests/ui/consts/const-integer-bool-ops.stderr index d58a8e93ff6..4e503e5a5c0 100644 --- a/tests/ui/consts/const-integer-bool-ops.stderr +++ b/tests/ui/consts/const-integer-bool-ops.stderr @@ -16,12 +16,6 @@ error[E0308]: mismatched types LL | const X: usize = 42 && 39; | ^^^^^^^^ expected `usize`, found `bool` -note: erroneous constant encountered - --> $DIR/const-integer-bool-ops.rs:8:18 - | -LL | const ARR: [i32; X] = [99; 34]; - | ^ - error[E0308]: mismatched types --> $DIR/const-integer-bool-ops.rs:10:19 | @@ -40,12 +34,6 @@ error[E0308]: mismatched types LL | const X1: usize = 42 || 39; | ^^^^^^^^ expected `usize`, found `bool` -note: erroneous constant encountered - --> $DIR/const-integer-bool-ops.rs:17:19 - | -LL | const ARR1: [i32; X1] = [99; 47]; - | ^^ - error[E0308]: mismatched types --> $DIR/const-integer-bool-ops.rs:19:19 | @@ -64,12 +52,6 @@ error[E0308]: mismatched types LL | const X2: usize = -42 || -39; | ^^^^^^^^^^ expected `usize`, found `bool` -note: erroneous constant encountered - --> $DIR/const-integer-bool-ops.rs:26:19 - | -LL | const ARR2: [i32; X2] = [99; 18446744073709551607]; - | ^^ - error[E0308]: mismatched types --> $DIR/const-integer-bool-ops.rs:28:19 | @@ -88,84 +70,42 @@ error[E0308]: mismatched types LL | const X3: usize = -42 && -39; | ^^^^^^^^^^ expected `usize`, found `bool` -note: erroneous constant encountered - --> $DIR/const-integer-bool-ops.rs:35:19 - | -LL | const ARR3: [i32; X3] = [99; 6]; - | ^^ - error[E0308]: mismatched types --> $DIR/const-integer-bool-ops.rs:37:18 | LL | const Y: usize = 42.0 == 42.0; | ^^^^^^^^^^^^ expected `usize`, found `bool` -note: erroneous constant encountered - --> $DIR/const-integer-bool-ops.rs:40:19 - | -LL | const ARRR: [i32; Y] = [99; 1]; - | ^ - error[E0308]: mismatched types --> $DIR/const-integer-bool-ops.rs:42:19 | LL | const Y1: usize = 42.0 >= 42.0; | ^^^^^^^^^^^^ expected `usize`, found `bool` -note: erroneous constant encountered - --> $DIR/const-integer-bool-ops.rs:45:20 - | -LL | const ARRR1: [i32; Y1] = [99; 1]; - | ^^ - error[E0308]: mismatched types --> $DIR/const-integer-bool-ops.rs:47:19 | LL | const Y2: usize = 42.0 <= 42.0; | ^^^^^^^^^^^^ expected `usize`, found `bool` -note: erroneous constant encountered - --> $DIR/const-integer-bool-ops.rs:50:20 - | -LL | const ARRR2: [i32; Y2] = [99; 1]; - | ^^ - error[E0308]: mismatched types --> $DIR/const-integer-bool-ops.rs:52:19 | LL | const Y3: usize = 42.0 > 42.0; | ^^^^^^^^^^^ expected `usize`, found `bool` -note: erroneous constant encountered - --> $DIR/const-integer-bool-ops.rs:55:20 - | -LL | const ARRR3: [i32; Y3] = [99; 0]; - | ^^ - error[E0308]: mismatched types --> $DIR/const-integer-bool-ops.rs:57:19 | LL | const Y4: usize = 42.0 < 42.0; | ^^^^^^^^^^^ expected `usize`, found `bool` -note: erroneous constant encountered - --> $DIR/const-integer-bool-ops.rs:60:20 - | -LL | const ARRR4: [i32; Y4] = [99; 0]; - | ^^ - error[E0308]: mismatched types --> $DIR/const-integer-bool-ops.rs:62:19 | LL | const Y5: usize = 42.0 != 42.0; | ^^^^^^^^^^^^ expected `usize`, found `bool` -note: erroneous constant encountered - --> $DIR/const-integer-bool-ops.rs:65:20 - | -LL | const ARRR5: [i32; Y5] = [99; 0]; - | ^^ - error: aborting due to 18 previous errors For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/consts/const-mut-refs/issue-76510.stderr b/tests/ui/consts/const-mut-refs/issue-76510.stderr index a63be676fda..aff86e83578 100644 --- a/tests/ui/consts/const-mut-refs/issue-76510.stderr +++ b/tests/ui/consts/const-mut-refs/issue-76510.stderr @@ -4,12 +4,6 @@ error[E0764]: mutable references are not allowed in the final value of constants LL | const S: &'static mut str = &mut " hello "; | ^^^^^^^^^^^^^^ -note: erroneous constant encountered - --> $DIR/issue-76510.rs:7:70 - | -LL | let s = transmute::<(*const u8, usize), &ManuallyDrop<str>>((S.as_ptr(), 3)); - | ^ - error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0764`. diff --git a/tests/ui/consts/const-try.stderr b/tests/ui/consts/const-try.stderr index abb03a74c82..4209ca1d526 100644 --- a/tests/ui/consts/const-try.stderr +++ b/tests/ui/consts/const-try.stderr @@ -2,7 +2,7 @@ error: const `impl` for trait `FromResidual` which is not marked with `#[const_t --> $DIR/const-try.rs:15:12 | LL | impl const FromResidual<Error> for TryMe { - | ^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^ this trait is not `const` | = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const` = note: adding a non-const method body in the future would be a breaking change @@ -11,7 +11,7 @@ error: const `impl` for trait `Try` which is not marked with `#[const_trait]` --> $DIR/const-try.rs:22:12 | LL | impl const Try for TryMe { - | ^^^ + | ^^^ this trait is not `const` | = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const` = note: adding a non-const method body in the future would be a breaking change diff --git a/tests/ui/consts/const-tup-index-span.stderr b/tests/ui/consts/const-tup-index-span.stderr index 2a3f0cfb06d..792e18aa8fd 100644 --- a/tests/ui/consts/const-tup-index-span.stderr +++ b/tests/ui/consts/const-tup-index-span.stderr @@ -11,12 +11,6 @@ help: use a trailing comma to create a tuple with one element LL | const TUP: (usize,) = (5usize << 64,); | + ++ -note: erroneous constant encountered - --> $DIR/const-tup-index-span.rs:6:18 - | -LL | const ARR: [i32; TUP.0] = []; - | ^^^ - error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/consts/fn_trait_refs.stderr b/tests/ui/consts/fn_trait_refs.stderr index bb7ff76b125..e0dbecff8e5 100644 --- a/tests/ui/consts/fn_trait_refs.stderr +++ b/tests/ui/consts/fn_trait_refs.stderr @@ -14,110 +14,145 @@ error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/fn_trait_refs.rs:14:8 | LL | T: ~const Fn<()> + ~const Destruct, - | ^^^^^^ + | ^^^^^^ can't be applied to `Fn` + | +note: `Fn` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/ops/function.rs:LL:COL error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/fn_trait_refs.rs:14:8 | LL | T: ~const Fn<()> + ~const Destruct, - | ^^^^^^ + | ^^^^^^ can't be applied to `Fn` | +note: `Fn` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/ops/function.rs:LL:COL = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/fn_trait_refs.rs:14:8 | LL | T: ~const Fn<()> + ~const Destruct, - | ^^^^^^ + | ^^^^^^ can't be applied to `Fn` | +note: `Fn` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/ops/function.rs:LL:COL = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/fn_trait_refs.rs:21:8 | LL | T: ~const FnMut<()> + ~const Destruct, - | ^^^^^^ + | ^^^^^^ can't be applied to `FnMut` + | +note: `FnMut` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/ops/function.rs:LL:COL error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/fn_trait_refs.rs:21:8 | LL | T: ~const FnMut<()> + ~const Destruct, - | ^^^^^^ + | ^^^^^^ can't be applied to `FnMut` | +note: `FnMut` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/ops/function.rs:LL:COL = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/fn_trait_refs.rs:21:8 | LL | T: ~const FnMut<()> + ~const Destruct, - | ^^^^^^ + | ^^^^^^ can't be applied to `FnMut` | +note: `FnMut` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/ops/function.rs:LL:COL = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/fn_trait_refs.rs:28:8 | LL | T: ~const FnOnce<()>, - | ^^^^^^ + | ^^^^^^ can't be applied to `FnOnce` + | +note: `FnOnce` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/ops/function.rs:LL:COL error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/fn_trait_refs.rs:28:8 | LL | T: ~const FnOnce<()>, - | ^^^^^^ + | ^^^^^^ can't be applied to `FnOnce` | +note: `FnOnce` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/ops/function.rs:LL:COL = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/fn_trait_refs.rs:28:8 | LL | T: ~const FnOnce<()>, - | ^^^^^^ + | ^^^^^^ can't be applied to `FnOnce` | +note: `FnOnce` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/ops/function.rs:LL:COL = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/fn_trait_refs.rs:35:8 | LL | T: ~const Fn<()> + ~const Destruct, - | ^^^^^^ + | ^^^^^^ can't be applied to `Fn` + | +note: `Fn` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/ops/function.rs:LL:COL error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/fn_trait_refs.rs:35:8 | LL | T: ~const Fn<()> + ~const Destruct, - | ^^^^^^ + | ^^^^^^ can't be applied to `Fn` | +note: `Fn` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/ops/function.rs:LL:COL = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/fn_trait_refs.rs:35:8 | LL | T: ~const Fn<()> + ~const Destruct, - | ^^^^^^ + | ^^^^^^ can't be applied to `Fn` | +note: `Fn` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/ops/function.rs:LL:COL = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/fn_trait_refs.rs:49:8 | LL | T: ~const FnMut<()> + ~const Destruct, - | ^^^^^^ + | ^^^^^^ can't be applied to `FnMut` + | +note: `FnMut` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/ops/function.rs:LL:COL error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/fn_trait_refs.rs:49:8 | LL | T: ~const FnMut<()> + ~const Destruct, - | ^^^^^^ + | ^^^^^^ can't be applied to `FnMut` | +note: `FnMut` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/ops/function.rs:LL:COL = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/fn_trait_refs.rs:49:8 | LL | T: ~const FnMut<()> + ~const Destruct, - | ^^^^^^ + | ^^^^^^ can't be applied to `FnMut` | +note: `FnMut` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/ops/function.rs:LL:COL = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error[E0277]: the trait bound `fn() -> i32 {one}: const Destruct` is not satisfied diff --git a/tests/ui/consts/issue-54954.stderr b/tests/ui/consts/issue-54954.stderr index ed6aa9c44a3..b8c983eb7b8 100644 --- a/tests/ui/consts/issue-54954.stderr +++ b/tests/ui/consts/issue-54954.stderr @@ -19,24 +19,6 @@ LL | | core::mem::size_of::<T>() LL | | } | |_____- `Tt::const_val` defined here -note: erroneous constant encountered - --> $DIR/issue-54954.rs:11:15 - | -LL | fn f(z: [f32; ARR_LEN]) -> [f32; ARR_LEN] { - | ^^^^^^^ - -note: erroneous constant encountered - --> $DIR/issue-54954.rs:11:34 - | -LL | fn f(z: [f32; ARR_LEN]) -> [f32; ARR_LEN] { - | ^^^^^^^ - -note: erroneous constant encountered - --> $DIR/issue-54954.rs:16:22 - | -LL | let _ = f([1f32; ARR_LEN]); - | ^^^^^^^ - error: aborting due to 2 previous errors Some errors have detailed explanations: E0379, E0790. diff --git a/tests/ui/consts/missing_assoc_const_type2.stderr b/tests/ui/consts/missing_assoc_const_type2.stderr index 3279a077464..1255ca2d102 100644 --- a/tests/ui/consts/missing_assoc_const_type2.stderr +++ b/tests/ui/consts/missing_assoc_const_type2.stderr @@ -4,11 +4,5 @@ error: missing type for `const` item LL | const FIRST: = 10; | ^ help: provide a type for the associated constant: `u8` -note: erroneous constant encountered - --> $DIR/missing_assoc_const_type2.rs:18:5 - | -LL | TwoDigits::FIRST as usize - | ^^^^^^^^^^^^^^^^ - error: aborting due to 1 previous error diff --git a/tests/ui/consts/promoted-type-error-issue-133968.rs b/tests/ui/consts/promoted-type-error-issue-133968.rs new file mode 100644 index 00000000000..52c0d48ab5b --- /dev/null +++ b/tests/ui/consts/promoted-type-error-issue-133968.rs @@ -0,0 +1,7 @@ +struct B<T: ?Sized + Send + 'static> { + x: &'static T, +} +static STR: &'static [u8] = "a b"; //~ERROR: mismatched types +static C: &B<[u8]> = &B { x: STR }; + +fn main() {} diff --git a/tests/ui/consts/promoted-type-error-issue-133968.stderr b/tests/ui/consts/promoted-type-error-issue-133968.stderr new file mode 100644 index 00000000000..24f1268e4b6 --- /dev/null +++ b/tests/ui/consts/promoted-type-error-issue-133968.stderr @@ -0,0 +1,16 @@ +error[E0308]: mismatched types + --> $DIR/promoted-type-error-issue-133968.rs:4:29 + | +LL | static STR: &'static [u8] = "a b"; + | ^^^^^ expected `&[u8]`, found `&str` + | + = note: expected reference `&'static [u8]` + found reference `&'static str` +help: consider adding a leading `b` + | +LL | static STR: &'static [u8] = b"a b"; + | + + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/consts/rustc-impl-const-stability.stderr b/tests/ui/consts/rustc-impl-const-stability.stderr index 4a58b5c8603..19c6bb5907f 100644 --- a/tests/ui/consts/rustc-impl-const-stability.stderr +++ b/tests/ui/consts/rustc-impl-const-stability.stderr @@ -2,7 +2,7 @@ error: const `impl` for trait `Default` which is not marked with `#[const_trait] --> $DIR/rustc-impl-const-stability.rs:15:12 | LL | impl const Default for Data { - | ^^^^^^^ + | ^^^^^^^ this trait is not `const` | = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const` = note: adding a non-const method body in the future would be a breaking change diff --git a/tests/ui/consts/unstable-const-fn-in-libcore.stderr b/tests/ui/consts/unstable-const-fn-in-libcore.stderr index f40c1871e90..32693edbfcb 100644 --- a/tests/ui/consts/unstable-const-fn-in-libcore.stderr +++ b/tests/ui/consts/unstable-const-fn-in-libcore.stderr @@ -2,14 +2,19 @@ error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/unstable-const-fn-in-libcore.rs:19:32 | LL | const fn unwrap_or_else<F: ~const FnOnce() -> T>(self, f: F) -> T { - | ^^^^^^ + | ^^^^^^ can't be applied to `FnOnce` + | +note: `FnOnce` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/ops/function.rs:LL:COL error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/unstable-const-fn-in-libcore.rs:19:32 | LL | const fn unwrap_or_else<F: ~const FnOnce() -> T>(self, f: F) -> T { - | ^^^^^^ + | ^^^^^^ can't be applied to `FnOnce` | +note: `FnOnce` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/ops/function.rs:LL:COL = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error[E0015]: cannot call non-const closure in constant functions diff --git a/tests/ui/coroutine/break-inside-coroutine-issue-124495.rs b/tests/ui/coroutine/break-inside-coroutine-issue-124495.rs index d0597fdd8e1..7d8b1a1156c 100644 --- a/tests/ui/coroutine/break-inside-coroutine-issue-124495.rs +++ b/tests/ui/coroutine/break-inside-coroutine-issue-124495.rs @@ -1,7 +1,6 @@ //@ edition: 2024 #![feature(gen_blocks)] -#![feature(async_closure)] async fn async_fn() { break; //~ ERROR `break` inside `async` function diff --git a/tests/ui/coroutine/break-inside-coroutine-issue-124495.stderr b/tests/ui/coroutine/break-inside-coroutine-issue-124495.stderr index bdd26d39d82..ee838fbe694 100644 --- a/tests/ui/coroutine/break-inside-coroutine-issue-124495.stderr +++ b/tests/ui/coroutine/break-inside-coroutine-issue-124495.stderr @@ -1,5 +1,5 @@ error[E0267]: `break` inside `async` function - --> $DIR/break-inside-coroutine-issue-124495.rs:7:5 + --> $DIR/break-inside-coroutine-issue-124495.rs:6:5 | LL | async fn async_fn() { | ------------------- enclosing `async` function @@ -7,7 +7,7 @@ LL | break; | ^^^^^ cannot `break` inside `async` function error[E0267]: `break` inside `gen` function - --> $DIR/break-inside-coroutine-issue-124495.rs:11:5 + --> $DIR/break-inside-coroutine-issue-124495.rs:10:5 | LL | gen fn gen_fn() { | --------------- enclosing `gen` function @@ -15,7 +15,7 @@ LL | break; | ^^^^^ cannot `break` inside `gen` function error[E0267]: `break` inside `async gen` function - --> $DIR/break-inside-coroutine-issue-124495.rs:15:5 + --> $DIR/break-inside-coroutine-issue-124495.rs:14:5 | LL | async gen fn async_gen_fn() { | --------------------------- enclosing `async gen` function @@ -23,7 +23,7 @@ LL | break; | ^^^^^ cannot `break` inside `async gen` function error[E0267]: `break` inside `async` block - --> $DIR/break-inside-coroutine-issue-124495.rs:19:21 + --> $DIR/break-inside-coroutine-issue-124495.rs:18:21 | LL | let _ = async { break; }; | ----- ^^^^^ cannot `break` inside `async` block @@ -31,7 +31,7 @@ LL | let _ = async { break; }; | enclosing `async` block error[E0267]: `break` inside `async` closure - --> $DIR/break-inside-coroutine-issue-124495.rs:21:24 + --> $DIR/break-inside-coroutine-issue-124495.rs:20:24 | LL | let _ = async || { break; }; | -------- ^^^^^ cannot `break` inside `async` closure @@ -39,7 +39,7 @@ LL | let _ = async || { break; }; | enclosing `async` closure error[E0267]: `break` inside `gen` block - --> $DIR/break-inside-coroutine-issue-124495.rs:23:19 + --> $DIR/break-inside-coroutine-issue-124495.rs:22:19 | LL | let _ = gen { break; }; | --- ^^^^^ cannot `break` inside `gen` block @@ -47,7 +47,7 @@ LL | let _ = gen { break; }; | enclosing `gen` block error[E0267]: `break` inside `async gen` block - --> $DIR/break-inside-coroutine-issue-124495.rs:25:25 + --> $DIR/break-inside-coroutine-issue-124495.rs:24:25 | LL | let _ = async gen { break; }; | --------- ^^^^^ cannot `break` inside `async gen` block diff --git a/tests/ui/diagnostic-flags/allow-non-lint-warnings.rs b/tests/ui/diagnostic-flags/allow-non-lint-warnings.rs new file mode 100644 index 00000000000..40b9e6536f5 --- /dev/null +++ b/tests/ui/diagnostic-flags/allow-non-lint-warnings.rs @@ -0,0 +1,27 @@ +// ignore-tidy-linelength +//! Check that `-A warnings` cli flag applies to non-lint warnings as well. +//! +//! This test tries to exercise that by checking that the "relaxing a default bound only does +//! something for `?Sized`; all other traits are not bound by default" non-lint warning (normally +//! warn-by-default) is suppressed if the `-A warnings` cli flag is passed. +//! +//! Take special note that `warnings` is a special pseudo lint group in relationship to non-lint +//! warnings, which is somewhat special. This test does not exercise other `-A <other_lint_group>` +//! that check that they are working in the same way, only `warnings` specifically. +//! +//! # Relevant context +//! +//! - Original impl PR: <https://github.com/rust-lang/rust/pull/21248>. +//! - RFC 507 "Release channels": +//! <https://github.com/rust-lang/rfcs/blob/c017755b9bfa0421570d92ba38082302e0f3ad4f/text/0507-release-channels.md>. +#![crate_type = "lib"] + +//@ revisions: without_flag with_flag + +//@[with_flag] compile-flags: -Awarnings + +//@ check-pass + +pub trait Trait {} +pub fn f<T: ?Trait>() {} +//[without_flag]~^ WARN relaxing a default bound only does something for `?Sized`; all other traits are not bound by default diff --git a/tests/ui/diagnostic-flags/allow-non-lint-warnings.without_flag.stderr b/tests/ui/diagnostic-flags/allow-non-lint-warnings.without_flag.stderr new file mode 100644 index 00000000000..b037847c70f --- /dev/null +++ b/tests/ui/diagnostic-flags/allow-non-lint-warnings.without_flag.stderr @@ -0,0 +1,8 @@ +warning: relaxing a default bound only does something for `?Sized`; all other traits are not bound by default + --> $DIR/allow-non-lint-warnings.rs:26:13 + | +LL | pub fn f<T: ?Trait>() {} + | ^^^^^^ + +warning: 1 warning emitted + diff --git a/tests/ui/editions/edition-keywords-2018-2015-parsing.rs b/tests/ui/editions/edition-keywords-2018-2015-parsing.rs index c346be50856..c3dfcfb19cb 100644 --- a/tests/ui/editions/edition-keywords-2018-2015-parsing.rs +++ b/tests/ui/editions/edition-keywords-2018-2015-parsing.rs @@ -1,8 +1,6 @@ //@ edition:2018 //@ aux-build:edition-kw-macro-2015.rs -#![feature(async_closure)] - fn main() {} #[macro_use] diff --git a/tests/ui/editions/edition-keywords-2018-2015-parsing.stderr b/tests/ui/editions/edition-keywords-2018-2015-parsing.stderr index aed5837abea..905e1249d97 100644 --- a/tests/ui/editions/edition-keywords-2018-2015-parsing.stderr +++ b/tests/ui/editions/edition-keywords-2018-2015-parsing.stderr @@ -1,5 +1,5 @@ error: expected identifier, found keyword `async` - --> $DIR/edition-keywords-2018-2015-parsing.rs:16:13 + --> $DIR/edition-keywords-2018-2015-parsing.rs:14:13 | LL | let mut async = 1; | ^^^^^ expected identifier, found keyword @@ -10,7 +10,7 @@ LL | let mut r#async = 1; | ++ error: expected identifier, found keyword `async` - --> $DIR/edition-keywords-2018-2015-parsing.rs:28:13 + --> $DIR/edition-keywords-2018-2015-parsing.rs:26:13 | LL | module::async(); | ^^^^^ expected identifier, found keyword @@ -21,7 +21,7 @@ LL | module::r#async(); | ++ error: no rules expected `r#async` - --> $DIR/edition-keywords-2018-2015-parsing.rs:20:31 + --> $DIR/edition-keywords-2018-2015-parsing.rs:18:31 | LL | r#async = consumes_async!(r#async); | ^^^^^^^ no rules expected this token in macro call @@ -33,7 +33,7 @@ LL | (async) => (1) | ^^^^^ error: no rules expected keyword `async` - --> $DIR/edition-keywords-2018-2015-parsing.rs:21:35 + --> $DIR/edition-keywords-2018-2015-parsing.rs:19:35 | LL | r#async = consumes_async_raw!(async); | ^^^^^ no rules expected this token in macro call @@ -50,19 +50,19 @@ error: macro expansion ends with an incomplete expression: expected one of `move LL | ($i: ident) => ($i) | ^ expected one of `move`, `|`, or `||` | - ::: $DIR/edition-keywords-2018-2015-parsing.rs:24:8 + ::: $DIR/edition-keywords-2018-2015-parsing.rs:22:8 | LL | if passes_ident!(async) == 1 {} // FIXME: Edition hygiene bug, async here is 2018 and reserved | -------------------- in this macro invocation error: macro expansion ends with an incomplete expression: expected one of `move`, `|`, or `||` - --> $DIR/edition-keywords-2018-2015-parsing.rs:26:24 + --> $DIR/edition-keywords-2018-2015-parsing.rs:24:24 | LL | if passes_tt!(async) == 1 {} | ^ expected one of `move`, `|`, or `||` error[E0308]: mismatched types - --> $DIR/edition-keywords-2018-2015-parsing.rs:31:33 + --> $DIR/edition-keywords-2018-2015-parsing.rs:29:33 | LL | let _recovery_witness: () = 0; | -- ^ expected `()`, found integer diff --git a/tests/ui/editions/edition-keywords-2018-2018-parsing.rs b/tests/ui/editions/edition-keywords-2018-2018-parsing.rs index b75b68b3feb..1447c49ef71 100644 --- a/tests/ui/editions/edition-keywords-2018-2018-parsing.rs +++ b/tests/ui/editions/edition-keywords-2018-2018-parsing.rs @@ -1,8 +1,6 @@ //@ edition:2018 //@ aux-build:edition-kw-macro-2018.rs -#![feature(async_closure)] - fn main() {} #[macro_use] diff --git a/tests/ui/editions/edition-keywords-2018-2018-parsing.stderr b/tests/ui/editions/edition-keywords-2018-2018-parsing.stderr index 6503e9cc73c..af5cc515bb2 100644 --- a/tests/ui/editions/edition-keywords-2018-2018-parsing.stderr +++ b/tests/ui/editions/edition-keywords-2018-2018-parsing.stderr @@ -1,5 +1,5 @@ error: expected identifier, found keyword `async` - --> $DIR/edition-keywords-2018-2018-parsing.rs:23:13 + --> $DIR/edition-keywords-2018-2018-parsing.rs:21:13 | LL | let mut async = 1; | ^^^^^ expected identifier, found keyword @@ -10,7 +10,7 @@ LL | let mut r#async = 1; | ++ error: expected identifier, found keyword `async` - --> $DIR/edition-keywords-2018-2018-parsing.rs:39:13 + --> $DIR/edition-keywords-2018-2018-parsing.rs:37:13 | LL | module::async(); | ^^^^^ expected identifier, found keyword @@ -21,7 +21,7 @@ LL | module::r#async(); | ++ error: no rules expected `r#async` - --> $DIR/edition-keywords-2018-2018-parsing.rs:27:31 + --> $DIR/edition-keywords-2018-2018-parsing.rs:25:31 | LL | r#async = consumes_async!(r#async); | ^^^^^^^ no rules expected this token in macro call @@ -33,7 +33,7 @@ LL | (async) => (1) | ^^^^^ error: no rules expected keyword `async` - --> $DIR/edition-keywords-2018-2018-parsing.rs:28:35 + --> $DIR/edition-keywords-2018-2018-parsing.rs:26:35 | LL | r#async = consumes_async_raw!(async); | ^^^^^ no rules expected this token in macro call @@ -50,31 +50,31 @@ error: macro expansion ends with an incomplete expression: expected one of `move LL | ($i: ident) => ($i) | ^ expected one of `move`, `|`, or `||` | - ::: $DIR/edition-keywords-2018-2018-parsing.rs:31:8 + ::: $DIR/edition-keywords-2018-2018-parsing.rs:29:8 | LL | if passes_ident!(async) == 1 {} // FIXME: Edition hygiene bug, async here is 2018 and reserved | -------------------- in this macro invocation error: macro expansion ends with an incomplete expression: expected one of `move`, `|`, or `||` - --> $DIR/edition-keywords-2018-2018-parsing.rs:33:24 + --> $DIR/edition-keywords-2018-2018-parsing.rs:31:24 | LL | if passes_tt!(async) == 1 {} | ^ expected one of `move`, `|`, or `||` error: macro expansion ends with an incomplete expression: expected one of `move`, `|`, or `||` - --> $DIR/edition-keywords-2018-2018-parsing.rs:16:23 + --> $DIR/edition-keywords-2018-2018-parsing.rs:14:23 | LL | ($i: ident) => ($i) | ^ expected one of `move`, `|`, or `||` error: macro expansion ends with an incomplete expression: expected one of `move`, `|`, or `||` - --> $DIR/edition-keywords-2018-2018-parsing.rs:37:30 + --> $DIR/edition-keywords-2018-2018-parsing.rs:35:30 | LL | if local_passes_tt!(async) == 1 {} | ^ expected one of `move`, `|`, or `||` error[E0308]: mismatched types - --> $DIR/edition-keywords-2018-2018-parsing.rs:42:33 + --> $DIR/edition-keywords-2018-2018-parsing.rs:40:33 | LL | let _recovery_witness: () = 0; | -- ^ expected `()`, found integer diff --git a/tests/ui/editions/never-type-fallback-breaking.e2021.fixed b/tests/ui/editions/never-type-fallback-breaking.e2021.fixed index 91d30de74c7..11ec273fc4b 100644 --- a/tests/ui/editions/never-type-fallback-breaking.e2021.fixed +++ b/tests/ui/editions/never-type-fallback-breaking.e2021.fixed @@ -11,6 +11,8 @@ fn main() { m(); q(); let _ = meow(); + let _ = fallback_return(); + let _ = fully_apit(); } fn m() { @@ -49,3 +51,29 @@ fn meow() -> Result<(), ()> { //[e2024]~^ error: the trait bound `(): From<!>` is not satisfied Ok(()) } + +pub fn takes_apit<T>(_y: impl Fn() -> T) -> Result<T, ()> { + Err(()) +} + +pub fn fallback_return() -> Result<(), ()> { + //[e2021]~^ this function depends on never type fallback being `()` + //[e2021]~| this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! + takes_apit::<()>(|| Default::default())?; + //[e2024]~^ error: the trait bound `!: Default` is not satisfied + Ok(()) +} + +fn mk<T>() -> Result<T, ()> { + Err(()) +} + +fn takes_apit2(_x: impl Default) {} + +fn fully_apit() -> Result<(), ()> { + //[e2021]~^ this function depends on never type fallback being `()` + //[e2021]~| this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! + takes_apit2(mk::<()>()?); + //[e2024]~^ error: the trait bound `!: Default` is not satisfied + Ok(()) +} diff --git a/tests/ui/editions/never-type-fallback-breaking.e2021.stderr b/tests/ui/editions/never-type-fallback-breaking.e2021.stderr index 6fdb548c431..9009d617936 100644 --- a/tests/ui/editions/never-type-fallback-breaking.e2021.stderr +++ b/tests/ui/editions/never-type-fallback-breaking.e2021.stderr @@ -1,5 +1,5 @@ warning: this function depends on never type fallback being `()` - --> $DIR/never-type-fallback-breaking.rs:16:1 + --> $DIR/never-type-fallback-breaking.rs:18:1 | LL | fn m() { | ^^^^^^ @@ -8,7 +8,7 @@ LL | fn m() { = note: for more information, see issue #123748 <https://github.com/rust-lang/rust/issues/123748> = help: specify the types explicitly note: in edition 2024, the requirement `!: Default` will fail - --> $DIR/never-type-fallback-breaking.rs:20:17 + --> $DIR/never-type-fallback-breaking.rs:22:17 | LL | true => Default::default(), | ^^^^^^^^^^^^^^^^^^ @@ -19,7 +19,7 @@ LL | let x: () = match true { | ++++ warning: this function depends on never type fallback being `()` - --> $DIR/never-type-fallback-breaking.rs:28:1 + --> $DIR/never-type-fallback-breaking.rs:30:1 | LL | fn q() -> Option<()> { | ^^^^^^^^^^^^^^^^^^^^ @@ -28,7 +28,7 @@ LL | fn q() -> Option<()> { = note: for more information, see issue #123748 <https://github.com/rust-lang/rust/issues/123748> = help: specify the types explicitly note: in edition 2024, the requirement `!: Default` will fail - --> $DIR/never-type-fallback-breaking.rs:35:5 + --> $DIR/never-type-fallback-breaking.rs:37:5 | LL | deserialize()?; | ^^^^^^^^^^^^^ @@ -38,7 +38,7 @@ LL | deserialize::<()>()?; | ++++++ warning: this function depends on never type fallback being `()` - --> $DIR/never-type-fallback-breaking.rs:45:1 + --> $DIR/never-type-fallback-breaking.rs:47:1 | LL | fn meow() -> Result<(), ()> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -47,7 +47,7 @@ LL | fn meow() -> Result<(), ()> { = note: for more information, see issue #123748 <https://github.com/rust-lang/rust/issues/123748> = help: specify the types explicitly note: in edition 2024, the requirement `(): From<!>` will fail - --> $DIR/never-type-fallback-breaking.rs:48:5 + --> $DIR/never-type-fallback-breaking.rs:50:5 | LL | help(1)?; | ^^^^^^^ @@ -56,5 +56,43 @@ help: use `()` annotations to avoid fallback changes LL | help::<(), _>(1)?; | +++++++++ -warning: 3 warnings emitted +warning: this function depends on never type fallback being `()` + --> $DIR/never-type-fallback-breaking.rs:59:1 + | +LL | pub fn fallback_return() -> Result<(), ()> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! + = note: for more information, see issue #123748 <https://github.com/rust-lang/rust/issues/123748> + = help: specify the types explicitly +note: in edition 2024, the requirement `!: Default` will fail + --> $DIR/never-type-fallback-breaking.rs:62:19 + | +LL | takes_apit(|| Default::default())?; + | ^^^^^^^^^^^^^^^^^^ +help: use `()` annotations to avoid fallback changes + | +LL | takes_apit::<()>(|| Default::default())?; + | ++++++ + +warning: this function depends on never type fallback being `()` + --> $DIR/never-type-fallback-breaking.rs:73:1 + | +LL | fn fully_apit() -> Result<(), ()> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! + = note: for more information, see issue #123748 <https://github.com/rust-lang/rust/issues/123748> + = help: specify the types explicitly +note: in edition 2024, the requirement `!: Default` will fail + --> $DIR/never-type-fallback-breaking.rs:76:17 + | +LL | takes_apit2(mk()?); + | ^^^^^ +help: use `()` annotations to avoid fallback changes + | +LL | takes_apit2(mk::<()>()?); + | ++++++ + +warning: 5 warnings emitted diff --git a/tests/ui/editions/never-type-fallback-breaking.e2024.stderr b/tests/ui/editions/never-type-fallback-breaking.e2024.stderr index 9d79dfb4099..2daf00f7804 100644 --- a/tests/ui/editions/never-type-fallback-breaking.e2024.stderr +++ b/tests/ui/editions/never-type-fallback-breaking.e2024.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `!: Default` is not satisfied - --> $DIR/never-type-fallback-breaking.rs:20:17 + --> $DIR/never-type-fallback-breaking.rs:22:17 | LL | true => Default::default(), | ^^^^^^^^^^^^^^^^^^ the trait `Default` is not implemented for `!` @@ -8,7 +8,7 @@ LL | true => Default::default(), = help: did you intend to use the type `()` here instead? error[E0277]: the trait bound `!: Default` is not satisfied - --> $DIR/never-type-fallback-breaking.rs:35:5 + --> $DIR/never-type-fallback-breaking.rs:37:5 | LL | deserialize()?; | ^^^^^^^^^^^^^ the trait `Default` is not implemented for `!` @@ -16,13 +16,13 @@ LL | deserialize()?; = note: this error might have been caused by changes to Rust's type-inference algorithm (see issue #48950 <https://github.com/rust-lang/rust/issues/48950> for more information) = help: did you intend to use the type `()` here instead? note: required by a bound in `deserialize` - --> $DIR/never-type-fallback-breaking.rs:31:23 + --> $DIR/never-type-fallback-breaking.rs:33:23 | LL | fn deserialize<T: Default>() -> Option<T> { | ^^^^^^^ required by this bound in `deserialize` error[E0277]: the trait bound `(): From<!>` is not satisfied - --> $DIR/never-type-fallback-breaking.rs:48:5 + --> $DIR/never-type-fallback-breaking.rs:50:5 | LL | help(1)?; | ^^^^^^^ the trait `From<!>` is not implemented for `()` @@ -39,11 +39,36 @@ LL | help(1)?; and 4 others = note: required for `!` to implement `Into<()>` note: required by a bound in `help` - --> $DIR/never-type-fallback-breaking.rs:42:20 + --> $DIR/never-type-fallback-breaking.rs:44:20 | LL | fn help<'a: 'a, T: Into<()>, U>(_: U) -> Result<T, ()> { | ^^^^^^^^ required by this bound in `help` -error: aborting due to 3 previous errors +error[E0277]: the trait bound `!: Default` is not satisfied + --> $DIR/never-type-fallback-breaking.rs:62:19 + | +LL | takes_apit(|| Default::default())?; + | ^^^^^^^^^^^^^^^^^^ the trait `Default` is not implemented for `!` + | + = note: this error might have been caused by changes to Rust's type-inference algorithm (see issue #48950 <https://github.com/rust-lang/rust/issues/48950> for more information) + = help: did you intend to use the type `()` here instead? + +error[E0277]: the trait bound `!: Default` is not satisfied + --> $DIR/never-type-fallback-breaking.rs:76:17 + | +LL | takes_apit2(mk()?); + | ----------- ^^^^^ the trait `Default` is not implemented for `!` + | | + | required by a bound introduced by this call + | + = note: this error might have been caused by changes to Rust's type-inference algorithm (see issue #48950 <https://github.com/rust-lang/rust/issues/48950> for more information) + = help: did you intend to use the type `()` here instead? +note: required by a bound in `takes_apit2` + --> $DIR/never-type-fallback-breaking.rs:71:25 + | +LL | fn takes_apit2(_x: impl Default) {} + | ^^^^^^^ required by this bound in `takes_apit2` + +error: aborting due to 5 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/editions/never-type-fallback-breaking.rs b/tests/ui/editions/never-type-fallback-breaking.rs index 24e33ff6bf6..daafc526eff 100644 --- a/tests/ui/editions/never-type-fallback-breaking.rs +++ b/tests/ui/editions/never-type-fallback-breaking.rs @@ -11,6 +11,8 @@ fn main() { m(); q(); let _ = meow(); + let _ = fallback_return(); + let _ = fully_apit(); } fn m() { @@ -49,3 +51,29 @@ fn meow() -> Result<(), ()> { //[e2024]~^ error: the trait bound `(): From<!>` is not satisfied Ok(()) } + +pub fn takes_apit<T>(_y: impl Fn() -> T) -> Result<T, ()> { + Err(()) +} + +pub fn fallback_return() -> Result<(), ()> { + //[e2021]~^ this function depends on never type fallback being `()` + //[e2021]~| this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! + takes_apit(|| Default::default())?; + //[e2024]~^ error: the trait bound `!: Default` is not satisfied + Ok(()) +} + +fn mk<T>() -> Result<T, ()> { + Err(()) +} + +fn takes_apit2(_x: impl Default) {} + +fn fully_apit() -> Result<(), ()> { + //[e2021]~^ this function depends on never type fallback being `()` + //[e2021]~| this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! + takes_apit2(mk()?); + //[e2024]~^ error: the trait bound `!: Default` is not satisfied + Ok(()) +} diff --git a/tests/ui/enum-discriminant/issue-41394.stderr b/tests/ui/enum-discriminant/issue-41394.stderr index 9bf4fc79b1b..e81562df04f 100644 --- a/tests/ui/enum-discriminant/issue-41394.stderr +++ b/tests/ui/enum-discriminant/issue-41394.stderr @@ -6,12 +6,6 @@ LL | A = "" + 1 | | | &str -note: erroneous constant encountered - --> $DIR/issue-41394.rs:7:9 - | -LL | A = Foo::A as isize - | ^^^^^^^^^^^^^^^ - error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0369`. diff --git a/tests/ui/feature-gates/feature-gate-arbitrary-self-types-pointers.stderr b/tests/ui/feature-gates/feature-gate-arbitrary-self-types-pointers.stderr index 3bb93cf2ea0..0c5b8a4d3b6 100644 --- a/tests/ui/feature-gates/feature-gate-arbitrary-self-types-pointers.stderr +++ b/tests/ui/feature-gates/feature-gate-arbitrary-self-types-pointers.stderr @@ -7,7 +7,7 @@ LL | fn foo(self: *const Self) {} = note: see issue #44874 <https://github.com/rust-lang/rust/issues/44874> for more information = help: add `#![feature(arbitrary_self_types_pointers)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - = help: consider changing to `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`) + = help: consider changing to `self`, `&self`, `&mut self`, or a type implementing `Receiver` such as `self: Box<Self>`, `self: Rc<Self>`, or `self: Arc<Self>` error[E0658]: `*mut Bar` cannot be used as the type of `self` without the `arbitrary_self_types_pointers` feature --> $DIR/feature-gate-arbitrary-self-types-pointers.rs:12:18 @@ -18,7 +18,7 @@ LL | fn bar(self: *mut Self) {} = note: see issue #44874 <https://github.com/rust-lang/rust/issues/44874> for more information = help: add `#![feature(arbitrary_self_types_pointers)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - = help: consider changing to `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`) + = help: consider changing to `self`, `&self`, `&mut self`, or a type implementing `Receiver` such as `self: Box<Self>`, `self: Rc<Self>`, or `self: Arc<Self>` error[E0658]: `*const Self` cannot be used as the type of `self` without the `arbitrary_self_types_pointers` feature --> $DIR/feature-gate-arbitrary-self-types-pointers.rs:2:18 @@ -29,7 +29,7 @@ LL | fn foo(self: *const Self); = note: see issue #44874 <https://github.com/rust-lang/rust/issues/44874> for more information = help: add `#![feature(arbitrary_self_types_pointers)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - = help: consider changing to `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`) + = help: consider changing to `self`, `&self`, `&mut self`, or a type implementing `Receiver` such as `self: Box<Self>`, `self: Rc<Self>`, or `self: Arc<Self>` error: aborting due to 3 previous errors diff --git a/tests/ui/feature-gates/feature-gate-arbitrary-self-types.stderr b/tests/ui/feature-gates/feature-gate-arbitrary-self-types.stderr index 7f0e02c91f8..3ffba533d63 100644 --- a/tests/ui/feature-gates/feature-gate-arbitrary-self-types.stderr +++ b/tests/ui/feature-gates/feature-gate-arbitrary-self-types.stderr @@ -7,7 +7,7 @@ LL | fn foo(self: Ptr<Self>) {} = note: see issue #44874 <https://github.com/rust-lang/rust/issues/44874> for more information = help: add `#![feature(arbitrary_self_types)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - = help: consider changing to `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`) + = help: consider changing to `self`, `&self`, `&mut self`, or a type implementing `Receiver` such as `self: Box<Self>`, `self: Rc<Self>`, or `self: Arc<Self>` error[E0658]: `Box<Ptr<Bar>>` cannot be used as the type of `self` without the `arbitrary_self_types` feature --> $DIR/feature-gate-arbitrary-self-types.rs:26:18 @@ -18,7 +18,7 @@ LL | fn bar(self: Box<Ptr<Self>>) {} = note: see issue #44874 <https://github.com/rust-lang/rust/issues/44874> for more information = help: add `#![feature(arbitrary_self_types)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - = help: consider changing to `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`) + = help: consider changing to `self`, `&self`, `&mut self`, or a type implementing `Receiver` such as `self: Box<Self>`, `self: Rc<Self>`, or `self: Arc<Self>` error[E0658]: `Ptr<Self>` cannot be used as the type of `self` without the `arbitrary_self_types` feature --> $DIR/feature-gate-arbitrary-self-types.rs:16:18 @@ -29,7 +29,7 @@ LL | fn foo(self: Ptr<Self>); = note: see issue #44874 <https://github.com/rust-lang/rust/issues/44874> for more information = help: add `#![feature(arbitrary_self_types)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - = help: consider changing to `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`) + = help: consider changing to `self`, `&self`, `&mut self`, or a type implementing `Receiver` such as `self: Box<Self>`, `self: Rc<Self>`, or `self: Arc<Self>` error: aborting due to 3 previous errors diff --git a/tests/ui/feature-gates/feature-gate-arbitrary_self_types-raw-pointer.stderr b/tests/ui/feature-gates/feature-gate-arbitrary_self_types-raw-pointer.stderr index 856e0595331..3eb87adb33a 100644 --- a/tests/ui/feature-gates/feature-gate-arbitrary_self_types-raw-pointer.stderr +++ b/tests/ui/feature-gates/feature-gate-arbitrary_self_types-raw-pointer.stderr @@ -7,7 +7,7 @@ LL | fn foo(self: *const Self) {} = note: see issue #44874 <https://github.com/rust-lang/rust/issues/44874> for more information = help: add `#![feature(arbitrary_self_types_pointers)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - = help: consider changing to `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`) + = help: consider changing to `self`, `&self`, `&mut self`, or a type implementing `Receiver` such as `self: Box<Self>`, `self: Rc<Self>`, or `self: Arc<Self>` error[E0658]: `*const ()` cannot be used as the type of `self` without the `arbitrary_self_types_pointers` feature --> $DIR/feature-gate-arbitrary_self_types-raw-pointer.rs:14:18 @@ -18,7 +18,7 @@ LL | fn bar(self: *const Self) {} = note: see issue #44874 <https://github.com/rust-lang/rust/issues/44874> for more information = help: add `#![feature(arbitrary_self_types_pointers)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - = help: consider changing to `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`) + = help: consider changing to `self`, `&self`, `&mut self`, or a type implementing `Receiver` such as `self: Box<Self>`, `self: Rc<Self>`, or `self: Arc<Self>` error[E0658]: `*const Self` cannot be used as the type of `self` without the `arbitrary_self_types_pointers` feature --> $DIR/feature-gate-arbitrary_self_types-raw-pointer.rs:9:18 @@ -29,7 +29,7 @@ LL | fn bar(self: *const Self); = note: see issue #44874 <https://github.com/rust-lang/rust/issues/44874> for more information = help: add `#![feature(arbitrary_self_types_pointers)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - = help: consider changing to `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`) + = help: consider changing to `self`, `&self`, `&mut self`, or a type implementing `Receiver` such as `self: Box<Self>`, `self: Rc<Self>`, or `self: Arc<Self>` error: aborting due to 3 previous errors diff --git a/tests/ui/feature-gates/feature-gate-async-fn-in-dyn-trait.rs b/tests/ui/feature-gates/feature-gate-async-fn-in-dyn-trait.rs new file mode 100644 index 00000000000..d9ff45f57ec --- /dev/null +++ b/tests/ui/feature-gates/feature-gate-async-fn-in-dyn-trait.rs @@ -0,0 +1,14 @@ +//@ edition: 2021 + +trait Foo { + async fn bar(&self); +} + +async fn takes_dyn_trait(x: &dyn Foo) { + //~^ ERROR the trait `Foo` cannot be made into an object + x.bar().await; + //~^ ERROR the trait `Foo` cannot be made into an object + //~| ERROR the trait `Foo` cannot be made into an object +} + +fn main() {} diff --git a/tests/ui/feature-gates/feature-gate-async-fn-in-dyn-trait.stderr b/tests/ui/feature-gates/feature-gate-async-fn-in-dyn-trait.stderr new file mode 100644 index 00000000000..f78fc422410 --- /dev/null +++ b/tests/ui/feature-gates/feature-gate-async-fn-in-dyn-trait.stderr @@ -0,0 +1,48 @@ +error[E0038]: the trait `Foo` cannot be made into an object + --> $DIR/feature-gate-async-fn-in-dyn-trait.rs:7:30 + | +LL | async fn takes_dyn_trait(x: &dyn Foo) { + | ^^^^^^^ `Foo` cannot be made into an object + | +note: for a trait to be "dyn-compatible" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + --> $DIR/feature-gate-async-fn-in-dyn-trait.rs:4:14 + | +LL | trait Foo { + | --- this trait cannot be made into an object... +LL | async fn bar(&self); + | ^^^ ...because method `bar` is `async` + = help: consider moving `bar` to another trait + +error[E0038]: the trait `Foo` cannot be made into an object + --> $DIR/feature-gate-async-fn-in-dyn-trait.rs:9:7 + | +LL | x.bar().await; + | ^^^ `Foo` cannot be made into an object + | +note: for a trait to be "dyn-compatible" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + --> $DIR/feature-gate-async-fn-in-dyn-trait.rs:4:14 + | +LL | trait Foo { + | --- this trait cannot be made into an object... +LL | async fn bar(&self); + | ^^^ ...because method `bar` is `async` + = help: consider moving `bar` to another trait + +error[E0038]: the trait `Foo` cannot be made into an object + --> $DIR/feature-gate-async-fn-in-dyn-trait.rs:9:5 + | +LL | x.bar().await; + | ^^^^^^^ `Foo` cannot be made into an object + | +note: for a trait to be "dyn-compatible" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + --> $DIR/feature-gate-async-fn-in-dyn-trait.rs:4:14 + | +LL | trait Foo { + | --- this trait cannot be made into an object... +LL | async fn bar(&self); + | ^^^ ...because method `bar` is `async` + = help: consider moving `bar` to another trait + +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0038`. diff --git a/tests/ui/feature-gates/feature-gate-async-trait-bounds.rs b/tests/ui/feature-gates/feature-gate-async-trait-bounds.rs index db5d7aa06d2..210ce60ef11 100644 --- a/tests/ui/feature-gates/feature-gate-async-trait-bounds.rs +++ b/tests/ui/feature-gates/feature-gate-async-trait-bounds.rs @@ -2,6 +2,5 @@ fn test(_: impl async Fn()) {} //~^ ERROR `async` trait bounds are unstable -//~| ERROR use of unstable library feature `async_closure` fn main() {} diff --git a/tests/ui/feature-gates/feature-gate-async-trait-bounds.stderr b/tests/ui/feature-gates/feature-gate-async-trait-bounds.stderr index abc7e37c45f..34727aef975 100644 --- a/tests/ui/feature-gates/feature-gate-async-trait-bounds.stderr +++ b/tests/ui/feature-gates/feature-gate-async-trait-bounds.stderr @@ -9,16 +9,6 @@ LL | fn test(_: impl async Fn()) {} = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date = help: use the desugared name of the async trait, such as `AsyncFn` -error[E0658]: use of unstable library feature `async_closure` - --> $DIR/feature-gate-async-trait-bounds.rs:3:23 - | -LL | fn test(_: impl async Fn()) {} - | ^^^^ - | - = note: see issue #62290 <https://github.com/rust-lang/rust/issues/62290> for more information - = help: add `#![feature(async_closure)]` 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 2 previous errors +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/feature-gates/feature-gate-dispatch-from-dyn-cell.stderr b/tests/ui/feature-gates/feature-gate-dispatch-from-dyn-cell.stderr index 2150effc3b7..eb9e51a04c3 100644 --- a/tests/ui/feature-gates/feature-gate-dispatch-from-dyn-cell.stderr +++ b/tests/ui/feature-gates/feature-gate-dispatch-from-dyn-cell.stderr @@ -4,8 +4,8 @@ error[E0307]: invalid `self` parameter type: `Cell<&Self>` LL | fn cell(self: Cell<&Self>); | ^^^^^^^^^^^ | - = note: type of `self` must be `Self` or a type that dereferences to it - = help: consider changing to `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`) + = note: type of `self` must be `Self` or some type implementing `Receiver` + = help: consider changing to `self`, `&self`, `&mut self`, or a type implementing `Receiver` such as `self: Box<Self>`, `self: Rc<Self>`, or `self: Arc<Self>` error: aborting due to 1 previous error diff --git a/tests/ui/feature-gates/feature-gate-unsafe-binders.rs b/tests/ui/feature-gates/feature-gate-unsafe-binders.rs new file mode 100644 index 00000000000..a2997ced4fa --- /dev/null +++ b/tests/ui/feature-gates/feature-gate-unsafe-binders.rs @@ -0,0 +1,7 @@ +#[cfg(any())] +fn test() { + let x: unsafe<> (); + //~^ ERROR unsafe binder types are experimental +} + +fn main() {} diff --git a/tests/ui/feature-gates/feature-gate-unsafe-binders.stderr b/tests/ui/feature-gates/feature-gate-unsafe-binders.stderr new file mode 100644 index 00000000000..93997d6c14a --- /dev/null +++ b/tests/ui/feature-gates/feature-gate-unsafe-binders.stderr @@ -0,0 +1,13 @@ +error[E0658]: unsafe binder types are experimental + --> $DIR/feature-gate-unsafe-binders.rs:3:12 + | +LL | let x: unsafe<> (); + | ^^^^^^^^^^^ + | + = note: see issue #130516 <https://github.com/rust-lang/rust/issues/130516> for more information + = help: add `#![feature(unsafe_binders)]` 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/anonymous-higher-ranked-lifetime.rs b/tests/ui/higher-ranked/anonymous-higher-ranked-lifetime.rs index 898fe22fa23..8d8d0e71067 100644 --- a/tests/ui/anonymous-higher-ranked-lifetime.rs +++ b/tests/ui/higher-ranked/anonymous-higher-ranked-lifetime.rs @@ -1,3 +1,9 @@ +//! Diagnostics test to check that higher-ranked lifetimes are properly named when being pretty +//! printed in diagnostics. +//! +//! Issue: <https://github.com/rust-lang/rust/issues/44887> +//! PR: <https://github.com/rust-lang/rust/pull/44888> + fn main() { f1(|_: (), _: ()| {}); //~ ERROR type mismatch f2(|_: (), _: ()| {}); //~ ERROR type mismatch diff --git a/tests/ui/anonymous-higher-ranked-lifetime.stderr b/tests/ui/higher-ranked/anonymous-higher-ranked-lifetime.stderr index c28d856ad55..7e0cdba6ff2 100644 --- a/tests/ui/anonymous-higher-ranked-lifetime.stderr +++ b/tests/ui/higher-ranked/anonymous-higher-ranked-lifetime.stderr @@ -1,5 +1,5 @@ error[E0631]: type mismatch in closure arguments - --> $DIR/anonymous-higher-ranked-lifetime.rs:2:5 + --> $DIR/anonymous-higher-ranked-lifetime.rs:8:5 | LL | f1(|_: (), _: ()| {}); | ^^^--------------^^^^ @@ -10,7 +10,7 @@ LL | f1(|_: (), _: ()| {}); = note: expected closure signature `for<'a, 'b> fn(&'a (), &'b ()) -> _` found closure signature `fn((), ()) -> _` note: required by a bound in `f1` - --> $DIR/anonymous-higher-ranked-lifetime.rs:16:25 + --> $DIR/anonymous-higher-ranked-lifetime.rs:22:25 | LL | fn f1<F>(_: F) where F: Fn(&(), &()) {} | ^^^^^^^^^^^^ required by this bound in `f1` @@ -20,7 +20,7 @@ LL | f1(|_: &(), _: &()| {}); | + + error[E0631]: type mismatch in closure arguments - --> $DIR/anonymous-higher-ranked-lifetime.rs:3:5 + --> $DIR/anonymous-higher-ranked-lifetime.rs:9:5 | LL | f2(|_: (), _: ()| {}); | ^^^--------------^^^^ @@ -31,7 +31,7 @@ LL | f2(|_: (), _: ()| {}); = note: expected closure signature `for<'a, 'b> fn(&'a (), &'b ()) -> _` found closure signature `fn((), ()) -> _` note: required by a bound in `f2` - --> $DIR/anonymous-higher-ranked-lifetime.rs:17:25 + --> $DIR/anonymous-higher-ranked-lifetime.rs:23:25 | LL | fn f2<F>(_: F) where F: for<'a> Fn(&'a (), &()) {} | ^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `f2` @@ -41,7 +41,7 @@ LL | f2(|_: &(), _: &()| {}); | + + error[E0631]: type mismatch in closure arguments - --> $DIR/anonymous-higher-ranked-lifetime.rs:4:5 + --> $DIR/anonymous-higher-ranked-lifetime.rs:10:5 | LL | f3(|_: (), _: ()| {}); | ^^^--------------^^^^ @@ -52,7 +52,7 @@ LL | f3(|_: (), _: ()| {}); = note: expected closure signature `for<'a> fn(&(), &'a ()) -> _` found closure signature `fn((), ()) -> _` note: required by a bound in `f3` - --> $DIR/anonymous-higher-ranked-lifetime.rs:18:29 + --> $DIR/anonymous-higher-ranked-lifetime.rs:24:29 | LL | fn f3<'a, F>(_: F) where F: Fn(&'a (), &()) {} | ^^^^^^^^^^^^^^^ required by this bound in `f3` @@ -62,7 +62,7 @@ LL | f3(|_: &(), _: &()| {}); | + + error[E0631]: type mismatch in closure arguments - --> $DIR/anonymous-higher-ranked-lifetime.rs:5:5 + --> $DIR/anonymous-higher-ranked-lifetime.rs:11:5 | LL | f4(|_: (), _: ()| {}); | ^^^--------------^^^^ @@ -73,7 +73,7 @@ LL | f4(|_: (), _: ()| {}); = note: expected closure signature `for<'a, 'r> fn(&'a (), &'r ()) -> _` found closure signature `fn((), ()) -> _` note: required by a bound in `f4` - --> $DIR/anonymous-higher-ranked-lifetime.rs:19:25 + --> $DIR/anonymous-higher-ranked-lifetime.rs:25:25 | LL | fn f4<F>(_: F) where F: for<'r> Fn(&(), &'r ()) {} | ^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `f4` @@ -83,7 +83,7 @@ LL | f4(|_: &(), _: &()| {}); | + + error[E0631]: type mismatch in closure arguments - --> $DIR/anonymous-higher-ranked-lifetime.rs:6:5 + --> $DIR/anonymous-higher-ranked-lifetime.rs:12:5 | LL | f5(|_: (), _: ()| {}); | ^^^--------------^^^^ @@ -94,7 +94,7 @@ LL | f5(|_: (), _: ()| {}); = note: expected closure signature `for<'r> fn(&'r (), &'r ()) -> _` found closure signature `fn((), ()) -> _` note: required by a bound in `f5` - --> $DIR/anonymous-higher-ranked-lifetime.rs:20:25 + --> $DIR/anonymous-higher-ranked-lifetime.rs:26:25 | LL | fn f5<F>(_: F) where F: for<'r> Fn(&'r (), &'r ()) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `f5` @@ -104,7 +104,7 @@ LL | f5(|_: &(), _: &()| {}); | + + error[E0631]: type mismatch in closure arguments - --> $DIR/anonymous-higher-ranked-lifetime.rs:7:5 + --> $DIR/anonymous-higher-ranked-lifetime.rs:13:5 | LL | g1(|_: (), _: ()| {}); | ^^^--------------^^^^ @@ -115,7 +115,7 @@ LL | g1(|_: (), _: ()| {}); = note: expected closure signature `for<'a> fn(&'a (), Box<(dyn for<'a> Fn(&'a ()) + 'static)>) -> _` found closure signature `fn((), ()) -> _` note: required by a bound in `g1` - --> $DIR/anonymous-higher-ranked-lifetime.rs:23:25 + --> $DIR/anonymous-higher-ranked-lifetime.rs:29:25 | LL | fn g1<F>(_: F) where F: Fn(&(), Box<dyn Fn(&())>) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `g1` @@ -125,7 +125,7 @@ LL | g1(|_: &(), _: ()| {}); | + error[E0631]: type mismatch in closure arguments - --> $DIR/anonymous-higher-ranked-lifetime.rs:8:5 + --> $DIR/anonymous-higher-ranked-lifetime.rs:14:5 | LL | g2(|_: (), _: ()| {}); | ^^^--------------^^^^ @@ -136,7 +136,7 @@ LL | g2(|_: (), _: ()| {}); = note: expected closure signature `for<'a> fn(&'a (), for<'a> fn(&'a ())) -> _` found closure signature `fn((), ()) -> _` note: required by a bound in `g2` - --> $DIR/anonymous-higher-ranked-lifetime.rs:24:25 + --> $DIR/anonymous-higher-ranked-lifetime.rs:30:25 | LL | fn g2<F>(_: F) where F: Fn(&(), fn(&())) {} | ^^^^^^^^^^^^^^^^ required by this bound in `g2` @@ -146,7 +146,7 @@ LL | g2(|_: &(), _: ()| {}); | + error[E0631]: type mismatch in closure arguments - --> $DIR/anonymous-higher-ranked-lifetime.rs:9:5 + --> $DIR/anonymous-higher-ranked-lifetime.rs:15:5 | LL | g3(|_: (), _: ()| {}); | ^^^--------------^^^^ @@ -157,7 +157,7 @@ LL | g3(|_: (), _: ()| {}); = note: expected closure signature `for<'s> fn(&'s (), Box<(dyn for<'a> Fn(&'a ()) + 'static)>) -> _` found closure signature `fn((), ()) -> _` note: required by a bound in `g3` - --> $DIR/anonymous-higher-ranked-lifetime.rs:25:25 + --> $DIR/anonymous-higher-ranked-lifetime.rs:31:25 | LL | fn g3<F>(_: F) where F: for<'s> Fn(&'s (), Box<dyn Fn(&())>) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `g3` @@ -167,7 +167,7 @@ LL | g3(|_: &(), _: ()| {}); | + error[E0631]: type mismatch in closure arguments - --> $DIR/anonymous-higher-ranked-lifetime.rs:10:5 + --> $DIR/anonymous-higher-ranked-lifetime.rs:16:5 | LL | g4(|_: (), _: ()| {}); | ^^^--------------^^^^ @@ -178,7 +178,7 @@ LL | g4(|_: (), _: ()| {}); = note: expected closure signature `for<'a> fn(&'a (), for<'r> fn(&'r ())) -> _` found closure signature `fn((), ()) -> _` note: required by a bound in `g4` - --> $DIR/anonymous-higher-ranked-lifetime.rs:26:25 + --> $DIR/anonymous-higher-ranked-lifetime.rs:32:25 | LL | fn g4<F>(_: F) where F: Fn(&(), for<'r> fn(&'r ())) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `g4` @@ -188,7 +188,7 @@ LL | g4(|_: &(), _: ()| {}); | + error[E0631]: type mismatch in closure arguments - --> $DIR/anonymous-higher-ranked-lifetime.rs:11:5 + --> $DIR/anonymous-higher-ranked-lifetime.rs:17:5 | LL | h1(|_: (), _: (), _: (), _: ()| {}); | ^^^----------------------------^^^^ @@ -199,7 +199,7 @@ LL | h1(|_: (), _: (), _: (), _: ()| {}); = note: expected closure signature `for<'a, 'b> fn(&'a (), Box<(dyn for<'a> Fn(&'a ()) + 'static)>, &'b (), for<'a, 'b> fn(&'a (), &'b ())) -> _` found closure signature `fn((), (), (), ()) -> _` note: required by a bound in `h1` - --> $DIR/anonymous-higher-ranked-lifetime.rs:29:25 + --> $DIR/anonymous-higher-ranked-lifetime.rs:35:25 | LL | fn h1<F>(_: F) where F: Fn(&(), Box<dyn Fn(&())>, &(), fn(&(), &())) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `h1` @@ -209,7 +209,7 @@ LL | h1(|_: &(), _: (), _: &(), _: ()| {}); | + + error[E0631]: type mismatch in closure arguments - --> $DIR/anonymous-higher-ranked-lifetime.rs:12:5 + --> $DIR/anonymous-higher-ranked-lifetime.rs:18:5 | LL | h2(|_: (), _: (), _: (), _: ()| {}); | ^^^----------------------------^^^^ @@ -220,7 +220,7 @@ LL | h2(|_: (), _: (), _: (), _: ()| {}); = note: expected closure signature `for<'a, 't0> fn(&'a (), Box<(dyn for<'a> Fn(&'a ()) + 'static)>, &'t0 (), for<'a, 'b> fn(&'a (), &'b ())) -> _` found closure signature `fn((), (), (), ()) -> _` note: required by a bound in `h2` - --> $DIR/anonymous-higher-ranked-lifetime.rs:30:25 + --> $DIR/anonymous-higher-ranked-lifetime.rs:36:25 | LL | fn h2<F>(_: F) where F: for<'t0> Fn(&(), Box<dyn Fn(&())>, &'t0 (), fn(&(), &())) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `h2` diff --git a/tests/ui/impl-trait/in-trait/sized-rpits-dont-need-pointer-like.rs b/tests/ui/impl-trait/in-trait/sized-rpits-dont-need-pointer-like.rs new file mode 100644 index 00000000000..80850a2639f --- /dev/null +++ b/tests/ui/impl-trait/in-trait/sized-rpits-dont-need-pointer-like.rs @@ -0,0 +1,13 @@ +//@ check-pass + +// Make sure that we don't enforce that an RPIT that has `where Self: Sized` is pointer-like. + +trait Foo { + fn foo() -> impl Sized where Self: Sized {} +} + +impl Foo for () {} + +fn main() { + let x: &dyn Foo = &(); +} diff --git a/tests/ui/impl-trait/normalize-tait-in-const.stderr b/tests/ui/impl-trait/normalize-tait-in-const.stderr index 1dd84f10ad8..0f79cefeaec 100644 --- a/tests/ui/impl-trait/normalize-tait-in-const.stderr +++ b/tests/ui/impl-trait/normalize-tait-in-const.stderr @@ -2,14 +2,19 @@ error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/normalize-tait-in-const.rs:26:35 | LL | const fn with_positive<F: for<'a> ~const Fn(&'a Alias<'a>) + ~const Destruct>(fun: F) { - | ^^^^^^ + | ^^^^^^ can't be applied to `Fn` + | +note: `Fn` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/ops/function.rs:LL:COL error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/normalize-tait-in-const.rs:26:35 | LL | const fn with_positive<F: for<'a> ~const Fn(&'a Alias<'a>) + ~const Destruct>(fun: F) { - | ^^^^^^ + | ^^^^^^ can't be applied to `Fn` | +note: `Fn` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/ops/function.rs:LL:COL = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error[E0277]: the trait bound `for<'a, 'b> fn(&'a foo::Alias<'b>) {foo}: const Destruct` is not satisfied diff --git a/tests/ui/impl-trait/precise-capturing/overcaptures-2024.fixed b/tests/ui/impl-trait/precise-capturing/overcaptures-2024.fixed index 1eb88c71d54..ef8dd055a8a 100644 --- a/tests/ui/impl-trait/precise-capturing/overcaptures-2024.fixed +++ b/tests/ui/impl-trait/precise-capturing/overcaptures-2024.fixed @@ -42,4 +42,8 @@ async fn async_fn<'a>(x: &'a ()) -> impl Sized + use<> {} //~^ ERROR `impl Sized` will capture more lifetimes than possibly intended in edition 2024 //~| WARN this changes meaning in Rust 2024 +pub fn parens(x: &i32) -> &(impl Clone + use<>) { x } +//~^ ERROR `impl Clone` will capture more lifetimes than possibly intended in edition 2024 +//~| WARN this changes meaning in Rust 2024 + fn main() {} diff --git a/tests/ui/impl-trait/precise-capturing/overcaptures-2024.rs b/tests/ui/impl-trait/precise-capturing/overcaptures-2024.rs index 6f1ef6a472f..ce1cfe1246f 100644 --- a/tests/ui/impl-trait/precise-capturing/overcaptures-2024.rs +++ b/tests/ui/impl-trait/precise-capturing/overcaptures-2024.rs @@ -42,4 +42,8 @@ async fn async_fn<'a>(x: &'a ()) -> impl Sized {} //~^ ERROR `impl Sized` will capture more lifetimes than possibly intended in edition 2024 //~| WARN this changes meaning in Rust 2024 +pub fn parens(x: &i32) -> &impl Clone { x } +//~^ ERROR `impl Clone` will capture more lifetimes than possibly intended in edition 2024 +//~| WARN this changes meaning in Rust 2024 + fn main() {} diff --git a/tests/ui/impl-trait/precise-capturing/overcaptures-2024.stderr b/tests/ui/impl-trait/precise-capturing/overcaptures-2024.stderr index 63c87cd46c8..965f8e7b672 100644 --- a/tests/ui/impl-trait/precise-capturing/overcaptures-2024.stderr +++ b/tests/ui/impl-trait/precise-capturing/overcaptures-2024.stderr @@ -146,5 +146,24 @@ help: use the precise capturing `use<...>` syntax to make the captures explicit LL | async fn async_fn<'a>(x: &'a ()) -> impl Sized + use<> {} | +++++++ -error: aborting due to 7 previous errors +error: `impl Clone` will capture more lifetimes than possibly intended in edition 2024 + --> $DIR/overcaptures-2024.rs:45:28 + | +LL | pub fn parens(x: &i32) -> &impl Clone { x } + | ^^^^^^^^^^ + | + = warning: this changes meaning in Rust 2024 + = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/rpit-lifetime-capture.html> +note: specifically, this lifetime is in scope but not mentioned in the type's bounds + --> $DIR/overcaptures-2024.rs:45:18 + | +LL | pub fn parens(x: &i32) -> &impl Clone { x } + | ^ + = note: all lifetimes in scope will be captured by `impl Trait`s in edition 2024 +help: use the precise capturing `use<...>` syntax to make the captures explicit + | +LL | pub fn parens(x: &i32) -> &(impl Clone + use<>) { x } + | + ++++++++ + +error: aborting due to 8 previous errors diff --git a/tests/ui/issues/auxiliary/issue-111011.rs b/tests/ui/issues/auxiliary/issue-111011.rs index 7130234f41e..0c1a8ce1cf6 100644 --- a/tests/ui/issues/auxiliary/issue-111011.rs +++ b/tests/ui/issues/auxiliary/issue-111011.rs @@ -1,5 +1,3 @@ -#![feature(async_closure)] - //@ edition:2021 fn foo<X>(x: impl FnOnce() -> Box<X>) {} diff --git a/tests/ui/issues/issue-56806.stderr b/tests/ui/issues/issue-56806.stderr index ec50d863758..4b0a59fe12d 100644 --- a/tests/ui/issues/issue-56806.stderr +++ b/tests/ui/issues/issue-56806.stderr @@ -4,8 +4,8 @@ error[E0307]: invalid `self` parameter type: `Box<(dyn Trait + 'static)>` LL | fn dyn_instead_of_self(self: Box<dyn Trait>); | ^^^^^^^^^^^^^^ | - = note: type of `self` must be `Self` or a type that dereferences to it - = help: consider changing to `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`) + = note: type of `self` must be `Self` or some type implementing `Receiver` + = help: consider changing to `self`, `&self`, `&mut self`, or a type implementing `Receiver` such as `self: Box<Self>`, `self: Rc<Self>`, or `self: Arc<Self>` error: aborting due to 1 previous error diff --git a/tests/ui/layout/base-layout-is-sized-ice-123078.stderr b/tests/ui/layout/base-layout-is-sized-ice-123078.stderr index ee7f5162552..455bd2cbf8b 100644 --- a/tests/ui/layout/base-layout-is-sized-ice-123078.stderr +++ b/tests/ui/layout/base-layout-is-sized-ice-123078.stderr @@ -25,12 +25,6 @@ LL | const C: S = unsafe { std::mem::transmute(()) }; = note: source type: `()` (0 bits) = note: target type: `S` (size can vary because of [u8]) -note: erroneous constant encountered - --> $DIR/base-layout-is-sized-ice-123078.rs:13:5 - | -LL | C; - | ^ - error: aborting due to 2 previous errors Some errors have detailed explanations: E0277, E0512. diff --git a/tests/ui/layout/post-mono-layout-cycle-2.rs b/tests/ui/layout/post-mono-layout-cycle-2.rs index 2159dee7463..2daac12d7ac 100644 --- a/tests/ui/layout/post-mono-layout-cycle-2.rs +++ b/tests/ui/layout/post-mono-layout-cycle-2.rs @@ -1,8 +1,6 @@ //@ build-fail //@ edition: 2021 -#![feature(async_closure)] - use std::future::Future; use std::pin::pin; use std::task::*; diff --git a/tests/ui/layout/post-mono-layout-cycle-2.stderr b/tests/ui/layout/post-mono-layout-cycle-2.stderr index 2e8d237844e..d8c51deffe3 100644 --- a/tests/ui/layout/post-mono-layout-cycle-2.stderr +++ b/tests/ui/layout/post-mono-layout-cycle-2.stderr @@ -1,5 +1,5 @@ error[E0733]: recursion in an async fn requires boxing - --> $DIR/post-mono-layout-cycle-2.rs:30:5 + --> $DIR/post-mono-layout-cycle-2.rs:28:5 | LL | / async fn iter<T>(&mut self, iterator: T) LL | | @@ -13,7 +13,7 @@ LL | Blah::iter(self, iterator).await = note: a recursive `async fn` call must introduce indirection such as `Box::pin` to avoid an infinitely sized future note: the above error was encountered while instantiating `fn Wrap::<()>::ice` - --> $DIR/post-mono-layout-cycle-2.rs:56:9 + --> $DIR/post-mono-layout-cycle-2.rs:54:9 | LL | t.ice(); | ^^^^^^^ diff --git a/tests/ui/lifetimes/could-not-resolve-issue-121503.stderr b/tests/ui/lifetimes/could-not-resolve-issue-121503.stderr index 3babf63347c..46804642af8 100644 --- a/tests/ui/lifetimes/could-not-resolve-issue-121503.stderr +++ b/tests/ui/lifetimes/could-not-resolve-issue-121503.stderr @@ -7,7 +7,7 @@ LL | async fn box_ref_Struct(self: Box<Self, impl FnMut(&mut Self)>) -> &u32 = note: see issue #44874 <https://github.com/rust-lang/rust/issues/44874> for more information = help: add `#![feature(arbitrary_self_types)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - = help: consider changing to `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`) + = help: consider changing to `self`, `&self`, `&mut self`, or a type implementing `Receiver` such as `self: Box<Self>`, `self: Rc<Self>`, or `self: Arc<Self>` error: aborting due to 1 previous error diff --git a/tests/ui/lint/unused/lint-unused-mut-variables.rs b/tests/ui/lint/unused/lint-unused-mut-variables.rs index bc38af9867c..0467e87ce22 100644 --- a/tests/ui/lint/unused/lint-unused-mut-variables.rs +++ b/tests/ui/lint/unused/lint-unused-mut-variables.rs @@ -3,7 +3,6 @@ // Exercise the unused_mut attribute in some positive and negative cases #![warn(unused_mut)] -#![feature(async_closure)] async fn baz_async( mut a: i32, diff --git a/tests/ui/lint/unused/lint-unused-mut-variables.stderr b/tests/ui/lint/unused/lint-unused-mut-variables.stderr index dcda1e5306f..a16b6a378e9 100644 --- a/tests/ui/lint/unused/lint-unused-mut-variables.stderr +++ b/tests/ui/lint/unused/lint-unused-mut-variables.stderr @@ -1,5 +1,5 @@ warning: variable does not need to be mutable - --> $DIR/lint-unused-mut-variables.rs:9:5 + --> $DIR/lint-unused-mut-variables.rs:8:5 | LL | mut a: i32, | ----^ @@ -13,7 +13,7 @@ LL | #![warn(unused_mut)] | ^^^^^^^^^^ warning: variable does not need to be mutable - --> $DIR/lint-unused-mut-variables.rs:23:9 + --> $DIR/lint-unused-mut-variables.rs:22:9 | LL | mut a: i32, | ----^ @@ -21,7 +21,7 @@ LL | mut a: i32, | help: remove this `mut` warning: variable does not need to be mutable - --> $DIR/lint-unused-mut-variables.rs:14:5 + --> $DIR/lint-unused-mut-variables.rs:13:5 | LL | mut a: i32, | ----^ @@ -29,7 +29,7 @@ LL | mut a: i32, | help: remove this `mut` warning: variable does not need to be mutable - --> $DIR/lint-unused-mut-variables.rs:29:9 + --> $DIR/lint-unused-mut-variables.rs:28:9 | LL | mut a: i32, | ----^ @@ -37,7 +37,7 @@ LL | mut a: i32, | help: remove this `mut` warning: variable does not need to be mutable - --> $DIR/lint-unused-mut-variables.rs:39:9 + --> $DIR/lint-unused-mut-variables.rs:38:9 | LL | mut a: i32, | ----^ @@ -45,7 +45,7 @@ LL | mut a: i32, | help: remove this `mut` warning: variable does not need to be mutable - --> $DIR/lint-unused-mut-variables.rs:48:9 + --> $DIR/lint-unused-mut-variables.rs:47:9 | LL | mut a: i32, | ----^ @@ -53,7 +53,7 @@ LL | mut a: i32, | help: remove this `mut` warning: variable does not need to be mutable - --> $DIR/lint-unused-mut-variables.rs:57:9 + --> $DIR/lint-unused-mut-variables.rs:56:9 | LL | mut a: i32, | ----^ @@ -61,7 +61,7 @@ LL | mut a: i32, | help: remove this `mut` warning: variable does not need to be mutable - --> $DIR/lint-unused-mut-variables.rs:62:9 + --> $DIR/lint-unused-mut-variables.rs:61:9 | LL | mut a: i32, | ----^ @@ -69,7 +69,7 @@ LL | mut a: i32, | help: remove this `mut` warning: variable does not need to be mutable - --> $DIR/lint-unused-mut-variables.rs:107:14 + --> $DIR/lint-unused-mut-variables.rs:106:14 | LL | let x = |mut y: isize| 10; | ----^ @@ -77,7 +77,7 @@ LL | let x = |mut y: isize| 10; | help: remove this `mut` warning: variable does not need to be mutable - --> $DIR/lint-unused-mut-variables.rs:69:9 + --> $DIR/lint-unused-mut-variables.rs:68:9 | LL | let mut a = 3; | ----^ @@ -85,7 +85,7 @@ LL | let mut a = 3; | help: remove this `mut` warning: variable does not need to be mutable - --> $DIR/lint-unused-mut-variables.rs:71:9 + --> $DIR/lint-unused-mut-variables.rs:70:9 | LL | let mut a = 2; | ----^ @@ -93,7 +93,7 @@ LL | let mut a = 2; | help: remove this `mut` warning: variable does not need to be mutable - --> $DIR/lint-unused-mut-variables.rs:73:9 + --> $DIR/lint-unused-mut-variables.rs:72:9 | LL | let mut b = 3; | ----^ @@ -101,7 +101,7 @@ LL | let mut b = 3; | help: remove this `mut` warning: variable does not need to be mutable - --> $DIR/lint-unused-mut-variables.rs:75:9 + --> $DIR/lint-unused-mut-variables.rs:74:9 | LL | let mut a = vec![3]; | ----^ @@ -109,7 +109,7 @@ LL | let mut a = vec![3]; | help: remove this `mut` warning: variable does not need to be mutable - --> $DIR/lint-unused-mut-variables.rs:77:10 + --> $DIR/lint-unused-mut-variables.rs:76:10 | LL | let (mut a, b) = (1, 2); | ----^ @@ -117,7 +117,7 @@ LL | let (mut a, b) = (1, 2); | help: remove this `mut` warning: variable does not need to be mutable - --> $DIR/lint-unused-mut-variables.rs:79:9 + --> $DIR/lint-unused-mut-variables.rs:78:9 | LL | let mut a; | ----^ @@ -125,7 +125,7 @@ LL | let mut a; | help: remove this `mut` warning: variable does not need to be mutable - --> $DIR/lint-unused-mut-variables.rs:83:9 + --> $DIR/lint-unused-mut-variables.rs:82:9 | LL | let mut b; | ----^ @@ -133,7 +133,7 @@ LL | let mut b; | help: remove this `mut` warning: variable does not need to be mutable - --> $DIR/lint-unused-mut-variables.rs:92:9 + --> $DIR/lint-unused-mut-variables.rs:91:9 | LL | mut x => {} | ----^ @@ -141,7 +141,7 @@ LL | mut x => {} | help: remove this `mut` warning: variable does not need to be mutable - --> $DIR/lint-unused-mut-variables.rs:99:10 + --> $DIR/lint-unused-mut-variables.rs:98:10 | LL | (mut x, 1) | | ----^ @@ -149,7 +149,7 @@ LL | (mut x, 1) | | help: remove this `mut` warning: variable does not need to be mutable - --> $DIR/lint-unused-mut-variables.rs:112:9 + --> $DIR/lint-unused-mut-variables.rs:111:9 | LL | let mut a = &mut 5; | ----^ @@ -157,7 +157,7 @@ LL | let mut a = &mut 5; | help: remove this `mut` warning: variable does not need to be mutable - --> $DIR/lint-unused-mut-variables.rs:117:9 + --> $DIR/lint-unused-mut-variables.rs:116:9 | LL | let mut b = (&mut a,); | ----^ @@ -165,7 +165,7 @@ LL | let mut b = (&mut a,); | help: remove this `mut` warning: variable does not need to be mutable - --> $DIR/lint-unused-mut-variables.rs:120:9 + --> $DIR/lint-unused-mut-variables.rs:119:9 | LL | let mut x = &mut 1; | ----^ @@ -173,7 +173,7 @@ LL | let mut x = &mut 1; | help: remove this `mut` warning: variable does not need to be mutable - --> $DIR/lint-unused-mut-variables.rs:132:9 + --> $DIR/lint-unused-mut-variables.rs:131:9 | LL | let mut v : &mut Vec<()> = &mut vec![]; | ----^ @@ -181,7 +181,7 @@ LL | let mut v : &mut Vec<()> = &mut vec![]; | help: remove this `mut` warning: variable does not need to be mutable - --> $DIR/lint-unused-mut-variables.rs:187:9 + --> $DIR/lint-unused-mut-variables.rs:186:9 | LL | let mut raw_address_of_const = 1; | ----^^^^^^^^^^^^^^^^^^^^ @@ -189,7 +189,7 @@ LL | let mut raw_address_of_const = 1; | help: remove this `mut` warning: variable does not need to be mutable - --> $DIR/lint-unused-mut-variables.rs:109:13 + --> $DIR/lint-unused-mut-variables.rs:108:13 | LL | fn what(mut foo: isize) {} | ----^^^ @@ -197,7 +197,7 @@ LL | fn what(mut foo: isize) {} | help: remove this `mut` warning: variable does not need to be mutable - --> $DIR/lint-unused-mut-variables.rs:127:20 + --> $DIR/lint-unused-mut-variables.rs:126:20 | LL | fn mut_ref_arg(mut arg : &mut [u8]) -> &mut [u8] { | ----^^^ @@ -205,7 +205,7 @@ LL | fn mut_ref_arg(mut arg : &mut [u8]) -> &mut [u8] { | help: remove this `mut` error: variable does not need to be mutable - --> $DIR/lint-unused-mut-variables.rs:205:9 + --> $DIR/lint-unused-mut-variables.rs:204:9 | LL | let mut b = vec![2]; | ----^ @@ -213,13 +213,13 @@ LL | let mut b = vec![2]; | help: remove this `mut` | note: the lint level is defined here - --> $DIR/lint-unused-mut-variables.rs:201:8 + --> $DIR/lint-unused-mut-variables.rs:200:8 | LL | #[deny(unused_mut)] | ^^^^^^^^^^ warning: variable does not need to be mutable - --> $DIR/lint-unused-mut-variables.rs:212:28 + --> $DIR/lint-unused-mut-variables.rs:211:28 | LL | fn write_through_reference(mut arg: &mut Arg) { | ----^^^ diff --git a/tests/ui/lint/unused/lint-unused-variables.rs b/tests/ui/lint/unused/lint-unused-variables.rs index 84c26c334f0..e0035d6d725 100644 --- a/tests/ui/lint/unused/lint-unused-variables.rs +++ b/tests/ui/lint/unused/lint-unused-variables.rs @@ -1,7 +1,6 @@ //@ compile-flags: --cfg something //@ edition:2018 -#![feature(async_closure)] #![deny(unused_variables)] async fn foo_async( diff --git a/tests/ui/lint/unused/lint-unused-variables.stderr b/tests/ui/lint/unused/lint-unused-variables.stderr index ef590d85aef..6106d4cd1bf 100644 --- a/tests/ui/lint/unused/lint-unused-variables.stderr +++ b/tests/ui/lint/unused/lint-unused-variables.stderr @@ -1,71 +1,71 @@ error: unused variable: `a` - --> $DIR/lint-unused-variables.rs:8:5 + --> $DIR/lint-unused-variables.rs:7:5 | LL | a: i32, | ^ help: if this is intentional, prefix it with an underscore: `_a` | note: the lint level is defined here - --> $DIR/lint-unused-variables.rs:5:9 + --> $DIR/lint-unused-variables.rs:4:9 | LL | #![deny(unused_variables)] | ^^^^^^^^^^^^^^^^ error: unused variable: `a` - --> $DIR/lint-unused-variables.rs:22:9 + --> $DIR/lint-unused-variables.rs:21:9 | LL | a: i32, | ^ help: if this is intentional, prefix it with an underscore: `_a` error: unused variable: `a` - --> $DIR/lint-unused-variables.rs:68:9 + --> $DIR/lint-unused-variables.rs:67:9 | LL | a: i32, | ^ help: if this is intentional, prefix it with an underscore: `_a` error: unused variable: `b` - --> $DIR/lint-unused-variables.rs:14:5 + --> $DIR/lint-unused-variables.rs:13:5 | LL | b: i32, | ^ help: if this is intentional, prefix it with an underscore: `_b` error: unused variable: `b` - --> $DIR/lint-unused-variables.rs:29:9 + --> $DIR/lint-unused-variables.rs:28:9 | LL | b: i32, | ^ help: if this is intentional, prefix it with an underscore: `_b` error: unused variable: `b` - --> $DIR/lint-unused-variables.rs:34:9 + --> $DIR/lint-unused-variables.rs:33:9 | LL | b: i32, | ^ help: if this is intentional, prefix it with an underscore: `_b` error: unused variable: `b` - --> $DIR/lint-unused-variables.rs:42:9 + --> $DIR/lint-unused-variables.rs:41:9 | LL | b: i32, | ^ help: if this is intentional, prefix it with an underscore: `_b` error: unused variable: `b` - --> $DIR/lint-unused-variables.rs:47:9 + --> $DIR/lint-unused-variables.rs:46:9 | LL | b: i32, | ^ help: if this is intentional, prefix it with an underscore: `_b` error: unused variable: `b` - --> $DIR/lint-unused-variables.rs:55:9 + --> $DIR/lint-unused-variables.rs:54:9 | LL | b: i32, | ^ help: if this is intentional, prefix it with an underscore: `_b` error: unused variable: `b` - --> $DIR/lint-unused-variables.rs:60:9 + --> $DIR/lint-unused-variables.rs:59:9 | LL | b: i32, | ^ help: if this is intentional, prefix it with an underscore: `_b` error: unused variable: `b` - --> $DIR/lint-unused-variables.rs:74:9 + --> $DIR/lint-unused-variables.rs:73:9 | LL | b: i32, | ^ help: if this is intentional, prefix it with an underscore: `_b` diff --git a/tests/ui/lint/unused/unused-closure.rs b/tests/ui/lint/unused/unused-closure.rs index 4633038cc9b..1f98cdfb21f 100644 --- a/tests/ui/lint/unused/unused-closure.rs +++ b/tests/ui/lint/unused/unused-closure.rs @@ -1,7 +1,6 @@ // Test that closures and coroutines are "must use" types. //@ edition:2018 -#![feature(async_closure)] #![feature(coroutines, stmt_expr_attributes)] #![deny(unused_must_use)] diff --git a/tests/ui/lint/unused/unused-closure.stderr b/tests/ui/lint/unused/unused-closure.stderr index c3a82402e0a..bc0e5173c33 100644 --- a/tests/ui/lint/unused/unused-closure.stderr +++ b/tests/ui/lint/unused/unused-closure.stderr @@ -1,5 +1,5 @@ error: unused closure that must be used - --> $DIR/unused-closure.rs:9:5 + --> $DIR/unused-closure.rs:8:5 | LL | / || { LL | | println!("Hello!"); @@ -8,13 +8,13 @@ LL | | }; | = note: closures are lazy and do nothing unless called note: the lint level is defined here - --> $DIR/unused-closure.rs:6:9 + --> $DIR/unused-closure.rs:5:9 | LL | #![deny(unused_must_use)] | ^^^^^^^^^^^^^^^ error: unused implementer of `Future` that must be used - --> $DIR/unused-closure.rs:13:5 + --> $DIR/unused-closure.rs:12:5 | LL | async {}; | ^^^^^^^^ @@ -22,7 +22,7 @@ LL | async {}; = note: futures do nothing unless you `.await` or poll them error: unused closure that must be used - --> $DIR/unused-closure.rs:14:5 + --> $DIR/unused-closure.rs:13:5 | LL | || async {}; | ^^^^^^^^^^^ @@ -30,7 +30,7 @@ LL | || async {}; = note: closures are lazy and do nothing unless called error: unused closure that must be used - --> $DIR/unused-closure.rs:15:5 + --> $DIR/unused-closure.rs:14:5 | LL | async || {}; | ^^^^^^^^^^^ @@ -38,7 +38,7 @@ LL | async || {}; = note: closures are lazy and do nothing unless called error: unused array of boxed arrays of closures that must be used - --> $DIR/unused-closure.rs:18:5 + --> $DIR/unused-closure.rs:17:5 | LL | [Box::new([|| {}; 10]); 1]; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -46,7 +46,7 @@ LL | [Box::new([|| {}; 10]); 1]; = note: closures are lazy and do nothing unless called error: unused closure that must be used - --> $DIR/unused-closure.rs:20:5 + --> $DIR/unused-closure.rs:19:5 | LL | vec![|| "a"].pop().unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -54,7 +54,7 @@ LL | vec![|| "a"].pop().unwrap(); = note: closures are lazy and do nothing unless called error: unused closure that must be used - --> $DIR/unused-closure.rs:23:9 + --> $DIR/unused-closure.rs:22:9 | LL | || true; | ^^^^^^^ diff --git a/tests/ui/macros/stringify.rs b/tests/ui/macros/stringify.rs index f405cd253de..a560bf4c6ef 100644 --- a/tests/ui/macros/stringify.rs +++ b/tests/ui/macros/stringify.rs @@ -3,7 +3,6 @@ //@ compile-flags: --test #![allow(incomplete_features)] -#![feature(async_closure)] #![feature(auto_traits)] #![feature(box_patterns)] #![feature(const_trait_impl)] diff --git a/tests/ui/methods/call_method_unknown_referent.rs b/tests/ui/methods/call_method_unknown_referent.rs new file mode 100644 index 00000000000..b01e2d80f7f --- /dev/null +++ b/tests/ui/methods/call_method_unknown_referent.rs @@ -0,0 +1,48 @@ +//@ edition: 2018 + +#![feature(arbitrary_self_types)] + +// tests that the referent type of a reference must be known to call methods on it + +struct SmartPtr<T>(T); + +impl<T> core::ops::Receiver for SmartPtr<T> { + type Target = T; +} + +impl<T> SmartPtr<T> { + fn foo(&self) {} +} + +fn main() { + let val = 1_u32; + let ptr = &val; + let _a: i32 = (ptr as &_).read(); + //~^ ERROR type annotations needed + + // Same again, but with a smart pointer type + let val2 = 1_u32; + let rc = std::rc::Rc::new(val2); + let _b = (rc as std::rc::Rc<_>).read(); + //~^ ERROR type annotations needed + + // Same again, but with a smart pointer type + let ptr = SmartPtr(val); + + // We can call unambiguous outer-type methods on this + (ptr as SmartPtr<_>).foo(); + // ... but we can't follow the Receiver chain to the inner type + // because we end up with _. + + // Because SmartPtr implements Receiver, it's arguable which of the + // following two diagnostics we'd want in this case: + // (a) "type annotations needed" (because the inner type is _) + // (b) "no method named `read` found for struct `SmartPtr`" + // (ignoring the fact that there might have been methods on the + // inner type, had it not been _) + // At present we produce error type (b), which is necessary because + // our resolution logic needs to be able to call methods such as foo() + // on the outer type even if the inner type is ambiguous. + let _c = (ptr as SmartPtr<_>).read(); + //~^ ERROR no method named `read` found for struct `SmartPtr` +} diff --git a/tests/ui/methods/call_method_unknown_referent.stderr b/tests/ui/methods/call_method_unknown_referent.stderr new file mode 100644 index 00000000000..748b02b52b5 --- /dev/null +++ b/tests/ui/methods/call_method_unknown_referent.stderr @@ -0,0 +1,29 @@ +error[E0282]: type annotations needed + --> $DIR/call_method_unknown_referent.rs:20:31 + | +LL | let _a: i32 = (ptr as &_).read(); + | ^^^^ cannot infer type + +error[E0282]: type annotations needed + --> $DIR/call_method_unknown_referent.rs:26:37 + | +LL | let _b = (rc as std::rc::Rc<_>).read(); + | ^^^^ cannot infer type + +error[E0599]: no method named `read` found for struct `SmartPtr` in the current scope + --> $DIR/call_method_unknown_referent.rs:46:35 + | +LL | struct SmartPtr<T>(T); + | ------------------ method `read` not found for this struct +... +LL | let _c = (ptr as SmartPtr<_>).read(); + | ^^^^ method not found in `SmartPtr<_>` + | + = help: items from traits can only be used if the trait is implemented and in scope + = note: the following trait defines an item `read`, perhaps you need to implement it: + candidate #1: `std::io::Read` + +error: aborting due to 3 previous errors + +Some errors have detailed explanations: E0282, E0599. +For more information about an error, try `rustc --explain E0282`. diff --git a/tests/ui/methods/call_method_unknown_referent2.rs b/tests/ui/methods/call_method_unknown_referent2.rs new file mode 100644 index 00000000000..b1615bd8d44 --- /dev/null +++ b/tests/ui/methods/call_method_unknown_referent2.rs @@ -0,0 +1,24 @@ +//@ edition: 2018 +//@ run-pass + +#![feature(arbitrary_self_types)] + +// tests that the referent type of a reference must be known to call methods on it + +struct SmartPtr<T>(T); + +impl<T> core::ops::Receiver for SmartPtr<T> { + type Target = T; +} + +impl<T> SmartPtr<T> { + fn foo(&self) -> usize { 3 } +} + +fn main() { + let val = 1_u32; + let ptr = SmartPtr(val); + // Ensure calls to outer methods work even if inner methods can't be + // resolved due to the type variable + assert_eq!((ptr as SmartPtr<_>).foo(), 3); +} diff --git a/tests/ui/mir/issue-68841.rs b/tests/ui/mir/issue-68841.rs index 5638449b684..0eed46eb6ca 100644 --- a/tests/ui/mir/issue-68841.rs +++ b/tests/ui/mir/issue-68841.rs @@ -2,8 +2,6 @@ //@ edition:2018 //@ build-pass -#![feature(async_closure)] - use std::future::Future; fn async_closure() -> impl Future<Output = u8> { diff --git a/tests/ui/never_type/fallback-closure-ret.nofallback.stderr b/tests/ui/never_type/fallback-closure-ret.nofallback.stderr index b5b5d87e7dd..8d08fb7f2a8 100644 --- a/tests/ui/never_type/fallback-closure-ret.nofallback.stderr +++ b/tests/ui/never_type/fallback-closure-ret.nofallback.stderr @@ -15,8 +15,8 @@ LL | foo(|| panic!()); = note: `#[warn(dependency_on_unit_never_type_fallback)]` on by default help: use `()` annotations to avoid fallback changes | -LL | foo::<(), _>(|| panic!()); - | +++++++++ +LL | foo::<()>(|| panic!()); + | ++++++ warning: 1 warning emitted diff --git a/tests/ui/never_type/never-in-range-pat.rs b/tests/ui/never_type/never-in-range-pat.rs new file mode 100644 index 00000000000..ae2d76c172e --- /dev/null +++ b/tests/ui/never_type/never-in-range-pat.rs @@ -0,0 +1,16 @@ +// Regression test for <https://github.com/rust-lang/rust/issues/133947>. + +// Make sure we don't ICE when there's `!` in a range pattern. +// +// This shouldn't be allowed anyways, but we only deny it during MIR +// building, so make sure we handle it semi-gracefully during typeck. + +#![feature(never_type)] + +fn main() { + let x: !; + match 1 { + 0..x => {} + //~^ ERROR only `char` and numeric types are allowed in range patterns + } +} diff --git a/tests/ui/never_type/never-in-range-pat.stderr b/tests/ui/never_type/never-in-range-pat.stderr new file mode 100644 index 00000000000..c78be5350e0 --- /dev/null +++ b/tests/ui/never_type/never-in-range-pat.stderr @@ -0,0 +1,11 @@ +error[E0029]: only `char` and numeric types are allowed in range patterns + --> $DIR/never-in-range-pat.rs:13:12 + | +LL | 0..x => {} + | - ^ this is of type `!` but it should be `char` or numeric + | | + | this is of type `{integer}` + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0029`. diff --git a/tests/ui/parser/as-precedence.rs b/tests/ui/parser/as-precedence.rs new file mode 100644 index 00000000000..ca8328adb0e --- /dev/null +++ b/tests/ui/parser/as-precedence.rs @@ -0,0 +1,18 @@ +//! Parser precedence test to help with [RFC 87 "Trait Bounds with Plus"][rfc-87], to check the +//! precedence of the `as` operator in relation to some arithmetic bin-ops and parentheses. +//! +//! Editor's note: this test seems quite incomplete compared to what's possible nowadays. Maybe +//! there's another set of tests whose coverage overshadows this test? +//! +//! [rfc-87]: https://rust-lang.github.io/rfcs/0087-trait-bounds-with-plus.html + +//@ run-pass + +#[allow(unused_parens)] +fn main() { + assert_eq!(3 as usize * 3, 9); + assert_eq!(3 as (usize) * 3, 9); + assert_eq!(3 as (usize) / 3, 1); + assert_eq!(3 as usize + 3, 6); + assert_eq!(3 as (usize) + 3, 6); +} diff --git a/tests/ui/parser/bad-name.stderr b/tests/ui/parser/bad-name.stderr index a336923f4fd..112fdcad336 100644 --- a/tests/ui/parser/bad-name.stderr +++ b/tests/ui/parser/bad-name.stderr @@ -1,9 +1,3 @@ -error: field expressions cannot have generic arguments - --> $DIR/bad-name.rs:2:12 - | -LL | let x.y::<isize>.z foo; - | ^^^^^^^ - error: expected a pattern, found an expression --> $DIR/bad-name.rs:2:7 | @@ -18,5 +12,11 @@ error: expected one of `(`, `.`, `::`, `:`, `;`, `=`, `?`, `|`, or an operator, LL | let x.y::<isize>.z foo; | ^^^ expected one of 9 possible tokens +error: field expressions cannot have generic arguments + --> $DIR/bad-name.rs:2:12 + | +LL | let x.y::<isize>.z foo; + | ^^^^^^^ + error: aborting due to 3 previous errors diff --git a/tests/ui/parser/circular_modules_main.stderr b/tests/ui/parser/circular_modules_main.stderr index 2de70789358..e1780fe9fd9 100644 --- a/tests/ui/parser/circular_modules_main.stderr +++ b/tests/ui/parser/circular_modules_main.stderr @@ -4,22 +4,5 @@ error: circular modules: $DIR/circular_modules_main.rs -> $DIR/circular_modules_ LL | mod circular_modules_main; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ -error[E0425]: cannot find function `hi_str` in module `circular_modules_main` - --> $DIR/circular_modules_hello.rs:7:43 - | -LL | println!("{}", circular_modules_main::hi_str()); - | ^^^^^^ not found in `circular_modules_main` - | -help: consider importing this function - | -LL + use hi_str; - | -help: if you import `hi_str`, refer to it directly - | -LL - println!("{}", circular_modules_main::hi_str()); -LL + println!("{}", hi_str()); - | - -error: aborting due to 2 previous errors +error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0425`. diff --git a/tests/ui/reachable/artificial-block.rs b/tests/ui/reachable/artificial-block.rs new file mode 100644 index 00000000000..6d73ba1a972 --- /dev/null +++ b/tests/ui/reachable/artificial-block.rs @@ -0,0 +1,30 @@ +//! Check that we don't get compile errors on unreachable code after the `{ return 3; }` artificial +//! block below. This test is run-pass to also exercise the codegen, but it might be possible to +//! reduce to build-pass or even check-pass. +//! +//! This test was introduced as part of commit `a833f152baa17460e8414355e832d30d5161f8e8` which +//! removes an "artificial block". See also commit `3d738e9e0634a4cd6239d1317bd7dad53be68dc8` for +//! more elaboration, reproduced below (this is outdated for *today*'s rustc as of 2024-12-10, but +//! is helpful to understand the original intention): +//! +//! > Return a fresh, unreachable context after ret, break, and cont +//! > +//! > This ensures we don't get compile errors on unreachable code (see +//! > test/run-pass/artificial-block.rs for an example of sane code that wasn't compiling). In the +//! > future, we might want to warn about non-trivial code appearing in an unreachable context, +//! > and/or avoid generating unreachable code altogether (though I'm sure LLVM will weed it out as +//! > well). +//! +//! Since then, `ret` became `return`, `int` became `isize` and `assert` became a macro. + +//@ run-pass + +fn f() -> isize { + { + return 3; + } +} + +fn main() { + assert_eq!(f(), 3); +} diff --git a/tests/ui/resolve/generic-params-from-outer-item-in-const-item.default.stderr b/tests/ui/resolve/generic-params-from-outer-item-in-const-item.default.stderr index c7e9df10d41..fbb9ede8aa1 100644 --- a/tests/ui/resolve/generic-params-from-outer-item-in-const-item.default.stderr +++ b/tests/ui/resolve/generic-params-from-outer-item-in-const-item.default.stderr @@ -29,20 +29,6 @@ LL | const _: u32 = T::C; | = note: a `const` is a separate item from the item that contains it -note: erroneous constant encountered - --> $DIR/generic-params-from-outer-item-in-const-item.rs:22:9 - | -LL | I - | ^ - -note: erroneous constant encountered - --> $DIR/generic-params-from-outer-item-in-const-item.rs:22:9 - | -LL | I - | ^ - | - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0401`. diff --git a/tests/ui/resolve/generic-params-from-outer-item-in-const-item.generic_const_items.stderr b/tests/ui/resolve/generic-params-from-outer-item-in-const-item.generic_const_items.stderr index 64c436d3ceb..60aa94038c3 100644 --- a/tests/ui/resolve/generic-params-from-outer-item-in-const-item.generic_const_items.stderr +++ b/tests/ui/resolve/generic-params-from-outer-item-in-const-item.generic_const_items.stderr @@ -35,20 +35,6 @@ LL | const _: u32 = T::C; | = note: a `const` is a separate item from the item that contains it -note: erroneous constant encountered - --> $DIR/generic-params-from-outer-item-in-const-item.rs:22:9 - | -LL | I - | ^ - -note: erroneous constant encountered - --> $DIR/generic-params-from-outer-item-in-const-item.rs:22:9 - | -LL | I - | ^ - | - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0401`. diff --git a/tests/ui/resolve/issue-50599.stderr b/tests/ui/resolve/issue-50599.stderr index 427dc9f2049..24fb3d580b8 100644 --- a/tests/ui/resolve/issue-50599.stderr +++ b/tests/ui/resolve/issue-50599.stderr @@ -20,12 +20,6 @@ LL - const M: usize = (f64::from(N) * std::f64::LOG10_2) as usize; LL + const M: usize = (f64::from(N) * LOG10_2) as usize; | -note: erroneous constant encountered - --> $DIR/issue-50599.rs:4:29 - | -LL | let mut digits = [0u32; M]; - | ^ - error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0425`. diff --git a/tests/ui/resolve/parse-error-resolve.rs b/tests/ui/resolve/parse-error-resolve.rs new file mode 100644 index 00000000000..1e0772648af --- /dev/null +++ b/tests/ui/resolve/parse-error-resolve.rs @@ -0,0 +1,7 @@ +mod parse_error; +use parse_error::Canonical; // ok, `parse_error.rs` had parse errors + +fn main() { + let _ = "" + 1; //~ ERROR E0369 + parse_error::Canonical.foo(); // ok, `parse_error.rs` had parse errors +} diff --git a/tests/ui/resolve/parse-error-resolve.stderr b/tests/ui/resolve/parse-error-resolve.stderr new file mode 100644 index 00000000000..30475aa0ee6 --- /dev/null +++ b/tests/ui/resolve/parse-error-resolve.stderr @@ -0,0 +1,22 @@ +error: expected one of `+`, `,`, `::`, `=`, or `>`, found `From` + --> $DIR/parse_error.rs:2:46 + | +LL | impl<S: Into<std::borrow::Cow<'static, str>> From<S> for Canonical { + | ^^^^ expected one of `+`, `,`, `::`, `=`, or `>` + | +help: you might have meant to end the type parameters here + | +LL | impl<S: Into<std::borrow::Cow<'static, str>>> From<S> for Canonical { + | + + +error[E0369]: cannot add `{integer}` to `&str` + --> $DIR/parse-error-resolve.rs:5:16 + | +LL | let _ = "" + 1; + | -- ^ - {integer} + | | + | &str + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0369`. diff --git a/tests/ui/resolve/parse_error.rs b/tests/ui/resolve/parse_error.rs new file mode 100644 index 00000000000..4cd025e1edf --- /dev/null +++ b/tests/ui/resolve/parse_error.rs @@ -0,0 +1,5 @@ +struct Canonical; +impl<S: Into<std::borrow::Cow<'static, str>> From<S> for Canonical { //~ ERROR expected + fn foo() {} +} +fn bar() {} diff --git a/tests/ui/resolve/parse_error.stderr b/tests/ui/resolve/parse_error.stderr new file mode 100644 index 00000000000..f764f08875f --- /dev/null +++ b/tests/ui/resolve/parse_error.stderr @@ -0,0 +1,13 @@ +error: expected one of `+`, `,`, `::`, `=`, or `>`, found `From` + --> $DIR/parse_error.rs:2:46 + | +LL | impl<S: Into<std::borrow::Cow<'static, str>> From<S> for Canonical { + | ^^^^ expected one of `+`, `,`, `::`, `=`, or `>` + | +help: you might have meant to end the type parameters here + | +LL | impl<S: Into<std::borrow::Cow<'static, str>>> From<S> for Canonical { + | + + +error: aborting due to 1 previous error + diff --git a/tests/ui/rfcs/rfc-2497-if-let-chains/avoid-invalid-mir.stderr b/tests/ui/rfcs/rfc-2497-if-let-chains/avoid-invalid-mir.stderr index eab2604d4c0..606f808f093 100644 --- a/tests/ui/rfcs/rfc-2497-if-let-chains/avoid-invalid-mir.stderr +++ b/tests/ui/rfcs/rfc-2497-if-let-chains/avoid-invalid-mir.stderr @@ -6,11 +6,5 @@ LL | !let y = 42; | = note: only supported directly in conditions of `if` and `while` expressions -note: erroneous constant encountered - --> $DIR/avoid-invalid-mir.rs:11:13 - | -LL | x: [(); N] - | ^ - error: aborting due to 1 previous error diff --git a/tests/ui/rfcs/rfc-2565-param-attrs/param-attrs-cfg.rs b/tests/ui/rfcs/rfc-2565-param-attrs/param-attrs-cfg.rs index e7a5d59958b..15d2a2f5ebc 100644 --- a/tests/ui/rfcs/rfc-2565-param-attrs/param-attrs-cfg.rs +++ b/tests/ui/rfcs/rfc-2565-param-attrs/param-attrs-cfg.rs @@ -1,7 +1,6 @@ //@ compile-flags: --cfg something --check-cfg=cfg(nothing,something) //@ edition:2018 -#![feature(async_closure)] #![deny(unused_variables)] extern "C" { diff --git a/tests/ui/rfcs/rfc-2565-param-attrs/param-attrs-cfg.stderr b/tests/ui/rfcs/rfc-2565-param-attrs/param-attrs-cfg.stderr index 9b92166bcb7..ba92bc4a71d 100644 --- a/tests/ui/rfcs/rfc-2565-param-attrs/param-attrs-cfg.stderr +++ b/tests/ui/rfcs/rfc-2565-param-attrs/param-attrs-cfg.stderr @@ -1,119 +1,119 @@ error: unused variable: `a` - --> $DIR/param-attrs-cfg.rs:24:23 + --> $DIR/param-attrs-cfg.rs:23:23 | LL | #[cfg(something)] a: i32, | ^ help: if this is intentional, prefix it with an underscore: `_a` | note: the lint level is defined here - --> $DIR/param-attrs-cfg.rs:5:9 + --> $DIR/param-attrs-cfg.rs:4:9 | LL | #![deny(unused_variables)] | ^^^^^^^^^^^^^^^^ error: unused variable: `a` - --> $DIR/param-attrs-cfg.rs:41:27 + --> $DIR/param-attrs-cfg.rs:40:27 | LL | #[cfg(something)] a: i32, | ^ help: if this is intentional, prefix it with an underscore: `_a` error: unused variable: `a` - --> $DIR/param-attrs-cfg.rs:107:27 + --> $DIR/param-attrs-cfg.rs:106:27 | LL | #[cfg(something)] a: i32, | ^ help: if this is intentional, prefix it with an underscore: `_a` error: unused variable: `b` - --> $DIR/param-attrs-cfg.rs:30:23 + --> $DIR/param-attrs-cfg.rs:29:23 | LL | #[cfg(something)] b: i32, | ^ help: if this is intentional, prefix it with an underscore: `_b` error: unused variable: `c` - --> $DIR/param-attrs-cfg.rs:32:40 + --> $DIR/param-attrs-cfg.rs:31:40 | LL | #[cfg_attr(nothing, cfg(nothing))] c: i32, | ^ help: if this is intentional, prefix it with an underscore: `_c` error: unused variable: `b` - --> $DIR/param-attrs-cfg.rs:48:27 + --> $DIR/param-attrs-cfg.rs:47:27 | LL | #[cfg(something)] b: i32, | ^ help: if this is intentional, prefix it with an underscore: `_b` error: unused variable: `c` - --> $DIR/param-attrs-cfg.rs:50:44 + --> $DIR/param-attrs-cfg.rs:49:44 | LL | #[cfg_attr(nothing, cfg(nothing))] c: i32, | ^ help: if this is intentional, prefix it with an underscore: `_c` error: unused variable: `b` - --> $DIR/param-attrs-cfg.rs:56:27 + --> $DIR/param-attrs-cfg.rs:55:27 | LL | #[cfg(something)] b: i32, | ^ help: if this is intentional, prefix it with an underscore: `_b` error: unused variable: `c` - --> $DIR/param-attrs-cfg.rs:58:44 + --> $DIR/param-attrs-cfg.rs:57:44 | LL | #[cfg_attr(nothing, cfg(nothing))] c: i32, | ^ help: if this is intentional, prefix it with an underscore: `_c` error: unused variable: `b` - --> $DIR/param-attrs-cfg.rs:67:27 + --> $DIR/param-attrs-cfg.rs:66:27 | LL | #[cfg(something)] b: i32, | ^ help: if this is intentional, prefix it with an underscore: `_b` error: unused variable: `c` - --> $DIR/param-attrs-cfg.rs:69:44 + --> $DIR/param-attrs-cfg.rs:68:44 | LL | #[cfg_attr(nothing, cfg(nothing))] c: i32, | ^ help: if this is intentional, prefix it with an underscore: `_c` error: unused variable: `b` - --> $DIR/param-attrs-cfg.rs:75:27 + --> $DIR/param-attrs-cfg.rs:74:27 | LL | #[cfg(something)] b: i32, | ^ help: if this is intentional, prefix it with an underscore: `_b` error: unused variable: `c` - --> $DIR/param-attrs-cfg.rs:77:44 + --> $DIR/param-attrs-cfg.rs:76:44 | LL | #[cfg_attr(nothing, cfg(nothing))] c: i32, | ^ help: if this is intentional, prefix it with an underscore: `_c` error: unused variable: `b` - --> $DIR/param-attrs-cfg.rs:86:27 + --> $DIR/param-attrs-cfg.rs:85:27 | LL | #[cfg(something)] b: i32, | ^ help: if this is intentional, prefix it with an underscore: `_b` error: unused variable: `c` - --> $DIR/param-attrs-cfg.rs:88:44 + --> $DIR/param-attrs-cfg.rs:87:44 | LL | #[cfg_attr(nothing, cfg(nothing))] c: i32, | ^ help: if this is intentional, prefix it with an underscore: `_c` error: unused variable: `b` - --> $DIR/param-attrs-cfg.rs:94:27 + --> $DIR/param-attrs-cfg.rs:93:27 | LL | #[cfg(something)] b: i32, | ^ help: if this is intentional, prefix it with an underscore: `_b` error: unused variable: `c` - --> $DIR/param-attrs-cfg.rs:96:44 + --> $DIR/param-attrs-cfg.rs:95:44 | LL | #[cfg_attr(nothing, cfg(nothing))] c: i32, | ^ help: if this is intentional, prefix it with an underscore: `_c` error: unused variable: `b` - --> $DIR/param-attrs-cfg.rs:113:27 + --> $DIR/param-attrs-cfg.rs:112:27 | LL | #[cfg(something)] b: i32, | ^ help: if this is intentional, prefix it with an underscore: `_b` error: unused variable: `c` - --> $DIR/param-attrs-cfg.rs:115:44 + --> $DIR/param-attrs-cfg.rs:114:44 | LL | #[cfg_attr(nothing, cfg(nothing))] c: i32, | ^ help: if this is intentional, prefix it with an underscore: `_c` diff --git a/tests/ui/rfcs/rfc-2627-raw-dylib/invalid-dlltool.rs b/tests/ui/rfcs/rfc-2627-raw-dylib/invalid-dlltool.rs index bcf6dda7a44..057242246f0 100644 --- a/tests/ui/rfcs/rfc-2627-raw-dylib/invalid-dlltool.rs +++ b/tests/ui/rfcs/rfc-2627-raw-dylib/invalid-dlltool.rs @@ -1,7 +1,7 @@ // Tests that failing to run dlltool will raise an error. //@ needs-dlltool -//@ compile-flags: --crate-type lib --emit link -Cdlltool=does_not_exit.exe +//@ compile-flags: --crate-type lib --emit link -Cdlltool=does_not_exist.exe #[link(name = "foo", kind = "raw-dylib")] extern "C" { fn f(x: i32); diff --git a/tests/ui/rfcs/rfc-2627-raw-dylib/invalid-dlltool.stderr b/tests/ui/rfcs/rfc-2627-raw-dylib/invalid-dlltool.stderr index 9dbeee49f53..4bbad9b30a7 100644 --- a/tests/ui/rfcs/rfc-2627-raw-dylib/invalid-dlltool.stderr +++ b/tests/ui/rfcs/rfc-2627-raw-dylib/invalid-dlltool.stderr @@ -1,4 +1,4 @@ -error: Error calling dlltool 'does_not_exit.exe': program not found +error: Error calling dlltool 'does_not_exist.exe': program not found error: aborting due to 1 previous error diff --git a/tests/ui/runtime/on-broken-pipe/auxiliary/assert-sigpipe-disposition.rs b/tests/ui/runtime/on-broken-pipe/auxiliary/assert-sigpipe-disposition.rs index 117f6134b4e..229408fb724 100644 --- a/tests/ui/runtime/on-broken-pipe/auxiliary/assert-sigpipe-disposition.rs +++ b/tests/ui/runtime/on-broken-pipe/auxiliary/assert-sigpipe-disposition.rs @@ -25,7 +25,14 @@ fn start(argc: isize, argv: *const *const u8) -> isize { let actual = unsafe { let mut actual: libc::sigaction = std::mem::zeroed(); libc::sigaction(libc::SIGPIPE, std::ptr::null(), &mut actual); - actual.sa_sigaction + #[cfg(not(target_os = "aix"))] + { + actual.sa_sigaction + } + #[cfg(target_os = "aix")] + { + actual.sa_union.__su_sigaction as libc::sighandler_t + } }; assert_eq!(actual, expected, "actual and expected SIGPIPE disposition in child differs"); diff --git a/tests/ui/runtime/on-broken-pipe/auxiliary/sigpipe-utils.rs b/tests/ui/runtime/on-broken-pipe/auxiliary/sigpipe-utils.rs index 3d93d50ca3f..d16a2b4d8c8 100644 --- a/tests/ui/runtime/on-broken-pipe/auxiliary/sigpipe-utils.rs +++ b/tests/ui/runtime/on-broken-pipe/auxiliary/sigpipe-utils.rs @@ -20,7 +20,14 @@ pub fn assert_sigpipe_handler(expected_handler: SignalHandler) { let actual = unsafe { let mut actual: libc::sigaction = std::mem::zeroed(); libc::sigaction(libc::SIGPIPE, std::ptr::null(), &mut actual); - actual.sa_sigaction + #[cfg(not(target_os = "aix"))] + { + actual.sa_sigaction + } + #[cfg(target_os = "aix")] + { + actual.sa_union.__su_sigaction as libc::sighandler_t + } }; let expected = match expected_handler { diff --git a/tests/ui/runtime/signal-alternate-stack-cleanup.rs b/tests/ui/runtime/signal-alternate-stack-cleanup.rs index f2af86be0a5..8fce0928273 100644 --- a/tests/ui/runtime/signal-alternate-stack-cleanup.rs +++ b/tests/ui/runtime/signal-alternate-stack-cleanup.rs @@ -29,7 +29,14 @@ fn main() { // Install signal handler that runs on alternate signal stack. let mut action: sigaction = std::mem::zeroed(); action.sa_flags = (SA_ONSTACK | SA_SIGINFO) as _; - action.sa_sigaction = signal_handler as sighandler_t; + #[cfg(not(target_os = "aix"))] + { + action.sa_sigaction = signal_handler as sighandler_t; + } + #[cfg(target_os = "aix")] + { + action.sa_union.__su_sigaction = signal_handler as sighandler_t; + } sigaction(SIGWINCH, &action, std::ptr::null_mut()); // Send SIGWINCH on exit. diff --git a/tests/ui/sanitizer/cfi/async-closures.rs b/tests/ui/sanitizer/cfi/async-closures.rs index 4eaa44cfa3f..351853ab1a7 100644 --- a/tests/ui/sanitizer/cfi/async-closures.rs +++ b/tests/ui/sanitizer/cfi/async-closures.rs @@ -13,7 +13,6 @@ //@ [kcfi] compile-flags: -C panic=abort -Z panic-abort-tests -C prefer-dynamic=off //@ run-pass -#![feature(async_closure)] #![feature(async_fn_traits)] use std::ops::AsyncFn; diff --git a/tests/ui/self/arbitrary-self-from-method-substs-ice.stderr b/tests/ui/self/arbitrary-self-from-method-substs-ice.stderr index e4991823d28..cf4c219215e 100644 --- a/tests/ui/self/arbitrary-self-from-method-substs-ice.stderr +++ b/tests/ui/self/arbitrary-self-from-method-substs-ice.stderr @@ -17,12 +17,6 @@ LL | const fn get<R: Deref<Target = Self>>(self: R) -> u32 { LL | } | - value is dropped here -note: erroneous constant encountered - --> $DIR/arbitrary-self-from-method-substs-ice.rs:24:5 - | -LL | FOO; - | ^^^ - error[E0801]: invalid generic `self` parameter type: `R` --> $DIR/arbitrary-self-from-method-substs-ice.rs:10:49 | diff --git a/tests/ui/self/arbitrary-self-from-method-substs-with-receiver.rs b/tests/ui/self/arbitrary-self-from-method-substs-with-receiver.rs new file mode 100644 index 00000000000..495d261c549 --- /dev/null +++ b/tests/ui/self/arbitrary-self-from-method-substs-with-receiver.rs @@ -0,0 +1,64 @@ +#![feature(arbitrary_self_types)] + +use std::ops::{Receiver, Deref}; + +struct SmartPtr<'a, T: ?Sized>(&'a T); + +impl<'a, T: ?Sized> Deref for SmartPtr<'a, T> { + type Target = T; + fn deref(&self) -> &Self::Target { + self.0 + } +} + +impl<'a, T: ?Sized> Clone for SmartPtr<'a, T> { + fn clone(&self) -> Self { + Self(self.0) + } +} + +impl<'a, T: ?Sized> Copy for SmartPtr<'a, T> { +} + +struct Foo(u32); +impl Foo { + fn a<R: Receiver<Target=Self>>(self: R) -> u32 { + //~^ ERROR invalid generic `self` parameter type: `R` + 2 + } + fn b<R: Deref<Target=Self>>(self: R) -> u32 { + //~^ ERROR invalid generic `self` parameter type: `R` + self.0 + } + fn c(self: impl Receiver<Target=Self>) -> u32 { + //~^ ERROR invalid generic `self` parameter type: `impl Receiver<Target = Self>` + 3 + } + fn d(self: impl Deref<Target=Self>) -> u32 { + //~^ ERROR invalid generic `self` parameter type: `impl Deref<Target = Self>` + self.0 + } +} + +fn main() { + let foo = Foo(1); + assert_eq!((&foo).a::<&Foo>(), 2); + assert_eq!((&foo).b::<&Foo>(), 1); + assert_eq!((&foo).a(), 2); + assert_eq!((&foo).b(), 1); + assert_eq!((&foo).c(), 3); + assert_eq!((&foo).d(), 1); + assert_eq!(foo.a::<&Foo>(), 2); + //~^ ERROR mismatched types + assert_eq!(foo.b::<&Foo>(), 1); + //~^ ERROR mismatched types + let smart_ptr = SmartPtr(&foo); + assert_eq!(smart_ptr.a(), 2); + assert_eq!(smart_ptr.b(), 1); + assert_eq!(smart_ptr.c(), 3); + assert_eq!(smart_ptr.d(), 1); + assert_eq!(smart_ptr.a::<&Foo>(), 2); + //~^ ERROR mismatched types + assert_eq!(smart_ptr.b::<&Foo>(), 1); + //~^ ERROR mismatched types +} diff --git a/tests/ui/self/arbitrary-self-from-method-substs-with-receiver.stderr b/tests/ui/self/arbitrary-self-from-method-substs-with-receiver.stderr new file mode 100644 index 00000000000..9af2a08f371 --- /dev/null +++ b/tests/ui/self/arbitrary-self-from-method-substs-with-receiver.stderr @@ -0,0 +1,70 @@ +error[E0801]: invalid generic `self` parameter type: `R` + --> $DIR/arbitrary-self-from-method-substs-with-receiver.rs:25:42 + | +LL | fn a<R: Receiver<Target=Self>>(self: R) -> u32 { + | ^ + | + = note: type of `self` must not be a method generic parameter type + = help: use a concrete type such as `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`) + +error[E0801]: invalid generic `self` parameter type: `R` + --> $DIR/arbitrary-self-from-method-substs-with-receiver.rs:29:39 + | +LL | fn b<R: Deref<Target=Self>>(self: R) -> u32 { + | ^ + | + = note: type of `self` must not be a method generic parameter type + = help: use a concrete type such as `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`) + +error[E0801]: invalid generic `self` parameter type: `impl Receiver<Target = Self>` + --> $DIR/arbitrary-self-from-method-substs-with-receiver.rs:33:16 + | +LL | fn c(self: impl Receiver<Target=Self>) -> u32 { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: type of `self` must not be a method generic parameter type + = help: use a concrete type such as `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`) + +error[E0801]: invalid generic `self` parameter type: `impl Deref<Target = Self>` + --> $DIR/arbitrary-self-from-method-substs-with-receiver.rs:37:16 + | +LL | fn d(self: impl Deref<Target=Self>) -> u32 { + | ^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: type of `self` must not be a method generic parameter type + = help: use a concrete type such as `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`) + +error[E0308]: mismatched types + --> $DIR/arbitrary-self-from-method-substs-with-receiver.rs:51:16 + | +LL | assert_eq!(foo.a::<&Foo>(), 2); + | ^^^ expected `&Foo`, found `Foo` + +error[E0308]: mismatched types + --> $DIR/arbitrary-self-from-method-substs-with-receiver.rs:53:16 + | +LL | assert_eq!(foo.b::<&Foo>(), 1); + | ^^^ expected `&Foo`, found `Foo` + +error[E0308]: mismatched types + --> $DIR/arbitrary-self-from-method-substs-with-receiver.rs:60:16 + | +LL | assert_eq!(smart_ptr.a::<&Foo>(), 2); + | ^^^^^^^^^ expected `&Foo`, found `SmartPtr<'_, Foo>` + | + = note: expected reference `&Foo` + found struct `SmartPtr<'_, Foo, >` + +error[E0308]: mismatched types + --> $DIR/arbitrary-self-from-method-substs-with-receiver.rs:62:16 + | +LL | assert_eq!(smart_ptr.b::<&Foo>(), 1); + | ^^^^^^^^^ expected `&Foo`, found `SmartPtr<'_, Foo>` + | + = note: expected reference `&Foo` + found struct `SmartPtr<'_, Foo, >` + +error: aborting due to 8 previous errors + +Some errors have detailed explanations: E0308, E0801. +For more information about an error, try `rustc --explain E0308`. diff --git a/tests/ui/self/arbitrary-self-from-method-substs.default.stderr b/tests/ui/self/arbitrary-self-from-method-substs.default.stderr index 5dc3a0b0234..7cf9c9a3afd 100644 --- a/tests/ui/self/arbitrary-self-from-method-substs.default.stderr +++ b/tests/ui/self/arbitrary-self-from-method-substs.default.stderr @@ -61,7 +61,7 @@ LL | fn get6<FR: FindReceiver>(self: FR::Receiver, other: FR) -> u32 { = note: see issue #44874 <https://github.com/rust-lang/rust/issues/44874> for more information = help: add `#![feature(arbitrary_self_types)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - = help: consider changing to `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`) + = help: consider changing to `self`, `&self`, `&mut self`, or a type implementing `Receiver` such as `self: Box<Self>`, `self: Rc<Self>`, or `self: Arc<Self>` error[E0658]: `R` cannot be used as the type of `self` without the `arbitrary_self_types` feature --> $DIR/arbitrary-self-from-method-substs.rs:61:18 @@ -72,7 +72,7 @@ LL | fn get(self: R) {} = note: see issue #44874 <https://github.com/rust-lang/rust/issues/44874> for more information = help: add `#![feature(arbitrary_self_types)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - = help: consider changing to `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`) + = help: consider changing to `self`, `&self`, `&mut self`, or a type implementing `Receiver` such as `self: Box<Self>`, `self: Rc<Self>`, or `self: Arc<Self>` error[E0271]: type mismatch resolving `<Silly as FindReceiver>::Receiver == Foo` --> $DIR/arbitrary-self-from-method-substs.rs:92:9 diff --git a/tests/ui/self/arbitrary-self-opaque.stderr b/tests/ui/self/arbitrary-self-opaque.stderr index c75165d9f8e..0469aca27dc 100644 --- a/tests/ui/self/arbitrary-self-opaque.stderr +++ b/tests/ui/self/arbitrary-self-opaque.stderr @@ -4,8 +4,8 @@ error[E0307]: invalid `self` parameter type: `Bar` LL | fn foo(self: Bar) {} | ^^^ | - = note: type of `self` must be `Self` or a type that dereferences to it - = help: consider changing to `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`) + = note: type of `self` must be `Self` or some type implementing `Receiver` + = help: consider changing to `self`, `&self`, `&mut self`, or a type implementing `Receiver` such as `self: Box<Self>`, `self: Rc<Self>`, or `self: Arc<Self>` error: item does not constrain `Bar::{opaque#0}`, but has it in its signature --> $DIR/arbitrary-self-opaque.rs:7:8 diff --git a/tests/ui/self/arbitrary_self_types_by_value_reborrow.rs b/tests/ui/self/arbitrary_self_types_by_value_reborrow.rs new file mode 100644 index 00000000000..de4db1b9afe --- /dev/null +++ b/tests/ui/self/arbitrary_self_types_by_value_reborrow.rs @@ -0,0 +1,69 @@ +//@ run-pass + +#![feature(arbitrary_self_types)] +#![allow(dead_code)] + +// With arbitrary self types v2, we show an error if there are +// multiple contenders for a method call in an inner and outer type. +// The goal is to avoid any possibility of confusion by a new +// 'shadowing' method calling a 'shadowed' method. +// However, there are niche circumstances where this +// algorithm doesn't quite work, due to reborrows to get a different +// lifetime. The test below explicitly tests those circumstances to ensure +// the behavior is as expected, even if it's not 100% desirable. They're +// very niche circumstances. + +#[derive(Debug, PartialEq)] +enum Callee { + INNER, + OUTER +} + +struct MyNonNull<T>(T); + +impl<T> std::ops::Receiver for MyNonNull<T> { + type Target = T; +} + +struct A; +impl A { + fn foo(self: MyNonNull<A>) -> Callee { + Callee::INNER + } + + fn bar(self: &MyNonNull<A>) -> Callee { + Callee::INNER + } + + fn baz(self: &&MyNonNull<A>) -> Callee { + // note this is by DOUBLE reference + Callee::INNER + } +} + +impl<T> MyNonNull<T> { + fn foo(&self) -> Callee{ + Callee::OUTER + } + + fn bar(&self) -> Callee{ + Callee::OUTER + } + + fn baz(&self) -> Callee{ + Callee::OUTER + } +} + +fn main() { + // The normal deshadowing case. Does not compile. + // assert_eq!(MyNonNull(A).foo(), Callee::INNER); + + // Similarly, does not compile. + //assert_eq!(MyNonNull(A).bar(), Callee::INNER); + + // The double-reference case. + // We call the newly-added outer type method. + // Not ideal but very niche so we accept it. + assert_eq!(MyNonNull(A).baz(), Callee::OUTER); +} diff --git a/tests/ui/self/arbitrary_self_types_generic_over_receiver.rs b/tests/ui/self/arbitrary_self_types_generic_over_receiver.rs new file mode 100644 index 00000000000..8ccda9368ad --- /dev/null +++ b/tests/ui/self/arbitrary_self_types_generic_over_receiver.rs @@ -0,0 +1,23 @@ +#![feature(arbitrary_self_types)] + +use std::ops::{Receiver, Deref}; + +struct Foo(u32); +impl Foo { + fn a(self: impl Receiver<Target=Self>) -> u32 { + //~^ ERROR invalid generic `self` parameter type: `impl Receiver<Target = Self>` + 3 + } + fn b(self: impl Deref<Target=Self>) -> u32 { + //~^ ERROR invalid generic `self` parameter type: `impl Deref<Target = Self>` + self.0 + } +} + +fn main() { + let foo = Foo(1); + foo.a(); + //~^ ERROR the trait bound + foo.b(); + //~^ ERROR the trait bound +} diff --git a/tests/ui/self/arbitrary_self_types_generic_over_receiver.stderr b/tests/ui/self/arbitrary_self_types_generic_over_receiver.stderr new file mode 100644 index 00000000000..2da3925341e --- /dev/null +++ b/tests/ui/self/arbitrary_self_types_generic_over_receiver.stderr @@ -0,0 +1,59 @@ +error[E0801]: invalid generic `self` parameter type: `impl Receiver<Target = Self>` + --> $DIR/arbitrary_self_types_generic_over_receiver.rs:7:16 + | +LL | fn a(self: impl Receiver<Target=Self>) -> u32 { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: type of `self` must not be a method generic parameter type + = help: use a concrete type such as `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`) + +error[E0801]: invalid generic `self` parameter type: `impl Deref<Target = Self>` + --> $DIR/arbitrary_self_types_generic_over_receiver.rs:11:16 + | +LL | fn b(self: impl Deref<Target=Self>) -> u32 { + | ^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: type of `self` must not be a method generic parameter type + = help: use a concrete type such as `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`) + +error[E0277]: the trait bound `Foo: std::ops::Receiver` is not satisfied + --> $DIR/arbitrary_self_types_generic_over_receiver.rs:19:9 + | +LL | foo.a(); + | ^ the trait `std::ops::Receiver` is not implemented for `Foo` + | + = note: required for `Foo` to implement `std::ops::Receiver` +note: required by a bound in `Foo::a` + --> $DIR/arbitrary_self_types_generic_over_receiver.rs:7:21 + | +LL | fn a(self: impl Receiver<Target=Self>) -> u32 { + | ^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Foo::a` +help: consider borrowing here + | +LL | &foo.a(); + | + +LL | &mut foo.a(); + | ++++ + +error[E0277]: the trait bound `Foo: Deref` is not satisfied + --> $DIR/arbitrary_self_types_generic_over_receiver.rs:21:9 + | +LL | foo.b(); + | ^ the trait `Deref` is not implemented for `Foo` + | +note: required by a bound in `Foo::b` + --> $DIR/arbitrary_self_types_generic_over_receiver.rs:11:21 + | +LL | fn b(self: impl Deref<Target=Self>) -> u32 { + | ^^^^^^^^^^^^^^^^^^ required by this bound in `Foo::b` +help: consider borrowing here + | +LL | &foo.b(); + | + +LL | &mut foo.b(); + | ++++ + +error: aborting due to 4 previous errors + +Some errors have detailed explanations: E0277, E0801. +For more information about an error, try `rustc --explain E0277`. diff --git a/tests/ui/self/arbitrary_self_types_generic_receiver.rs b/tests/ui/self/arbitrary_self_types_generic_receiver.rs new file mode 100644 index 00000000000..0739fb778b6 --- /dev/null +++ b/tests/ui/self/arbitrary_self_types_generic_receiver.rs @@ -0,0 +1,50 @@ +#![feature(arbitrary_self_types)] + +struct PtrA<T>(T); + +impl<T> core::ops::Receiver for PtrA<T> { + type Target = T; +} + +struct PtrB<T>(T); + +trait SomePtr: core::ops::Receiver<Target=<Self as SomePtr>::SomeTarget> { + type SomeTarget; +} + +impl<T> SomePtr for PtrB<T> { + type SomeTarget = T; +} + +impl<T> core::ops::Receiver for PtrB<T> { + type Target = T; +} + +struct Content; + +impl Content { + fn a<R: core::ops::Receiver<Target=Self>>(self: &R) {} + //~^ ERROR invalid generic + fn b<R: core::ops::Receiver<Target=Self>>(self: &mut R) {} + //~^ ERROR invalid generic + fn c<R: core::ops::Receiver<Target=Self>>(self: R) {} + //~^ ERROR invalid generic + fn d<R: SomePtr<SomeTarget=Self>>(self: R) {} + //~^ ERROR invalid generic + fn e(self: impl SomePtr<SomeTarget=Self>) {} + //~^ ERROR invalid generic +} + +fn main() { + PtrA(Content).a(); + PtrA(Content).b(); + PtrA(Content).c(); + std::rc::Rc::new(Content).a(); + std::rc::Rc::new(Content).b(); + std::rc::Rc::new(Content).c(); + PtrB(Content).a(); + PtrB(Content).b(); + PtrB(Content).c(); + PtrB(Content).d(); + PtrB(Content).e(); +} diff --git a/tests/ui/self/arbitrary_self_types_generic_receiver.stderr b/tests/ui/self/arbitrary_self_types_generic_receiver.stderr new file mode 100644 index 00000000000..788c55ea2f1 --- /dev/null +++ b/tests/ui/self/arbitrary_self_types_generic_receiver.stderr @@ -0,0 +1,48 @@ +error[E0801]: invalid generic `self` parameter type: `&R` + --> $DIR/arbitrary_self_types_generic_receiver.rs:26:53 + | +LL | fn a<R: core::ops::Receiver<Target=Self>>(self: &R) {} + | ^^ + | + = note: type of `self` must not be a method generic parameter type + = help: use a concrete type such as `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`) + +error[E0801]: invalid generic `self` parameter type: `&mut R` + --> $DIR/arbitrary_self_types_generic_receiver.rs:28:53 + | +LL | fn b<R: core::ops::Receiver<Target=Self>>(self: &mut R) {} + | ^^^^^^ + | + = note: type of `self` must not be a method generic parameter type + = help: use a concrete type such as `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`) + +error[E0801]: invalid generic `self` parameter type: `R` + --> $DIR/arbitrary_self_types_generic_receiver.rs:30:53 + | +LL | fn c<R: core::ops::Receiver<Target=Self>>(self: R) {} + | ^ + | + = note: type of `self` must not be a method generic parameter type + = help: use a concrete type such as `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`) + +error[E0801]: invalid generic `self` parameter type: `R` + --> $DIR/arbitrary_self_types_generic_receiver.rs:32:45 + | +LL | fn d<R: SomePtr<SomeTarget=Self>>(self: R) {} + | ^ + | + = note: type of `self` must not be a method generic parameter type + = help: use a concrete type such as `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`) + +error[E0801]: invalid generic `self` parameter type: `impl SomePtr<SomeTarget = Self>` + --> $DIR/arbitrary_self_types_generic_receiver.rs:34:16 + | +LL | fn e(self: impl SomePtr<SomeTarget=Self>) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: type of `self` must not be a method generic parameter type + = help: use a concrete type such as `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`) + +error: aborting due to 5 previous errors + +For more information about this error, try `rustc --explain E0801`. diff --git a/tests/ui/self/arbitrary_self_types_lifetime_elision.rs b/tests/ui/self/arbitrary_self_types_lifetime_elision.rs new file mode 100644 index 00000000000..fd645c1013b --- /dev/null +++ b/tests/ui/self/arbitrary_self_types_lifetime_elision.rs @@ -0,0 +1,27 @@ +//@ run-pass + +#![feature(arbitrary_self_types)] + +#[derive(Clone)] +struct SmartPtr<'a, T: ?Sized>(&'a T); + +impl<'a, T: ?Sized> std::ops::Receiver for SmartPtr<'a, T> { + type Target = T; +} + +#[derive(Clone)] +struct MyType; + +impl MyType { + fn m(self: SmartPtr<Self>) {} + fn n(self: SmartPtr<'_, Self>) {} + fn o<'a>(self: SmartPtr<'a, Self>) {} +} + +fn main() { + let a = MyType; + let ptr = SmartPtr(&a); + ptr.clone().m(); + ptr.clone().n(); + ptr.o(); +} diff --git a/tests/ui/self/arbitrary_self_types_no_generics.rs b/tests/ui/self/arbitrary_self_types_no_generics.rs new file mode 100644 index 00000000000..8a6f5741882 --- /dev/null +++ b/tests/ui/self/arbitrary_self_types_no_generics.rs @@ -0,0 +1,32 @@ +//@ run-pass + +#![feature(arbitrary_self_types)] + +pub struct A; + +impl A { + pub fn f(self: B) -> i32 { 1 } +} + +pub struct B(A); + +impl core::ops::Receiver for B { + type Target = A; +} + +struct C; + +struct D; + +impl C { + fn weird(self: D) -> i32 { 3 } +} + +impl core::ops::Receiver for D { + type Target = C; +} + +fn main() { + assert_eq!(B(A).f(), 1); + assert_eq!(D.weird(), 3); +} diff --git a/tests/ui/self/arbitrary_self_types_not_allow_call_with_no_deref.rs b/tests/ui/self/arbitrary_self_types_not_allow_call_with_no_deref.rs new file mode 100644 index 00000000000..26e48f69d23 --- /dev/null +++ b/tests/ui/self/arbitrary_self_types_not_allow_call_with_no_deref.rs @@ -0,0 +1,38 @@ +#![feature(arbitrary_self_types)] + +use std::rc::Rc; + +struct Foo; + +struct CppRef<T>(T); + +impl<T> std::ops::Receiver for CppRef<T> { + type Target = T; +} + +impl Foo{ + fn frobnicate_self(self) {} + fn frobnicate_ref(&self) {} + fn frobnicate_cpp_ref(self: CppRef<Self>) {} +} + +fn main() { + let foo_rc = Rc::new(Foo); + + // this compiles fine, and desugars to `Foo::frobnicate_ref(&*foo_rc)` + foo_rc.frobnicate_ref(); + + let foo_cpp_ref = CppRef(Foo); + + // should not compile because it would desugar to `Foo::frobnicate_ref(&*foo_cpp_ref)` + // and you can't deref a CppRef + foo_cpp_ref.frobnicate_ref(); + //~^ ERROR no method named + + foo_cpp_ref.frobnicate_self(); // would desugar to `Foo::frobnicate_self(*foo_cpp_ref)` + //~^ ERROR no method named + + // should compile, because we're not dereffing the CppRef + // desugars to `Foo::frobnicate_cpp_ref(foo_cpp_ref)` + foo_cpp_ref.frobnicate_cpp_ref(); +} diff --git a/tests/ui/self/arbitrary_self_types_not_allow_call_with_no_deref.stderr b/tests/ui/self/arbitrary_self_types_not_allow_call_with_no_deref.stderr new file mode 100644 index 00000000000..4c0ab88493e --- /dev/null +++ b/tests/ui/self/arbitrary_self_types_not_allow_call_with_no_deref.stderr @@ -0,0 +1,39 @@ +error[E0599]: no method named `frobnicate_ref` found for struct `CppRef` in the current scope + --> $DIR/arbitrary_self_types_not_allow_call_with_no_deref.rs:29:17 + | +LL | struct CppRef<T>(T); + | ---------------- method `frobnicate_ref` not found for this struct +... +LL | foo_cpp_ref.frobnicate_ref(); + | ^^^^^^^^^^^^^^ + | +help: one of the expressions' fields has a method of the same name + | +LL | foo_cpp_ref.0.frobnicate_ref(); + | ++ +help: there is a method `frobnicate_cpp_ref` with a similar name + | +LL | foo_cpp_ref.frobnicate_cpp_ref(); + | ~~~~~~~~~~~~~~~~~~ + +error[E0599]: no method named `frobnicate_self` found for struct `CppRef` in the current scope + --> $DIR/arbitrary_self_types_not_allow_call_with_no_deref.rs:32:17 + | +LL | struct CppRef<T>(T); + | ---------------- method `frobnicate_self` not found for this struct +... +LL | foo_cpp_ref.frobnicate_self(); // would desugar to `Foo::frobnicate_self(*foo_cpp_ref)` + | ^^^^^^^^^^^^^^^ + | +help: one of the expressions' fields has a method of the same name + | +LL | foo_cpp_ref.0.frobnicate_self(); // would desugar to `Foo::frobnicate_self(*foo_cpp_ref)` + | ++ +help: there is a method `frobnicate_cpp_ref` with a similar name + | +LL | foo_cpp_ref.frobnicate_cpp_ref(); // would desugar to `Foo::frobnicate_self(*foo_cpp_ref)` + | ~~~~~~~~~~~~~~~~~~ + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0599`. diff --git a/tests/ui/self/arbitrary_self_types_recursive_receiver.rs b/tests/ui/self/arbitrary_self_types_recursive_receiver.rs new file mode 100644 index 00000000000..f3e7f96d7c4 --- /dev/null +++ b/tests/ui/self/arbitrary_self_types_recursive_receiver.rs @@ -0,0 +1,32 @@ +//@ run-pass +#![feature(arbitrary_self_types)] + +struct MyNonNull<T>(*const T); + +impl<T> std::ops::Receiver for MyNonNull<T> { + type Target = T; +} + +#[allow(dead_code)] +impl<T> MyNonNull<T> { + fn foo<U>(&self) -> *const U { + self.cast::<U>().bar() + } + fn cast<U>(&self) -> MyNonNull<U> { + MyNonNull(self.0 as *const U) + } + fn bar(&self) -> *const T { + self.0 + } +} + +#[repr(transparent)] +struct Foo(usize); +#[repr(transparent)] +struct Bar(usize); + +fn main() { + let a = Foo(3); + let ptr = MyNonNull(&a); + let _bar_ptr: *const Bar = ptr.foo(); +} diff --git a/tests/ui/self/arbitrary_self_types_shadowing_val_constptr.rs b/tests/ui/self/arbitrary_self_types_shadowing_val_constptr.rs new file mode 100644 index 00000000000..2b718cb0454 --- /dev/null +++ b/tests/ui/self/arbitrary_self_types_shadowing_val_constptr.rs @@ -0,0 +1,33 @@ +//@ run-pass + +#![feature(arbitrary_self_types)] +#![feature(arbitrary_self_types_pointers)] + +pub struct A; + +impl A { + pub fn f(self: *const MyNonNull<Self>) -> i32 { 1 } +} + +pub struct MyNonNull<T>(T); + +impl<T> core::ops::Receiver for MyNonNull<T> { + type Target = T; +} + +impl<T> MyNonNull<T> { + // Imagine this a NEW method in B<T> shadowing an EXISTING + // method in A. + pub fn f(self: *mut Self) -> i32 { + 2 + } +} + +fn main() { + let mut b = MyNonNull(A); + let b = &mut b; + let b = b as *mut MyNonNull<A>; + // We actually allow the shadowing in the case of const vs mut raw + // pointer receivers. + assert_eq!(b.f(), 2); +} diff --git a/tests/ui/self/arbitrary_self_types_struct_receiver_trait.rs b/tests/ui/self/arbitrary_self_types_struct_receiver_trait.rs new file mode 100644 index 00000000000..cebf0ea7cba --- /dev/null +++ b/tests/ui/self/arbitrary_self_types_struct_receiver_trait.rs @@ -0,0 +1,31 @@ +//@ run-pass +#![feature(arbitrary_self_types)] + +use std::ops::Receiver; + +struct SmartPtr<T>(T); + +impl<T> Receiver for SmartPtr<T> { + type Target = T; +} + +struct Foo { + x: i32, + y: i32, +} + +impl Foo { + fn x(self: &SmartPtr<Self>) -> i32 { + self.0.x + } + + fn y(self: SmartPtr<Self>) -> i32 { + self.0.y + } +} + +fn main() { + let foo = SmartPtr(Foo {x: 3, y: 4}); + assert_eq!(3, foo.x()); + assert_eq!(4, foo.y()); +} diff --git a/tests/ui/self/arbitrary_self_types_trait_receiver_trait.rs b/tests/ui/self/arbitrary_self_types_trait_receiver_trait.rs new file mode 100644 index 00000000000..9c0402da0be --- /dev/null +++ b/tests/ui/self/arbitrary_self_types_trait_receiver_trait.rs @@ -0,0 +1,25 @@ +//@ run-pass +#![feature(arbitrary_self_types)] +#![allow(unused_allocation)] + +struct SmartPtr<T: ?Sized>(T); + +impl<T: ?Sized> std::ops::Receiver for SmartPtr<T> { + type Target = T; +} + +trait Trait { + fn trait_method<'a>(self: &'a Box<SmartPtr<Self>>) -> &'a [i32]; +} + +impl Trait for Vec<i32> { + fn trait_method<'a>(self: &'a Box<SmartPtr<Self>>) -> &'a [i32] { + &(**self).0 + } +} + +fn main() { + let v = vec![1, 2, 3]; + + assert_eq!(&[1, 2, 3], Box::new(SmartPtr(v)).trait_method()); +} diff --git a/tests/ui/self/arbitrary_self_types_unshadowing.rs b/tests/ui/self/arbitrary_self_types_unshadowing.rs new file mode 100644 index 00000000000..cd195654cc1 --- /dev/null +++ b/tests/ui/self/arbitrary_self_types_unshadowing.rs @@ -0,0 +1,55 @@ +#![feature(arbitrary_self_types)] + +pub struct A; + +// The receiver of the potentially shadowed method +// precisely matches that of the shadower +impl A { + pub fn f(self: Wrapper<Self>) -> i32 { 1 } + pub fn g(self: &Wrapper<Self>) -> i32 { 2 } + pub fn h(self: &mut Wrapper<Self>) -> i32 { 3 } +} + +// The receiver of the potentially shadowed method is a reference +pub struct B; + +impl B { + pub fn f(self: &Wrapper<Self>) -> i32 { 9 } +} + +// The receiver of the potentially shadowed method is a mut reference + +pub struct C; + +impl C { + pub fn f(self: &mut Wrapper<Self>) -> i32 { 10 } + pub fn g(self: &mut Wrapper<Self>) -> i32 { 11 } +} + +pub struct Wrapper<T>(T); + +impl<T> core::ops::Receiver for Wrapper<T> { + type Target = T; +} + +impl<T> Wrapper<T> { + pub fn f(self) -> i32 { 5 } + pub fn g(&self) -> i32 { 6 } + pub fn h(&mut self) -> i32 { 7 } +} + +fn main() { + assert_eq!(Wrapper(A).f(), 1); + //~^ ERROR: multiple applicable items in scope + assert_eq!(Wrapper(A).g(), 2); + //~^ ERROR: multiple applicable items in scope + assert_eq!(Wrapper(A).h(), 3); + //~^ ERROR: multiple applicable items in scope + let a = Wrapper(A); + assert_eq!(Wrapper(B).f(), 9); + //~^ ERROR: multiple applicable items in scope + assert_eq!(Wrapper(C).f(), 10); + //~^ ERROR: multiple applicable items in scope + assert_eq!(Wrapper(C).g(), 11); + //~^ ERROR: multiple applicable items in scope +} diff --git a/tests/ui/self/arbitrary_self_types_unshadowing.stderr b/tests/ui/self/arbitrary_self_types_unshadowing.stderr new file mode 100644 index 00000000000..3a126c495c9 --- /dev/null +++ b/tests/ui/self/arbitrary_self_types_unshadowing.stderr @@ -0,0 +1,105 @@ +error[E0034]: multiple applicable items in scope + --> $DIR/arbitrary_self_types_unshadowing.rs:42:27 + | +LL | assert_eq!(Wrapper(A).f(), 1); + | ^ multiple `f` found + | +note: candidate #1 is defined in an impl for the type `A` + --> $DIR/arbitrary_self_types_unshadowing.rs:8:5 + | +LL | pub fn f(self: Wrapper<Self>) -> i32 { 1 } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +note: candidate #2 is defined in an impl for the type `Wrapper<T>` + --> $DIR/arbitrary_self_types_unshadowing.rs:36:5 + | +LL | pub fn f(self) -> i32 { 5 } + | ^^^^^^^^^^^^^^^^^^^^^ + +error[E0034]: multiple applicable items in scope + --> $DIR/arbitrary_self_types_unshadowing.rs:44:27 + | +LL | assert_eq!(Wrapper(A).g(), 2); + | ^ multiple `g` found + | +note: candidate #1 is defined in an impl for the type `A` + --> $DIR/arbitrary_self_types_unshadowing.rs:9:5 + | +LL | pub fn g(self: &Wrapper<Self>) -> i32 { 2 } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +note: candidate #2 is defined in an impl for the type `Wrapper<T>` + --> $DIR/arbitrary_self_types_unshadowing.rs:37:5 + | +LL | pub fn g(&self) -> i32 { 6 } + | ^^^^^^^^^^^^^^^^^^^^^^ + +error[E0034]: multiple applicable items in scope + --> $DIR/arbitrary_self_types_unshadowing.rs:46:27 + | +LL | assert_eq!(Wrapper(A).h(), 3); + | ^ multiple `h` found + | +note: candidate #1 is defined in an impl for the type `A` + --> $DIR/arbitrary_self_types_unshadowing.rs:10:5 + | +LL | pub fn h(self: &mut Wrapper<Self>) -> i32 { 3 } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +note: candidate #2 is defined in an impl for the type `Wrapper<T>` + --> $DIR/arbitrary_self_types_unshadowing.rs:38:5 + | +LL | pub fn h(&mut self) -> i32 { 7 } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0034]: multiple applicable items in scope + --> $DIR/arbitrary_self_types_unshadowing.rs:49:27 + | +LL | assert_eq!(Wrapper(B).f(), 9); + | ^ multiple `f` found + | +note: candidate #1 is defined in an impl for the type `B` + --> $DIR/arbitrary_self_types_unshadowing.rs:17:5 + | +LL | pub fn f(self: &Wrapper<Self>) -> i32 { 9 } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +note: candidate #2 is defined in an impl for the type `Wrapper<T>` + --> $DIR/arbitrary_self_types_unshadowing.rs:36:5 + | +LL | pub fn f(self) -> i32 { 5 } + | ^^^^^^^^^^^^^^^^^^^^^ + +error[E0034]: multiple applicable items in scope + --> $DIR/arbitrary_self_types_unshadowing.rs:51:27 + | +LL | assert_eq!(Wrapper(C).f(), 10); + | ^ multiple `f` found + | +note: candidate #1 is defined in an impl for the type `C` + --> $DIR/arbitrary_self_types_unshadowing.rs:25:5 + | +LL | pub fn f(self: &mut Wrapper<Self>) -> i32 { 10 } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +note: candidate #2 is defined in an impl for the type `Wrapper<T>` + --> $DIR/arbitrary_self_types_unshadowing.rs:36:5 + | +LL | pub fn f(self) -> i32 { 5 } + | ^^^^^^^^^^^^^^^^^^^^^ + +error[E0034]: multiple applicable items in scope + --> $DIR/arbitrary_self_types_unshadowing.rs:53:27 + | +LL | assert_eq!(Wrapper(C).g(), 11); + | ^ multiple `g` found + | +note: candidate #1 is defined in an impl for the type `C` + --> $DIR/arbitrary_self_types_unshadowing.rs:26:5 + | +LL | pub fn g(self: &mut Wrapper<Self>) -> i32 { 11 } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +note: candidate #2 is defined in an impl for the type `Wrapper<T>` + --> $DIR/arbitrary_self_types_unshadowing.rs:37:5 + | +LL | pub fn g(&self) -> i32 { 6 } + | ^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 6 previous errors + +For more information about this error, try `rustc --explain E0034`. diff --git a/tests/ui/self/arbitrary_self_types_unshadowing_ptrs.rs b/tests/ui/self/arbitrary_self_types_unshadowing_ptrs.rs new file mode 100644 index 00000000000..62553c2622a --- /dev/null +++ b/tests/ui/self/arbitrary_self_types_unshadowing_ptrs.rs @@ -0,0 +1,61 @@ +#![feature(arbitrary_self_types_pointers)] +#![feature(arbitrary_self_types)] + +pub struct A; + +// The receiver of the potentially shadowed method +// precisely matches that of the shadower +impl A { + pub fn f(self: Wrapper<Self>) -> i32 { 1 } + pub fn g(self: &Wrapper<Self>) -> i32 { 2 } + pub fn h(self: &mut Wrapper<Self>) -> i32 { 3 } + pub fn i(self: *const Wrapper<Self>) -> i32 { 4 } +} + +// The receiver of the potentially shadowed method is a reference +pub struct B; + +impl B { + pub fn f(self: &Wrapper<Self>) -> i32 { 9 } +} + +// The receiver of the potentially shadowed method is a mut reference + +pub struct C; + +impl C { + pub fn f(self: &mut Wrapper<Self>) -> i32 { 10 } + pub fn g(self: &mut Wrapper<Self>) -> i32 { 11 } +} + +pub struct Wrapper<T>(T); + +impl<T> core::ops::Receiver for Wrapper<T> { + type Target = T; +} + +impl<T> Wrapper<T> { + pub fn f(self) -> i32 { 5 } + pub fn g(&self) -> i32 { 6 } + pub fn h(&mut self) -> i32 { 7 } + pub fn i(self: *const Self) -> i32 { 8 } +} + +fn main() { + assert_eq!(Wrapper(A).f(), 1); + //~^ ERROR: multiple applicable items in scope + assert_eq!(Wrapper(A).g(), 2); + //~^ ERROR: multiple applicable items in scope + assert_eq!(Wrapper(A).h(), 3); + //~^ ERROR: multiple applicable items in scope + let a = Wrapper(A); + let a_ptr = &a as *const Wrapper<A>; + assert_eq!(a_ptr.i(), 4); + //~^ ERROR: multiple applicable items in scope + assert_eq!(Wrapper(B).f(), 9); + //~^ ERROR: multiple applicable items in scope + assert_eq!(Wrapper(C).f(), 10); + //~^ ERROR: multiple applicable items in scope + assert_eq!(Wrapper(C).g(), 11); + //~^ ERROR: multiple applicable items in scope +} diff --git a/tests/ui/self/arbitrary_self_types_unshadowing_ptrs.stderr b/tests/ui/self/arbitrary_self_types_unshadowing_ptrs.stderr new file mode 100644 index 00000000000..6d453aed0f0 --- /dev/null +++ b/tests/ui/self/arbitrary_self_types_unshadowing_ptrs.stderr @@ -0,0 +1,122 @@ +error[E0034]: multiple applicable items in scope + --> $DIR/arbitrary_self_types_unshadowing_ptrs.rs:45:27 + | +LL | assert_eq!(Wrapper(A).f(), 1); + | ^ multiple `f` found + | +note: candidate #1 is defined in an impl for the type `A` + --> $DIR/arbitrary_self_types_unshadowing_ptrs.rs:9:5 + | +LL | pub fn f(self: Wrapper<Self>) -> i32 { 1 } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +note: candidate #2 is defined in an impl for the type `Wrapper<T>` + --> $DIR/arbitrary_self_types_unshadowing_ptrs.rs:38:5 + | +LL | pub fn f(self) -> i32 { 5 } + | ^^^^^^^^^^^^^^^^^^^^^ + +error[E0034]: multiple applicable items in scope + --> $DIR/arbitrary_self_types_unshadowing_ptrs.rs:47:27 + | +LL | assert_eq!(Wrapper(A).g(), 2); + | ^ multiple `g` found + | +note: candidate #1 is defined in an impl for the type `A` + --> $DIR/arbitrary_self_types_unshadowing_ptrs.rs:10:5 + | +LL | pub fn g(self: &Wrapper<Self>) -> i32 { 2 } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +note: candidate #2 is defined in an impl for the type `Wrapper<T>` + --> $DIR/arbitrary_self_types_unshadowing_ptrs.rs:39:5 + | +LL | pub fn g(&self) -> i32 { 6 } + | ^^^^^^^^^^^^^^^^^^^^^^ + +error[E0034]: multiple applicable items in scope + --> $DIR/arbitrary_self_types_unshadowing_ptrs.rs:49:27 + | +LL | assert_eq!(Wrapper(A).h(), 3); + | ^ multiple `h` found + | +note: candidate #1 is defined in an impl for the type `A` + --> $DIR/arbitrary_self_types_unshadowing_ptrs.rs:11:5 + | +LL | pub fn h(self: &mut Wrapper<Self>) -> i32 { 3 } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +note: candidate #2 is defined in an impl for the type `Wrapper<T>` + --> $DIR/arbitrary_self_types_unshadowing_ptrs.rs:40:5 + | +LL | pub fn h(&mut self) -> i32 { 7 } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0034]: multiple applicable items in scope + --> $DIR/arbitrary_self_types_unshadowing_ptrs.rs:53:22 + | +LL | assert_eq!(a_ptr.i(), 4); + | ^ multiple `i` found + | +note: candidate #1 is defined in an impl for the type `A` + --> $DIR/arbitrary_self_types_unshadowing_ptrs.rs:12:5 + | +LL | pub fn i(self: *const Wrapper<Self>) -> i32 { 4 } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +note: candidate #2 is defined in an impl for the type `Wrapper<T>` + --> $DIR/arbitrary_self_types_unshadowing_ptrs.rs:41:5 + | +LL | pub fn i(self: *const Self) -> i32 { 8 } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0034]: multiple applicable items in scope + --> $DIR/arbitrary_self_types_unshadowing_ptrs.rs:55:27 + | +LL | assert_eq!(Wrapper(B).f(), 9); + | ^ multiple `f` found + | +note: candidate #1 is defined in an impl for the type `B` + --> $DIR/arbitrary_self_types_unshadowing_ptrs.rs:19:5 + | +LL | pub fn f(self: &Wrapper<Self>) -> i32 { 9 } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +note: candidate #2 is defined in an impl for the type `Wrapper<T>` + --> $DIR/arbitrary_self_types_unshadowing_ptrs.rs:38:5 + | +LL | pub fn f(self) -> i32 { 5 } + | ^^^^^^^^^^^^^^^^^^^^^ + +error[E0034]: multiple applicable items in scope + --> $DIR/arbitrary_self_types_unshadowing_ptrs.rs:57:27 + | +LL | assert_eq!(Wrapper(C).f(), 10); + | ^ multiple `f` found + | +note: candidate #1 is defined in an impl for the type `C` + --> $DIR/arbitrary_self_types_unshadowing_ptrs.rs:27:5 + | +LL | pub fn f(self: &mut Wrapper<Self>) -> i32 { 10 } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +note: candidate #2 is defined in an impl for the type `Wrapper<T>` + --> $DIR/arbitrary_self_types_unshadowing_ptrs.rs:38:5 + | +LL | pub fn f(self) -> i32 { 5 } + | ^^^^^^^^^^^^^^^^^^^^^ + +error[E0034]: multiple applicable items in scope + --> $DIR/arbitrary_self_types_unshadowing_ptrs.rs:59:27 + | +LL | assert_eq!(Wrapper(C).g(), 11); + | ^ multiple `g` found + | +note: candidate #1 is defined in an impl for the type `C` + --> $DIR/arbitrary_self_types_unshadowing_ptrs.rs:28:5 + | +LL | pub fn g(self: &mut Wrapper<Self>) -> i32 { 11 } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +note: candidate #2 is defined in an impl for the type `Wrapper<T>` + --> $DIR/arbitrary_self_types_unshadowing_ptrs.rs:39:5 + | +LL | pub fn g(&self) -> i32 { 6 } + | ^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 7 previous errors + +For more information about this error, try `rustc --explain E0034`. diff --git a/tests/ui/self/conflicting_inner.rs b/tests/ui/self/conflicting_inner.rs new file mode 100644 index 00000000000..1a7037dce73 --- /dev/null +++ b/tests/ui/self/conflicting_inner.rs @@ -0,0 +1,38 @@ +//@ run-pass +//@ revisions: default feature +#![cfg_attr(feature, feature(arbitrary_self_types))] + +// This test aims to be like the IndexVec within rustc, and conflicts +// over its into_iter(). + +#[allow(dead_code)] +trait Foo { + fn foo(self) -> usize; +} + +struct IndexVec<T>(T); + +impl<T> std::ops::Deref for IndexVec<T> { + type Target = T; + + fn deref(&self) -> &Self::Target { + &self.0 + } +} + +impl<'a, T> Foo for &'a IndexVec<T> { + fn foo(self) -> usize { + 2 + } +} + +impl<T> IndexVec<T> { + fn foo(self) -> usize { + 1 + } +} + +fn main() { + let ivec = IndexVec(0usize); + assert_eq!(ivec.foo(), 1); +} diff --git a/tests/ui/self/conflicting_inner2.rs b/tests/ui/self/conflicting_inner2.rs new file mode 100644 index 00000000000..e6a6b5ef793 --- /dev/null +++ b/tests/ui/self/conflicting_inner2.rs @@ -0,0 +1,63 @@ +//@ run-pass +//@ revisions: default feature +#![cfg_attr(feature, feature(arbitrary_self_types))] + +use std::pin::Pin; +use std::ops::DerefMut; +use std::marker::Unpin; + +struct TryChunks; + +impl TryChunks { + #[allow(dead_code)] + fn take(self: std::pin::Pin<&mut Self>) -> usize { + 1 + } +} + +#[allow(dead_code)] +trait Stream { + fn poll_next(self: std::pin::Pin<&mut Self>); +} + +#[allow(dead_code)] +trait StreamExt: Stream { + #[allow(dead_code)] + fn take(self) -> usize where Self: Sized + { + 2 + } +} + +impl<T: ?Sized> StreamExt for T where T: Stream {} + +impl Stream for TryChunks { + fn poll_next(self: std::pin::Pin<&mut Self>) { + assert_eq!(self.take(), 1); + } +} + +#[allow(dead_code)] +impl<S: ?Sized + Stream + Unpin> Stream for &mut S { + #[allow(dead_code)] + fn poll_next(mut self: Pin<&mut Self>) { + S::poll_next(Pin::new(&mut **self)) + } +} + +#[allow(dead_code)] +impl<P> Stream for Pin<P> +where + P: DerefMut + Unpin, + P::Target: Stream, +{ + #[allow(dead_code)] + fn poll_next(self: Pin<&mut Self>) { + self.get_mut().as_mut().poll_next() + } +} + +fn main() { + let mut item = Box::pin(TryChunks); + item.as_mut().poll_next(); +} diff --git a/tests/ui/span/issue-27522.stderr b/tests/ui/span/issue-27522.stderr index c57a100bbe2..04904b0ddc1 100644 --- a/tests/ui/span/issue-27522.stderr +++ b/tests/ui/span/issue-27522.stderr @@ -4,8 +4,8 @@ error[E0307]: invalid `self` parameter type: `&SomeType` LL | fn handler(self: &SomeType); | ^^^^^^^^^ | - = note: type of `self` must be `Self` or a type that dereferences to it - = help: consider changing to `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`) + = note: type of `self` must be `Self` or some type implementing `Receiver` + = help: consider changing to `self`, `&self`, `&mut self`, or a type implementing `Receiver` such as `self: Box<Self>`, `self: Rc<Self>`, or `self: Arc<Self>` error: aborting due to 1 previous error diff --git a/tests/ui/specialization/const_trait_impl.stderr b/tests/ui/specialization/const_trait_impl.stderr index 607fc06823e..3e1260ff09c 100644 --- a/tests/ui/specialization/const_trait_impl.stderr +++ b/tests/ui/specialization/const_trait_impl.stderr @@ -2,42 +2,57 @@ error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/const_trait_impl.rs:34:9 | LL | impl<T: ~const Default> const A for T { - | ^^^^^^ + | ^^^^^^ can't be applied to `Default` + | +note: `Default` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/default.rs:LL:COL error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/const_trait_impl.rs:40:9 | LL | impl<T: ~const Default + ~const Sup> const A for T { - | ^^^^^^ + | ^^^^^^ can't be applied to `Default` + | +note: `Default` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/default.rs:LL:COL error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/const_trait_impl.rs:46:9 | LL | impl<T: ~const Default + ~const Sub> const A for T { - | ^^^^^^ + | ^^^^^^ can't be applied to `Default` + | +note: `Default` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/default.rs:LL:COL error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/const_trait_impl.rs:40:9 | LL | impl<T: ~const Default + ~const Sup> const A for T { - | ^^^^^^ + | ^^^^^^ can't be applied to `Default` | +note: `Default` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/default.rs:LL:COL = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/const_trait_impl.rs:34:9 | LL | impl<T: ~const Default> const A for T { - | ^^^^^^ + | ^^^^^^ can't be applied to `Default` | +note: `Default` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/default.rs:LL:COL = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/const_trait_impl.rs:46:9 | LL | impl<T: ~const Default + ~const Sub> const A for T { - | ^^^^^^ + | ^^^^^^ can't be applied to `Default` | +note: `Default` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/default.rs:LL:COL = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: aborting due to 6 previous errors diff --git a/tests/ui/structs/default-field-values-support.rs b/tests/ui/structs/default-field-values-support.rs index da0379af94b..8209d6dd4a0 100644 --- a/tests/ui/structs/default-field-values-support.rs +++ b/tests/ui/structs/default-field-values-support.rs @@ -1,18 +1,23 @@ +// Exercise the `default_field_values` feature to confirm it interacts correctly with other nightly +// features. In particular, we want to verify that interaction with consts coming from different +// contexts are usable as a default field value. //@ run-pass //@ aux-build:struct_field_default.rs -#![feature(default_field_values, generic_const_exprs)] +#![feature(const_trait_impl, default_field_values, generic_const_exprs)] #![allow(unused_variables, dead_code, incomplete_features)] extern crate struct_field_default as xc; pub struct S; +// Basic expressions and `Default` expansion #[derive(Default)] pub struct Foo { pub bar: S = S, pub baz: i32 = 42 + 3, } +// Enum support for deriving `Default` when all fields have default values #[derive(Default)] pub enum Bar { #[default] @@ -22,17 +27,27 @@ pub enum Bar { } } -#[derive(Default)] -pub struct Qux<A, const C: i32> { - bar: S = Qux::<A, C>::S, - baz: i32 = foo(), - bat: i32 = <Qux<A, C> as T>::K, - baq: i32 = Self::K, - bay: i32 = C, - bak: Vec<A> = Vec::new(), +#[const_trait] pub trait ConstDefault { + fn value() -> Self; +} + +impl const ConstDefault for i32 { + fn value() -> i32 { + 101 + } +} + +pub struct Qux<A, const C: i32, X: const ConstDefault> { + bar: S = Qux::<A, C, X>::S, // Associated constant from inherent impl + baz: i32 = foo(), // Constant function + bat: i32 = <Qux<A, C, X> as T>::K, // Associated constant from explicit trait + baq: i32 = Self::K, // Associated constant from implicit trait + bay: i32 = C, // `const` parameter + bak: Vec<A> = Vec::new(), // Associated constant function + ban: X = X::value(), // Associated constant function from `const` trait parameter } -impl<A, const C: i32> Qux<A, C> { +impl<A, const C: i32, X: const ConstDefault> Qux<A, C, X> { const S: S = S; } @@ -40,7 +55,7 @@ trait T { const K: i32; } -impl<A, const C: i32> T for Qux<A, C> { +impl<A, const C: i32, X: const ConstDefault> T for Qux<A, C, X> { const K: i32 = 2; } @@ -65,8 +80,19 @@ fn main () { assert!(matches!(Bar::Foo { bar: S, baz: 45 }, y)); assert!(matches!(Bar::Foo { bar: S, baz: 1 }, z)); - let x = Qux::<i32, 4> { .. }; - assert!(matches!(Qux::<i32, 4> { bar: S, baz: 42, bat: 2, baq: 2, bay: 4, .. }, x)); + let x = Qux::<i32, 4, i32> { .. }; + assert!(matches!( + Qux::<i32, 4, i32> { + bar: S, + baz: 42, + bat: 2, + baq: 2, + bay: 4, + ban: 101, + .. + }, + x, + )); assert!(x.bak.is_empty()); let x = xc::A { .. }; diff --git a/tests/ui/suggestions/async-fn-ctor-passed-as-arg-where-it-should-have-been-called.rs b/tests/ui/suggestions/async-fn-ctor-passed-as-arg-where-it-should-have-been-called.rs index 11ed167b44a..8e67f4e7398 100644 --- a/tests/ui/suggestions/async-fn-ctor-passed-as-arg-where-it-should-have-been-called.rs +++ b/tests/ui/suggestions/async-fn-ctor-passed-as-arg-where-it-should-have-been-called.rs @@ -1,5 +1,4 @@ //@ edition:2018 -#![feature(async_closure)] use std::future::Future; async fn foo() {} diff --git a/tests/ui/suggestions/async-fn-ctor-passed-as-arg-where-it-should-have-been-called.stderr b/tests/ui/suggestions/async-fn-ctor-passed-as-arg-where-it-should-have-been-called.stderr index a040e71cf3b..696b156d5a5 100644 --- a/tests/ui/suggestions/async-fn-ctor-passed-as-arg-where-it-should-have-been-called.stderr +++ b/tests/ui/suggestions/async-fn-ctor-passed-as-arg-where-it-should-have-been-called.stderr @@ -1,5 +1,5 @@ error[E0277]: `fn() -> impl Future<Output = ()> {foo}` is not a future - --> $DIR/async-fn-ctor-passed-as-arg-where-it-should-have-been-called.rs:10:9 + --> $DIR/async-fn-ctor-passed-as-arg-where-it-should-have-been-called.rs:9:9 | LL | bar(foo); | --- ^^^ `fn() -> impl Future<Output = ()> {foo}` is not a future @@ -8,7 +8,7 @@ LL | bar(foo); | = help: the trait `Future` is not implemented for fn item `fn() -> impl Future<Output = ()> {foo}` note: required by a bound in `bar` - --> $DIR/async-fn-ctor-passed-as-arg-where-it-should-have-been-called.rs:7:16 + --> $DIR/async-fn-ctor-passed-as-arg-where-it-should-have-been-called.rs:6:16 | LL | fn bar(f: impl Future<Output=()>) {} | ^^^^^^^^^^^^^^^^^ required by this bound in `bar` @@ -17,17 +17,17 @@ help: use parentheses to call this function LL | bar(foo()); | ++ -error[E0277]: `{async closure@$DIR/async-fn-ctor-passed-as-arg-where-it-should-have-been-called.rs:11:25: 11:33}` is not a future - --> $DIR/async-fn-ctor-passed-as-arg-where-it-should-have-been-called.rs:12:9 +error[E0277]: `{async closure@$DIR/async-fn-ctor-passed-as-arg-where-it-should-have-been-called.rs:10:25: 10:33}` is not a future + --> $DIR/async-fn-ctor-passed-as-arg-where-it-should-have-been-called.rs:11:9 | LL | bar(async_closure); - | --- ^^^^^^^^^^^^^ `{async closure@$DIR/async-fn-ctor-passed-as-arg-where-it-should-have-been-called.rs:11:25: 11:33}` is not a future + | --- ^^^^^^^^^^^^^ `{async closure@$DIR/async-fn-ctor-passed-as-arg-where-it-should-have-been-called.rs:10:25: 10:33}` is not a future | | | required by a bound introduced by this call | - = help: the trait `Future` is not implemented for `{async closure@$DIR/async-fn-ctor-passed-as-arg-where-it-should-have-been-called.rs:11:25: 11:33}` + = help: the trait `Future` is not implemented for `{async closure@$DIR/async-fn-ctor-passed-as-arg-where-it-should-have-been-called.rs:10:25: 10:33}` note: required by a bound in `bar` - --> $DIR/async-fn-ctor-passed-as-arg-where-it-should-have-been-called.rs:7:16 + --> $DIR/async-fn-ctor-passed-as-arg-where-it-should-have-been-called.rs:6:16 | LL | fn bar(f: impl Future<Output=()>) {} | ^^^^^^^^^^^^^^^^^ required by this bound in `bar` diff --git a/tests/ui/suggestions/dyn-incompatible-trait-should-use-where-sized.stderr b/tests/ui/suggestions/dyn-incompatible-trait-should-use-where-sized.stderr index beafd7c2ab0..eb9f9196a72 100644 --- a/tests/ui/suggestions/dyn-incompatible-trait-should-use-where-sized.stderr +++ b/tests/ui/suggestions/dyn-incompatible-trait-should-use-where-sized.stderr @@ -32,8 +32,8 @@ error[E0307]: invalid `self` parameter type: `()` LL | fn bar(self: ()) {} | ^^ | - = note: type of `self` must be `Self` or a type that dereferences to it - = help: consider changing to `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`) + = note: type of `self` must be `Self` or some type implementing `Receiver` + = help: consider changing to `self`, `&self`, `&mut self`, or a type implementing `Receiver` such as `self: Box<Self>`, `self: Rc<Self>`, or `self: Arc<Self>` error: aborting due to 2 previous errors diff --git a/tests/ui/suggestions/method-missing-parentheses.rs b/tests/ui/suggestions/method-missing-parentheses.rs index f10bfb56d2e..bc576b71f0d 100644 --- a/tests/ui/suggestions/method-missing-parentheses.rs +++ b/tests/ui/suggestions/method-missing-parentheses.rs @@ -1,5 +1,4 @@ fn main() { let _ = vec![].into_iter().collect::<usize>; //~^ ERROR attempted to take value of method `collect` on type `std::vec::IntoIter<_>` - //~| ERROR field expressions cannot have generic arguments } diff --git a/tests/ui/suggestions/method-missing-parentheses.stderr b/tests/ui/suggestions/method-missing-parentheses.stderr index 1bfff56a6a9..f0ff1f0334a 100644 --- a/tests/ui/suggestions/method-missing-parentheses.stderr +++ b/tests/ui/suggestions/method-missing-parentheses.stderr @@ -1,9 +1,3 @@ -error: field expressions cannot have generic arguments - --> $DIR/method-missing-parentheses.rs:2:41 - | -LL | let _ = vec![].into_iter().collect::<usize>; - | ^^^^^^^ - error[E0615]: attempted to take value of method `collect` on type `std::vec::IntoIter<_>` --> $DIR/method-missing-parentheses.rs:2:32 | @@ -15,6 +9,6 @@ help: use parentheses to call the method LL | let _ = vec![].into_iter().collect::<usize>(); | ++ -error: aborting due to 2 previous errors +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0615`. diff --git a/tests/ui/suggestions/suggest-boxed-empty-block.fixed b/tests/ui/suggestions/suggest-boxed-empty-block.fixed index 25cb4dc74b1..a43e4405a76 100644 --- a/tests/ui/suggestions/suggest-boxed-empty-block.fixed +++ b/tests/ui/suggestions/suggest-boxed-empty-block.fixed @@ -1,5 +1,3 @@ -#![feature(async_closure)] - //@ edition:2021 //@ run-rustfix diff --git a/tests/ui/suggestions/suggest-boxed-empty-block.rs b/tests/ui/suggestions/suggest-boxed-empty-block.rs index 9a8d6498fb1..47fb08e4d11 100644 --- a/tests/ui/suggestions/suggest-boxed-empty-block.rs +++ b/tests/ui/suggestions/suggest-boxed-empty-block.rs @@ -1,5 +1,3 @@ -#![feature(async_closure)] - //@ edition:2021 //@ run-rustfix diff --git a/tests/ui/suggestions/suggest-boxed-empty-block.stderr b/tests/ui/suggestions/suggest-boxed-empty-block.stderr index 474a37b888f..e4602341c1f 100644 --- a/tests/ui/suggestions/suggest-boxed-empty-block.stderr +++ b/tests/ui/suggestions/suggest-boxed-empty-block.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/suggest-boxed-empty-block.rs:10:9 + --> $DIR/suggest-boxed-empty-block.rs:8:9 | LL | foo({}); | ^^ expected `Box<_>`, found `()` @@ -14,7 +14,7 @@ LL + foo(Box::new(())); | error[E0308]: mismatched types - --> $DIR/suggest-boxed-empty-block.rs:11:12 + --> $DIR/suggest-boxed-empty-block.rs:9:12 | LL | bar(|| {}); | ^^ expected `Box<_>`, found `()` diff --git a/tests/ui/suggestions/suggest-on-bare-closure-call.rs b/tests/ui/suggestions/suggest-on-bare-closure-call.rs index 046fe4803ec..1e6b422de5e 100644 --- a/tests/ui/suggestions/suggest-on-bare-closure-call.rs +++ b/tests/ui/suggestions/suggest-on-bare-closure-call.rs @@ -1,7 +1,5 @@ //@ edition:2021 -#![feature(async_closure)] - fn main() { let _ = ||{}(); //~^ ERROR expected function, found `()` diff --git a/tests/ui/suggestions/suggest-on-bare-closure-call.stderr b/tests/ui/suggestions/suggest-on-bare-closure-call.stderr index e65a6eb4939..7bbb24aa622 100644 --- a/tests/ui/suggestions/suggest-on-bare-closure-call.stderr +++ b/tests/ui/suggestions/suggest-on-bare-closure-call.stderr @@ -1,5 +1,5 @@ error[E0618]: expected function, found `()` - --> $DIR/suggest-on-bare-closure-call.rs:6:15 + --> $DIR/suggest-on-bare-closure-call.rs:4:15 | LL | let _ = ||{}(); | ^^-- @@ -12,7 +12,7 @@ LL | let _ = (||{})(); | + + error[E0618]: expected function, found `()` - --> $DIR/suggest-on-bare-closure-call.rs:9:21 + --> $DIR/suggest-on-bare-closure-call.rs:7:21 | LL | let _ = async ||{}(); | ^^-- diff --git a/tests/ui/target-feature/allowed-softfloat-target-feature-attribute.rs b/tests/ui/target-feature/allowed-softfloat-target-feature-attribute.rs new file mode 100644 index 00000000000..8b60820cc9b --- /dev/null +++ b/tests/ui/target-feature/allowed-softfloat-target-feature-attribute.rs @@ -0,0 +1,11 @@ +//@ compile-flags: --target=x86_64-unknown-none --crate-type=lib +//@ needs-llvm-components: x86 +//@ build-pass +#![feature(no_core, lang_items, x87_target_feature)] +#![no_core] + +#[lang = "sized"] +pub trait Sized {} + +#[target_feature(enable = "x87")] +pub unsafe fn my_fun() {} diff --git a/tests/ui/target-feature/allowed-softfloat-target-feature-flag-disable.rs b/tests/ui/target-feature/allowed-softfloat-target-feature-flag-disable.rs new file mode 100644 index 00000000000..e34faf5a983 --- /dev/null +++ b/tests/ui/target-feature/allowed-softfloat-target-feature-flag-disable.rs @@ -0,0 +1,9 @@ +//@ compile-flags: --target=x86_64-unknown-none --crate-type=lib +//@ needs-llvm-components: x86 +//@ compile-flags: -Ctarget-feature=-x87 +//@ build-pass +#![feature(no_core, lang_items)] +#![no_core] + +#[lang = "sized"] +pub trait Sized {} diff --git a/tests/ui/target-feature/allowed-softfloat-target-feature-flag-disable.stderr b/tests/ui/target-feature/allowed-softfloat-target-feature-flag-disable.stderr new file mode 100644 index 00000000000..309b64afd92 --- /dev/null +++ b/tests/ui/target-feature/allowed-softfloat-target-feature-flag-disable.stderr @@ -0,0 +1,6 @@ +warning: unstable feature specified for `-Ctarget-feature`: `x87` + | + = note: this feature is not stably supported; its behavior can change in the future + +warning: 1 warning emitted + diff --git a/tests/ui/target-feature/forbidden-hardfloat-target-feature-attribute.rs b/tests/ui/target-feature/forbidden-hardfloat-target-feature-attribute.rs new file mode 100644 index 00000000000..b3171d52c51 --- /dev/null +++ b/tests/ui/target-feature/forbidden-hardfloat-target-feature-attribute.rs @@ -0,0 +1,11 @@ +//@ compile-flags: --target=x86_64-unknown-linux-gnu --crate-type=lib +//@ needs-llvm-components: x86 +#![feature(no_core, lang_items)] +#![no_core] + +#[lang = "sized"] +pub trait Sized {} + +#[target_feature(enable = "x87")] +//~^ERROR: cannot be toggled with +pub unsafe fn my_fun() {} diff --git a/tests/ui/target-feature/forbidden-hardfloat-target-feature-attribute.stderr b/tests/ui/target-feature/forbidden-hardfloat-target-feature-attribute.stderr new file mode 100644 index 00000000000..3ebbe69d8ae --- /dev/null +++ b/tests/ui/target-feature/forbidden-hardfloat-target-feature-attribute.stderr @@ -0,0 +1,8 @@ +error: target feature `x87` cannot be toggled with `#[target_feature]`: unsound on hard-float targets because it changes float ABI + --> $DIR/forbidden-hardfloat-target-feature-attribute.rs:9:18 + | +LL | #[target_feature(enable = "x87")] + | ^^^^^^^^^^^^^^ + +error: aborting due to 1 previous error + diff --git a/tests/ui/target-feature/forbidden-hardfloat-target-feature-cfg.rs b/tests/ui/target-feature/forbidden-hardfloat-target-feature-cfg.rs new file mode 100644 index 00000000000..8755791c1c0 --- /dev/null +++ b/tests/ui/target-feature/forbidden-hardfloat-target-feature-cfg.rs @@ -0,0 +1,14 @@ +//@ compile-flags: --target=x86_64-unknown-linux-gnu --crate-type=lib +//@ needs-llvm-components: x86 +//@ check-pass +#![feature(no_core, lang_items)] +#![no_core] +#![allow(unexpected_cfgs)] + +#[lang = "sized"] +pub trait Sized {} + +// The compile_error macro does not exist, so if the `cfg` evaluates to `true` this +// complains about the missing macro rather than showing the error... but that's good enough. +#[cfg(not(target_feature = "x87"))] +compile_error!("the x87 feature *should* be exposed in `cfg`"); diff --git a/tests/ui/target-feature/forbidden-hardfloat-target-feature-flag-disable.rs b/tests/ui/target-feature/forbidden-hardfloat-target-feature-flag-disable.rs new file mode 100644 index 00000000000..fd8023664da --- /dev/null +++ b/tests/ui/target-feature/forbidden-hardfloat-target-feature-flag-disable.rs @@ -0,0 +1,10 @@ +//@ compile-flags: --target=x86_64-unknown-linux-gnu --crate-type=lib +//@ needs-llvm-components: x86 +//@ compile-flags: -Ctarget-feature=-x87 +// For now this is just a warning. +//@ build-pass +#![feature(no_core, lang_items)] +#![no_core] + +#[lang = "sized"] +pub trait Sized {} diff --git a/tests/ui/target-feature/forbidden-hardfloat-target-feature-flag-disable.stderr b/tests/ui/target-feature/forbidden-hardfloat-target-feature-flag-disable.stderr new file mode 100644 index 00000000000..604ad2f991a --- /dev/null +++ b/tests/ui/target-feature/forbidden-hardfloat-target-feature-flag-disable.stderr @@ -0,0 +1,7 @@ +warning: target feature `x87` cannot be toggled with `-Ctarget-feature`: unsound on hard-float targets because it changes float ABI + | + = note: 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 #116344 <https://github.com/rust-lang/rust/issues/116344> + +warning: 1 warning emitted + diff --git a/tests/ui/target-feature/forbidden-target-feature-attribute.rs b/tests/ui/target-feature/forbidden-target-feature-attribute.rs index 91c56b43689..f13cdd17da6 100644 --- a/tests/ui/target-feature/forbidden-target-feature-attribute.rs +++ b/tests/ui/target-feature/forbidden-target-feature-attribute.rs @@ -1,7 +1,6 @@ //@ compile-flags: --target=x86_64-unknown-linux-gnu --crate-type=lib //@ needs-llvm-components: x86 #![feature(no_core, lang_items)] -#![no_std] #![no_core] #[lang = "sized"] diff --git a/tests/ui/target-feature/forbidden-target-feature-attribute.stderr b/tests/ui/target-feature/forbidden-target-feature-attribute.stderr index fb318531f7e..27ac4aaf960 100644 --- a/tests/ui/target-feature/forbidden-target-feature-attribute.stderr +++ b/tests/ui/target-feature/forbidden-target-feature-attribute.stderr @@ -1,5 +1,5 @@ error: target feature `soft-float` cannot be toggled with `#[target_feature]`: unsound because it changes float ABI - --> $DIR/forbidden-target-feature-attribute.rs:10:18 + --> $DIR/forbidden-target-feature-attribute.rs:9:18 | LL | #[target_feature(enable = "soft-float")] | ^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/target-feature/forbidden-target-feature-cfg.rs b/tests/ui/target-feature/forbidden-target-feature-cfg.rs index 5df26e26793..1f001e9f8ff 100644 --- a/tests/ui/target-feature/forbidden-target-feature-cfg.rs +++ b/tests/ui/target-feature/forbidden-target-feature-cfg.rs @@ -2,7 +2,6 @@ //@ needs-llvm-components: x86 //@ check-pass #![feature(no_core, lang_items)] -#![no_std] #![no_core] #![allow(unexpected_cfgs)] diff --git a/tests/ui/target-feature/forbidden-target-feature-flag-disable.rs b/tests/ui/target-feature/forbidden-target-feature-flag-disable.rs index b27e8a10afe..b09c53bd46a 100644 --- a/tests/ui/target-feature/forbidden-target-feature-flag-disable.rs +++ b/tests/ui/target-feature/forbidden-target-feature-flag-disable.rs @@ -4,7 +4,6 @@ // For now this is just a warning. //@ build-pass #![feature(no_core, lang_items)] -#![no_std] #![no_core] #[lang = "sized"] diff --git a/tests/ui/target-feature/forbidden-target-feature-flag.rs b/tests/ui/target-feature/forbidden-target-feature-flag.rs index 93cebc6b536..0f688fde7f4 100644 --- a/tests/ui/target-feature/forbidden-target-feature-flag.rs +++ b/tests/ui/target-feature/forbidden-target-feature-flag.rs @@ -4,7 +4,6 @@ // For now this is just a warning. //@ build-pass #![feature(no_core, lang_items)] -#![no_std] #![no_core] #[lang = "sized"] diff --git a/tests/ui/target-feature/gate.rs b/tests/ui/target-feature/gate.rs index f35fbd11155..2626685fa0a 100644 --- a/tests/ui/target-feature/gate.rs +++ b/tests/ui/target-feature/gate.rs @@ -24,6 +24,7 @@ // gate-test-prfchw_target_feature // gate-test-s390x_target_feature // gate-test-sparc_target_feature +// gate-test-x87_target_feature #[target_feature(enable = "avx512bw")] //~^ ERROR: currently unstable diff --git a/tests/ui/target-feature/gate.stderr b/tests/ui/target-feature/gate.stderr index b84bab370be..ba5ae79f942 100644 --- a/tests/ui/target-feature/gate.stderr +++ b/tests/ui/target-feature/gate.stderr @@ -1,5 +1,5 @@ error[E0658]: the target feature `avx512bw` is currently unstable - --> $DIR/gate.rs:28:18 + --> $DIR/gate.rs:29:18 | LL | #[target_feature(enable = "avx512bw")] | ^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/traits/const-traits/call-const-trait-method-pass.stderr b/tests/ui/traits/const-traits/call-const-trait-method-pass.stderr index 1e48a0331cc..ef494bde98c 100644 --- a/tests/ui/traits/const-traits/call-const-trait-method-pass.stderr +++ b/tests/ui/traits/const-traits/call-const-trait-method-pass.stderr @@ -2,7 +2,7 @@ error: const `impl` for trait `PartialEq` which is not marked with `#[const_trai --> $DIR/call-const-trait-method-pass.rs:15:12 | LL | impl const PartialEq for Int { - | ^^^^^^^^^ + | ^^^^^^^^^ this trait is not `const` | = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const` = note: adding a non-const method body in the future would be a breaking change diff --git a/tests/ui/traits/const-traits/call-generic-in-impl.stderr b/tests/ui/traits/const-traits/call-generic-in-impl.stderr index 52ee04425b2..58d0997f5a3 100644 --- a/tests/ui/traits/const-traits/call-generic-in-impl.stderr +++ b/tests/ui/traits/const-traits/call-generic-in-impl.stderr @@ -2,14 +2,19 @@ error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/call-generic-in-impl.rs:10:9 | LL | impl<T: ~const PartialEq> const MyPartialEq for T { - | ^^^^^^ + | ^^^^^^ can't be applied to `PartialEq` + | +note: `PartialEq` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/cmp.rs:LL:COL error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/call-generic-in-impl.rs:10:9 | LL | impl<T: ~const PartialEq> const MyPartialEq for T { - | ^^^^^^ + | ^^^^^^ can't be applied to `PartialEq` | +note: `PartialEq` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/cmp.rs:LL:COL = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error[E0015]: cannot call non-const fn `<T as PartialEq>::eq` in constant functions diff --git a/tests/ui/traits/const-traits/call-generic-method-chain.stderr b/tests/ui/traits/const-traits/call-generic-method-chain.stderr index 21fb19daad4..d7a2a186494 100644 --- a/tests/ui/traits/const-traits/call-generic-method-chain.stderr +++ b/tests/ui/traits/const-traits/call-generic-method-chain.stderr @@ -2,7 +2,7 @@ error: const `impl` for trait `PartialEq` which is not marked with `#[const_trai --> $DIR/call-generic-method-chain.rs:11:12 | LL | impl const PartialEq for S { - | ^^^^^^^^^ + | ^^^^^^^^^ this trait is not `const` | = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const` = note: adding a non-const method body in the future would be a breaking change @@ -11,28 +11,38 @@ error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/call-generic-method-chain.rs:20:25 | LL | const fn equals_self<T: ~const PartialEq>(t: &T) -> bool { - | ^^^^^^ + | ^^^^^^ can't be applied to `PartialEq` + | +note: `PartialEq` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/cmp.rs:LL:COL error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/call-generic-method-chain.rs:20:25 | LL | const fn equals_self<T: ~const PartialEq>(t: &T) -> bool { - | ^^^^^^ + | ^^^^^^ can't be applied to `PartialEq` | +note: `PartialEq` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/cmp.rs:LL:COL = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/call-generic-method-chain.rs:24:33 | LL | const fn equals_self_wrapper<T: ~const PartialEq>(t: &T) -> bool { - | ^^^^^^ + | ^^^^^^ can't be applied to `PartialEq` + | +note: `PartialEq` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/cmp.rs:LL:COL error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/call-generic-method-chain.rs:24:33 | LL | const fn equals_self_wrapper<T: ~const PartialEq>(t: &T) -> bool { - | ^^^^^^ + | ^^^^^^ can't be applied to `PartialEq` | +note: `PartialEq` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/cmp.rs:LL:COL = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error[E0015]: cannot call non-const operator in constant functions diff --git a/tests/ui/traits/const-traits/call-generic-method-dup-bound.stderr b/tests/ui/traits/const-traits/call-generic-method-dup-bound.stderr index 845949a38bf..90465d0a5b2 100644 --- a/tests/ui/traits/const-traits/call-generic-method-dup-bound.stderr +++ b/tests/ui/traits/const-traits/call-generic-method-dup-bound.stderr @@ -2,7 +2,7 @@ error: const `impl` for trait `PartialEq` which is not marked with `#[const_trai --> $DIR/call-generic-method-dup-bound.rs:9:12 | LL | impl const PartialEq for S { - | ^^^^^^^^^ + | ^^^^^^^^^ this trait is not `const` | = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const` = note: adding a non-const method body in the future would be a breaking change @@ -11,28 +11,38 @@ error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/call-generic-method-dup-bound.rs:20:37 | LL | const fn equals_self<T: PartialEq + ~const PartialEq>(t: &T) -> bool { - | ^^^^^^ + | ^^^^^^ can't be applied to `PartialEq` + | +note: `PartialEq` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/cmp.rs:LL:COL error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/call-generic-method-dup-bound.rs:20:37 | LL | const fn equals_self<T: PartialEq + ~const PartialEq>(t: &T) -> bool { - | ^^^^^^ + | ^^^^^^ can't be applied to `PartialEq` | +note: `PartialEq` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/cmp.rs:LL:COL = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/call-generic-method-dup-bound.rs:27:30 | LL | const fn equals_self2<T: A + ~const PartialEq>(t: &T) -> bool { - | ^^^^^^ + | ^^^^^^ can't be applied to `PartialEq` + | +note: `PartialEq` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/cmp.rs:LL:COL error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/call-generic-method-dup-bound.rs:27:30 | LL | const fn equals_self2<T: A + ~const PartialEq>(t: &T) -> bool { - | ^^^^^^ + | ^^^^^^ can't be applied to `PartialEq` | +note: `PartialEq` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/cmp.rs:LL:COL = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error[E0015]: cannot call non-const operator in constant functions diff --git a/tests/ui/traits/const-traits/call-generic-method-pass.stderr b/tests/ui/traits/const-traits/call-generic-method-pass.stderr index 0c0037e36b8..a7626a4e99d 100644 --- a/tests/ui/traits/const-traits/call-generic-method-pass.stderr +++ b/tests/ui/traits/const-traits/call-generic-method-pass.stderr @@ -2,7 +2,7 @@ error: const `impl` for trait `PartialEq` which is not marked with `#[const_trai --> $DIR/call-generic-method-pass.rs:11:12 | LL | impl const PartialEq for S { - | ^^^^^^^^^ + | ^^^^^^^^^ this trait is not `const` | = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const` = note: adding a non-const method body in the future would be a breaking change @@ -11,14 +11,19 @@ error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/call-generic-method-pass.rs:20:25 | LL | const fn equals_self<T: ~const PartialEq>(t: &T) -> bool { - | ^^^^^^ + | ^^^^^^ can't be applied to `PartialEq` + | +note: `PartialEq` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/cmp.rs:LL:COL error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/call-generic-method-pass.rs:20:25 | LL | const fn equals_self<T: ~const PartialEq>(t: &T) -> bool { - | ^^^^^^ + | ^^^^^^ can't be applied to `PartialEq` | +note: `PartialEq` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/cmp.rs:LL:COL = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error[E0015]: cannot call non-const operator in constant functions diff --git a/tests/ui/traits/const-traits/const-bounds-non-const-trait.stderr b/tests/ui/traits/const-traits/const-bounds-non-const-trait.stderr index 2436c97ccf2..f97d3a9181e 100644 --- a/tests/ui/traits/const-traits/const-bounds-non-const-trait.stderr +++ b/tests/ui/traits/const-traits/const-bounds-non-const-trait.stderr @@ -2,21 +2,35 @@ error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/const-bounds-non-const-trait.rs:6:21 | LL | const fn perform<T: ~const NonConst>() {} - | ^^^^^^ + | ^^^^^^ can't be applied to `NonConst` + | +help: mark `NonConst` as `#[const_trait]` to allow it to have `const` implementations + | +LL | #[const_trait] trait NonConst {} + | ++++++++++++++ error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/const-bounds-non-const-trait.rs:6:21 | LL | const fn perform<T: ~const NonConst>() {} - | ^^^^^^ + | ^^^^^^ can't be applied to `NonConst` | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: mark `NonConst` as `#[const_trait]` to allow it to have `const` implementations + | +LL | #[const_trait] trait NonConst {} + | ++++++++++++++ error: `const` can only be applied to `#[const_trait]` traits --> $DIR/const-bounds-non-const-trait.rs:10:15 | LL | fn operate<T: const NonConst>() {} - | ^^^^^ + | ^^^^^ can't be applied to `NonConst` + | +help: mark `NonConst` as `#[const_trait]` to allow it to have `const` implementations + | +LL | #[const_trait] trait NonConst {} + | ++++++++++++++ error: aborting due to 3 previous errors diff --git a/tests/ui/traits/const-traits/const-closure-parse-not-item.stderr b/tests/ui/traits/const-traits/const-closure-parse-not-item.stderr index 0970cd5225f..57afa2257b7 100644 --- a/tests/ui/traits/const-traits/const-closure-parse-not-item.stderr +++ b/tests/ui/traits/const-traits/const-closure-parse-not-item.stderr @@ -2,22 +2,29 @@ error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/const-closure-parse-not-item.rs:7:25 | LL | const fn test() -> impl ~const Fn() { - | ^^^^^^ + | ^^^^^^ can't be applied to `Fn` + | +note: `Fn` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/ops/function.rs:LL:COL error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/const-closure-parse-not-item.rs:7:25 | LL | const fn test() -> impl ~const Fn() { - | ^^^^^^ + | ^^^^^^ can't be applied to `Fn` | +note: `Fn` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/ops/function.rs:LL:COL = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/const-closure-parse-not-item.rs:7:25 | LL | const fn test() -> impl ~const Fn() { - | ^^^^^^ + | ^^^^^^ can't be applied to `Fn` | +note: `Fn` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/ops/function.rs:LL:COL = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: aborting due to 3 previous errors diff --git a/tests/ui/traits/const-traits/const-closure-trait-method-fail.stderr b/tests/ui/traits/const-traits/const-closure-trait-method-fail.stderr index a76dc3e82af..2a97846ccb4 100644 --- a/tests/ui/traits/const-traits/const-closure-trait-method-fail.stderr +++ b/tests/ui/traits/const-traits/const-closure-trait-method-fail.stderr @@ -2,14 +2,19 @@ error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/const-closure-trait-method-fail.rs:14:32 | LL | const fn need_const_closure<T: ~const FnOnce(()) -> i32>(x: T) -> i32 { - | ^^^^^^ + | ^^^^^^ can't be applied to `FnOnce` + | +note: `FnOnce` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/ops/function.rs:LL:COL error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/const-closure-trait-method-fail.rs:14:32 | LL | const fn need_const_closure<T: ~const FnOnce(()) -> i32>(x: T) -> i32 { - | ^^^^^^ + | ^^^^^^ can't be applied to `FnOnce` | +note: `FnOnce` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/ops/function.rs:LL:COL = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error[E0015]: cannot call non-const closure in constant functions diff --git a/tests/ui/traits/const-traits/const-closure-trait-method.stderr b/tests/ui/traits/const-traits/const-closure-trait-method.stderr index d37ff3d727c..9c63b7e63a6 100644 --- a/tests/ui/traits/const-traits/const-closure-trait-method.stderr +++ b/tests/ui/traits/const-traits/const-closure-trait-method.stderr @@ -2,14 +2,19 @@ error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/const-closure-trait-method.rs:14:32 | LL | const fn need_const_closure<T: ~const FnOnce(()) -> i32>(x: T) -> i32 { - | ^^^^^^ + | ^^^^^^ can't be applied to `FnOnce` + | +note: `FnOnce` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/ops/function.rs:LL:COL error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/const-closure-trait-method.rs:14:32 | LL | const fn need_const_closure<T: ~const FnOnce(()) -> i32>(x: T) -> i32 { - | ^^^^^^ + | ^^^^^^ can't be applied to `FnOnce` | +note: `FnOnce` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/ops/function.rs:LL:COL = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error[E0015]: cannot call non-const closure in constant functions diff --git a/tests/ui/traits/const-traits/const-closures.stderr b/tests/ui/traits/const-traits/const-closures.stderr index 8ceaae16d8e..92f3ba20820 100644 --- a/tests/ui/traits/const-traits/const-closures.stderr +++ b/tests/ui/traits/const-traits/const-closures.stderr @@ -2,56 +2,76 @@ error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/const-closures.rs:8:12 | LL | F: ~const FnOnce() -> u8, - | ^^^^^^ + | ^^^^^^ can't be applied to `FnOnce` + | +note: `FnOnce` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/ops/function.rs:LL:COL error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/const-closures.rs:9:12 | LL | F: ~const FnMut() -> u8, - | ^^^^^^ + | ^^^^^^ can't be applied to `FnMut` + | +note: `FnMut` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/ops/function.rs:LL:COL error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/const-closures.rs:10:12 | LL | F: ~const Fn() -> u8, - | ^^^^^^ + | ^^^^^^ can't be applied to `Fn` + | +note: `Fn` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/ops/function.rs:LL:COL error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/const-closures.rs:8:12 | LL | F: ~const FnOnce() -> u8, - | ^^^^^^ + | ^^^^^^ can't be applied to `FnOnce` | +note: `FnOnce` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/ops/function.rs:LL:COL = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/const-closures.rs:9:12 | LL | F: ~const FnMut() -> u8, - | ^^^^^^ + | ^^^^^^ can't be applied to `FnMut` | +note: `FnMut` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/ops/function.rs:LL:COL = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/const-closures.rs:10:12 | LL | F: ~const Fn() -> u8, - | ^^^^^^ + | ^^^^^^ can't be applied to `Fn` | +note: `Fn` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/ops/function.rs:LL:COL = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/const-closures.rs:23:20 | LL | const fn answer<F: ~const Fn() -> u8>(f: &F) -> u8 { - | ^^^^^^ + | ^^^^^^ can't be applied to `Fn` + | +note: `Fn` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/ops/function.rs:LL:COL error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/const-closures.rs:23:20 | LL | const fn answer<F: ~const Fn() -> u8>(f: &F) -> u8 { - | ^^^^^^ + | ^^^^^^ can't be applied to `Fn` | +note: `Fn` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/ops/function.rs:LL:COL = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error[E0015]: cannot call non-const closure in constant functions diff --git a/tests/ui/traits/const-traits/const-impl-requires-const-trait.stderr b/tests/ui/traits/const-traits/const-impl-requires-const-trait.stderr index bcaae381949..c728eda069e 100644 --- a/tests/ui/traits/const-traits/const-impl-requires-const-trait.stderr +++ b/tests/ui/traits/const-traits/const-impl-requires-const-trait.stderr @@ -1,14 +1,15 @@ error: const `impl` for trait `A` which is not marked with `#[const_trait]` --> $DIR/const-impl-requires-const-trait.rs:6:12 | -LL | pub trait A {} - | - help: mark `A` as const: `#[const_trait]` -LL | LL | impl const A for () {} - | ^ + | ^ this trait is not `const` | = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const` = note: adding a non-const method body in the future would be a breaking change +help: mark `A` as `#[const_trait]` to allow it to have `const` implementations + | +LL | #[const_trait] pub trait A {} + | ++++++++++++++ error: aborting due to 1 previous error diff --git a/tests/ui/traits/const-traits/const_derives/derive-const-gate.stderr b/tests/ui/traits/const-traits/const_derives/derive-const-gate.stderr index 95f6f32f21d..fae871a4c85 100644 --- a/tests/ui/traits/const-traits/const_derives/derive-const-gate.stderr +++ b/tests/ui/traits/const-traits/const_derives/derive-const-gate.stderr @@ -11,7 +11,7 @@ error: const `impl` for trait `Default` which is not marked with `#[const_trait] --> $DIR/derive-const-gate.rs:1:16 | LL | #[derive_const(Default)] - | ^^^^^^^ + | ^^^^^^^ this trait is not `const` | = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const` = note: adding a non-const method body in the future would be a breaking change diff --git a/tests/ui/traits/const-traits/const_derives/derive-const-non-const-type.stderr b/tests/ui/traits/const-traits/const_derives/derive-const-non-const-type.stderr index 9492000a563..8a6401afcf1 100644 --- a/tests/ui/traits/const-traits/const_derives/derive-const-non-const-type.stderr +++ b/tests/ui/traits/const-traits/const_derives/derive-const-non-const-type.stderr @@ -2,7 +2,7 @@ error: const `impl` for trait `Default` which is not marked with `#[const_trait] --> $DIR/derive-const-non-const-type.rs:10:16 | LL | #[derive_const(Default)] - | ^^^^^^^ + | ^^^^^^^ this trait is not `const` | = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const` = note: adding a non-const method body in the future would be a breaking change diff --git a/tests/ui/traits/const-traits/const_derives/derive-const-use.stderr b/tests/ui/traits/const-traits/const_derives/derive-const-use.stderr index 6f4fc90f636..3b06f4d801a 100644 --- a/tests/ui/traits/const-traits/const_derives/derive-const-use.stderr +++ b/tests/ui/traits/const-traits/const_derives/derive-const-use.stderr @@ -14,7 +14,7 @@ error: const `impl` for trait `Default` which is not marked with `#[const_trait] --> $DIR/derive-const-use.rs:7:12 | LL | impl const Default for A { - | ^^^^^^^ + | ^^^^^^^ this trait is not `const` | = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const` = note: adding a non-const method body in the future would be a breaking change @@ -23,7 +23,7 @@ error: const `impl` for trait `Default` which is not marked with `#[const_trait] --> $DIR/derive-const-use.rs:15:16 | LL | #[derive_const(Default, PartialEq)] - | ^^^^^^^ + | ^^^^^^^ this trait is not `const` | = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const` = note: adding a non-const method body in the future would be a breaking change @@ -33,7 +33,7 @@ error: const `impl` for trait `PartialEq` which is not marked with `#[const_trai --> $DIR/derive-const-use.rs:11:12 | LL | impl const PartialEq for A { - | ^^^^^^^^^ + | ^^^^^^^^^ this trait is not `const` | = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const` = note: adding a non-const method body in the future would be a breaking change @@ -42,7 +42,7 @@ error: const `impl` for trait `PartialEq` which is not marked with `#[const_trai --> $DIR/derive-const-use.rs:15:25 | LL | #[derive_const(Default, PartialEq)] - | ^^^^^^^^^ + | ^^^^^^^^^ this trait is not `const` | = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const` = note: adding a non-const method body in the future would be a breaking change diff --git a/tests/ui/traits/const-traits/const_derives/derive-const-with-params.stderr b/tests/ui/traits/const-traits/const_derives/derive-const-with-params.stderr index 21cf64f89ea..6b1405712ef 100644 --- a/tests/ui/traits/const-traits/const_derives/derive-const-with-params.stderr +++ b/tests/ui/traits/const-traits/const_derives/derive-const-with-params.stderr @@ -2,13 +2,16 @@ error: const `impl` for trait `PartialEq` which is not marked with `#[const_trai --> $DIR/derive-const-with-params.rs:7:16 | LL | #[derive_const(PartialEq)] - | ^^^^^^^^^ + | ^^^^^^^^^ this trait is not `const` | = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const` = note: adding a non-const method body in the future would be a breaking change = note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info) error: `~const` can only be applied to `#[const_trait]` traits + | +note: `PartialEq` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/cmp.rs:LL:COL error[E0015]: cannot call non-const operator in constant functions --> $DIR/derive-const-with-params.rs:8:23 diff --git a/tests/ui/traits/const-traits/dont-ice-on-const-pred-for-bounds.rs b/tests/ui/traits/const-traits/dont-ice-on-const-pred-for-bounds.rs new file mode 100644 index 00000000000..2295c2c3857 --- /dev/null +++ b/tests/ui/traits/const-traits/dont-ice-on-const-pred-for-bounds.rs @@ -0,0 +1,22 @@ +// Regression test for <https://github.com/rust-lang/rust/issues/133526>. + +// Ensures we don't ICE when we encounter a `HostEffectPredicate` when computing +// the "item super predicates" for `Assoc`. + +//@ compile-flags: -Znext-solver +//@ check-pass + +#![feature(const_trait_impl)] + +#[const_trait] +trait Trait { + type Assoc: const Trait; +} + +const fn needs_trait<T: ~const Trait>() {} + +fn test<T: Trait>() { + const { needs_trait::<T::Assoc>() }; +} + +fn main() {} diff --git a/tests/ui/traits/const-traits/effects/auxiliary/minicore.rs b/tests/ui/traits/const-traits/effects/auxiliary/minicore.rs index aaa61e21155..e606d896e93 100644 --- a/tests/ui/traits/const-traits/effects/auxiliary/minicore.rs +++ b/tests/ui/traits/const-traits/effects/auxiliary/minicore.rs @@ -110,6 +110,16 @@ impl<T: ?Sized> LegacyReceiver for &T {} impl<T: ?Sized> LegacyReceiver for &mut T {} +#[lang = "receiver"] +pub trait Receiver { + #[lang = "receiver_target"] + type Target: ?Sized; +} + +impl<T: Deref + ?Sized> Receiver for T { + type Target = <T as Deref>::Target; +} + #[lang = "destruct"] #[const_trait] pub trait Destruct {} diff --git a/tests/ui/traits/const-traits/effects/ice-112822-expected-type-for-param.stderr b/tests/ui/traits/const-traits/effects/ice-112822-expected-type-for-param.stderr index 879d966b1f9..280f8807f5f 100644 --- a/tests/ui/traits/const-traits/effects/ice-112822-expected-type-for-param.stderr +++ b/tests/ui/traits/const-traits/effects/ice-112822-expected-type-for-param.stderr @@ -12,22 +12,29 @@ error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/ice-112822-expected-type-for-param.rs:3:25 | LL | const fn test() -> impl ~const Fn() { - | ^^^^^^ + | ^^^^^^ can't be applied to `Fn` + | +note: `Fn` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/ops/function.rs:LL:COL error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/ice-112822-expected-type-for-param.rs:3:25 | LL | const fn test() -> impl ~const Fn() { - | ^^^^^^ + | ^^^^^^ can't be applied to `Fn` | +note: `Fn` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/ops/function.rs:LL:COL = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/ice-112822-expected-type-for-param.rs:3:25 | LL | const fn test() -> impl ~const Fn() { - | ^^^^^^ + | ^^^^^^ can't be applied to `Fn` | +note: `Fn` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/ops/function.rs:LL:COL = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error[E0015]: cannot call non-const operator in constant functions diff --git a/tests/ui/traits/const-traits/effects/spec-effectvar-ice.stderr b/tests/ui/traits/const-traits/effects/spec-effectvar-ice.stderr index 5659102c5e5..474d96698d5 100644 --- a/tests/ui/traits/const-traits/effects/spec-effectvar-ice.stderr +++ b/tests/ui/traits/const-traits/effects/spec-effectvar-ice.stderr @@ -1,32 +1,39 @@ error: const `impl` for trait `Foo` which is not marked with `#[const_trait]` --> $DIR/spec-effectvar-ice.rs:10:15 | -LL | trait Foo {} - | - help: mark `Foo` as const: `#[const_trait]` -LL | LL | impl<T> const Foo for T {} - | ^^^ + | ^^^ this trait is not `const` | = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const` = note: adding a non-const method body in the future would be a breaking change +help: mark `Foo` as `#[const_trait]` to allow it to have `const` implementations + | +LL | #[const_trait] trait Foo {} + | ++++++++++++++ error: const `impl` for trait `Foo` which is not marked with `#[const_trait]` --> $DIR/spec-effectvar-ice.rs:13:15 | -LL | trait Foo {} - | - help: mark `Foo` as const: `#[const_trait]` -... LL | impl<T> const Foo for T where T: const Specialize {} - | ^^^ + | ^^^ this trait is not `const` | = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const` = note: adding a non-const method body in the future would be a breaking change +help: mark `Foo` as `#[const_trait]` to allow it to have `const` implementations + | +LL | #[const_trait] trait Foo {} + | ++++++++++++++ error: `const` can only be applied to `#[const_trait]` traits --> $DIR/spec-effectvar-ice.rs:13:34 | LL | impl<T> const Foo for T where T: const Specialize {} - | ^^^^^ + | ^^^^^ can't be applied to `Specialize` + | +help: mark `Specialize` as `#[const_trait]` to allow it to have `const` implementations + | +LL | #[const_trait] trait Specialize {} + | ++++++++++++++ error: specialization impl does not specialize any associated items --> $DIR/spec-effectvar-ice.rs:13:1 diff --git a/tests/ui/traits/const-traits/ice-119717-constant-lifetime.stderr b/tests/ui/traits/const-traits/ice-119717-constant-lifetime.stderr index 9e22422ad3b..5af263de28c 100644 --- a/tests/ui/traits/const-traits/ice-119717-constant-lifetime.stderr +++ b/tests/ui/traits/const-traits/ice-119717-constant-lifetime.stderr @@ -2,7 +2,7 @@ error: const `impl` for trait `FromResidual` which is not marked with `#[const_t --> $DIR/ice-119717-constant-lifetime.rs:6:15 | LL | impl<T> const FromResidual for T { - | ^^^^^^^^^^^^ + | ^^^^^^^^^^^^ this trait is not `const` | = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const` = note: adding a non-const method body in the future would be a breaking change diff --git a/tests/ui/traits/const-traits/ice-123664-unexpected-bound-var.stderr b/tests/ui/traits/const-traits/ice-123664-unexpected-bound-var.stderr index 1178c90fce5..821b257af88 100644 --- a/tests/ui/traits/const-traits/ice-123664-unexpected-bound-var.stderr +++ b/tests/ui/traits/const-traits/ice-123664-unexpected-bound-var.stderr @@ -2,14 +2,19 @@ error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/ice-123664-unexpected-bound-var.rs:4:27 | LL | const fn with_positive<F: ~const Fn()>() {} - | ^^^^^^ + | ^^^^^^ can't be applied to `Fn` + | +note: `Fn` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/ops/function.rs:LL:COL error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/ice-123664-unexpected-bound-var.rs:4:27 | LL | const fn with_positive<F: ~const Fn()>() {} - | ^^^^^^ + | ^^^^^^ can't be applied to `Fn` | +note: `Fn` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/ops/function.rs:LL:COL = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: aborting due to 2 previous errors diff --git a/tests/ui/traits/const-traits/ice-126148-failed-to-normalize.stderr b/tests/ui/traits/const-traits/ice-126148-failed-to-normalize.stderr index 9bd493e5fdb..41f99c2d375 100644 --- a/tests/ui/traits/const-traits/ice-126148-failed-to-normalize.stderr +++ b/tests/ui/traits/const-traits/ice-126148-failed-to-normalize.stderr @@ -2,7 +2,7 @@ error: const `impl` for trait `FromResidual` which is not marked with `#[const_t --> $DIR/ice-126148-failed-to-normalize.rs:8:12 | LL | impl const FromResidual<Error> for TryMe {} - | ^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^ this trait is not `const` | = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const` = note: adding a non-const method body in the future would be a breaking change @@ -19,7 +19,7 @@ error: const `impl` for trait `Try` which is not marked with `#[const_trait]` --> $DIR/ice-126148-failed-to-normalize.rs:12:12 | LL | impl const Try for TryMe { - | ^^^ + | ^^^ this trait is not `const` | = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const` = note: adding a non-const method body in the future would be a breaking change diff --git a/tests/ui/traits/const-traits/non-const-op-in-closure-in-const.stderr b/tests/ui/traits/const-traits/non-const-op-in-closure-in-const.stderr index 837effb7ca4..4ddb1e8c5a9 100644 --- a/tests/ui/traits/const-traits/non-const-op-in-closure-in-const.stderr +++ b/tests/ui/traits/const-traits/non-const-op-in-closure-in-const.stderr @@ -2,14 +2,19 @@ error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/non-const-op-in-closure-in-const.rs:10:44 | LL | impl<A, B> const Convert<B> for A where B: ~const From<A> { - | ^^^^^^ + | ^^^^^^ can't be applied to `From` + | +note: `From` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/convert/mod.rs:LL:COL error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/non-const-op-in-closure-in-const.rs:10:44 | LL | impl<A, B> const Convert<B> for A where B: ~const From<A> { - | ^^^^^^ + | ^^^^^^ can't be applied to `From` | +note: `From` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/convert/mod.rs:LL:COL = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error[E0015]: cannot call non-const fn `<B as From<A>>::from` in constant functions diff --git a/tests/ui/traits/const-traits/super-traits-fail-2.nn.stderr b/tests/ui/traits/const-traits/super-traits-fail-2.nn.stderr index e7f54b4c5bd..51b88cf8702 100644 --- a/tests/ui/traits/const-traits/super-traits-fail-2.nn.stderr +++ b/tests/ui/traits/const-traits/super-traits-fail-2.nn.stderr @@ -14,23 +14,36 @@ error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/super-traits-fail-2.rs:11:12 | LL | trait Bar: ~const Foo {} - | ^^^^^^ + | ^^^^^^ can't be applied to `Foo` + | +help: mark `Foo` as `#[const_trait]` to allow it to have `const` implementations + | +LL | #[const_trait] trait Foo { + | ++++++++++++++ error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/super-traits-fail-2.rs:11:12 | LL | trait Bar: ~const Foo {} - | ^^^^^^ + | ^^^^^^ can't be applied to `Foo` | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: mark `Foo` as `#[const_trait]` to allow it to have `const` implementations + | +LL | #[const_trait] trait Foo { + | ++++++++++++++ error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/super-traits-fail-2.rs:11:12 | LL | trait Bar: ~const Foo {} - | ^^^^^^ + | ^^^^^^ can't be applied to `Foo` | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: mark `Foo` as `#[const_trait]` to allow it to have `const` implementations + | +LL | #[const_trait] trait Foo { + | ++++++++++++++ error[E0015]: cannot call non-const fn `<T as Foo>::a` in constant functions --> $DIR/super-traits-fail-2.rs:20:7 diff --git a/tests/ui/traits/const-traits/super-traits-fail-2.ny.stderr b/tests/ui/traits/const-traits/super-traits-fail-2.ny.stderr index a09fe81f716..38fb6f05412 100644 --- a/tests/ui/traits/const-traits/super-traits-fail-2.ny.stderr +++ b/tests/ui/traits/const-traits/super-traits-fail-2.ny.stderr @@ -2,39 +2,60 @@ error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/super-traits-fail-2.rs:11:12 | LL | trait Bar: ~const Foo {} - | ^^^^^^ + | ^^^^^^ can't be applied to `Foo` + | +help: mark `Foo` as `#[const_trait]` to allow it to have `const` implementations + | +LL | #[const_trait] trait Foo { + | ++++++++++++++ error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/super-traits-fail-2.rs:11:12 | LL | trait Bar: ~const Foo {} - | ^^^^^^ + | ^^^^^^ can't be applied to `Foo` | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: mark `Foo` as `#[const_trait]` to allow it to have `const` implementations + | +LL | #[const_trait] trait Foo { + | ++++++++++++++ error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/super-traits-fail-2.rs:11:12 | LL | trait Bar: ~const Foo {} - | ^^^^^^ + | ^^^^^^ can't be applied to `Foo` | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: mark `Foo` as `#[const_trait]` to allow it to have `const` implementations + | +LL | #[const_trait] trait Foo { + | ++++++++++++++ error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/super-traits-fail-2.rs:11:12 | LL | trait Bar: ~const Foo {} - | ^^^^^^ + | ^^^^^^ can't be applied to `Foo` | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: mark `Foo` as `#[const_trait]` to allow it to have `const` implementations + | +LL | #[const_trait] trait Foo { + | ++++++++++++++ error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/super-traits-fail-2.rs:11:12 | LL | trait Bar: ~const Foo {} - | ^^^^^^ + | ^^^^^^ can't be applied to `Foo` | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: mark `Foo` as `#[const_trait]` to allow it to have `const` implementations + | +LL | #[const_trait] trait Foo { + | ++++++++++++++ error[E0015]: cannot call non-const fn `<T as Foo>::a` in constant functions --> $DIR/super-traits-fail-2.rs:20:7 diff --git a/tests/ui/traits/const-traits/super-traits-fail-3.nnn.stderr b/tests/ui/traits/const-traits/super-traits-fail-3.nnn.stderr new file mode 100644 index 00000000000..fd802fde5bd --- /dev/null +++ b/tests/ui/traits/const-traits/super-traits-fail-3.nnn.stderr @@ -0,0 +1,102 @@ +error: `~const` is not allowed here + --> $DIR/super-traits-fail-3.rs:23:12 + | +LL | trait Bar: ~const Foo {} + | ^^^^^^ + | +note: this trait is not a `#[const_trait]`, so it cannot have `~const` trait bounds + --> $DIR/super-traits-fail-3.rs:23:1 + | +LL | trait Bar: ~const Foo {} + | ^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0658]: const trait impls are experimental + --> $DIR/super-traits-fail-3.rs:23:12 + | +LL | trait Bar: ~const Foo {} + | ^^^^^^ + | + = note: see issue #67792 <https://github.com/rust-lang/rust/issues/67792> 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/super-traits-fail-3.rs:32:17 + | +LL | const fn foo<T: ~const Bar>(x: &T) { + | ^^^^^^ + | + = note: see issue #67792 <https://github.com/rust-lang/rust/issues/67792> 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: `~const` can only be applied to `#[const_trait]` traits + --> $DIR/super-traits-fail-3.rs:23:12 + | +LL | trait Bar: ~const Foo {} + | ^^^^^^ can't be applied to `Foo` + | +help: enable `#![feature(const_trait_impl)]` in your crate and mark `Foo` as `#[const_trait]` to allow it to have `const` implementations + | +LL | #[const_trait] trait Foo { + | ++++++++++++++ + +error: `~const` can only be applied to `#[const_trait]` traits + --> $DIR/super-traits-fail-3.rs:23:12 + | +LL | trait Bar: ~const Foo {} + | ^^^^^^ can't be applied to `Foo` + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: enable `#![feature(const_trait_impl)]` in your crate and mark `Foo` as `#[const_trait]` to allow it to have `const` implementations + | +LL | #[const_trait] trait Foo { + | ++++++++++++++ + +error: `~const` can only be applied to `#[const_trait]` traits + --> $DIR/super-traits-fail-3.rs:23:12 + | +LL | trait Bar: ~const Foo {} + | ^^^^^^ can't be applied to `Foo` + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: enable `#![feature(const_trait_impl)]` in your crate and mark `Foo` as `#[const_trait]` to allow it to have `const` implementations + | +LL | #[const_trait] trait Foo { + | ++++++++++++++ + +error: `~const` can only be applied to `#[const_trait]` traits + --> $DIR/super-traits-fail-3.rs:32:17 + | +LL | const fn foo<T: ~const Bar>(x: &T) { + | ^^^^^^ can't be applied to `Bar` + | +help: enable `#![feature(const_trait_impl)]` in your crate and mark `Bar` as `#[const_trait]` to allow it to have `const` implementations + | +LL | #[const_trait] trait Bar: ~const Foo {} + | ++++++++++++++ + +error: `~const` can only be applied to `#[const_trait]` traits + --> $DIR/super-traits-fail-3.rs:32:17 + | +LL | const fn foo<T: ~const Bar>(x: &T) { + | ^^^^^^ can't be applied to `Bar` + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: enable `#![feature(const_trait_impl)]` in your crate and mark `Bar` as `#[const_trait]` to allow it to have `const` implementations + | +LL | #[const_trait] trait Bar: ~const Foo {} + | ++++++++++++++ + +error[E0015]: cannot call non-const fn `<T as Foo>::a` in constant functions + --> $DIR/super-traits-fail-3.rs:36:7 + | +LL | x.a(); + | ^^^ + | + = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants + +error: aborting due to 9 previous errors + +Some errors have detailed explanations: E0015, E0658. +For more information about an error, try `rustc --explain E0015`. diff --git a/tests/ui/traits/const-traits/super-traits-fail-3.nny.stderr b/tests/ui/traits/const-traits/super-traits-fail-3.nny.stderr new file mode 100644 index 00000000000..fd802fde5bd --- /dev/null +++ b/tests/ui/traits/const-traits/super-traits-fail-3.nny.stderr @@ -0,0 +1,102 @@ +error: `~const` is not allowed here + --> $DIR/super-traits-fail-3.rs:23:12 + | +LL | trait Bar: ~const Foo {} + | ^^^^^^ + | +note: this trait is not a `#[const_trait]`, so it cannot have `~const` trait bounds + --> $DIR/super-traits-fail-3.rs:23:1 + | +LL | trait Bar: ~const Foo {} + | ^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0658]: const trait impls are experimental + --> $DIR/super-traits-fail-3.rs:23:12 + | +LL | trait Bar: ~const Foo {} + | ^^^^^^ + | + = note: see issue #67792 <https://github.com/rust-lang/rust/issues/67792> 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/super-traits-fail-3.rs:32:17 + | +LL | const fn foo<T: ~const Bar>(x: &T) { + | ^^^^^^ + | + = note: see issue #67792 <https://github.com/rust-lang/rust/issues/67792> 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: `~const` can only be applied to `#[const_trait]` traits + --> $DIR/super-traits-fail-3.rs:23:12 + | +LL | trait Bar: ~const Foo {} + | ^^^^^^ can't be applied to `Foo` + | +help: enable `#![feature(const_trait_impl)]` in your crate and mark `Foo` as `#[const_trait]` to allow it to have `const` implementations + | +LL | #[const_trait] trait Foo { + | ++++++++++++++ + +error: `~const` can only be applied to `#[const_trait]` traits + --> $DIR/super-traits-fail-3.rs:23:12 + | +LL | trait Bar: ~const Foo {} + | ^^^^^^ can't be applied to `Foo` + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: enable `#![feature(const_trait_impl)]` in your crate and mark `Foo` as `#[const_trait]` to allow it to have `const` implementations + | +LL | #[const_trait] trait Foo { + | ++++++++++++++ + +error: `~const` can only be applied to `#[const_trait]` traits + --> $DIR/super-traits-fail-3.rs:23:12 + | +LL | trait Bar: ~const Foo {} + | ^^^^^^ can't be applied to `Foo` + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: enable `#![feature(const_trait_impl)]` in your crate and mark `Foo` as `#[const_trait]` to allow it to have `const` implementations + | +LL | #[const_trait] trait Foo { + | ++++++++++++++ + +error: `~const` can only be applied to `#[const_trait]` traits + --> $DIR/super-traits-fail-3.rs:32:17 + | +LL | const fn foo<T: ~const Bar>(x: &T) { + | ^^^^^^ can't be applied to `Bar` + | +help: enable `#![feature(const_trait_impl)]` in your crate and mark `Bar` as `#[const_trait]` to allow it to have `const` implementations + | +LL | #[const_trait] trait Bar: ~const Foo {} + | ++++++++++++++ + +error: `~const` can only be applied to `#[const_trait]` traits + --> $DIR/super-traits-fail-3.rs:32:17 + | +LL | const fn foo<T: ~const Bar>(x: &T) { + | ^^^^^^ can't be applied to `Bar` + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: enable `#![feature(const_trait_impl)]` in your crate and mark `Bar` as `#[const_trait]` to allow it to have `const` implementations + | +LL | #[const_trait] trait Bar: ~const Foo {} + | ++++++++++++++ + +error[E0015]: cannot call non-const fn `<T as Foo>::a` in constant functions + --> $DIR/super-traits-fail-3.rs:36:7 + | +LL | x.a(); + | ^^^ + | + = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants + +error: aborting due to 9 previous errors + +Some errors have detailed explanations: E0015, E0658. +For more information about an error, try `rustc --explain E0015`. diff --git a/tests/ui/traits/const-traits/super-traits-fail-3.ny.stderr b/tests/ui/traits/const-traits/super-traits-fail-3.ny.stderr deleted file mode 100644 index a880c2a2206..00000000000 --- a/tests/ui/traits/const-traits/super-traits-fail-3.ny.stderr +++ /dev/null @@ -1,49 +0,0 @@ -error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/super-traits-fail-3.rs:13:12 - | -LL | trait Bar: ~const Foo {} - | ^^^^^^ - -error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/super-traits-fail-3.rs:13:12 - | -LL | trait Bar: ~const Foo {} - | ^^^^^^ - | - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - -error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/super-traits-fail-3.rs:13:12 - | -LL | trait Bar: ~const Foo {} - | ^^^^^^ - | - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - -error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/super-traits-fail-3.rs:13:12 - | -LL | trait Bar: ~const Foo {} - | ^^^^^^ - | - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - -error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/super-traits-fail-3.rs:13:12 - | -LL | trait Bar: ~const Foo {} - | ^^^^^^ - | - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - -error[E0015]: cannot call non-const fn `<T as Foo>::a` in constant functions - --> $DIR/super-traits-fail-3.rs:24:7 - | -LL | x.a(); - | ^^^ - | - = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants - -error: aborting due to 6 previous errors - -For more information about this error, try `rustc --explain E0015`. diff --git a/tests/ui/traits/const-traits/super-traits-fail-3.nyn.stderr b/tests/ui/traits/const-traits/super-traits-fail-3.nyn.stderr new file mode 100644 index 00000000000..8abda1c8f8a --- /dev/null +++ b/tests/ui/traits/const-traits/super-traits-fail-3.nyn.stderr @@ -0,0 +1,53 @@ +error[E0658]: const trait impls are experimental + --> $DIR/super-traits-fail-3.rs:23:12 + | +LL | trait Bar: ~const Foo {} + | ^^^^^^ + | + = note: see issue #67792 <https://github.com/rust-lang/rust/issues/67792> 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/super-traits-fail-3.rs:32:17 + | +LL | const fn foo<T: ~const Bar>(x: &T) { + | ^^^^^^ + | + = note: see issue #67792 <https://github.com/rust-lang/rust/issues/67792> 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` is a temporary placeholder for marking a trait that is suitable for `const` `impls` and all default bodies as `const`, which may be removed or renamed in the future. + --> $DIR/super-traits-fail-3.rs:15:37 + | +LL | #[cfg_attr(any(yyy, yyn, nyy, nyn), const_trait)] + | ^^^^^^^^^^^ + | + = note: see issue #67792 <https://github.com/rust-lang/rust/issues/67792> 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` is a temporary placeholder for marking a trait that is suitable for `const` `impls` and all default bodies as `const`, which may be removed or renamed in the future. + --> $DIR/super-traits-fail-3.rs:21:37 + | +LL | #[cfg_attr(any(yyy, yny, nyy, nyn), const_trait)] + | ^^^^^^^^^^^ + | + = note: see issue #67792 <https://github.com/rust-lang/rust/issues/67792> 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]: cannot call conditionally-const method `<T as Foo>::a` in constant functions + --> $DIR/super-traits-fail-3.rs:36:5 + | +LL | x.a(); + | ^^^^^ + | + = note: see issue #67792 <https://github.com/rust-lang/rust/issues/67792> 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: aborting due to 5 previous errors + +For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/traits/const-traits/super-traits-fail-3.nyy.stderr b/tests/ui/traits/const-traits/super-traits-fail-3.nyy.stderr new file mode 100644 index 00000000000..8abda1c8f8a --- /dev/null +++ b/tests/ui/traits/const-traits/super-traits-fail-3.nyy.stderr @@ -0,0 +1,53 @@ +error[E0658]: const trait impls are experimental + --> $DIR/super-traits-fail-3.rs:23:12 + | +LL | trait Bar: ~const Foo {} + | ^^^^^^ + | + = note: see issue #67792 <https://github.com/rust-lang/rust/issues/67792> 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/super-traits-fail-3.rs:32:17 + | +LL | const fn foo<T: ~const Bar>(x: &T) { + | ^^^^^^ + | + = note: see issue #67792 <https://github.com/rust-lang/rust/issues/67792> 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` is a temporary placeholder for marking a trait that is suitable for `const` `impls` and all default bodies as `const`, which may be removed or renamed in the future. + --> $DIR/super-traits-fail-3.rs:15:37 + | +LL | #[cfg_attr(any(yyy, yyn, nyy, nyn), const_trait)] + | ^^^^^^^^^^^ + | + = note: see issue #67792 <https://github.com/rust-lang/rust/issues/67792> 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` is a temporary placeholder for marking a trait that is suitable for `const` `impls` and all default bodies as `const`, which may be removed or renamed in the future. + --> $DIR/super-traits-fail-3.rs:21:37 + | +LL | #[cfg_attr(any(yyy, yny, nyy, nyn), const_trait)] + | ^^^^^^^^^^^ + | + = note: see issue #67792 <https://github.com/rust-lang/rust/issues/67792> 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]: cannot call conditionally-const method `<T as Foo>::a` in constant functions + --> $DIR/super-traits-fail-3.rs:36:5 + | +LL | x.a(); + | ^^^^^ + | + = note: see issue #67792 <https://github.com/rust-lang/rust/issues/67792> 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: aborting due to 5 previous errors + +For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/traits/const-traits/super-traits-fail-3.rs b/tests/ui/traits/const-traits/super-traits-fail-3.rs index bd95ae8d96a..aa27554e7f8 100644 --- a/tests/ui/traits/const-traits/super-traits-fail-3.rs +++ b/tests/ui/traits/const-traits/super-traits-fail-3.rs @@ -1,29 +1,42 @@ //@ compile-flags: -Znext-solver -#![feature(const_trait_impl)] +#![cfg_attr(any(yyy, yyn, yny, ynn), feature(const_trait_impl))] -//@ revisions: yy yn ny nn -//@[yy] check-pass +//@ revisions: yyy yyn yny ynn nyy nyn nny nnn +//@[yyy] check-pass +/// yyy: feature enabled, Foo is const, Bar is const +/// yyn: feature enabled, Foo is const, Bar is not const +/// yny: feature enabled, Foo is not const, Bar is const +/// ynn: feature enabled, Foo is not const, Bar is not const +/// nyy: feature not enabled, Foo is const, Bar is const +/// nyn: feature not enabled, Foo is const, Bar is not const +/// nny: feature not enabled, Foo is not const, Bar is const +/// nnn: feature not enabled, Foo is not const, Bar is not const -#[cfg_attr(any(yy, yn), const_trait)] +#[cfg_attr(any(yyy, yyn, nyy, nyn), const_trait)] +//[nyy,nyn]~^ ERROR: `const_trait` is a temporary placeholder for marking a trait that is suitable for `const` `impls` and all default bodies as `const`, which may be removed or renamed in the future trait Foo { fn a(&self); } -#[cfg_attr(any(yy, ny), const_trait)] +#[cfg_attr(any(yyy, yny, nyy, nyn), const_trait)] +//[nyy,nyn]~^ ERROR: `const_trait` is a temporary placeholder for marking a trait that is suitable for `const` `impls` and all default bodies as `const`, which may be removed or renamed in the future trait Bar: ~const Foo {} -//[ny,nn]~^ ERROR: `~const` can only be applied to `#[const_trait]` -//[ny,nn]~| ERROR: `~const` can only be applied to `#[const_trait]` -//[ny,nn]~| ERROR: `~const` can only be applied to `#[const_trait]` -//[ny]~| ERROR: `~const` can only be applied to `#[const_trait]` -//[ny]~| ERROR: `~const` can only be applied to `#[const_trait]` -//[yn,nn]~^^^^^^ ERROR: `~const` is not allowed here +//[yny,ynn,nny,nnn]~^ ERROR: `~const` can only be applied to `#[const_trait]` +//[yny,ynn,nny,nnn]~| ERROR: `~const` can only be applied to `#[const_trait]` +//[yny,ynn,nny,nnn]~| ERROR: `~const` can only be applied to `#[const_trait]` +//[yny]~^^^^ ERROR: `~const` can only be applied to `#[const_trait]` +//[yny]~| ERROR: `~const` can only be applied to `#[const_trait]` +//[yyn,ynn,nny,nnn]~^^^^^^ ERROR: `~const` is not allowed here +//[nyy,nyn,nny,nnn]~^^^^^^^ ERROR: const trait impls are experimental const fn foo<T: ~const Bar>(x: &T) { - //[yn,nn]~^ ERROR: `~const` can only be applied to `#[const_trait]` - //[yn,nn]~| ERROR: `~const` can only be applied to `#[const_trait]` + //[yyn,ynn,nny,nnn]~^ ERROR: `~const` can only be applied to `#[const_trait]` + //[yyn,ynn,nny,nnn]~| ERROR: `~const` can only be applied to `#[const_trait]` + //[nyy,nyn,nny,nnn]~^^^ ERROR: const trait impls are experimental x.a(); - //[yn]~^ ERROR: the trait bound `T: ~const Foo` is not satisfied - //[nn,ny]~^^ ERROR: cannot call non-const fn `<T as Foo>::a` in constant functions + //[yyn]~^ ERROR: the trait bound `T: ~const Foo` is not satisfied + //[ynn,yny,nny,nnn]~^^ ERROR: cannot call non-const fn `<T as Foo>::a` in constant functions + //[nyy,nyn]~^^^ ERROR: cannot call conditionally-const method `<T as Foo>::a` in constant functions } fn main() {} diff --git a/tests/ui/traits/const-traits/super-traits-fail-3.nn.stderr b/tests/ui/traits/const-traits/super-traits-fail-3.ynn.stderr index 599b8c826f7..16424696eeb 100644 --- a/tests/ui/traits/const-traits/super-traits-fail-3.nn.stderr +++ b/tests/ui/traits/const-traits/super-traits-fail-3.ynn.stderr @@ -1,53 +1,75 @@ error: `~const` is not allowed here - --> $DIR/super-traits-fail-3.rs:13:12 + --> $DIR/super-traits-fail-3.rs:23:12 | LL | trait Bar: ~const Foo {} | ^^^^^^ | note: this trait is not a `#[const_trait]`, so it cannot have `~const` trait bounds - --> $DIR/super-traits-fail-3.rs:13:1 + --> $DIR/super-traits-fail-3.rs:23:1 | LL | trait Bar: ~const Foo {} | ^^^^^^^^^^^^^^^^^^^^^^^^ error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/super-traits-fail-3.rs:13:12 + --> $DIR/super-traits-fail-3.rs:23:12 | LL | trait Bar: ~const Foo {} - | ^^^^^^ + | ^^^^^^ can't be applied to `Foo` + | +help: mark `Foo` as `#[const_trait]` to allow it to have `const` implementations + | +LL | #[const_trait] trait Foo { + | ++++++++++++++ error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/super-traits-fail-3.rs:13:12 + --> $DIR/super-traits-fail-3.rs:23:12 | LL | trait Bar: ~const Foo {} - | ^^^^^^ + | ^^^^^^ can't be applied to `Foo` | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: mark `Foo` as `#[const_trait]` to allow it to have `const` implementations + | +LL | #[const_trait] trait Foo { + | ++++++++++++++ error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/super-traits-fail-3.rs:13:12 + --> $DIR/super-traits-fail-3.rs:23:12 | LL | trait Bar: ~const Foo {} - | ^^^^^^ + | ^^^^^^ can't be applied to `Foo` | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: mark `Foo` as `#[const_trait]` to allow it to have `const` implementations + | +LL | #[const_trait] trait Foo { + | ++++++++++++++ error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/super-traits-fail-3.rs:21:17 + --> $DIR/super-traits-fail-3.rs:32:17 | LL | const fn foo<T: ~const Bar>(x: &T) { - | ^^^^^^ + | ^^^^^^ can't be applied to `Bar` + | +help: mark `Bar` as `#[const_trait]` to allow it to have `const` implementations + | +LL | #[const_trait] trait Bar: ~const Foo {} + | ++++++++++++++ error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/super-traits-fail-3.rs:21:17 + --> $DIR/super-traits-fail-3.rs:32:17 | LL | const fn foo<T: ~const Bar>(x: &T) { - | ^^^^^^ + | ^^^^^^ can't be applied to `Bar` | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: mark `Bar` as `#[const_trait]` to allow it to have `const` implementations + | +LL | #[const_trait] trait Bar: ~const Foo {} + | ++++++++++++++ error[E0015]: cannot call non-const fn `<T as Foo>::a` in constant functions - --> $DIR/super-traits-fail-3.rs:24:7 + --> $DIR/super-traits-fail-3.rs:36:7 | LL | x.a(); | ^^^ diff --git a/tests/ui/traits/const-traits/super-traits-fail-3.yny.stderr b/tests/ui/traits/const-traits/super-traits-fail-3.yny.stderr new file mode 100644 index 00000000000..c81544c4bf5 --- /dev/null +++ b/tests/ui/traits/const-traits/super-traits-fail-3.yny.stderr @@ -0,0 +1,70 @@ +error: `~const` can only be applied to `#[const_trait]` traits + --> $DIR/super-traits-fail-3.rs:23:12 + | +LL | trait Bar: ~const Foo {} + | ^^^^^^ can't be applied to `Foo` + | +help: mark `Foo` as `#[const_trait]` to allow it to have `const` implementations + | +LL | #[const_trait] trait Foo { + | ++++++++++++++ + +error: `~const` can only be applied to `#[const_trait]` traits + --> $DIR/super-traits-fail-3.rs:23:12 + | +LL | trait Bar: ~const Foo {} + | ^^^^^^ can't be applied to `Foo` + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: mark `Foo` as `#[const_trait]` to allow it to have `const` implementations + | +LL | #[const_trait] trait Foo { + | ++++++++++++++ + +error: `~const` can only be applied to `#[const_trait]` traits + --> $DIR/super-traits-fail-3.rs:23:12 + | +LL | trait Bar: ~const Foo {} + | ^^^^^^ can't be applied to `Foo` + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: mark `Foo` as `#[const_trait]` to allow it to have `const` implementations + | +LL | #[const_trait] trait Foo { + | ++++++++++++++ + +error: `~const` can only be applied to `#[const_trait]` traits + --> $DIR/super-traits-fail-3.rs:23:12 + | +LL | trait Bar: ~const Foo {} + | ^^^^^^ can't be applied to `Foo` + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: mark `Foo` as `#[const_trait]` to allow it to have `const` implementations + | +LL | #[const_trait] trait Foo { + | ++++++++++++++ + +error: `~const` can only be applied to `#[const_trait]` traits + --> $DIR/super-traits-fail-3.rs:23:12 + | +LL | trait Bar: ~const Foo {} + | ^^^^^^ can't be applied to `Foo` + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: mark `Foo` as `#[const_trait]` to allow it to have `const` implementations + | +LL | #[const_trait] trait Foo { + | ++++++++++++++ + +error[E0015]: cannot call non-const fn `<T as Foo>::a` in constant functions + --> $DIR/super-traits-fail-3.rs:36:7 + | +LL | x.a(); + | ^^^ + | + = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants + +error: aborting due to 6 previous errors + +For more information about this error, try `rustc --explain E0015`. diff --git a/tests/ui/traits/const-traits/super-traits-fail-3.yn.stderr b/tests/ui/traits/const-traits/super-traits-fail-3.yyn.stderr index ecee348222d..3270611dace 100644 --- a/tests/ui/traits/const-traits/super-traits-fail-3.yn.stderr +++ b/tests/ui/traits/const-traits/super-traits-fail-3.yyn.stderr @@ -1,31 +1,40 @@ error: `~const` is not allowed here - --> $DIR/super-traits-fail-3.rs:13:12 + --> $DIR/super-traits-fail-3.rs:23:12 | LL | trait Bar: ~const Foo {} | ^^^^^^ | note: this trait is not a `#[const_trait]`, so it cannot have `~const` trait bounds - --> $DIR/super-traits-fail-3.rs:13:1 + --> $DIR/super-traits-fail-3.rs:23:1 | LL | trait Bar: ~const Foo {} | ^^^^^^^^^^^^^^^^^^^^^^^^ error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/super-traits-fail-3.rs:21:17 + --> $DIR/super-traits-fail-3.rs:32:17 | LL | const fn foo<T: ~const Bar>(x: &T) { - | ^^^^^^ + | ^^^^^^ can't be applied to `Bar` + | +help: mark `Bar` as `#[const_trait]` to allow it to have `const` implementations + | +LL | #[const_trait] trait Bar: ~const Foo {} + | ++++++++++++++ error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/super-traits-fail-3.rs:21:17 + --> $DIR/super-traits-fail-3.rs:32:17 | LL | const fn foo<T: ~const Bar>(x: &T) { - | ^^^^^^ + | ^^^^^^ can't be applied to `Bar` | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: mark `Bar` as `#[const_trait]` to allow it to have `const` implementations + | +LL | #[const_trait] trait Bar: ~const Foo {} + | ++++++++++++++ error[E0277]: the trait bound `T: ~const Foo` is not satisfied - --> $DIR/super-traits-fail-3.rs:24:7 + --> $DIR/super-traits-fail-3.rs:36:7 | LL | x.a(); | ^ diff --git a/tests/ui/traits/const-traits/trait-default-body-stability.stderr b/tests/ui/traits/const-traits/trait-default-body-stability.stderr index b471cb81c3b..77b81211e81 100644 --- a/tests/ui/traits/const-traits/trait-default-body-stability.stderr +++ b/tests/ui/traits/const-traits/trait-default-body-stability.stderr @@ -2,7 +2,7 @@ error: const `impl` for trait `Try` which is not marked with `#[const_trait]` --> $DIR/trait-default-body-stability.rs:19:12 | LL | impl const Try for T { - | ^^^ + | ^^^ this trait is not `const` | = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const` = note: adding a non-const method body in the future would be a breaking change @@ -11,7 +11,7 @@ error: const `impl` for trait `FromResidual` which is not marked with `#[const_t --> $DIR/trait-default-body-stability.rs:34:12 | LL | impl const FromResidual for T { - | ^^^^^^^^^^^^ + | ^^^^^^^^^^^^ this trait is not `const` | = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const` = note: adding a non-const method body in the future would be a breaking change diff --git a/tests/ui/traits/issue-78372.stderr b/tests/ui/traits/issue-78372.stderr index 86234d15a5d..1c58915111f 100644 --- a/tests/ui/traits/issue-78372.stderr +++ b/tests/ui/traits/issue-78372.stderr @@ -61,8 +61,8 @@ error[E0307]: invalid `self` parameter type: `Smaht<Self, T>` LL | fn foo(self: Smaht<Self, T>); | ^^^^^^^^^^^^^^ | - = note: type of `self` must be `Self` or a type that dereferences to it - = help: consider changing to `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`) + = note: type of `self` must be `Self` or some type implementing `Receiver` + = help: consider changing to `self`, `&self`, `&mut self`, or a type implementing `Receiver` such as `self: Box<Self>`, `self: Rc<Self>`, or `self: Arc<Self>` error[E0378]: the trait `DispatchFromDyn` may only be implemented for a coercion between structures --> $DIR/issue-78372.rs:3:1 diff --git a/tests/ui/type-alias-impl-trait/method_resolution3.current.stderr b/tests/ui/type-alias-impl-trait/method_resolution3.current.stderr index 09efd7a9e7e..c6aa0e811f3 100644 --- a/tests/ui/type-alias-impl-trait/method_resolution3.current.stderr +++ b/tests/ui/type-alias-impl-trait/method_resolution3.current.stderr @@ -4,8 +4,8 @@ error[E0307]: invalid `self` parameter type: `Bar<u32>` LL | fn bar(self: Bar<u32>) { | ^^^^^^^^ | - = note: type of `self` must be `Self` or a type that dereferences to it - = help: consider changing to `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`) + = note: type of `self` must be `Self` or some type implementing `Receiver` + = help: consider changing to `self`, `&self`, `&mut self`, or a type implementing `Receiver` such as `self: Box<Self>`, `self: Rc<Self>`, or `self: Arc<Self>` error[E0307]: invalid `self` parameter type: `&Bar<u32>` --> $DIR/method_resolution3.rs:20:18 @@ -13,8 +13,8 @@ error[E0307]: invalid `self` parameter type: `&Bar<u32>` LL | fn baz(self: &Bar<u32>) { | ^^^^^^^^^ | - = note: type of `self` must be `Self` or a type that dereferences to it - = help: consider changing to `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`) + = note: type of `self` must be `Self` or some type implementing `Receiver` + = help: consider changing to `self`, `&self`, `&mut self`, or a type implementing `Receiver` such as `self: Box<Self>`, `self: Rc<Self>`, or `self: Arc<Self>` error: aborting due to 2 previous errors diff --git a/tests/ui/type-alias-impl-trait/method_resolution3.next.stderr b/tests/ui/type-alias-impl-trait/method_resolution3.next.stderr index 09efd7a9e7e..c6aa0e811f3 100644 --- a/tests/ui/type-alias-impl-trait/method_resolution3.next.stderr +++ b/tests/ui/type-alias-impl-trait/method_resolution3.next.stderr @@ -4,8 +4,8 @@ error[E0307]: invalid `self` parameter type: `Bar<u32>` LL | fn bar(self: Bar<u32>) { | ^^^^^^^^ | - = note: type of `self` must be `Self` or a type that dereferences to it - = help: consider changing to `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`) + = note: type of `self` must be `Self` or some type implementing `Receiver` + = help: consider changing to `self`, `&self`, `&mut self`, or a type implementing `Receiver` such as `self: Box<Self>`, `self: Rc<Self>`, or `self: Arc<Self>` error[E0307]: invalid `self` parameter type: `&Bar<u32>` --> $DIR/method_resolution3.rs:20:18 @@ -13,8 +13,8 @@ error[E0307]: invalid `self` parameter type: `&Bar<u32>` LL | fn baz(self: &Bar<u32>) { | ^^^^^^^^^ | - = note: type of `self` must be `Self` or a type that dereferences to it - = help: consider changing to `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`) + = note: type of `self` must be `Self` or some type implementing `Receiver` + = help: consider changing to `self`, `&self`, `&mut self`, or a type implementing `Receiver` such as `self: Box<Self>`, `self: Rc<Self>`, or `self: Arc<Self>` error: aborting due to 2 previous errors diff --git a/tests/ui/type-alias-impl-trait/method_resolution4.current.stderr b/tests/ui/type-alias-impl-trait/method_resolution4.current.stderr index 8ffdb21f251..e4c4d121733 100644 --- a/tests/ui/type-alias-impl-trait/method_resolution4.current.stderr +++ b/tests/ui/type-alias-impl-trait/method_resolution4.current.stderr @@ -4,8 +4,8 @@ error[E0307]: invalid `self` parameter type: `Bar<Foo>` LL | fn foo(self: Bar<Foo>) { | ^^^^^^^^ | - = note: type of `self` must be `Self` or a type that dereferences to it - = help: consider changing to `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`) + = note: type of `self` must be `Self` or some type implementing `Receiver` + = help: consider changing to `self`, `&self`, `&mut self`, or a type implementing `Receiver` such as `self: Box<Self>`, `self: Rc<Self>`, or `self: Arc<Self>` error[E0307]: invalid `self` parameter type: `&Bar<Foo>` --> $DIR/method_resolution4.rs:31:20 @@ -13,8 +13,8 @@ error[E0307]: invalid `self` parameter type: `&Bar<Foo>` LL | fn foomp(self: &Bar<Foo>) { | ^^^^^^^^^ | - = note: type of `self` must be `Self` or a type that dereferences to it - = help: consider changing to `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`) + = note: type of `self` must be `Self` or some type implementing `Receiver` + = help: consider changing to `self`, `&self`, `&mut self`, or a type implementing `Receiver` such as `self: Box<Self>`, `self: Rc<Self>`, or `self: Arc<Self>` error: aborting due to 2 previous errors diff --git a/tests/ui/type-alias-impl-trait/method_resolution4.next.stderr b/tests/ui/type-alias-impl-trait/method_resolution4.next.stderr index 8ffdb21f251..e4c4d121733 100644 --- a/tests/ui/type-alias-impl-trait/method_resolution4.next.stderr +++ b/tests/ui/type-alias-impl-trait/method_resolution4.next.stderr @@ -4,8 +4,8 @@ error[E0307]: invalid `self` parameter type: `Bar<Foo>` LL | fn foo(self: Bar<Foo>) { | ^^^^^^^^ | - = note: type of `self` must be `Self` or a type that dereferences to it - = help: consider changing to `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`) + = note: type of `self` must be `Self` or some type implementing `Receiver` + = help: consider changing to `self`, `&self`, `&mut self`, or a type implementing `Receiver` such as `self: Box<Self>`, `self: Rc<Self>`, or `self: Arc<Self>` error[E0307]: invalid `self` parameter type: `&Bar<Foo>` --> $DIR/method_resolution4.rs:31:20 @@ -13,8 +13,8 @@ error[E0307]: invalid `self` parameter type: `&Bar<Foo>` LL | fn foomp(self: &Bar<Foo>) { | ^^^^^^^^^ | - = note: type of `self` must be `Self` or a type that dereferences to it - = help: consider changing to `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`) + = note: type of `self` must be `Self` or some type implementing `Receiver` + = help: consider changing to `self`, `&self`, `&mut self`, or a type implementing `Receiver` such as `self: Box<Self>`, `self: Rc<Self>`, or `self: Arc<Self>` error: aborting due to 2 previous errors diff --git a/tests/ui/type/type-dependent-def-issue-49241.stderr b/tests/ui/type/type-dependent-def-issue-49241.stderr index 4e55618e5cb..cf372dc5968 100644 --- a/tests/ui/type/type-dependent-def-issue-49241.stderr +++ b/tests/ui/type/type-dependent-def-issue-49241.stderr @@ -9,12 +9,6 @@ help: consider using `let` instead of `const` LL | let l: usize = v.count(); | ~~~ -note: erroneous constant encountered - --> $DIR/type-dependent-def-issue-49241.rs:4:18 - | -LL | let s: [u32; l] = v.into_iter().collect(); - | ^ - error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0435`. diff --git a/tests/ui/ufcs/ufcs-explicit-self-bad.stderr b/tests/ui/ufcs/ufcs-explicit-self-bad.stderr index 2a8c4edbdb5..36bdc714e05 100644 --- a/tests/ui/ufcs/ufcs-explicit-self-bad.stderr +++ b/tests/ui/ufcs/ufcs-explicit-self-bad.stderr @@ -22,8 +22,8 @@ error[E0307]: invalid `self` parameter type: `isize` LL | fn foo(self: isize, x: isize) -> isize { | ^^^^^ | - = note: type of `self` must be `Self` or a type that dereferences to it - = help: consider changing to `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`) + = note: type of `self` must be `Self` or some type implementing `Receiver` + = help: consider changing to `self`, `&self`, `&mut self`, or a type implementing `Receiver` such as `self: Box<Self>`, `self: Rc<Self>`, or `self: Arc<Self>` error[E0307]: invalid `self` parameter type: `Bar<isize>` --> $DIR/ufcs-explicit-self-bad.rs:19:18 @@ -31,8 +31,8 @@ error[E0307]: invalid `self` parameter type: `Bar<isize>` LL | fn foo(self: Bar<isize>, x: isize) -> isize { | ^^^^^^^^^^ | - = note: type of `self` must be `Self` or a type that dereferences to it - = help: consider changing to `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`) + = note: type of `self` must be `Self` or some type implementing `Receiver` + = help: consider changing to `self`, `&self`, `&mut self`, or a type implementing `Receiver` such as `self: Box<Self>`, `self: Rc<Self>`, or `self: Arc<Self>` error[E0307]: invalid `self` parameter type: `&Bar<usize>` --> $DIR/ufcs-explicit-self-bad.rs:23:18 @@ -40,8 +40,8 @@ error[E0307]: invalid `self` parameter type: `&Bar<usize>` LL | fn bar(self: &Bar<usize>, x: isize) -> isize { | ^^^^^^^^^^^ | - = note: type of `self` must be `Self` or a type that dereferences to it - = help: consider changing to `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`) + = note: type of `self` must be `Self` or some type implementing `Receiver` + = help: consider changing to `self`, `&self`, `&mut self`, or a type implementing `Receiver` such as `self: Box<Self>`, `self: Rc<Self>`, or `self: Arc<Self>` error[E0308]: mismatched `self` parameter type --> $DIR/ufcs-explicit-self-bad.rs:37:21 diff --git a/tests/ui/unpretty/expanded-exhaustive.rs b/tests/ui/unpretty/expanded-exhaustive.rs index 9af57fe4c3c..98fe05cf7c8 100644 --- a/tests/ui/unpretty/expanded-exhaustive.rs +++ b/tests/ui/unpretty/expanded-exhaustive.rs @@ -2,7 +2,6 @@ //@ edition:2024 //@ check-pass -#![feature(async_closure)] #![feature(auto_traits)] #![feature(box_patterns)] #![feature(builtin_syntax)] diff --git a/tests/ui/unpretty/expanded-exhaustive.stdout b/tests/ui/unpretty/expanded-exhaustive.stdout index 14a274415ca..452c06dd7e4 100644 --- a/tests/ui/unpretty/expanded-exhaustive.stdout +++ b/tests/ui/unpretty/expanded-exhaustive.stdout @@ -3,7 +3,6 @@ //@ edition:2024 //@ check-pass -#![feature(async_closure)] #![feature(auto_traits)] #![feature(box_patterns)] #![feature(builtin_syntax)] diff --git a/tests/ui/unsafe-binders/expr.rs b/tests/ui/unsafe-binders/expr.rs new file mode 100644 index 00000000000..d8c4c2df2cd --- /dev/null +++ b/tests/ui/unsafe-binders/expr.rs @@ -0,0 +1,13 @@ +#![feature(unsafe_binders)] +//~^ WARN the feature `unsafe_binders` is incomplete + +use std::unsafe_binder::{wrap_binder, unwrap_binder}; + +fn main() { + let x = 1; + let binder: unsafe<'a> &'a i32 = wrap_binder!(x); + //~^ ERROR unsafe binders are not yet implemented + //~| ERROR unsafe binders are not yet implemented + let rx = *unwrap_binder!(binder); + //~^ ERROR unsafe binders are not yet implemented +} diff --git a/tests/ui/unsafe-binders/expr.stderr b/tests/ui/unsafe-binders/expr.stderr new file mode 100644 index 00000000000..26fae1958b0 --- /dev/null +++ b/tests/ui/unsafe-binders/expr.stderr @@ -0,0 +1,29 @@ +warning: the feature `unsafe_binders` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/expr.rs:1:12 + | +LL | #![feature(unsafe_binders)] + | ^^^^^^^^^^^^^^ + | + = note: see issue #130516 <https://github.com/rust-lang/rust/issues/130516> for more information + = note: `#[warn(incomplete_features)]` on by default + +error: unsafe binders are not yet implemented + --> $DIR/expr.rs:8:17 + | +LL | let binder: unsafe<'a> &'a i32 = wrap_binder!(x); + | ^^^^^^^^^^^^^^^^^^ + +error: unsafe binders are not yet implemented + --> $DIR/expr.rs:8:51 + | +LL | let binder: unsafe<'a> &'a i32 = wrap_binder!(x); + | ^ + +error: unsafe binders are not yet implemented + --> $DIR/expr.rs:11:30 + | +LL | let rx = *unwrap_binder!(binder); + | ^^^^^^ + +error: aborting due to 3 previous errors; 1 warning emitted + diff --git a/tests/ui/unsafe-binders/lifetime-resolution.rs b/tests/ui/unsafe-binders/lifetime-resolution.rs new file mode 100644 index 00000000000..aebed9599d4 --- /dev/null +++ b/tests/ui/unsafe-binders/lifetime-resolution.rs @@ -0,0 +1,19 @@ +#![feature(unsafe_binders)] +//~^ WARN the feature `unsafe_binders` is incomplete + +fn foo<'a>() { + let good: unsafe<'b> &'a &'b (); + //~^ ERROR unsafe binders are not yet implemented + + let missing: unsafe<> &'missing (); + //~^ ERROR unsafe binders are not yet implemented + //~| ERROR use of undeclared lifetime name `'missing` + + fn inner<'b>() { + let outer: unsafe<> &'a &'b (); + //~^ ERROR unsafe binders are not yet implemented + //~| can't use generic parameters from outer item + } +} + +fn main() {} diff --git a/tests/ui/unsafe-binders/lifetime-resolution.stderr b/tests/ui/unsafe-binders/lifetime-resolution.stderr new file mode 100644 index 00000000000..7a8ce929df1 --- /dev/null +++ b/tests/ui/unsafe-binders/lifetime-resolution.stderr @@ -0,0 +1,65 @@ +error[E0261]: use of undeclared lifetime name `'missing` + --> $DIR/lifetime-resolution.rs:8:28 + | +LL | let missing: unsafe<> &'missing (); + | ^^^^^^^^ undeclared lifetime + | + = note: for more information on higher-ranked polymorphism, visit https://doc.rust-lang.org/nomicon/hrtb.html +help: consider making the type lifetime-generic with a new `'missing` lifetime + | +LL | let missing: unsafe<'missing, > &'missing (); + | +++++++++ +help: consider introducing lifetime `'missing` here + | +LL | fn foo<'missing, 'a>() { + | +++++++++ + +error[E0401]: can't use generic parameters from outer item + --> $DIR/lifetime-resolution.rs:13:30 + | +LL | fn foo<'a>() { + | -- lifetime parameter from outer item +... +LL | let outer: unsafe<> &'a &'b (); + | ^^ use of generic parameter from outer item + | +help: consider making the type lifetime-generic with a new `'a` lifetime + | +LL | let outer: unsafe<'a, > &'a &'b (); + | +++ +help: consider introducing lifetime `'a` here + | +LL | fn inner<'a, 'b>() { + | +++ + +warning: the feature `unsafe_binders` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/lifetime-resolution.rs:1:12 + | +LL | #![feature(unsafe_binders)] + | ^^^^^^^^^^^^^^ + | + = note: see issue #130516 <https://github.com/rust-lang/rust/issues/130516> for more information + = note: `#[warn(incomplete_features)]` on by default + +error: unsafe binders are not yet implemented + --> $DIR/lifetime-resolution.rs:5:15 + | +LL | let good: unsafe<'b> &'a &'b (); + | ^^^^^^^^^^^^^^^^^^^^^ + +error: unsafe binders are not yet implemented + --> $DIR/lifetime-resolution.rs:8:18 + | +LL | let missing: unsafe<> &'missing (); + | ^^^^^^^^^^^^^^^^^^^^^ + +error: unsafe binders are not yet implemented + --> $DIR/lifetime-resolution.rs:13:20 + | +LL | let outer: unsafe<> &'a &'b (); + | ^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 5 previous errors; 1 warning emitted + +Some errors have detailed explanations: E0261, E0401. +For more information about an error, try `rustc --explain E0261`. diff --git a/tests/ui/unsafe-binders/simple.rs b/tests/ui/unsafe-binders/simple.rs new file mode 100644 index 00000000000..cebff2cbfb8 --- /dev/null +++ b/tests/ui/unsafe-binders/simple.rs @@ -0,0 +1,7 @@ +#![feature(unsafe_binders)] +//~^ WARN the feature `unsafe_binders` is incomplete + +fn main() { + let x: unsafe<'a> &'a (); + //~^ ERROR unsafe binders are not yet implemented +} diff --git a/tests/ui/unsafe-binders/simple.stderr b/tests/ui/unsafe-binders/simple.stderr new file mode 100644 index 00000000000..a21dbd00b4c --- /dev/null +++ b/tests/ui/unsafe-binders/simple.stderr @@ -0,0 +1,17 @@ +warning: the feature `unsafe_binders` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/simple.rs:1:12 + | +LL | #![feature(unsafe_binders)] + | ^^^^^^^^^^^^^^ + | + = note: see issue #130516 <https://github.com/rust-lang/rust/issues/130516> for more information + = note: `#[warn(incomplete_features)]` on by default + +error: unsafe binders are not yet implemented + --> $DIR/simple.rs:5:12 + | +LL | let x: unsafe<'a> &'a (); + | ^^^^^^^^^^^^^^^^^ + +error: aborting due to 1 previous error; 1 warning emitted + diff --git a/tests/ui/unsafe-fields/copy-trait.rs b/tests/ui/unsafe-fields/copy-trait.rs new file mode 100644 index 00000000000..fb09ed02e3f --- /dev/null +++ b/tests/ui/unsafe-fields/copy-trait.rs @@ -0,0 +1,41 @@ +//@ compile-flags: --crate-type=lib + +#![feature(unsafe_fields)] +#![allow(incomplete_features)] +#![deny(missing_copy_implementations)] + +mod good_safe_impl { + enum SafeEnum { + Safe(u8), + } + + impl Copy for SafeEnum {} +} + +mod bad_safe_impl { + enum UnsafeEnum { + Safe(u8), + Unsafe { unsafe field: u8 }, + } + + impl Copy for UnsafeEnum {} + //~^ ERROR the trait `Copy` requires an `unsafe impl` declaration +} + +mod good_unsafe_impl { + enum UnsafeEnum { + Safe(u8), + Unsafe { unsafe field: u8 }, + } + + unsafe impl Copy for UnsafeEnum {} +} + +mod bad_unsafe_impl { + enum SafeEnum { + Safe(u8), + } + + unsafe impl Copy for SafeEnum {} + //~^ ERROR implementing the trait `Copy` is not unsafe +} diff --git a/tests/ui/unsafe-fields/copy-trait.stderr b/tests/ui/unsafe-fields/copy-trait.stderr new file mode 100644 index 00000000000..5952f8c89c1 --- /dev/null +++ b/tests/ui/unsafe-fields/copy-trait.stderr @@ -0,0 +1,28 @@ +error[E0200]: the trait `Copy` requires an `unsafe impl` declaration + --> $DIR/copy-trait.rs:21:5 + | +LL | impl Copy for UnsafeEnum {} + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: the trait `Copy` cannot be safely implemented for `bad_safe_impl::UnsafeEnum` because it has unsafe fields. Review the invariants of those fields before adding an `unsafe impl` +help: add `unsafe` to this trait implementation + | +LL | unsafe impl Copy for UnsafeEnum {} + | ++++++ + +error[E0199]: implementing the trait `Copy` is not unsafe + --> $DIR/copy-trait.rs:39:5 + | +LL | unsafe impl Copy for SafeEnum {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: remove `unsafe` from this trait implementation + | +LL - unsafe impl Copy for SafeEnum {} +LL + impl Copy for SafeEnum {} + | + +error: aborting due to 2 previous errors + +Some errors have detailed explanations: E0199, E0200. +For more information about an error, try `rustc --explain E0199`. |
