From 7dd57f085cab4cc671b01d6dd27977c76d04de28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bennet=20Ble=C3=9Fmann?= Date: Sun, 6 Apr 2025 15:12:24 +0200 Subject: [PATCH] update/bless tests --- .../src/error_codes/E0622.md | 10 +- tests/assembly/simd-bitmask.rs | 5 +- tests/assembly/simd-intrinsic-gather.rs | 5 +- tests/assembly/simd-intrinsic-mask-load.rs | 5 +- tests/assembly/simd-intrinsic-mask-reduce.rs | 8 +- tests/assembly/simd-intrinsic-mask-store.rs | 5 +- tests/assembly/simd-intrinsic-scatter.rs | 5 +- tests/assembly/simd-intrinsic-select.rs | 5 +- tests/codegen/avr/avr-func-addrspace.rs | 5 +- .../codegen/emscripten-catch-unwind-js-eh.rs | 13 +- .../emscripten-catch-unwind-wasm-eh.rs | 14 +- tests/codegen/intrinsic-no-unnamed-attr.rs | 6 +- tests/codegen/intrinsics/nontemporal.rs | 5 +- tests/mir-opt/lower_intrinsics.rs | 9 +- .../atomic-lock-free/atomic_lock_free.rs | 5 +- .../avr-rjmp-offset/avr-rjmp-offsets.rs | 7 +- ...abi-typo-unstable.feature_disabled.stderr} | 8 +- .../abi-typo-unstable.feature_enabled.stderr | 16 + tests/ui/abi/abi-typo-unstable.rs | 11 +- ...sociated-types-in-ambiguous-context.stderr | 36 +- ...ice-mutability-error-slicing-121807.stderr | 12 +- .../trait-impl-argument-difference-ice.stderr | 12 +- tests/ui/delegation/ice-issue-124347.rs | 1 - tests/ui/delegation/ice-issue-124347.stderr | 12 +- ...-fn-inputs-and-outputs-issue-125139.stderr | 320 +++++++++--------- tests/ui/error-codes/E0092.rs | 9 +- tests/ui/error-codes/E0092.stderr | 6 +- tests/ui/error-codes/E0093.rs | 11 +- tests/ui/error-codes/E0093.stderr | 6 +- tests/ui/error-codes/E0622.rs | 14 +- tests/ui/error-codes/E0622.stderr | 6 +- tests/ui/extern/extern-with-type-bounds.rs | 21 -- .../ui/extern/extern-with-type-bounds.stderr | 9 - tests/ui/feature-gates/feature-gate-abi.rs | 21 -- .../ui/feature-gates/feature-gate-abi.stderr | 172 +--------- .../feature-gates/feature-gate-intrinsics.rs | 9 +- .../feature-gate-intrinsics.stderr | 36 +- .../feature-gated-feature-in-macro-arg.rs | 6 +- .../feature-gated-feature-in-macro-arg.stderr | 10 +- tests/ui/intrinsics/always-extern.rs | 17 - tests/ui/intrinsics/always-extern.stderr | 34 -- .../ui/intrinsics/auxiliary/cci_intrinsic.rs | 9 +- .../incorrect-read_via_copy-defn.rs | 7 +- .../incorrect-read_via_copy-defn.stderr | 21 +- tests/ui/intrinsics/incorrect-transmute.rs | 7 +- .../ui/intrinsics/incorrect-transmute.stderr | 21 +- tests/ui/intrinsics/intrinsic-atomics.rs | 64 ++-- .../intrinsics/invalid-ABI-rust-intrinsic.rs | 19 ++ .../invalid-ABI-rust-intrinsic.stderr | 35 ++ tests/ui/intrinsics/issue-28575.rs | 1 + tests/ui/intrinsics/issue-28575.stderr | 15 +- .../ui/intrinsics/safe-intrinsic-mismatch.rs | 11 +- .../intrinsics/safe-intrinsic-mismatch.stderr | 21 +- tests/ui/lint/internal_features.rs | 5 +- tests/ui/print-calling-conventions.stdout | 1 - ...it-should-use-self-2021-without-dyn.stderr | 56 +-- tests/ui/suggestions/issue-116434-2015.stderr | 26 +- .../typeck_type_placeholder_item.stderr | 24 +- ...ir-wf-check-anon-const-issue-122199.stderr | 12 +- 59 files changed, 545 insertions(+), 737 deletions(-) rename tests/ui/abi/{abi-typo-unstable.stderr => abi-typo-unstable.feature_disabled.stderr} (55%) create mode 100644 tests/ui/abi/abi-typo-unstable.feature_enabled.stderr delete mode 100644 tests/ui/extern/extern-with-type-bounds.rs delete mode 100644 tests/ui/extern/extern-with-type-bounds.stderr delete mode 100644 tests/ui/intrinsics/always-extern.rs delete mode 100644 tests/ui/intrinsics/always-extern.stderr create mode 100644 tests/ui/intrinsics/invalid-ABI-rust-intrinsic.rs create mode 100644 tests/ui/intrinsics/invalid-ABI-rust-intrinsic.stderr diff --git a/compiler/rustc_error_codes/src/error_codes/E0622.md b/compiler/rustc_error_codes/src/error_codes/E0622.md index 4cb605b636d..e6ff949d3e9 100644 --- a/compiler/rustc_error_codes/src/error_codes/E0622.md +++ b/compiler/rustc_error_codes/src/error_codes/E0622.md @@ -6,8 +6,9 @@ Erroneous code example: #![feature(intrinsics)] #![allow(internal_features)] -extern "rust-intrinsic" { - pub static atomic_singlethreadfence_seqcst: fn(); +extern "C" { + #[rustc_intrinsic] + pub static atomic_singlethreadfence_seqcst: unsafe fn(); // error: intrinsic must be a function } @@ -22,9 +23,8 @@ error, just declare a function. Example: #![feature(intrinsics)] #![allow(internal_features)] -extern "rust-intrinsic" { - pub fn atomic_singlethreadfence_seqcst(); // ok! -} +#[rustc_intrinsic] +pub unsafe fn atomic_singlethreadfence_seqcst(); // ok! fn main() { unsafe { atomic_singlethreadfence_seqcst(); } } ``` diff --git a/tests/assembly/simd-bitmask.rs b/tests/assembly/simd-bitmask.rs index a632791153b..e4122461087 100644 --- a/tests/assembly/simd-bitmask.rs +++ b/tests/assembly/simd-bitmask.rs @@ -35,9 +35,8 @@ pub struct m64x2([i64; 2]); #[repr(simd)] pub struct m64x4([i64; 4]); -extern "rust-intrinsic" { - fn simd_bitmask(mask: V) -> B; -} +#[rustc_intrinsic] +unsafe fn simd_bitmask(mask: V) -> B; // CHECK-LABEL: bitmask_m8x16 #[no_mangle] diff --git a/tests/assembly/simd-intrinsic-gather.rs b/tests/assembly/simd-intrinsic-gather.rs index 8c17a58046d..bcab0ba1cc0 100644 --- a/tests/assembly/simd-intrinsic-gather.rs +++ b/tests/assembly/simd-intrinsic-gather.rs @@ -22,9 +22,8 @@ pub struct m64x4([i64; 4]); #[repr(simd)] pub struct pf64x4([*const f64; 4]); -extern "rust-intrinsic" { - fn simd_gather(values: V, mask: M, pointer: P) -> V; -} +#[rustc_intrinsic] +unsafe fn simd_gather(values: V, mask: M, pointer: P) -> V; // CHECK-LABEL: gather_f64x4 #[no_mangle] diff --git a/tests/assembly/simd-intrinsic-mask-load.rs b/tests/assembly/simd-intrinsic-mask-load.rs index a0d0514c014..d3f3453a780 100644 --- a/tests/assembly/simd-intrinsic-mask-load.rs +++ b/tests/assembly/simd-intrinsic-mask-load.rs @@ -34,9 +34,8 @@ pub struct f64x4([f64; 4]); #[repr(simd)] pub struct m64x4([i64; 4]); -extern "rust-intrinsic" { - fn simd_masked_load(mask: M, pointer: P, values: T) -> T; -} +#[rustc_intrinsic] +unsafe fn simd_masked_load(mask: M, pointer: P, values: T) -> T; // CHECK-LABEL: load_i8x16 #[no_mangle] diff --git a/tests/assembly/simd-intrinsic-mask-reduce.rs b/tests/assembly/simd-intrinsic-mask-reduce.rs index 959c4ddefdb..8b15ed0a254 100644 --- a/tests/assembly/simd-intrinsic-mask-reduce.rs +++ b/tests/assembly/simd-intrinsic-mask-reduce.rs @@ -20,10 +20,10 @@ use minicore::*; #[repr(simd)] pub struct mask8x16([i8; 16]); -extern "rust-intrinsic" { - fn simd_reduce_all(x: T) -> bool; - fn simd_reduce_any(x: T) -> bool; -} +#[rustc_intrinsic] +unsafe fn simd_reduce_all(x: T) -> bool; +#[rustc_intrinsic] +unsafe fn simd_reduce_any(x: T) -> bool; // CHECK-LABEL: mask_reduce_all: #[no_mangle] diff --git a/tests/assembly/simd-intrinsic-mask-store.rs b/tests/assembly/simd-intrinsic-mask-store.rs index 4be9194943c..001762e5060 100644 --- a/tests/assembly/simd-intrinsic-mask-store.rs +++ b/tests/assembly/simd-intrinsic-mask-store.rs @@ -34,9 +34,8 @@ pub struct f64x4([f64; 4]); #[repr(simd)] pub struct m64x4([i64; 4]); -extern "rust-intrinsic" { - fn simd_masked_store(mask: M, pointer: P, values: T); -} +#[rustc_intrinsic] +unsafe fn simd_masked_store(mask: M, pointer: P, values: T); // CHECK-LABEL: store_i8x16 #[no_mangle] diff --git a/tests/assembly/simd-intrinsic-scatter.rs b/tests/assembly/simd-intrinsic-scatter.rs index 715de04af4d..d77dfad3546 100644 --- a/tests/assembly/simd-intrinsic-scatter.rs +++ b/tests/assembly/simd-intrinsic-scatter.rs @@ -22,9 +22,8 @@ pub struct m64x4([i64; 4]); #[repr(simd)] pub struct pf64x4([*mut f64; 4]); -extern "rust-intrinsic" { - fn simd_scatter(values: V, pointer: P, mask: M); -} +#[rustc_intrinsic] +unsafe fn simd_scatter(values: V, pointer: P, mask: M); // CHECK-LABEL: scatter_f64x4 #[no_mangle] diff --git a/tests/assembly/simd-intrinsic-select.rs b/tests/assembly/simd-intrinsic-select.rs index 7f1e42662bf..4f8d6b825b6 100644 --- a/tests/assembly/simd-intrinsic-select.rs +++ b/tests/assembly/simd-intrinsic-select.rs @@ -48,9 +48,8 @@ pub struct f64x8([f64; 8]); #[repr(simd)] pub struct m64x8([i64; 8]); -extern "rust-intrinsic" { - fn simd_select(mask: M, a: V, b: V) -> V; -} +#[rustc_intrinsic] +unsafe fn simd_select(mask: M, a: V, b: V) -> V; // CHECK-LABEL: select_i8x16 #[no_mangle] diff --git a/tests/codegen/avr/avr-func-addrspace.rs b/tests/codegen/avr/avr-func-addrspace.rs index 2ae2f40d7b3..e0192f8b45a 100644 --- a/tests/codegen/avr/avr-func-addrspace.rs +++ b/tests/codegen/avr/avr-func-addrspace.rs @@ -17,9 +17,8 @@ extern crate minicore; use minicore::*; -extern "rust-intrinsic" { - pub fn transmute(src: Src) -> Dst; -} +#[rustc_intrinsic] +pub unsafe fn transmute(src: Src) -> Dst; pub static mut STORAGE_FOO: fn(&usize, &mut u32) -> Result<(), ()> = arbitrary_black_box; pub static mut STORAGE_BAR: u32 = 12; diff --git a/tests/codegen/emscripten-catch-unwind-js-eh.rs b/tests/codegen/emscripten-catch-unwind-js-eh.rs index 018ad5454fc..3ab4b5c9c63 100644 --- a/tests/codegen/emscripten-catch-unwind-js-eh.rs +++ b/tests/codegen/emscripten-catch-unwind-js-eh.rs @@ -23,13 +23,12 @@ fn size_of() -> usize { loop {} } -extern "rust-intrinsic" { - fn catch_unwind( - try_fn: fn(_: *mut u8), - data: *mut u8, - catch_fn: fn(_: *mut u8, _: *mut u8), - ) -> i32; -} +#[rustc_intrinsic] +unsafe fn catch_unwind( + try_fn: fn(_: *mut u8), + data: *mut u8, + catch_fn: fn(_: *mut u8, _: *mut u8), +) -> i32; // CHECK-LABEL: @ptr_size #[no_mangle] diff --git a/tests/codegen/emscripten-catch-unwind-wasm-eh.rs b/tests/codegen/emscripten-catch-unwind-wasm-eh.rs index 0fc9ae96720..d0571e4df08 100644 --- a/tests/codegen/emscripten-catch-unwind-wasm-eh.rs +++ b/tests/codegen/emscripten-catch-unwind-wasm-eh.rs @@ -21,14 +21,12 @@ impl Copy for *mut T {} fn size_of() -> usize { loop {} } - -extern "rust-intrinsic" { - fn catch_unwind( - try_fn: fn(_: *mut u8), - data: *mut u8, - catch_fn: fn(_: *mut u8, _: *mut u8), - ) -> i32; -} +#[rustc_intrinsic] +unsafe fn catch_unwind( + try_fn: fn(_: *mut u8), + data: *mut u8, + catch_fn: fn(_: *mut u8, _: *mut u8), +) -> i32; // CHECK-LABEL: @ptr_size #[no_mangle] diff --git a/tests/codegen/intrinsic-no-unnamed-attr.rs b/tests/codegen/intrinsic-no-unnamed-attr.rs index fce0de80d7b..35eb025ab6b 100644 --- a/tests/codegen/intrinsic-no-unnamed-attr.rs +++ b/tests/codegen/intrinsic-no-unnamed-attr.rs @@ -2,9 +2,9 @@ #![feature(intrinsics)] -extern "rust-intrinsic" { - fn sqrtf32(x: f32) -> f32; -} +#[rustc_intrinsic] +unsafe fn sqrtf32(x: f32) -> f32; + // CHECK: @llvm.sqrt.f32(float) #{{[0-9]*}} fn main() { diff --git a/tests/codegen/intrinsics/nontemporal.rs b/tests/codegen/intrinsics/nontemporal.rs index 1d4fae83c29..a151d4bd297 100644 --- a/tests/codegen/intrinsics/nontemporal.rs +++ b/tests/codegen/intrinsics/nontemporal.rs @@ -18,9 +18,8 @@ extern crate minicore; use minicore::*; -extern "rust-intrinsic" { - pub fn nontemporal_store(ptr: *mut T, val: T); -} +#[rustc_intrinsic] +pub unsafe fn nontemporal_store(ptr: *mut T, val: T); #[no_mangle] pub fn a(a: &mut u32, b: u32) { diff --git a/tests/mir-opt/lower_intrinsics.rs b/tests/mir-opt/lower_intrinsics.rs index 4859d935461..5afddc5ff73 100644 --- a/tests/mir-opt/lower_intrinsics.rs +++ b/tests/mir-opt/lower_intrinsics.rs @@ -153,11 +153,10 @@ pub fn discriminant(t: T) { core::intrinsics::discriminant_value(&E::B); } -extern "rust-intrinsic" { - // Cannot use `std::intrinsics::copy_nonoverlapping` as that is a wrapper function - #[rustc_nounwind] - fn copy_nonoverlapping(src: *const T, dst: *mut T, count: usize); -} +// Cannot use `std::intrinsics::copy_nonoverlapping` as that is a wrapper function +#[rustc_nounwind] +#[rustc_intrinsic] +unsafe fn copy_nonoverlapping(src: *const T, dst: *mut T, count: usize); // EMIT_MIR lower_intrinsics.f_copy_nonoverlapping.LowerIntrinsics.diff pub fn f_copy_nonoverlapping() { diff --git a/tests/run-make/atomic-lock-free/atomic_lock_free.rs b/tests/run-make/atomic-lock-free/atomic_lock_free.rs index 1f1116b9bfd..b49c5044f31 100644 --- a/tests/run-make/atomic-lock-free/atomic_lock_free.rs +++ b/tests/run-make/atomic-lock-free/atomic_lock_free.rs @@ -2,9 +2,8 @@ #![crate_type = "rlib"] #![no_core] -extern "rust-intrinsic" { - fn atomic_xadd_seqcst(dst: *mut T, src: T) -> T; -} +#[rustc_intrinsic] +unsafe fn atomic_xadd_seqcst(dst: *mut T, src: T) -> T; #[lang = "sized"] trait Sized {} diff --git a/tests/run-make/avr-rjmp-offset/avr-rjmp-offsets.rs b/tests/run-make/avr-rjmp-offset/avr-rjmp-offsets.rs index 2f97fc1ed95..c91cd695cee 100644 --- a/tests/run-make/avr-rjmp-offset/avr-rjmp-offsets.rs +++ b/tests/run-make/avr-rjmp-offset/avr-rjmp-offsets.rs @@ -37,10 +37,9 @@ mod minicore { #[inline] #[rustc_diagnostic_item = "ptr_write_volatile"] pub unsafe fn write_volatile(dst: *mut T, src: T) { - extern "rust-intrinsic" { - #[rustc_nounwind] - pub fn volatile_store(dst: *mut T, val: T); - } + #[rustc_intrinsic] + pub unsafe fn volatile_store(dst: *mut T, val: T); + unsafe { volatile_store(dst, src) }; } } diff --git a/tests/ui/abi/abi-typo-unstable.stderr b/tests/ui/abi/abi-typo-unstable.feature_disabled.stderr similarity index 55% rename from tests/ui/abi/abi-typo-unstable.stderr rename to tests/ui/abi/abi-typo-unstable.feature_disabled.stderr index 9ba67ad7dbe..1934b483c47 100644 --- a/tests/ui/abi/abi-typo-unstable.stderr +++ b/tests/ui/abi/abi-typo-unstable.feature_disabled.stderr @@ -1,8 +1,8 @@ -error[E0703]: invalid ABI: found `rust-intrinsec` - --> $DIR/abi-typo-unstable.rs:2:8 +error[E0703]: invalid ABI: found `rust-cull` + --> $DIR/abi-typo-unstable.rs:5:8 | -LL | extern "rust-intrinsec" fn rust_intrinsic() {} - | ^^^^^^^^^^^^^^^^ invalid ABI +LL | extern "rust-cull" fn rust_call(_: ()) {} + | ^^^^^^^^^^^ invalid ABI | = note: invoke `rustc --print=calling-conventions` for a full list of supported calling conventions diff --git a/tests/ui/abi/abi-typo-unstable.feature_enabled.stderr b/tests/ui/abi/abi-typo-unstable.feature_enabled.stderr new file mode 100644 index 00000000000..868b9509830 --- /dev/null +++ b/tests/ui/abi/abi-typo-unstable.feature_enabled.stderr @@ -0,0 +1,16 @@ +error[E0703]: invalid ABI: found `rust-cull` + --> $DIR/abi-typo-unstable.rs:5:8 + | +LL | extern "rust-cull" fn rust_call(_: ()) {} + | ^^^^^^^^^^^ invalid ABI + | + = note: invoke `rustc --print=calling-conventions` for a full list of supported calling conventions +help: there's a similarly named valid ABI `rust-call` + | +LL - extern "rust-cull" fn rust_call(_: ()) {} +LL + extern "rust-call" fn rust_call(_: ()) {} + | + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0703`. diff --git a/tests/ui/abi/abi-typo-unstable.rs b/tests/ui/abi/abi-typo-unstable.rs index 94991a5eb17..75366217fa2 100644 --- a/tests/ui/abi/abi-typo-unstable.rs +++ b/tests/ui/abi/abi-typo-unstable.rs @@ -1,6 +1,11 @@ -// rust-intrinsic is unstable and not enabled, so it should not be suggested as a fix -extern "rust-intrinsec" fn rust_intrinsic() {} //~ ERROR invalid ABI +//@ revisions: feature_disabled feature_enabled +#![cfg_attr(feature_enabled, feature(unboxed_closures))] + +// rust-call is unstable and not enabled, so it should not be suggested as a fix +extern "rust-cull" fn rust_call(_: ()) {} +//~^ ERROR invalid ABI +//[feature_enabled]~| HELP there's a similarly named valid ABI fn main() { - rust_intrinsic(); + rust_call(()); } diff --git a/tests/ui/associated-types/associated-types-in-ambiguous-context.stderr b/tests/ui/associated-types/associated-types-in-ambiguous-context.stderr index d7d2161e7ad..1be8db5ddf4 100644 --- a/tests/ui/associated-types/associated-types-in-ambiguous-context.stderr +++ b/tests/ui/associated-types/associated-types-in-ambiguous-context.stderr @@ -10,24 +10,6 @@ LL - fn get(x: T, y: U) -> Get::Value {} LL + fn get(x: T, y: U) -> ::Value {} | -error[E0223]: ambiguous associated type - --> $DIR/associated-types-in-ambiguous-context.rs:13:23 - | -LL | fn grab(&self) -> Grab::Value; - | ^^^^^^^^^^^ help: use fully-qualified syntax: `::Value` - -error[E0223]: ambiguous associated type - --> $DIR/associated-types-in-ambiguous-context.rs:16:22 - | -LL | fn get(&self) -> Get::Value; - | ^^^^^^^^^^ - | -help: if there were a type named `Example` that implemented `Get`, you could use the fully-qualified path - | -LL - fn get(&self) -> Get::Value; -LL + fn get(&self) -> ::Value; - | - error[E0223]: ambiguous associated type --> $DIR/associated-types-in-ambiguous-context.rs:22:17 | @@ -56,6 +38,24 @@ LL + type X = as Deref>::Target; | and N other candidates +error[E0223]: ambiguous associated type + --> $DIR/associated-types-in-ambiguous-context.rs:13:23 + | +LL | fn grab(&self) -> Grab::Value; + | ^^^^^^^^^^^ help: use fully-qualified syntax: `::Value` + +error[E0223]: ambiguous associated type + --> $DIR/associated-types-in-ambiguous-context.rs:16:22 + | +LL | fn get(&self) -> Get::Value; + | ^^^^^^^^^^ + | +help: if there were a type named `Example` that implemented `Get`, you could use the fully-qualified path + | +LL - fn get(&self) -> Get::Value; +LL + fn get(&self) -> ::Value; + | + error: aborting due to 5 previous errors For more information about this error, try `rustc --explain E0223`. diff --git a/tests/ui/borrowck/ice-mutability-error-slicing-121807.stderr b/tests/ui/borrowck/ice-mutability-error-slicing-121807.stderr index 3a6b8008fce..02d5231f713 100644 --- a/tests/ui/borrowck/ice-mutability-error-slicing-121807.stderr +++ b/tests/ui/borrowck/ice-mutability-error-slicing-121807.stderr @@ -23,12 +23,6 @@ LL | extern "C" fn read_dword(Self::Assoc<'_>) -> u16; = note: for more information, see issue #41686 = note: `#[warn(anonymous_parameters)]` on by default -error[E0220]: associated type `Assoc` not found for `Self` - --> $DIR/ice-mutability-error-slicing-121807.rs:7:36 - | -LL | extern "C" fn read_dword(Self::Assoc<'_>) -> u16; - | ^^^^^ associated type `Assoc` not found - error[E0185]: method `read_dword` has a `&self` declaration in the impl, but not in the trait --> $DIR/ice-mutability-error-slicing-121807.rs:17:5 | @@ -47,6 +41,12 @@ LL | extern "C" fn read_word(&mut self) -> u8; LL | impl MemoryUnit for ROM { | ^^^^^^^^^^^^^^^^^^^^^^^ missing `read_word` in implementation +error[E0220]: associated type `Assoc` not found for `Self` + --> $DIR/ice-mutability-error-slicing-121807.rs:7:36 + | +LL | extern "C" fn read_dword(Self::Assoc<'_>) -> u16; + | ^^^^^ associated type `Assoc` not found + error: aborting due to 4 previous errors; 1 warning emitted Some errors have detailed explanations: E0046, E0185, E0220, E0261. diff --git a/tests/ui/borrowck/trait-impl-argument-difference-ice.stderr b/tests/ui/borrowck/trait-impl-argument-difference-ice.stderr index 190ddeaa8f2..a656bb67bcb 100644 --- a/tests/ui/borrowck/trait-impl-argument-difference-ice.stderr +++ b/tests/ui/borrowck/trait-impl-argument-difference-ice.stderr @@ -8,12 +8,6 @@ LL | extern "C" fn read_dword(Self::Assoc<'_>) -> u16; = note: for more information, see issue #41686 = note: `#[warn(anonymous_parameters)]` on by default -error[E0220]: associated type `Assoc` not found for `Self` - --> $DIR/trait-impl-argument-difference-ice.rs:4:36 - | -LL | extern "C" fn read_dword(Self::Assoc<'_>) -> u16; - | ^^^^^ associated type `Assoc` not found - error[E0185]: method `read_dword` has a `&self` declaration in the impl, but not in the trait --> $DIR/trait-impl-argument-difference-ice.rs:14:5 | @@ -32,6 +26,12 @@ LL | extern "C" fn read_word(&mut self) -> u8; LL | impl MemoryUnit for ROM { | ^^^^^^^^^^^^^^^^^^^^^^^ missing `read_word` in implementation +error[E0220]: associated type `Assoc` not found for `Self` + --> $DIR/trait-impl-argument-difference-ice.rs:4:36 + | +LL | extern "C" fn read_dword(Self::Assoc<'_>) -> u16; + | ^^^^^ associated type `Assoc` not found + error[E0596]: cannot borrow `*self` as mutable, as it is behind a `&` reference --> $DIR/trait-impl-argument-difference-ice.rs:16:19 | diff --git a/tests/ui/delegation/ice-issue-124347.rs b/tests/ui/delegation/ice-issue-124347.rs index b2b3c61a722..3e0a5b36ddc 100644 --- a/tests/ui/delegation/ice-issue-124347.rs +++ b/tests/ui/delegation/ice-issue-124347.rs @@ -4,7 +4,6 @@ // FIXME(fn_delegation): `recursive delegation` error should be emitted here trait Trait { reuse Trait::foo { &self.0 } - //~^ ERROR recursive delegation is not supported yet } reuse foo; diff --git a/tests/ui/delegation/ice-issue-124347.stderr b/tests/ui/delegation/ice-issue-124347.stderr index 74c4b5cd949..2955c044203 100644 --- a/tests/ui/delegation/ice-issue-124347.stderr +++ b/tests/ui/delegation/ice-issue-124347.stderr @@ -1,23 +1,17 @@ -error: recursive delegation is not supported yet - --> $DIR/ice-issue-124347.rs:6:18 - | -LL | reuse Trait::foo { &self.0 } - | ^^^ callee defined here - error[E0391]: cycle detected when computing generics of `foo` - --> $DIR/ice-issue-124347.rs:10:7 + --> $DIR/ice-issue-124347.rs:9:7 | LL | reuse foo; | ^^^ | = note: ...which immediately requires computing generics of `foo` again note: cycle used when checking that `foo` is well-formed - --> $DIR/ice-issue-124347.rs:10:7 + --> $DIR/ice-issue-124347.rs:9:7 | LL | reuse foo; | ^^^ = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information -error: aborting due to 2 previous errors +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0391`. diff --git a/tests/ui/dyn-compatibility/reference-to-bare-trait-in-fn-inputs-and-outputs-issue-125139.stderr b/tests/ui/dyn-compatibility/reference-to-bare-trait-in-fn-inputs-and-outputs-issue-125139.stderr index 832e7ef4dc3..2cf244185e6 100644 --- a/tests/ui/dyn-compatibility/reference-to-bare-trait-in-fn-inputs-and-outputs-issue-125139.stderr +++ b/tests/ui/dyn-compatibility/reference-to-bare-trait-in-fn-inputs-and-outputs-issue-125139.stderr @@ -187,166 +187,6 @@ help: consider using the `'static` lifetime, but this is uncommon unless you're LL | fn parrot() -> &'static mut Trait { | +++++++ -error[E0782]: expected a type, found a trait - --> $DIR/reference-to-bare-trait-in-fn-inputs-and-outputs-issue-125139.rs:52:16 - | -LL | fn foo(_: &Trait); - | ^^^^^ - | -help: use a new generic type parameter, constrained by `Trait` - | -LL - fn foo(_: &Trait); -LL + fn foo(_: &T); - | -help: you can also use an opaque type, but users won't be able to specify the type parameter when calling the `fn`, having to rely exclusively on type inference - | -LL | fn foo(_: &impl Trait); - | ++++ -help: alternatively, use a trait object to accept any type that implements `Trait`, accessing its methods at runtime using dynamic dispatch - | -LL | fn foo(_: &dyn Trait); - | +++ - -error[E0782]: expected a type, found a trait - --> $DIR/reference-to-bare-trait-in-fn-inputs-and-outputs-issue-125139.rs:55:19 - | -LL | fn bar(_: &'a Trait); - | ^^^^^ - | -help: use a new generic type parameter, constrained by `Trait` - | -LL - fn bar(_: &'a Trait); -LL + fn bar(_: &'a T); - | -help: you can also use an opaque type, but users won't be able to specify the type parameter when calling the `fn`, having to rely exclusively on type inference - | -LL | fn bar(_: &'a impl Trait); - | ++++ -help: alternatively, use a trait object to accept any type that implements `Trait`, accessing its methods at runtime using dynamic dispatch - | -LL | fn bar(_: &'a dyn Trait); - | +++ - -error[E0782]: expected a type, found a trait - --> $DIR/reference-to-bare-trait-in-fn-inputs-and-outputs-issue-125139.rs:59:22 - | -LL | fn alice<'a>(_: &Trait); - | ^^^^^ - | -help: use a new generic type parameter, constrained by `Trait` - | -LL - fn alice<'a>(_: &Trait); -LL + fn alice<'a, T: Trait>(_: &T); - | -help: you can also use an opaque type, but users won't be able to specify the type parameter when calling the `fn`, having to rely exclusively on type inference - | -LL | fn alice<'a>(_: &impl Trait); - | ++++ -help: alternatively, use a trait object to accept any type that implements `Trait`, accessing its methods at runtime using dynamic dispatch - | -LL | fn alice<'a>(_: &dyn Trait); - | +++ - -error[E0782]: expected a type, found a trait - --> $DIR/reference-to-bare-trait-in-fn-inputs-and-outputs-issue-125139.rs:62:23 - | -LL | fn bob<'a>(_: &'a Trait); - | ^^^^^ - | -help: use a new generic type parameter, constrained by `Trait` - | -LL - fn bob<'a>(_: &'a Trait); -LL + fn bob<'a, T: Trait>(_: &'a T); - | -help: you can also use an opaque type, but users won't be able to specify the type parameter when calling the `fn`, having to rely exclusively on type inference - | -LL | fn bob<'a>(_: &'a impl Trait); - | ++++ -help: alternatively, use a trait object to accept any type that implements `Trait`, accessing its methods at runtime using dynamic dispatch - | -LL | fn bob<'a>(_: &'a dyn Trait); - | +++ - -error[E0782]: expected a type, found a trait - --> $DIR/reference-to-bare-trait-in-fn-inputs-and-outputs-issue-125139.rs:65:18 - | -LL | fn cat() -> &Trait; - | ^^^^^ - | -help: use `impl Trait` to return an opaque type, as long as you return a single underlying type - | -LL | fn cat() -> &impl Trait; - | ++++ -help: alternatively, you can return an owned trait object - | -LL - fn cat() -> &Trait; -LL + fn cat() -> Box; - | - -error[E0782]: expected a type, found a trait - --> $DIR/reference-to-bare-trait-in-fn-inputs-and-outputs-issue-125139.rs:69:22 - | -LL | fn dog<'a>() -> &Trait { - | ^^^^^ - | -help: use `impl Trait` to return an opaque type, as long as you return a single underlying type - | -LL | fn dog<'a>() -> &impl Trait { - | ++++ -help: alternatively, you can return an owned trait object - | -LL - fn dog<'a>() -> &Trait { -LL + fn dog<'a>() -> Box { - | - -error[E0782]: expected a type, found a trait - --> $DIR/reference-to-bare-trait-in-fn-inputs-and-outputs-issue-125139.rs:75:24 - | -LL | fn kitten() -> &'a Trait { - | ^^^^^ - | -help: use `impl Trait` to return an opaque type, as long as you return a single underlying type - | -LL | fn kitten() -> &'a impl Trait { - | ++++ -help: alternatively, you can return an owned trait object - | -LL - fn kitten() -> &'a Trait { -LL + fn kitten() -> Box { - | - -error[E0782]: expected a type, found a trait - --> $DIR/reference-to-bare-trait-in-fn-inputs-and-outputs-issue-125139.rs:81:27 - | -LL | fn puppy<'a>() -> &'a Trait { - | ^^^^^ - | -help: use `impl Trait` to return an opaque type, as long as you return a single underlying type - | -LL | fn puppy<'a>() -> &'a impl Trait { - | ++++ -help: alternatively, you can return an owned trait object - | -LL - fn puppy<'a>() -> &'a Trait { -LL + fn puppy<'a>() -> Box { - | - -error[E0782]: expected a type, found a trait - --> $DIR/reference-to-bare-trait-in-fn-inputs-and-outputs-issue-125139.rs:86:25 - | -LL | fn parrot() -> &mut Trait { - | ^^^^^ - | -help: use `impl Trait` to return an opaque type, as long as you return a single underlying type - | -LL | fn parrot() -> &mut impl Trait { - | ++++ -help: alternatively, you can return an owned trait object - | -LL - fn parrot() -> &mut Trait { -LL + fn parrot() -> Box { - | - error[E0782]: expected a type, found a trait --> $DIR/reference-to-bare-trait-in-fn-inputs-and-outputs-issue-125139.rs:93:12 | @@ -667,6 +507,166 @@ LL - fn parrot() -> &mut Trait { LL + fn parrot() -> Box { | +error[E0782]: expected a type, found a trait + --> $DIR/reference-to-bare-trait-in-fn-inputs-and-outputs-issue-125139.rs:52:16 + | +LL | fn foo(_: &Trait); + | ^^^^^ + | +help: use a new generic type parameter, constrained by `Trait` + | +LL - fn foo(_: &Trait); +LL + fn foo(_: &T); + | +help: you can also use an opaque type, but users won't be able to specify the type parameter when calling the `fn`, having to rely exclusively on type inference + | +LL | fn foo(_: &impl Trait); + | ++++ +help: alternatively, use a trait object to accept any type that implements `Trait`, accessing its methods at runtime using dynamic dispatch + | +LL | fn foo(_: &dyn Trait); + | +++ + +error[E0782]: expected a type, found a trait + --> $DIR/reference-to-bare-trait-in-fn-inputs-and-outputs-issue-125139.rs:55:19 + | +LL | fn bar(_: &'a Trait); + | ^^^^^ + | +help: use a new generic type parameter, constrained by `Trait` + | +LL - fn bar(_: &'a Trait); +LL + fn bar(_: &'a T); + | +help: you can also use an opaque type, but users won't be able to specify the type parameter when calling the `fn`, having to rely exclusively on type inference + | +LL | fn bar(_: &'a impl Trait); + | ++++ +help: alternatively, use a trait object to accept any type that implements `Trait`, accessing its methods at runtime using dynamic dispatch + | +LL | fn bar(_: &'a dyn Trait); + | +++ + +error[E0782]: expected a type, found a trait + --> $DIR/reference-to-bare-trait-in-fn-inputs-and-outputs-issue-125139.rs:59:22 + | +LL | fn alice<'a>(_: &Trait); + | ^^^^^ + | +help: use a new generic type parameter, constrained by `Trait` + | +LL - fn alice<'a>(_: &Trait); +LL + fn alice<'a, T: Trait>(_: &T); + | +help: you can also use an opaque type, but users won't be able to specify the type parameter when calling the `fn`, having to rely exclusively on type inference + | +LL | fn alice<'a>(_: &impl Trait); + | ++++ +help: alternatively, use a trait object to accept any type that implements `Trait`, accessing its methods at runtime using dynamic dispatch + | +LL | fn alice<'a>(_: &dyn Trait); + | +++ + +error[E0782]: expected a type, found a trait + --> $DIR/reference-to-bare-trait-in-fn-inputs-and-outputs-issue-125139.rs:62:23 + | +LL | fn bob<'a>(_: &'a Trait); + | ^^^^^ + | +help: use a new generic type parameter, constrained by `Trait` + | +LL - fn bob<'a>(_: &'a Trait); +LL + fn bob<'a, T: Trait>(_: &'a T); + | +help: you can also use an opaque type, but users won't be able to specify the type parameter when calling the `fn`, having to rely exclusively on type inference + | +LL | fn bob<'a>(_: &'a impl Trait); + | ++++ +help: alternatively, use a trait object to accept any type that implements `Trait`, accessing its methods at runtime using dynamic dispatch + | +LL | fn bob<'a>(_: &'a dyn Trait); + | +++ + +error[E0782]: expected a type, found a trait + --> $DIR/reference-to-bare-trait-in-fn-inputs-and-outputs-issue-125139.rs:65:18 + | +LL | fn cat() -> &Trait; + | ^^^^^ + | +help: use `impl Trait` to return an opaque type, as long as you return a single underlying type + | +LL | fn cat() -> &impl Trait; + | ++++ +help: alternatively, you can return an owned trait object + | +LL - fn cat() -> &Trait; +LL + fn cat() -> Box; + | + +error[E0782]: expected a type, found a trait + --> $DIR/reference-to-bare-trait-in-fn-inputs-and-outputs-issue-125139.rs:69:22 + | +LL | fn dog<'a>() -> &Trait { + | ^^^^^ + | +help: use `impl Trait` to return an opaque type, as long as you return a single underlying type + | +LL | fn dog<'a>() -> &impl Trait { + | ++++ +help: alternatively, you can return an owned trait object + | +LL - fn dog<'a>() -> &Trait { +LL + fn dog<'a>() -> Box { + | + +error[E0782]: expected a type, found a trait + --> $DIR/reference-to-bare-trait-in-fn-inputs-and-outputs-issue-125139.rs:75:24 + | +LL | fn kitten() -> &'a Trait { + | ^^^^^ + | +help: use `impl Trait` to return an opaque type, as long as you return a single underlying type + | +LL | fn kitten() -> &'a impl Trait { + | ++++ +help: alternatively, you can return an owned trait object + | +LL - fn kitten() -> &'a Trait { +LL + fn kitten() -> Box { + | + +error[E0782]: expected a type, found a trait + --> $DIR/reference-to-bare-trait-in-fn-inputs-and-outputs-issue-125139.rs:81:27 + | +LL | fn puppy<'a>() -> &'a Trait { + | ^^^^^ + | +help: use `impl Trait` to return an opaque type, as long as you return a single underlying type + | +LL | fn puppy<'a>() -> &'a impl Trait { + | ++++ +help: alternatively, you can return an owned trait object + | +LL - fn puppy<'a>() -> &'a Trait { +LL + fn puppy<'a>() -> Box { + | + +error[E0782]: expected a type, found a trait + --> $DIR/reference-to-bare-trait-in-fn-inputs-and-outputs-issue-125139.rs:86:25 + | +LL | fn parrot() -> &mut Trait { + | ^^^^^ + | +help: use `impl Trait` to return an opaque type, as long as you return a single underlying type + | +LL | fn parrot() -> &mut impl Trait { + | ++++ +help: alternatively, you can return an owned trait object + | +LL - fn parrot() -> &mut Trait { +LL + fn parrot() -> Box { + | + error: aborting due to 42 previous errors Some errors have detailed explanations: E0106, E0261, E0782. diff --git a/tests/ui/error-codes/E0092.rs b/tests/ui/error-codes/E0092.rs index ddaace98bd4..19a7c65a48e 100644 --- a/tests/ui/error-codes/E0092.rs +++ b/tests/ui/error-codes/E0092.rs @@ -1,7 +1,6 @@ #![feature(intrinsics)] -extern "rust-intrinsic" { - fn atomic_foo(); //~ ERROR E0092 -} -fn main() { -} +#[rustc_intrinsic] +unsafe fn atomic_foo(); //~ ERROR E0092 + +fn main() {} diff --git a/tests/ui/error-codes/E0092.stderr b/tests/ui/error-codes/E0092.stderr index 4ff2e6f077d..003c989fd59 100644 --- a/tests/ui/error-codes/E0092.stderr +++ b/tests/ui/error-codes/E0092.stderr @@ -1,8 +1,8 @@ error[E0092]: unrecognized atomic operation function: `foo` - --> $DIR/E0092.rs:3:5 + --> $DIR/E0092.rs:4:11 | -LL | fn atomic_foo(); - | ^^^^^^^^^^^^^^^^ unrecognized atomic operation +LL | unsafe fn atomic_foo(); + | ^^^^^^^^^^ unrecognized atomic operation error: aborting due to 1 previous error diff --git a/tests/ui/error-codes/E0093.rs b/tests/ui/error-codes/E0093.rs index a2f0b1ae443..24df7a9a32b 100644 --- a/tests/ui/error-codes/E0093.rs +++ b/tests/ui/error-codes/E0093.rs @@ -1,8 +1,7 @@ #![feature(intrinsics)] -extern "rust-intrinsic" { - fn foo(); - //~^ ERROR E0093 -} -fn main() { -} +#[rustc_intrinsic] +unsafe fn foo(); +//~^ ERROR E0093 + +fn main() {} diff --git a/tests/ui/error-codes/E0093.stderr b/tests/ui/error-codes/E0093.stderr index 51c367b343a..d81bf53976a 100644 --- a/tests/ui/error-codes/E0093.stderr +++ b/tests/ui/error-codes/E0093.stderr @@ -1,8 +1,8 @@ error[E0093]: unrecognized intrinsic function: `foo` - --> $DIR/E0093.rs:3:5 + --> $DIR/E0093.rs:4:11 | -LL | fn foo(); - | ^^^^^^^^^ unrecognized intrinsic +LL | unsafe fn foo(); + | ^^^ unrecognized intrinsic | = help: if you're adding an intrinsic, be sure to update `check_intrinsic_type` diff --git a/tests/ui/error-codes/E0622.rs b/tests/ui/error-codes/E0622.rs index 08c6d171296..0c2a4f226d8 100644 --- a/tests/ui/error-codes/E0622.rs +++ b/tests/ui/error-codes/E0622.rs @@ -1,6 +1,14 @@ #![feature(intrinsics)] -extern "rust-intrinsic" { - pub static atomic_singlethreadfence_seqcst : unsafe extern "rust-intrinsic" fn(); + +extern "C" { + + #[rustc_intrinsic] + pub static atomic_singlethreadfence_seqcst: unsafe extern "C" fn(); //~^ ERROR intrinsic must be a function [E0622] } -fn main() { unsafe { atomic_singlethreadfence_seqcst(); } } + +fn main() { + unsafe { + atomic_singlethreadfence_seqcst(); + } +} diff --git a/tests/ui/error-codes/E0622.stderr b/tests/ui/error-codes/E0622.stderr index 739ec984fc6..c0aea542af0 100644 --- a/tests/ui/error-codes/E0622.stderr +++ b/tests/ui/error-codes/E0622.stderr @@ -1,8 +1,8 @@ error[E0622]: intrinsic must be a function - --> $DIR/E0622.rs:3:5 + --> $DIR/E0622.rs:6:5 | -LL | pub static atomic_singlethreadfence_seqcst : unsafe extern "rust-intrinsic" fn(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected a function +LL | pub static atomic_singlethreadfence_seqcst: unsafe extern "C" fn(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected a function error: aborting due to 1 previous error diff --git a/tests/ui/extern/extern-with-type-bounds.rs b/tests/ui/extern/extern-with-type-bounds.rs deleted file mode 100644 index 3fbddfc99a6..00000000000 --- a/tests/ui/extern/extern-with-type-bounds.rs +++ /dev/null @@ -1,21 +0,0 @@ -#![feature(intrinsics, rustc_attrs)] - -// Intrinsics are the only (?) extern blocks supporting generics. -// Once intrinsics have to be declared via `#[rustc_intrinsic]`, -// the entire support for generics in extern fn can probably be removed. - -extern "rust-intrinsic" { - // Silent bounds made explicit to make sure they are actually - // resolved. - fn transmute(val: T) -> U; - - // Bounds aren't checked right now, so this should work - // even though it's incorrect. - fn size_of_val(x: *const T) -> usize; - - // Unresolved bounds should still error. - fn align_of() -> usize; - //~^ ERROR cannot find trait `NoSuchTrait` in this scope -} - -fn main() {} diff --git a/tests/ui/extern/extern-with-type-bounds.stderr b/tests/ui/extern/extern-with-type-bounds.stderr deleted file mode 100644 index 893947e831f..00000000000 --- a/tests/ui/extern/extern-with-type-bounds.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0405]: cannot find trait `NoSuchTrait` in this scope - --> $DIR/extern-with-type-bounds.rs:17:20 - | -LL | fn align_of() -> usize; - | ^^^^^^^^^^^ not found in this scope - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0405`. diff --git a/tests/ui/feature-gates/feature-gate-abi.rs b/tests/ui/feature-gates/feature-gate-abi.rs index 2af623734ee..bafd3643788 100644 --- a/tests/ui/feature-gates/feature-gate-abi.rs +++ b/tests/ui/feature-gates/feature-gate-abi.rs @@ -8,19 +8,10 @@ extern crate minicore; use minicore::*; -// Functions -extern "rust-intrinsic" fn f1() {} //~ ERROR extern "rust-intrinsic" ABI is an implementation detail - //~^ ERROR intrinsic must be in -extern "rust-intrinsic" fn f2() {} //~ ERROR extern "rust-intrinsic" ABI is an implementation detail - //~^ ERROR intrinsic must be in extern "rust-call" fn f4(_: ()) {} //~ ERROR extern "rust-call" ABI is experimental and subject to change // Methods in trait definition trait Tr { - extern "rust-intrinsic" fn m1(); //~ ERROR extern "rust-intrinsic" ABI is an implementation detail - //~^ ERROR intrinsic must be in - extern "rust-intrinsic" fn m2(); //~ ERROR extern "rust-intrinsic" ABI is an implementation detail - //~^ ERROR intrinsic must be in extern "rust-call" fn m4(_: ()); //~ ERROR extern "rust-call" ABI is experimental and subject to change extern "rust-call" fn dm4(_: ()) {} //~ ERROR extern "rust-call" ABI is experimental and subject to change @@ -30,28 +21,16 @@ struct S; // Methods in trait impl impl Tr for S { - extern "rust-intrinsic" fn m1() {} //~ ERROR extern "rust-intrinsic" ABI is an implementation detail - //~^ ERROR intrinsic must be in - extern "rust-intrinsic" fn m2() {} //~ ERROR extern "rust-intrinsic" ABI is an implementation detail - //~^ ERROR intrinsic must be in extern "rust-call" fn m4(_: ()) {} //~ ERROR extern "rust-call" ABI is experimental and subject to change } // Methods in inherent impl impl S { - extern "rust-intrinsic" fn im1() {} //~ ERROR extern "rust-intrinsic" ABI is an implementation detail - //~^ ERROR intrinsic must be in - extern "rust-intrinsic" fn im2() {} //~ ERROR extern "rust-intrinsic" ABI is an implementation detail - //~^ ERROR intrinsic must be in extern "rust-call" fn im4(_: ()) {} //~ ERROR extern "rust-call" ABI is experimental and subject to change } // Function pointer types -type A1 = extern "rust-intrinsic" fn(); //~ ERROR extern "rust-intrinsic" ABI is an implementation detail -type A2 = extern "rust-intrinsic" fn(); //~ ERROR extern "rust-intrinsic" ABI is an implementation detail type A4 = extern "rust-call" fn(_: ()); //~ ERROR extern "rust-call" ABI is experimental and subject to change // Foreign modules -extern "rust-intrinsic" {} //~ ERROR extern "rust-intrinsic" ABI is an implementation detail -extern "rust-intrinsic" {} //~ ERROR extern "rust-intrinsic" ABI is an implementation detail extern "rust-call" {} //~ ERROR extern "rust-call" ABI is experimental and subject to change diff --git a/tests/ui/feature-gates/feature-gate-abi.stderr b/tests/ui/feature-gates/feature-gate-abi.stderr index a974c0099cb..7897a60b34f 100644 --- a/tests/ui/feature-gates/feature-gate-abi.stderr +++ b/tests/ui/feature-gates/feature-gate-abi.stderr @@ -1,23 +1,5 @@ -error[E0658]: the extern "rust-intrinsic" ABI is an implementation detail and perma-unstable - --> $DIR/feature-gate-abi.rs:12:8 - | -LL | extern "rust-intrinsic" fn f1() {} - | ^^^^^^^^^^^^^^^^ - | - = help: add `#![feature(intrinsics)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - -error[E0658]: the extern "rust-intrinsic" ABI is an implementation detail and perma-unstable - --> $DIR/feature-gate-abi.rs:14:8 - | -LL | extern "rust-intrinsic" fn f2() {} - | ^^^^^^^^^^^^^^^^ - | - = help: add `#![feature(intrinsics)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - error[E0658]: the extern "rust-call" ABI is experimental and subject to change - --> $DIR/feature-gate-abi.rs:16:8 + --> $DIR/feature-gate-abi.rs:11:8 | LL | extern "rust-call" fn f4(_: ()) {} | ^^^^^^^^^^^ @@ -26,26 +8,8 @@ LL | extern "rust-call" fn f4(_: ()) {} = help: add `#![feature(unboxed_closures)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: the extern "rust-intrinsic" ABI is an implementation detail and perma-unstable - --> $DIR/feature-gate-abi.rs:20:12 - | -LL | extern "rust-intrinsic" fn m1(); - | ^^^^^^^^^^^^^^^^ - | - = help: add `#![feature(intrinsics)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - -error[E0658]: the extern "rust-intrinsic" ABI is an implementation detail and perma-unstable - --> $DIR/feature-gate-abi.rs:22:12 - | -LL | extern "rust-intrinsic" fn m2(); - | ^^^^^^^^^^^^^^^^ - | - = help: add `#![feature(intrinsics)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - error[E0658]: the extern "rust-call" ABI is experimental and subject to change - --> $DIR/feature-gate-abi.rs:24:12 + --> $DIR/feature-gate-abi.rs:15:12 | LL | extern "rust-call" fn m4(_: ()); | ^^^^^^^^^^^ @@ -55,7 +19,7 @@ LL | extern "rust-call" fn m4(_: ()); = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "rust-call" ABI is experimental and subject to change - --> $DIR/feature-gate-abi.rs:26:12 + --> $DIR/feature-gate-abi.rs:17:12 | LL | extern "rust-call" fn dm4(_: ()) {} | ^^^^^^^^^^^ @@ -64,26 +28,8 @@ LL | extern "rust-call" fn dm4(_: ()) {} = help: add `#![feature(unboxed_closures)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: the extern "rust-intrinsic" ABI is an implementation detail and perma-unstable - --> $DIR/feature-gate-abi.rs:33:12 - | -LL | extern "rust-intrinsic" fn m1() {} - | ^^^^^^^^^^^^^^^^ - | - = help: add `#![feature(intrinsics)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - -error[E0658]: the extern "rust-intrinsic" ABI is an implementation detail and perma-unstable - --> $DIR/feature-gate-abi.rs:35:12 - | -LL | extern "rust-intrinsic" fn m2() {} - | ^^^^^^^^^^^^^^^^ - | - = help: add `#![feature(intrinsics)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - error[E0658]: the extern "rust-call" ABI is experimental and subject to change - --> $DIR/feature-gate-abi.rs:37:12 + --> $DIR/feature-gate-abi.rs:24:12 | LL | extern "rust-call" fn m4(_: ()) {} | ^^^^^^^^^^^ @@ -92,26 +38,8 @@ LL | extern "rust-call" fn m4(_: ()) {} = help: add `#![feature(unboxed_closures)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: the extern "rust-intrinsic" ABI is an implementation detail and perma-unstable - --> $DIR/feature-gate-abi.rs:42:12 - | -LL | extern "rust-intrinsic" fn im1() {} - | ^^^^^^^^^^^^^^^^ - | - = help: add `#![feature(intrinsics)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - -error[E0658]: the extern "rust-intrinsic" ABI is an implementation detail and perma-unstable - --> $DIR/feature-gate-abi.rs:44:12 - | -LL | extern "rust-intrinsic" fn im2() {} - | ^^^^^^^^^^^^^^^^ - | - = help: add `#![feature(intrinsics)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - error[E0658]: the extern "rust-call" ABI is experimental and subject to change - --> $DIR/feature-gate-abi.rs:46:12 + --> $DIR/feature-gate-abi.rs:29:12 | LL | extern "rust-call" fn im4(_: ()) {} | ^^^^^^^^^^^ @@ -120,26 +48,8 @@ LL | extern "rust-call" fn im4(_: ()) {} = help: add `#![feature(unboxed_closures)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: the extern "rust-intrinsic" ABI is an implementation detail and perma-unstable - --> $DIR/feature-gate-abi.rs:50:18 - | -LL | type A1 = extern "rust-intrinsic" fn(); - | ^^^^^^^^^^^^^^^^ - | - = help: add `#![feature(intrinsics)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - -error[E0658]: the extern "rust-intrinsic" ABI is an implementation detail and perma-unstable - --> $DIR/feature-gate-abi.rs:51:18 - | -LL | type A2 = extern "rust-intrinsic" fn(); - | ^^^^^^^^^^^^^^^^ - | - = help: add `#![feature(intrinsics)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - error[E0658]: the extern "rust-call" ABI is experimental and subject to change - --> $DIR/feature-gate-abi.rs:52:18 + --> $DIR/feature-gate-abi.rs:33:18 | LL | type A4 = extern "rust-call" fn(_: ()); | ^^^^^^^^^^^ @@ -148,26 +58,8 @@ LL | type A4 = extern "rust-call" fn(_: ()); = help: add `#![feature(unboxed_closures)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: the extern "rust-intrinsic" ABI is an implementation detail and perma-unstable - --> $DIR/feature-gate-abi.rs:55:8 - | -LL | extern "rust-intrinsic" {} - | ^^^^^^^^^^^^^^^^ - | - = help: add `#![feature(intrinsics)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - -error[E0658]: the extern "rust-intrinsic" ABI is an implementation detail and perma-unstable - --> $DIR/feature-gate-abi.rs:56:8 - | -LL | extern "rust-intrinsic" {} - | ^^^^^^^^^^^^^^^^ - | - = help: add `#![feature(intrinsics)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - error[E0658]: the extern "rust-call" ABI is experimental and subject to change - --> $DIR/feature-gate-abi.rs:57:8 + --> $DIR/feature-gate-abi.rs:36:8 | LL | extern "rust-call" {} | ^^^^^^^^^^^ @@ -176,54 +68,6 @@ LL | extern "rust-call" {} = help: add `#![feature(unboxed_closures)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error: intrinsic must be in `extern "rust-intrinsic" { ... }` block - --> $DIR/feature-gate-abi.rs:20:32 - | -LL | extern "rust-intrinsic" fn m1(); - | ^^ - -error: intrinsic must be in `extern "rust-intrinsic" { ... }` block - --> $DIR/feature-gate-abi.rs:22:32 - | -LL | extern "rust-intrinsic" fn m2(); - | ^^ - -error: intrinsic must be in `extern "rust-intrinsic" { ... }` block - --> $DIR/feature-gate-abi.rs:12:33 - | -LL | extern "rust-intrinsic" fn f1() {} - | ^^ - -error: intrinsic must be in `extern "rust-intrinsic" { ... }` block - --> $DIR/feature-gate-abi.rs:14:33 - | -LL | extern "rust-intrinsic" fn f2() {} - | ^^ - -error: intrinsic must be in `extern "rust-intrinsic" { ... }` block - --> $DIR/feature-gate-abi.rs:33:37 - | -LL | extern "rust-intrinsic" fn m1() {} - | ^^ - -error: intrinsic must be in `extern "rust-intrinsic" { ... }` block - --> $DIR/feature-gate-abi.rs:35:37 - | -LL | extern "rust-intrinsic" fn m2() {} - | ^^ - -error: intrinsic must be in `extern "rust-intrinsic" { ... }` block - --> $DIR/feature-gate-abi.rs:42:38 - | -LL | extern "rust-intrinsic" fn im1() {} - | ^^ - -error: intrinsic must be in `extern "rust-intrinsic" { ... }` block - --> $DIR/feature-gate-abi.rs:44:38 - | -LL | extern "rust-intrinsic" fn im2() {} - | ^^ - -error: aborting due to 27 previous errors +error: aborting due to 7 previous errors For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/feature-gates/feature-gate-intrinsics.rs b/tests/ui/feature-gates/feature-gate-intrinsics.rs index 65806a0223e..b7ebba67272 100644 --- a/tests/ui/feature-gates/feature-gate-intrinsics.rs +++ b/tests/ui/feature-gates/feature-gate-intrinsics.rs @@ -1,8 +1,5 @@ -extern "rust-intrinsic" { //~ ERROR "rust-intrinsic" ABI is an implementation detail - fn bar(); //~ ERROR unrecognized intrinsic function: `bar` -} - -extern "rust-intrinsic" fn baz() {} //~ ERROR "rust-intrinsic" ABI is an implementation detail -//~^ ERROR intrinsic must be in +#[rustc_intrinsic] +//~^ ERROR the `#[rustc_intrinsic]` attribute is used to declare intrinsics as function items +fn bar(); fn main() {} diff --git a/tests/ui/feature-gates/feature-gate-intrinsics.stderr b/tests/ui/feature-gates/feature-gate-intrinsics.stderr index 97246f05258..a7a725883a9 100644 --- a/tests/ui/feature-gates/feature-gate-intrinsics.stderr +++ b/tests/ui/feature-gates/feature-gate-intrinsics.stderr @@ -1,36 +1,12 @@ -error[E0658]: the extern "rust-intrinsic" ABI is an implementation detail and perma-unstable - --> $DIR/feature-gate-intrinsics.rs:1:8 +error[E0658]: the `#[rustc_intrinsic]` attribute is used to declare intrinsics as function items + --> $DIR/feature-gate-intrinsics.rs:1:1 | -LL | extern "rust-intrinsic" { - | ^^^^^^^^^^^^^^^^ +LL | #[rustc_intrinsic] + | ^^^^^^^^^^^^^^^^^^ | = help: add `#![feature(intrinsics)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: the extern "rust-intrinsic" ABI is an implementation detail and perma-unstable - --> $DIR/feature-gate-intrinsics.rs:5:8 - | -LL | extern "rust-intrinsic" fn baz() {} - | ^^^^^^^^^^^^^^^^ - | - = help: add `#![feature(intrinsics)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date +error: aborting due to 1 previous error -error[E0093]: unrecognized intrinsic function: `bar` - --> $DIR/feature-gate-intrinsics.rs:2:5 - | -LL | fn bar(); - | ^^^^^^^^^ unrecognized intrinsic - | - = help: if you're adding an intrinsic, be sure to update `check_intrinsic_type` - -error: intrinsic must be in `extern "rust-intrinsic" { ... }` block - --> $DIR/feature-gate-intrinsics.rs:5:34 - | -LL | extern "rust-intrinsic" fn baz() {} - | ^^ - -error: aborting due to 4 previous errors - -Some errors have detailed explanations: E0093, E0658. -For more information about an error, try `rustc --explain E0093`. +For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/feature-gates/feature-gated-feature-in-macro-arg.rs b/tests/ui/feature-gates/feature-gated-feature-in-macro-arg.rs index 2328798d74c..44c0f1130f0 100644 --- a/tests/ui/feature-gates/feature-gated-feature-in-macro-arg.rs +++ b/tests/ui/feature-gates/feature-gated-feature-in-macro-arg.rs @@ -5,9 +5,9 @@ fn main() { let a = &[1, 2, 3]; println!("{}", { - extern "rust-intrinsic" { //~ ERROR "rust-intrinsic" ABI is an implementation detail - fn atomic_fence(); - } + #[rustc_intrinsic] //~ ERROR the `#[rustc_intrinsic]` attribute is used to declare intrinsics as function items + unsafe fn atomic_fence(); + atomic_fence(); //~ ERROR: is unsafe 42 }); diff --git a/tests/ui/feature-gates/feature-gated-feature-in-macro-arg.stderr b/tests/ui/feature-gates/feature-gated-feature-in-macro-arg.stderr index 86f88fdff5f..aaaaeece67a 100644 --- a/tests/ui/feature-gates/feature-gated-feature-in-macro-arg.stderr +++ b/tests/ui/feature-gates/feature-gated-feature-in-macro-arg.stderr @@ -1,13 +1,13 @@ -error[E0658]: the extern "rust-intrinsic" ABI is an implementation detail and perma-unstable - --> $DIR/feature-gated-feature-in-macro-arg.rs:8:16 +error[E0658]: the `#[rustc_intrinsic]` attribute is used to declare intrinsics as function items + --> $DIR/feature-gated-feature-in-macro-arg.rs:8:9 | -LL | extern "rust-intrinsic" { - | ^^^^^^^^^^^^^^^^ +LL | #[rustc_intrinsic] + | ^^^^^^^^^^^^^^^^^^ | = help: add `#![feature(intrinsics)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0133]: call to unsafe function `main::atomic_fence` is unsafe and requires unsafe function or block +error[E0133]: call to unsafe function `atomic_fence` is unsafe and requires unsafe function or block --> $DIR/feature-gated-feature-in-macro-arg.rs:11:9 | LL | atomic_fence(); diff --git a/tests/ui/intrinsics/always-extern.rs b/tests/ui/intrinsics/always-extern.rs deleted file mode 100644 index 0afd8353455..00000000000 --- a/tests/ui/intrinsics/always-extern.rs +++ /dev/null @@ -1,17 +0,0 @@ -#![feature(intrinsics)] - -trait Foo { - extern "rust-intrinsic" fn foo(&self); //~ ERROR intrinsic must -} - -impl Foo for () { - extern "rust-intrinsic" fn foo(&self) { //~ ERROR intrinsic must - } -} - -extern "rust-intrinsic" fn hello() {//~ ERROR intrinsic must - //~^ ERROR unrecognized intrinsic function: `hello` -} - -fn main() { -} diff --git a/tests/ui/intrinsics/always-extern.stderr b/tests/ui/intrinsics/always-extern.stderr deleted file mode 100644 index 44b889c6faa..00000000000 --- a/tests/ui/intrinsics/always-extern.stderr +++ /dev/null @@ -1,34 +0,0 @@ -error: intrinsic must be in `extern "rust-intrinsic" { ... }` block - --> $DIR/always-extern.rs:4:32 - | -LL | extern "rust-intrinsic" fn foo(&self); - | ^^^ - -error[E0093]: unrecognized intrinsic function: `hello` - --> $DIR/always-extern.rs:12:28 - | -LL | extern "rust-intrinsic" fn hello() { - | ^^^^^ unrecognized intrinsic - | - = help: if you're adding an intrinsic, be sure to update `check_intrinsic_type` - -error: intrinsic must be in `extern "rust-intrinsic" { ... }` block - --> $DIR/always-extern.rs:8:43 - | -LL | extern "rust-intrinsic" fn foo(&self) { - | ___________________________________________^ -LL | | } - | |_____^ - -error: intrinsic must be in `extern "rust-intrinsic" { ... }` block - --> $DIR/always-extern.rs:12:36 - | -LL | extern "rust-intrinsic" fn hello() { - | ____________________________________^ -LL | | -LL | | } - | |_^ - -error: aborting due to 4 previous errors - -For more information about this error, try `rustc --explain E0093`. diff --git a/tests/ui/intrinsics/auxiliary/cci_intrinsic.rs b/tests/ui/intrinsics/auxiliary/cci_intrinsic.rs index f3b9d569ce3..1014ac6f560 100644 --- a/tests/ui/intrinsics/auxiliary/cci_intrinsic.rs +++ b/tests/ui/intrinsics/auxiliary/cci_intrinsic.rs @@ -1,14 +1,11 @@ #![feature(intrinsics)] pub mod rusti { - extern "rust-intrinsic" { - pub fn atomic_xchg_seqcst(dst: *mut T, src: T) -> T; - } + #[rustc_intrinsic] + pub unsafe fn atomic_xchg_seqcst(dst: *mut T, src: T) -> T; } #[inline(always)] pub fn atomic_xchg_seqcst(dst: *mut isize, src: isize) -> isize { - unsafe { - rusti::atomic_xchg_seqcst(dst, src) - } + unsafe { rusti::atomic_xchg_seqcst(dst, src) } } diff --git a/tests/ui/intrinsics/incorrect-read_via_copy-defn.rs b/tests/ui/intrinsics/incorrect-read_via_copy-defn.rs index 5520430e140..e9f9270de87 100644 --- a/tests/ui/intrinsics/incorrect-read_via_copy-defn.rs +++ b/tests/ui/intrinsics/incorrect-read_via_copy-defn.rs @@ -1,7 +1,8 @@ fn main() { read_via_copy(); + //~^ ERROR call to unsafe function `read_via_copy` is unsafe and requires unsafe function or block } -extern "rust-intrinsic" fn read_via_copy() {} -//~^ ERROR "rust-intrinsic" ABI is an implementation detail -//~| ERROR intrinsic must be in `extern "rust-intrinsic" { ... }` block +#[rustc_intrinsic] +//~^ ERROR the `#[rustc_intrinsic]` attribute is used to declare intrinsics as function items +unsafe fn read_via_copy() {} diff --git a/tests/ui/intrinsics/incorrect-read_via_copy-defn.stderr b/tests/ui/intrinsics/incorrect-read_via_copy-defn.stderr index c6682693f74..6711c77a11e 100644 --- a/tests/ui/intrinsics/incorrect-read_via_copy-defn.stderr +++ b/tests/ui/intrinsics/incorrect-read_via_copy-defn.stderr @@ -1,18 +1,21 @@ -error[E0658]: the extern "rust-intrinsic" ABI is an implementation detail and perma-unstable - --> $DIR/incorrect-read_via_copy-defn.rs:5:8 +error[E0658]: the `#[rustc_intrinsic]` attribute is used to declare intrinsics as function items + --> $DIR/incorrect-read_via_copy-defn.rs:6:1 | -LL | extern "rust-intrinsic" fn read_via_copy() {} - | ^^^^^^^^^^^^^^^^ +LL | #[rustc_intrinsic] + | ^^^^^^^^^^^^^^^^^^ | = help: add `#![feature(intrinsics)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error: intrinsic must be in `extern "rust-intrinsic" { ... }` block - --> $DIR/incorrect-read_via_copy-defn.rs:5:44 +error[E0133]: call to unsafe function `read_via_copy` is unsafe and requires unsafe function or block + --> $DIR/incorrect-read_via_copy-defn.rs:2:5 | -LL | extern "rust-intrinsic" fn read_via_copy() {} - | ^^ +LL | read_via_copy(); + | ^^^^^^^^^^^^^^^ call to unsafe function + | + = note: consult the function's documentation for information on how to avoid undefined behavior error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0658`. +Some errors have detailed explanations: E0133, E0658. +For more information about an error, try `rustc --explain E0133`. diff --git a/tests/ui/intrinsics/incorrect-transmute.rs b/tests/ui/intrinsics/incorrect-transmute.rs index 15d1ab939ed..25fbc7a92ee 100644 --- a/tests/ui/intrinsics/incorrect-transmute.rs +++ b/tests/ui/intrinsics/incorrect-transmute.rs @@ -1,7 +1,8 @@ fn main() { transmute(); // does not ICE + //~^ ERROR call to unsafe function `transmute` is unsafe and requires unsafe function or block } -extern "rust-intrinsic" fn transmute() {} -//~^ ERROR "rust-intrinsic" ABI is an implementation detail -//~| ERROR intrinsic must be in `extern "rust-intrinsic" { ... }` block +#[rustc_intrinsic] +//~^ ERROR the `#[rustc_intrinsic]` attribute is used to declare intrinsics as function items +unsafe fn transmute() {} diff --git a/tests/ui/intrinsics/incorrect-transmute.stderr b/tests/ui/intrinsics/incorrect-transmute.stderr index 99dfb9847ff..6145a11c4ae 100644 --- a/tests/ui/intrinsics/incorrect-transmute.stderr +++ b/tests/ui/intrinsics/incorrect-transmute.stderr @@ -1,18 +1,21 @@ -error[E0658]: the extern "rust-intrinsic" ABI is an implementation detail and perma-unstable - --> $DIR/incorrect-transmute.rs:5:8 +error[E0658]: the `#[rustc_intrinsic]` attribute is used to declare intrinsics as function items + --> $DIR/incorrect-transmute.rs:6:1 | -LL | extern "rust-intrinsic" fn transmute() {} - | ^^^^^^^^^^^^^^^^ +LL | #[rustc_intrinsic] + | ^^^^^^^^^^^^^^^^^^ | = help: add `#![feature(intrinsics)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error: intrinsic must be in `extern "rust-intrinsic" { ... }` block - --> $DIR/incorrect-transmute.rs:5:40 +error[E0133]: call to unsafe function `transmute` is unsafe and requires unsafe function or block + --> $DIR/incorrect-transmute.rs:2:5 | -LL | extern "rust-intrinsic" fn transmute() {} - | ^^ +LL | transmute(); // does not ICE + | ^^^^^^^^^^^ call to unsafe function + | + = note: consult the function's documentation for information on how to avoid undefined behavior error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0658`. +Some errors have detailed explanations: E0133, E0658. +For more information about an error, try `rustc --explain E0133`. diff --git a/tests/ui/intrinsics/intrinsic-atomics.rs b/tests/ui/intrinsics/intrinsic-atomics.rs index 4ad267e3ddb..6bc3f8d884d 100644 --- a/tests/ui/intrinsics/intrinsic-atomics.rs +++ b/tests/ui/intrinsics/intrinsic-atomics.rs @@ -2,33 +2,51 @@ #![feature(intrinsics)] mod rusti { - extern "rust-intrinsic" { - pub fn atomic_cxchg_seqcst_seqcst(dst: *mut T, old: T, src: T) -> (T, bool); - pub fn atomic_cxchg_acquire_acquire(dst: *mut T, old: T, src: T) -> (T, bool); - pub fn atomic_cxchg_release_relaxed(dst: *mut T, old: T, src: T) -> (T, bool); - pub fn atomic_cxchgweak_seqcst_seqcst(dst: *mut T, old: T, src: T) -> (T, bool); - pub fn atomic_cxchgweak_acquire_acquire(dst: *mut T, old: T, src: T) -> (T, bool); - pub fn atomic_cxchgweak_release_relaxed(dst: *mut T, old: T, src: T) -> (T, bool); + #[rustc_intrinsic] + pub unsafe fn atomic_cxchg_seqcst_seqcst(dst: *mut T, old: T, src: T) -> (T, bool); + #[rustc_intrinsic] + pub unsafe fn atomic_cxchg_acquire_acquire(dst: *mut T, old: T, src: T) -> (T, bool); + #[rustc_intrinsic] + pub unsafe fn atomic_cxchg_release_relaxed(dst: *mut T, old: T, src: T) -> (T, bool); - pub fn atomic_load_seqcst(src: *const T) -> T; - pub fn atomic_load_acquire(src: *const T) -> T; + #[rustc_intrinsic] + pub unsafe fn atomic_cxchgweak_seqcst_seqcst(dst: *mut T, old: T, src: T) -> (T, bool); + #[rustc_intrinsic] + pub unsafe fn atomic_cxchgweak_acquire_acquire(dst: *mut T, old: T, src: T) -> (T, bool); + #[rustc_intrinsic] + pub unsafe fn atomic_cxchgweak_release_relaxed(dst: *mut T, old: T, src: T) -> (T, bool); - pub fn atomic_store_seqcst(dst: *mut T, val: T); - pub fn atomic_store_release(dst: *mut T, val: T); + #[rustc_intrinsic] + pub unsafe fn atomic_load_seqcst(src: *const T) -> T; + #[rustc_intrinsic] + pub unsafe fn atomic_load_acquire(src: *const T) -> T; - pub fn atomic_xchg_seqcst(dst: *mut T, src: T) -> T; - pub fn atomic_xchg_acquire(dst: *mut T, src: T) -> T; - pub fn atomic_xchg_release(dst: *mut T, src: T) -> T; + #[rustc_intrinsic] + pub unsafe fn atomic_store_seqcst(dst: *mut T, val: T); + #[rustc_intrinsic] + pub unsafe fn atomic_store_release(dst: *mut T, val: T); - pub fn atomic_xadd_seqcst(dst: *mut T, src: T) -> T; - pub fn atomic_xadd_acquire(dst: *mut T, src: T) -> T; - pub fn atomic_xadd_release(dst: *mut T, src: T) -> T; + #[rustc_intrinsic] + pub unsafe fn atomic_xchg_seqcst(dst: *mut T, src: T) -> T; + #[rustc_intrinsic] + pub unsafe fn atomic_xchg_acquire(dst: *mut T, src: T) -> T; + #[rustc_intrinsic] + pub unsafe fn atomic_xchg_release(dst: *mut T, src: T) -> T; - pub fn atomic_xsub_seqcst(dst: *mut T, src: T) -> T; - pub fn atomic_xsub_acquire(dst: *mut T, src: T) -> T; - pub fn atomic_xsub_release(dst: *mut T, src: T) -> T; - } + #[rustc_intrinsic] + pub unsafe fn atomic_xadd_seqcst(dst: *mut T, src: T) -> T; + #[rustc_intrinsic] + pub unsafe fn atomic_xadd_acquire(dst: *mut T, src: T) -> T; + #[rustc_intrinsic] + pub unsafe fn atomic_xadd_release(dst: *mut T, src: T) -> T; + + #[rustc_intrinsic] + pub unsafe fn atomic_xsub_seqcst(dst: *mut T, src: T) -> T; + #[rustc_intrinsic] + pub unsafe fn atomic_xsub_acquire(dst: *mut T, src: T) -> T; + #[rustc_intrinsic] + pub unsafe fn atomic_xsub_release(dst: *mut T, src: T) -> T; } pub fn main() { @@ -39,9 +57,9 @@ pub fn main() { *x = 5; assert_eq!(rusti::atomic_load_acquire(&*x), 5); - rusti::atomic_store_seqcst(&mut *x,3); + rusti::atomic_store_seqcst(&mut *x, 3); assert_eq!(*x, 3); - rusti::atomic_store_release(&mut *x,1); + rusti::atomic_store_release(&mut *x, 1); assert_eq!(*x, 1); assert_eq!(rusti::atomic_cxchg_seqcst_seqcst(&mut *x, 1, 2), (1, true)); diff --git a/tests/ui/intrinsics/invalid-ABI-rust-intrinsic.rs b/tests/ui/intrinsics/invalid-ABI-rust-intrinsic.rs new file mode 100644 index 00000000000..4b777deb8b5 --- /dev/null +++ b/tests/ui/intrinsics/invalid-ABI-rust-intrinsic.rs @@ -0,0 +1,19 @@ +#![feature(intrinsics)] + +trait Foo { + extern "rust-intrinsic" fn foo(&self); //~ ERROR invalid ABI +} + +impl Foo for () { + extern "rust-intrinsic" fn foo(&self) { //~ ERROR invalid ABI + } +} + +extern "rust-intrinsic" fn hello() { //~ ERROR invalid ABI +} + +extern "rust-intrinsic" { + //~^ ERROR invalid ABI +} + +fn main() {} diff --git a/tests/ui/intrinsics/invalid-ABI-rust-intrinsic.stderr b/tests/ui/intrinsics/invalid-ABI-rust-intrinsic.stderr new file mode 100644 index 00000000000..fc8bf62915b --- /dev/null +++ b/tests/ui/intrinsics/invalid-ABI-rust-intrinsic.stderr @@ -0,0 +1,35 @@ +error[E0703]: invalid ABI: found `rust-intrinsic` + --> $DIR/invalid-ABI-rust-intrinsic.rs:4:12 + | +LL | extern "rust-intrinsic" fn foo(&self); + | ^^^^^^^^^^^^^^^^ invalid ABI + | + = note: invoke `rustc --print=calling-conventions` for a full list of supported calling conventions + +error[E0703]: invalid ABI: found `rust-intrinsic` + --> $DIR/invalid-ABI-rust-intrinsic.rs:8:12 + | +LL | extern "rust-intrinsic" fn foo(&self) { + | ^^^^^^^^^^^^^^^^ invalid ABI + | + = note: invoke `rustc --print=calling-conventions` for a full list of supported calling conventions + +error[E0703]: invalid ABI: found `rust-intrinsic` + --> $DIR/invalid-ABI-rust-intrinsic.rs:12:8 + | +LL | extern "rust-intrinsic" fn hello() { + | ^^^^^^^^^^^^^^^^ invalid ABI + | + = note: invoke `rustc --print=calling-conventions` for a full list of supported calling conventions + +error[E0703]: invalid ABI: found `rust-intrinsic` + --> $DIR/invalid-ABI-rust-intrinsic.rs:15:8 + | +LL | extern "rust-intrinsic" { + | ^^^^^^^^^^^^^^^^ invalid ABI + | + = note: invoke `rustc --print=calling-conventions` for a full list of supported calling conventions + +error: aborting due to 4 previous errors + +For more information about this error, try `rustc --explain E0703`. diff --git a/tests/ui/intrinsics/issue-28575.rs b/tests/ui/intrinsics/issue-28575.rs index 141136d25b2..841bc45138a 100644 --- a/tests/ui/intrinsics/issue-28575.rs +++ b/tests/ui/intrinsics/issue-28575.rs @@ -2,6 +2,7 @@ extern "C" { pub static FOO: extern "rust-intrinsic" fn(); + //~^ ERROR invalid ABI } fn main() { diff --git a/tests/ui/intrinsics/issue-28575.stderr b/tests/ui/intrinsics/issue-28575.stderr index 8a7816f231f..09c52aa4c99 100644 --- a/tests/ui/intrinsics/issue-28575.stderr +++ b/tests/ui/intrinsics/issue-28575.stderr @@ -1,11 +1,20 @@ +error[E0703]: invalid ABI: found `rust-intrinsic` + --> $DIR/issue-28575.rs:4:28 + | +LL | pub static FOO: extern "rust-intrinsic" fn(); + | ^^^^^^^^^^^^^^^^ invalid ABI + | + = note: invoke `rustc --print=calling-conventions` for a full list of supported calling conventions + error[E0133]: use of extern static is unsafe and requires unsafe function or block - --> $DIR/issue-28575.rs:8:5 + --> $DIR/issue-28575.rs:9:5 | LL | FOO() | ^^^ use of extern static | = note: extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior -error: aborting due to 1 previous error +error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0133`. +Some errors have detailed explanations: E0133, E0703. +For more information about an error, try `rustc --explain E0133`. diff --git a/tests/ui/intrinsics/safe-intrinsic-mismatch.rs b/tests/ui/intrinsics/safe-intrinsic-mismatch.rs index 915a23b5905..4c301f9dbb0 100644 --- a/tests/ui/intrinsics/safe-intrinsic-mismatch.rs +++ b/tests/ui/intrinsics/safe-intrinsic-mismatch.rs @@ -1,13 +1,14 @@ #![feature(intrinsics)] #![feature(rustc_attrs)] -extern "rust-intrinsic" { - fn size_of() -> usize; //~ ERROR intrinsic safety mismatch - //~^ ERROR intrinsic safety mismatch -} +#[rustc_intrinsic] +unsafe fn size_of() -> usize; +//~^ ERROR intrinsic safety mismatch +//~| ERROR intrinsic has wrong type #[rustc_intrinsic] -const fn assume(_b: bool) {} //~ ERROR intrinsic safety mismatch +const fn assume(_b: bool) {} +//~^ ERROR intrinsic safety mismatch //~| ERROR intrinsic has wrong type #[rustc_intrinsic] diff --git a/tests/ui/intrinsics/safe-intrinsic-mismatch.stderr b/tests/ui/intrinsics/safe-intrinsic-mismatch.stderr index aa4f294232d..04f6daeced2 100644 --- a/tests/ui/intrinsics/safe-intrinsic-mismatch.stderr +++ b/tests/ui/intrinsics/safe-intrinsic-mismatch.stderr @@ -1,16 +1,17 @@ error: intrinsic safety mismatch between list of intrinsics within the compiler and core library intrinsics for intrinsic `size_of` - --> $DIR/safe-intrinsic-mismatch.rs:5:5 + --> $DIR/safe-intrinsic-mismatch.rs:5:1 | -LL | fn size_of() -> usize; - | ^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | unsafe fn size_of() -> usize; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: intrinsic safety mismatch between list of intrinsics within the compiler and core library intrinsics for intrinsic `size_of` - --> $DIR/safe-intrinsic-mismatch.rs:5:5 +error[E0308]: intrinsic has wrong type + --> $DIR/safe-intrinsic-mismatch.rs:5:18 | -LL | fn size_of() -> usize; - | ^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | unsafe fn size_of() -> usize; + | ^^^ expected safe fn, found unsafe fn | - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + = note: expected signature `fn() -> _` + found signature `unsafe fn() -> _` error: intrinsic safety mismatch between list of intrinsics within the compiler and core library intrinsics for intrinsic `assume` --> $DIR/safe-intrinsic-mismatch.rs:10:1 @@ -28,13 +29,13 @@ LL | const fn assume(_b: bool) {} found signature `fn(_)` error: intrinsic safety mismatch between list of intrinsics within the compiler and core library intrinsics for intrinsic `const_deallocate` - --> $DIR/safe-intrinsic-mismatch.rs:14:1 + --> $DIR/safe-intrinsic-mismatch.rs:15:1 | LL | const fn const_deallocate(_ptr: *mut u8, _size: usize, _align: usize) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0308]: intrinsic has wrong type - --> $DIR/safe-intrinsic-mismatch.rs:14:26 + --> $DIR/safe-intrinsic-mismatch.rs:15:26 | LL | const fn const_deallocate(_ptr: *mut u8, _size: usize, _align: usize) {} | ^ expected unsafe fn, found safe fn diff --git a/tests/ui/lint/internal_features.rs b/tests/ui/lint/internal_features.rs index 32ce9540cb3..6456078a5c2 100644 --- a/tests/ui/lint/internal_features.rs +++ b/tests/ui/lint/internal_features.rs @@ -4,8 +4,7 @@ //~^ ERROR: internal //~| ERROR: internal -extern "rust-intrinsic" { - fn copy_nonoverlapping(src: *const T, dst: *mut T, count: usize); -} +#[rustc_intrinsic] +unsafe fn copy_nonoverlapping(src: *const T, dst: *mut T, count: usize); fn main() {} diff --git a/tests/ui/print-calling-conventions.stdout b/tests/ui/print-calling-conventions.stdout index 539b2d5dee4..feee8cc3aa9 100644 --- a/tests/ui/print-calling-conventions.stdout +++ b/tests/ui/print-calling-conventions.stdout @@ -19,7 +19,6 @@ riscv-interrupt-m riscv-interrupt-s rust-call rust-cold -rust-intrinsic stdcall stdcall-unwind system diff --git a/tests/ui/suggestions/dyn-incompatible-trait-should-use-self-2021-without-dyn.stderr b/tests/ui/suggestions/dyn-incompatible-trait-should-use-self-2021-without-dyn.stderr index 7b0fd979991..e189012d15c 100644 --- a/tests/ui/suggestions/dyn-incompatible-trait-should-use-self-2021-without-dyn.stderr +++ b/tests/ui/suggestions/dyn-incompatible-trait-should-use-self-2021-without-dyn.stderr @@ -26,6 +26,20 @@ help: `A` is dyn-incompatible, use `impl A` to return an opaque type, as long as LL | fn f(a: A) -> impl A; | ++++ +error: associated item referring to unboxed trait object for its own trait + --> $DIR/dyn-incompatible-trait-should-use-self-2021-without-dyn.rs:4:13 + | +LL | trait A: Sized { + | - in this trait +LL | fn f(a: A) -> A; + | ^ ^ + | +help: you might have meant to use `Self` to refer to the implementing type + | +LL - fn f(a: A) -> A; +LL + fn f(a: Self) -> Self; + | + error[E0782]: expected a type, found a trait --> $DIR/dyn-incompatible-trait-should-use-self-2021-without-dyn.rs:10:13 | @@ -54,6 +68,20 @@ help: `B` is dyn-incompatible, use `impl B` to return an opaque type, as long as LL | fn f(b: B) -> impl B; | ++++ +error: associated item referring to unboxed trait object for its own trait + --> $DIR/dyn-incompatible-trait-should-use-self-2021-without-dyn.rs:10:13 + | +LL | trait B { + | - in this trait +LL | fn f(b: B) -> B; + | ^ ^ + | +help: you might have meant to use `Self` to refer to the implementing type + | +LL - fn f(b: B) -> B; +LL + fn f(b: Self) -> Self; + | + error[E0782]: expected a type, found a trait --> $DIR/dyn-incompatible-trait-should-use-self-2021-without-dyn.rs:16:20 | @@ -82,34 +110,6 @@ help: `C` is dyn-incompatible, use `impl C` to return an opaque type, as long as LL | fn f(&self, c: C) -> impl C; | ++++ -error: associated item referring to unboxed trait object for its own trait - --> $DIR/dyn-incompatible-trait-should-use-self-2021-without-dyn.rs:4:13 - | -LL | trait A: Sized { - | - in this trait -LL | fn f(a: A) -> A; - | ^ ^ - | -help: you might have meant to use `Self` to refer to the implementing type - | -LL - fn f(a: A) -> A; -LL + fn f(a: Self) -> Self; - | - -error: associated item referring to unboxed trait object for its own trait - --> $DIR/dyn-incompatible-trait-should-use-self-2021-without-dyn.rs:10:13 - | -LL | trait B { - | - in this trait -LL | fn f(b: B) -> B; - | ^ ^ - | -help: you might have meant to use `Self` to refer to the implementing type - | -LL - fn f(b: B) -> B; -LL + fn f(b: Self) -> Self; - | - error: associated item referring to unboxed trait object for its own trait --> $DIR/dyn-incompatible-trait-should-use-self-2021-without-dyn.rs:16:20 | diff --git a/tests/ui/suggestions/issue-116434-2015.stderr b/tests/ui/suggestions/issue-116434-2015.stderr index e7b8cd2f101..07a254432a2 100644 --- a/tests/ui/suggestions/issue-116434-2015.stderr +++ b/tests/ui/suggestions/issue-116434-2015.stderr @@ -12,19 +12,6 @@ help: if this is a dyn-compatible trait, use `dyn` LL | fn foo() -> dyn Clone; | +++ -warning: trait objects without an explicit `dyn` are deprecated - --> $DIR/issue-116434-2015.rs:18:20 - | -LL | fn handle() -> DbHandle; - | ^^^^^^^^ - | - = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! - = note: for more information, see -help: if this is a dyn-compatible trait, use `dyn` - | -LL | fn handle() -> dyn DbHandle; - | +++ - warning: trait objects without an explicit `dyn` are deprecated --> $DIR/issue-116434-2015.rs:3:17 | @@ -53,6 +40,19 @@ help: there is an associated type with the same name LL | fn foo() -> Self::Clone; | ++++++ +warning: trait objects without an explicit `dyn` are deprecated + --> $DIR/issue-116434-2015.rs:18:20 + | +LL | fn handle() -> DbHandle; + | ^^^^^^^^ + | + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! + = note: for more information, see +help: if this is a dyn-compatible trait, use `dyn` + | +LL | fn handle() -> dyn DbHandle; + | +++ + warning: trait objects without an explicit `dyn` are deprecated --> $DIR/issue-116434-2015.rs:18:20 | diff --git a/tests/ui/typeck/typeck_type_placeholder_item.stderr b/tests/ui/typeck/typeck_type_placeholder_item.stderr index 2a4a5a62ab4..7184244f5dc 100644 --- a/tests/ui/typeck/typeck_type_placeholder_item.stderr +++ b/tests/ui/typeck/typeck_type_placeholder_item.stderr @@ -439,6 +439,18 @@ LL | fn fn_test13(x: _) -> (i32, _) { (x, x) } | | not allowed in type signatures | help: replace with the correct return type: `(i32, i32)` +error[E0121]: the placeholder `_` is not allowed within types on item signatures for structs + --> $DIR/typeck_type_placeholder_item.rs:154:21 + | +LL | struct BadStruct<_>(_); + | ^ not allowed in type signatures + | +help: use type parameters instead + | +LL - struct BadStruct<_>(_); +LL + struct BadStruct(T); + | + error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions --> $DIR/typeck_type_placeholder_item.rs:140:31 | @@ -515,18 +527,6 @@ LL - fn assoc_fn_test3() -> _; LL + fn assoc_fn_test3() -> T; | -error[E0121]: the placeholder `_` is not allowed within types on item signatures for structs - --> $DIR/typeck_type_placeholder_item.rs:154:21 - | -LL | struct BadStruct<_>(_); - | ^ not allowed in type signatures - | -help: use type parameters instead - | -LL - struct BadStruct<_>(_); -LL + struct BadStruct(T); - | - error[E0121]: the placeholder `_` is not allowed within types on item signatures for implementations --> $DIR/typeck_type_placeholder_item.rs:159:15 | diff --git a/tests/ui/wf/ice-hir-wf-check-anon-const-issue-122199.stderr b/tests/ui/wf/ice-hir-wf-check-anon-const-issue-122199.stderr index 3b4de0753af..59eef0c6327 100644 --- a/tests/ui/wf/ice-hir-wf-check-anon-const-issue-122199.stderr +++ b/tests/ui/wf/ice-hir-wf-check-anon-const-issue-122199.stderr @@ -53,6 +53,12 @@ LL | trait Trait { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information +error: defaults for const parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions + --> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:6:12 + | +LL | fn fnc(&self) -> Trait { + | ^^^^^^^^^^^^^^^^^^^^ + warning: trait objects without an explicit `dyn` are deprecated --> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:6:44 | @@ -66,12 +72,6 @@ help: if this is a dyn-compatible trait, use `dyn` LL | fn fnc(&self) -> dyn Trait { | +++ -error: defaults for const parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions - --> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:6:12 - | -LL | fn fnc(&self) -> Trait { - | ^^^^^^^^^^^^^^^^^^^^ - warning: trait objects without an explicit `dyn` are deprecated --> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:6:21 |