-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Stablize
const_extern_fn
for "Rust" and "C"
All other ABIs are left unstable for now. cc #64926
- Loading branch information
Showing
4 changed files
with
42 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 10 additions & 7 deletions
17
src/test/ui/consts/const-extern-fn/feature-gate-const_extern_fn.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,13 @@ | ||
// Check that `const extern fn` and `const unsafe extern fn` are feature-gated. | ||
// Check that `const extern fn` and `const unsafe extern fn` are feature-gated | ||
// for certain ABIs. | ||
|
||
const extern fn foo1() {} //~ ERROR `const extern fn` definitions are unstable | ||
const extern "C" fn foo2() {} //~ ERROR `const extern fn` definitions are unstable | ||
const extern "Rust" fn foo3() {} //~ ERROR `const extern fn` definitions are unstable | ||
const unsafe extern fn bar1() {} //~ ERROR `const extern fn` definitions are unstable | ||
const unsafe extern "C" fn bar2() {} //~ ERROR `const extern fn` definitions are unstable | ||
const unsafe extern "Rust" fn bar3() {} //~ ERROR `const extern fn` definitions are unstable | ||
const extern fn foo1() {} | ||
const extern "C" fn foo2() {} | ||
const extern "Rust" fn foo3() {} | ||
const extern "cdecl" fn foo4() {} //~ ERROR `cdecl` as a `const fn` ABI is unstable | ||
const unsafe extern fn bar1() {} | ||
const unsafe extern "C" fn bar2() {} | ||
const unsafe extern "Rust" fn bar3() {} | ||
const unsafe extern "cdecl" fn bar4() {} //~ ERROR `cdecl` as a `const fn` ABI is unstable | ||
|
||
fn main() {} |
54 changes: 9 additions & 45 deletions
54
src/test/ui/consts/const-extern-fn/feature-gate-const_extern_fn.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,57 +1,21 @@ | ||
error[E0658]: `const extern fn` definitions are unstable | ||
--> $DIR/feature-gate-const_extern_fn.rs:3:1 | ||
error[E0658]: `cdecl` as a `const fn` ABI is unstable | ||
--> $DIR/feature-gate-const_extern_fn.rs:7:14 | ||
| | ||
LL | const extern fn foo1() {} | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
LL | const extern "cdecl" fn foo4() {} | ||
| ^^^^^^^ | ||
| | ||
= note: see issue #64926 <https://github.com/rust-lang/rust/issues/64926> for more information | ||
= help: add `#![feature(const_extern_fn)]` to the crate attributes to enable | ||
|
||
error[E0658]: `const extern fn` definitions are unstable | ||
--> $DIR/feature-gate-const_extern_fn.rs:4:1 | ||
error[E0658]: `cdecl` as a `const fn` ABI is unstable | ||
--> $DIR/feature-gate-const_extern_fn.rs:11:21 | ||
| | ||
LL | const extern "C" fn foo2() {} | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
LL | const unsafe extern "cdecl" fn bar4() {} | ||
| ^^^^^^^ | ||
| | ||
= note: see issue #64926 <https://github.com/rust-lang/rust/issues/64926> for more information | ||
= help: add `#![feature(const_extern_fn)]` to the crate attributes to enable | ||
|
||
error[E0658]: `const extern fn` definitions are unstable | ||
--> $DIR/feature-gate-const_extern_fn.rs:5:1 | ||
| | ||
LL | const extern "Rust" fn foo3() {} | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= note: see issue #64926 <https://github.com/rust-lang/rust/issues/64926> for more information | ||
= help: add `#![feature(const_extern_fn)]` to the crate attributes to enable | ||
|
||
error[E0658]: `const extern fn` definitions are unstable | ||
--> $DIR/feature-gate-const_extern_fn.rs:6:1 | ||
| | ||
LL | const unsafe extern fn bar1() {} | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= note: see issue #64926 <https://github.com/rust-lang/rust/issues/64926> for more information | ||
= help: add `#![feature(const_extern_fn)]` to the crate attributes to enable | ||
|
||
error[E0658]: `const extern fn` definitions are unstable | ||
--> $DIR/feature-gate-const_extern_fn.rs:7:1 | ||
| | ||
LL | const unsafe extern "C" fn bar2() {} | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= note: see issue #64926 <https://github.com/rust-lang/rust/issues/64926> for more information | ||
= help: add `#![feature(const_extern_fn)]` to the crate attributes to enable | ||
|
||
error[E0658]: `const extern fn` definitions are unstable | ||
--> $DIR/feature-gate-const_extern_fn.rs:8:1 | ||
| | ||
LL | const unsafe extern "Rust" fn bar3() {} | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= note: see issue #64926 <https://github.com/rust-lang/rust/issues/64926> for more information | ||
= help: add `#![feature(const_extern_fn)]` to the crate attributes to enable | ||
|
||
error: aborting due to 6 previous errors | ||
error: aborting due to 2 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0658`. |