forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Add test for issue 47446 - Implement the new lint lint_builtin_mixed_export_name_and_no_mangle - Add suggestion how to fix it
- Loading branch information
Showing
9 changed files
with
143 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// issue: rust-lang/rust#47446 | ||
//@ run-rustfix | ||
//@ check-pass | ||
|
||
#![warn(unused_attributes)] | ||
//~^ WARN `#[no_mangle]` attribute may not be used in combination with `#[export_name]` [unused_attributes] | ||
#[export_name = "foo"] | ||
pub fn bar() {} | ||
|
||
//~^ WARN `#[unsafe(no_mangle)]` attribute may not be used in combination with `#[export_name]` [unused_attributes] | ||
#[export_name = "baz"] | ||
pub fn bak() {} | ||
|
||
fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// issue: rust-lang/rust#47446 | ||
//@ run-rustfix | ||
//@ check-pass | ||
|
||
#![warn(unused_attributes)] | ||
#[no_mangle] | ||
//~^ WARN `#[no_mangle]` attribute may not be used in combination with `#[export_name]` [unused_attributes] | ||
#[export_name = "foo"] | ||
pub fn bar() {} | ||
|
||
#[unsafe(no_mangle)] | ||
//~^ WARN `#[unsafe(no_mangle)]` attribute may not be used in combination with `#[export_name]` [unused_attributes] | ||
#[export_name = "baz"] | ||
pub fn bak() {} | ||
|
||
fn main() {} |
39 changes: 39 additions & 0 deletions
39
tests/ui/attributes/mixed_export_name_and_no_mangle.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
warning: `#[no_mangle]` attribute may not be used in combination with `#[export_name]` | ||
--> $DIR/mixed_export_name_and_no_mangle.rs:6:1 | ||
| | ||
LL | #[no_mangle] | ||
| ^^^^^^^^^^^^ `#[no_mangle]` is ignored | ||
| | ||
note: `#[export_name]` takes precedence | ||
--> $DIR/mixed_export_name_and_no_mangle.rs:8:1 | ||
| | ||
LL | #[export_name = "foo"] | ||
| ^^^^^^^^^^^^^^^^^^^^^^ | ||
note: the lint level is defined here | ||
--> $DIR/mixed_export_name_and_no_mangle.rs:5:9 | ||
| | ||
LL | #![warn(unused_attributes)] | ||
| ^^^^^^^^^^^^^^^^^ | ||
help: remove the `#[no_mangle]` attribute | ||
| | ||
LL - #[no_mangle] | ||
| | ||
|
||
warning: `#[unsafe(no_mangle)]` attribute may not be used in combination with `#[export_name]` | ||
--> $DIR/mixed_export_name_and_no_mangle.rs:11:1 | ||
| | ||
LL | #[unsafe(no_mangle)] | ||
| ^^^^^^^^^^^^^^^^^^^^ `#[unsafe(no_mangle)]` is ignored | ||
| | ||
note: `#[export_name]` takes precedence | ||
--> $DIR/mixed_export_name_and_no_mangle.rs:13:1 | ||
| | ||
LL | #[export_name = "baz"] | ||
| ^^^^^^^^^^^^^^^^^^^^^^ | ||
help: remove the `#[unsafe(no_mangle)]` attribute | ||
| | ||
LL - #[unsafe(no_mangle)] | ||
| | ||
|
||
warning: 2 warnings emitted | ||
|