Add error if link_ordinal used without raw-dylib

This commit is contained in:
Daniel Paoliello 2022-08-02 10:33:27 -07:00
parent 6d3f1beae1
commit fda5144ceb
3 changed files with 66 additions and 1 deletions

View file

@ -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() {}

View file

@ -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