Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 3 additions & 16 deletions build.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
// rustc-cfg emitted by the build script:
//
// "use_proc_macro"
// Link to extern crate proc_macro. Available on any compiler and any target
// except wasm32. Requires "proc-macro" Cargo cfg to be enabled (default is
// enabled). On wasm32 we never link to proc_macro even if "proc-macro" cfg
// is enabled.
// Link to extern crate proc_macro. Requires "proc-macro" Cargo cfg to be
// enabled (default is enabled).
//
// "wrap_proc_macro"
// Wrap types from libproc_macro rather than polyfilling the whole API.
Expand Down Expand Up @@ -109,8 +107,7 @@ fn main() {
println!("cargo:rustc-cfg=no_source_text");
}

let target = env::var("TARGET").unwrap();
if !enable_use_proc_macro(&target) {
if !cfg!(feature = "proc-macro") {
return;
}

Expand All @@ -132,16 +129,6 @@ fn main() {
}
}

fn enable_use_proc_macro(target: &str) -> bool {
// wasm targets don't have the `proc_macro` crate, disable this feature.
if target.contains("wasm32") && target != "wasm32-unknown-emscripten" {
return false;
}

// Otherwise, only enable it if our feature is actually enabled.
cfg!(feature = "proc-macro")
}

struct RustcVersion {
minor: u32,
nightly: bool,
Expand Down