]> git.lizzy.rs Git - rust.git/commitdiff
Auto merge of #41757 - alexcrichton:stabilize-crt-static, r=japaric
authorbors <bors@rust-lang.org>
Fri, 12 May 2017 07:33:10 +0000 (07:33 +0000)
committerbors <bors@rust-lang.org>
Fri, 12 May 2017 07:33:10 +0000 (07:33 +0000)
rustc: Stabilize `-C target-feature=+crt-static`

This commit stabilizes the `crt-static` feature accepted by the compiler. Note
that this does not stabilize the `#[cfg]` attribute for `crt-static` as
that's going to be covered by #29717. This only stabilizes a few small pieces:

* The `crt-static` feature as accepted by the `-C target-feature` flag, and its
  connection with the platform-specific definition of `crt-static`.
* The semantics of `--print cfg` printing out activated `crt-static` feature, if
  available.

This should be enough to get the benefits of `crt-static` on stable Rust with
MSVC and with musl, but sidsteps the issue of stabilizing #29717 first.

Closes #37406

1  2 
src/librustc_driver/target_features.rs

index 718f2b515068b3415033e2cf578e2cb39fd135e5,e383f92d7b80ec37201023f9f7cc23bd064f38ed..61bc7c6eb4c714e81f7b1ab3283e3e261d28a4f3
@@@ -12,7 -12,6 +12,6 @@@ use syntax::ast
  use llvm::LLVMRustHasFeature;
  use rustc::session::Session;
  use rustc_trans::back::write::create_target_machine;
- use syntax::feature_gate::UnstableFeatures;
  use syntax::symbol::Symbol;
  use libc::c_char;
  
@@@ -27,8 -26,6 +26,8 @@@ const X86_WHITELIST: &'static [&'stati
                                                   "ssse3\0", "tbm\0", "lzcnt\0", "popcnt\0",
                                                   "sse4a\0", "rdrnd\0", "rdseed\0", "fma\0"];
  
 +const HEXAGON_WHITELIST: &'static [&'static str] = &["hvx\0", "hvx-double\0"];
 +
  /// Add `target_feature = "..."` cfgs for a variety of platform
  /// specific features (SSE, NEON etc.).
  ///
@@@ -40,7 -37,6 +39,7 @@@ pub fn add_configuration(cfg: &mut ast:
      let whitelist = match &*sess.target.target.arch {
          "arm" => ARM_WHITELIST,
          "x86" | "x86_64" => X86_WHITELIST,
 +        "hexagon" => HEXAGON_WHITELIST,
          _ => &[],
      };
  
@@@ -53,8 -49,6 +52,6 @@@
      }
  
      let requested_features = sess.opts.cg.target_feature.split(',');
-     let unstable_options = sess.opts.debugging_opts.unstable_options;
-     let is_nightly = UnstableFeatures::from_environment().is_nightly_build();
      let found_negative = requested_features.clone().any(|r| r == "-crt-static");
      let found_positive = requested_features.clone().any(|r| r == "+crt-static");
  
          found_positive
      };
  
-     // If we switched from the default then that's only allowed on nightly, so
-     // gate that here.
-     if (found_positive || found_negative) && (!is_nightly || !unstable_options) {
-         sess.fatal("specifying the `crt-static` target feature is only allowed \
-                     on the nightly channel with `-Z unstable-options` passed \
-                     as well");
-     }
      if crt_static {
          cfg.insert((tf, Some(Symbol::intern("crt-static"))));
      }