Skip to content

Commit 90a1e49

Browse files
committed
Mark missing_abi lint as an edition migration lint
1 parent 560e09a commit 90a1e49

16 files changed

+72
-31
lines changed

compiler/rustc_lint_defs/src/builtin.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3546,7 +3546,11 @@ declare_lint! {
35463546
/// [Other ABIs]: https://doc.rust-lang.org/reference/items/external-blocks.html#abi
35473547
pub MISSING_ABI,
35483548
Warn,
3549-
"No declared ABI for extern declaration"
3549+
"No declared ABI for extern declaration",
3550+
@future_incompatible = FutureIncompatibleInfo {
3551+
reason: FutureIncompatibilityReason::EditionError(Edition::EditionFuture),
3552+
reference: "issue #134986 <https://github.com/rust-lang/rust/issues/134986>",
3553+
};
35503554
}
35513555

35523556
declare_lint! {

src/tools/lint-docs/src/groups.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ static GROUP_DESCRIPTIONS: &[(&str, &str)] = &[
1717
("rust-2018-compatibility", "Lints used to transition code from the 2015 edition to 2018"),
1818
("rust-2021-compatibility", "Lints used to transition code from the 2018 edition to 2021"),
1919
("rust-2024-compatibility", "Lints used to transition code from the 2021 edition to 2024"),
20+
("edition-future-compatibility", "Lints used to transition code to the future edition"),
2021
(
2122
"refining-impl-trait",
2223
"Detects refinement of `impl Trait` return types by trait implementations",
Lines changed: 8 additions & 0 deletions
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() {}
Lines changed: 2 additions & 0 deletions
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

Lines changed: 3 additions & 1 deletion
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

Lines changed: 2 additions & 0 deletions
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

Lines changed: 2 additions & 0 deletions
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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
error: extern declarations without an explicit ABI are deprecated
2-
--> $DIR/cli-lint-override.rs:12:1
2+
--> $DIR/cli-lint-override.rs:11: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: 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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
warning: extern declarations without an explicit ABI are deprecated
2-
--> $DIR/cli-lint-override.rs:12:1
2+
--> $DIR/cli-lint-override.rs:11: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: requested on the command line with `--force-warn missing-abi`
810

911
warning: 1 warning emitted

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,12 @@
88
//@[force_warn_deny] compile-flags: --force-warn missing_abi --allow missing_abi
99
//@[force_warn_deny] check-pass
1010

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

1719
fn main() {}

0 commit comments

Comments
 (0)