Ban non-extern rust intrinsics

Intrinsics can only be defined by the compiler.
This commit is contained in:
Mark Rousskov 2019-09-12 10:46:49 -04:00
parent 457666860c
commit 7b3adc289e
9 changed files with 186 additions and 97 deletions

View file

@ -1088,6 +1088,8 @@ fn check_fn<'a, 'tcx>(
let span = body.value.span;
fn_maybe_err(fcx.tcx, span, fn_sig.abi);
if body.generator_kind.is_some() && can_be_generator.is_some() {
let yield_ty = fcx.next_ty_var(TypeVariableOrigin {
kind: TypeVariableOriginKind::TypeInference,
@ -1439,6 +1441,14 @@ fn check_opaque_for_cycles<'tcx>(
}
}
// Forbid defining intrinsics in Rust code,
// as they must always be defined by the compiler.
fn fn_maybe_err(tcx: TyCtxt<'_>, sp: Span, abi: Abi) {
if let Abi::RustIntrinsic | Abi::PlatformIntrinsic = abi {
tcx.sess.span_err(sp, "intrinsic must be in `extern \"rust-intrinsic\" { ... }` block");
}
}
pub fn check_item_type<'tcx>(tcx: TyCtxt<'tcx>, it: &'tcx hir::Item) {
debug!(
"check_item_type(it.hir_id={}, it.name={})",
@ -1475,9 +1485,17 @@ pub fn check_item_type<'tcx>(tcx: TyCtxt<'tcx>, it: &'tcx hir::Item) {
check_on_unimplemented(tcx, trait_def_id, it);
}
}
hir::ItemKind::Trait(..) => {
hir::ItemKind::Trait(_, _, _, _, ref items) => {
let def_id = tcx.hir().local_def_id(it.hir_id);
check_on_unimplemented(tcx, def_id, it);
for item in items.iter() {
let item = tcx.hir().trait_item(item.id);
if let hir::TraitItemKind::Method(sig, _) = &item.node {
let abi = sig.header.abi;
fn_maybe_err(tcx, item.ident.span, abi);
}
}
}
hir::ItemKind::Struct(..) => {
check_struct(tcx, it.hir_id, it.span);

View file

@ -11,7 +11,6 @@
#![allow(warnings)]
#![feature(intrinsics)]
#![feature(linkage)]
#![feature(rustc_attrs)]
#![crate_type = "rlib"]
@ -99,17 +98,6 @@ pub fn make_extern() {}
pub extern "C" fn make_extern() {}
// Extern C Extern Rust-Intrinsic ----------------------------------------------
#[cfg(cfail1)]
pub extern "C" fn make_intrinsic() {}
#[cfg(not(cfail1))]
#[rustc_clean(cfg = "cfail2", except = "Hir, HirBody, typeck_tables_of, fn_sig")]
#[rustc_clean(cfg = "cfail3")]
pub extern "rust-intrinsic" fn make_intrinsic() {}
// Type Parameter --------------------------------------------------------------
#[cfg(cfail1)]

View file

@ -18,7 +18,6 @@
#![feature(rustc_attrs)]
#![crate_type="rlib"]
#![feature(associated_type_defaults)]
#![feature(intrinsics)]
// Change trait visibility
@ -318,7 +317,7 @@ trait TraitAddExternModifier {
// Change extern "C" to extern "rust-intrinsic"
// Change extern "C" to extern "stdcall"
#[cfg(cfail1)]
trait TraitChangeExternCToRustIntrinsic {
extern "C" fn method();
@ -330,7 +329,7 @@ trait TraitChangeExternCToRustIntrinsic {
trait TraitChangeExternCToRustIntrinsic {
#[rustc_dirty(label="Hir", cfg="cfail2")]
#[rustc_clean(label="Hir", cfg="cfail3")]
extern "rust-intrinsic" fn method();
extern "stdcall" fn method();
}

View file

@ -10,7 +10,9 @@
// Functions
extern "rust-intrinsic" fn f1() {} //~ ERROR intrinsics are subject to change
//~^ ERROR intrinsic must be in
extern "platform-intrinsic" fn f2() {} //~ ERROR platform intrinsics are experimental
//~^ ERROR intrinsic must be in
extern "vectorcall" fn f3() {} //~ ERROR vectorcall is experimental and subject to change
extern "rust-call" fn f4() {} //~ ERROR rust-call ABI is subject to change
extern "msp430-interrupt" fn f5() {} //~ ERROR msp430-interrupt ABI is experimental
@ -22,7 +24,9 @@ extern "amdgpu-kernel" fn f9() {} //~ ERROR amdgpu-kernel ABI is experimental an
// Methods in trait definition
trait Tr {
extern "rust-intrinsic" fn m1(); //~ ERROR intrinsics are subject to change
//~^ ERROR intrinsic must be in
extern "platform-intrinsic" fn m2(); //~ ERROR platform intrinsics are experimental
//~^ ERROR intrinsic must be in
extern "vectorcall" fn m3(); //~ ERROR vectorcall is experimental and subject to change
extern "rust-call" fn m4(); //~ ERROR rust-call ABI is subject to change
extern "msp430-interrupt" fn m5(); //~ ERROR msp430-interrupt ABI is experimental
@ -31,8 +35,6 @@ trait Tr {
extern "thiscall" fn m8(); //~ ERROR thiscall is experimental and subject to change
extern "amdgpu-kernel" fn m9(); //~ ERROR amdgpu-kernel ABI is experimental and subject to change
extern "rust-intrinsic" fn dm1() {} //~ ERROR intrinsics are subject to change
extern "platform-intrinsic" fn dm2() {} //~ ERROR platform intrinsics are experimental
extern "vectorcall" fn dm3() {} //~ ERROR vectorcall is experimental and subject to change
extern "rust-call" fn dm4() {} //~ ERROR rust-call ABI is subject to change
extern "msp430-interrupt" fn dm5() {} //~ ERROR msp430-interrupt ABI is experimental
@ -47,7 +49,9 @@ struct S;
// Methods in trait impl
impl Tr for S {
extern "rust-intrinsic" fn m1() {} //~ ERROR intrinsics are subject to change
//~^ ERROR intrinsic must be in
extern "platform-intrinsic" fn m2() {} //~ ERROR platform intrinsics are experimental
//~^ ERROR intrinsic must be in
extern "vectorcall" fn m3() {} //~ ERROR vectorcall is experimental and subject to change
extern "rust-call" fn m4() {} //~ ERROR rust-call ABI is subject to change
extern "msp430-interrupt" fn m5() {} //~ ERROR msp430-interrupt ABI is experimental
@ -60,7 +64,9 @@ impl Tr for S {
// Methods in inherent impl
impl S {
extern "rust-intrinsic" fn im1() {} //~ ERROR intrinsics are subject to change
//~^ ERROR intrinsic must be in
extern "platform-intrinsic" fn im2() {} //~ ERROR platform intrinsics are experimental
//~^ ERROR intrinsic must be in
extern "vectorcall" fn im3() {} //~ ERROR vectorcall is experimental and subject to change
extern "rust-call" fn im4() {} //~ ERROR rust-call ABI is subject to change
extern "msp430-interrupt" fn im5() {} //~ ERROR msp430-interrupt ABI is experimental

View file

@ -7,7 +7,7 @@ LL | extern "rust-intrinsic" fn f1() {}
= help: add `#![feature(intrinsics)]` to the crate attributes to enable
error[E0658]: platform intrinsics are experimental and possibly buggy
--> $DIR/feature-gate-abi.rs:13:1
--> $DIR/feature-gate-abi.rs:14:1
|
LL | extern "platform-intrinsic" fn f2() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -16,7 +16,7 @@ LL | extern "platform-intrinsic" fn f2() {}
= help: add `#![feature(platform_intrinsics)]` to the crate attributes to enable
error[E0658]: vectorcall is experimental and subject to change
--> $DIR/feature-gate-abi.rs:14:1
--> $DIR/feature-gate-abi.rs:16:1
|
LL | extern "vectorcall" fn f3() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -24,7 +24,7 @@ LL | extern "vectorcall" fn f3() {}
= help: add `#![feature(abi_vectorcall)]` to the crate attributes to enable
error[E0658]: rust-call ABI is subject to change
--> $DIR/feature-gate-abi.rs:15:1
--> $DIR/feature-gate-abi.rs:17:1
|
LL | extern "rust-call" fn f4() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -33,7 +33,7 @@ LL | extern "rust-call" fn f4() {}
= help: add `#![feature(unboxed_closures)]` to the crate attributes to enable
error[E0658]: msp430-interrupt ABI is experimental and subject to change
--> $DIR/feature-gate-abi.rs:16:1
--> $DIR/feature-gate-abi.rs:18:1
|
LL | extern "msp430-interrupt" fn f5() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -42,7 +42,7 @@ LL | extern "msp430-interrupt" fn f5() {}
= help: add `#![feature(abi_msp430_interrupt)]` to the crate attributes to enable
error[E0658]: PTX ABIs are experimental and subject to change
--> $DIR/feature-gate-abi.rs:17:1
--> $DIR/feature-gate-abi.rs:19:1
|
LL | extern "ptx-kernel" fn f6() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -51,7 +51,7 @@ LL | extern "ptx-kernel" fn f6() {}
= help: add `#![feature(abi_ptx)]` to the crate attributes to enable
error[E0658]: x86-interrupt ABI is experimental and subject to change
--> $DIR/feature-gate-abi.rs:18:1
--> $DIR/feature-gate-abi.rs:20:1
|
LL | extern "x86-interrupt" fn f7() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -60,7 +60,7 @@ LL | extern "x86-interrupt" fn f7() {}
= help: add `#![feature(abi_x86_interrupt)]` to the crate attributes to enable
error[E0658]: thiscall is experimental and subject to change
--> $DIR/feature-gate-abi.rs:19:1
--> $DIR/feature-gate-abi.rs:21:1
|
LL | extern "thiscall" fn f8() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -68,7 +68,7 @@ LL | extern "thiscall" fn f8() {}
= help: add `#![feature(abi_thiscall)]` to the crate attributes to enable
error[E0658]: amdgpu-kernel ABI is experimental and subject to change
--> $DIR/feature-gate-abi.rs:20:1
--> $DIR/feature-gate-abi.rs:22:1
|
LL | extern "amdgpu-kernel" fn f9() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -77,7 +77,7 @@ LL | extern "amdgpu-kernel" fn f9() {}
= help: add `#![feature(abi_amdgpu_kernel)]` to the crate attributes to enable
error[E0658]: intrinsics are subject to change
--> $DIR/feature-gate-abi.rs:24:5
--> $DIR/feature-gate-abi.rs:26:5
|
LL | extern "rust-intrinsic" fn m1();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -85,7 +85,7 @@ LL | extern "rust-intrinsic" fn m1();
= help: add `#![feature(intrinsics)]` to the crate attributes to enable
error[E0658]: platform intrinsics are experimental and possibly buggy
--> $DIR/feature-gate-abi.rs:25:5
--> $DIR/feature-gate-abi.rs:28:5
|
LL | extern "platform-intrinsic" fn m2();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -94,7 +94,7 @@ LL | extern "platform-intrinsic" fn m2();
= help: add `#![feature(platform_intrinsics)]` to the crate attributes to enable
error[E0658]: vectorcall is experimental and subject to change
--> $DIR/feature-gate-abi.rs:26:5
--> $DIR/feature-gate-abi.rs:30:5
|
LL | extern "vectorcall" fn m3();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -102,7 +102,7 @@ LL | extern "vectorcall" fn m3();
= help: add `#![feature(abi_vectorcall)]` to the crate attributes to enable
error[E0658]: rust-call ABI is subject to change
--> $DIR/feature-gate-abi.rs:27:5
--> $DIR/feature-gate-abi.rs:31:5
|
LL | extern "rust-call" fn m4();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -111,7 +111,7 @@ LL | extern "rust-call" fn m4();
= help: add `#![feature(unboxed_closures)]` to the crate attributes to enable
error[E0658]: msp430-interrupt ABI is experimental and subject to change
--> $DIR/feature-gate-abi.rs:28:5
--> $DIR/feature-gate-abi.rs:32:5
|
LL | extern "msp430-interrupt" fn m5();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -120,7 +120,7 @@ LL | extern "msp430-interrupt" fn m5();
= help: add `#![feature(abi_msp430_interrupt)]` to the crate attributes to enable
error[E0658]: PTX ABIs are experimental and subject to change
--> $DIR/feature-gate-abi.rs:29:5
--> $DIR/feature-gate-abi.rs:33:5
|
LL | extern "ptx-kernel" fn m6();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -129,7 +129,7 @@ LL | extern "ptx-kernel" fn m6();
= help: add `#![feature(abi_ptx)]` to the crate attributes to enable
error[E0658]: x86-interrupt ABI is experimental and subject to change
--> $DIR/feature-gate-abi.rs:30:5
--> $DIR/feature-gate-abi.rs:34:5
|
LL | extern "x86-interrupt" fn m7();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -138,7 +138,7 @@ LL | extern "x86-interrupt" fn m7();
= help: add `#![feature(abi_x86_interrupt)]` to the crate attributes to enable
error[E0658]: thiscall is experimental and subject to change
--> $DIR/feature-gate-abi.rs:31:5
--> $DIR/feature-gate-abi.rs:35:5
|
LL | extern "thiscall" fn m8();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -146,7 +146,7 @@ LL | extern "thiscall" fn m8();
= help: add `#![feature(abi_thiscall)]` to the crate attributes to enable
error[E0658]: amdgpu-kernel ABI is experimental and subject to change
--> $DIR/feature-gate-abi.rs:32:5
--> $DIR/feature-gate-abi.rs:36:5
|
LL | extern "amdgpu-kernel" fn m9();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -154,25 +154,8 @@ LL | extern "amdgpu-kernel" fn m9();
= note: for more information, see https://github.com/rust-lang/rust/issues/51575
= help: add `#![feature(abi_amdgpu_kernel)]` to the crate attributes to enable
error[E0658]: intrinsics are subject to change
--> $DIR/feature-gate-abi.rs:34:5
|
LL | extern "rust-intrinsic" fn dm1() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: add `#![feature(intrinsics)]` to the crate attributes to enable
error[E0658]: platform intrinsics are experimental and possibly buggy
--> $DIR/feature-gate-abi.rs:35:5
|
LL | extern "platform-intrinsic" fn dm2() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: for more information, see https://github.com/rust-lang/rust/issues/27731
= help: add `#![feature(platform_intrinsics)]` to the crate attributes to enable
error[E0658]: vectorcall is experimental and subject to change
--> $DIR/feature-gate-abi.rs:36:5
--> $DIR/feature-gate-abi.rs:38:5
|
LL | extern "vectorcall" fn dm3() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -180,7 +163,7 @@ LL | extern "vectorcall" fn dm3() {}
= help: add `#![feature(abi_vectorcall)]` to the crate attributes to enable
error[E0658]: rust-call ABI is subject to change
--> $DIR/feature-gate-abi.rs:37:5
--> $DIR/feature-gate-abi.rs:39:5
|
LL | extern "rust-call" fn dm4() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -189,7 +172,7 @@ LL | extern "rust-call" fn dm4() {}
= help: add `#![feature(unboxed_closures)]` to the crate attributes to enable
error[E0658]: msp430-interrupt ABI is experimental and subject to change
--> $DIR/feature-gate-abi.rs:38:5
--> $DIR/feature-gate-abi.rs:40:5
|
LL | extern "msp430-interrupt" fn dm5() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -198,7 +181,7 @@ LL | extern "msp430-interrupt" fn dm5() {}
= help: add `#![feature(abi_msp430_interrupt)]` to the crate attributes to enable
error[E0658]: PTX ABIs are experimental and subject to change
--> $DIR/feature-gate-abi.rs:39:5
--> $DIR/feature-gate-abi.rs:41:5
|
LL | extern "ptx-kernel" fn dm6() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -207,7 +190,7 @@ LL | extern "ptx-kernel" fn dm6() {}
= help: add `#![feature(abi_ptx)]` to the crate attributes to enable
error[E0658]: x86-interrupt ABI is experimental and subject to change
--> $DIR/feature-gate-abi.rs:40:5
--> $DIR/feature-gate-abi.rs:42:5
|
LL | extern "x86-interrupt" fn dm7() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -216,7 +199,7 @@ LL | extern "x86-interrupt" fn dm7() {}
= help: add `#![feature(abi_x86_interrupt)]` to the crate attributes to enable
error[E0658]: thiscall is experimental and subject to change
--> $DIR/feature-gate-abi.rs:41:5
--> $DIR/feature-gate-abi.rs:43:5
|
LL | extern "thiscall" fn dm8() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -224,7 +207,7 @@ LL | extern "thiscall" fn dm8() {}
= help: add `#![feature(abi_thiscall)]` to the crate attributes to enable
error[E0658]: amdgpu-kernel ABI is experimental and subject to change
--> $DIR/feature-gate-abi.rs:42:5
--> $DIR/feature-gate-abi.rs:44:5
|
LL | extern "amdgpu-kernel" fn dm9() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -233,7 +216,7 @@ LL | extern "amdgpu-kernel" fn dm9() {}
= help: add `#![feature(abi_amdgpu_kernel)]` to the crate attributes to enable
error[E0658]: intrinsics are subject to change
--> $DIR/feature-gate-abi.rs:49:5
--> $DIR/feature-gate-abi.rs:51:5
|
LL | extern "rust-intrinsic" fn m1() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -241,7 +224,7 @@ LL | extern "rust-intrinsic" fn m1() {}
= help: add `#![feature(intrinsics)]` to the crate attributes to enable
error[E0658]: platform intrinsics are experimental and possibly buggy
--> $DIR/feature-gate-abi.rs:50:5
--> $DIR/feature-gate-abi.rs:53:5
|
LL | extern "platform-intrinsic" fn m2() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -250,7 +233,7 @@ LL | extern "platform-intrinsic" fn m2() {}
= help: add `#![feature(platform_intrinsics)]` to the crate attributes to enable
error[E0658]: vectorcall is experimental and subject to change
--> $DIR/feature-gate-abi.rs:51:5
--> $DIR/feature-gate-abi.rs:55:5
|
LL | extern "vectorcall" fn m3() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -258,7 +241,7 @@ LL | extern "vectorcall" fn m3() {}
= help: add `#![feature(abi_vectorcall)]` to the crate attributes to enable
error[E0658]: rust-call ABI is subject to change
--> $DIR/feature-gate-abi.rs:52:5
--> $DIR/feature-gate-abi.rs:56:5
|
LL | extern "rust-call" fn m4() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -267,7 +250,7 @@ LL | extern "rust-call" fn m4() {}
= help: add `#![feature(unboxed_closures)]` to the crate attributes to enable
error[E0658]: msp430-interrupt ABI is experimental and subject to change
--> $DIR/feature-gate-abi.rs:53:5
--> $DIR/feature-gate-abi.rs:57:5
|
LL | extern "msp430-interrupt" fn m5() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -276,7 +259,7 @@ LL | extern "msp430-interrupt" fn m5() {}
= help: add `#![feature(abi_msp430_interrupt)]` to the crate attributes to enable
error[E0658]: PTX ABIs are experimental and subject to change
--> $DIR/feature-gate-abi.rs:54:5
--> $DIR/feature-gate-abi.rs:58:5
|
LL | extern "ptx-kernel" fn m6() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -285,7 +268,7 @@ LL | extern "ptx-kernel" fn m6() {}
= help: add `#![feature(abi_ptx)]` to the crate attributes to enable
error[E0658]: x86-interrupt ABI is experimental and subject to change
--> $DIR/feature-gate-abi.rs:55:5
--> $DIR/feature-gate-abi.rs:59:5
|
LL | extern "x86-interrupt" fn m7() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -294,7 +277,7 @@ LL | extern "x86-interrupt" fn m7() {}
= help: add `#![feature(abi_x86_interrupt)]` to the crate attributes to enable
error[E0658]: thiscall is experimental and subject to change
--> $DIR/feature-gate-abi.rs:56:5
--> $DIR/feature-gate-abi.rs:60:5
|
LL | extern "thiscall" fn m8() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -302,7 +285,7 @@ LL | extern "thiscall" fn m8() {}
= help: add `#![feature(abi_thiscall)]` to the crate attributes to enable
error[E0658]: amdgpu-kernel ABI is experimental and subject to change
--> $DIR/feature-gate-abi.rs:57:5
--> $DIR/feature-gate-abi.rs:61:5
|
LL | extern "amdgpu-kernel" fn m9() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -311,7 +294,7 @@ LL | extern "amdgpu-kernel" fn m9() {}
= help: add `#![feature(abi_amdgpu_kernel)]` to the crate attributes to enable
error[E0658]: intrinsics are subject to change
--> $DIR/feature-gate-abi.rs:62:5
--> $DIR/feature-gate-abi.rs:66:5
|
LL | extern "rust-intrinsic" fn im1() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -319,7 +302,7 @@ LL | extern "rust-intrinsic" fn im1() {}
= help: add `#![feature(intrinsics)]` to the crate attributes to enable
error[E0658]: platform intrinsics are experimental and possibly buggy
--> $DIR/feature-gate-abi.rs:63:5
--> $DIR/feature-gate-abi.rs:68:5
|
LL | extern "platform-intrinsic" fn im2() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -328,7 +311,7 @@ LL | extern "platform-intrinsic" fn im2() {}
= help: add `#![feature(platform_intrinsics)]` to the crate attributes to enable
error[E0658]: vectorcall is experimental and subject to change
--> $DIR/feature-gate-abi.rs:64:5
--> $DIR/feature-gate-abi.rs:70:5
|
LL | extern "vectorcall" fn im3() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -336,7 +319,7 @@ LL | extern "vectorcall" fn im3() {}
= help: add `#![feature(abi_vectorcall)]` to the crate attributes to enable
error[E0658]: rust-call ABI is subject to change
--> $DIR/feature-gate-abi.rs:65:5
--> $DIR/feature-gate-abi.rs:71:5
|
LL | extern "rust-call" fn im4() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -345,7 +328,7 @@ LL | extern "rust-call" fn im4() {}
= help: add `#![feature(unboxed_closures)]` to the crate attributes to enable
error[E0658]: msp430-interrupt ABI is experimental and subject to change
--> $DIR/feature-gate-abi.rs:66:5
--> $DIR/feature-gate-abi.rs:72:5
|
LL | extern "msp430-interrupt" fn im5() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -354,7 +337,7 @@ LL | extern "msp430-interrupt" fn im5() {}
= help: add `#![feature(abi_msp430_interrupt)]` to the crate attributes to enable
error[E0658]: PTX ABIs are experimental and subject to change
--> $DIR/feature-gate-abi.rs:67:5
--> $DIR/feature-gate-abi.rs:73:5
|
LL | extern "ptx-kernel" fn im6() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -363,7 +346,7 @@ LL | extern "ptx-kernel" fn im6() {}
= help: add `#![feature(abi_ptx)]` to the crate attributes to enable
error[E0658]: x86-interrupt ABI is experimental and subject to change
--> $DIR/feature-gate-abi.rs:68:5
--> $DIR/feature-gate-abi.rs:74:5
|
LL | extern "x86-interrupt" fn im7() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -372,7 +355,7 @@ LL | extern "x86-interrupt" fn im7() {}
= help: add `#![feature(abi_x86_interrupt)]` to the crate attributes to enable
error[E0658]: thiscall is experimental and subject to change
--> $DIR/feature-gate-abi.rs:69:5
--> $DIR/feature-gate-abi.rs:75:5
|
LL | extern "thiscall" fn im8() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -380,7 +363,7 @@ LL | extern "thiscall" fn im8() {}
= help: add `#![feature(abi_thiscall)]` to the crate attributes to enable
error[E0658]: amdgpu-kernel ABI is experimental and subject to change
--> $DIR/feature-gate-abi.rs:70:5
--> $DIR/feature-gate-abi.rs:76:5
|
LL | extern "amdgpu-kernel" fn im9() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -389,7 +372,7 @@ LL | extern "amdgpu-kernel" fn im9() {}
= help: add `#![feature(abi_amdgpu_kernel)]` to the crate attributes to enable
error[E0658]: intrinsics are subject to change
--> $DIR/feature-gate-abi.rs:74:11
--> $DIR/feature-gate-abi.rs:80:11
|
LL | type A1 = extern "rust-intrinsic" fn();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -397,7 +380,7 @@ LL | type A1 = extern "rust-intrinsic" fn();
= help: add `#![feature(intrinsics)]` to the crate attributes to enable
error[E0658]: platform intrinsics are experimental and possibly buggy
--> $DIR/feature-gate-abi.rs:75:11
--> $DIR/feature-gate-abi.rs:81:11
|
LL | type A2 = extern "platform-intrinsic" fn();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -406,7 +389,7 @@ LL | type A2 = extern "platform-intrinsic" fn();
= help: add `#![feature(platform_intrinsics)]` to the crate attributes to enable
error[E0658]: vectorcall is experimental and subject to change
--> $DIR/feature-gate-abi.rs:76:11
--> $DIR/feature-gate-abi.rs:82:11
|
LL | type A3 = extern "vectorcall" fn();
| ^^^^^^^^^^^^^^^^^^^^^^^^
@ -414,7 +397,7 @@ LL | type A3 = extern "vectorcall" fn();
= help: add `#![feature(abi_vectorcall)]` to the crate attributes to enable
error[E0658]: rust-call ABI is subject to change
--> $DIR/feature-gate-abi.rs:77:11
--> $DIR/feature-gate-abi.rs:83:11
|
LL | type A4 = extern "rust-call" fn();
| ^^^^^^^^^^^^^^^^^^^^^^^
@ -423,7 +406,7 @@ LL | type A4 = extern "rust-call" fn();
= help: add `#![feature(unboxed_closures)]` to the crate attributes to enable
error[E0658]: msp430-interrupt ABI is experimental and subject to change
--> $DIR/feature-gate-abi.rs:78:11
--> $DIR/feature-gate-abi.rs:84:11
|
LL | type A5 = extern "msp430-interrupt" fn();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -432,7 +415,7 @@ LL | type A5 = extern "msp430-interrupt" fn();
= help: add `#![feature(abi_msp430_interrupt)]` to the crate attributes to enable
error[E0658]: PTX ABIs are experimental and subject to change
--> $DIR/feature-gate-abi.rs:79:11
--> $DIR/feature-gate-abi.rs:85:11
|
LL | type A6 = extern "ptx-kernel" fn ();
| ^^^^^^^^^^^^^^^^^^^^^^^^^
@ -441,7 +424,7 @@ LL | type A6 = extern "ptx-kernel" fn ();
= help: add `#![feature(abi_ptx)]` to the crate attributes to enable
error[E0658]: x86-interrupt ABI is experimental and subject to change
--> $DIR/feature-gate-abi.rs:80:11
--> $DIR/feature-gate-abi.rs:86:11
|
LL | type A7 = extern "x86-interrupt" fn();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -450,7 +433,7 @@ LL | type A7 = extern "x86-interrupt" fn();
= help: add `#![feature(abi_x86_interrupt)]` to the crate attributes to enable
error[E0658]: thiscall is experimental and subject to change
--> $DIR/feature-gate-abi.rs:81:11
--> $DIR/feature-gate-abi.rs:87:11
|
LL | type A8 = extern "thiscall" fn();
| ^^^^^^^^^^^^^^^^^^^^^^
@ -458,7 +441,7 @@ LL | type A8 = extern "thiscall" fn();
= help: add `#![feature(abi_thiscall)]` to the crate attributes to enable
error[E0658]: amdgpu-kernel ABI is experimental and subject to change
--> $DIR/feature-gate-abi.rs:82:11
--> $DIR/feature-gate-abi.rs:88:11
|
LL | type A9 = extern "amdgpu-kernel" fn();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -467,7 +450,7 @@ LL | type A9 = extern "amdgpu-kernel" fn();
= help: add `#![feature(abi_amdgpu_kernel)]` to the crate attributes to enable
error[E0658]: intrinsics are subject to change
--> $DIR/feature-gate-abi.rs:85:1
--> $DIR/feature-gate-abi.rs:91:1
|
LL | extern "rust-intrinsic" {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -475,7 +458,7 @@ LL | extern "rust-intrinsic" {}
= help: add `#![feature(intrinsics)]` to the crate attributes to enable
error[E0658]: platform intrinsics are experimental and possibly buggy
--> $DIR/feature-gate-abi.rs:86:1
--> $DIR/feature-gate-abi.rs:92:1
|
LL | extern "platform-intrinsic" {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -484,7 +467,7 @@ LL | extern "platform-intrinsic" {}
= help: add `#![feature(platform_intrinsics)]` to the crate attributes to enable
error[E0658]: vectorcall is experimental and subject to change
--> $DIR/feature-gate-abi.rs:87:1
--> $DIR/feature-gate-abi.rs:93:1
|
LL | extern "vectorcall" {}
| ^^^^^^^^^^^^^^^^^^^^^^
@ -492,7 +475,7 @@ LL | extern "vectorcall" {}
= help: add `#![feature(abi_vectorcall)]` to the crate attributes to enable
error[E0658]: rust-call ABI is subject to change
--> $DIR/feature-gate-abi.rs:88:1
--> $DIR/feature-gate-abi.rs:94:1
|
LL | extern "rust-call" {}
| ^^^^^^^^^^^^^^^^^^^^^
@ -501,7 +484,7 @@ LL | extern "rust-call" {}
= help: add `#![feature(unboxed_closures)]` to the crate attributes to enable
error[E0658]: msp430-interrupt ABI is experimental and subject to change
--> $DIR/feature-gate-abi.rs:89:1
--> $DIR/feature-gate-abi.rs:95:1
|
LL | extern "msp430-interrupt" {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -510,7 +493,7 @@ LL | extern "msp430-interrupt" {}
= help: add `#![feature(abi_msp430_interrupt)]` to the crate attributes to enable
error[E0658]: PTX ABIs are experimental and subject to change
--> $DIR/feature-gate-abi.rs:90:1
--> $DIR/feature-gate-abi.rs:96:1
|
LL | extern "ptx-kernel" {}
| ^^^^^^^^^^^^^^^^^^^^^^
@ -519,7 +502,7 @@ LL | extern "ptx-kernel" {}
= help: add `#![feature(abi_ptx)]` to the crate attributes to enable
error[E0658]: x86-interrupt ABI is experimental and subject to change
--> $DIR/feature-gate-abi.rs:91:1
--> $DIR/feature-gate-abi.rs:97:1
|
LL | extern "x86-interrupt" {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^
@ -528,7 +511,7 @@ LL | extern "x86-interrupt" {}
= help: add `#![feature(abi_x86_interrupt)]` to the crate attributes to enable
error[E0658]: thiscall is experimental and subject to change
--> $DIR/feature-gate-abi.rs:92:1
--> $DIR/feature-gate-abi.rs:98:1
|
LL | extern "thiscall" {}
| ^^^^^^^^^^^^^^^^^^^^
@ -536,7 +519,7 @@ LL | extern "thiscall" {}
= help: add `#![feature(abi_thiscall)]` to the crate attributes to enable
error[E0658]: amdgpu-kernel ABI is experimental and subject to change
--> $DIR/feature-gate-abi.rs:93:1
--> $DIR/feature-gate-abi.rs:99:1
|
LL | extern "amdgpu-kernel" {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^
@ -544,6 +527,54 @@ LL | extern "amdgpu-kernel" {}
= note: for more information, see https://github.com/rust-lang/rust/issues/51575
= help: add `#![feature(abi_amdgpu_kernel)]` to the crate attributes to enable
error: aborting due to 63 previous errors
error: intrinsic must be in `extern "rust-intrinsic" { ... }` block
--> $DIR/feature-gate-abi.rs:26:32
|
LL | extern "rust-intrinsic" fn m1();
| ^^
error: intrinsic must be in `extern "rust-intrinsic" { ... }` block
--> $DIR/feature-gate-abi.rs:28:36
|
LL | extern "platform-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:37
|
LL | extern "platform-intrinsic" fn f2() {}
| ^^
error: intrinsic must be in `extern "rust-intrinsic" { ... }` block
--> $DIR/feature-gate-abi.rs:51:37
|
LL | extern "rust-intrinsic" fn m1() {}
| ^^
error: intrinsic must be in `extern "rust-intrinsic" { ... }` block
--> $DIR/feature-gate-abi.rs:53:41
|
LL | extern "platform-intrinsic" fn m2() {}
| ^^
error: intrinsic must be in `extern "rust-intrinsic" { ... }` block
--> $DIR/feature-gate-abi.rs:66:38
|
LL | extern "rust-intrinsic" fn im1() {}
| ^^
error: intrinsic must be in `extern "rust-intrinsic" { ... }` block
--> $DIR/feature-gate-abi.rs:68:42
|
LL | extern "platform-intrinsic" fn im2() {}
| ^^
error: aborting due to 69 previous errors
For more information about this error, try `rustc --explain E0658`.

View file

@ -3,5 +3,6 @@ extern "rust-intrinsic" { //~ ERROR intrinsics are subject to change
}
extern "rust-intrinsic" fn baz() {} //~ ERROR intrinsics are subject to change
//~^ ERROR intrinsic must be in
fn main() {}

View file

@ -22,7 +22,13 @@ error[E0093]: unrecognized intrinsic function: `bar`
LL | fn bar();
| ^^^^^^^^^ unrecognized intrinsic
error: aborting due to 3 previous errors
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`.

View file

@ -0,0 +1,16 @@
#![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
}
fn main() {
}

View file

@ -0,0 +1,24 @@
error: intrinsic must be in `extern "rust-intrinsic" { ... }` block
--> $DIR/intrinsics-always-extern.rs:4:32
|
LL | extern "rust-intrinsic" fn foo(&self);
| ^^^
error: intrinsic must be in `extern "rust-intrinsic" { ... }` block
--> $DIR/intrinsics-always-extern.rs:8:43
|
LL | extern "rust-intrinsic" fn foo(&self) {
| ___________________________________________^
LL | | }
| |_____^
error: intrinsic must be in `extern "rust-intrinsic" { ... }` block
--> $DIR/intrinsics-always-extern.rs:12:36
|
LL | extern "rust-intrinsic" fn hello() {
| ____________________________________^
LL | | }
| |_^
error: aborting due to 3 previous errors