-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of #100069 - dpaoliello:linkordinal, r=michaelwoerister
Add error if link_ordinal used with unsupported link kind The `link_ordinal` attribute only has an affect if the `raw-dylib` link kind is used, so add an error if it is used with any other link kind.
- Loading branch information
Showing
3 changed files
with
66 additions
and
1 deletion.
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
18 changes: 18 additions & 0 deletions
18
src/test/ui/rfc-2627-raw-dylib/link-ordinal-unsupported-link-kind.rs
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,18 @@ | ||
#![feature(raw_dylib)] | ||
//~^ WARN the feature `raw_dylib` is incomplete | ||
|
||
#[link(name = "foo")] | ||
extern "C" { | ||
#[link_ordinal(3)] | ||
//~^ ERROR `#[link_ordinal]` is only supported if link kind is `raw-dylib` | ||
fn foo(); | ||
} | ||
|
||
#[link(name = "bar", kind = "static")] | ||
extern "C" { | ||
#[link_ordinal(3)] | ||
//~^ ERROR `#[link_ordinal]` is only supported if link kind is `raw-dylib` | ||
fn bar(); | ||
} | ||
|
||
fn main() {} |
23 changes: 23 additions & 0 deletions
23
src/test/ui/rfc-2627-raw-dylib/link-ordinal-unsupported-link-kind.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,23 @@ | ||
warning: the feature `raw_dylib` is incomplete and may not be safe to use and/or cause compiler crashes | ||
--> $DIR/link-ordinal-unsupported-link-kind.rs:1:12 | ||
| | ||
LL | #![feature(raw_dylib)] | ||
| ^^^^^^^^^ | ||
| | ||
= note: `#[warn(incomplete_features)]` on by default | ||
= note: see issue #58713 <https://github.com/rust-lang/rust/issues/58713> for more information | ||
|
||
error: `#[link_ordinal]` is only supported if link kind is `raw-dylib` | ||
--> $DIR/link-ordinal-unsupported-link-kind.rs:6:5 | ||
| | ||
LL | #[link_ordinal(3)] | ||
| ^^^^^^^^^^^^^^^^^^ | ||
|
||
error: `#[link_ordinal]` is only supported if link kind is `raw-dylib` | ||
--> $DIR/link-ordinal-unsupported-link-kind.rs:13:5 | ||
| | ||
LL | #[link_ordinal(3)] | ||
| ^^^^^^^^^^^^^^^^^^ | ||
|
||
error: aborting due to 2 previous errors; 1 warning emitted | ||
|