Skip to content

Commit

Permalink
Stabilize raw_dylib (#[link(kind = "raw-dylib")])
Browse files Browse the repository at this point in the history
This stabilizes the raw-dylib and link_ordinal features (#58713) for the
remaining architecture: x86.
  • Loading branch information
tbu- committed Nov 10, 2022
1 parent c716587 commit ec4d15d
Show file tree
Hide file tree
Showing 46 changed files with 29 additions and 207 deletions.
2 changes: 2 additions & 0 deletions compiler/rustc_feature/src/accepted.rs
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,8 @@ declare_features! (
(accepted, pub_restricted, "1.18.0", Some(32409), None),
/// Allows use of the postfix `?` operator in expressions.
(accepted, question_mark, "1.13.0", Some(31436), None),
/// Allows the use of raw-dylibs (RFC 2627).
(accepted, raw_dylib, "CURRENT_RUSTC_VERSION", Some(58713), None),
/// Allows keywords to be escaped for use as identifiers.
(accepted, raw_identifiers, "1.30.0", Some(48589), None),
/// Allows relaxing the coherence rules such that
Expand Down
2 changes: 0 additions & 2 deletions compiler/rustc_feature/src/active.rs
Original file line number Diff line number Diff line change
Expand Up @@ -482,8 +482,6 @@ declare_features! (
(active, precise_pointer_size_matching, "1.32.0", Some(56354), None),
/// Allows macro attributes on expressions, statements and non-inline modules.
(active, proc_macro_hygiene, "1.30.0", Some(54727), None),
/// Allows the use of raw-dylibs (RFC 2627).
(active, raw_dylib, "1.65.0", Some(58713), None),
/// Allows `&raw const $place_expr` and `&raw mut $place_expr` expressions.
(active, raw_ref_op, "1.41.0", Some(64490), None),
/// Allows using the `#[register_tool]` attribute.
Expand Down
9 changes: 0 additions & 9 deletions compiler/rustc_hir_analysis/src/collect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2170,15 +2170,6 @@ fn should_inherit_track_caller(tcx: TyCtxt<'_>, def_id: DefId) -> bool {

fn check_link_ordinal(tcx: TyCtxt<'_>, attr: &ast::Attribute) -> Option<u16> {
use rustc_ast::{Lit, LitIntType, LitKind};
if !tcx.features().raw_dylib && tcx.sess.target.arch == "x86" {
feature_err(
&tcx.sess.parse_sess,
sym::raw_dylib,
attr.span,
"`#[link_ordinal]` is unstable on x86",
)
.emit();
}
let meta_item_list = attr.meta_item_list();
let meta_item_list: Option<&[ast::NestedMetaItem]> = meta_item_list.as_ref().map(Vec::as_ref);
let sole_meta_list = match meta_item_list {
Expand Down
18 changes: 0 additions & 18 deletions compiler/rustc_metadata/src/native_libs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,14 +165,6 @@ impl<'tcx> Collector<'tcx> {
"raw-dylib" => {
if !sess.target.is_like_windows {
sess.emit_err(FrameworkOnlyWindows { span });
} else if !features.raw_dylib && sess.target.arch == "x86" {
feature_err(
&sess.parse_sess,
sym::raw_dylib,
span,
"link kind `raw-dylib` is unstable on x86",
)
.emit();
}
NativeLibKind::RawDylib
}
Expand Down Expand Up @@ -255,16 +247,6 @@ impl<'tcx> Collector<'tcx> {
continue;
}
};
if !features.raw_dylib {
let span = item.name_value_literal_span().unwrap();
feature_err(
&sess.parse_sess,
sym::raw_dylib,
span,
"import name type is unstable",
)
.emit();
}
import_name_type = Some((link_import_name_type, item.span()));
}
_ => {
Expand Down
34 changes: 0 additions & 34 deletions src/doc/unstable-book/src/language-features/raw-dylib.md

This file was deleted.

1 change: 0 additions & 1 deletion src/test/run-make/raw-dylib-alt-calling-convention/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#![feature(abi_vectorcall)]
#![cfg_attr(target_arch = "x86", feature(raw_dylib))]

#[repr(C)]
#[derive(Clone)]
Expand Down
2 changes: 1 addition & 1 deletion src/test/run-make/raw-dylib-c/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#![feature(raw_dylib, native_link_modifiers_verbatim)]
#![feature(native_link_modifiers_verbatim)]

#[link(name = "extern_1.dll", kind = "raw-dylib", modifiers = "+verbatim")]
extern {
Expand Down
1 change: 0 additions & 1 deletion src/test/run-make/raw-dylib-import-name-type/driver.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#![feature(raw_dylib)]
#![feature(abi_vectorcall)]

#[link(name = "extern", kind = "raw-dylib", import_name_type = "undecorated")]
Expand Down
2 changes: 0 additions & 2 deletions src/test/run-make/raw-dylib-inline-cross-dylib/driver.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![feature(raw_dylib)]

extern crate raw_dylib_test;
extern crate raw_dylib_test_wrapper;

Expand Down
2 changes: 0 additions & 2 deletions src/test/run-make/raw-dylib-inline-cross-dylib/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![feature(raw_dylib)]

#[link(name = "extern_1", kind = "raw-dylib")]
extern {
fn extern_fn_1();
Expand Down
2 changes: 0 additions & 2 deletions src/test/run-make/raw-dylib-link-ordinal/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![cfg_attr(target_arch = "x86", feature(raw_dylib))]

#[link(name = "exporter", kind = "raw-dylib")]
extern {
#[link_ordinal(13)]
Expand Down
2 changes: 0 additions & 2 deletions src/test/run-make/raw-dylib-stdcall-ordinal/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![cfg_attr(target_arch = "x86", feature(raw_dylib))]

#[link(name = "exporter", kind = "raw-dylib")]
extern "stdcall" {
#[link_ordinal(15)]
Expand Down
12 changes: 0 additions & 12 deletions src/test/ui/feature-gates/feature-gate-raw-dylib-2.rs

This file was deleted.

21 changes: 0 additions & 21 deletions src/test/ui/feature-gates/feature-gate-raw-dylib-2.stderr

This file was deleted.

This file was deleted.

This file was deleted.

7 changes: 0 additions & 7 deletions src/test/ui/feature-gates/feature-gate-raw-dylib.rs

This file was deleted.

12 changes: 0 additions & 12 deletions src/test/ui/feature-gates/feature-gate-raw-dylib.stderr

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
// 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" { }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error: import name type must be of the form `import_name_type = "string"`
--> $DIR/import-name-type-invalid-format.rs:5:42
--> $DIR/import-name-type-invalid-format.rs:3:42
|
LL | #[link(name = "foo", kind = "raw-dylib", import_name_type = 6)]
| ^^^^^^^^^^^^^^^^^^^^
Expand Down
2 changes: 0 additions & 2 deletions src/test/ui/rfc-2627-raw-dylib/import-name-type-multiple.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
// 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" { }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error: multiple `import_name_type` arguments in a single `#[link]` attribute
--> $DIR/import-name-type-multiple.rs:6:74
--> $DIR/import-name-type-multiple.rs:4:74
|
LL | #[link(name = "foo", kind = "raw-dylib", import_name_type = "decorated", import_name_type = "decorated")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
// 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" { }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error: unknown import name type `unknown`, expected one of: decorated, noprefix, undecorated
--> $DIR/import-name-type-unknown-value.rs:5:42
--> $DIR/import-name-type-unknown-value.rs:3:42
|
LL | #[link(name = "foo", kind = "raw-dylib", import_name_type = "unknown")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
// 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" { }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
error: import name type can only be used with link kind `raw-dylib`
--> $DIR/import-name-type-unsupported-link-kind.rs:5:22
--> $DIR/import-name-type-unsupported-link-kind.rs:3: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
--> $DIR/import-name-type-unsupported-link-kind.rs:7:39
|
LL | #[link(name = "bar", kind = "static", import_name_type = "decorated")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down
2 changes: 0 additions & 2 deletions src/test/ui/rfc-2627-raw-dylib/link-ordinal-and-name.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![cfg_attr(target_arch = "x86", feature(raw_dylib))]

#[link(name="foo")]
extern "C" {
#[link_name="foo"]
Expand Down
4 changes: 2 additions & 2 deletions src/test/ui/rfc-2627-raw-dylib/link-ordinal-and-name.stderr
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
error: cannot use `#[link_name]` with `#[link_ordinal]`
--> $DIR/link-ordinal-and-name.rs:6:5
--> $DIR/link-ordinal-and-name.rs:4:5
|
LL | #[link_ordinal(42)]
| ^^^^^^^^^^^^^^^^^^^

error: cannot use `#[link_name]` with `#[link_ordinal]`
--> $DIR/link-ordinal-and-name.rs:10:5
--> $DIR/link-ordinal-and-name.rs:8:5
|
LL | #[link_ordinal(5)]
| ^^^^^^^^^^^^^^^^^^
Expand Down
2 changes: 0 additions & 2 deletions src/test/ui/rfc-2627-raw-dylib/link-ordinal-invalid-format.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![cfg_attr(target_arch = "x86", feature(raw_dylib))]

#[link(name = "foo")]
extern "C" {
#[link_ordinal("JustMonika")]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
error: illegal ordinal format in `link_ordinal`
--> $DIR/link-ordinal-invalid-format.rs:5:5
--> $DIR/link-ordinal-invalid-format.rs:3:5
|
LL | #[link_ordinal("JustMonika")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: an unsuffixed integer value, e.g., `1`, is expected

error: illegal ordinal format in `link_ordinal`
--> $DIR/link-ordinal-invalid-format.rs:8:5
--> $DIR/link-ordinal-invalid-format.rs:6:5
|
LL | #[link_ordinal("JustMonika")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![cfg_attr(target_arch = "x86", feature(raw_dylib))]

#[link(name = "foo")]
extern "C" {
#[link_ordinal()]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
error: incorrect number of arguments to `#[link_ordinal]`
--> $DIR/link-ordinal-missing-argument.rs:5:5
--> $DIR/link-ordinal-missing-argument.rs:3:5
|
LL | #[link_ordinal()]
| ^^^^^^^^^^^^^^^^^
|
= note: the attribute requires exactly one argument

error: incorrect number of arguments to `#[link_ordinal]`
--> $DIR/link-ordinal-missing-argument.rs:8:5
--> $DIR/link-ordinal-missing-argument.rs:6:5
|
LL | #[link_ordinal()]
| ^^^^^^^^^^^^^^^^^
Expand Down
2 changes: 0 additions & 2 deletions src/test/ui/rfc-2627-raw-dylib/link-ordinal-multiple.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
// only-windows
#![cfg_attr(target_arch = "x86", feature(raw_dylib))]

#[link(name = "foo", kind = "raw-dylib")]
extern "C" {
#[link_ordinal(1)] //~ ERROR multiple `link_ordinal` attributes
Expand Down
8 changes: 4 additions & 4 deletions src/test/ui/rfc-2627-raw-dylib/link-ordinal-multiple.stderr
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
error: multiple `link_ordinal` attributes
--> $DIR/link-ordinal-multiple.rs:6:5
--> $DIR/link-ordinal-multiple.rs:4:5
|
LL | #[link_ordinal(1)]
| ^^^^^^^^^^^^^^^^^^ help: remove this attribute
|
note: attribute also specified here
--> $DIR/link-ordinal-multiple.rs:7:5
--> $DIR/link-ordinal-multiple.rs:5:5
|
LL | #[link_ordinal(2)]
| ^^^^^^^^^^^^^^^^^^

error: multiple `link_ordinal` attributes
--> $DIR/link-ordinal-multiple.rs:9:5
--> $DIR/link-ordinal-multiple.rs:7:5
|
LL | #[link_ordinal(1)]
| ^^^^^^^^^^^^^^^^^^ help: remove this attribute
|
note: attribute also specified here
--> $DIR/link-ordinal-multiple.rs:10:5
--> $DIR/link-ordinal-multiple.rs:8:5
|
LL | #[link_ordinal(2)]
| ^^^^^^^^^^^^^^^^^^
Expand Down
Loading

0 comments on commit ec4d15d

Please sign in to comment.