Skip to content

Commit 75e34ac

Browse files
committed
rustc: Stabilize #[wasm_import_module]
This commit stabilizes the `#[wasm_import_module]` attribute. Tracked by #52090 this issue can be attached to foreign modules (`extern { ... }` blocks) and is used to configured the module name that the imports are listed with. The WebAssembly specification indicates two utf-8 names are associated with all imported items, one for the module the item comes from and one for the item itself. The item itself is configurable in Rust via its identifier or `#[link_name = "..."]`, but the module name was previously not configurable and defaulted to `"env"`. This commit ensures that this is also configurable. Closes #52090
1 parent 50702b2 commit 75e34ac

File tree

6 files changed

+4
-36
lines changed

6 files changed

+4
-36
lines changed

src/libsyntax/feature_gate.rs

+3-7
Original file line numberDiff line numberDiff line change
@@ -420,9 +420,6 @@ declare_features! (
420420
// The #[wasm_custom_section] attribute
421421
(active, wasm_custom_section, "1.26.0", Some(51088), None),
422422

423-
// The #![wasm_import_module] attribute
424-
(active, wasm_import_module, "1.26.0", Some(52090), None),
425-
426423
// Allows keywords to be escaped for use as identifiers
427424
(active, raw_identifiers, "1.26.0", Some(48589), None),
428425

@@ -626,6 +623,8 @@ declare_features! (
626623
(accepted, global_allocator, "1.28.0", Some(27389), None),
627624
// Allows `#[repr(transparent)]` attribute on newtype structs
628625
(accepted, repr_transparent, "1.28.0", Some(43036), None),
626+
// The #![wasm_import_module] attribute
627+
(accepted, wasm_import_module, "1.29.0", Some(52090), None),
629628
);
630629

631630
// If you change this, please modify src/doc/unstable-book as well. You must
@@ -980,10 +979,7 @@ pub const BUILTIN_ATTRIBUTES: &'static [(&'static str, AttributeType, AttributeG
980979
"the `#[no_debug]` attribute was an experimental feature that has been \
981980
deprecated due to lack of demand",
982981
cfg_fn!(no_debug))),
983-
("wasm_import_module", Normal, Gated(Stability::Unstable,
984-
"wasm_import_module",
985-
"experimental attribute",
986-
cfg_fn!(wasm_import_module))),
982+
("wasm_import_module", Normal, Ungated),
987983
("omit_gdb_pretty_printer_section", Whitelisted, Gated(Stability::Unstable,
988984
"omit_gdb_pretty_printer_section",
989985
"the `#[omit_gdb_pretty_printer_section]` \

src/test/run-make/wasm-import-module/bar.rs

-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
// except according to those terms.
1010

1111
#![crate_type = "cdylib"]
12-
#![feature(wasm_import_module)]
1312
#![deny(warnings)]
1413

1514
extern crate foo;

src/test/run-make/wasm-import-module/foo.rs

-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
// except according to those terms.
1010

1111
#![crate_type = "rlib"]
12-
#![feature(wasm_import_module)]
1312
#![deny(warnings)]
1413

1514
#[wasm_import_module = "./dep"]

src/test/ui/feature-gate-wasm_import_module.rs

-15
This file was deleted.

src/test/ui/feature-gate-wasm_import_module.stderr

-11
This file was deleted.

src/test/ui/wasm-import-module.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
#![feature(wasm_import_module)]
11+
1212

1313
#[wasm_import_module] //~ ERROR: must be of the form
1414
extern {}

0 commit comments

Comments
 (0)