diff options
| author | Jubilee <workingjubilee@gmail.com> | 2024-10-31 17:50:41 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-10-31 17:50:41 -0700 |
| commit | 6b0c8cfedc9623abc16596f17ed7582f1c288380 (patch) | |
| tree | 6f7322b4ab2fb68d59a60dc0ae36ba61440f5e4f /compiler/rustc_parse/src/parser | |
| parent | 121916997037b44877cc55c30c1915d3cb0f3764 (diff) | |
| parent | a433ea2518e18f3beda9bfdd11dc104e40eaa9ac (diff) | |
| download | rust-6b0c8cfedc9623abc16596f17ed7582f1c288380.tar.gz rust-6b0c8cfedc9623abc16596f17ed7582f1c288380.zip | |
Rollup merge of #132357 - m-ou-se:explicit-abi, r=compiler-errors
Improve missing_abi lint
This is for the migration lint for https://github.com/rust-lang/rfcs/pull/3722
It is not yet marked as an edition migration lint, because `Edition2027` doesn't exist yet.
The lint now includes a machine applicable suggestion:
```
warning: extern declarations without an explicit ABI are deprecated
--> src/main.rs:3:1
|
3 | extern fn a() {}
| ^^^^^^ help: explicitly specify the C ABI: `extern "C"`
|
```
Diffstat (limited to 'compiler/rustc_parse/src/parser')
| -rw-r--r-- | compiler/rustc_parse/src/parser/item.rs | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/compiler/rustc_parse/src/parser/item.rs b/compiler/rustc_parse/src/parser/item.rs index 36733726564..6b4e2d0f4e2 100644 --- a/compiler/rustc_parse/src/parser/item.rs +++ b/compiler/rustc_parse/src/parser/item.rs @@ -1194,6 +1194,7 @@ impl<'a> Parser<'a> { attrs: &mut AttrVec, mut safety: Safety, ) -> PResult<'a, ItemInfo> { + let extern_span = self.prev_token.uninterpolated_span(); let abi = self.parse_abi(); // ABI? // FIXME: This recovery should be tested better. if safety == Safety::Default @@ -1205,6 +1206,7 @@ impl<'a> Parser<'a> { let _ = self.eat_keyword(kw::Unsafe); } let module = ast::ForeignMod { + extern_span, safety, abi, items: self.parse_item_list(attrs, |p| p.parse_foreign_item(ForceCollect::No))?, |
