Skip to content

Commit d62d078

Browse files
authored
Merge pull request #388 from dtolnay/wasm
Extern crate proc_macro available on all wasm targets
2 parents d51f395 + e60c466 commit d62d078

File tree

1 file changed

+3
-16
lines changed

1 file changed

+3
-16
lines changed

build.rs

+3-16
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
// rustc-cfg emitted by the build script:
22
//
33
// "use_proc_macro"
4-
// Link to extern crate proc_macro. Available on any compiler and any target
5-
// except wasm32. Requires "proc-macro" Cargo cfg to be enabled (default is
6-
// enabled). On wasm32 we never link to proc_macro even if "proc-macro" cfg
7-
// is enabled.
4+
// Link to extern crate proc_macro. Requires "proc-macro" Cargo cfg to be
5+
// enabled (default is enabled).
86
//
97
// "wrap_proc_macro"
108
// Wrap types from libproc_macro rather than polyfilling the whole API.
@@ -109,8 +107,7 @@ fn main() {
109107
println!("cargo:rustc-cfg=no_source_text");
110108
}
111109

112-
let target = env::var("TARGET").unwrap();
113-
if !enable_use_proc_macro(&target) {
110+
if !cfg!(feature = "proc-macro") {
114111
return;
115112
}
116113

@@ -132,16 +129,6 @@ fn main() {
132129
}
133130
}
134131

135-
fn enable_use_proc_macro(target: &str) -> bool {
136-
// wasm targets don't have the `proc_macro` crate, disable this feature.
137-
if target.contains("wasm32") && target != "wasm32-unknown-emscripten" {
138-
return false;
139-
}
140-
141-
// Otherwise, only enable it if our feature is actually enabled.
142-
cfg!(feature = "proc-macro")
143-
}
144-
145132
struct RustcVersion {
146133
minor: u32,
147134
nightly: bool,

0 commit comments

Comments
 (0)