Skip to content

Commit df735f8

Browse files
committed
Mark missing_abi lint as an edition migration lint
1 parent bea5f89 commit df735f8

16 files changed

+71
-27
lines changed

compiler/rustc_lint_defs/src/builtin.rs

+7-1
Original file line numberDiff line numberDiff line change
@@ -3544,9 +3544,15 @@ declare_lint! {
35443544
/// easily makes code review easier.
35453545
///
35463546
/// [Other ABIs]: https://doc.rust-lang.org/reference/items/external-blocks.html#abi
3547+
/// [issue #134986]: https://github.com/rust-lang/rust/issues/134986
3548+
/// [`cargo fix`]: https://doc.rust-lang.org/cargo/commands/cargo-fix.html
35473549
pub MISSING_ABI,
35483550
Warn,
3549-
"No declared ABI for extern declaration"
3551+
"No declared ABI for extern declaration",
3552+
@future_incompatible = FutureIncompatibleInfo {
3553+
reason: FutureIncompatibilityReason::EditionError(Edition::EditionFuture),
3554+
reference: "issue #134986 <https://github.com/rust-lang/rust/issues/134986>",
3555+
};
35503556
}
35513557

35523558
declare_lint! {

feature-gate-explicit-extern-abis

3.78 MB
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
//@ run-pass
2+
//@ run-rustfix
3+
4+
extern "C" fn _foo() {}
5+
//~^ WARN extern declarations without an explicit ABI are deprecated
6+
//~^^ WARN this is accepted in the current edition (Rust 2015) but is a hard error in Rust future!
7+
8+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
//@ run-pass
2+
//@ run-rustfix
23

34
extern fn _foo() {}
45
//~^ WARN extern declarations without an explicit ABI are deprecated
6+
//~^^ WARN this is accepted in the current edition (Rust 2015) but is a hard error in Rust future!
57

68
fn main() {}

tests/ui/feature-gates/feature-gate-explicit-extern-abis.stderr

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
warning: extern declarations without an explicit ABI are deprecated
2-
--> $DIR/feature-gate-explicit-extern-abis.rs:3:1
2+
--> $DIR/feature-gate-explicit-extern-abis.rs:4:1
33
|
44
LL | extern fn _foo() {}
55
| ^^^^^^ help: explicitly specify the "C" ABI: `extern "C"`
66
|
7+
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust future!
8+
= note: for more information, see issue #134986 <https://github.com/rust-lang/rust/issues/134986>
79
= note: `#[warn(missing_abi)]` on by default
810

911
warning: 1 warning emitted

tests/ui/link-native-libs/suggest-libname-only-1.stderr

+2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ warning: extern declarations without an explicit ABI are deprecated
44
LL | extern { }
55
| ^^^^^^ help: explicitly specify the "C" ABI: `extern "C"`
66
|
7+
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust future!
8+
= note: for more information, see issue #134986 <https://github.com/rust-lang/rust/issues/134986>
79
= note: `#[warn(missing_abi)]` on by default
810

911
error: could not find native static library `libfoo.a`, perhaps an -L flag is missing?

tests/ui/link-native-libs/suggest-libname-only-2.stderr

+2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ warning: extern declarations without an explicit ABI are deprecated
44
LL | extern { }
55
| ^^^^^^ help: explicitly specify the "C" ABI: `extern "C"`
66
|
7+
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust future!
8+
= note: for more information, see issue #134986 <https://github.com/rust-lang/rust/issues/134986>
79
= note: `#[warn(missing_abi)]` on by default
810

911
error: could not find native static library `bar.lib`, perhaps an -L flag is missing?

tests/ui/lint/cli-lint-override.forbid_warn.stderr

+2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ error: extern declarations without an explicit ABI are deprecated
44
LL | extern fn foo() {}
55
| ^^^^^^ help: explicitly specify the "C" ABI: `extern "C"`
66
|
7+
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust future!
8+
= note: for more information, see issue #134986 <https://github.com/rust-lang/rust/issues/134986>
79
= note: requested on the command line with `-F missing-abi`
810

911
error: aborting due to 1 previous error

tests/ui/lint/cli-lint-override.force_warn_deny.stderr

+2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ warning: extern declarations without an explicit ABI are deprecated
44
LL | extern fn foo() {}
55
| ^^^^^^ help: explicitly specify the "C" ABI: `extern "C"`
66
|
7+
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust future!
8+
= note: for more information, see issue #134986 <https://github.com/rust-lang/rust/issues/134986>
79
= note: requested on the command line with `--force-warn missing-abi`
810

911
warning: 1 warning emitted

tests/ui/lint/cli-lint-override.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@
1111

1212
extern fn foo() {}
1313
//[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
14+
//[warn_deny]~^^ WARN this is accepted in the current edition (Rust 2015) but is a hard error in Rust future!
15+
//[forbid_warn]~^^^ ERROR extern declarations without an explicit ABI are deprecated
16+
//[forbid_warn]~^^^^ WARN this is accepted in the current edition (Rust 2015) but is a hard error in Rust future!
17+
//[force_warn_deny]~^^^^^ WARN extern declarations without an explicit ABI are deprecated
18+
//[force_warn_deny]~^^^^^^ WARN this is accepted in the current edition (Rust 2015) but is a hard error in Rust future!
19+
1620

1721
fn main() {}

tests/ui/lint/cli-lint-override.warn_deny.stderr

+2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ error: extern declarations without an explicit ABI are deprecated
44
LL | extern fn foo() {}
55
| ^^^^^^ help: explicitly specify the "C" ABI: `extern "C"`
66
|
7+
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust future!
8+
= note: for more information, see issue #134986 <https://github.com/rust-lang/rust/issues/134986>
79
= note: requested on the command line with `-D missing-abi`
810

911
error: aborting due to 1 previous error

tests/ui/parser/bad-lit-suffixes.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
#![feature(rustc_attrs)]
22

33
extern //~ WARN missing_abi
4+
//~^ WARN this is accepted in the current edition (Rust 2015) but is a hard error in Rust future!
45
"C"suffix //~ ERROR suffixes on string literals are invalid
56
fn foo() {}
67

78
extern //~ WARN missing_abi
9+
//~^ WARN this is accepted in the current edition (Rust 2015) but is a hard error in Rust future!
810
"C"suffix //~ ERROR suffixes on string literals are invalid
911
{}
1012

tests/ui/parser/bad-lit-suffixes.stderr

+27-22
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
11
error: suffixes on string literals are invalid
2-
--> $DIR/bad-lit-suffixes.rs:4:5
2+
--> $DIR/bad-lit-suffixes.rs:5:5
33
|
44
LL | "C"suffix
55
| ^^^^^^^^^ invalid suffix `suffix`
66

77
error: suffixes on string literals are invalid
8-
--> $DIR/bad-lit-suffixes.rs:8:5
8+
--> $DIR/bad-lit-suffixes.rs:10:5
99
|
1010
LL | "C"suffix
1111
| ^^^^^^^^^ invalid suffix `suffix`
1212

1313
error: suffixes on string literals are invalid
14-
--> $DIR/bad-lit-suffixes.rs:30:17
14+
--> $DIR/bad-lit-suffixes.rs:32:17
1515
|
1616
LL | #[rustc_dummy = "string"suffix]
1717
| ^^^^^^^^^^^^^^ invalid suffix `suffix`
1818

1919
error: suffixes on string literals are invalid
20-
--> $DIR/bad-lit-suffixes.rs:34:14
20+
--> $DIR/bad-lit-suffixes.rs:36:14
2121
|
2222
LL | #[must_use = "string"suffix]
2323
| ^^^^^^^^^^^^^^ invalid suffix `suffix`
2424

2525
error: malformed `must_use` attribute input
26-
--> $DIR/bad-lit-suffixes.rs:34:1
26+
--> $DIR/bad-lit-suffixes.rs:36:1
2727
|
2828
LL | #[must_use = "string"suffix]
2929
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -38,13 +38,13 @@ LL + #[must_use]
3838
|
3939

4040
error: suffixes on string literals are invalid
41-
--> $DIR/bad-lit-suffixes.rs:39:15
41+
--> $DIR/bad-lit-suffixes.rs:41:15
4242
|
4343
LL | #[link(name = "string"suffix)]
4444
| ^^^^^^^^^^^^^^ invalid suffix `suffix`
4545

4646
error: invalid suffix `suffix` for number literal
47-
--> $DIR/bad-lit-suffixes.rs:43:41
47+
--> $DIR/bad-lit-suffixes.rs:45:41
4848
|
4949
LL | #[rustc_layout_scalar_valid_range_start(0suffix)]
5050
| ^^^^^^^ invalid suffix `suffix`
@@ -57,108 +57,113 @@ warning: extern declarations without an explicit ABI are deprecated
5757
LL | extern
5858
| ^^^^^^ help: explicitly specify the "C" ABI: `extern "C"`
5959
|
60+
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust future!
61+
= note: for more information, see issue #134986 <https://github.com/rust-lang/rust/issues/134986>
6062
= note: `#[warn(missing_abi)]` on by default
6163

6264
warning: extern declarations without an explicit ABI are deprecated
63-
--> $DIR/bad-lit-suffixes.rs:7:1
65+
--> $DIR/bad-lit-suffixes.rs:8:1
6466
|
6567
LL | extern
6668
| ^^^^^^ help: explicitly specify the "C" ABI: `extern "C"`
69+
|
70+
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust future!
71+
= note: for more information, see issue #134986 <https://github.com/rust-lang/rust/issues/134986>
6772

6873
error: suffixes on string literals are invalid
69-
--> $DIR/bad-lit-suffixes.rs:12:5
74+
--> $DIR/bad-lit-suffixes.rs:14:5
7075
|
7176
LL | ""suffix;
7277
| ^^^^^^^^ invalid suffix `suffix`
7378

7479
error: suffixes on byte string literals are invalid
75-
--> $DIR/bad-lit-suffixes.rs:13:5
80+
--> $DIR/bad-lit-suffixes.rs:15:5
7681
|
7782
LL | b""suffix;
7883
| ^^^^^^^^^ invalid suffix `suffix`
7984

8085
error: suffixes on string literals are invalid
81-
--> $DIR/bad-lit-suffixes.rs:14:5
86+
--> $DIR/bad-lit-suffixes.rs:16:5
8287
|
8388
LL | r#""#suffix;
8489
| ^^^^^^^^^^^ invalid suffix `suffix`
8590

8691
error: suffixes on byte string literals are invalid
87-
--> $DIR/bad-lit-suffixes.rs:15:5
92+
--> $DIR/bad-lit-suffixes.rs:17:5
8893
|
8994
LL | br#""#suffix;
9095
| ^^^^^^^^^^^^ invalid suffix `suffix`
9196

9297
error: suffixes on char literals are invalid
93-
--> $DIR/bad-lit-suffixes.rs:16:5
98+
--> $DIR/bad-lit-suffixes.rs:18:5
9499
|
95100
LL | 'a'suffix;
96101
| ^^^^^^^^^ invalid suffix `suffix`
97102

98103
error: suffixes on byte literals are invalid
99-
--> $DIR/bad-lit-suffixes.rs:17:5
104+
--> $DIR/bad-lit-suffixes.rs:19:5
100105
|
101106
LL | b'a'suffix;
102107
| ^^^^^^^^^^ invalid suffix `suffix`
103108

104109
error: invalid width `1024` for integer literal
105-
--> $DIR/bad-lit-suffixes.rs:19:5
110+
--> $DIR/bad-lit-suffixes.rs:21:5
106111
|
107112
LL | 1234u1024;
108113
| ^^^^^^^^^
109114
|
110115
= help: valid widths are 8, 16, 32, 64 and 128
111116

112117
error: invalid width `1024` for integer literal
113-
--> $DIR/bad-lit-suffixes.rs:20:5
118+
--> $DIR/bad-lit-suffixes.rs:22:5
114119
|
115120
LL | 1234i1024;
116121
| ^^^^^^^^^
117122
|
118123
= help: valid widths are 8, 16, 32, 64 and 128
119124

120125
error: invalid width `1024` for float literal
121-
--> $DIR/bad-lit-suffixes.rs:21:5
126+
--> $DIR/bad-lit-suffixes.rs:23:5
122127
|
123128
LL | 1234f1024;
124129
| ^^^^^^^^^
125130
|
126131
= help: valid widths are 32 and 64
127132

128133
error: invalid width `1024` for float literal
129-
--> $DIR/bad-lit-suffixes.rs:22:5
134+
--> $DIR/bad-lit-suffixes.rs:24:5
130135
|
131136
LL | 1234.5f1024;
132137
| ^^^^^^^^^^^
133138
|
134139
= help: valid widths are 32 and 64
135140

136141
error: invalid suffix `suffix` for number literal
137-
--> $DIR/bad-lit-suffixes.rs:24:5
142+
--> $DIR/bad-lit-suffixes.rs:26:5
138143
|
139144
LL | 1234suffix;
140145
| ^^^^^^^^^^ invalid suffix `suffix`
141146
|
142147
= help: the suffix must be one of the numeric types (`u32`, `isize`, `f32`, etc.)
143148

144149
error: invalid suffix `suffix` for number literal
145-
--> $DIR/bad-lit-suffixes.rs:25:5
150+
--> $DIR/bad-lit-suffixes.rs:27:5
146151
|
147152
LL | 0b101suffix;
148153
| ^^^^^^^^^^^ invalid suffix `suffix`
149154
|
150155
= help: the suffix must be one of the numeric types (`u32`, `isize`, `f32`, etc.)
151156

152157
error: invalid suffix `suffix` for float literal
153-
--> $DIR/bad-lit-suffixes.rs:26:5
158+
--> $DIR/bad-lit-suffixes.rs:28:5
154159
|
155160
LL | 1.0suffix;
156161
| ^^^^^^^^^ invalid suffix `suffix`
157162
|
158163
= help: valid suffixes are `f32` and `f64`
159164

160165
error: invalid suffix `suffix` for float literal
161-
--> $DIR/bad-lit-suffixes.rs:27:5
166+
--> $DIR/bad-lit-suffixes.rs:29:5
162167
|
163168
LL | 1.0e10suffix;
164169
| ^^^^^^^^^^^^ invalid suffix `suffix`

tests/ui/parser/lit-err-in-macro.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
macro_rules! f {
22
($abi:literal) => {
33
extern $abi fn f() {} //~ WARN missing_abi
4+
//~^ WARN this is accepted in the current edition (Rust 2015) but is a hard error in Rust future!
45
}
56
}
67

tests/ui/parser/lit-err-in-macro.stderr

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: suffixes on string literals are invalid
2-
--> $DIR/lit-err-in-macro.rs:7:4
2+
--> $DIR/lit-err-in-macro.rs:8:4
33
|
44
LL | f!("Foo"__);
55
| ^^^^^^^ invalid suffix `__`
@@ -13,6 +13,8 @@ LL | extern $abi fn f() {}
1313
LL | f!("Foo"__);
1414
| ----------- in this macro invocation
1515
|
16+
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust future!
17+
= note: for more information, see issue #134986 <https://github.com/rust-lang/rust/issues/134986>
1618
= note: `#[warn(missing_abi)]` on by default
1719
= note: this warning originates in the macro `f` (in Nightly builds, run with -Z macro-backtrace for more info)
1820

tests/ui/proc-macro/inner-attrs.stderr

+2
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ warning: extern declarations without an explicit ABI are deprecated
2828
LL | extern {
2929
| ^^^^^^ help: explicitly specify the "C" ABI: `extern "C"`
3030
|
31+
= warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust future!
32+
= note: for more information, see issue #134986 <https://github.com/rust-lang/rust/issues/134986>
3133
= note: `#[warn(missing_abi)]` on by default
3234

3335
error: aborting due to 4 previous errors; 1 warning emitted

0 commit comments

Comments
 (0)