diff options
Diffstat (limited to 'src/test/ui/rfc-2627-raw-dylib')
32 files changed, 252 insertions, 92 deletions
diff --git a/src/test/ui/rfc-2627-raw-dylib/import-name-type-invalid-format.rs b/src/test/ui/rfc-2627-raw-dylib/import-name-type-invalid-format.rs new file mode 100644 index 000000000..22d57f8be --- /dev/null +++ b/src/test/ui/rfc-2627-raw-dylib/import-name-type-invalid-format.rs @@ -0,0 +1,9 @@ +// only-windows +// only-x86 +#![feature(raw_dylib)] + +#[link(name = "foo", kind = "raw-dylib", import_name_type = 6)] +//~^ ERROR import name type must be of the form `import_name_type = "string"` +extern "C" { } + +fn main() {} diff --git a/src/test/ui/rfc-2627-raw-dylib/import-name-type-invalid-format.stderr b/src/test/ui/rfc-2627-raw-dylib/import-name-type-invalid-format.stderr new file mode 100644 index 000000000..0e95fec29 --- /dev/null +++ b/src/test/ui/rfc-2627-raw-dylib/import-name-type-invalid-format.stderr @@ -0,0 +1,8 @@ +error: import name type must be of the form `import_name_type = "string"` + --> $DIR/import-name-type-invalid-format.rs:5:42 + | +LL | #[link(name = "foo", kind = "raw-dylib", import_name_type = 6)] + | ^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/src/test/ui/rfc-2627-raw-dylib/import-name-type-multiple.rs b/src/test/ui/rfc-2627-raw-dylib/import-name-type-multiple.rs new file mode 100644 index 000000000..7ccb0082f --- /dev/null +++ b/src/test/ui/rfc-2627-raw-dylib/import-name-type-multiple.rs @@ -0,0 +1,10 @@ +// ignore-tidy-linelength +// only-windows +// only-x86 +#![feature(raw_dylib)] + +#[link(name = "foo", kind = "raw-dylib", import_name_type = "decorated", import_name_type = "decorated")] +//~^ ERROR multiple `import_name_type` arguments in a single `#[link]` attribute +extern "C" { } + +fn main() {} diff --git a/src/test/ui/rfc-2627-raw-dylib/import-name-type-multiple.stderr b/src/test/ui/rfc-2627-raw-dylib/import-name-type-multiple.stderr new file mode 100644 index 000000000..7c0e0be91 --- /dev/null +++ b/src/test/ui/rfc-2627-raw-dylib/import-name-type-multiple.stderr @@ -0,0 +1,8 @@ +error: multiple `import_name_type` arguments in a single `#[link]` attribute + --> $DIR/import-name-type-multiple.rs:6:74 + | +LL | #[link(name = "foo", kind = "raw-dylib", import_name_type = "decorated", import_name_type = "decorated")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/src/test/ui/rfc-2627-raw-dylib/import-name-type-unknown-value.rs b/src/test/ui/rfc-2627-raw-dylib/import-name-type-unknown-value.rs new file mode 100644 index 000000000..f728a578d --- /dev/null +++ b/src/test/ui/rfc-2627-raw-dylib/import-name-type-unknown-value.rs @@ -0,0 +1,9 @@ +// only-windows +// only-x86 +#![feature(raw_dylib)] + +#[link(name = "foo", kind = "raw-dylib", import_name_type = "unknown")] +//~^ ERROR unknown import name type `unknown`, expected one of: decorated, noprefix, undecorated +extern "C" { } + +fn main() {} diff --git a/src/test/ui/rfc-2627-raw-dylib/import-name-type-unknown-value.stderr b/src/test/ui/rfc-2627-raw-dylib/import-name-type-unknown-value.stderr new file mode 100644 index 000000000..2b299f2fe --- /dev/null +++ b/src/test/ui/rfc-2627-raw-dylib/import-name-type-unknown-value.stderr @@ -0,0 +1,8 @@ +error: unknown import name type `unknown`, expected one of: decorated, noprefix, undecorated + --> $DIR/import-name-type-unknown-value.rs:5:42 + | +LL | #[link(name = "foo", kind = "raw-dylib", import_name_type = "unknown")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/src/test/ui/rfc-2627-raw-dylib/import-name-type-unsupported-link-kind.rs b/src/test/ui/rfc-2627-raw-dylib/import-name-type-unsupported-link-kind.rs new file mode 100644 index 000000000..ae9207864 --- /dev/null +++ b/src/test/ui/rfc-2627-raw-dylib/import-name-type-unsupported-link-kind.rs @@ -0,0 +1,17 @@ +// only-windows +// only-x86 +#![feature(raw_dylib)] + +#[link(name = "foo", import_name_type = "decorated")] +//~^ ERROR import name type can only be used with link kind `raw-dylib` +extern "C" { } + +#[link(name = "bar", kind = "static", import_name_type = "decorated")] +//~^ ERROR import name type can only be used with link kind `raw-dylib` +extern "C" { } + +// Specifying `import_name_type` before `kind` shouldn't raise an error. +#[link(name = "bar", import_name_type = "decorated", kind = "raw-dylib")] +extern "C" { } + +fn main() {} diff --git a/src/test/ui/rfc-2627-raw-dylib/import-name-type-unsupported-link-kind.stderr b/src/test/ui/rfc-2627-raw-dylib/import-name-type-unsupported-link-kind.stderr new file mode 100644 index 000000000..5898cd875 --- /dev/null +++ b/src/test/ui/rfc-2627-raw-dylib/import-name-type-unsupported-link-kind.stderr @@ -0,0 +1,14 @@ +error: import name type can only be used with link kind `raw-dylib` + --> $DIR/import-name-type-unsupported-link-kind.rs:5:22 + | +LL | #[link(name = "foo", import_name_type = "decorated")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: import name type can only be used with link kind `raw-dylib` + --> $DIR/import-name-type-unsupported-link-kind.rs:9:39 + | +LL | #[link(name = "bar", kind = "static", import_name_type = "decorated")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/rfc-2627-raw-dylib/import-name-type-x86-only.rs b/src/test/ui/rfc-2627-raw-dylib/import-name-type-x86-only.rs new file mode 100644 index 000000000..346ea18a8 --- /dev/null +++ b/src/test/ui/rfc-2627-raw-dylib/import-name-type-x86-only.rs @@ -0,0 +1,7 @@ +// only-windows +// ignore-x86 +#[link(name = "foo", kind = "raw-dylib", import_name_type = "decorated")] +//~^ ERROR import name type is only supported on x86 +extern "C" { } + +fn main() {} diff --git a/src/test/ui/rfc-2627-raw-dylib/import-name-type-x86-only.stderr b/src/test/ui/rfc-2627-raw-dylib/import-name-type-x86-only.stderr new file mode 100644 index 000000000..b56449299 --- /dev/null +++ b/src/test/ui/rfc-2627-raw-dylib/import-name-type-x86-only.stderr @@ -0,0 +1,8 @@ +error: import name type is only supported on x86 + --> $DIR/import-name-type-x86-only.rs:3:42 + | +LL | #[link(name = "foo", kind = "raw-dylib", import_name_type = "decorated")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/src/test/ui/rfc-2627-raw-dylib/link-ordinal-and-name.rs b/src/test/ui/rfc-2627-raw-dylib/link-ordinal-and-name.rs index 42685cad9..1a128c87a 100644 --- a/src/test/ui/rfc-2627-raw-dylib/link-ordinal-and-name.rs +++ b/src/test/ui/rfc-2627-raw-dylib/link-ordinal-and-name.rs @@ -1,5 +1,4 @@ -#![feature(raw_dylib)] -//~^ WARN the feature `raw_dylib` is incomplete +#![cfg_attr(target_arch = "x86", feature(raw_dylib))] #[link(name="foo")] extern "C" { @@ -7,6 +6,10 @@ extern "C" { #[link_ordinal(42)] //~^ ERROR cannot use `#[link_name]` with `#[link_ordinal]` fn foo(); + #[link_name="foo"] + #[link_ordinal(5)] + //~^ ERROR cannot use `#[link_name]` with `#[link_ordinal]` + static mut imported_variable: i32; } fn main() {} diff --git a/src/test/ui/rfc-2627-raw-dylib/link-ordinal-and-name.stderr b/src/test/ui/rfc-2627-raw-dylib/link-ordinal-and-name.stderr index 5d8545b50..481a06d27 100644 --- a/src/test/ui/rfc-2627-raw-dylib/link-ordinal-and-name.stderr +++ b/src/test/ui/rfc-2627-raw-dylib/link-ordinal-and-name.stderr @@ -1,17 +1,14 @@ -warning: the feature `raw_dylib` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/link-ordinal-and-name.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: cannot use `#[link_name]` with `#[link_ordinal]` - --> $DIR/link-ordinal-and-name.rs:7:5 + --> $DIR/link-ordinal-and-name.rs:6:5 | LL | #[link_ordinal(42)] | ^^^^^^^^^^^^^^^^^^^ -error: aborting due to previous error; 1 warning emitted +error: cannot use `#[link_name]` with `#[link_ordinal]` + --> $DIR/link-ordinal-and-name.rs:10:5 + | +LL | #[link_ordinal(5)] + | ^^^^^^^^^^^^^^^^^^ + +error: aborting due to 2 previous errors diff --git a/src/test/ui/rfc-2627-raw-dylib/link-ordinal-invalid-format.rs b/src/test/ui/rfc-2627-raw-dylib/link-ordinal-invalid-format.rs index 135f5909e..7c8da050c 100644 --- a/src/test/ui/rfc-2627-raw-dylib/link-ordinal-invalid-format.rs +++ b/src/test/ui/rfc-2627-raw-dylib/link-ordinal-invalid-format.rs @@ -1,11 +1,13 @@ -#![feature(raw_dylib)] -//~^ WARN the feature `raw_dylib` is incomplete +#![cfg_attr(target_arch = "x86", feature(raw_dylib))] #[link(name = "foo")] extern "C" { #[link_ordinal("JustMonika")] //~^ ERROR illegal ordinal format in `link_ordinal` fn foo(); + #[link_ordinal("JustMonika")] + //~^ ERROR illegal ordinal format in `link_ordinal` + static mut imported_variable: i32; } fn main() {} diff --git a/src/test/ui/rfc-2627-raw-dylib/link-ordinal-invalid-format.stderr b/src/test/ui/rfc-2627-raw-dylib/link-ordinal-invalid-format.stderr index 8453a3966..55cdcad75 100644 --- a/src/test/ui/rfc-2627-raw-dylib/link-ordinal-invalid-format.stderr +++ b/src/test/ui/rfc-2627-raw-dylib/link-ordinal-invalid-format.stderr @@ -1,19 +1,18 @@ -warning: the feature `raw_dylib` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/link-ordinal-invalid-format.rs:1:12 +error: illegal ordinal format in `link_ordinal` + --> $DIR/link-ordinal-invalid-format.rs:5:5 | -LL | #![feature(raw_dylib)] - | ^^^^^^^^^ +LL | #[link_ordinal("JustMonika")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #58713 <https://github.com/rust-lang/rust/issues/58713> for more information + = note: an unsuffixed integer value, e.g., `1`, is expected error: illegal ordinal format in `link_ordinal` - --> $DIR/link-ordinal-invalid-format.rs:6:5 + --> $DIR/link-ordinal-invalid-format.rs:8:5 | LL | #[link_ordinal("JustMonika")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: an unsuffixed integer value, e.g., `1`, is expected -error: aborting due to previous error; 1 warning emitted +error: aborting due to 2 previous errors diff --git a/src/test/ui/rfc-2627-raw-dylib/link-ordinal-missing-argument.rs b/src/test/ui/rfc-2627-raw-dylib/link-ordinal-missing-argument.rs index c391ccd1c..9feed3941 100644 --- a/src/test/ui/rfc-2627-raw-dylib/link-ordinal-missing-argument.rs +++ b/src/test/ui/rfc-2627-raw-dylib/link-ordinal-missing-argument.rs @@ -1,11 +1,13 @@ -#![feature(raw_dylib)] -//~^ WARN the feature `raw_dylib` is incomplete +#![cfg_attr(target_arch = "x86", feature(raw_dylib))] #[link(name = "foo")] extern "C" { #[link_ordinal()] //~^ ERROR incorrect number of arguments to `#[link_ordinal]` fn foo(); + #[link_ordinal()] + //~^ ERROR incorrect number of arguments to `#[link_ordinal]` + static mut imported_variable: i32; } fn main() {} diff --git a/src/test/ui/rfc-2627-raw-dylib/link-ordinal-missing-argument.stderr b/src/test/ui/rfc-2627-raw-dylib/link-ordinal-missing-argument.stderr index 8e9edfb9d..853cdad8c 100644 --- a/src/test/ui/rfc-2627-raw-dylib/link-ordinal-missing-argument.stderr +++ b/src/test/ui/rfc-2627-raw-dylib/link-ordinal-missing-argument.stderr @@ -1,19 +1,18 @@ -warning: the feature `raw_dylib` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/link-ordinal-missing-argument.rs:1:12 +error: incorrect number of arguments to `#[link_ordinal]` + --> $DIR/link-ordinal-missing-argument.rs:5:5 | -LL | #![feature(raw_dylib)] - | ^^^^^^^^^ +LL | #[link_ordinal()] + | ^^^^^^^^^^^^^^^^^ | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #58713 <https://github.com/rust-lang/rust/issues/58713> for more information + = note: the attribute requires exactly one argument error: incorrect number of arguments to `#[link_ordinal]` - --> $DIR/link-ordinal-missing-argument.rs:6:5 + --> $DIR/link-ordinal-missing-argument.rs:8:5 | LL | #[link_ordinal()] | ^^^^^^^^^^^^^^^^^ | = note: the attribute requires exactly one argument -error: aborting due to previous error; 1 warning emitted +error: aborting due to 2 previous errors diff --git a/src/test/ui/rfc-2627-raw-dylib/link-ordinal-multiple.rs b/src/test/ui/rfc-2627-raw-dylib/link-ordinal-multiple.rs index 2a15b1d79..631c363d4 100644 --- a/src/test/ui/rfc-2627-raw-dylib/link-ordinal-multiple.rs +++ b/src/test/ui/rfc-2627-raw-dylib/link-ordinal-multiple.rs @@ -1,12 +1,14 @@ // only-windows -#![feature(raw_dylib)] -//~^ WARN the feature `raw_dylib` is incomplete +#![cfg_attr(target_arch = "x86", feature(raw_dylib))] #[link(name = "foo", kind = "raw-dylib")] extern "C" { #[link_ordinal(1)] //~ ERROR multiple `link_ordinal` attributes #[link_ordinal(2)] fn foo(); + #[link_ordinal(1)] //~ ERROR multiple `link_ordinal` attributes + #[link_ordinal(2)] + static mut imported_variable: i32; } fn main() {} diff --git a/src/test/ui/rfc-2627-raw-dylib/link-ordinal-multiple.stderr b/src/test/ui/rfc-2627-raw-dylib/link-ordinal-multiple.stderr index 4772533ab..c0453d2bf 100644 --- a/src/test/ui/rfc-2627-raw-dylib/link-ordinal-multiple.stderr +++ b/src/test/ui/rfc-2627-raw-dylib/link-ordinal-multiple.stderr @@ -1,23 +1,26 @@ -warning: the feature `raw_dylib` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/link-ordinal-multiple.rs:2:12 +error: multiple `link_ordinal` attributes + --> $DIR/link-ordinal-multiple.rs:6:5 | -LL | #![feature(raw_dylib)] - | ^^^^^^^^^ +LL | #[link_ordinal(1)] + | ^^^^^^^^^^^^^^^^^^ help: remove this attribute | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #58713 <https://github.com/rust-lang/rust/issues/58713> for more information +note: attribute also specified here + --> $DIR/link-ordinal-multiple.rs:7:5 + | +LL | #[link_ordinal(2)] + | ^^^^^^^^^^^^^^^^^^ error: multiple `link_ordinal` attributes - --> $DIR/link-ordinal-multiple.rs:7:5 + --> $DIR/link-ordinal-multiple.rs:9:5 | LL | #[link_ordinal(1)] | ^^^^^^^^^^^^^^^^^^ help: remove this attribute | note: attribute also specified here - --> $DIR/link-ordinal-multiple.rs:8:5 + --> $DIR/link-ordinal-multiple.rs:10:5 | LL | #[link_ordinal(2)] | ^^^^^^^^^^^^^^^^^^ -error: aborting due to previous error; 1 warning emitted +error: aborting due to 2 previous errors diff --git a/src/test/ui/rfc-2627-raw-dylib/link-ordinal-not-foreign-fn.rs b/src/test/ui/rfc-2627-raw-dylib/link-ordinal-not-foreign-fn.rs new file mode 100644 index 000000000..54e614164 --- /dev/null +++ b/src/test/ui/rfc-2627-raw-dylib/link-ordinal-not-foreign-fn.rs @@ -0,0 +1,24 @@ +#![cfg_attr(target_arch = "x86", feature(raw_dylib))] + +#[link_ordinal(123)] +//~^ ERROR attribute should be applied to a foreign function or static +struct Foo {} + +#[link_ordinal(123)] +//~^ ERROR attribute should be applied to a foreign function or static +fn test() {} + +#[link_ordinal(42)] +//~^ ERROR attribute should be applied to a foreign function or static +static mut imported_val: i32 = 123; + +#[link(name = "exporter", kind = "raw-dylib")] +extern { + #[link_ordinal(13)] + fn imported_function(); + + #[link_ordinal(42)] + static mut imported_variable: i32; +} + +fn main() {} diff --git a/src/test/ui/rfc-2627-raw-dylib/link-ordinal-not-foreign-fn.stderr b/src/test/ui/rfc-2627-raw-dylib/link-ordinal-not-foreign-fn.stderr new file mode 100644 index 000000000..ec4104fbe --- /dev/null +++ b/src/test/ui/rfc-2627-raw-dylib/link-ordinal-not-foreign-fn.stderr @@ -0,0 +1,20 @@ +error: attribute should be applied to a foreign function or static + --> $DIR/link-ordinal-not-foreign-fn.rs:3:1 + | +LL | #[link_ordinal(123)] + | ^^^^^^^^^^^^^^^^^^^^ + +error: attribute should be applied to a foreign function or static + --> $DIR/link-ordinal-not-foreign-fn.rs:7:1 + | +LL | #[link_ordinal(123)] + | ^^^^^^^^^^^^^^^^^^^^ + +error: attribute should be applied to a foreign function or static + --> $DIR/link-ordinal-not-foreign-fn.rs:11:1 + | +LL | #[link_ordinal(42)] + | ^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 3 previous errors + diff --git a/src/test/ui/rfc-2627-raw-dylib/link-ordinal-too-large.rs b/src/test/ui/rfc-2627-raw-dylib/link-ordinal-too-large.rs index b6089d27e..46731581e 100644 --- a/src/test/ui/rfc-2627-raw-dylib/link-ordinal-too-large.rs +++ b/src/test/ui/rfc-2627-raw-dylib/link-ordinal-too-large.rs @@ -1,11 +1,13 @@ -#![feature(raw_dylib)] -//~^ WARN the feature `raw_dylib` is incomplete +#![cfg_attr(target_arch = "x86", feature(raw_dylib))] #[link(name = "foo")] extern "C" { #[link_ordinal(72436)] //~^ ERROR ordinal value in `link_ordinal` is too large: `72436` fn foo(); + #[link_ordinal(72436)] + //~^ ERROR ordinal value in `link_ordinal` is too large: `72436` + static mut imported_variable: i32; } fn main() {} diff --git a/src/test/ui/rfc-2627-raw-dylib/link-ordinal-too-large.stderr b/src/test/ui/rfc-2627-raw-dylib/link-ordinal-too-large.stderr index bbe985fa1..fef6de6ae 100644 --- a/src/test/ui/rfc-2627-raw-dylib/link-ordinal-too-large.stderr +++ b/src/test/ui/rfc-2627-raw-dylib/link-ordinal-too-large.stderr @@ -1,19 +1,18 @@ -warning: the feature `raw_dylib` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/link-ordinal-too-large.rs:1:12 +error: ordinal value in `link_ordinal` is too large: `72436` + --> $DIR/link-ordinal-too-large.rs:5:5 | -LL | #![feature(raw_dylib)] - | ^^^^^^^^^ +LL | #[link_ordinal(72436)] + | ^^^^^^^^^^^^^^^^^^^^^^ | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #58713 <https://github.com/rust-lang/rust/issues/58713> for more information + = note: the value may not exceed `u16::MAX` error: ordinal value in `link_ordinal` is too large: `72436` - --> $DIR/link-ordinal-too-large.rs:6:5 + --> $DIR/link-ordinal-too-large.rs:8:5 | LL | #[link_ordinal(72436)] | ^^^^^^^^^^^^^^^^^^^^^^ | = note: the value may not exceed `u16::MAX` -error: aborting due to previous error; 1 warning emitted +error: aborting due to 2 previous errors diff --git a/src/test/ui/rfc-2627-raw-dylib/link-ordinal-too-many-arguments.rs b/src/test/ui/rfc-2627-raw-dylib/link-ordinal-too-many-arguments.rs index 93286c616..71e0ac9f3 100644 --- a/src/test/ui/rfc-2627-raw-dylib/link-ordinal-too-many-arguments.rs +++ b/src/test/ui/rfc-2627-raw-dylib/link-ordinal-too-many-arguments.rs @@ -1,11 +1,13 @@ -#![feature(raw_dylib)] -//~^ WARN the feature `raw_dylib` is incomplete +#![cfg_attr(target_arch = "x86", feature(raw_dylib))] #[link(name = "foo")] extern "C" { #[link_ordinal(3, 4)] //~^ ERROR incorrect number of arguments to `#[link_ordinal]` fn foo(); + #[link_ordinal(3, 4)] + //~^ ERROR incorrect number of arguments to `#[link_ordinal]` + static mut imported_variable: i32; } fn main() {} diff --git a/src/test/ui/rfc-2627-raw-dylib/link-ordinal-too-many-arguments.stderr b/src/test/ui/rfc-2627-raw-dylib/link-ordinal-too-many-arguments.stderr index 484c85a0f..7e0fcd845 100644 --- a/src/test/ui/rfc-2627-raw-dylib/link-ordinal-too-many-arguments.stderr +++ b/src/test/ui/rfc-2627-raw-dylib/link-ordinal-too-many-arguments.stderr @@ -1,19 +1,18 @@ -warning: the feature `raw_dylib` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/link-ordinal-too-many-arguments.rs:1:12 +error: incorrect number of arguments to `#[link_ordinal]` + --> $DIR/link-ordinal-too-many-arguments.rs:5:5 | -LL | #![feature(raw_dylib)] - | ^^^^^^^^^ +LL | #[link_ordinal(3, 4)] + | ^^^^^^^^^^^^^^^^^^^^^ | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #58713 <https://github.com/rust-lang/rust/issues/58713> for more information + = note: the attribute requires exactly one argument error: incorrect number of arguments to `#[link_ordinal]` - --> $DIR/link-ordinal-too-many-arguments.rs:6:5 + --> $DIR/link-ordinal-too-many-arguments.rs:8:5 | LL | #[link_ordinal(3, 4)] | ^^^^^^^^^^^^^^^^^^^^^ | = note: the attribute requires exactly one argument -error: aborting due to previous error; 1 warning emitted +error: aborting due to 2 previous errors diff --git a/src/test/ui/rfc-2627-raw-dylib/link-ordinal-unsupported-link-kind.rs b/src/test/ui/rfc-2627-raw-dylib/link-ordinal-unsupported-link-kind.rs new file mode 100644 index 000000000..329c93fc1 --- /dev/null +++ b/src/test/ui/rfc-2627-raw-dylib/link-ordinal-unsupported-link-kind.rs @@ -0,0 +1,17 @@ +#![cfg_attr(target_arch = "x86", feature(raw_dylib))] + +#[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() {} diff --git a/src/test/ui/rfc-2627-raw-dylib/link-ordinal-unsupported-link-kind.stderr b/src/test/ui/rfc-2627-raw-dylib/link-ordinal-unsupported-link-kind.stderr new file mode 100644 index 000000000..5fbffbda5 --- /dev/null +++ b/src/test/ui/rfc-2627-raw-dylib/link-ordinal-unsupported-link-kind.stderr @@ -0,0 +1,14 @@ +error: `#[link_ordinal]` is only supported if link kind is `raw-dylib` + --> $DIR/link-ordinal-unsupported-link-kind.rs:5:5 + | +LL | #[link_ordinal(3)] + | ^^^^^^^^^^^^^^^^^^ + +error: `#[link_ordinal]` is only supported if link kind is `raw-dylib` + --> $DIR/link-ordinal-unsupported-link-kind.rs:12:5 + | +LL | #[link_ordinal(3)] + | ^^^^^^^^^^^^^^^^^^ + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/rfc-2627-raw-dylib/multiple-declarations.rs b/src/test/ui/rfc-2627-raw-dylib/multiple-declarations.rs index 13c9aa01e..6542faad2 100644 --- a/src/test/ui/rfc-2627-raw-dylib/multiple-declarations.rs +++ b/src/test/ui/rfc-2627-raw-dylib/multiple-declarations.rs @@ -3,7 +3,6 @@ // compile-flags: --crate-type lib --emit link #![allow(clashing_extern_declarations)] #![feature(raw_dylib)] -//~^ WARN the feature `raw_dylib` is incomplete #[link(name = "foo", kind = "raw-dylib")] extern "C" { fn f(x: i32); diff --git a/src/test/ui/rfc-2627-raw-dylib/multiple-declarations.stderr b/src/test/ui/rfc-2627-raw-dylib/multiple-declarations.stderr index 93ca8f4d8..c6808bec7 100644 --- a/src/test/ui/rfc-2627-raw-dylib/multiple-declarations.stderr +++ b/src/test/ui/rfc-2627-raw-dylib/multiple-declarations.stderr @@ -1,17 +1,8 @@ -warning: the feature `raw_dylib` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/multiple-declarations.rs:5: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: multiple declarations of external function `f` from library `foo.dll` have different calling conventions - --> $DIR/multiple-declarations.rs:15:9 + --> $DIR/multiple-declarations.rs:14:9 | LL | fn f(x: i32); | ^^^^^^^^^^^^^ -error: aborting due to previous error; 1 warning emitted +error: aborting due to previous error diff --git a/src/test/ui/rfc-2627-raw-dylib/raw-dylib-windows-only.rs b/src/test/ui/rfc-2627-raw-dylib/raw-dylib-windows-only.rs index 5856b18aa..4efffbd53 100644 --- a/src/test/ui/rfc-2627-raw-dylib/raw-dylib-windows-only.rs +++ b/src/test/ui/rfc-2627-raw-dylib/raw-dylib-windows-only.rs @@ -1,7 +1,6 @@ // ignore-windows // compile-flags: --crate-type lib -#![feature(raw_dylib)] -//~^ WARNING: the feature `raw_dylib` is incomplete +#![cfg_attr(target_arch = "x86", feature(raw_dylib))] #[link(name = "foo", kind = "raw-dylib")] //~^ ERROR: link kind `raw-dylib` is only supported on Windows targets extern "C" {} diff --git a/src/test/ui/rfc-2627-raw-dylib/raw-dylib-windows-only.stderr b/src/test/ui/rfc-2627-raw-dylib/raw-dylib-windows-only.stderr index 600aac81a..14e791f1f 100644 --- a/src/test/ui/rfc-2627-raw-dylib/raw-dylib-windows-only.stderr +++ b/src/test/ui/rfc-2627-raw-dylib/raw-dylib-windows-only.stderr @@ -1,18 +1,9 @@ -warning: the feature `raw_dylib` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/raw-dylib-windows-only.rs:3: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[E0455]: link kind `raw-dylib` is only supported on Windows targets - --> $DIR/raw-dylib-windows-only.rs:5:29 + --> $DIR/raw-dylib-windows-only.rs:4:29 | LL | #[link(name = "foo", kind = "raw-dylib")] | ^^^^^^^^^^^ -error: aborting due to previous error; 1 warning emitted +error: aborting due to previous error For more information about this error, try `rustc --explain E0455`. diff --git a/src/test/ui/rfc-2627-raw-dylib/unsupported-abi.rs b/src/test/ui/rfc-2627-raw-dylib/unsupported-abi.rs index dc647fd63..2f5a23e47 100644 --- a/src/test/ui/rfc-2627-raw-dylib/unsupported-abi.rs +++ b/src/test/ui/rfc-2627-raw-dylib/unsupported-abi.rs @@ -1,8 +1,6 @@ // only-x86_64 // only-windows // compile-flags: --crate-type lib --emit link -#![allow(incomplete_features)] -#![feature(raw_dylib)] #[link(name = "foo", kind = "raw-dylib")] extern "stdcall" { fn f(x: i32); diff --git a/src/test/ui/rfc-2627-raw-dylib/unsupported-abi.stderr b/src/test/ui/rfc-2627-raw-dylib/unsupported-abi.stderr index d8a2a6af9..f8265ae69 100644 --- a/src/test/ui/rfc-2627-raw-dylib/unsupported-abi.stderr +++ b/src/test/ui/rfc-2627-raw-dylib/unsupported-abi.stderr @@ -1,5 +1,5 @@ error: ABI not supported by `#[link(kind = "raw-dylib")]` on this architecture - --> $DIR/unsupported-abi.rs:8:5 + --> $DIR/unsupported-abi.rs:6:5 | LL | fn f(x: i32); | ^^^^^^^^^^^^^ |