Add test for extern
without explicit ABI · rust-lang/rust@d17c04e (original) (raw)
20 files changed
lines changed
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
1 | +// The purpose of this feature gate is to make something into a hard error in a | |
2 | +// future edition. Consequently, this test differs from most other feature gate | |
3 | +// tests. Instead of verifying that an error occurs when the feature gate is | |
4 | +// missing, it ensures that the hard error is only produced with the feature | |
5 | +// gate is present in the `future` edition -- and otherwise that only a warning | |
6 | +// is emitted. | |
7 | + | |
8 | +//@ revisions: current current_feature future future_feature | |
9 | + | |
10 | +//@ [current] run-rustfix | |
11 | +//@ [current] check-pass | |
12 | + | |
13 | +//@ [current_feature] run-rustfix | |
14 | +//@ [current_feature] check-pass | |
15 | + | |
16 | +//@ [future] edition: future | |
17 | +//@ [future] compile-flags: -Z unstable-options | |
18 | +//@ [future] run-rustfix | |
19 | +//@ [future] check-pass | |
20 | + | |
21 | +//@ [future_feature] edition: future | |
22 | +//@ [future_feature] compile-flags: -Z unstable-options | |
23 | + | |
24 | +#![cfg_attr(future_feature, feature(explicit_extern_abis))] | |
25 | +#![cfg_attr(current_feature, feature(explicit_extern_abis))] | |
26 | + | |
27 | +extern "C" fn _foo() {} | |
28 | +//[current]~^ WARN `extern` declarations without an explicit ABI are deprecated | |
29 | +//[current_feature]~^^ WARN `extern` declarations without an explicit ABI are deprecated | |
30 | +//[future]~^^^ WARN `extern` declarations without an explicit ABI are deprecated | |
31 | +//[future_feature]~^^^^ ERROR `extern` declarations without an explicit ABI are disallowed | |
32 | + | |
33 | +unsafe extern "C" fn _bar() {} | |
34 | +//[current]~^ WARN `extern` declarations without an explicit ABI are deprecated | |
35 | +//[current_feature]~^^ WARN `extern` declarations without an explicit ABI are deprecated | |
36 | +//[future]~^^^ WARN `extern` declarations without an explicit ABI are deprecated | |
37 | +//[future_feature]~^^^^ ERROR `extern` declarations without an explicit ABI are disallowed | |
38 | + | |
39 | +unsafe extern "C" {} | |
40 | +//[current]~^ WARN `extern` declarations without an explicit ABI are deprecated | |
41 | +//[current_feature]~^^ WARN `extern` declarations without an explicit ABI are deprecated | |
42 | +//[future]~^^^ WARN `extern` declarations without an explicit ABI are deprecated | |
43 | +//[future_feature]~^^^^ ERROR `extern` declarations without an explicit ABI are disallowed | |
44 | + | |
45 | +fn main() {} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
1 | +warning: `extern` declarations without an explicit ABI are deprecated | |
2 | + --> $DIR/feature-gate-explicit-extern-abis.rs:27:1 | |
3 | + | | |
4 | +LL | extern fn _foo() {} | |
5 | + | ^^^^^^ help: explicitly specify the "C" ABI: `extern "C"` | |
6 | + | | |
7 | + = note: `#[warn(missing_abi)]` on by default | |
8 | + | |
9 | +warning: `extern` declarations without an explicit ABI are deprecated | |
10 | + --> $DIR/feature-gate-explicit-extern-abis.rs:33:8 | |
11 | + | | |
12 | +LL | unsafe extern fn _bar() {} | |
13 | + | ^^^^^^ help: explicitly specify the "C" ABI: `extern "C"` | |
14 | + | |
15 | +warning: `extern` declarations without an explicit ABI are deprecated | |
16 | + --> $DIR/feature-gate-explicit-extern-abis.rs:39:8 | |
17 | + | | |
18 | +LL | unsafe extern {} | |
19 | + | ^^^^^^ help: explicitly specify the "C" ABI: `extern "C"` | |
20 | + | |
21 | +warning: 3 warnings emitted | |
22 | + |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
1 | +// The purpose of this feature gate is to make something into a hard error in a | |
2 | +// future edition. Consequently, this test differs from most other feature gate | |
3 | +// tests. Instead of verifying that an error occurs when the feature gate is | |
4 | +// missing, it ensures that the hard error is only produced with the feature | |
5 | +// gate is present in the `future` edition -- and otherwise that only a warning | |
6 | +// is emitted. | |
7 | + | |
8 | +//@ revisions: current current_feature future future_feature | |
9 | + | |
10 | +//@ [current] run-rustfix | |
11 | +//@ [current] check-pass | |
12 | + | |
13 | +//@ [current_feature] run-rustfix | |
14 | +//@ [current_feature] check-pass | |
15 | + | |
16 | +//@ [future] edition: future | |
17 | +//@ [future] compile-flags: -Z unstable-options | |
18 | +//@ [future] run-rustfix | |
19 | +//@ [future] check-pass | |
20 | + | |
21 | +//@ [future_feature] edition: future | |
22 | +//@ [future_feature] compile-flags: -Z unstable-options | |
23 | + | |
24 | +#![cfg_attr(future_feature, feature(explicit_extern_abis))] | |
25 | +#![cfg_attr(current_feature, feature(explicit_extern_abis))] | |
26 | + | |
27 | +extern "C" fn _foo() {} | |
28 | +//[current]~^ WARN `extern` declarations without an explicit ABI are deprecated | |
29 | +//[current_feature]~^^ WARN `extern` declarations without an explicit ABI are deprecated | |
30 | +//[future]~^^^ WARN `extern` declarations without an explicit ABI are deprecated | |
31 | +//[future_feature]~^^^^ ERROR `extern` declarations without an explicit ABI are disallowed | |
32 | + | |
33 | +unsafe extern "C" fn _bar() {} | |
34 | +//[current]~^ WARN `extern` declarations without an explicit ABI are deprecated | |
35 | +//[current_feature]~^^ WARN `extern` declarations without an explicit ABI are deprecated | |
36 | +//[future]~^^^ WARN `extern` declarations without an explicit ABI are deprecated | |
37 | +//[future_feature]~^^^^ ERROR `extern` declarations without an explicit ABI are disallowed | |
38 | + | |
39 | +unsafe extern "C" {} | |
40 | +//[current]~^ WARN `extern` declarations without an explicit ABI are deprecated | |
41 | +//[current_feature]~^^ WARN `extern` declarations without an explicit ABI are deprecated | |
42 | +//[future]~^^^ WARN `extern` declarations without an explicit ABI are deprecated | |
43 | +//[future_feature]~^^^^ ERROR `extern` declarations without an explicit ABI are disallowed | |
44 | + | |
45 | +fn main() {} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
1 | +warning: `extern` declarations without an explicit ABI are deprecated | |
2 | + --> $DIR/feature-gate-explicit-extern-abis.rs:27:1 | |
3 | + | | |
4 | +LL | extern fn _foo() {} | |
5 | + | ^^^^^^ help: explicitly specify the "C" ABI: `extern "C"` | |
6 | + | | |
7 | + = note: `#[warn(missing_abi)]` on by default | |
8 | + | |
9 | +warning: `extern` declarations without an explicit ABI are deprecated | |
10 | + --> $DIR/feature-gate-explicit-extern-abis.rs:33:8 | |
11 | + | | |
12 | +LL | unsafe extern fn _bar() {} | |
13 | + | ^^^^^^ help: explicitly specify the "C" ABI: `extern "C"` | |
14 | + | |
15 | +warning: `extern` declarations without an explicit ABI are deprecated | |
16 | + --> $DIR/feature-gate-explicit-extern-abis.rs:39:8 | |
17 | + | | |
18 | +LL | unsafe extern {} | |
19 | + | ^^^^^^ help: explicitly specify the "C" ABI: `extern "C"` | |
20 | + | |
21 | +warning: 3 warnings emitted | |
22 | + |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
1 | +// The purpose of this feature gate is to make something into a hard error in a | |
2 | +// future edition. Consequently, this test differs from most other feature gate | |
3 | +// tests. Instead of verifying that an error occurs when the feature gate is | |
4 | +// missing, it ensures that the hard error is only produced with the feature | |
5 | +// gate is present in the `future` edition -- and otherwise that only a warning | |
6 | +// is emitted. | |
7 | + | |
8 | +//@ revisions: current current_feature future future_feature | |
9 | + | |
10 | +//@ [current] run-rustfix | |
11 | +//@ [current] check-pass | |
12 | + | |
13 | +//@ [current_feature] run-rustfix | |
14 | +//@ [current_feature] check-pass | |
15 | + | |
16 | +//@ [future] edition: future | |
17 | +//@ [future] compile-flags: -Z unstable-options | |
18 | +//@ [future] run-rustfix | |
19 | +//@ [future] check-pass | |
20 | + | |
21 | +//@ [future_feature] edition: future | |
22 | +//@ [future_feature] compile-flags: -Z unstable-options | |
23 | + | |
24 | +#![cfg_attr(future_feature, feature(explicit_extern_abis))] | |
25 | +#![cfg_attr(current_feature, feature(explicit_extern_abis))] | |
26 | + | |
27 | +extern "C" fn _foo() {} | |
28 | +//[current]~^ WARN `extern` declarations without an explicit ABI are deprecated | |
29 | +//[current_feature]~^^ WARN `extern` declarations without an explicit ABI are deprecated | |
30 | +//[future]~^^^ WARN `extern` declarations without an explicit ABI are deprecated | |
31 | +//[future_feature]~^^^^ ERROR `extern` declarations without an explicit ABI are disallowed | |
32 | + | |
33 | +unsafe extern "C" fn _bar() {} | |
34 | +//[current]~^ WARN `extern` declarations without an explicit ABI are deprecated | |
35 | +//[current_feature]~^^ WARN `extern` declarations without an explicit ABI are deprecated | |
36 | +//[future]~^^^ WARN `extern` declarations without an explicit ABI are deprecated | |
37 | +//[future_feature]~^^^^ ERROR `extern` declarations without an explicit ABI are disallowed | |
38 | + | |
39 | +unsafe extern "C" {} | |
40 | +//[current]~^ WARN `extern` declarations without an explicit ABI are deprecated | |
41 | +//[current_feature]~^^ WARN `extern` declarations without an explicit ABI are deprecated | |
42 | +//[future]~^^^ WARN `extern` declarations without an explicit ABI are deprecated | |
43 | +//[future_feature]~^^^^ ERROR `extern` declarations without an explicit ABI are disallowed | |
44 | + | |
45 | +fn main() {} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
1 | +warning: `extern` declarations without an explicit ABI are deprecated | |
2 | + --> $DIR/feature-gate-explicit-extern-abis.rs:27:1 | |
3 | + | | |
4 | +LL | extern fn _foo() {} | |
5 | + | ^^^^^^ help: explicitly specify the "C" ABI: `extern "C"` | |
6 | + | | |
7 | + = note: `#[warn(missing_abi)]` on by default | |
8 | + | |
9 | +warning: `extern` declarations without an explicit ABI are deprecated | |
10 | + --> $DIR/feature-gate-explicit-extern-abis.rs:33:8 | |
11 | + | | |
12 | +LL | unsafe extern fn _bar() {} | |
13 | + | ^^^^^^ help: explicitly specify the "C" ABI: `extern "C"` | |
14 | + | |
15 | +warning: `extern` declarations without an explicit ABI are deprecated | |
16 | + --> $DIR/feature-gate-explicit-extern-abis.rs:39:8 | |
17 | + | | |
18 | +LL | unsafe extern {} | |
19 | + | ^^^^^^ help: explicitly specify the "C" ABI: `extern "C"` | |
20 | + | |
21 | +warning: 3 warnings emitted | |
22 | + |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
1 | +error: `extern` declarations without an explicit ABI are disallowed | |
2 | + --> $DIR/feature-gate-explicit-extern-abis.rs:27:1 | |
3 | + | | |
4 | +LL | extern fn _foo() {} | |
5 | + | ^^^^^^ help: specify an ABI: `extern ""` | |
6 | + | | |
7 | + = help: prior to Rust 2024, a default ABI was inferred | |
8 | + | |
9 | +error: `extern` declarations without an explicit ABI are disallowed | |
10 | + --> $DIR/feature-gate-explicit-extern-abis.rs:33:8 | |
11 | + | | |
12 | +LL | unsafe extern fn _bar() {} | |
13 | + | ^^^^^^ help: specify an ABI: `extern ""` | |
14 | + | | |
15 | + = help: prior to Rust 2024, a default ABI was inferred | |
16 | + | |
17 | +error: `extern` declarations without an explicit ABI are disallowed | |
18 | + --> $DIR/feature-gate-explicit-extern-abis.rs:39:8 | |
19 | + | | |
20 | +LL | unsafe extern {} | |
21 | + | ^^^^^^ help: specify an ABI: `extern ""` | |
22 | + | | |
23 | + = help: prior to Rust 2024, a default ABI was inferred | |
24 | + | |
25 | +error: aborting due to 3 previous errors | |
26 | + |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
1 | +// The purpose of this feature gate is to make something into a hard error in a | |
2 | +// future edition. Consequently, this test differs from most other feature gate | |
3 | +// tests. Instead of verifying that an error occurs when the feature gate is | |
4 | +// missing, it ensures that the hard error is only produced with the feature | |
5 | +// gate is present in the `future` edition -- and otherwise that only a warning | |
6 | +// is emitted. | |
7 | + | |
8 | +//@ revisions: current current_feature future future_feature | |
9 | + | |
10 | +//@ [current] run-rustfix | |
11 | +//@ [current] check-pass | |
12 | + | |
13 | +//@ [current_feature] run-rustfix | |
14 | +//@ [current_feature] check-pass | |
15 | + | |
16 | +//@ [future] edition: future | |
17 | +//@ [future] compile-flags: -Z unstable-options | |
18 | +//@ [future] run-rustfix | |
19 | +//@ [future] check-pass | |
20 | + | |
21 | +//@ [future_feature] edition: future | |
22 | +//@ [future_feature] compile-flags: -Z unstable-options | |
23 | + | |
24 | +#![cfg_attr(future_feature, feature(explicit_extern_abis))] | |
25 | +#![cfg_attr(current_feature, feature(explicit_extern_abis))] | |
26 | + | |
27 | +extern fn _foo() {} | |
28 | +//[current]~^ WARN `extern` declarations without an explicit ABI are deprecated | |
29 | +//[current_feature]~^^ WARN `extern` declarations without an explicit ABI are deprecated | |
30 | +//[future]~^^^ WARN `extern` declarations without an explicit ABI are deprecated | |
31 | +//[future_feature]~^^^^ ERROR `extern` declarations without an explicit ABI are disallowed | |
32 | + | |
33 | +unsafe extern fn _bar() {} | |
34 | +//[current]~^ WARN `extern` declarations without an explicit ABI are deprecated | |
35 | +//[current_feature]~^^ WARN `extern` declarations without an explicit ABI are deprecated | |
36 | +//[future]~^^^ WARN `extern` declarations without an explicit ABI are deprecated | |
37 | +//[future_feature]~^^^^ ERROR `extern` declarations without an explicit ABI are disallowed | |
38 | + | |
39 | +unsafe extern {} | |
40 | +//[current]~^ WARN `extern` declarations without an explicit ABI are deprecated | |
41 | +//[current_feature]~^^ WARN `extern` declarations without an explicit ABI are deprecated | |
42 | +//[future]~^^^ WARN `extern` declarations without an explicit ABI are deprecated | |
43 | +//[future_feature]~^^^^ ERROR `extern` declarations without an explicit ABI are disallowed | |
44 | + | |
45 | +fn main() {} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -2,7 +2,7 @@ | ||
2 | 2 | //@ compile-flags: --crate-type rlib |
3 | 3 | |
4 | 4 | #[link(name = "libfoo.a", kind = "static")] |
5 | -extern { } //~ WARN extern declarations without an explicit ABI are deprecated | |
5 | +extern { } //~ WARN `extern` declarations without an explicit ABI are deprecated | |
6 | 6 | //~| HELP explicitly specify the "C" ABI |
7 | 7 | |
8 | 8 | pub fn main() { } |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
1 | -warning: extern declarations without an explicit ABI are deprecated | |
1 | +warning: `extern` declarations without an explicit ABI are deprecated | |
2 | 2 | --> $DIR/suggest-libname-only-1.rs:5:1 |
3 | 3 | | |
4 | 4 | LL | extern { } |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -2,7 +2,7 @@ | ||
2 | 2 | //@ compile-flags: --crate-type rlib |
3 | 3 | |
4 | 4 | #[link(name = "bar.lib", kind = "static")] |
5 | -extern { } //~ WARN extern declarations without an explicit ABI are deprecated | |
5 | +extern { } //~ WARN `extern` declarations without an explicit ABI are deprecated | |
6 | 6 | //~| HELP explicitly specify the "C" ABI |
7 | 7 | |
8 | 8 | pub fn main() { } |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
1 | -warning: extern declarations without an explicit ABI are deprecated | |
1 | +warning: `extern` declarations without an explicit ABI are deprecated | |
2 | 2 | --> $DIR/suggest-libname-only-2.rs:5:1 |
3 | 3 | | |
4 | 4 | LL | extern { } |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
1 | -error: extern declarations without an explicit ABI are deprecated | |
1 | +error: `extern` declarations without an explicit ABI are deprecated | |
2 | 2 | --> $DIR/cli-lint-override.rs:12:1 |
3 | 3 | | |
4 | 4 | LL | extern fn foo() {} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
1 | -warning: extern declarations without an explicit ABI are deprecated | |
1 | +warning: `extern` declarations without an explicit ABI are deprecated | |
2 | 2 | --> $DIR/cli-lint-override.rs:12:1 |
3 | 3 | | |
4 | 4 | LL | extern fn foo() {} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -10,8 +10,8 @@ | ||
10 | 10 | |
11 | 11 | |
12 | 12 | extern fn foo() {} |
13 | -//[warn_deny]~^ ERROR extern declarations without an explicit ABI are deprecated | |
14 | -//[forbid_warn]~^^ ERROR extern declarations without an explicit ABI are deprecated | |
15 | -//[force_warn_deny]~^^^ WARN extern declarations without an explicit ABI are deprecated | |
13 | +//[warn_deny]~^ ERROR `extern` declarations without an explicit ABI are deprecated | |
14 | +//[forbid_warn]~^^ ERROR `extern` declarations without an explicit ABI are deprecated | |
15 | +//[force_warn_deny]~^^^ WARN `extern` declarations without an explicit ABI are deprecated | |
16 | 16 | |
17 | 17 | fn main() {} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
1 | -error: extern declarations without an explicit ABI are deprecated | |
1 | +error: `extern` declarations without an explicit ABI are deprecated | |
2 | 2 | --> $DIR/cli-lint-override.rs:12:1 |
3 | 3 | | |
4 | 4 | LL | extern fn foo() {} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -51,15 +51,15 @@ LL | #[rustc_layout_scalar_valid_range_start(0suffix)] | ||
51 | 51 | | |
52 | 52 | = help: the suffix must be one of the numeric types (`u32`, `isize`, `f32`, etc.) |
53 | 53 | |
54 | -warning: extern declarations without an explicit ABI are deprecated | |
54 | +warning: `extern` declarations without an explicit ABI are deprecated | |
55 | 55 | --> $DIR/bad-lit-suffixes.rs:3:1 |
56 | 56 | | |
57 | 57 | LL | extern |
58 | 58 | | ^^^^^^ help: explicitly specify the "C" ABI: `extern "C"` |
59 | 59 | | |
60 | 60 | = note: `#[warn(missing_abi)]` on by default |
61 | 61 | |
62 | -warning: extern declarations without an explicit ABI are deprecated | |
62 | +warning: `extern` declarations without an explicit ABI are deprecated | |
63 | 63 | --> $DIR/bad-lit-suffixes.rs:7:1 |
64 | 64 | | |
65 | 65 | LL | extern |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -4,7 +4,7 @@ error: suffixes on string literals are invalid | ||
4 | 4 | LL | f!("Foo"__); |
5 | 5 | | ^^^^^^^ invalid suffix `__` |
6 | 6 | |
7 | -warning: extern declarations without an explicit ABI are deprecated | |
7 | +warning: `extern` declarations without an explicit ABI are deprecated | |
8 | 8 | --> $DIR/lit-err-in-macro.rs:3:9 |
9 | 9 | | |
10 | 10 | LL | extern $abi fn f() {} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -82,7 +82,7 @@ fn bar() { | ||
82 | 82 | } |
83 | 83 | |
84 | 84 | |
85 | -extern { //~ WARN extern declarations without an explicit ABI are deprecated | |
85 | +extern { //~ WARN `extern` declarations without an explicit ABI are deprecated | |
86 | 86 | fn weird_extern() { |
87 | 87 | #![print_target_and_args_consume(tenth)] |
88 | 88 | } |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -22,7 +22,7 @@ error: expected non-macro inner attribute, found attribute macro `print_attr` | ||
22 | 22 | LL | #![print_attr] |
23 | 23 | | ^^^^^^^^^^ not a non-macro inner attribute |
24 | 24 | |
25 | -warning: extern declarations without an explicit ABI are deprecated | |
25 | +warning: `extern` declarations without an explicit ABI are deprecated | |
26 | 26 | --> $DIR/inner-attrs.rs:85:1 |
27 | 27 | | |
28 | 28 | LL | extern { |