mirror of
https://github.com/rust-lang/rust.git
synced 2025-04-28 02:57:37 +00:00
Add test for extern
without explicit ABI
This commit is contained in:
parent
01cfa9aad5
commit
d17c04e4a2
@ -0,0 +1,45 @@
|
||||
// The purpose of this feature gate is to make something into a hard error in a
|
||||
// future edition. Consequently, this test differs from most other feature gate
|
||||
// tests. Instead of verifying that an error occurs when the feature gate is
|
||||
// missing, it ensures that the hard error is only produced with the feature
|
||||
// gate is present in the `future` edition -- and otherwise that only a warning
|
||||
// is emitted.
|
||||
|
||||
//@ revisions: current current_feature future future_feature
|
||||
|
||||
//@ [current] run-rustfix
|
||||
//@ [current] check-pass
|
||||
|
||||
//@ [current_feature] run-rustfix
|
||||
//@ [current_feature] check-pass
|
||||
|
||||
//@ [future] edition: future
|
||||
//@ [future] compile-flags: -Z unstable-options
|
||||
//@ [future] run-rustfix
|
||||
//@ [future] check-pass
|
||||
|
||||
//@ [future_feature] edition: future
|
||||
//@ [future_feature] compile-flags: -Z unstable-options
|
||||
|
||||
#![cfg_attr(future_feature, feature(explicit_extern_abis))]
|
||||
#![cfg_attr(current_feature, feature(explicit_extern_abis))]
|
||||
|
||||
extern "C" fn _foo() {}
|
||||
//[current]~^ WARN `extern` declarations without an explicit ABI are deprecated
|
||||
//[current_feature]~^^ WARN `extern` declarations without an explicit ABI are deprecated
|
||||
//[future]~^^^ WARN `extern` declarations without an explicit ABI are deprecated
|
||||
//[future_feature]~^^^^ ERROR `extern` declarations without an explicit ABI are disallowed
|
||||
|
||||
unsafe extern "C" fn _bar() {}
|
||||
//[current]~^ WARN `extern` declarations without an explicit ABI are deprecated
|
||||
//[current_feature]~^^ WARN `extern` declarations without an explicit ABI are deprecated
|
||||
//[future]~^^^ WARN `extern` declarations without an explicit ABI are deprecated
|
||||
//[future_feature]~^^^^ ERROR `extern` declarations without an explicit ABI are disallowed
|
||||
|
||||
unsafe extern "C" {}
|
||||
//[current]~^ WARN `extern` declarations without an explicit ABI are deprecated
|
||||
//[current_feature]~^^ WARN `extern` declarations without an explicit ABI are deprecated
|
||||
//[future]~^^^ WARN `extern` declarations without an explicit ABI are deprecated
|
||||
//[future_feature]~^^^^ ERROR `extern` declarations without an explicit ABI are disallowed
|
||||
|
||||
fn main() {}
|
@ -0,0 +1,22 @@
|
||||
warning: `extern` declarations without an explicit ABI are deprecated
|
||||
--> $DIR/feature-gate-explicit-extern-abis.rs:27:1
|
||||
|
|
||||
LL | extern fn _foo() {}
|
||||
| ^^^^^^ help: explicitly specify the "C" ABI: `extern "C"`
|
||||
|
|
||||
= note: `#[warn(missing_abi)]` on by default
|
||||
|
||||
warning: `extern` declarations without an explicit ABI are deprecated
|
||||
--> $DIR/feature-gate-explicit-extern-abis.rs:33:8
|
||||
|
|
||||
LL | unsafe extern fn _bar() {}
|
||||
| ^^^^^^ help: explicitly specify the "C" ABI: `extern "C"`
|
||||
|
||||
warning: `extern` declarations without an explicit ABI are deprecated
|
||||
--> $DIR/feature-gate-explicit-extern-abis.rs:39:8
|
||||
|
|
||||
LL | unsafe extern {}
|
||||
| ^^^^^^ help: explicitly specify the "C" ABI: `extern "C"`
|
||||
|
||||
warning: 3 warnings emitted
|
||||
|
@ -0,0 +1,45 @@
|
||||
// The purpose of this feature gate is to make something into a hard error in a
|
||||
// future edition. Consequently, this test differs from most other feature gate
|
||||
// tests. Instead of verifying that an error occurs when the feature gate is
|
||||
// missing, it ensures that the hard error is only produced with the feature
|
||||
// gate is present in the `future` edition -- and otherwise that only a warning
|
||||
// is emitted.
|
||||
|
||||
//@ revisions: current current_feature future future_feature
|
||||
|
||||
//@ [current] run-rustfix
|
||||
//@ [current] check-pass
|
||||
|
||||
//@ [current_feature] run-rustfix
|
||||
//@ [current_feature] check-pass
|
||||
|
||||
//@ [future] edition: future
|
||||
//@ [future] compile-flags: -Z unstable-options
|
||||
//@ [future] run-rustfix
|
||||
//@ [future] check-pass
|
||||
|
||||
//@ [future_feature] edition: future
|
||||
//@ [future_feature] compile-flags: -Z unstable-options
|
||||
|
||||
#![cfg_attr(future_feature, feature(explicit_extern_abis))]
|
||||
#![cfg_attr(current_feature, feature(explicit_extern_abis))]
|
||||
|
||||
extern "C" fn _foo() {}
|
||||
//[current]~^ WARN `extern` declarations without an explicit ABI are deprecated
|
||||
//[current_feature]~^^ WARN `extern` declarations without an explicit ABI are deprecated
|
||||
//[future]~^^^ WARN `extern` declarations without an explicit ABI are deprecated
|
||||
//[future_feature]~^^^^ ERROR `extern` declarations without an explicit ABI are disallowed
|
||||
|
||||
unsafe extern "C" fn _bar() {}
|
||||
//[current]~^ WARN `extern` declarations without an explicit ABI are deprecated
|
||||
//[current_feature]~^^ WARN `extern` declarations without an explicit ABI are deprecated
|
||||
//[future]~^^^ WARN `extern` declarations without an explicit ABI are deprecated
|
||||
//[future_feature]~^^^^ ERROR `extern` declarations without an explicit ABI are disallowed
|
||||
|
||||
unsafe extern "C" {}
|
||||
//[current]~^ WARN `extern` declarations without an explicit ABI are deprecated
|
||||
//[current_feature]~^^ WARN `extern` declarations without an explicit ABI are deprecated
|
||||
//[future]~^^^ WARN `extern` declarations without an explicit ABI are deprecated
|
||||
//[future_feature]~^^^^ ERROR `extern` declarations without an explicit ABI are disallowed
|
||||
|
||||
fn main() {}
|
@ -0,0 +1,22 @@
|
||||
warning: `extern` declarations without an explicit ABI are deprecated
|
||||
--> $DIR/feature-gate-explicit-extern-abis.rs:27:1
|
||||
|
|
||||
LL | extern fn _foo() {}
|
||||
| ^^^^^^ help: explicitly specify the "C" ABI: `extern "C"`
|
||||
|
|
||||
= note: `#[warn(missing_abi)]` on by default
|
||||
|
||||
warning: `extern` declarations without an explicit ABI are deprecated
|
||||
--> $DIR/feature-gate-explicit-extern-abis.rs:33:8
|
||||
|
|
||||
LL | unsafe extern fn _bar() {}
|
||||
| ^^^^^^ help: explicitly specify the "C" ABI: `extern "C"`
|
||||
|
||||
warning: `extern` declarations without an explicit ABI are deprecated
|
||||
--> $DIR/feature-gate-explicit-extern-abis.rs:39:8
|
||||
|
|
||||
LL | unsafe extern {}
|
||||
| ^^^^^^ help: explicitly specify the "C" ABI: `extern "C"`
|
||||
|
||||
warning: 3 warnings emitted
|
||||
|
@ -0,0 +1,45 @@
|
||||
// The purpose of this feature gate is to make something into a hard error in a
|
||||
// future edition. Consequently, this test differs from most other feature gate
|
||||
// tests. Instead of verifying that an error occurs when the feature gate is
|
||||
// missing, it ensures that the hard error is only produced with the feature
|
||||
// gate is present in the `future` edition -- and otherwise that only a warning
|
||||
// is emitted.
|
||||
|
||||
//@ revisions: current current_feature future future_feature
|
||||
|
||||
//@ [current] run-rustfix
|
||||
//@ [current] check-pass
|
||||
|
||||
//@ [current_feature] run-rustfix
|
||||
//@ [current_feature] check-pass
|
||||
|
||||
//@ [future] edition: future
|
||||
//@ [future] compile-flags: -Z unstable-options
|
||||
//@ [future] run-rustfix
|
||||
//@ [future] check-pass
|
||||
|
||||
//@ [future_feature] edition: future
|
||||
//@ [future_feature] compile-flags: -Z unstable-options
|
||||
|
||||
#![cfg_attr(future_feature, feature(explicit_extern_abis))]
|
||||
#![cfg_attr(current_feature, feature(explicit_extern_abis))]
|
||||
|
||||
extern "C" fn _foo() {}
|
||||
//[current]~^ WARN `extern` declarations without an explicit ABI are deprecated
|
||||
//[current_feature]~^^ WARN `extern` declarations without an explicit ABI are deprecated
|
||||
//[future]~^^^ WARN `extern` declarations without an explicit ABI are deprecated
|
||||
//[future_feature]~^^^^ ERROR `extern` declarations without an explicit ABI are disallowed
|
||||
|
||||
unsafe extern "C" fn _bar() {}
|
||||
//[current]~^ WARN `extern` declarations without an explicit ABI are deprecated
|
||||
//[current_feature]~^^ WARN `extern` declarations without an explicit ABI are deprecated
|
||||
//[future]~^^^ WARN `extern` declarations without an explicit ABI are deprecated
|
||||
//[future_feature]~^^^^ ERROR `extern` declarations without an explicit ABI are disallowed
|
||||
|
||||
unsafe extern "C" {}
|
||||
//[current]~^ WARN `extern` declarations without an explicit ABI are deprecated
|
||||
//[current_feature]~^^ WARN `extern` declarations without an explicit ABI are deprecated
|
||||
//[future]~^^^ WARN `extern` declarations without an explicit ABI are deprecated
|
||||
//[future_feature]~^^^^ ERROR `extern` declarations without an explicit ABI are disallowed
|
||||
|
||||
fn main() {}
|
@ -0,0 +1,22 @@
|
||||
warning: `extern` declarations without an explicit ABI are deprecated
|
||||
--> $DIR/feature-gate-explicit-extern-abis.rs:27:1
|
||||
|
|
||||
LL | extern fn _foo() {}
|
||||
| ^^^^^^ help: explicitly specify the "C" ABI: `extern "C"`
|
||||
|
|
||||
= note: `#[warn(missing_abi)]` on by default
|
||||
|
||||
warning: `extern` declarations without an explicit ABI are deprecated
|
||||
--> $DIR/feature-gate-explicit-extern-abis.rs:33:8
|
||||
|
|
||||
LL | unsafe extern fn _bar() {}
|
||||
| ^^^^^^ help: explicitly specify the "C" ABI: `extern "C"`
|
||||
|
||||
warning: `extern` declarations without an explicit ABI are deprecated
|
||||
--> $DIR/feature-gate-explicit-extern-abis.rs:39:8
|
||||
|
|
||||
LL | unsafe extern {}
|
||||
| ^^^^^^ help: explicitly specify the "C" ABI: `extern "C"`
|
||||
|
||||
warning: 3 warnings emitted
|
||||
|
@ -0,0 +1,26 @@
|
||||
error: `extern` declarations without an explicit ABI are disallowed
|
||||
--> $DIR/feature-gate-explicit-extern-abis.rs:27:1
|
||||
|
|
||||
LL | extern fn _foo() {}
|
||||
| ^^^^^^ help: specify an ABI: `extern "<abi>"`
|
||||
|
|
||||
= help: prior to Rust 2024, a default ABI was inferred
|
||||
|
||||
error: `extern` declarations without an explicit ABI are disallowed
|
||||
--> $DIR/feature-gate-explicit-extern-abis.rs:33:8
|
||||
|
|
||||
LL | unsafe extern fn _bar() {}
|
||||
| ^^^^^^ help: specify an ABI: `extern "<abi>"`
|
||||
|
|
||||
= help: prior to Rust 2024, a default ABI was inferred
|
||||
|
||||
error: `extern` declarations without an explicit ABI are disallowed
|
||||
--> $DIR/feature-gate-explicit-extern-abis.rs:39:8
|
||||
|
|
||||
LL | unsafe extern {}
|
||||
| ^^^^^^ help: specify an ABI: `extern "<abi>"`
|
||||
|
|
||||
= help: prior to Rust 2024, a default ABI was inferred
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
45
tests/ui/feature-gates/feature-gate-explicit-extern-abis.rs
Normal file
45
tests/ui/feature-gates/feature-gate-explicit-extern-abis.rs
Normal file
@ -0,0 +1,45 @@
|
||||
// The purpose of this feature gate is to make something into a hard error in a
|
||||
// future edition. Consequently, this test differs from most other feature gate
|
||||
// tests. Instead of verifying that an error occurs when the feature gate is
|
||||
// missing, it ensures that the hard error is only produced with the feature
|
||||
// gate is present in the `future` edition -- and otherwise that only a warning
|
||||
// is emitted.
|
||||
|
||||
//@ revisions: current current_feature future future_feature
|
||||
|
||||
//@ [current] run-rustfix
|
||||
//@ [current] check-pass
|
||||
|
||||
//@ [current_feature] run-rustfix
|
||||
//@ [current_feature] check-pass
|
||||
|
||||
//@ [future] edition: future
|
||||
//@ [future] compile-flags: -Z unstable-options
|
||||
//@ [future] run-rustfix
|
||||
//@ [future] check-pass
|
||||
|
||||
//@ [future_feature] edition: future
|
||||
//@ [future_feature] compile-flags: -Z unstable-options
|
||||
|
||||
#![cfg_attr(future_feature, feature(explicit_extern_abis))]
|
||||
#![cfg_attr(current_feature, feature(explicit_extern_abis))]
|
||||
|
||||
extern fn _foo() {}
|
||||
//[current]~^ WARN `extern` declarations without an explicit ABI are deprecated
|
||||
//[current_feature]~^^ WARN `extern` declarations without an explicit ABI are deprecated
|
||||
//[future]~^^^ WARN `extern` declarations without an explicit ABI are deprecated
|
||||
//[future_feature]~^^^^ ERROR `extern` declarations without an explicit ABI are disallowed
|
||||
|
||||
unsafe extern fn _bar() {}
|
||||
//[current]~^ WARN `extern` declarations without an explicit ABI are deprecated
|
||||
//[current_feature]~^^ WARN `extern` declarations without an explicit ABI are deprecated
|
||||
//[future]~^^^ WARN `extern` declarations without an explicit ABI are deprecated
|
||||
//[future_feature]~^^^^ ERROR `extern` declarations without an explicit ABI are disallowed
|
||||
|
||||
unsafe extern {}
|
||||
//[current]~^ WARN `extern` declarations without an explicit ABI are deprecated
|
||||
//[current_feature]~^^ WARN `extern` declarations without an explicit ABI are deprecated
|
||||
//[future]~^^^ WARN `extern` declarations without an explicit ABI are deprecated
|
||||
//[future_feature]~^^^^ ERROR `extern` declarations without an explicit ABI are disallowed
|
||||
|
||||
fn main() {}
|
@ -2,7 +2,7 @@
|
||||
//@ compile-flags: --crate-type rlib
|
||||
|
||||
#[link(name = "libfoo.a", kind = "static")]
|
||||
extern { } //~ WARN extern declarations without an explicit ABI are deprecated
|
||||
extern { } //~ WARN `extern` declarations without an explicit ABI are deprecated
|
||||
//~| HELP explicitly specify the "C" ABI
|
||||
|
||||
pub fn main() { }
|
||||
|
@ -1,4 +1,4 @@
|
||||
warning: extern declarations without an explicit ABI are deprecated
|
||||
warning: `extern` declarations without an explicit ABI are deprecated
|
||||
--> $DIR/suggest-libname-only-1.rs:5:1
|
||||
|
|
||||
LL | extern { }
|
||||
|
@ -2,7 +2,7 @@
|
||||
//@ compile-flags: --crate-type rlib
|
||||
|
||||
#[link(name = "bar.lib", kind = "static")]
|
||||
extern { } //~ WARN extern declarations without an explicit ABI are deprecated
|
||||
extern { } //~ WARN `extern` declarations without an explicit ABI are deprecated
|
||||
//~| HELP explicitly specify the "C" ABI
|
||||
|
||||
pub fn main() { }
|
||||
|
@ -1,4 +1,4 @@
|
||||
warning: extern declarations without an explicit ABI are deprecated
|
||||
warning: `extern` declarations without an explicit ABI are deprecated
|
||||
--> $DIR/suggest-libname-only-2.rs:5:1
|
||||
|
|
||||
LL | extern { }
|
||||
|
@ -1,4 +1,4 @@
|
||||
error: extern declarations without an explicit ABI are deprecated
|
||||
error: `extern` declarations without an explicit ABI are deprecated
|
||||
--> $DIR/cli-lint-override.rs:12:1
|
||||
|
|
||||
LL | extern fn foo() {}
|
||||
|
@ -1,4 +1,4 @@
|
||||
warning: extern declarations without an explicit ABI are deprecated
|
||||
warning: `extern` declarations without an explicit ABI are deprecated
|
||||
--> $DIR/cli-lint-override.rs:12:1
|
||||
|
|
||||
LL | extern fn foo() {}
|
||||
|
@ -10,8 +10,8 @@
|
||||
|
||||
|
||||
extern fn foo() {}
|
||||
//[warn_deny]~^ ERROR extern declarations without an explicit ABI are deprecated
|
||||
//[forbid_warn]~^^ ERROR extern declarations without an explicit ABI are deprecated
|
||||
//[force_warn_deny]~^^^ WARN extern declarations without an explicit ABI are deprecated
|
||||
//[warn_deny]~^ ERROR `extern` declarations without an explicit ABI are deprecated
|
||||
//[forbid_warn]~^^ ERROR `extern` declarations without an explicit ABI are deprecated
|
||||
//[force_warn_deny]~^^^ WARN `extern` declarations without an explicit ABI are deprecated
|
||||
|
||||
fn main() {}
|
||||
|
@ -1,4 +1,4 @@
|
||||
error: extern declarations without an explicit ABI are deprecated
|
||||
error: `extern` declarations without an explicit ABI are deprecated
|
||||
--> $DIR/cli-lint-override.rs:12:1
|
||||
|
|
||||
LL | extern fn foo() {}
|
||||
|
@ -51,7 +51,7 @@ LL | #[rustc_layout_scalar_valid_range_start(0suffix)]
|
||||
|
|
||||
= help: the suffix must be one of the numeric types (`u32`, `isize`, `f32`, etc.)
|
||||
|
||||
warning: extern declarations without an explicit ABI are deprecated
|
||||
warning: `extern` declarations without an explicit ABI are deprecated
|
||||
--> $DIR/bad-lit-suffixes.rs:3:1
|
||||
|
|
||||
LL | extern
|
||||
@ -59,7 +59,7 @@ LL | extern
|
||||
|
|
||||
= note: `#[warn(missing_abi)]` on by default
|
||||
|
||||
warning: extern declarations without an explicit ABI are deprecated
|
||||
warning: `extern` declarations without an explicit ABI are deprecated
|
||||
--> $DIR/bad-lit-suffixes.rs:7:1
|
||||
|
|
||||
LL | extern
|
||||
|
@ -4,7 +4,7 @@ error: suffixes on string literals are invalid
|
||||
LL | f!("Foo"__);
|
||||
| ^^^^^^^ invalid suffix `__`
|
||||
|
||||
warning: extern declarations without an explicit ABI are deprecated
|
||||
warning: `extern` declarations without an explicit ABI are deprecated
|
||||
--> $DIR/lit-err-in-macro.rs:3:9
|
||||
|
|
||||
LL | extern $abi fn f() {}
|
||||
|
@ -82,7 +82,7 @@ fn bar() {
|
||||
}
|
||||
|
||||
|
||||
extern { //~ WARN extern declarations without an explicit ABI are deprecated
|
||||
extern { //~ WARN `extern` declarations without an explicit ABI are deprecated
|
||||
fn weird_extern() {
|
||||
#![print_target_and_args_consume(tenth)]
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ error: expected non-macro inner attribute, found attribute macro `print_attr`
|
||||
LL | #![print_attr]
|
||||
| ^^^^^^^^^^ not a non-macro inner attribute
|
||||
|
||||
warning: extern declarations without an explicit ABI are deprecated
|
||||
warning: `extern` declarations without an explicit ABI are deprecated
|
||||
--> $DIR/inner-attrs.rs:85:1
|
||||
|
|
||||
LL | extern {
|
||||
|
Loading…
Reference in New Issue
Block a user