update/bless tests

This commit is contained in:
Bennet Bleßmann 2025-04-06 15:12:24 +02:00 committed by Bennet Bleßmann
parent 6dfb29624c
commit 7dd57f085c
No known key found for this signature in database
GPG Key ID: 3BE1A1A3CBC3CF99
59 changed files with 545 additions and 737 deletions

View File

@ -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(); } }
```

View File

@ -35,9 +35,8 @@ pub struct m64x2([i64; 2]);
#[repr(simd)]
pub struct m64x4([i64; 4]);
extern "rust-intrinsic" {
fn simd_bitmask<V, B>(mask: V) -> B;
}
#[rustc_intrinsic]
unsafe fn simd_bitmask<V, B>(mask: V) -> B;
// CHECK-LABEL: bitmask_m8x16
#[no_mangle]

View File

@ -22,9 +22,8 @@ pub struct m64x4([i64; 4]);
#[repr(simd)]
pub struct pf64x4([*const f64; 4]);
extern "rust-intrinsic" {
fn simd_gather<V, M, P>(values: V, mask: M, pointer: P) -> V;
}
#[rustc_intrinsic]
unsafe fn simd_gather<V, M, P>(values: V, mask: M, pointer: P) -> V;
// CHECK-LABEL: gather_f64x4
#[no_mangle]

View File

@ -34,9 +34,8 @@ pub struct f64x4([f64; 4]);
#[repr(simd)]
pub struct m64x4([i64; 4]);
extern "rust-intrinsic" {
fn simd_masked_load<M, P, T>(mask: M, pointer: P, values: T) -> T;
}
#[rustc_intrinsic]
unsafe fn simd_masked_load<M, P, T>(mask: M, pointer: P, values: T) -> T;
// CHECK-LABEL: load_i8x16
#[no_mangle]

View File

@ -20,10 +20,10 @@ use minicore::*;
#[repr(simd)]
pub struct mask8x16([i8; 16]);
extern "rust-intrinsic" {
fn simd_reduce_all<T>(x: T) -> bool;
fn simd_reduce_any<T>(x: T) -> bool;
}
#[rustc_intrinsic]
unsafe fn simd_reduce_all<T>(x: T) -> bool;
#[rustc_intrinsic]
unsafe fn simd_reduce_any<T>(x: T) -> bool;
// CHECK-LABEL: mask_reduce_all:
#[no_mangle]

View File

@ -34,9 +34,8 @@ pub struct f64x4([f64; 4]);
#[repr(simd)]
pub struct m64x4([i64; 4]);
extern "rust-intrinsic" {
fn simd_masked_store<M, P, T>(mask: M, pointer: P, values: T);
}
#[rustc_intrinsic]
unsafe fn simd_masked_store<M, P, T>(mask: M, pointer: P, values: T);
// CHECK-LABEL: store_i8x16
#[no_mangle]

View File

@ -22,9 +22,8 @@ pub struct m64x4([i64; 4]);
#[repr(simd)]
pub struct pf64x4([*mut f64; 4]);
extern "rust-intrinsic" {
fn simd_scatter<V, P, M>(values: V, pointer: P, mask: M);
}
#[rustc_intrinsic]
unsafe fn simd_scatter<V, P, M>(values: V, pointer: P, mask: M);
// CHECK-LABEL: scatter_f64x4
#[no_mangle]

View File

@ -48,9 +48,8 @@ pub struct f64x8([f64; 8]);
#[repr(simd)]
pub struct m64x8([i64; 8]);
extern "rust-intrinsic" {
fn simd_select<M, V>(mask: M, a: V, b: V) -> V;
}
#[rustc_intrinsic]
unsafe fn simd_select<M, V>(mask: M, a: V, b: V) -> V;
// CHECK-LABEL: select_i8x16
#[no_mangle]

View File

@ -17,9 +17,8 @@
extern crate minicore;
use minicore::*;
extern "rust-intrinsic" {
pub fn transmute<Src, Dst>(src: Src) -> Dst;
}
#[rustc_intrinsic]
pub unsafe fn transmute<Src, Dst>(src: Src) -> Dst;
pub static mut STORAGE_FOO: fn(&usize, &mut u32) -> Result<(), ()> = arbitrary_black_box;
pub static mut STORAGE_BAR: u32 = 12;

View File

@ -23,13 +23,12 @@ fn size_of<T>() -> 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]

View File

@ -21,14 +21,12 @@ impl<T> Copy for *mut T {}
fn size_of<T>() -> 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]

View File

@ -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() {

View File

@ -18,9 +18,8 @@
extern crate minicore;
use minicore::*;
extern "rust-intrinsic" {
pub fn nontemporal_store<T>(ptr: *mut T, val: T);
}
#[rustc_intrinsic]
pub unsafe fn nontemporal_store<T>(ptr: *mut T, val: T);
#[no_mangle]
pub fn a(a: &mut u32, b: u32) {

View File

@ -153,11 +153,10 @@ pub fn discriminant<T>(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<T>(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<T>(src: *const T, dst: *mut T, count: usize);
// EMIT_MIR lower_intrinsics.f_copy_nonoverlapping.LowerIntrinsics.diff
pub fn f_copy_nonoverlapping() {

View File

@ -2,9 +2,8 @@
#![crate_type = "rlib"]
#![no_core]
extern "rust-intrinsic" {
fn atomic_xadd_seqcst<T>(dst: *mut T, src: T) -> T;
}
#[rustc_intrinsic]
unsafe fn atomic_xadd_seqcst<T>(dst: *mut T, src: T) -> T;
#[lang = "sized"]
trait Sized {}

View File

@ -37,10 +37,9 @@ mod minicore {
#[inline]
#[rustc_diagnostic_item = "ptr_write_volatile"]
pub unsafe fn write_volatile<T>(dst: *mut T, src: T) {
extern "rust-intrinsic" {
#[rustc_nounwind]
pub fn volatile_store<T>(dst: *mut T, val: T);
}
#[rustc_intrinsic]
pub unsafe fn volatile_store<T>(dst: *mut T, val: T);
unsafe { volatile_store(dst, src) };
}
}

View File

@ -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

View File

@ -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`.

View File

@ -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(());
}

View File

@ -10,24 +10,6 @@ LL - fn get<T:Get,U:Get>(x: T, y: U) -> Get::Value {}
LL + fn get<T:Get,U:Get>(x: T, y: U) -> <Example as Get>::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: `<Self as Grab>::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) -> <Example as Get>::Value;
|
error[E0223]: ambiguous associated type
--> $DIR/associated-types-in-ambiguous-context.rs:22:17
|
@ -56,6 +38,24 @@ LL + type X = <IoSlice<'_> 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: `<Self as Grab>::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) -> <Example as Get>::Value;
|
error: aborting due to 5 previous errors
For more information about this error, try `rustc --explain E0223`.

View File

@ -23,12 +23,6 @@ LL | extern "C" fn read_dword(Self::Assoc<'_>) -> u16;
= note: for more information, see issue #41686 <https://github.com/rust-lang/rust/issues/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.

View File

@ -8,12 +8,6 @@ LL | extern "C" fn read_dword(Self::Assoc<'_>) -> u16;
= note: for more information, see issue #41686 <https://github.com/rust-lang/rust/issues/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
|

View File

@ -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;

View File

@ -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`.

View File

@ -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: 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 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<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 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<dyn Trait>;
|
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<dyn Trait> {
|
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<dyn Trait> {
|
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<dyn Trait> {
|
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<dyn Trait> {
|
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<dyn 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: 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 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<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 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<dyn Trait>;
|
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<dyn Trait> {
|
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<dyn Trait> {
|
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<dyn Trait> {
|
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<dyn Trait> {
|
error: aborting due to 42 previous errors
Some errors have detailed explanations: E0106, E0261, E0782.

View File

@ -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() {}

View File

@ -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

View File

@ -1,8 +1,7 @@
#![feature(intrinsics)]
extern "rust-intrinsic" {
fn foo();
//~^ ERROR E0093
}
fn main() {
}
#[rustc_intrinsic]
unsafe fn foo();
//~^ ERROR E0093
fn main() {}

View File

@ -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`

View File

@ -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();
}
}

View File

@ -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

View File

@ -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<T: Sized, U: Sized>(val: T) -> U;
// Bounds aren't checked right now, so this should work
// even though it's incorrect.
fn size_of_val<T: Clone>(x: *const T) -> usize;
// Unresolved bounds should still error.
fn align_of<T: NoSuchTrait>() -> usize;
//~^ ERROR cannot find trait `NoSuchTrait` in this scope
}
fn main() {}

View File

@ -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<T: NoSuchTrait>() -> usize;
| ^^^^^^^^^^^ not found in this scope
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0405`.

View File

@ -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

View File

@ -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`.

View File

@ -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() {}

View File

@ -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`.

View File

@ -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
});

View File

@ -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();

View File

@ -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() {
}

View File

@ -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`.

View File

@ -1,14 +1,11 @@
#![feature(intrinsics)]
pub mod rusti {
extern "rust-intrinsic" {
pub fn atomic_xchg_seqcst<T>(dst: *mut T, src: T) -> T;
}
#[rustc_intrinsic]
pub unsafe fn atomic_xchg_seqcst<T>(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) }
}

View File

@ -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() {}

View File

@ -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`.

View File

@ -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() {}

View File

@ -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`.

View File

@ -2,33 +2,51 @@
#![feature(intrinsics)]
mod rusti {
extern "rust-intrinsic" {
pub fn atomic_cxchg_seqcst_seqcst<T>(dst: *mut T, old: T, src: T) -> (T, bool);
pub fn atomic_cxchg_acquire_acquire<T>(dst: *mut T, old: T, src: T) -> (T, bool);
pub fn atomic_cxchg_release_relaxed<T>(dst: *mut T, old: T, src: T) -> (T, bool);
pub fn atomic_cxchgweak_seqcst_seqcst<T>(dst: *mut T, old: T, src: T) -> (T, bool);
pub fn atomic_cxchgweak_acquire_acquire<T>(dst: *mut T, old: T, src: T) -> (T, bool);
pub fn atomic_cxchgweak_release_relaxed<T>(dst: *mut T, old: T, src: T) -> (T, bool);
#[rustc_intrinsic]
pub unsafe fn atomic_cxchg_seqcst_seqcst<T>(dst: *mut T, old: T, src: T) -> (T, bool);
#[rustc_intrinsic]
pub unsafe fn atomic_cxchg_acquire_acquire<T>(dst: *mut T, old: T, src: T) -> (T, bool);
#[rustc_intrinsic]
pub unsafe fn atomic_cxchg_release_relaxed<T>(dst: *mut T, old: T, src: T) -> (T, bool);
pub fn atomic_load_seqcst<T>(src: *const T) -> T;
pub fn atomic_load_acquire<T>(src: *const T) -> T;
#[rustc_intrinsic]
pub unsafe fn atomic_cxchgweak_seqcst_seqcst<T>(dst: *mut T, old: T, src: T) -> (T, bool);
#[rustc_intrinsic]
pub unsafe fn atomic_cxchgweak_acquire_acquire<T>(dst: *mut T, old: T, src: T) -> (T, bool);
#[rustc_intrinsic]
pub unsafe fn atomic_cxchgweak_release_relaxed<T>(dst: *mut T, old: T, src: T) -> (T, bool);
pub fn atomic_store_seqcst<T>(dst: *mut T, val: T);
pub fn atomic_store_release<T>(dst: *mut T, val: T);
#[rustc_intrinsic]
pub unsafe fn atomic_load_seqcst<T>(src: *const T) -> T;
#[rustc_intrinsic]
pub unsafe fn atomic_load_acquire<T>(src: *const T) -> T;
pub fn atomic_xchg_seqcst<T>(dst: *mut T, src: T) -> T;
pub fn atomic_xchg_acquire<T>(dst: *mut T, src: T) -> T;
pub fn atomic_xchg_release<T>(dst: *mut T, src: T) -> T;
#[rustc_intrinsic]
pub unsafe fn atomic_store_seqcst<T>(dst: *mut T, val: T);
#[rustc_intrinsic]
pub unsafe fn atomic_store_release<T>(dst: *mut T, val: T);
pub fn atomic_xadd_seqcst<T>(dst: *mut T, src: T) -> T;
pub fn atomic_xadd_acquire<T>(dst: *mut T, src: T) -> T;
pub fn atomic_xadd_release<T>(dst: *mut T, src: T) -> T;
#[rustc_intrinsic]
pub unsafe fn atomic_xchg_seqcst<T>(dst: *mut T, src: T) -> T;
#[rustc_intrinsic]
pub unsafe fn atomic_xchg_acquire<T>(dst: *mut T, src: T) -> T;
#[rustc_intrinsic]
pub unsafe fn atomic_xchg_release<T>(dst: *mut T, src: T) -> T;
pub fn atomic_xsub_seqcst<T>(dst: *mut T, src: T) -> T;
pub fn atomic_xsub_acquire<T>(dst: *mut T, src: T) -> T;
pub fn atomic_xsub_release<T>(dst: *mut T, src: T) -> T;
}
#[rustc_intrinsic]
pub unsafe fn atomic_xadd_seqcst<T>(dst: *mut T, src: T) -> T;
#[rustc_intrinsic]
pub unsafe fn atomic_xadd_acquire<T>(dst: *mut T, src: T) -> T;
#[rustc_intrinsic]
pub unsafe fn atomic_xadd_release<T>(dst: *mut T, src: T) -> T;
#[rustc_intrinsic]
pub unsafe fn atomic_xsub_seqcst<T>(dst: *mut T, src: T) -> T;
#[rustc_intrinsic]
pub unsafe fn atomic_xsub_acquire<T>(dst: *mut T, src: T) -> T;
#[rustc_intrinsic]
pub unsafe fn atomic_xsub_release<T>(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));

View File

@ -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() {}

View File

@ -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`.

View File

@ -2,6 +2,7 @@
extern "C" {
pub static FOO: extern "rust-intrinsic" fn();
//~^ ERROR invalid ABI
}
fn main() {

View File

@ -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`.

View File

@ -1,13 +1,14 @@
#![feature(intrinsics)]
#![feature(rustc_attrs)]
extern "rust-intrinsic" {
fn size_of<T>() -> usize; //~ ERROR intrinsic safety mismatch
//~^ ERROR intrinsic safety mismatch
}
#[rustc_intrinsic]
unsafe fn size_of<T>() -> 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]

View File

@ -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<T>() -> usize;
| ^^^^^^^^^^^^^^^^^^^^^^^^^
LL | unsafe fn size_of<T>() -> 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<T>() -> usize;
| ^^^^^^^^^^^^^^^^^^^^^^^^^
LL | unsafe fn size_of<T>() -> 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

View File

@ -4,8 +4,7 @@
//~^ ERROR: internal
//~| ERROR: internal
extern "rust-intrinsic" {
fn copy_nonoverlapping<T>(src: *const T, dst: *mut T, count: usize);
}
#[rustc_intrinsic]
unsafe fn copy_nonoverlapping<T>(src: *const T, dst: *mut T, count: usize);
fn main() {}

View File

@ -19,7 +19,6 @@ riscv-interrupt-m
riscv-interrupt-s
rust-call
rust-cold
rust-intrinsic
stdcall
stdcall-unwind
system

View File

@ -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
|

View File

@ -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 <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
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 <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
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
|

View File

@ -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>(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>() -> 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>(T);
|
error[E0121]: the placeholder `_` is not allowed within types on item signatures for implementations
--> $DIR/typeck_type_placeholder_item.rs:159:15
|

View File

@ -53,6 +53,12 @@ LL | trait Trait<const N: Trait = bar> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
error: defaults for const parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions
--> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:6:12
|
LL | fn fnc<const N: Trait = u32>(&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<const N: Trait = u32>(&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<const N: Trait = u32>(&self) -> Trait {
| ^^^^^^^^^^^^^^^^^^^^
warning: trait objects without an explicit `dyn` are deprecated
--> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:6:21
|