diff options
| author | bors <bors@rust-lang.org> | 2023-08-08 06:46:20 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-08-08 06:46:20 +0000 |
| commit | f21c6576644c9715f59491ab483b78a6f6f35cbc (patch) | |
| tree | 89859e6ac1f15219d1ccb8a1edcce57c6bc49d76 /tests | |
| parent | 4b2ec291ea29bcdcc892342b28ad954c16c49396 (diff) | |
| parent | 9bd77a3bcbb8ac92990d1ab1299caeb50e28c649 (diff) | |
| download | rust-f21c6576644c9715f59491ab483b78a6f6f35cbc.tar.gz rust-f21c6576644c9715f59491ab483b78a6f6f35cbc.zip | |
Auto merge of #3020 - rust-lang:rustup-2023-08-08, r=RalfJung
Automatic sync from rustc
Diffstat (limited to 'tests')
131 files changed, 822 insertions, 699 deletions
diff --git a/tests/codegen/box-maybe-uninit-llvm14.rs b/tests/codegen/box-maybe-uninit-llvm14.rs deleted file mode 100644 index c9f88fb3fe4..00000000000 --- a/tests/codegen/box-maybe-uninit-llvm14.rs +++ /dev/null @@ -1,34 +0,0 @@ -// compile-flags: -O - -// Once we're done with llvm 14 and earlier, this test can be deleted. - -#![crate_type = "lib"] - -use std::mem::MaybeUninit; - -// Boxing a `MaybeUninit` value should not copy junk from the stack -#[no_mangle] -pub fn box_uninitialized() -> Box<MaybeUninit<usize>> { - // CHECK-LABEL: @box_uninitialized - // CHECK-NOT: store - // CHECK-NOT: alloca - // CHECK-NOT: memcpy - // CHECK-NOT: memset - Box::new(MaybeUninit::uninit()) -} - -// https://github.com/rust-lang/rust/issues/58201 -#[no_mangle] -pub fn box_uninitialized2() -> Box<MaybeUninit<[usize; 1024 * 1024]>> { - // CHECK-LABEL: @box_uninitialized2 - // CHECK-NOT: store - // CHECK-NOT: alloca - // CHECK-NOT: memcpy - // CHECK-NOT: memset - Box::new(MaybeUninit::uninit()) -} - -// Hide the LLVM 15+ `allocalign` attribute in the declaration of __rust_alloc -// from the CHECK-NOT above. We don't check the attributes here because we can't rely -// on all of them being set until LLVM 15. -// CHECK: declare {{(dso_local )?}}noalias{{.*}} @__rust_alloc(i{{[0-9]+}} noundef, i{{[0-9]+.*}} noundef) diff --git a/tests/codegen/c-variadic-copy.rs b/tests/codegen/cffi/c-variadic-copy.rs index 4c61c4fcf68..4c61c4fcf68 100644 --- a/tests/codegen/c-variadic-copy.rs +++ b/tests/codegen/cffi/c-variadic-copy.rs diff --git a/tests/codegen/c-variadic-opt.rs b/tests/codegen/cffi/c-variadic-opt.rs index 969dce80f58..969dce80f58 100644 --- a/tests/codegen/c-variadic-opt.rs +++ b/tests/codegen/cffi/c-variadic-opt.rs diff --git a/tests/codegen/c-variadic.rs b/tests/codegen/cffi/c-variadic.rs index cab32652210..cab32652210 100644 --- a/tests/codegen/c-variadic.rs +++ b/tests/codegen/cffi/c-variadic.rs diff --git a/tests/codegen/ffi-const.rs b/tests/codegen/cffi/ffi-const.rs index 93720503480..93720503480 100644 --- a/tests/codegen/ffi-const.rs +++ b/tests/codegen/cffi/ffi-const.rs diff --git a/tests/codegen/ffi-out-of-bounds-loads.rs b/tests/codegen/cffi/ffi-out-of-bounds-loads.rs index 099726b2f08..099726b2f08 100644 --- a/tests/codegen/ffi-out-of-bounds-loads.rs +++ b/tests/codegen/cffi/ffi-out-of-bounds-loads.rs diff --git a/tests/codegen/ffi-pure.rs b/tests/codegen/cffi/ffi-pure.rs index 2ed73581358..2ed73581358 100644 --- a/tests/codegen/ffi-pure.rs +++ b/tests/codegen/cffi/ffi-pure.rs diff --git a/tests/codegen/ffi-returns-twice.rs b/tests/codegen/cffi/ffi-returns-twice.rs index 0fbe03f0bb6..0fbe03f0bb6 100644 --- a/tests/codegen/ffi-returns-twice.rs +++ b/tests/codegen/cffi/ffi-returns-twice.rs diff --git a/tests/codegen/enum-bounds-check-derived-idx.rs b/tests/codegen/enum/enum-bounds-check-derived-idx.rs index aa66c2ed08e..aa66c2ed08e 100644 --- a/tests/codegen/enum-bounds-check-derived-idx.rs +++ b/tests/codegen/enum/enum-bounds-check-derived-idx.rs diff --git a/tests/codegen/enum-bounds-check-issue-13926.rs b/tests/codegen/enum/enum-bounds-check-issue-13926.rs index b26945bc549..b26945bc549 100644 --- a/tests/codegen/enum-bounds-check-issue-13926.rs +++ b/tests/codegen/enum/enum-bounds-check-issue-13926.rs diff --git a/tests/codegen/enum-bounds-check-issue-82871.rs b/tests/codegen/enum/enum-bounds-check-issue-82871.rs index 32fdc4a5f4f..32fdc4a5f4f 100644 --- a/tests/codegen/enum-bounds-check-issue-82871.rs +++ b/tests/codegen/enum/enum-bounds-check-issue-82871.rs diff --git a/tests/codegen/enum-bounds-check.rs b/tests/codegen/enum/enum-bounds-check.rs index 17322d5911b..17322d5911b 100644 --- a/tests/codegen/enum-bounds-check.rs +++ b/tests/codegen/enum/enum-bounds-check.rs diff --git a/tests/codegen/enum-debug-clike.rs b/tests/codegen/enum/enum-debug-clike.rs index 1e369a2c4e6..1e369a2c4e6 100644 --- a/tests/codegen/enum-debug-clike.rs +++ b/tests/codegen/enum/enum-debug-clike.rs diff --git a/tests/codegen/enum-debug-niche-2.rs b/tests/codegen/enum/enum-debug-niche-2.rs index 4b607d50574..4b607d50574 100644 --- a/tests/codegen/enum-debug-niche-2.rs +++ b/tests/codegen/enum/enum-debug-niche-2.rs diff --git a/tests/codegen/enum-debug-niche.rs b/tests/codegen/enum/enum-debug-niche.rs index b718a6854dd..b718a6854dd 100644 --- a/tests/codegen/enum-debug-niche.rs +++ b/tests/codegen/enum/enum-debug-niche.rs diff --git a/tests/codegen/enum-debug-tagged.rs b/tests/codegen/enum/enum-debug-tagged.rs index 095c49ac3ac..095c49ac3ac 100644 --- a/tests/codegen/enum-debug-tagged.rs +++ b/tests/codegen/enum/enum-debug-tagged.rs diff --git a/tests/codegen/enum-discriminant-value.rs b/tests/codegen/enum/enum-discriminant-value.rs index cc14c212002..cc14c212002 100644 --- a/tests/codegen/enum-discriminant-value.rs +++ b/tests/codegen/enum/enum-discriminant-value.rs diff --git a/tests/codegen/enum-match.rs b/tests/codegen/enum/enum-match.rs index 5548cd25147..5548cd25147 100644 --- a/tests/codegen/enum-match.rs +++ b/tests/codegen/enum/enum-match.rs diff --git a/tests/codegen/enum-u128.rs b/tests/codegen/enum/enum-u128.rs index f50d360ac9f..f50d360ac9f 100644 --- a/tests/codegen/enum-u128.rs +++ b/tests/codegen/enum/enum-u128.rs diff --git a/tests/codegen/intrinsics/compare_bytes.rs b/tests/codegen/intrinsics/compare_bytes.rs new file mode 100644 index 00000000000..e69224d818c --- /dev/null +++ b/tests/codegen/intrinsics/compare_bytes.rs @@ -0,0 +1,34 @@ +// revisions: INT32 INT16 +// compile-flags: -O +// [INT32] ignore-16bit +// [INT16] only-16bit + +#![crate_type = "lib"] +#![feature(core_intrinsics)] + +use std::intrinsics::compare_bytes; + +#[no_mangle] +// CHECK-LABEL: @bytes_cmp( +pub unsafe fn bytes_cmp(a: *const u8, b: *const u8, n: usize) -> i32 { + // INT32: %[[TEMP:.+]] = tail call i32 @memcmp(ptr %a, ptr %b, {{i32|i64}} %n) + // INT32-NOT: sext + // INT32: ret i32 %[[TEMP]] + + // INT16: %[[TEMP1:.+]] = tail call i16 @memcmp(ptr %a, ptr %b, i16 %n) + // INT16: %[[TEMP2:.+]] = sext i16 %[[TEMP1]] to i32 + // INT16: ret i32 %[[TEMP2]] + compare_bytes(a, b, n) +} + +// Ensure that, even though there's an `sext` emitted by the intrinsic, +// that doesn't end up pessiming checks against zero. +#[no_mangle] +// CHECK-LABEL: @bytes_eq( +pub unsafe fn bytes_eq(a: *const u8, b: *const u8, n: usize) -> bool { + // CHECK: call {{.+}} @{{bcmp|memcmp}}(ptr %a, ptr %b, {{i16|i32|i64}} %n) + // CHECK-NOT: sext + // INT32: icmp eq i32 + // INT16: icmp eq i16 + compare_bytes(a, b, n) == 0_i32 +} diff --git a/tests/codegen/i686-macosx-deployment-target.rs b/tests/codegen/macos/i686-macosx-deployment-target.rs index 17258a264a5..17258a264a5 100644 --- a/tests/codegen/i686-macosx-deployment-target.rs +++ b/tests/codegen/macos/i686-macosx-deployment-target.rs diff --git a/tests/codegen/i686-no-macosx-deployment-target.rs b/tests/codegen/macos/i686-no-macosx-deployment-target.rs index 043040a95e3..043040a95e3 100644 --- a/tests/codegen/i686-no-macosx-deployment-target.rs +++ b/tests/codegen/macos/i686-no-macosx-deployment-target.rs diff --git a/tests/codegen/x86_64-macosx-deployment-target.rs b/tests/codegen/macos/x86_64-macosx-deployment-target.rs index 8e673d11d98..8e673d11d98 100644 --- a/tests/codegen/x86_64-macosx-deployment-target.rs +++ b/tests/codegen/macos/x86_64-macosx-deployment-target.rs diff --git a/tests/codegen/x86_64-no-macosx-deployment-target.rs b/tests/codegen/macos/x86_64-no-macosx-deployment-target.rs index 25ae6924de0..25ae6924de0 100644 --- a/tests/codegen/x86_64-no-macosx-deployment-target.rs +++ b/tests/codegen/macos/x86_64-no-macosx-deployment-target.rs diff --git a/tests/codegen/naked-functions.rs b/tests/codegen/naked-fn/naked-functions.rs index e05bbc26e83..e05bbc26e83 100644 --- a/tests/codegen/naked-functions.rs +++ b/tests/codegen/naked-fn/naked-functions.rs diff --git a/tests/codegen/naked-nocoverage.rs b/tests/codegen/naked-fn/naked-nocoverage.rs index 3c755e49c6d..3c755e49c6d 100644 --- a/tests/codegen/naked-nocoverage.rs +++ b/tests/codegen/naked-fn/naked-nocoverage.rs diff --git a/tests/codegen/naked-noinline.rs b/tests/codegen/naked-fn/naked-noinline.rs index 5cfb500c0ef..5cfb500c0ef 100644 --- a/tests/codegen/naked-noinline.rs +++ b/tests/codegen/naked-fn/naked-noinline.rs diff --git a/tests/codegen/sanitizer-cfi-add-canonical-jump-tables-flag.rs b/tests/codegen/sanitizer/cfi-add-canonical-jump-tables-flag.rs index 1ee8bdfc3ab..1ee8bdfc3ab 100644 --- a/tests/codegen/sanitizer-cfi-add-canonical-jump-tables-flag.rs +++ b/tests/codegen/sanitizer/cfi-add-canonical-jump-tables-flag.rs diff --git a/tests/codegen/sanitizer-cfi-add-enable-split-lto-unit-flag.rs b/tests/codegen/sanitizer/cfi-add-enable-split-lto-unit-flag.rs index 68c91384b82..68c91384b82 100644 --- a/tests/codegen/sanitizer-cfi-add-enable-split-lto-unit-flag.rs +++ b/tests/codegen/sanitizer/cfi-add-enable-split-lto-unit-flag.rs diff --git a/tests/codegen/sanitizer-cfi-emit-type-checks-attr-no-sanitize.rs b/tests/codegen/sanitizer/cfi-emit-type-checks-attr-no-sanitize.rs index 2b61c9078fd..a3cd16e3dd5 100644 --- a/tests/codegen/sanitizer-cfi-emit-type-checks-attr-no-sanitize.rs +++ b/tests/codegen/sanitizer/cfi-emit-type-checks-attr-no-sanitize.rs @@ -8,7 +8,7 @@ #[no_sanitize(cfi)] pub fn foo(f: fn(i32) -> i32, arg: i32) -> i32 { - // CHECK-LABEL: sanitizer_cfi_emit_type_checks_attr_no_sanitize::foo + // CHECK-LABEL: cfi_emit_type_checks_attr_no_sanitize::foo // CHECK: Function Attrs: {{.*}} // CHECK-LABEL: define{{.*}}foo{{.*}}!type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} // CHECK: start: diff --git a/tests/codegen/sanitizer-cfi-emit-type-checks.rs b/tests/codegen/sanitizer/cfi-emit-type-checks.rs index f0fe5de9f66..f0fe5de9f66 100644 --- a/tests/codegen/sanitizer-cfi-emit-type-checks.rs +++ b/tests/codegen/sanitizer/cfi-emit-type-checks.rs diff --git a/tests/codegen/sanitizer-cfi-emit-type-metadata-attr-cfi-encoding.rs b/tests/codegen/sanitizer/cfi-emit-type-metadata-attr-cfi-encoding.rs index 084d8bf803c..084d8bf803c 100644 --- a/tests/codegen/sanitizer-cfi-emit-type-metadata-attr-cfi-encoding.rs +++ b/tests/codegen/sanitizer/cfi-emit-type-metadata-attr-cfi-encoding.rs diff --git a/tests/codegen/sanitizer-cfi-emit-type-metadata-id-itanium-cxx-abi.rs b/tests/codegen/sanitizer/cfi-emit-type-metadata-id-itanium-cxx-abi.rs index 63e63c5d4aa..da608e180c5 100644 --- a/tests/codegen/sanitizer-cfi-emit-type-metadata-id-itanium-cxx-abi.rs +++ b/tests/codegen/sanitizer/cfi-emit-type-metadata-id-itanium-cxx-abi.rs @@ -521,15 +521,15 @@ pub fn foo149(_: Type14<Bar>, _: Type14<Bar>, _: Type14<Bar>) { } // CHECK: ![[TYPE66]] = !{i64 0, !"_ZTSFvu3refIu5sliceIu3i32EEE"} // CHECK: ![[TYPE67]] = !{i64 0, !"_ZTSFvu3refIu5sliceIu3i32EES1_E"} // CHECK: ![[TYPE68]] = !{i64 0, !"_ZTSFvu3refIu5sliceIu3i32EES1_S1_E"} -// CHECK: ![[TYPE69]] = !{i64 0, !"_ZTSFvu3refIu{{[0-9]+}}NtC{{[[:print:]]+}}_51sanitizer_cfi_emit_type_metadata_id_itanium_cxx_abi7Struct1Iu3i32EEE"} -// CHECK: ![[TYPE70]] = !{i64 0, !"_ZTSFvu3refIu{{[0-9]+}}NtC{{[[:print:]]+}}_51sanitizer_cfi_emit_type_metadata_id_itanium_cxx_abi7Struct1Iu3i32EES1_E"} -// CHECK: ![[TYPE71]] = !{i64 0, !"_ZTSFvu3refIu{{[0-9]+}}NtC{{[[:print:]]+}}_51sanitizer_cfi_emit_type_metadata_id_itanium_cxx_abi7Struct1Iu3i32EES1_S1_E"} -// CHECK: ![[TYPE72]] = !{i64 0, !"_ZTSFvu3refIu{{[0-9]+}}NtC{{[[:print:]]+}}_51sanitizer_cfi_emit_type_metadata_id_itanium_cxx_abi5Enum1Iu3i32EEE"} -// CHECK: ![[TYPE73]] = !{i64 0, !"_ZTSFvu3refIu{{[0-9]+}}NtC{{[[:print:]]+}}_51sanitizer_cfi_emit_type_metadata_id_itanium_cxx_abi5Enum1Iu3i32EES1_E"} -// CHECK: ![[TYPE74]] = !{i64 0, !"_ZTSFvu3refIu{{[0-9]+}}NtC{{[[:print:]]+}}_51sanitizer_cfi_emit_type_metadata_id_itanium_cxx_abi5Enum1Iu3i32EES1_S1_E"} -// CHECK: ![[TYPE75]] = !{i64 0, !"_ZTSFvu3refIu{{[0-9]+}}NtC{{[[:print:]]+}}_51sanitizer_cfi_emit_type_metadata_id_itanium_cxx_abi6Union1Iu3i32EEE"} -// CHECK: ![[TYPE76]] = !{i64 0, !"_ZTSFvu3refIu{{[0-9]+}}NtC{{[[:print:]]+}}_51sanitizer_cfi_emit_type_metadata_id_itanium_cxx_abi6Union1Iu3i32EES1_E"} -// CHECK: ![[TYPE77]] = !{i64 0, !"_ZTSFvu3refIu{{[0-9]+}}NtC{{[[:print:]]+}}_51sanitizer_cfi_emit_type_metadata_id_itanium_cxx_abi6Union1Iu3i32EES1_S1_E"} +// CHECK: ![[TYPE69]] = !{i64 0, !"_ZTSFvu3refIu{{[0-9]+}}NtC{{[[:print:]]+}}_[[ITANIUMED_FILENAME:[0-9]{1,2}[a-z_]{1,99}]]7Struct1Iu3i32EEE"} +// CHECK: ![[TYPE70]] = !{i64 0, !"_ZTSFvu3refIu{{[0-9]+}}NtC{{[[:print:]]+}}_[[ITANIUMED_FILENAME]]7Struct1Iu3i32EES1_E"} +// CHECK: ![[TYPE71]] = !{i64 0, !"_ZTSFvu3refIu{{[0-9]+}}NtC{{[[:print:]]+}}_[[ITANIUMED_FILENAME]]7Struct1Iu3i32EES1_S1_E"} +// CHECK: ![[TYPE72]] = !{i64 0, !"_ZTSFvu3refIu{{[0-9]+}}NtC{{[[:print:]]+}}_[[ITANIUMED_FILENAME]]5Enum1Iu3i32EEE"} +// CHECK: ![[TYPE73]] = !{i64 0, !"_ZTSFvu3refIu{{[0-9]+}}NtC{{[[:print:]]+}}_[[ITANIUMED_FILENAME]]5Enum1Iu3i32EES1_E"} +// CHECK: ![[TYPE74]] = !{i64 0, !"_ZTSFvu3refIu{{[0-9]+}}NtC{{[[:print:]]+}}_[[ITANIUMED_FILENAME]]5Enum1Iu3i32EES1_S1_E"} +// CHECK: ![[TYPE75]] = !{i64 0, !"_ZTSFvu3refIu{{[0-9]+}}NtC{{[[:print:]]+}}_[[ITANIUMED_FILENAME]]6Union1Iu3i32EEE"} +// CHECK: ![[TYPE76]] = !{i64 0, !"_ZTSFvu3refIu{{[0-9]+}}NtC{{[[:print:]]+}}_[[ITANIUMED_FILENAME]]6Union1Iu3i32EES1_E"} +// CHECK: ![[TYPE77]] = !{i64 0, !"_ZTSFvu3refIu{{[0-9]+}}NtC{{[[:print:]]+}}_[[ITANIUMED_FILENAME]]6Union1Iu3i32EES1_S1_E"} // CHECK: ![[TYPE78]] = !{i64 0, !"_ZTSFvP5type1E"} // CHECK: ![[TYPE79]] = !{i64 0, !"_ZTSFvP5type1S0_E"} // CHECK: ![[TYPE80]] = !{i64 0, !"_ZTSFvP5type1S0_S0_E"} @@ -560,45 +560,45 @@ pub fn foo149(_: Type14<Bar>, _: Type14<Bar>, _: Type14<Bar>) { } // CHECK: ![[TYPE105]] = !{i64 0, !"_ZTSFvu3refIu3dynIu{{[0-9]+}}NtNtC{{[[:print:]]+}}_4core6marker4Sendu6regionEEE"} // CHECK: ![[TYPE106]] = !{i64 0, !"_ZTSFvu3refIu3dynIu{{[0-9]+}}NtNtC{{[[:print:]]+}}_4core6marker4Sendu6regionEES2_E"} // CHECK: ![[TYPE107]] = !{i64 0, !"_ZTSFvu3refIu3dynIu{{[0-9]+}}NtNtC{{[[:print:]]+}}_4core6marker4Sendu6regionEES2_S2_E"} -// CHECK: ![[TYPE108]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NCNvC{{[[:print:]]+}}_51sanitizer_cfi_emit_type_metadata_id_itanium_cxx_abi3fn111{{[{}][{}]}}closure{{[}][}]}}Iu2i8PFvvEvEE"} -// CHECK: ![[TYPE109]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NCNvC{{[[:print:]]+}}_51sanitizer_cfi_emit_type_metadata_id_itanium_cxx_abi3fn111{{[{}][{}]}}closure{{[}][}]}}Iu2i8PFvvEvES1_E"} -// CHECK: ![[TYPE110]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NCNvC{{[[:print:]]+}}_51sanitizer_cfi_emit_type_metadata_id_itanium_cxx_abi3fn111{{[{}][{}]}}closure{{[}][}]}}Iu2i8PFvvEvES1_S1_E"} -// CHECK: ![[TYPE111]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NcNtNvC{{[[:print:]]+}}_51sanitizer_cfi_emit_type_metadata_id_itanium_cxx_abi3fn13Foo15{{[{}][{}]}}constructor{{[}][}]}}E"} -// CHECK: ![[TYPE112]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NcNtNvC{{[[:print:]]+}}_51sanitizer_cfi_emit_type_metadata_id_itanium_cxx_abi3fn13Foo15{{[{}][{}]}}constructor{{[}][}]}}S_E"} -// CHECK: ![[TYPE113]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NcNtNvC{{[[:print:]]+}}_51sanitizer_cfi_emit_type_metadata_id_itanium_cxx_abi3fn13Foo15{{[{}][{}]}}constructor{{[}][}]}}S_S_E"} -// CHECK: ![[TYPE114]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NvNFNvC{{[[:print:]]+}}_51sanitizer_cfi_emit_type_metadata_id_itanium_cxx_abi3fn110{{[{}][{}]}}extern{{[}][}]}}3fooE"} -// CHECK: ![[TYPE115]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NvNFNvC{{[[:print:]]+}}_51sanitizer_cfi_emit_type_metadata_id_itanium_cxx_abi3fn110{{[{}][{}]}}extern{{[}][}]}}3fooS_E"} -// CHECK: ![[TYPE116]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NvNFNvC{{[[:print:]]+}}_51sanitizer_cfi_emit_type_metadata_id_itanium_cxx_abi3fn110{{[{}][{}]}}extern{{[}][}]}}3fooS_S_E"} -// CHECK: ![[TYPE117]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NtNCNvC{{[[:print:]]+}}_51sanitizer_cfi_emit_type_metadata_id_itanium_cxx_abi3fn1s0_11{{[{}][{}]}}closure{{[}][}]}}3FooE"} -// CHECK: ![[TYPE118]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NtNCNvC{{[[:print:]]+}}_51sanitizer_cfi_emit_type_metadata_id_itanium_cxx_abi3fn1s0_11{{[{}][{}]}}closure{{[}][}]}}3FooS_E"} -// CHECK: ![[TYPE119]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NtNCNvC{{[[:print:]]+}}_51sanitizer_cfi_emit_type_metadata_id_itanium_cxx_abi3fn1s0_11{{[{}][{}]}}closure{{[}][}]}}3FooS_S_E"} -// CHECK: ![[TYPE120]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NtNkNvC{{[[:print:]]+}}_51sanitizer_cfi_emit_type_metadata_id_itanium_cxx_abi3fn112{{[{}][{}]}}constant{{[}][}]}}3FooE"} -// CHECK: ![[TYPE121]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NtNkNvC{{[[:print:]]+}}_51sanitizer_cfi_emit_type_metadata_id_itanium_cxx_abi3fn112{{[{}][{}]}}constant{{[}][}]}}3FooS_E"} -// CHECK: ![[TYPE122]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NtNkNvC{{[[:print:]]+}}_51sanitizer_cfi_emit_type_metadata_id_itanium_cxx_abi3fn112{{[{}][{}]}}constant{{[}][}]}}3FooS_S_E"} -// CHECK: ![[TYPE123]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NvNINvC{{[[:print:]]+}}_51sanitizer_cfi_emit_type_metadata_id_itanium_cxx_abi3fn18{{[{}][{}]}}impl{{[}][}]}}3fooIu3i32EE"} -// CHECK: ![[TYPE124]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NvNINvC{{[[:print:]]+}}_51sanitizer_cfi_emit_type_metadata_id_itanium_cxx_abi3fn18{{[{}][{}]}}impl{{[}][}]}}3fooIu3i32ES0_E"} -// CHECK: ![[TYPE125]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NvNINvC{{[[:print:]]+}}_51sanitizer_cfi_emit_type_metadata_id_itanium_cxx_abi3fn18{{[{}][{}]}}impl{{[}][}]}}3fooIu3i32ES0_S0_E"} -// CHECK: ![[TYPE126]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NvNtC{{[[:print:]]+}}_51sanitizer_cfi_emit_type_metadata_id_itanium_cxx_abi6Trait13fooIu3dynIu{{[0-9]+}}NtC{{[[:print:]]+}}_51sanitizer_cfi_emit_type_metadata_id_itanium_cxx_abi6Trait1Iu5paramEu6regionEu3i32EE"} -// CHECK: ![[TYPE127]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NvNtC{{[[:print:]]+}}_51sanitizer_cfi_emit_type_metadata_id_itanium_cxx_abi6Trait13fooIu3dynIu{{[0-9]+}}NtC{{[[:print:]]+}}_51sanitizer_cfi_emit_type_metadata_id_itanium_cxx_abi6Trait1Iu5paramEu6regionEu3i32ES4_E"} -// CHECK: ![[TYPE128]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NvNtC{{[[:print:]]+}}_51sanitizer_cfi_emit_type_metadata_id_itanium_cxx_abi6Trait13fooIu3dynIu{{[0-9]+}}NtC{{[[:print:]]+}}_51sanitizer_cfi_emit_type_metadata_id_itanium_cxx_abi6Trait1Iu5paramEu6regionEu3i32ES4_S4_E"} -// CHECK: ![[TYPE129]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NvNtC{{[[:print:]]+}}_51sanitizer_cfi_emit_type_metadata_id_itanium_cxx_abi6Trait13fooIu3i32S_EE"} -// CHECK: ![[TYPE130]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NvNtC{{[[:print:]]+}}_51sanitizer_cfi_emit_type_metadata_id_itanium_cxx_abi6Trait13fooIu3i32S_ES0_E"} -// CHECK: ![[TYPE131]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NvNtC{{[[:print:]]+}}_51sanitizer_cfi_emit_type_metadata_id_itanium_cxx_abi6Trait13fooIu3i32S_ES0_S0_E"} -// CHECK: ![[TYPE132]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NvNtC{{[[:print:]]+}}_51sanitizer_cfi_emit_type_metadata_id_itanium_cxx_abi6Trait13fooIu{{[0-9]+}}NtC{{[[:print:]]+}}_51sanitizer_cfi_emit_type_metadata_id_itanium_cxx_abi7Struct1Iu3i32ES_EE"} -// CHECK: ![[TYPE133]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NvNtC{{[[:print:]]+}}_51sanitizer_cfi_emit_type_metadata_id_itanium_cxx_abi6Trait13fooIu{{[0-9]+}}NtC{{[[:print:]]+}}_51sanitizer_cfi_emit_type_metadata_id_itanium_cxx_abi7Struct1Iu3i32ES_ES1_E"} -// CHECK: ![[TYPE134]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NvNtC{{[[:print:]]+}}_51sanitizer_cfi_emit_type_metadata_id_itanium_cxx_abi6Trait13fooIu{{[0-9]+}}NtC{{[[:print:]]+}}_51sanitizer_cfi_emit_type_metadata_id_itanium_cxx_abi7Struct1Iu3i32ES_ES1_S1_E"} -// CHECK: ![[TYPE135]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NtNvC{{[[:print:]]+}}_51sanitizer_cfi_emit_type_metadata_id_itanium_cxx_abi3fn13QuxIu3i32Lu5usize32EEE"} -// CHECK: ![[TYPE136]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NtNvC{{[[:print:]]+}}_51sanitizer_cfi_emit_type_metadata_id_itanium_cxx_abi3fn13QuxIu3i32Lu5usize32EES2_E"} -// CHECK: ![[TYPE137]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NtNvC{{[[:print:]]+}}_51sanitizer_cfi_emit_type_metadata_id_itanium_cxx_abi3fn13QuxIu3i32Lu5usize32EES2_S2_E"} -// CHECK: ![[TYPE138]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NcNtNvC{{[[:print:]]+}}_51sanitizer_cfi_emit_type_metadata_id_itanium_cxx_abi3fn15Quuux15{{[{}][{}]}}constructor{{[}][}]}}Iu6regionS_EE"} -// CHECK: ![[TYPE139]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NcNtNvC{{[[:print:]]+}}_51sanitizer_cfi_emit_type_metadata_id_itanium_cxx_abi3fn15Quuux15{{[{}][{}]}}constructor{{[}][}]}}Iu6regionS_ES0_E"} -// CHECK: ![[TYPE140]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NcNtNvC{{[[:print:]]+}}_51sanitizer_cfi_emit_type_metadata_id_itanium_cxx_abi3fn15Quuux15{{[{}][{}]}}constructor{{[}][}]}}Iu6regionS_ES0_S0_E"} -// CHECK: ![[TYPE141]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NtC{{[[:print:]]+}}_51sanitizer_cfi_emit_type_metadata_id_itanium_cxx_abi3FooE"} -// CHECK: ![[TYPE142]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NtC{{[[:print:]]+}}_51sanitizer_cfi_emit_type_metadata_id_itanium_cxx_abi3FooS_E"} -// CHECK: ![[TYPE143]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NtC{{[[:print:]]+}}_51sanitizer_cfi_emit_type_metadata_id_itanium_cxx_abi3FooS_S_E"} +// CHECK: ![[TYPE108]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NCNvC{{[[:print:]]+}}_[[ITANIUMED_FILENAME]]3fn111{{[{}][{}]}}closure{{[}][}]}}Iu2i8PFvvEvEE"} +// CHECK: ![[TYPE109]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NCNvC{{[[:print:]]+}}_[[ITANIUMED_FILENAME]]3fn111{{[{}][{}]}}closure{{[}][}]}}Iu2i8PFvvEvES1_E"} +// CHECK: ![[TYPE110]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NCNvC{{[[:print:]]+}}_[[ITANIUMED_FILENAME]]3fn111{{[{}][{}]}}closure{{[}][}]}}Iu2i8PFvvEvES1_S1_E"} +// CHECK: ![[TYPE111]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NcNtNvC{{[[:print:]]+}}_[[ITANIUMED_FILENAME]]3fn13Foo15{{[{}][{}]}}constructor{{[}][}]}}E"} +// CHECK: ![[TYPE112]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NcNtNvC{{[[:print:]]+}}_[[ITANIUMED_FILENAME]]3fn13Foo15{{[{}][{}]}}constructor{{[}][}]}}S_E"} +// CHECK: ![[TYPE113]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NcNtNvC{{[[:print:]]+}}_[[ITANIUMED_FILENAME]]3fn13Foo15{{[{}][{}]}}constructor{{[}][}]}}S_S_E"} +// CHECK: ![[TYPE114]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NvNFNvC{{[[:print:]]+}}_[[ITANIUMED_FILENAME]]3fn110{{[{}][{}]}}extern{{[}][}]}}3fooE"} +// CHECK: ![[TYPE115]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NvNFNvC{{[[:print:]]+}}_[[ITANIUMED_FILENAME]]3fn110{{[{}][{}]}}extern{{[}][}]}}3fooS_E"} +// CHECK: ![[TYPE116]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NvNFNvC{{[[:print:]]+}}_[[ITANIUMED_FILENAME]]3fn110{{[{}][{}]}}extern{{[}][}]}}3fooS_S_E"} +// CHECK: ![[TYPE117]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NtNCNvC{{[[:print:]]+}}_[[ITANIUMED_FILENAME]]3fn1s0_11{{[{}][{}]}}closure{{[}][}]}}3FooE"} +// CHECK: ![[TYPE118]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NtNCNvC{{[[:print:]]+}}_[[ITANIUMED_FILENAME]]3fn1s0_11{{[{}][{}]}}closure{{[}][}]}}3FooS_E"} +// CHECK: ![[TYPE119]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NtNCNvC{{[[:print:]]+}}_[[ITANIUMED_FILENAME]]3fn1s0_11{{[{}][{}]}}closure{{[}][}]}}3FooS_S_E"} +// CHECK: ![[TYPE120]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NtNkNvC{{[[:print:]]+}}_[[ITANIUMED_FILENAME]]3fn112{{[{}][{}]}}constant{{[}][}]}}3FooE"} +// CHECK: ![[TYPE121]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NtNkNvC{{[[:print:]]+}}_[[ITANIUMED_FILENAME]]3fn112{{[{}][{}]}}constant{{[}][}]}}3FooS_E"} +// CHECK: ![[TYPE122]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NtNkNvC{{[[:print:]]+}}_[[ITANIUMED_FILENAME]]3fn112{{[{}][{}]}}constant{{[}][}]}}3FooS_S_E"} +// CHECK: ![[TYPE123]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NvNINvC{{[[:print:]]+}}_[[ITANIUMED_FILENAME]]3fn18{{[{}][{}]}}impl{{[}][}]}}3fooIu3i32EE"} +// CHECK: ![[TYPE124]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NvNINvC{{[[:print:]]+}}_[[ITANIUMED_FILENAME]]3fn18{{[{}][{}]}}impl{{[}][}]}}3fooIu3i32ES0_E"} +// CHECK: ![[TYPE125]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NvNINvC{{[[:print:]]+}}_[[ITANIUMED_FILENAME]]3fn18{{[{}][{}]}}impl{{[}][}]}}3fooIu3i32ES0_S0_E"} +// CHECK: ![[TYPE126]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NvNtC{{[[:print:]]+}}_[[ITANIUMED_FILENAME]]6Trait13fooIu3dynIu{{[0-9]+}}NtC{{[[:print:]]+}}_[[ITANIUMED_FILENAME]]6Trait1Iu5paramEu6regionEu3i32EE"} +// CHECK: ![[TYPE127]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NvNtC{{[[:print:]]+}}_[[ITANIUMED_FILENAME]]6Trait13fooIu3dynIu{{[0-9]+}}NtC{{[[:print:]]+}}_[[ITANIUMED_FILENAME]]6Trait1Iu5paramEu6regionEu3i32ES4_E"} +// CHECK: ![[TYPE128]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NvNtC{{[[:print:]]+}}_[[ITANIUMED_FILENAME]]6Trait13fooIu3dynIu{{[0-9]+}}NtC{{[[:print:]]+}}_[[ITANIUMED_FILENAME]]6Trait1Iu5paramEu6regionEu3i32ES4_S4_E"} +// CHECK: ![[TYPE129]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NvNtC{{[[:print:]]+}}_[[ITANIUMED_FILENAME]]6Trait13fooIu3i32S_EE"} +// CHECK: ![[TYPE130]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NvNtC{{[[:print:]]+}}_[[ITANIUMED_FILENAME]]6Trait13fooIu3i32S_ES0_E"} +// CHECK: ![[TYPE131]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NvNtC{{[[:print:]]+}}_[[ITANIUMED_FILENAME]]6Trait13fooIu3i32S_ES0_S0_E"} +// CHECK: ![[TYPE132]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NvNtC{{[[:print:]]+}}_[[ITANIUMED_FILENAME]]6Trait13fooIu{{[0-9]+}}NtC{{[[:print:]]+}}_[[ITANIUMED_FILENAME]]7Struct1Iu3i32ES_EE"} +// CHECK: ![[TYPE133]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NvNtC{{[[:print:]]+}}_[[ITANIUMED_FILENAME]]6Trait13fooIu{{[0-9]+}}NtC{{[[:print:]]+}}_[[ITANIUMED_FILENAME]]7Struct1Iu3i32ES_ES1_E"} +// CHECK: ![[TYPE134]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NvNtC{{[[:print:]]+}}_[[ITANIUMED_FILENAME]]6Trait13fooIu{{[0-9]+}}NtC{{[[:print:]]+}}_[[ITANIUMED_FILENAME]]7Struct1Iu3i32ES_ES1_S1_E"} +// CHECK: ![[TYPE135]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NtNvC{{[[:print:]]+}}_[[ITANIUMED_FILENAME]]3fn13QuxIu3i32Lu5usize32EEE"} +// CHECK: ![[TYPE136]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NtNvC{{[[:print:]]+}}_[[ITANIUMED_FILENAME]]3fn13QuxIu3i32Lu5usize32EES2_E"} +// CHECK: ![[TYPE137]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NtNvC{{[[:print:]]+}}_[[ITANIUMED_FILENAME]]3fn13QuxIu3i32Lu5usize32EES2_S2_E"} +// CHECK: ![[TYPE138]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NcNtNvC{{[[:print:]]+}}_[[ITANIUMED_FILENAME]]3fn15Quuux15{{[{}][{}]}}constructor{{[}][}]}}Iu6regionS_EE"} +// CHECK: ![[TYPE139]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NcNtNvC{{[[:print:]]+}}_[[ITANIUMED_FILENAME]]3fn15Quuux15{{[{}][{}]}}constructor{{[}][}]}}Iu6regionS_ES0_E"} +// CHECK: ![[TYPE140]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NcNtNvC{{[[:print:]]+}}_[[ITANIUMED_FILENAME]]3fn15Quuux15{{[{}][{}]}}constructor{{[}][}]}}Iu6regionS_ES0_S0_E"} +// CHECK: ![[TYPE141]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NtC{{[[:print:]]+}}_[[ITANIUMED_FILENAME]]3FooE"} +// CHECK: ![[TYPE142]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NtC{{[[:print:]]+}}_[[ITANIUMED_FILENAME]]3FooS_E"} +// CHECK: ![[TYPE143]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NtC{{[[:print:]]+}}_[[ITANIUMED_FILENAME]]3FooS_S_E"} // CHECK: ![[TYPE144]] = !{i64 0, !"_ZTSFvu3refIvEE"} // CHECK: ![[TYPE145]] = !{i64 0, !"_ZTSFvu3refIvES_E"} // CHECK: ![[TYPE146]] = !{i64 0, !"_ZTSFvu3refIvES_S_E"} -// CHECK: ![[TYPE147]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NtC{{[[:print:]]+}}_51sanitizer_cfi_emit_type_metadata_id_itanium_cxx_abi3BarE"} -// CHECK: ![[TYPE148]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NtC{{[[:print:]]+}}_51sanitizer_cfi_emit_type_metadata_id_itanium_cxx_abi3BarS_E"} -// CHECK: ![[TYPE149]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NtC{{[[:print:]]+}}_51sanitizer_cfi_emit_type_metadata_id_itanium_cxx_abi3BarS_S_E"} +// CHECK: ![[TYPE147]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NtC{{[[:print:]]+}}_[[ITANIUMED_FILENAME]]3BarE"} +// CHECK: ![[TYPE148]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NtC{{[[:print:]]+}}_[[ITANIUMED_FILENAME]]3BarS_E"} +// CHECK: ![[TYPE149]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NtC{{[[:print:]]+}}_[[ITANIUMED_FILENAME]]3BarS_S_E"} diff --git a/tests/codegen/sanitizer-cfi-emit-type-metadata-itanium-cxx-abi-generalized.rs b/tests/codegen/sanitizer/cfi-emit-type-metadata-itanium-cxx-abi-generalized.rs index d200ed9798a..d200ed9798a 100644 --- a/tests/codegen/sanitizer-cfi-emit-type-metadata-itanium-cxx-abi-generalized.rs +++ b/tests/codegen/sanitizer/cfi-emit-type-metadata-itanium-cxx-abi-generalized.rs diff --git a/tests/codegen/sanitizer-cfi-emit-type-metadata-itanium-cxx-abi-normalized-generalized.rs b/tests/codegen/sanitizer/cfi-emit-type-metadata-itanium-cxx-abi-normalized-generalized.rs index cdefec17a1c..cdefec17a1c 100644 --- a/tests/codegen/sanitizer-cfi-emit-type-metadata-itanium-cxx-abi-normalized-generalized.rs +++ b/tests/codegen/sanitizer/cfi-emit-type-metadata-itanium-cxx-abi-normalized-generalized.rs diff --git a/tests/codegen/sanitizer-cfi-emit-type-metadata-itanium-cxx-abi-normalized.rs b/tests/codegen/sanitizer/cfi-emit-type-metadata-itanium-cxx-abi-normalized.rs index f360b33ddcf..f360b33ddcf 100644 --- a/tests/codegen/sanitizer-cfi-emit-type-metadata-itanium-cxx-abi-normalized.rs +++ b/tests/codegen/sanitizer/cfi-emit-type-metadata-itanium-cxx-abi-normalized.rs diff --git a/tests/codegen/sanitizer-cfi-emit-type-metadata-itanium-cxx-abi.rs b/tests/codegen/sanitizer/cfi-emit-type-metadata-itanium-cxx-abi.rs index 3cb817b212d..3cb817b212d 100644 --- a/tests/codegen/sanitizer-cfi-emit-type-metadata-itanium-cxx-abi.rs +++ b/tests/codegen/sanitizer/cfi-emit-type-metadata-itanium-cxx-abi.rs diff --git a/tests/codegen/sanitizer-cfi-emit-type-metadata-trait-objects.rs b/tests/codegen/sanitizer/cfi-emit-type-metadata-trait-objects.rs index b69e57261a8..b69e57261a8 100644 --- a/tests/codegen/sanitizer-cfi-emit-type-metadata-trait-objects.rs +++ b/tests/codegen/sanitizer/cfi-emit-type-metadata-trait-objects.rs diff --git a/tests/codegen/sanitizer-cfi-generalize-pointers.rs b/tests/codegen/sanitizer/cfi-generalize-pointers.rs index 677ebdb27ec..677ebdb27ec 100644 --- a/tests/codegen/sanitizer-cfi-generalize-pointers.rs +++ b/tests/codegen/sanitizer/cfi-generalize-pointers.rs diff --git a/tests/codegen/sanitizer-cfi-normalize-integers.rs b/tests/codegen/sanitizer/cfi-normalize-integers.rs index aa3913cb8e7..aa3913cb8e7 100644 --- a/tests/codegen/sanitizer-cfi-normalize-integers.rs +++ b/tests/codegen/sanitizer/cfi-normalize-integers.rs diff --git a/tests/codegen/sanitizer-kasan-emits-instrumentation.rs b/tests/codegen/sanitizer/kasan-emits-instrumentation.rs index d6e3f2719df..783bc47b9d0 100644 --- a/tests/codegen/sanitizer-kasan-emits-instrumentation.rs +++ b/tests/codegen/sanitizer/kasan-emits-instrumentation.rs @@ -25,7 +25,7 @@ trait Copy {} impl Copy for u8 {} -// CHECK-LABEL: ; sanitizer_kasan_emits_instrumentation::unsanitized +// CHECK-LABEL: ; kasan_emits_instrumentation::unsanitized // CHECK-NEXT: ; Function Attrs: // CHECK-NOT: sanitize_address // CHECK: start: @@ -36,7 +36,7 @@ pub fn unsanitized(b: &mut u8) -> u8 { *b } -// CHECK-LABEL: ; sanitizer_kasan_emits_instrumentation::sanitized +// CHECK-LABEL: ; kasan_emits_instrumentation::sanitized // CHECK-NEXT: ; Function Attrs: // CHECK: sanitize_address // CHECK: start: diff --git a/tests/codegen/sanitizer-kcfi-add-kcfi-flag.rs b/tests/codegen/sanitizer/kcfi-add-kcfi-flag.rs index c2eb852aec3..c2eb852aec3 100644 --- a/tests/codegen/sanitizer-kcfi-add-kcfi-flag.rs +++ b/tests/codegen/sanitizer/kcfi-add-kcfi-flag.rs diff --git a/tests/codegen/sanitizer-kcfi-emit-kcfi-operand-bundle-attr-no-sanitize.rs b/tests/codegen/sanitizer/kcfi-emit-kcfi-operand-bundle-attr-no-sanitize.rs index bb317e4a2fa..001fc956aaa 100644 --- a/tests/codegen/sanitizer-kcfi-emit-kcfi-operand-bundle-attr-no-sanitize.rs +++ b/tests/codegen/sanitizer/kcfi-emit-kcfi-operand-bundle-attr-no-sanitize.rs @@ -20,7 +20,7 @@ impl Copy for i32 {} #[no_sanitize(kcfi)] pub fn foo(f: fn(i32) -> i32, arg: i32) -> i32 { - // CHECK-LABEL: sanitizer_kcfi_emit_kcfi_operand_bundle_attr_no_sanitize::foo + // CHECK-LABEL: kcfi_emit_kcfi_operand_bundle_attr_no_sanitize::foo // CHECK: Function Attrs: {{.*}} // CHECK-LABEL: define{{.*}}foo{{.*}}!{{<unknown kind #36>|kcfi_type}} !{{[0-9]+}} // CHECK: start: diff --git a/tests/codegen/sanitizer-kcfi-emit-kcfi-operand-bundle-itanium-cxx-abi-generalized.rs b/tests/codegen/sanitizer/kcfi-emit-kcfi-operand-bundle-itanium-cxx-abi-generalized.rs index 29e4df3511f..29e4df3511f 100644 --- a/tests/codegen/sanitizer-kcfi-emit-kcfi-operand-bundle-itanium-cxx-abi-generalized.rs +++ b/tests/codegen/sanitizer/kcfi-emit-kcfi-operand-bundle-itanium-cxx-abi-generalized.rs diff --git a/tests/codegen/sanitizer-kcfi-emit-kcfi-operand-bundle-itanium-cxx-abi-normalized-generalized.rs b/tests/codegen/sanitizer/kcfi-emit-kcfi-operand-bundle-itanium-cxx-abi-normalized-generalized.rs index 84d678a33ba..84d678a33ba 100644 --- a/tests/codegen/sanitizer-kcfi-emit-kcfi-operand-bundle-itanium-cxx-abi-normalized-generalized.rs +++ b/tests/codegen/sanitizer/kcfi-emit-kcfi-operand-bundle-itanium-cxx-abi-normalized-generalized.rs diff --git a/tests/codegen/sanitizer-kcfi-emit-kcfi-operand-bundle-itanium-cxx-abi-normalized.rs b/tests/codegen/sanitizer/kcfi-emit-kcfi-operand-bundle-itanium-cxx-abi-normalized.rs index 761c37a9e06..761c37a9e06 100644 --- a/tests/codegen/sanitizer-kcfi-emit-kcfi-operand-bundle-itanium-cxx-abi-normalized.rs +++ b/tests/codegen/sanitizer/kcfi-emit-kcfi-operand-bundle-itanium-cxx-abi-normalized.rs diff --git a/tests/codegen/sanitizer-kcfi-emit-kcfi-operand-bundle-itanium-cxx-abi.rs b/tests/codegen/sanitizer/kcfi-emit-kcfi-operand-bundle-itanium-cxx-abi.rs index 83cda0ef136..83cda0ef136 100644 --- a/tests/codegen/sanitizer-kcfi-emit-kcfi-operand-bundle-itanium-cxx-abi.rs +++ b/tests/codegen/sanitizer/kcfi-emit-kcfi-operand-bundle-itanium-cxx-abi.rs diff --git a/tests/codegen/sanitizer-kcfi-emit-kcfi-operand-bundle.rs b/tests/codegen/sanitizer/kcfi-emit-kcfi-operand-bundle.rs index e1d617b5ee1..e1d617b5ee1 100644 --- a/tests/codegen/sanitizer-kcfi-emit-kcfi-operand-bundle.rs +++ b/tests/codegen/sanitizer/kcfi-emit-kcfi-operand-bundle.rs diff --git a/tests/codegen/sanitizer-kcfi-emit-type-metadata-trait-objects.rs b/tests/codegen/sanitizer/kcfi-emit-type-metadata-trait-objects.rs index 7aed137f215..7aed137f215 100644 --- a/tests/codegen/sanitizer-kcfi-emit-type-metadata-trait-objects.rs +++ b/tests/codegen/sanitizer/kcfi-emit-type-metadata-trait-objects.rs diff --git a/tests/codegen/sanitizer-memory-track-orgins.rs b/tests/codegen/sanitizer/memory-track-origins.rs index 4bd50508d15..4bd50508d15 100644 --- a/tests/codegen/sanitizer-memory-track-orgins.rs +++ b/tests/codegen/sanitizer/memory-track-origins.rs diff --git a/tests/codegen/sanitizer_memtag_attr_check.rs b/tests/codegen/sanitizer/memtag-attr-check.rs index 2fd362656d4..2fd362656d4 100644 --- a/tests/codegen/sanitizer_memtag_attr_check.rs +++ b/tests/codegen/sanitizer/memtag-attr-check.rs diff --git a/tests/codegen/sanitizer-no-sanitize-inlining.rs b/tests/codegen/sanitizer/no-sanitize-inlining.rs index f4af60baefe..f4af60baefe 100644 --- a/tests/codegen/sanitizer-no-sanitize-inlining.rs +++ b/tests/codegen/sanitizer/no-sanitize-inlining.rs diff --git a/tests/codegen/sanitizer-no-sanitize.rs b/tests/codegen/sanitizer/no-sanitize.rs index fb9d249da03..783b568e279 100644 --- a/tests/codegen/sanitizer-no-sanitize.rs +++ b/tests/codegen/sanitizer/no-sanitize.rs @@ -7,7 +7,7 @@ #![crate_type="lib"] #![feature(no_sanitize)] -// CHECK-LABEL: ; sanitizer_no_sanitize::unsanitized +// CHECK-LABEL: ; no_sanitize::unsanitized // CHECK-NEXT: ; Function Attrs: // CHECK-NOT: sanitize_address // CHECK: start: @@ -18,7 +18,7 @@ pub fn unsanitized(b: &mut u8) -> u8 { *b } -// CHECK-LABEL: ; sanitizer_no_sanitize::sanitized +// CHECK-LABEL: ; no_sanitize::sanitized // CHECK-NEXT: ; Function Attrs: // CHECK: sanitize_address // CHECK: start: diff --git a/tests/codegen/sanitizer-safestack-attr-check.rs b/tests/codegen/sanitizer/safestack-attr-check.rs index b73ed00e730..b73ed00e730 100644 --- a/tests/codegen/sanitizer-safestack-attr-check.rs +++ b/tests/codegen/sanitizer/safestack-attr-check.rs diff --git a/tests/codegen/sanitizer-recover.rs b/tests/codegen/sanitizer/sanitizer-recover.rs index 7b00fcf8e1b..7b00fcf8e1b 100644 --- a/tests/codegen/sanitizer-recover.rs +++ b/tests/codegen/sanitizer/sanitizer-recover.rs diff --git a/tests/codegen/sanitizer_scs_attr_check.rs b/tests/codegen/sanitizer/scs-attr-check.rs index a885d911717..a885d911717 100644 --- a/tests/codegen/sanitizer_scs_attr_check.rs +++ b/tests/codegen/sanitizer/scs-attr-check.rs diff --git a/tests/codegen/simd-wide-sum.rs b/tests/codegen/simd/simd-wide-sum.rs index 3116f9597bc..3116f9597bc 100644 --- a/tests/codegen/simd-wide-sum.rs +++ b/tests/codegen/simd/simd-wide-sum.rs diff --git a/tests/codegen/simd_arith_offset.rs b/tests/codegen/simd/simd_arith_offset.rs index 1ee73de1186..1ee73de1186 100644 --- a/tests/codegen/simd_arith_offset.rs +++ b/tests/codegen/simd/simd_arith_offset.rs diff --git a/tests/codegen/swap-simd-types.rs b/tests/codegen/simd/swap-simd-types.rs index 3472a42b0e6..3472a42b0e6 100644 --- a/tests/codegen/swap-simd-types.rs +++ b/tests/codegen/simd/swap-simd-types.rs diff --git a/tests/codegen/unpadded-simd.rs b/tests/codegen/simd/unpadded-simd.rs index eb44dbd9313..eb44dbd9313 100644 --- a/tests/codegen/unpadded-simd.rs +++ b/tests/codegen/simd/unpadded-simd.rs diff --git a/tests/codegen/unwind-abis/thiscall-unwind-abi.rs b/tests/codegen/unwind-abis/thiscall-unwind-abi.rs index 7e81367fc5b..0a02755a2cd 100644 --- a/tests/codegen/unwind-abis/thiscall-unwind-abi.rs +++ b/tests/codegen/unwind-abis/thiscall-unwind-abi.rs @@ -1,7 +1,7 @@ // needs-llvm-components: x86 // compile-flags: --target=i686-pc-windows-msvc --crate-type=rlib -Cno-prepopulate-passes #![no_core] -#![feature(no_core, lang_items, c_unwind, abi_thiscall)] +#![feature(no_core, lang_items, c_unwind)] #[lang="sized"] trait Sized { } diff --git a/tests/codegen/vec-calloc-llvm14.rs b/tests/codegen/vec-calloc-llvm14.rs deleted file mode 100644 index 08302796c41..00000000000 --- a/tests/codegen/vec-calloc-llvm14.rs +++ /dev/null @@ -1,144 +0,0 @@ -// compile-flags: -O -// only-x86_64 -// ignore-debug - -#![crate_type = "lib"] - -// CHECK-LABEL: @vec_zero_bytes -#[no_mangle] -pub fn vec_zero_bytes(n: usize) -> Vec<u8> { - // CHECK-NOT: call {{.*}}alloc::vec::from_elem - // CHECK-NOT: call {{.*}}reserve - // CHECK-NOT: call {{.*}}__rust_alloc( - // CHECK-NOT: call {{.*}}llvm.memset - - // CHECK: call {{.*}}__rust_alloc_zeroed( - - // CHECK-NOT: call {{.*}}alloc::vec::from_elem - // CHECK-NOT: call {{.*}}reserve - // CHECK-NOT: call {{.*}}__rust_alloc( - // CHECK-NOT: call {{.*}}llvm.memset - - // CHECK: ret void - vec![0; n] -} - -// CHECK-LABEL: @vec_one_bytes -#[no_mangle] -pub fn vec_one_bytes(n: usize) -> Vec<u8> { - // CHECK-NOT: call {{.*}}alloc::vec::from_elem - // CHECK-NOT: call {{.*}}reserve - // CHECK-NOT: call {{.*}}__rust_alloc_zeroed( - - // CHECK: call {{.*}}__rust_alloc( - // CHECK: call {{.*}}llvm.memset - - // CHECK-NOT: call {{.*}}alloc::vec::from_elem - // CHECK-NOT: call {{.*}}reserve - // CHECK-NOT: call {{.*}}__rust_alloc_zeroed( - - // CHECK: ret void - vec![1; n] -} - -// CHECK-LABEL: @vec_zero_scalar -#[no_mangle] -pub fn vec_zero_scalar(n: usize) -> Vec<i32> { - // CHECK-NOT: call {{.*}}alloc::vec::from_elem - // CHECK-NOT: call {{.*}}reserve - // CHECK-NOT: call {{.*}}__rust_alloc( - - // CHECK: call {{.*}}__rust_alloc_zeroed( - - // CHECK-NOT: call {{.*}}alloc::vec::from_elem - // CHECK-NOT: call {{.*}}reserve - // CHECK-NOT: call {{.*}}__rust_alloc( - - // CHECK: ret void - vec![0; n] -} - -// CHECK-LABEL: @vec_one_scalar -#[no_mangle] -pub fn vec_one_scalar(n: usize) -> Vec<i32> { - // CHECK-NOT: call {{.*}}alloc::vec::from_elem - // CHECK-NOT: call {{.*}}reserve - // CHECK-NOT: call {{.*}}__rust_alloc_zeroed( - - // CHECK: call {{.*}}__rust_alloc( - - // CHECK-NOT: call {{.*}}alloc::vec::from_elem - // CHECK-NOT: call {{.*}}reserve - // CHECK-NOT: call {{.*}}__rust_alloc_zeroed( - - // CHECK: ret void - vec![1; n] -} - -// CHECK-LABEL: @vec_zero_rgb48 -#[no_mangle] -pub fn vec_zero_rgb48(n: usize) -> Vec<[u16; 3]> { - // CHECK-NOT: call {{.*}}alloc::vec::from_elem - // CHECK-NOT: call {{.*}}reserve - // CHECK-NOT: call {{.*}}__rust_alloc( - - // CHECK: call {{.*}}__rust_alloc_zeroed( - - // CHECK-NOT: call {{.*}}alloc::vec::from_elem - // CHECK-NOT: call {{.*}}reserve - // CHECK-NOT: call {{.*}}__rust_alloc( - - // CHECK: ret void - vec![[0, 0, 0]; n] -} - -// CHECK-LABEL: @vec_zero_array_16 -#[no_mangle] -pub fn vec_zero_array_16(n: usize) -> Vec<[i64; 16]> { - // CHECK-NOT: call {{.*}}alloc::vec::from_elem - // CHECK-NOT: call {{.*}}reserve - // CHECK-NOT: call {{.*}}__rust_alloc( - - // CHECK: call {{.*}}__rust_alloc_zeroed( - - // CHECK-NOT: call {{.*}}alloc::vec::from_elem - // CHECK-NOT: call {{.*}}reserve - // CHECK-NOT: call {{.*}}__rust_alloc( - - // CHECK: ret void - vec![[0_i64; 16]; n] -} - -// CHECK-LABEL: @vec_zero_tuple -#[no_mangle] -pub fn vec_zero_tuple(n: usize) -> Vec<(i16, u8, char)> { - // CHECK-NOT: call {{.*}}alloc::vec::from_elem - // CHECK-NOT: call {{.*}}reserve - // CHECK-NOT: call {{.*}}__rust_alloc( - - // CHECK: call {{.*}}__rust_alloc_zeroed( - - // CHECK-NOT: call {{.*}}alloc::vec::from_elem - // CHECK-NOT: call {{.*}}reserve - // CHECK-NOT: call {{.*}}__rust_alloc( - - // CHECK: ret void - vec![(0, 0, '\0'); n] -} - -// CHECK-LABEL: @vec_non_zero_tuple -#[no_mangle] -pub fn vec_non_zero_tuple(n: usize) -> Vec<(i16, u8, char)> { - // CHECK-NOT: call {{.*}}alloc::vec::from_elem - // CHECK-NOT: call {{.*}}reserve - // CHECK-NOT: call {{.*}}__rust_alloc_zeroed( - - // CHECK: call {{.*}}__rust_alloc( - - // CHECK-NOT: call {{.*}}alloc::vec::from_elem - // CHECK-NOT: call {{.*}}reserve - // CHECK-NOT: call {{.*}}__rust_alloc_zeroed( - - // CHECK: ret void - vec![(0, 0, 'A'); n] -} diff --git a/tests/run-make/pretty-print-with-dep-file/Makefile b/tests/run-make/pretty-print-with-dep-file/Makefile new file mode 100644 index 00000000000..fa8089eb6a5 --- /dev/null +++ b/tests/run-make/pretty-print-with-dep-file/Makefile @@ -0,0 +1,9 @@ +include ../tools.mk + +all: + $(RUSTC) --emit=dep-info -Zunpretty=expanded with-dep.rs + $(CGREP) "with-dep.rs" < $(TMPDIR)/with-dep.d + -rm $(TMPDIR)/with-dep.d + + $(RUSTC) --emit=dep-info -Zunpretty=normal with-dep.rs + ! test -f $(TMPDIR)/with-dep.d diff --git a/tests/run-make/pretty-print-with-dep-file/with-dep.rs b/tests/run-make/pretty-print-with-dep-file/with-dep.rs new file mode 100644 index 00000000000..f328e4d9d04 --- /dev/null +++ b/tests/run-make/pretty-print-with-dep-file/with-dep.rs @@ -0,0 +1 @@ +fn main() {} diff --git a/tests/run-make/unknown-mod-stdin/Makefile b/tests/run-make/unknown-mod-stdin/Makefile new file mode 100644 index 00000000000..c1931765382 --- /dev/null +++ b/tests/run-make/unknown-mod-stdin/Makefile @@ -0,0 +1,15 @@ +# ignore-windows + +include ../tools.mk + +all: + echo 'mod unknown;' | $(RUSTC) --crate-type rlib - >$(TMPDIR)/unknown-mod.stdout 2>$(TMPDIR)/unknown-mod.stderr || echo "failed successfully" + +# Bless like this: RUSTC_BLESS_TEST=1 ./x.py test tests/run-make/unknown-mod-stdin +ifdef RUSTC_BLESS_TEST + cp "$(TMPDIR)"/unknown-mod.stdout unknown-mod.stdout + cp "$(TMPDIR)"/unknown-mod.stderr unknown-mod.stderr +else + $(DIFF) unknown-mod.stdout "$(TMPDIR)"/unknown-mod.stdout + $(DIFF) unknown-mod.stderr "$(TMPDIR)"/unknown-mod.stderr +endif diff --git a/tests/run-make/unknown-mod-stdin/unknown-mod.stderr b/tests/run-make/unknown-mod-stdin/unknown-mod.stderr new file mode 100644 index 00000000000..d7258fe4f68 --- /dev/null +++ b/tests/run-make/unknown-mod-stdin/unknown-mod.stderr @@ -0,0 +1,11 @@ +error[E0583]: file not found for module `unknown` + --> <anon>:1:1 + | +1 | mod unknown; + | ^^^^^^^^^^^^ + | + = help: to create the module `unknown`, create file "unknown.rs" or "unknown/mod.rs" + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0583`. diff --git a/tests/run-make/unknown-mod-stdin/unknown-mod.stdout b/tests/run-make/unknown-mod-stdin/unknown-mod.stdout new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/tests/run-make/unknown-mod-stdin/unknown-mod.stdout diff --git a/tests/rustdoc-gui/scrape-examples-toggle.goml b/tests/rustdoc-gui/scrape-examples-toggle.goml index 9cec6d2bbe8..f742b3186e5 100644 --- a/tests/rustdoc-gui/scrape-examples-toggle.goml +++ b/tests/rustdoc-gui/scrape-examples-toggle.goml @@ -28,18 +28,18 @@ define-function: ( call-function: ("check-color", { "theme": "ayu", - "toggle_line_color": "rgb(153, 153, 153)", - "toggle_line_hover_color": "rgb(197, 197, 197)", + "toggle_line_color": "#999", + "toggle_line_hover_color": "#c5c5c5", }) call-function: ("check-color", { "theme": "dark", - "toggle_line_color": "rgb(153, 153, 153)", - "toggle_line_hover_color": "rgb(197, 197, 197)", + "toggle_line_color": "#999", + "toggle_line_hover_color": "#c5c5c5", }) call-function: ("check-color", { "theme": "light", - "toggle_line_color": "rgb(204, 204, 204)", - "toggle_line_hover_color": "rgb(153, 153, 153)", + "toggle_line_color": "#ccc", + "toggle_line_hover_color": "#999", }) // Toggling all docs will close additional examples diff --git a/tests/rustdoc-gui/search-error.goml b/tests/rustdoc-gui/search-error.goml index d21905e90ae..70aeda1769a 100644 --- a/tests/rustdoc-gui/search-error.goml +++ b/tests/rustdoc-gui/search-error.goml @@ -20,20 +20,20 @@ call-function: ( "check-colors", { "theme": "ayu", - "error_background": "rgb(79, 76, 76)", + "error_background": "#4f4c4c", }, ) call-function: ( "check-colors", { "theme": "dark", - "error_background": "rgb(72, 72, 72)", + "error_background": "#484848", }, ) call-function: ( "check-colors", { "theme": "light", - "error_background": "rgb(208, 204, 204)", + "error_background": "#d0cccc", }, ) diff --git a/tests/ui/abi/stack-protector.rs b/tests/ui/abi/stack-protector.rs index 24bd2e21943..e94aa816d90 100644 --- a/tests/ui/abi/stack-protector.rs +++ b/tests/ui/abi/stack-protector.rs @@ -40,6 +40,8 @@ fn vulnerable_function() { // Overwrite the on-stack return address with the address of `malicious_code()`, // thereby jumping to that function when returning from `vulnerable_function()`. unsafe { fill(stackaddr, bad_code_ptr, 20); } + // Capture the address, so the write is not optimized away. + std::hint::black_box(stackaddr); } // Use an uninlined function with its own stack frame to make sure that we don't diff --git a/tests/ui/abi/unsupported.aarch64.stderr b/tests/ui/abi/unsupported.aarch64.stderr index e86a73ea60f..980457eeab5 100644 --- a/tests/ui/abi/unsupported.aarch64.stderr +++ b/tests/ui/abi/unsupported.aarch64.stderr @@ -1,53 +1,53 @@ error[E0570]: `"ptx-kernel"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:26:1 + --> $DIR/unsupported.rs:25:1 | LL | extern "ptx-kernel" fn ptx() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"amdgpu-kernel"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:28:1 + --> $DIR/unsupported.rs:27:1 | LL | extern "amdgpu-kernel" fn amdgpu() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"wasm"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:30:1 + --> $DIR/unsupported.rs:29:1 | LL | extern "wasm" fn wasm() {} | ^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"aapcs"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:32:1 + --> $DIR/unsupported.rs:31:1 | LL | extern "aapcs" fn aapcs() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"msp430-interrupt"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:36:1 + --> $DIR/unsupported.rs:35:1 | LL | extern "msp430-interrupt" fn msp430() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"avr-interrupt"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:38:1 + --> $DIR/unsupported.rs:37:1 | LL | extern "avr-interrupt" fn avr() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"x86-interrupt"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:40:1 + --> $DIR/unsupported.rs:39:1 | LL | extern "x86-interrupt" fn x86() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"thiscall"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:43:1 + --> $DIR/unsupported.rs:42:1 | LL | extern "thiscall" fn thiscall() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of calling convention not supported on this target - --> $DIR/unsupported.rs:47:1 + --> $DIR/unsupported.rs:46:1 | LL | extern "stdcall" fn stdcall() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/abi/unsupported.arm.stderr b/tests/ui/abi/unsupported.arm.stderr index f7569c8cdd7..450abd94886 100644 --- a/tests/ui/abi/unsupported.arm.stderr +++ b/tests/ui/abi/unsupported.arm.stderr @@ -1,47 +1,47 @@ error[E0570]: `"ptx-kernel"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:26:1 + --> $DIR/unsupported.rs:25:1 | LL | extern "ptx-kernel" fn ptx() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"amdgpu-kernel"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:28:1 + --> $DIR/unsupported.rs:27:1 | LL | extern "amdgpu-kernel" fn amdgpu() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"wasm"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:30:1 + --> $DIR/unsupported.rs:29:1 | LL | extern "wasm" fn wasm() {} | ^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"msp430-interrupt"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:36:1 + --> $DIR/unsupported.rs:35:1 | LL | extern "msp430-interrupt" fn msp430() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"avr-interrupt"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:38:1 + --> $DIR/unsupported.rs:37:1 | LL | extern "avr-interrupt" fn avr() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"x86-interrupt"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:40:1 + --> $DIR/unsupported.rs:39:1 | LL | extern "x86-interrupt" fn x86() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"thiscall"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:43:1 + --> $DIR/unsupported.rs:42:1 | LL | extern "thiscall" fn thiscall() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of calling convention not supported on this target - --> $DIR/unsupported.rs:47:1 + --> $DIR/unsupported.rs:46:1 | LL | extern "stdcall" fn stdcall() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/abi/unsupported.i686.stderr b/tests/ui/abi/unsupported.i686.stderr index 7ca93516db9..0340382a452 100644 --- a/tests/ui/abi/unsupported.i686.stderr +++ b/tests/ui/abi/unsupported.i686.stderr @@ -1,35 +1,35 @@ error[E0570]: `"ptx-kernel"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:26:1 + --> $DIR/unsupported.rs:25:1 | LL | extern "ptx-kernel" fn ptx() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"amdgpu-kernel"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:28:1 + --> $DIR/unsupported.rs:27:1 | LL | extern "amdgpu-kernel" fn amdgpu() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"wasm"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:30:1 + --> $DIR/unsupported.rs:29:1 | LL | extern "wasm" fn wasm() {} | ^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"aapcs"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:32:1 + --> $DIR/unsupported.rs:31:1 | LL | extern "aapcs" fn aapcs() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"msp430-interrupt"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:36:1 + --> $DIR/unsupported.rs:35:1 | LL | extern "msp430-interrupt" fn msp430() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"avr-interrupt"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:38:1 + --> $DIR/unsupported.rs:37:1 | LL | extern "avr-interrupt" fn avr() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/abi/unsupported.rs b/tests/ui/abi/unsupported.rs index 6427a5695c0..bcd95f1ed4c 100644 --- a/tests/ui/abi/unsupported.rs +++ b/tests/ui/abi/unsupported.rs @@ -15,7 +15,6 @@ abi_ptx, abi_msp430_interrupt, abi_avr_interrupt, - abi_thiscall, abi_amdgpu_kernel, wasm_abi, abi_x86_interrupt diff --git a/tests/ui/abi/unsupported.x64.stderr b/tests/ui/abi/unsupported.x64.stderr index 26023a4584e..29eed8505b9 100644 --- a/tests/ui/abi/unsupported.x64.stderr +++ b/tests/ui/abi/unsupported.x64.stderr @@ -1,47 +1,47 @@ error[E0570]: `"ptx-kernel"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:26:1 + --> $DIR/unsupported.rs:25:1 | LL | extern "ptx-kernel" fn ptx() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"amdgpu-kernel"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:28:1 + --> $DIR/unsupported.rs:27:1 | LL | extern "amdgpu-kernel" fn amdgpu() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"wasm"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:30:1 + --> $DIR/unsupported.rs:29:1 | LL | extern "wasm" fn wasm() {} | ^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"aapcs"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:32:1 + --> $DIR/unsupported.rs:31:1 | LL | extern "aapcs" fn aapcs() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"msp430-interrupt"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:36:1 + --> $DIR/unsupported.rs:35:1 | LL | extern "msp430-interrupt" fn msp430() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"avr-interrupt"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:38:1 + --> $DIR/unsupported.rs:37:1 | LL | extern "avr-interrupt" fn avr() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"thiscall"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:43:1 + --> $DIR/unsupported.rs:42:1 | LL | extern "thiscall" fn thiscall() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of calling convention not supported on this target - --> $DIR/unsupported.rs:47:1 + --> $DIR/unsupported.rs:46:1 | LL | extern "stdcall" fn stdcall() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/attributes/macro_export_on_decl_macro.rs b/tests/ui/attributes/macro_export_on_decl_macro.rs new file mode 100644 index 00000000000..e6fe66ac6c3 --- /dev/null +++ b/tests/ui/attributes/macro_export_on_decl_macro.rs @@ -0,0 +1,9 @@ +// Using #[macro_export] on a decl macro has no effect and should warn + +#![feature(decl_macro)] +#![deny(unused)] + +#[macro_export] //~ ERROR `#[macro_export]` has no effect on declarative macro definitions +pub macro foo() {} + +fn main() {} diff --git a/tests/ui/attributes/macro_export_on_decl_macro.stderr b/tests/ui/attributes/macro_export_on_decl_macro.stderr new file mode 100644 index 00000000000..565e07919bc --- /dev/null +++ b/tests/ui/attributes/macro_export_on_decl_macro.stderr @@ -0,0 +1,16 @@ +error: `#[macro_export]` has no effect on declarative macro definitions + --> $DIR/macro_export_on_decl_macro.rs:6:1 + | +LL | #[macro_export] + | ^^^^^^^^^^^^^^^ + | + = note: declarative macros follow the same exporting rules as regular items +note: the lint level is defined here + --> $DIR/macro_export_on_decl_macro.rs:4:9 + | +LL | #![deny(unused)] + | ^^^^^^ + = note: `#[deny(unused_attributes)]` implied by `#[deny(unused)]` + +error: aborting due to previous error + diff --git a/tests/ui/const-generics/lifetime-in-const-param.rs b/tests/ui/const-generics/lifetime-in-const-param.rs new file mode 100644 index 00000000000..be90dbb213e --- /dev/null +++ b/tests/ui/const-generics/lifetime-in-const-param.rs @@ -0,0 +1,9 @@ +// https://github.com/rust-lang/rust/issues/113462 + +struct S2<'b>(&'b ()); + +struct S<'a, const N: S2>(&'a ()); +//~^ ERROR missing lifetime specifier [E0106] +//~| ERROR `S2<'_>` is forbidden as the type of a const generic parameter + +fn main() {} diff --git a/tests/ui/const-generics/lifetime-in-const-param.stderr b/tests/ui/const-generics/lifetime-in-const-param.stderr new file mode 100644 index 00000000000..8fd9068e8ef --- /dev/null +++ b/tests/ui/const-generics/lifetime-in-const-param.stderr @@ -0,0 +1,18 @@ +error[E0106]: missing lifetime specifier + --> $DIR/lifetime-in-const-param.rs:5:23 + | +LL | struct S<'a, const N: S2>(&'a ()); + | ^^ expected named lifetime parameter + +error: `S2<'_>` is forbidden as the type of a const generic parameter + --> $DIR/lifetime-in-const-param.rs:5:23 + | +LL | struct S<'a, const N: S2>(&'a ()); + | ^^ + | + = note: the only supported types are integers, `bool` and `char` + = help: more complex types are supported with `#![feature(adt_const_params)]` + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0106`. diff --git a/tests/ui/const_prop/ice-issue-111353.rs b/tests/ui/const_prop/ice-issue-111353.rs new file mode 100644 index 00000000000..99d1b792fea --- /dev/null +++ b/tests/ui/const_prop/ice-issue-111353.rs @@ -0,0 +1,7 @@ +// build-pass +#![crate_type = "lib"] +#![feature(unsized_fn_params)] + +pub fn f(mut x: [i32]) { + x[0] = 1; +} diff --git a/tests/ui/const_prop/ice-issue-96944.rs b/tests/ui/const_prop/ice-issue-96944.rs new file mode 100644 index 00000000000..74baffddd8b --- /dev/null +++ b/tests/ui/const_prop/ice-issue-96944.rs @@ -0,0 +1,26 @@ +// build-pass +#![crate_type = "lib"] +#![allow(arithmetic_overflow)] + +pub trait BitSplit { + type Half; + fn merge(halves: [Self::Half; 2]) -> Self; +} + +macro_rules! impl_ints { + ($int:ty => $half:ty; $mask:expr) => { + impl BitSplit for $int { + type Half = $half; + #[inline] + fn merge(halves: [Self::Half; 2]) -> Self { + const HALF_SIZE: usize = std::mem::size_of::<$half>() * 8; + (halves[0] << HALF_SIZE) as $int | halves[1] as $int + } + } + }; +} + +impl_ints!(u128 => u64; 0x0000_0000_0000_0000_FFFF_FFFF_FFFF_FFFF); +impl_ints!( u64 => u32; 0x0000_0000_FFFF_FFFF); +impl_ints!( u32 => u16; 0x0000_FFFF); +impl_ints!( u16 => u8; 0x00FF); diff --git a/tests/ui/consts/const-compare-bytes-ub.rs b/tests/ui/consts/const-compare-bytes-ub.rs new file mode 100644 index 00000000000..2b4062fd22b --- /dev/null +++ b/tests/ui/consts/const-compare-bytes-ub.rs @@ -0,0 +1,41 @@ +// check-fail + +#![feature(core_intrinsics)] +#![feature(const_intrinsic_compare_bytes)] +use std::intrinsics::compare_bytes; +use std::mem::MaybeUninit; + +fn main() { + const LHS_NULL: i32 = unsafe { + compare_bytes(0 as *const u8, 2 as *const u8, 0) + //~^ ERROR evaluation of constant value failed + }; + const RHS_NULL: i32 = unsafe { + compare_bytes(1 as *const u8, 0 as *const u8, 0) + //~^ ERROR evaluation of constant value failed + }; + const DANGLING_PTR_NON_ZERO_LENGTH: i32 = unsafe { + compare_bytes(1 as *const u8, 2 as *const u8, 1) + //~^ ERROR evaluation of constant value failed + }; + const LHS_OUT_OF_BOUNDS: i32 = unsafe { + compare_bytes([1, 2, 3].as_ptr(), [1, 2, 3, 4].as_ptr(), 4) + //~^ ERROR evaluation of constant value failed + }; + const RHS_OUT_OF_BOUNDS: i32 = unsafe { + compare_bytes([1, 2, 3, 4].as_ptr(), [1, 2, 3].as_ptr(), 4) + //~^ ERROR evaluation of constant value failed + }; + const LHS_UNINIT: i32 = unsafe { + compare_bytes(MaybeUninit::uninit().as_ptr(), [1].as_ptr(), 1) + //~^ ERROR evaluation of constant value failed + }; + const RHS_UNINIT: i32 = unsafe { + compare_bytes([1].as_ptr(), MaybeUninit::uninit().as_ptr(), 1) + //~^ ERROR evaluation of constant value failed + }; + const WITH_PROVENANCE: i32 = unsafe { + compare_bytes([&1].as_ptr().cast(), [&2].as_ptr().cast(), std::mem::size_of::<usize>()) + //~^ ERROR evaluation of constant value failed + }; +} diff --git a/tests/ui/consts/const-compare-bytes-ub.stderr b/tests/ui/consts/const-compare-bytes-ub.stderr new file mode 100644 index 00000000000..54fafded07b --- /dev/null +++ b/tests/ui/consts/const-compare-bytes-ub.stderr @@ -0,0 +1,54 @@ +error[E0080]: evaluation of constant value failed + --> $DIR/const-compare-bytes-ub.rs:10:9 + | +LL | compare_bytes(0 as *const u8, 2 as *const u8, 0) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ memory access failed: null pointer is a dangling pointer (it has no provenance) + +error[E0080]: evaluation of constant value failed + --> $DIR/const-compare-bytes-ub.rs:14:9 + | +LL | compare_bytes(1 as *const u8, 0 as *const u8, 0) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ memory access failed: null pointer is a dangling pointer (it has no provenance) + +error[E0080]: evaluation of constant value failed + --> $DIR/const-compare-bytes-ub.rs:18:9 + | +LL | compare_bytes(1 as *const u8, 2 as *const u8, 1) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ memory access failed: 0x1[noalloc] is a dangling pointer (it has no provenance) + +error[E0080]: evaluation of constant value failed + --> $DIR/const-compare-bytes-ub.rs:22:9 + | +LL | compare_bytes([1, 2, 3].as_ptr(), [1, 2, 3, 4].as_ptr(), 4) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ memory access failed: alloc6 has size 3, so pointer to 4 bytes starting at offset 0 is out-of-bounds + +error[E0080]: evaluation of constant value failed + --> $DIR/const-compare-bytes-ub.rs:26:9 + | +LL | compare_bytes([1, 2, 3, 4].as_ptr(), [1, 2, 3].as_ptr(), 4) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ memory access failed: alloc13 has size 3, so pointer to 4 bytes starting at offset 0 is out-of-bounds + +error[E0080]: evaluation of constant value failed + --> $DIR/const-compare-bytes-ub.rs:30:9 + | +LL | compare_bytes(MaybeUninit::uninit().as_ptr(), [1].as_ptr(), 1) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ reading memory at alloc17[0x0..0x1], but memory is uninitialized at [0x0..0x1], and this operation requires initialized memory + +error[E0080]: evaluation of constant value failed + --> $DIR/const-compare-bytes-ub.rs:34:9 + | +LL | compare_bytes([1].as_ptr(), MaybeUninit::uninit().as_ptr(), 1) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ reading memory at alloc25[0x0..0x1], but memory is uninitialized at [0x0..0x1], and this operation requires initialized memory + +error[E0080]: evaluation of constant value failed + --> $DIR/const-compare-bytes-ub.rs:38:9 + | +LL | compare_bytes([&1].as_ptr().cast(), [&2].as_ptr().cast(), std::mem::size_of::<usize>()) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into integer + | + = help: this code performed an operation that depends on the underlying bytes representing a pointer + = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported + +error: aborting due to 8 previous errors + +For more information about this error, try `rustc --explain E0080`. diff --git a/tests/ui/consts/const-compare-bytes.rs b/tests/ui/consts/const-compare-bytes.rs new file mode 100644 index 00000000000..74e29f81386 --- /dev/null +++ b/tests/ui/consts/const-compare-bytes.rs @@ -0,0 +1,27 @@ +// run-pass + +#![feature(core_intrinsics)] +#![feature(const_intrinsic_compare_bytes)] +use std::intrinsics::compare_bytes; + +fn main() { + const A: i32 = unsafe { + compare_bytes(1 as *const u8, 2 as *const u8, 0) + }; + assert_eq!(A, 0); + + const B: i32 = unsafe { + compare_bytes([1, 2].as_ptr(), [1, 3].as_ptr(), 1) + }; + assert_eq!(B, 0); + + const C: i32 = unsafe { + compare_bytes([1, 2, 9].as_ptr(), [1, 3, 8].as_ptr(), 2) + }; + assert!(C < 0); + + const D: i32 = unsafe { + compare_bytes([1, 3, 8].as_ptr(), [1, 2, 9].as_ptr(), 2) + }; + assert!(D > 0); +} diff --git a/tests/ui/extern/extern-thiscall.rs b/tests/ui/extern/extern-thiscall.rs index 717df57ec48..c491c156af5 100644 --- a/tests/ui/extern/extern-thiscall.rs +++ b/tests/ui/extern/extern-thiscall.rs @@ -1,8 +1,6 @@ // run-pass // only-x86 -#![feature(abi_thiscall)] - trait A { extern "thiscall" fn test1(i: i32); } diff --git a/tests/ui/feature-gates/feature-gate-thiscall.rs b/tests/ui/feature-gates/feature-gate-thiscall.rs deleted file mode 100644 index 97a732bcff7..00000000000 --- a/tests/ui/feature-gates/feature-gate-thiscall.rs +++ /dev/null @@ -1,38 +0,0 @@ -// gate-test-abi_thiscall -// needs-llvm-components: x86 -// compile-flags: --target=i686-pc-windows-msvc --crate-type=rlib -#![no_core] -#![feature(no_core, lang_items)] -#[lang="sized"] -trait Sized { } - -// Test that the "thiscall" ABI is feature-gated, and cannot be used when -// the `abi_thiscall` feature gate is not used. - -extern "thiscall-unwind" fn fu() {} //~ ERROR thiscall-unwind ABI is experimental -extern "thiscall" fn f() {} //~ ERROR thiscall is experimental - -trait T { - extern "thiscall" fn m(); //~ ERROR thiscall is experimental - extern "thiscall-unwind" fn mu(); //~ ERROR thiscall-unwind ABI is experimental - - extern "thiscall" fn dm() {} //~ ERROR thiscall is experimental - extern "thiscall-unwind" fn dmu() {} //~ ERROR thiscall-unwind ABI is experimental -} - -struct S; -impl T for S { - extern "thiscall" fn m() {} //~ ERROR thiscall is experimental - extern "thiscall-unwind" fn mu() {} //~ ERROR thiscall-unwind ABI is experimental -} - -impl S { - extern "thiscall" fn im() {} //~ ERROR thiscall is experimental - extern "thiscall-unwind" fn imu() {} //~ ERROR thiscall-unwind ABI is experimental -} - -type TA = extern "thiscall" fn(); //~ ERROR thiscall is experimental -type TAU = extern "thiscall-unwind" fn(); //~ ERROR thiscall-unwind ABI is experimental - -extern "thiscall" {} //~ ERROR thiscall is experimental -extern "thiscall-unwind" {} //~ ERROR thiscall-unwind ABI is experimental diff --git a/tests/ui/feature-gates/feature-gate-thiscall.stderr b/tests/ui/feature-gates/feature-gate-thiscall.stderr deleted file mode 100644 index 346e45952cd..00000000000 --- a/tests/ui/feature-gates/feature-gate-thiscall.stderr +++ /dev/null @@ -1,115 +0,0 @@ -error[E0658]: thiscall-unwind ABI is experimental and subject to change - --> $DIR/feature-gate-thiscall.rs:12:8 - | -LL | extern "thiscall-unwind" fn fu() {} - | ^^^^^^^^^^^^^^^^^ - | - = help: add `#![feature(abi_thiscall)]` to the crate attributes to enable - -error[E0658]: thiscall is experimental and subject to change - --> $DIR/feature-gate-thiscall.rs:13:8 - | -LL | extern "thiscall" fn f() {} - | ^^^^^^^^^^ - | - = help: add `#![feature(abi_thiscall)]` to the crate attributes to enable - -error[E0658]: thiscall is experimental and subject to change - --> $DIR/feature-gate-thiscall.rs:16:12 - | -LL | extern "thiscall" fn m(); - | ^^^^^^^^^^ - | - = help: add `#![feature(abi_thiscall)]` to the crate attributes to enable - -error[E0658]: thiscall-unwind ABI is experimental and subject to change - --> $DIR/feature-gate-thiscall.rs:17:12 - | -LL | extern "thiscall-unwind" fn mu(); - | ^^^^^^^^^^^^^^^^^ - | - = help: add `#![feature(abi_thiscall)]` to the crate attributes to enable - -error[E0658]: thiscall is experimental and subject to change - --> $DIR/feature-gate-thiscall.rs:19:12 - | -LL | extern "thiscall" fn dm() {} - | ^^^^^^^^^^ - | - = help: add `#![feature(abi_thiscall)]` to the crate attributes to enable - -error[E0658]: thiscall-unwind ABI is experimental and subject to change - --> $DIR/feature-gate-thiscall.rs:20:12 - | -LL | extern "thiscall-unwind" fn dmu() {} - | ^^^^^^^^^^^^^^^^^ - | - = help: add `#![feature(abi_thiscall)]` to the crate attributes to enable - -error[E0658]: thiscall is experimental and subject to change - --> $DIR/feature-gate-thiscall.rs:25:12 - | -LL | extern "thiscall" fn m() {} - | ^^^^^^^^^^ - | - = help: add `#![feature(abi_thiscall)]` to the crate attributes to enable - -error[E0658]: thiscall-unwind ABI is experimental and subject to change - --> $DIR/feature-gate-thiscall.rs:26:12 - | -LL | extern "thiscall-unwind" fn mu() {} - | ^^^^^^^^^^^^^^^^^ - | - = help: add `#![feature(abi_thiscall)]` to the crate attributes to enable - -error[E0658]: thiscall is experimental and subject to change - --> $DIR/feature-gate-thiscall.rs:30:12 - | -LL | extern "thiscall" fn im() {} - | ^^^^^^^^^^ - | - = help: add `#![feature(abi_thiscall)]` to the crate attributes to enable - -error[E0658]: thiscall-unwind ABI is experimental and subject to change - --> $DIR/feature-gate-thiscall.rs:31:12 - | -LL | extern "thiscall-unwind" fn imu() {} - | ^^^^^^^^^^^^^^^^^ - | - = help: add `#![feature(abi_thiscall)]` to the crate attributes to enable - -error[E0658]: thiscall is experimental and subject to change - --> $DIR/feature-gate-thiscall.rs:34:18 - | -LL | type TA = extern "thiscall" fn(); - | ^^^^^^^^^^ - | - = help: add `#![feature(abi_thiscall)]` to the crate attributes to enable - -error[E0658]: thiscall-unwind ABI is experimental and subject to change - --> $DIR/feature-gate-thiscall.rs:35:19 - | -LL | type TAU = extern "thiscall-unwind" fn(); - | ^^^^^^^^^^^^^^^^^ - | - = help: add `#![feature(abi_thiscall)]` to the crate attributes to enable - -error[E0658]: thiscall is experimental and subject to change - --> $DIR/feature-gate-thiscall.rs:37:8 - | -LL | extern "thiscall" {} - | ^^^^^^^^^^ - | - = help: add `#![feature(abi_thiscall)]` to the crate attributes to enable - -error[E0658]: thiscall-unwind ABI is experimental and subject to change - --> $DIR/feature-gate-thiscall.rs:38:8 - | -LL | extern "thiscall-unwind" {} - | ^^^^^^^^^^^^^^^^^ - | - = help: add `#![feature(abi_thiscall)]` to the crate attributes to enable - -error: aborting due to 14 previous errors - -For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/for/issue-20605.next.stderr b/tests/ui/for/issue-20605.next.stderr index d55efedfcbe..0955efdbb73 100644 --- a/tests/ui/for/issue-20605.next.stderr +++ b/tests/ui/for/issue-20605.next.stderr @@ -34,12 +34,6 @@ error: the type `&mut <dyn Iterator<Item = &'a mut u8> as IntoIterator>::IntoIte LL | for item in *things { *item = 0 } | ^^^^^^^ -error[E0614]: type `<<dyn Iterator<Item = &'a mut u8> as IntoIterator>::IntoIter as Iterator>::Item` cannot be dereferenced - --> $DIR/issue-20605.rs:5:27 - | -LL | for item in *things { *item = 0 } - | ^^^^^ - error[E0277]: the size for values of type `<<dyn Iterator<Item = &'a mut u8> as IntoIterator>::IntoIter as Iterator>::Item` cannot be known at compilation time --> $DIR/issue-20605.rs:5:9 | @@ -66,6 +60,12 @@ LL | for item in *things { *item = 0 } note: required by a bound in `None` --> $SRC_DIR/core/src/option.rs:LL:COL +error[E0614]: type `<<dyn Iterator<Item = &'a mut u8> as IntoIterator>::IntoIter as Iterator>::Item` cannot be dereferenced + --> $DIR/issue-20605.rs:5:27 + | +LL | for item in *things { *item = 0 } + | ^^^^^ + error: aborting due to 9 previous errors Some errors have detailed explanations: E0277, E0614. diff --git a/tests/ui/generic-associated-types/issue-90014-tait2.rs b/tests/ui/generic-associated-types/issue-90014-tait2.rs index 34330ed8cba..7fb14eddc2c 100644 --- a/tests/ui/generic-associated-types/issue-90014-tait2.rs +++ b/tests/ui/generic-associated-types/issue-90014-tait2.rs @@ -1,27 +1,9 @@ //! This test checks that opaque type collection doesn't try to normalize the projection //! without respecting its binders (which would ICE). //! Unfortunately we don't even reach opaque type collection, as we ICE in typeck before that. -// known-bug: #109281 -// failure-status: 101 -// error-pattern:internal compiler error -// normalize-stderr-test "internal compiler error.*" -> "" -// normalize-stderr-test "DefId\([^)]*\)" -> "..." -// normalize-stderr-test "\nerror: internal compiler error.*\n\n" -> "" -// normalize-stderr-test "note:.*unexpectedly panicked.*\n\n" -> "" -// normalize-stderr-test "note: we would appreciate a bug report.*\n\n" -> "" -// normalize-stderr-test "note: compiler flags.*\n\n" -> "" -// normalize-stderr-test "note: rustc.*running on.*\n\n" -> "" -// normalize-stderr-test "thread.*panicked.*:\n.*\n" -> "" -// normalize-stderr-test "stack backtrace:\n" -> "" -// normalize-stderr-test "\s\d{1,}: .*\n" -> "" -// normalize-stderr-test "\s at .*\n" -> "" -// normalize-stderr-test ".*note: Some details.*\n" -> "" -// normalize-stderr-test "\n\n[ ]*\n" -> "" -// normalize-stderr-test "compiler/.*: projection" -> "projection" -// normalize-stderr-test ".*omitted \d{1,} frame.*\n" -> "" -// normalize-stderr-test "error: [\s\n]*query stack" -> "error: query stack" -// normalize-stderr-test "[\n\s]*\nquery stack during panic:" -> "query stack during panic:" +//! See #109281 for the original report. // edition:2018 +// error-pattern: expected generic lifetime parameter, found `'a` #![feature(type_alias_impl_trait)] #![allow(incomplete_features)] diff --git a/tests/ui/generic-associated-types/issue-90014-tait2.stderr b/tests/ui/generic-associated-types/issue-90014-tait2.stderr index 2538eb46dfa..d04788a919a 100644 --- a/tests/ui/generic-associated-types/issue-90014-tait2.stderr +++ b/tests/ui/generic-associated-types/issue-90014-tait2.stderr @@ -1,12 +1,5 @@ -error: - --> $DIR/issue-90014-tait2.rs:44:27 - | -LL | fn make_fut(&self) -> Box<dyn for<'a> Trait<'a, Thing = Fut<'a>>> { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^query stack during panic: -#0 [typeck] type-checking `<impl at $DIR/issue-90014-tait2.rs:43:1: 43:13>::make_fut` -#1 [type_of] computing type of `Fut::{opaque#0}` -#2 [check_mod_item_types] checking item types in top-level module -#3 [analysis] running analysis passes on this crate -end of query stack +error[E0792]: expected generic lifetime parameter, found `'a` + error: aborting due to previous error +For more information about this error, try `rustc --explain E0792`. diff --git a/tests/ui/issues/issue-100605.rs b/tests/ui/issues/issue-100605.rs deleted file mode 100644 index 917a45c15bb..00000000000 --- a/tests/ui/issues/issue-100605.rs +++ /dev/null @@ -1,9 +0,0 @@ -fn takes_option(_arg: Option<&String>) {} - -fn main() { - takes_option(&None); //~ ERROR 4:18: 4:23: mismatched types [E0308] - - let x = String::from("x"); - let res = Some(x); - takes_option(&res); //~ ERROR 8:18: 8:22: mismatched types [E0308] -} diff --git a/tests/ui/lazy-type-alias/auxiliary/eager.rs b/tests/ui/lazy-type-alias/auxiliary/eager.rs new file mode 100644 index 00000000000..8793a1701ec --- /dev/null +++ b/tests/ui/lazy-type-alias/auxiliary/eager.rs @@ -0,0 +1,6 @@ +// This crate does *not* have lazy type aliases enabled. + +#![allow(type_alias_bounds)] + +// The `Copy` bound is ignored both locally and externally for backward compatibility. +pub type Alias<T: Copy> = Option<T>; diff --git a/tests/ui/lazy-type-alias/auxiliary/lazy.rs b/tests/ui/lazy-type-alias/auxiliary/lazy.rs new file mode 100644 index 00000000000..caa7999b4f7 --- /dev/null +++ b/tests/ui/lazy-type-alias/auxiliary/lazy.rs @@ -0,0 +1,4 @@ +#![feature(lazy_type_alias)] +#![allow(incomplete_features)] + +pub type Alias<T: Copy> = Option<T>; diff --git a/tests/ui/lazy-type-alias/coerce-behind-lazy.current.stderr b/tests/ui/lazy-type-alias/coerce-behind-lazy.current.stderr new file mode 100644 index 00000000000..98b3921dec4 --- /dev/null +++ b/tests/ui/lazy-type-alias/coerce-behind-lazy.current.stderr @@ -0,0 +1,11 @@ +warning: the feature `lazy_type_alias` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/coerce-behind-lazy.rs:5:12 + | +LL | #![feature(lazy_type_alias)] + | ^^^^^^^^^^^^^^^ + | + = note: see issue #112792 <https://github.com/rust-lang/rust/issues/112792> for more information + = note: `#[warn(incomplete_features)]` on by default + +warning: 1 warning emitted + diff --git a/tests/ui/lazy-type-alias/coerce-behind-lazy.next.stderr b/tests/ui/lazy-type-alias/coerce-behind-lazy.next.stderr new file mode 100644 index 00000000000..98b3921dec4 --- /dev/null +++ b/tests/ui/lazy-type-alias/coerce-behind-lazy.next.stderr @@ -0,0 +1,11 @@ +warning: the feature `lazy_type_alias` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/coerce-behind-lazy.rs:5:12 + | +LL | #![feature(lazy_type_alias)] + | ^^^^^^^^^^^^^^^ + | + = note: see issue #112792 <https://github.com/rust-lang/rust/issues/112792> for more information + = note: `#[warn(incomplete_features)]` on by default + +warning: 1 warning emitted + diff --git a/tests/ui/lazy-type-alias/coerce-behind-lazy.rs b/tests/ui/lazy-type-alias/coerce-behind-lazy.rs new file mode 100644 index 00000000000..745eadb9625 --- /dev/null +++ b/tests/ui/lazy-type-alias/coerce-behind-lazy.rs @@ -0,0 +1,16 @@ +// check-pass +// revisions: current next +//[next] compile-flags: -Ztrait-solver=next + +#![feature(lazy_type_alias)] +//~^ WARN the feature `lazy_type_alias` is incomplete + +use std::any::Any; + +type Coerce = Box<dyn Any>; + +fn test() -> Coerce { + Box::new(1) +} + +fn main() {} diff --git a/tests/ui/lazy-type-alias/extern-crate-has-eager-type-aliases.rs b/tests/ui/lazy-type-alias/extern-crate-has-eager-type-aliases.rs new file mode 100644 index 00000000000..07389961c4c --- /dev/null +++ b/tests/ui/lazy-type-alias/extern-crate-has-eager-type-aliases.rs @@ -0,0 +1,23 @@ +// This test serves as a regression test for issue #114468 and it also ensures that we consider +// type aliases from external crates that don't have `lazy_type_alias` enabled to be eager. + +// aux-crate:eager=eager.rs +// edition: 2021 +// check-pass + +#![feature(lazy_type_alias)] +#![allow(incomplete_features)] + +// This used to crash when we were computing the variances of `Struct` since we would convert +// `eager::Alias<T>` to a weak projection due to the presence of `#![feature(lazy_type_alias)]` in +// this (!) crate and subsequently attempt to obtain the variances of the type alias associated with +// the weak projection which would panic because we don't compute this information for eager type +// aliases at all. +struct Struct<T>(eager::Alias<T>); + +fn main() { + // We want to ignore (or rather “end up ignoring”) the bound `T: Copy` since `Alias` should be + // treated as an eager type alias not just inside the crate it is defined in but also in + // dependent crates (like this one). + let _: eager::Alias<String>; +} diff --git a/tests/ui/lazy-type-alias/extern-crate-has-lazy-type-aliases.locally_eager.stderr b/tests/ui/lazy-type-alias/extern-crate-has-lazy-type-aliases.locally_eager.stderr new file mode 100644 index 00000000000..9e0e2bfa872 --- /dev/null +++ b/tests/ui/lazy-type-alias/extern-crate-has-lazy-type-aliases.locally_eager.stderr @@ -0,0 +1,15 @@ +error[E0277]: the trait bound `String: Copy` is not satisfied + --> $DIR/extern-crate-has-lazy-type-aliases.rs:15:12 + | +LL | let _: lazy::Alias<String>; + | ^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `String` + | +note: required by a bound on the type alias `Alias` + --> $DIR/auxiliary/lazy.rs:4:19 + | +LL | pub type Alias<T: Copy> = Option<T>; + | ^^^^ required by this bound + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/lazy-type-alias/extern-crate-has-lazy-type-aliases.locally_lazy.stderr b/tests/ui/lazy-type-alias/extern-crate-has-lazy-type-aliases.locally_lazy.stderr new file mode 100644 index 00000000000..9e0e2bfa872 --- /dev/null +++ b/tests/ui/lazy-type-alias/extern-crate-has-lazy-type-aliases.locally_lazy.stderr @@ -0,0 +1,15 @@ +error[E0277]: the trait bound `String: Copy` is not satisfied + --> $DIR/extern-crate-has-lazy-type-aliases.rs:15:12 + | +LL | let _: lazy::Alias<String>; + | ^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `String` + | +note: required by a bound on the type alias `Alias` + --> $DIR/auxiliary/lazy.rs:4:19 + | +LL | pub type Alias<T: Copy> = Option<T>; + | ^^^^ required by this bound + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/lazy-type-alias/extern-crate-has-lazy-type-aliases.rs b/tests/ui/lazy-type-alias/extern-crate-has-lazy-type-aliases.rs new file mode 100644 index 00000000000..31a19161b6c --- /dev/null +++ b/tests/ui/lazy-type-alias/extern-crate-has-lazy-type-aliases.rs @@ -0,0 +1,16 @@ +// revisions: locally_eager locally_lazy +// aux-crate:lazy=lazy.rs +// edition: 2021 + +// Test that we treat lazy type aliases from external crates as lazy independently of whether the +// local crate enables `lazy_type_alias` or not. + +#![cfg_attr( + locally_lazy, + feature(lazy_type_alias), + allow(incomplete_features) +)] + +fn main() { + let _: lazy::Alias<String>; //~ ERROR the trait bound `String: Copy` is not satisfied +} diff --git a/tests/ui/lifetimes/unusual-rib-combinations.stderr b/tests/ui/lifetimes/unusual-rib-combinations.stderr index 4994e4dc444..01ec69a6110 100644 --- a/tests/ui/lifetimes/unusual-rib-combinations.stderr +++ b/tests/ui/lifetimes/unusual-rib-combinations.stderr @@ -3,11 +3,6 @@ error[E0106]: missing lifetime specifier | LL | fn d<const C: S>() {} | ^ expected named lifetime parameter - | -help: consider introducing a named lifetime parameter - | -LL | fn d<'a, const C: S<'a>>() {} - | +++ ++++ error[E0770]: the type of const parameters must not depend on other generic parameters --> $DIR/unusual-rib-combinations.rs:29:22 diff --git a/tests/ui/lint/clashing-extern-fn.stderr b/tests/ui/lint/clashing-extern-fn.stderr index 5d457ba0ec7..0d269e599dd 100644 --- a/tests/ui/lint/clashing-extern-fn.stderr +++ b/tests/ui/lint/clashing-extern-fn.stderr @@ -1,11 +1,30 @@ +warning: `extern` block uses type `Option<TransparentNoNiche>`, which is not FFI-safe + --> $DIR/clashing-extern-fn.rs:433:55 + | +LL | fn hidden_niche_transparent_no_niche() -> Option<TransparentNoNiche>; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe + | + = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum + = note: enum has no representation hint + = note: `#[warn(improper_ctypes)]` on by default + +warning: `extern` block uses type `Option<UnsafeCell<NonZeroUsize>>`, which is not FFI-safe + --> $DIR/clashing-extern-fn.rs:437:46 + | +LL | fn hidden_niche_unsafe_cell() -> Option<UnsafeCell<NonZeroUsize>>; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe + | + = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum + = note: enum has no representation hint + warning: `clash` redeclared with a different signature --> $DIR/clashing-extern-fn.rs:14:13 | LL | fn clash(x: u8); - | ---------------- `clash` previously declared here + | --------------- `clash` previously declared here ... LL | fn clash(x: u64); - | ^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration + | ^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration | = note: expected `unsafe extern "C" fn(u8)` found `unsafe extern "C" fn(u64)` @@ -18,12 +37,11 @@ LL | #![warn(clashing_extern_declarations)] warning: `extern_link_name` redeclared with a different signature --> $DIR/clashing-extern-fn.rs:52:9 | -LL | / #[link_name = "extern_link_name"] -LL | | fn some_new_name(x: i16); - | |_____________________________- `extern_link_name` previously declared here +LL | #[link_name = "extern_link_name"] + | --------------------------------- `extern_link_name` previously declared here ... -LL | fn extern_link_name(x: u32); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration +LL | fn extern_link_name(x: u32); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration | = note: expected `unsafe extern "C" fn(i16)` found `unsafe extern "C" fn(u32)` @@ -31,13 +49,11 @@ LL | fn extern_link_name(x: u32); warning: `some_other_extern_link_name` redeclares `some_other_new_name` with a different signature --> $DIR/clashing-extern-fn.rs:55:9 | -LL | fn some_other_new_name(x: i16); - | ------------------------------- `some_other_new_name` previously declared here +LL | fn some_other_new_name(x: i16); + | ------------------------------ `some_other_new_name` previously declared here ... -LL | / #[link_name = "some_other_new_name"] -LL | | -LL | | fn some_other_extern_link_name(x: u32); - | |_______________________________________________^ this signature doesn't match the previous declaration +LL | #[link_name = "some_other_new_name"] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration | = note: expected `unsafe extern "C" fn(i16)` found `unsafe extern "C" fn(u32)` @@ -45,14 +61,11 @@ LL | | fn some_other_extern_link_name(x: u32); warning: `other_both_names_different` redeclares `link_name_same` with a different signature --> $DIR/clashing-extern-fn.rs:59:9 | -LL | / #[link_name = "link_name_same"] -LL | | fn both_names_different(x: i16); - | |____________________________________- `link_name_same` previously declared here +LL | #[link_name = "link_name_same"] + | ------------------------------- `link_name_same` previously declared here ... -LL | / #[link_name = "link_name_same"] -LL | | -LL | | fn other_both_names_different(x: u32); - | |______________________________________________^ this signature doesn't match the previous declaration +LL | #[link_name = "link_name_same"] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration | = note: expected `unsafe extern "C" fn(i16)` found `unsafe extern "C" fn(u32)` @@ -61,10 +74,10 @@ warning: `different_mod` redeclared with a different signature --> $DIR/clashing-extern-fn.rs:72:9 | LL | fn different_mod(x: u8); - | ------------------------ `different_mod` previously declared here + | ----------------------- `different_mod` previously declared here ... LL | fn different_mod(x: u64); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration + | ^^^^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration | = note: expected `unsafe extern "C" fn(u8)` found `unsafe extern "C" fn(u64)` @@ -73,10 +86,10 @@ warning: `variadic_decl` redeclared with a different signature --> $DIR/clashing-extern-fn.rs:82:9 | LL | fn variadic_decl(x: u8, ...); - | ----------------------------- `variadic_decl` previously declared here + | ---------------------------- `variadic_decl` previously declared here ... LL | fn variadic_decl(x: u8); - | ^^^^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration + | ^^^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration | = note: expected `unsafe extern "C" fn(u8, ...)` found `unsafe extern "C" fn(u8)` @@ -85,10 +98,10 @@ warning: `weigh_banana` redeclared with a different signature --> $DIR/clashing-extern-fn.rs:142:13 | LL | fn weigh_banana(count: *const Banana) -> u64; - | --------------------------------------------- `weigh_banana` previously declared here + | -------------------------------------------- `weigh_banana` previously declared here ... LL | fn weigh_banana(count: *const Banana) -> u64; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration | = note: expected `unsafe extern "C" fn(*const one::Banana) -> u64` found `unsafe extern "C" fn(*const three::Banana) -> u64` @@ -97,10 +110,10 @@ warning: `draw_point` redeclared with a different signature --> $DIR/clashing-extern-fn.rs:171:13 | LL | fn draw_point(p: Point); - | ------------------------ `draw_point` previously declared here + | ----------------------- `draw_point` previously declared here ... LL | fn draw_point(p: Point); - | ^^^^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration + | ^^^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration | = note: expected `unsafe extern "C" fn(sameish_members::a::Point)` found `unsafe extern "C" fn(sameish_members::b::Point)` @@ -109,10 +122,10 @@ warning: `origin` redeclared with a different signature --> $DIR/clashing-extern-fn.rs:197:13 | LL | fn origin() -> Point3; - | ---------------------- `origin` previously declared here + | --------------------- `origin` previously declared here ... LL | fn origin() -> Point3; - | ^^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration + | ^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration | = note: expected `unsafe extern "C" fn() -> same_sized_members_clash::a::Point3` found `unsafe extern "C" fn() -> same_sized_members_clash::b::Point3` @@ -121,10 +134,10 @@ warning: `transparent_incorrect` redeclared with a different signature --> $DIR/clashing-extern-fn.rs:220:13 | LL | fn transparent_incorrect() -> T; - | -------------------------------- `transparent_incorrect` previously declared here + | ------------------------------- `transparent_incorrect` previously declared here ... LL | fn transparent_incorrect() -> isize; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration | = note: expected `unsafe extern "C" fn() -> T` found `unsafe extern "C" fn() -> isize` @@ -133,10 +146,10 @@ warning: `missing_return_type` redeclared with a different signature --> $DIR/clashing-extern-fn.rs:259:13 | LL | fn missing_return_type() -> usize; - | ---------------------------------- `missing_return_type` previously declared here + | --------------------------------- `missing_return_type` previously declared here ... LL | fn missing_return_type(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration + | ^^^^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration | = note: expected `unsafe extern "C" fn() -> usize` found `unsafe extern "C" fn()` @@ -145,10 +158,10 @@ warning: `non_zero_usize` redeclared with a different signature --> $DIR/clashing-extern-fn.rs:277:13 | LL | fn non_zero_usize() -> core::num::NonZeroUsize; - | ----------------------------------------------- `non_zero_usize` previously declared here + | ---------------------------------------------- `non_zero_usize` previously declared here ... LL | fn non_zero_usize() -> usize; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration | = note: expected `unsafe extern "C" fn() -> NonZeroUsize` found `unsafe extern "C" fn() -> usize` @@ -157,10 +170,10 @@ warning: `non_null_ptr` redeclared with a different signature --> $DIR/clashing-extern-fn.rs:279:13 | LL | fn non_null_ptr() -> core::ptr::NonNull<usize>; - | ----------------------------------------------- `non_null_ptr` previously declared here + | ---------------------------------------------- `non_null_ptr` previously declared here ... LL | fn non_null_ptr() -> *const usize; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration | = note: expected `unsafe extern "C" fn() -> NonNull<usize>` found `unsafe extern "C" fn() -> *const usize` @@ -169,10 +182,10 @@ warning: `option_non_zero_usize_incorrect` redeclared with a different signature --> $DIR/clashing-extern-fn.rs:377:13 | LL | fn option_non_zero_usize_incorrect() -> usize; - | ---------------------------------------------- `option_non_zero_usize_incorrect` previously declared here + | --------------------------------------------- `option_non_zero_usize_incorrect` previously declared here ... LL | fn option_non_zero_usize_incorrect() -> isize; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration | = note: expected `unsafe extern "C" fn() -> usize` found `unsafe extern "C" fn() -> isize` @@ -181,10 +194,10 @@ warning: `option_non_null_ptr_incorrect` redeclared with a different signature --> $DIR/clashing-extern-fn.rs:379:13 | LL | fn option_non_null_ptr_incorrect() -> *const usize; - | --------------------------------------------------- `option_non_null_ptr_incorrect` previously declared here + | -------------------------------------------------- `option_non_null_ptr_incorrect` previously declared here ... LL | fn option_non_null_ptr_incorrect() -> *const isize; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration | = note: expected `unsafe extern "C" fn() -> *const usize` found `unsafe extern "C" fn() -> *const isize` @@ -193,10 +206,10 @@ warning: `hidden_niche_transparent_no_niche` redeclared with a different signatu --> $DIR/clashing-extern-fn.rs:433:13 | LL | fn hidden_niche_transparent_no_niche() -> usize; - | ------------------------------------------------ `hidden_niche_transparent_no_niche` previously declared here + | ----------------------------------------------- `hidden_niche_transparent_no_niche` previously declared here ... LL | fn hidden_niche_transparent_no_niche() -> Option<TransparentNoNiche>; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration | = note: expected `unsafe extern "C" fn() -> usize` found `unsafe extern "C" fn() -> Option<TransparentNoNiche>` @@ -205,32 +218,13 @@ warning: `hidden_niche_unsafe_cell` redeclared with a different signature --> $DIR/clashing-extern-fn.rs:437:13 | LL | fn hidden_niche_unsafe_cell() -> usize; - | --------------------------------------- `hidden_niche_unsafe_cell` previously declared here + | -------------------------------------- `hidden_niche_unsafe_cell` previously declared here ... LL | fn hidden_niche_unsafe_cell() -> Option<UnsafeCell<NonZeroUsize>>; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration | = note: expected `unsafe extern "C" fn() -> usize` found `unsafe extern "C" fn() -> Option<UnsafeCell<NonZeroUsize>>` -warning: `extern` block uses type `Option<TransparentNoNiche>`, which is not FFI-safe - --> $DIR/clashing-extern-fn.rs:433:55 - | -LL | fn hidden_niche_transparent_no_niche() -> Option<TransparentNoNiche>; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe - | - = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum - = note: enum has no representation hint - = note: `#[warn(improper_ctypes)]` on by default - -warning: `extern` block uses type `Option<UnsafeCell<NonZeroUsize>>`, which is not FFI-safe - --> $DIR/clashing-extern-fn.rs:437:46 - | -LL | fn hidden_niche_unsafe_cell() -> Option<UnsafeCell<NonZeroUsize>>; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe - | - = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum - = note: enum has no representation hint - warning: 19 warnings emitted diff --git a/tests/ui/lint/invalid-nan-comparison.stderr b/tests/ui/lint/invalid-nan-comparison.stderr index 054c06d38b3..f2d55c107ba 100644 --- a/tests/ui/lint/invalid-nan-comparison.stderr +++ b/tests/ui/lint/invalid-nan-comparison.stderr @@ -5,11 +5,6 @@ LL | const TEST: bool = 5f32 == f32::NAN; | ^^^^^^^^^^^^^^^^ | = note: `#[warn(invalid_nan_comparisons)]` on by default -help: use `f32::is_nan()` or `f64::is_nan()` instead - | -LL - const TEST: bool = 5f32 == f32::NAN; -LL + const TEST: bool = 5f32.is_nan(); - | warning: incorrect NaN comparison, NaN cannot be directly compared to itself --> $DIR/invalid-nan-comparison.rs:14:5 diff --git a/tests/ui/lint/issue-111359.stderr b/tests/ui/lint/issue-111359.stderr index 2296d8413d6..0aef5007a2b 100644 --- a/tests/ui/lint/issue-111359.stderr +++ b/tests/ui/lint/issue-111359.stderr @@ -1,26 +1,26 @@ -error: type does not implement `Debug`; consider adding `#[derive(Debug)]` or a manual implementation +error: type could implement `Copy`; consider adding `impl Copy` --> $DIR/issue-111359.rs:7:5 | LL | pub struct BarPub; | ^^^^^^^^^^^^^^^^^^ | note: the lint level is defined here - --> $DIR/issue-111359.rs:1:8 + --> $DIR/issue-111359.rs:2:8 | -LL | #[deny(missing_debug_implementations)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #[deny(missing_copy_implementations)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: type could implement `Copy`; consider adding `impl Copy` +error: type does not implement `Debug`; consider adding `#[derive(Debug)]` or a manual implementation --> $DIR/issue-111359.rs:7:5 | LL | pub struct BarPub; | ^^^^^^^^^^^^^^^^^^ | note: the lint level is defined here - --> $DIR/issue-111359.rs:2:8 + --> $DIR/issue-111359.rs:1:8 | -LL | #[deny(missing_copy_implementations)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #[deny(missing_debug_implementations)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/tests/ui/lint/issue-1866.stderr b/tests/ui/lint/issue-1866.stderr index d19a1349668..36d323825a4 100644 --- a/tests/ui/lint/issue-1866.stderr +++ b/tests/ui/lint/issue-1866.stderr @@ -2,10 +2,10 @@ warning: `rust_task_is_unwinding` redeclared with a different signature --> $DIR/issue-1866.rs:23:13 | LL | pub fn rust_task_is_unwinding(rt: *const rust_task) -> bool; - | ------------------------------------------------------------ `rust_task_is_unwinding` previously declared here + | ----------------------------------------------------------- `rust_task_is_unwinding` previously declared here ... LL | pub fn rust_task_is_unwinding(rt: *const rust_task) -> bool; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration | = note: expected `unsafe extern "C" fn(*const usize) -> bool` found `unsafe extern "C" fn(*const bool) -> bool` diff --git a/tests/ui/lint/lint-attr-everywhere-late.stderr b/tests/ui/lint/lint-attr-everywhere-late.stderr index 9587556b0c1..7fe078068fe 100644 --- a/tests/ui/lint/lint-attr-everywhere-late.stderr +++ b/tests/ui/lint/lint-attr-everywhere-late.stderr @@ -34,12 +34,6 @@ note: the lint level is defined here LL | #![deny(missing_docs)] | ^^^^^^^^^^^^ -error: missing documentation for a function - --> $DIR/lint-attr-everywhere-late.rs:47:5 - | -LL | pub fn missing_inner() {} - | ^^^^^^^^^^^^^^^^^^^^^^ - error: missing documentation for an associated function --> $DIR/lint-attr-everywhere-late.rs:54:5 | @@ -142,52 +136,6 @@ note: the lint level is defined here LL | #[deny(missing_docs)] | ^^^^^^^^^^^^ -error: missing documentation for a variant - --> $DIR/lint-attr-everywhere-late.rs:112:5 - | -LL | Variant1, - | ^^^^^^^^ - | -note: the lint level is defined here - --> $DIR/lint-attr-everywhere-late.rs:111:12 - | -LL | #[deny(missing_docs)] - | ^^^^^^^^^^^^ - -error: `clashing1` redeclared with a different signature - --> $DIR/lint-attr-everywhere-late.rs:123:5 - | -LL | fn clashing1(); - | --------------- `clashing1` previously declared here -... -LL | fn clashing1(_: i32); - | ^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration - | - = note: expected `unsafe extern "C" fn()` - found `unsafe extern "C" fn(i32)` -note: the lint level is defined here - --> $DIR/lint-attr-everywhere-late.rs:122:13 - | -LL | #![deny(clashing_extern_declarations)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: `clashing2` redeclared with a different signature - --> $DIR/lint-attr-everywhere-late.rs:128:5 - | -LL | fn clashing2(); - | --------------- `clashing2` previously declared here -... -LL | fn clashing2(_: i32); - | ^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration - | - = note: expected `unsafe extern "C" fn()` - found `unsafe extern "C" fn(i32)` -note: the lint level is defined here - --> $DIR/lint-attr-everywhere-late.rs:127:12 - | -LL | #[deny(clashing_extern_declarations)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - error: types that do not implement `Drop` can still have drop glue, consider instead using `std::mem::needs_drop` to detect whether a type is trivially dropped --> $DIR/lint-attr-everywhere-late.rs:93:38 | @@ -230,6 +178,18 @@ note: the lint level is defined here LL | #[deny(overflowing_literals)] const ASSOC_CONST: u8 = 1000; | ^^^^^^^^^^^^^^^^^^^^ +error: missing documentation for a variant + --> $DIR/lint-attr-everywhere-late.rs:112:5 + | +LL | Variant1, + | ^^^^^^^^ + | +note: the lint level is defined here + --> $DIR/lint-attr-everywhere-late.rs:111:12 + | +LL | #[deny(missing_docs)] + | ^^^^^^^^^^^^ + error: variable `PARAM` should have a snake case name --> $DIR/lint-attr-everywhere-late.rs:131:37 | @@ -436,5 +396,45 @@ note: the lint level is defined here LL | TupleStruct(#[deny(enum_intrinsics_non_enums)] discriminant::<i32>(&123)); | ^^^^^^^^^^^^^^^^^^^^^^^^^ +error: missing documentation for a function + --> $DIR/lint-attr-everywhere-late.rs:47:5 + | +LL | pub fn missing_inner() {} + | ^^^^^^^^^^^^^^^^^^^^^^ + +error: `clashing1` redeclared with a different signature + --> $DIR/lint-attr-everywhere-late.rs:123:5 + | +LL | fn clashing1(); + | -------------- `clashing1` previously declared here +... +LL | fn clashing1(_: i32); + | ^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration + | + = note: expected `unsafe extern "C" fn()` + found `unsafe extern "C" fn(i32)` +note: the lint level is defined here + --> $DIR/lint-attr-everywhere-late.rs:122:13 + | +LL | #![deny(clashing_extern_declarations)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: `clashing2` redeclared with a different signature + --> $DIR/lint-attr-everywhere-late.rs:128:5 + | +LL | fn clashing2(); + | -------------- `clashing2` previously declared here +... +LL | fn clashing2(_: i32); + | ^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration + | + = note: expected `unsafe extern "C" fn()` + found `unsafe extern "C" fn(i32)` +note: the lint level is defined here + --> $DIR/lint-attr-everywhere-late.rs:127:12 + | +LL | #[deny(clashing_extern_declarations)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + error: aborting due to 32 previous errors diff --git a/tests/ui/lint/lint-missing-doc.stderr b/tests/ui/lint/lint-missing-doc.stderr index adcc21c44b2..4e9ee4f2769 100644 --- a/tests/ui/lint/lint-missing-doc.stderr +++ b/tests/ui/lint/lint-missing-doc.stderr @@ -113,24 +113,6 @@ LL | pub static BAR4: u32 = 0; | ^^^^^^^^^^^^^^^^^^^^ error: missing documentation for a function - --> $DIR/lint-missing-doc.rs:174:5 - | -LL | pub fn undocumented1() {} - | ^^^^^^^^^^^^^^^^^^^^^^ - -error: missing documentation for a function - --> $DIR/lint-missing-doc.rs:175:5 - | -LL | pub fn undocumented2() {} - | ^^^^^^^^^^^^^^^^^^^^^^ - -error: missing documentation for a function - --> $DIR/lint-missing-doc.rs:181:9 - | -LL | pub fn also_undocumented1() {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: missing documentation for a function --> $DIR/lint-missing-doc.rs:196:5 | LL | pub fn extern_fn_undocumented(f: f32) -> f32; @@ -154,5 +136,23 @@ error: missing documentation for a trait alias LL | pub trait T = Sync; | ^^^^^^^^^^^ +error: missing documentation for a function + --> $DIR/lint-missing-doc.rs:174:5 + | +LL | pub fn undocumented1() {} + | ^^^^^^^^^^^^^^^^^^^^^^ + +error: missing documentation for a function + --> $DIR/lint-missing-doc.rs:175:5 + | +LL | pub fn undocumented2() {} + | ^^^^^^^^^^^^^^^^^^^^^^ + +error: missing documentation for a function + --> $DIR/lint-missing-doc.rs:181:9 + | +LL | pub fn also_undocumented1() {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + error: aborting due to 25 previous errors diff --git a/tests/ui/lint/lint-unconditional-drop-recursion.rs b/tests/ui/lint/lint-unconditional-drop-recursion.rs new file mode 100644 index 00000000000..348cd280139 --- /dev/null +++ b/tests/ui/lint/lint-unconditional-drop-recursion.rs @@ -0,0 +1,38 @@ +// Because drop recursion can only be detected after drop elaboration which +// happens for codegen: +// build-fail + +#![deny(unconditional_recursion)] +#![allow(dead_code)] + +pub struct RecursiveDrop; + +impl Drop for RecursiveDrop { + fn drop(&mut self) { //~ ERROR function cannot return without recursing + let _ = RecursiveDrop; + } +} + +#[derive(Default)] +struct NotRecursiveDrop1; + +impl Drop for NotRecursiveDrop1 { + fn drop(&mut self) { + // Before drop elaboration, the MIR can look like a recursive drop will + // occur. But it will not, since forget() prevents drop() from running. + let taken = std::mem::take(self); + std::mem::forget(taken); + } +} + +struct NotRecursiveDrop2; + +impl Drop for NotRecursiveDrop2 { + fn drop(&mut self) { + // Before drop elaboration, the MIR can look like a recursive drop will + // occur. But it will not, since this will panic. + std::panic::panic_any(NotRecursiveDrop2); + } +} + +fn main() {} diff --git a/tests/ui/lint/lint-unconditional-drop-recursion.stderr b/tests/ui/lint/lint-unconditional-drop-recursion.stderr new file mode 100644 index 00000000000..76f95481605 --- /dev/null +++ b/tests/ui/lint/lint-unconditional-drop-recursion.stderr @@ -0,0 +1,17 @@ +error: function cannot return without recursing + --> $DIR/lint-unconditional-drop-recursion.rs:11:5 + | +LL | fn drop(&mut self) { + | ^^^^^^^^^^^^^^^^^^ cannot return without recursing +LL | let _ = RecursiveDrop; + | - recursive call site + | + = help: a `loop` may express intention better if this is on purpose +note: the lint level is defined here + --> $DIR/lint-unconditional-drop-recursion.rs:5:9 + | +LL | #![deny(unconditional_recursion)] + | ^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/tests/ui/lint/missing-copy-implementations-negative-copy.rs b/tests/ui/lint/missing-copy-implementations-negative-copy.rs new file mode 100644 index 00000000000..b29d2209fa9 --- /dev/null +++ b/tests/ui/lint/missing-copy-implementations-negative-copy.rs @@ -0,0 +1,15 @@ +// Regression test for issue #101980. +// Ensure that we don't suggest impl'ing `Copy` for a type if it already impl's `!Copy`. + +// check-pass + +#![feature(negative_impls)] +#![deny(missing_copy_implementations)] + +pub struct Struct { + pub field: i32, +} + +impl !Copy for Struct {} + +fn main() {} diff --git a/tests/ui/lint/missing-doc-private-macro.stderr b/tests/ui/lint/missing-doc-private-macro.stderr index 979b007d0ec..18c8ad2de6b 100644 --- a/tests/ui/lint/missing-doc-private-macro.stderr +++ b/tests/ui/lint/missing-doc-private-macro.stderr @@ -1,8 +1,8 @@ error: missing documentation for a macro - --> $DIR/missing-doc-private-macro.rs:31:5 + --> $DIR/missing-doc-private-macro.rs:37:1 | -LL | macro_rules! exported_to_top_level { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | pub macro top_level_pub_macro { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: the lint level is defined here --> $DIR/missing-doc-private-macro.rs:5:9 @@ -11,10 +11,10 @@ LL | #![deny(missing_docs)] | ^^^^^^^^^^^^ error: missing documentation for a macro - --> $DIR/missing-doc-private-macro.rs:37:1 + --> $DIR/missing-doc-private-macro.rs:31:5 | -LL | pub macro top_level_pub_macro { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | macro_rules! exported_to_top_level { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/tests/ui/missing_debug_impls.rs b/tests/ui/missing_debug_impls.rs index dc4dacfc468..ccad861c037 100644 --- a/tests/ui/missing_debug_impls.rs +++ b/tests/ui/missing_debug_impls.rs @@ -35,4 +35,4 @@ struct PrivateStruct; enum PrivateEnum {} #[derive(Debug)] -struct GenericType<T>(T); +pub struct GenericType<T>(T); diff --git a/tests/ui/nll/guarantor-issue-46974.rs b/tests/ui/nll/guarantor-issue-46974.rs index 96af4bf5c36..93fdf7b460b 100644 --- a/tests/ui/nll/guarantor-issue-46974.rs +++ b/tests/ui/nll/guarantor-issue-46974.rs @@ -9,7 +9,6 @@ fn foo(s: &mut (i32,)) -> i32 { } fn bar(s: &Box<(i32,)>) -> &'static i32 { - // FIXME(#46983): error message should be better &s.0 //~ ERROR lifetime may not live long enough } diff --git a/tests/ui/nll/guarantor-issue-46974.stderr b/tests/ui/nll/guarantor-issue-46974.stderr index 7edc3dcc5cd..f09faf1630b 100644 --- a/tests/ui/nll/guarantor-issue-46974.stderr +++ b/tests/ui/nll/guarantor-issue-46974.stderr @@ -10,11 +10,10 @@ LL | *x | -- borrow later used here error: lifetime may not live long enough - --> $DIR/guarantor-issue-46974.rs:13:5 + --> $DIR/guarantor-issue-46974.rs:12:5 | LL | fn bar(s: &Box<(i32,)>) -> &'static i32 { | - let's call the lifetime of this reference `'1` -LL | // FIXME(#46983): error message should be better LL | &s.0 | ^^^^ returning this value requires that `'1` must outlive `'static` diff --git a/tests/ui/panic-handler/weak-lang-item-2.rs b/tests/ui/panic-handler/weak-lang-item-2.rs index a429d8fabc7..2cc5f23b45e 100644 --- a/tests/ui/panic-handler/weak-lang-item-2.rs +++ b/tests/ui/panic-handler/weak-lang-item-2.rs @@ -1,15 +1,15 @@ // run-pass // aux-build:weak-lang-items.rs -// ignore-emscripten no threads support // pretty-expanded FIXME #23616 extern crate weak_lang_items as other; -use std::thread; - fn main() { - let _ = thread::spawn(move|| { - other::foo() - }); + // The goal of the test is just to make sure other::foo() is referenced at link time. Since + // the function panics, to prevent it from running we gate it behind an always-false `if` that + // is not going to be optimized away. + if std::hint::black_box(false) { + other::foo(); + } } diff --git a/tests/ui/proc-macro/meta-macro-hygiene.stdout b/tests/ui/proc-macro/meta-macro-hygiene.stdout index e476a8024fd..ac65ba07512 100644 --- a/tests/ui/proc-macro/meta-macro-hygiene.stdout +++ b/tests/ui/proc-macro/meta-macro-hygiene.stdout @@ -18,7 +18,7 @@ Respanned: TokenStream [Ident { ident: "$crate", span: $DIR/auxiliary/make-macro use core /* 0#1 */::prelude /* 0#1 */::rust_2018 /* 0#1 */::*; #[macro_use /* 0#1 */] extern crate core /* 0#1 */; -extern crate compiler_builtins /* 444 */ as _ /* 0#1 */; +extern crate compiler_builtins /* 445 */ as _ /* 0#1 */; // Don't load unnecessary hygiene information from std extern crate std /* 0#0 */; diff --git a/tests/ui/proc-macro/nonterminal-token-hygiene.stdout b/tests/ui/proc-macro/nonterminal-token-hygiene.stdout index 23a21004238..4031eb98a38 100644 --- a/tests/ui/proc-macro/nonterminal-token-hygiene.stdout +++ b/tests/ui/proc-macro/nonterminal-token-hygiene.stdout @@ -39,7 +39,7 @@ PRINT-BANG INPUT (DEBUG): TokenStream [ use ::core /* 0#1 */::prelude /* 0#1 */::rust_2015 /* 0#1 */::*; #[macro_use /* 0#1 */] extern crate core /* 0#2 */; -extern crate compiler_builtins /* 444 */ as _ /* 0#2 */; +extern crate compiler_builtins /* 445 */ as _ /* 0#2 */; // Don't load unnecessary hygiene information from std extern crate std /* 0#0 */; diff --git a/tests/ui/resolve/issue-114433-invalid-unused-qualifications-suggestion.rs b/tests/ui/resolve/issue-114433-invalid-unused-qualifications-suggestion.rs new file mode 100644 index 00000000000..83349dd3350 --- /dev/null +++ b/tests/ui/resolve/issue-114433-invalid-unused-qualifications-suggestion.rs @@ -0,0 +1,10 @@ +#![deny(unused_qualifications)] +// check-pass +fn bar() { + match Option::<Option<()>>::None { + Some(v) => {} + None => {} + } +} + +fn main() {} diff --git a/tests/ui/resolve/unresolved-segments-visibility.rs b/tests/ui/resolve/unresolved-segments-visibility.rs new file mode 100644 index 00000000000..c26171f75d2 --- /dev/null +++ b/tests/ui/resolve/unresolved-segments-visibility.rs @@ -0,0 +1,11 @@ +// Check that we do not ICE due to unresolved segments in visibility path. +#![crate_type = "lib"] + +extern crate alloc as b; + +mod foo { + mod bar { + pub(in b::string::String::newy) extern crate alloc as e; + //~^ ERROR failed to resolve: `String` is a struct, not a module [E0433] + } +} diff --git a/tests/ui/resolve/unresolved-segments-visibility.stderr b/tests/ui/resolve/unresolved-segments-visibility.stderr new file mode 100644 index 00000000000..0a11549cdbf --- /dev/null +++ b/tests/ui/resolve/unresolved-segments-visibility.stderr @@ -0,0 +1,9 @@ +error[E0433]: failed to resolve: `String` is a struct, not a module + --> $DIR/unresolved-segments-visibility.rs:8:27 + | +LL | pub(in b::string::String::newy) extern crate alloc as e; + | ^^^^^^ `String` is a struct, not a module + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0433`. diff --git a/tests/ui/span/visibility-ty-params.rs b/tests/ui/span/visibility-ty-params.rs index d77febe0aa2..11c2cf44cb4 100644 --- a/tests/ui/span/visibility-ty-params.rs +++ b/tests/ui/span/visibility-ty-params.rs @@ -4,7 +4,7 @@ macro_rules! m { struct S<T>(T); m!{ S<u8> } //~ ERROR unexpected generic arguments in path - //~| ERROR expected module, found struct `S` + //~| ERROR failed to resolve: `S` is a struct, not a module [E0433] mod m { m!{ m<> } //~ ERROR unexpected generic arguments in path diff --git a/tests/ui/span/visibility-ty-params.stderr b/tests/ui/span/visibility-ty-params.stderr index 067893fd22d..97d05c4644e 100644 --- a/tests/ui/span/visibility-ty-params.stderr +++ b/tests/ui/span/visibility-ty-params.stderr @@ -4,11 +4,11 @@ error: unexpected generic arguments in path LL | m!{ S<u8> } | ^^^^ -error[E0577]: expected module, found struct `S` +error[E0433]: failed to resolve: `S` is a struct, not a module --> $DIR/visibility-ty-params.rs:6:5 | LL | m!{ S<u8> } - | ^^^^^ not a module + | ^ `S` is a struct, not a module error: unexpected generic arguments in path --> $DIR/visibility-ty-params.rs:10:10 @@ -18,4 +18,4 @@ LL | m!{ m<> } error: aborting due to 3 previous errors -For more information about this error, try `rustc --explain E0577`. +For more information about this error, try `rustc --explain E0433`. diff --git a/tests/ui/traits/new-solver/lazy-nested-obligations-2.rs b/tests/ui/traits/new-solver/lazy-nested-obligations-2.rs index fd91d81cdf0..20f504928c7 100644 --- a/tests/ui/traits/new-solver/lazy-nested-obligations-2.rs +++ b/tests/ui/traits/new-solver/lazy-nested-obligations-2.rs @@ -1,5 +1,5 @@ // compile-flags: -Ztrait-solver=next -// known-bug: #95863 +// check-pass pub trait With { type F; diff --git a/tests/ui/traits/new-solver/lazy-nested-obligations-2.stderr b/tests/ui/traits/new-solver/lazy-nested-obligations-2.stderr deleted file mode 100644 index d0a4cd661b3..00000000000 --- a/tests/ui/traits/new-solver/lazy-nested-obligations-2.stderr +++ /dev/null @@ -1,39 +0,0 @@ -error[E0308]: mismatched types - --> $DIR/lazy-nested-obligations-2.rs:15:23 - | -LL | let _: V<i32> = V(f); - | - ^ types differ - | | - | arguments to this struct are incorrect - | - = note: expected associated type `<i32 as With>::F` - found fn item `for<'a> fn(&'a str) {f}` - = help: consider constraining the associated type `<i32 as With>::F` to `for<'a> fn(&'a str) {f}` or calling a method that returns `<i32 as With>::F` - = note: for more information, visit https://doc.rust-lang.org/book/ch19-03-advanced-traits.html -note: tuple struct defined here - --> $DIR/lazy-nested-obligations-2.rs:16:16 - | -LL | pub struct V<T: With>(<T as With>::F); - | ^ - -error[E0308]: mismatched types - --> $DIR/lazy-nested-obligations-2.rs:21:30 - | -LL | let _: E3<i32> = E3::Var(f); - | ------- ^ types differ - | | - | arguments to this enum variant are incorrect - | - = note: expected associated type `<i32 as With>::F` - found fn item `for<'a> fn(&'a str) {f}` - = help: consider constraining the associated type `<i32 as With>::F` to `for<'a> fn(&'a str) {f}` or calling a method that returns `<i32 as With>::F` - = note: for more information, visit https://doc.rust-lang.org/book/ch19-03-advanced-traits.html -note: tuple variant defined here - --> $DIR/lazy-nested-obligations-2.rs:19:9 - | -LL | Var(<T as With>::F), - | ^^^ - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/traits/new-solver/more-object-bound.stderr b/tests/ui/traits/new-solver/more-object-bound.stderr index 4554b8c7473..54965dee184 100644 --- a/tests/ui/traits/new-solver/more-object-bound.stderr +++ b/tests/ui/traits/new-solver/more-object-bound.stderr @@ -1,8 +1,8 @@ error[E0277]: the trait bound `dyn Trait<A = A, B = B>: Trait` is not satisfied - --> $DIR/more-object-bound.rs:12:17 + --> $DIR/more-object-bound.rs:12:5 | LL | foo::<A, B, dyn Trait<A = A, B = B>>(x) - | ^^^^^^^^^^^^^^^^^^^^^^^ the trait `Trait` is not implemented for `dyn Trait<A = A, B = B>` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Trait` is not implemented for `dyn Trait<A = A, B = B>` | note: required by a bound in `foo` --> $DIR/more-object-bound.rs:18:8 diff --git a/tests/ui/traits/new-solver/object-soundness-requires-generalization.rs b/tests/ui/traits/new-solver/object-soundness-requires-generalization.rs new file mode 100644 index 00000000000..d02dada72c9 --- /dev/null +++ b/tests/ui/traits/new-solver/object-soundness-requires-generalization.rs @@ -0,0 +1,20 @@ +// compile-flags: -Ztrait-solver=next +// ignore-test + +trait Trait { + type Gat<'lt>; +} +impl Trait for u8 { + type Gat<'lt> = u8; +} + +fn test<T: Trait, F: FnOnce(<T as Trait>::Gat<'_>) -> S + ?Sized, S>() {} + +fn main() { + // Proving `dyn FnOnce: FnOnce` requires making sure that all of the supertraits + // of the trait and associated type bounds hold. We check this in + // `predicates_for_object_candidate`, and eagerly replace projections using equality + // which may generalize a type and emit a nested AliasRelate goal. Make sure that + // we don't ICE in that case, and bubble that goal up to the caller. + test::<u8, dyn FnOnce(<u8 as Trait>::Gat<'_>) + 'static, _>(); +} diff --git a/tests/ui/type-alias-impl-trait/under-binder.rs b/tests/ui/type-alias-impl-trait/under-binder.rs new file mode 100644 index 00000000000..caf21d64027 --- /dev/null +++ b/tests/ui/type-alias-impl-trait/under-binder.rs @@ -0,0 +1,9 @@ +#![feature(type_alias_impl_trait)] + +type Opaque<'a> = impl Sized + 'a; + +fn test(f: fn(u8)) -> fn(Opaque<'_>) { + f //~ ERROR E0792 +} + +fn main() {} diff --git a/tests/ui/type-alias-impl-trait/under-binder.stderr b/tests/ui/type-alias-impl-trait/under-binder.stderr new file mode 100644 index 00000000000..82c4ec97335 --- /dev/null +++ b/tests/ui/type-alias-impl-trait/under-binder.stderr @@ -0,0 +1,12 @@ +error[E0792]: expected generic lifetime parameter, found `'_` + --> $DIR/under-binder.rs:6:5 + | +LL | type Opaque<'a> = impl Sized + 'a; + | -- this generic parameter must be used with a generic lifetime parameter +... +LL | f + | ^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0792`. diff --git a/tests/ui/type/option-ref-advice.rs b/tests/ui/type/option-ref-advice.rs new file mode 100644 index 00000000000..2dcee5a2eb9 --- /dev/null +++ b/tests/ui/type/option-ref-advice.rs @@ -0,0 +1,11 @@ +// Regression test for https://github.com/rust-lang/rust/issues/100605 + +fn takes_option(_arg: Option<&String>) {} + +fn main() { + takes_option(&None); //~ ERROR 6:18: 6:23: mismatched types [E0308] + + let x = String::from("x"); + let res = Some(x); + takes_option(&res); //~ ERROR 10:18: 10:22: mismatched types [E0308] +} diff --git a/tests/ui/issues/issue-100605.stderr b/tests/ui/type/option-ref-advice.stderr index 6f11f44755a..d4dbef3013f 100644 --- a/tests/ui/issues/issue-100605.stderr +++ b/tests/ui/type/option-ref-advice.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/issue-100605.rs:4:18 + --> $DIR/option-ref-advice.rs:6:18 | LL | takes_option(&None); | ------------ ^^^^^ expected `Option<&String>`, found `&Option<_>` @@ -9,7 +9,7 @@ LL | takes_option(&None); = note: expected enum `Option<&String>` found reference `&Option<_>` note: function defined here - --> $DIR/issue-100605.rs:1:4 + --> $DIR/option-ref-advice.rs:3:4 | LL | fn takes_option(_arg: Option<&String>) {} | ^^^^^^^^^^^^ --------------------- @@ -20,7 +20,7 @@ LL + takes_option(None); | error[E0308]: mismatched types - --> $DIR/issue-100605.rs:8:18 + --> $DIR/option-ref-advice.rs:10:18 | LL | takes_option(&res); | ------------ ^^^^ expected `Option<&String>`, found `&Option<String>` @@ -30,7 +30,7 @@ LL | takes_option(&res); = note: expected enum `Option<&String>` found reference `&Option<String>` note: function defined here - --> $DIR/issue-100605.rs:1:4 + --> $DIR/option-ref-advice.rs:3:4 | LL | fn takes_option(_arg: Option<&String>) {} | ^^^^^^^^^^^^ --------------------- diff --git a/tests/ui/use/use-self-type.stderr b/tests/ui/use/use-self-type.stderr index 3da04a851f6..498df34fe32 100644 --- a/tests/ui/use/use-self-type.stderr +++ b/tests/ui/use/use-self-type.stderr @@ -1,8 +1,8 @@ -error[E0433]: failed to resolve: `Self` is only available in impls, traits, and type definitions +error[E0433]: failed to resolve: `Self` cannot be used in imports --> $DIR/use-self-type.rs:7:16 | LL | pub(in Self::f) struct Z; - | ^^^^ `Self` is only available in impls, traits, and type definitions + | ^^^^ `Self` cannot be used in imports error[E0432]: unresolved import `Self` --> $DIR/use-self-type.rs:6:13 |
