Skip to content

Commit

Permalink
Rollup merge of rust-lang#132397 - m-ou-se:warn-missing-abi, r=Nadrieril
Browse files Browse the repository at this point in the history
Make missing_abi lint warn-by-default.

This makes the missing_abi lint warn-by-default, as suggested here: rust-lang/rfcs#3722 (comment)

This needs a lang FCP.
  • Loading branch information
jhpratt authored Jan 15, 2025
2 parents f5864d7 + 9ad75b3 commit 1361c1f
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 12 deletions.
1 change: 1 addition & 0 deletions tests/ui/boxed_local.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ mod issue_3739 {
/// This shouldn't warn for `boxed_local` as it is intended to called from non-Rust code.
pub extern "C" fn do_not_warn_me(_c_pointer: Box<String>) -> () {}

#[allow(missing_abi)]
#[rustfmt::skip] // Forces rustfmt to not add ABI
pub extern fn do_not_warn_me_no_abi(_c_pointer: Box<String>) -> () {}

Expand Down
4 changes: 2 additions & 2 deletions tests/ui/boxed_local.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ LL | pub fn new(_needs_name: Box<PeekableSeekable<&()>>) -> () {}
| ^^^^^^^^^^^

error: local variable doesn't need to be boxed here
--> tests/ui/boxed_local.rs:188:44
--> tests/ui/boxed_local.rs:189:44
|
LL | fn default_impl_x(self: Box<Self>, x: Box<u32>) -> u32 {
| ^

error: local variable doesn't need to be boxed here
--> tests/ui/boxed_local.rs:196:16
--> tests/ui/boxed_local.rs:197:16
|
LL | fn foo(x: Box<u32>) {}
| ^
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/doc/doc-fixable.fixed
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ fn parenthesized_word() {}
/// UXes
fn plural_acronym_test() {}

extern {
extern "C" {
/// `foo()`
fn in_extern();
}
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/doc/doc-fixable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ fn parenthesized_word() {}
/// UXes
fn plural_acronym_test() {}

extern {
extern "C" {
/// foo()
fn in_extern();
}
Expand Down
1 change: 1 addition & 0 deletions tests/ui/missing_const_for_fn/could_be_const.fixed
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ mod msrv {
//~^ ERROR: this could be a `const fn`

#[rustfmt::skip]
#[allow(missing_abi)]
const extern fn implicit_c() {}
//~^ ERROR: this could be a `const fn`

Expand Down
1 change: 1 addition & 0 deletions tests/ui/missing_const_for_fn/could_be_const.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ mod msrv {
//~^ ERROR: this could be a `const fn`

#[rustfmt::skip]
#[allow(missing_abi)]
extern fn implicit_c() {}
//~^ ERROR: this could be a `const fn`

Expand Down
16 changes: 8 additions & 8 deletions tests/ui/missing_const_for_fn/could_be_const.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ LL | const extern "C" fn c() {}
| +++++

error: this could be a `const fn`
--> tests/ui/missing_const_for_fn/could_be_const.rs:152:9
--> tests/ui/missing_const_for_fn/could_be_const.rs:153:9
|
LL | extern fn implicit_c() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^
Expand All @@ -233,7 +233,7 @@ LL | const extern fn implicit_c() {}
| +++++

error: this could be a `const fn`
--> tests/ui/missing_const_for_fn/could_be_const.rs:169:9
--> tests/ui/missing_const_for_fn/could_be_const.rs:170:9
|
LL | / pub fn new(strings: Vec<String>) -> Self {
LL | | Self { strings }
Expand All @@ -246,7 +246,7 @@ LL | pub const fn new(strings: Vec<String>) -> Self {
| +++++

error: this could be a `const fn`
--> tests/ui/missing_const_for_fn/could_be_const.rs:174:9
--> tests/ui/missing_const_for_fn/could_be_const.rs:175:9
|
LL | / pub fn empty() -> Self {
LL | | Self { strings: Vec::new() }
Expand All @@ -259,7 +259,7 @@ LL | pub const fn empty() -> Self {
| +++++

error: this could be a `const fn`
--> tests/ui/missing_const_for_fn/could_be_const.rs:185:9
--> tests/ui/missing_const_for_fn/could_be_const.rs:186:9
|
LL | / pub fn new(text: String) -> Self {
LL | | let vec = Vec::new();
Expand All @@ -273,7 +273,7 @@ LL | pub const fn new(text: String) -> Self {
| +++++

error: this could be a `const fn`
--> tests/ui/missing_const_for_fn/could_be_const.rs:204:5
--> tests/ui/missing_const_for_fn/could_be_const.rs:205:5
|
LL | fn alias_ty_is_projection(bar: <() as FooTrait>::Foo) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand All @@ -284,7 +284,7 @@ LL | const fn alias_ty_is_projection(bar: <() as FooTrait>::Foo) {}
| +++++

error: this could be a `const fn`
--> tests/ui/missing_const_for_fn/could_be_const.rs:208:5
--> tests/ui/missing_const_for_fn/could_be_const.rs:209:5
|
LL | extern "C-unwind" fn c_unwind() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand All @@ -295,7 +295,7 @@ LL | const extern "C-unwind" fn c_unwind() {}
| +++++

error: this could be a `const fn`
--> tests/ui/missing_const_for_fn/could_be_const.rs:210:5
--> tests/ui/missing_const_for_fn/could_be_const.rs:211:5
|
LL | extern "system" fn system() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand All @@ -306,7 +306,7 @@ LL | const extern "system" fn system() {}
| +++++

error: this could be a `const fn`
--> tests/ui/missing_const_for_fn/could_be_const.rs:212:5
--> tests/ui/missing_const_for_fn/could_be_const.rs:213:5
|
LL | extern "system-unwind" fn system_unwind() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down

0 comments on commit 1361c1f

Please sign in to comment.