From 99f629a9313a6ac5d7c57fdfa9127a336d0731a8 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Mon, 8 May 2017 13:36:26 -0700 Subject: [PATCH 1/3] rustc: Add a new `-Z force-unstable-if-unmarked` flag This commit adds a new `-Z` flag to the compiler for use when bootstrapping the compiler itself. We want to be able to use crates.io crates, but we also want the usage of such crates to be as ergonomic as possible! To that end compiler crates are a little tricky in that the crates.io crates are not annotated as unstable, nor do they expect to pull in unstable dependencies. To cover all these situations it's intended that the compiler will forever now bootstrap with `-Z force-unstable-if-unmarked`. This flags serves a dual purpose of forcing crates.io crates to themselves be unstable while also allowing them to use other "unstable" crates.io crates. This should mean that adding a dependency to compiler no longer requires upstream modification with unstable/staged_api attributes for inclusion! --- src/librustc/middle/cstore.rs | 2 - src/librustc/middle/stability.rs | 81 ++++++++++++++++++++-------- src/librustc/session/config.rs | 2 + src/librustc_driver/driver.rs | 2 +- src/librustc_driver/test.rs | 2 +- src/librustc_metadata/cstore.rs | 9 ---- src/librustc_metadata/cstore_impl.rs | 5 -- 7 files changed, 62 insertions(+), 41 deletions(-) diff --git a/src/librustc/middle/cstore.rs b/src/librustc/middle/cstore.rs index 16b3fcd2f8c3..53e684e34bde 100644 --- a/src/librustc/middle/cstore.rs +++ b/src/librustc/middle/cstore.rs @@ -239,7 +239,6 @@ pub trait CrateStore { fn export_macros(&self, cnum: CrateNum); fn lang_items(&self, cnum: CrateNum) -> Vec<(DefIndex, usize)>; fn missing_lang_items(&self, cnum: CrateNum) -> Vec; - fn is_staged_api(&self, cnum: CrateNum) -> bool; fn is_allocator(&self, cnum: CrateNum) -> bool; fn is_panic_runtime(&self, cnum: CrateNum) -> bool; fn is_compiler_builtins(&self, cnum: CrateNum) -> bool; @@ -368,7 +367,6 @@ impl CrateStore for DummyCrateStore { { bug!("lang_items") } fn missing_lang_items(&self, cnum: CrateNum) -> Vec { bug!("missing_lang_items") } - fn is_staged_api(&self, cnum: CrateNum) -> bool { bug!("is_staged_api") } fn dep_kind(&self, cnum: CrateNum) -> DepKind { bug!("is_explicitly_linked") } fn export_macros(&self, cnum: CrateNum) { bug!("export_macros") } fn is_allocator(&self, cnum: CrateNum) -> bool { bug!("is_allocator") } diff --git a/src/librustc/middle/stability.rs b/src/librustc/middle/stability.rs index 198f7420f5d2..d74877e355a7 100644 --- a/src/librustc/middle/stability.rs +++ b/src/librustc/middle/stability.rs @@ -13,12 +13,12 @@ pub use self::StabilityLevel::*; -use hir::map as hir_map; use lint; use hir::def::Def; use hir::def_id::{CrateNum, CRATE_DEF_INDEX, DefId, DefIndex, LOCAL_CRATE}; use ty::{self, TyCtxt}; use middle::privacy::AccessLevels; +use session::Session; use syntax::symbol::Symbol; use syntax_pos::{Span, DUMMY_SP}; use syntax::ast; @@ -123,7 +123,7 @@ impl<'a, 'tcx: 'a> Annotator<'a, 'tcx> { item_sp: Span, kind: AnnotationKind, visit_children: F) where F: FnOnce(&mut Self) { - if self.index.staged_api[&LOCAL_CRATE] && self.tcx.sess.features.borrow().staged_api { + if self.index.staged_api[&LOCAL_CRATE] { debug!("annotate(id = {:?}, attrs = {:?})", id, attrs); if let Some(..) = attr::find_deprecation(self.tcx.sess.diagnostic(), attrs, item_sp) { self.tcx.sess.span_err(item_sp, "`#[deprecated]` cannot be used in staged api, \ @@ -390,20 +390,36 @@ impl<'a, 'tcx> Index<'tcx> { parent_depr: None, in_trait_impl: false, }; + + // If the `-Z force-unstable-if-unmarked` flag is passed then we provide + // a parent stability annotation which indicates that this is private + // with the `rustc_private` feature. This is intended for use when + // compiling librustc crates themselves so we can leverage crates.io + // while maintaining the invariant that all sysroot crates are unstable + // by default and are unable to be used. + if tcx.sess.opts.debugging_opts.force_unstable_if_unmarked { + let reason = "this crate is being loaded from the sysroot, and \ + unstable location; did you mean to load this crate \ + from crates.io via `Cargo.toml` instead?"; + let stability = tcx.intern_stability(Stability { + level: attr::StabilityLevel::Unstable { + reason: Some(Symbol::intern(reason)), + issue: 27812, + }, + feature: Symbol::intern("rustc_private"), + rustc_depr: None, + }); + annotator.parent_stab = Some(stability); + } + annotator.annotate(ast::CRATE_NODE_ID, &krate.attrs, krate.span, AnnotationKind::Required, |v| intravisit::walk_crate(v, krate)); } - pub fn new(hir_map: &hir_map::Map) -> Index<'tcx> { - let krate = hir_map.krate(); - - let mut is_staged_api = false; - for attr in &krate.attrs { - if attr.path == "stable" || attr.path == "unstable" { - is_staged_api = true; - break - } - } + pub fn new(sess: &Session) -> Index<'tcx> { + let is_staged_api = + sess.opts.debugging_opts.force_unstable_if_unmarked || + sess.features.borrow().staged_api; let mut staged_api = FxHashMap(); staged_api.insert(LOCAL_CRATE, is_staged_api); @@ -496,8 +512,10 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { } } - let is_staged_api = *self.stability.borrow_mut().staged_api.entry(def_id.krate) - .or_insert_with(|| self.sess.cstore.is_staged_api(def_id.krate)); + let is_staged_api = self.lookup_stability(DefId { + index: CRATE_DEF_INDEX, + ..def_id + }).is_some(); if !is_staged_api { return; } @@ -530,15 +548,32 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { match stability { Some(&Stability { level: attr::Unstable {ref reason, issue}, ref feature, .. }) => { - if !self.stability.borrow().active_features.contains(feature) { - let msg = match *reason { - Some(ref r) => format!("use of unstable library feature '{}': {}", - feature.as_str(), &r), - None => format!("use of unstable library feature '{}'", &feature) - }; - emit_feature_err(&self.sess.parse_sess, &feature.as_str(), span, - GateIssue::Library(Some(issue)), &msg); + if self.stability.borrow().active_features.contains(feature) { + return } + + // When we're compiling the compiler itself we may pull in + // crates from crates.io, but those crates may depend on other + // crates also pulled in from crates.io. We want to ideally be + // able to compile everything without requiring upstream + // modifications, so in the case that this looks like a + // rustc_private crate (e.g. a compiler crate) and we also have + // the `-Z force-unstable-if-unmarked` flag present (we're + // compiling a compiler crate), then let this missing feature + // annotation slide. + if *feature == "rustc_private" && issue == 27812 { + if self.sess.opts.debugging_opts.force_unstable_if_unmarked { + return + } + } + + let msg = match *reason { + Some(ref r) => format!("use of unstable library feature '{}': {}", + feature.as_str(), &r), + None => format!("use of unstable library feature '{}'", &feature) + }; + emit_feature_err(&self.sess.parse_sess, &feature.as_str(), span, + GateIssue::Library(Some(issue)), &msg); } Some(_) => { // Stable APIs are always ok to call and deprecated APIs are @@ -658,7 +693,7 @@ pub fn check_unused_or_stable_features<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) { let access_levels = &tcx.privacy_access_levels(LOCAL_CRATE); - if tcx.stability.borrow().staged_api[&LOCAL_CRATE] && tcx.sess.features.borrow().staged_api { + if tcx.stability.borrow().staged_api[&LOCAL_CRATE] { let krate = tcx.hir.krate(); let mut missing = MissingStabilityAnnotations { tcx: tcx, diff --git a/src/librustc/session/config.rs b/src/librustc/session/config.rs index 75bc940625d8..884a71f0d32d 100644 --- a/src/librustc/session/config.rs +++ b/src/librustc/session/config.rs @@ -1027,6 +1027,8 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options, "add a source pattern to the file path remapping config"), remap_path_prefix_to: Vec = (vec![], parse_string_push, [TRACKED], "add a mapping target to the file path remapping config"), + force_unstable_if_unmarked: bool = (false, parse_bool, [TRACKED], + "force all crates to be `rustc_private` unstable"), } pub fn default_lib_output() -> CrateType { diff --git a/src/librustc_driver/driver.rs b/src/librustc_driver/driver.rs index 5f14890665ca..8fddbe110b0e 100644 --- a/src/librustc_driver/driver.rs +++ b/src/librustc_driver/driver.rs @@ -882,7 +882,7 @@ pub fn phase_3_run_analysis_passes<'tcx, F, R>(sess: &'tcx Session, "static item recursion checking", || static_recursion::check_crate(sess, &hir_map))?; - let index = stability::Index::new(&hir_map); + let index = stability::Index::new(&sess); let mut local_providers = ty::maps::Providers::default(); borrowck::provide(&mut local_providers); diff --git a/src/librustc_driver/test.rs b/src/librustc_driver/test.rs index 8b95be00fa75..3b4f2560fc55 100644 --- a/src/librustc_driver/test.rs +++ b/src/librustc_driver/test.rs @@ -138,7 +138,7 @@ fn test_env(source_string: &str, // run just enough stuff to build a tcx: let lang_items = lang_items::collect_language_items(&sess, &hir_map); let named_region_map = resolve_lifetime::krate(&sess, &hir_map); - let index = stability::Index::new(&hir_map); + let index = stability::Index::new(&sess); TyCtxt::create_and_enter(&sess, ty::maps::Providers::default(), ty::maps::Providers::default(), diff --git a/src/librustc_metadata/cstore.rs b/src/librustc_metadata/cstore.rs index 8d53e7d49ee8..c12b4209675d 100644 --- a/src/librustc_metadata/cstore.rs +++ b/src/librustc_metadata/cstore.rs @@ -269,15 +269,6 @@ impl CrateMetadata { self.root.disambiguator } - pub fn is_staged_api(&self, dep_graph: &DepGraph) -> bool { - for attr in self.get_item_attrs(CRATE_DEF_INDEX, dep_graph).iter() { - if attr.path == "stable" || attr.path == "unstable" { - return true; - } - } - false - } - pub fn is_allocator(&self, dep_graph: &DepGraph) -> bool { let attrs = self.get_item_attrs(CRATE_DEF_INDEX, dep_graph); attr::contains_name(&attrs, "allocator") diff --git a/src/librustc_metadata/cstore_impl.rs b/src/librustc_metadata/cstore_impl.rs index 6fa6a868605d..c7da535faa29 100644 --- a/src/librustc_metadata/cstore_impl.rs +++ b/src/librustc_metadata/cstore_impl.rs @@ -267,11 +267,6 @@ impl CrateStore for cstore::CStore { self.get_crate_data(cnum).get_missing_lang_items(&self.dep_graph) } - fn is_staged_api(&self, cnum: CrateNum) -> bool - { - self.get_crate_data(cnum).is_staged_api(&self.dep_graph) - } - fn is_allocator(&self, cnum: CrateNum) -> bool { self.get_crate_data(cnum).is_allocator(&self.dep_graph) From af0e16c852662d23097ce1821ff04c1676aed20f Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Mon, 8 May 2017 14:36:33 -0700 Subject: [PATCH 2/3] rustbuild: Use `-Z force-unstable-if-unmarked` --- src/bootstrap/bin/rustc.rs | 13 +++++++++++++ src/bootstrap/lib.rs | 7 +++++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/bootstrap/bin/rustc.rs b/src/bootstrap/bin/rustc.rs index 62b7f6cb72e3..906c468241ae 100644 --- a/src/bootstrap/bin/rustc.rs +++ b/src/bootstrap/bin/rustc.rs @@ -194,6 +194,8 @@ fn main() { // do that we pass a weird flag to the compiler to get it to do // so. Note that this is definitely a hack, and we should likely // flesh out rpath support more fully in the future. + // + // FIXME: remove condition after next stage0 if stage != "0" { cmd.arg("-Z").arg("osx-rpath-install-name"); } @@ -218,6 +220,17 @@ fn main() { cmd.arg("-Z").arg("unstable-options"); cmd.arg("-C").arg("target-feature=+crt-static"); } + + // Force all crates compiled by this compiler to (a) be unstable and (b) + // allow the `rustc_private` feature to link to other unstable crates + // also in the sysroot. + // + // FIXME: remove condition after next stage0 + if env::var_os("RUSTC_FORCE_UNSTABLE").is_some() { + if stage != "0" { + cmd.arg("-Z").arg("force-unstable-if-unmarked"); + } + } } if verbose > 1 { diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs index 017d4015134d..ea0b521a2ce6 100644 --- a/src/bootstrap/lib.rs +++ b/src/bootstrap/lib.rs @@ -479,7 +479,8 @@ impl Build { // compiled with debuginfo. if mode != Mode::Tool { cargo.env("RUSTC_DEBUGINFO", self.config.rust_debuginfo.to_string()) - .env("RUSTC_DEBUGINFO_LINES", self.config.rust_debuginfo_lines.to_string()); + .env("RUSTC_DEBUGINFO_LINES", self.config.rust_debuginfo_lines.to_string()) + .env("RUSTC_FORCE_UNSTABLE", "1"); } // Enable usage of unstable features @@ -524,7 +525,9 @@ impl Build { // the comipiler, libs, and tests are stable and we don't want to make // their deps unstable (since this would break the first invariant // above). - if mode != Mode::Tool { + // + // FIXME: remove this after next stage0 + if mode != Mode::Tool && stage == 0 { cargo.env("RUSTBUILD_UNSTABLE", "1"); } From ab54f4b226639558ff46ea1f3e3f504aacef562d Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Mon, 8 May 2017 14:36:44 -0700 Subject: [PATCH 3/3] rustc: Remove #![unstable] annotation These are now no longer necessary with `-Z force-unstable-if-unmarked` --- src/libarena/lib.rs | 4 ++-- src/libflate/lib.rs | 4 ++-- src/libfmt_macros/lib.rs | 4 ++-- src/libgetopts/lib.rs | 6 +++--- src/libgraphviz/lib.rs | 4 ++-- src/libproc_macro_plugin/lib.rs | 6 +++--- src/librustc/lib.rs | 7 ++++--- src/librustc_back/lib.rs | 7 ++++--- src/librustc_bitflags/lib.rs | 4 ++-- src/librustc_borrowck/lib.rs | 8 +++++--- src/librustc_const_eval/lib.rs | 7 ++++--- src/librustc_const_math/lib.rs | 7 ++++--- src/librustc_data_structures/lib.rs | 7 ++++--- src/librustc_driver/lib.rs | 7 ++++--- src/librustc_errors/lib.rs | 7 ++++--- src/librustc_incremental/lib.rs | 7 ++++--- src/librustc_lint/lib.rs | 7 ++++--- src/librustc_llvm/lib.rs | 7 ++++--- src/librustc_metadata/lib.rs | 7 ++++--- src/librustc_mir/lib.rs | 7 ++++--- src/librustc_passes/lib.rs | 7 ++++--- src/librustc_platform_intrinsics/lib.rs | 4 ++-- src/librustc_plugin/lib.rs | 7 ++++--- src/librustc_privacy/lib.rs | 7 ++++--- src/librustc_resolve/lib.rs | 7 ++++--- src/librustc_save_analysis/lib.rs | 7 ++++--- src/librustc_trans/lib.rs | 7 ++++--- src/librustc_typeck/lib.rs | 7 ++++--- src/librustdoc/lib.rs | 7 ++++--- src/libserialize/lib.rs | 6 +++--- src/libsyntax/lib.rs | 7 ++++--- src/libsyntax_ext/lib.rs | 7 ++++--- src/libsyntax_pos/lib.rs | 7 ++++--- src/libterm/lib.rs | 7 +++---- 34 files changed, 121 insertions(+), 97 deletions(-) diff --git a/src/libarena/lib.rs b/src/libarena/lib.rs index 321fa2edd56c..c4c1635aa2a5 100644 --- a/src/libarena/lib.rs +++ b/src/libarena/lib.rs @@ -19,7 +19,7 @@ //! objects of a single type. #![crate_name = "arena"] -#![unstable(feature = "rustc_private", issue = "27812")] +#![cfg_attr(stage0, unstable(feature = "rustc_private", issue = "27812"))] #![crate_type = "rlib"] #![crate_type = "dylib"] #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", @@ -32,7 +32,7 @@ #![feature(core_intrinsics)] #![feature(dropck_eyepatch)] #![feature(generic_param_attrs)] -#![feature(staged_api)] +#![cfg_attr(stage0, feature(staged_api))] #![cfg_attr(test, feature(test))] #![allow(deprecated)] diff --git a/src/libflate/lib.rs b/src/libflate/lib.rs index 3619be82829c..e0bea884f31c 100644 --- a/src/libflate/lib.rs +++ b/src/libflate/lib.rs @@ -15,7 +15,7 @@ //! [mz]: https://code.google.com/p/miniz/ #![crate_name = "flate"] -#![unstable(feature = "rustc_private", issue = "27812")] +#![cfg_attr(stage0, unstable(feature = "rustc_private", issue = "27812"))] #![crate_type = "rlib"] #![crate_type = "dylib"] #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", @@ -25,7 +25,7 @@ #![deny(warnings)] #![feature(libc)] -#![feature(staged_api)] +#![cfg_attr(stage0, feature(staged_api))] #![feature(unique)] #![cfg_attr(test, feature(rand))] diff --git a/src/libfmt_macros/lib.rs b/src/libfmt_macros/lib.rs index f5a687de64e4..641a42b08188 100644 --- a/src/libfmt_macros/lib.rs +++ b/src/libfmt_macros/lib.rs @@ -15,7 +15,7 @@ //! generated instead. #![crate_name = "fmt_macros"] -#![unstable(feature = "rustc_private", issue = "27812")] +#![cfg_attr(stage0, unstable(feature = "rustc_private", issue = "27812"))] #![crate_type = "rlib"] #![crate_type = "dylib"] #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", @@ -25,7 +25,7 @@ test(attr(deny(warnings))))] #![deny(warnings)] -#![feature(staged_api)] +#![cfg_attr(stage0, feature(staged_api))] #![feature(unicode)] pub use self::Piece::*; diff --git a/src/libgetopts/lib.rs b/src/libgetopts/lib.rs index a5cd9fab2cf4..c69c68ba59c0 100644 --- a/src/libgetopts/lib.rs +++ b/src/libgetopts/lib.rs @@ -78,9 +78,9 @@ //! ``` #![crate_name = "getopts"] -#![unstable(feature = "rustc_private", +#![cfg_attr(stage0, unstable(feature = "rustc_private", reason = "use the crates.io `getopts` library instead", - issue = "27812")] + issue = "27812"))] #![crate_type = "rlib"] #![crate_type = "dylib"] #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", @@ -91,7 +91,7 @@ #![deny(missing_docs)] #![deny(warnings)] -#![feature(staged_api)] +#![cfg_attr(stage0, feature(staged_api))] use self::Name::*; use self::HasArg::*; diff --git a/src/libgraphviz/lib.rs b/src/libgraphviz/lib.rs index 1b2c7775185f..2c6744e7c905 100644 --- a/src/libgraphviz/lib.rs +++ b/src/libgraphviz/lib.rs @@ -284,8 +284,8 @@ //! * [DOT language](http://www.graphviz.org/doc/info/lang.html) #![crate_name = "graphviz"] -#![unstable(feature = "rustc_private", issue = "27812")] -#![feature(staged_api)] +#![cfg_attr(stage0, unstable(feature = "rustc_private", issue = "27812"))] +#![cfg_attr(stage0, feature(staged_api))] #![crate_type = "rlib"] #![crate_type = "dylib"] #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", diff --git a/src/libproc_macro_plugin/lib.rs b/src/libproc_macro_plugin/lib.rs index a6dad6412533..68c5d4959183 100644 --- a/src/libproc_macro_plugin/lib.rs +++ b/src/libproc_macro_plugin/lib.rs @@ -72,7 +72,7 @@ //! } //! ``` #![crate_name = "proc_macro_plugin"] -#![unstable(feature = "rustc_private", issue = "27812")] +#![cfg_attr(stage0, unstable(feature = "rustc_private", issue = "27812"))] #![feature(plugin_registrar)] #![crate_type = "dylib"] #![crate_type = "rlib"] @@ -81,9 +81,9 @@ html_root_url = "https://doc.rust-lang.org/nightly/")] #![deny(warnings)] -#![feature(staged_api)] +#![cfg_attr(stage0, feature(staged_api))] #![feature(rustc_diagnostic_macros)] -#![feature(rustc_private)] +#![cfg_attr(stage0, feature(rustc_private))] extern crate rustc_plugin; extern crate syntax; diff --git a/src/librustc/lib.rs b/src/librustc/lib.rs index d3954326e7b7..5cf26ea8bfca 100644 --- a/src/librustc/lib.rs +++ b/src/librustc/lib.rs @@ -15,7 +15,6 @@ //! This API is completely unstable and subject to change. #![crate_name = "rustc"] -#![unstable(feature = "rustc_private", issue = "27812")] #![crate_type = "dylib"] #![crate_type = "rlib"] #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", @@ -36,15 +35,17 @@ #![feature(nonzero)] #![feature(quote)] #![feature(rustc_diagnostic_macros)] -#![feature(rustc_private)] #![feature(slice_patterns)] #![feature(specialization)] -#![feature(staged_api)] #![feature(unboxed_closures)] #![feature(discriminant_value)] #![feature(sort_unstable)] #![feature(trace_macros)] +#![cfg_attr(stage0, unstable(feature = "rustc_private", issue = "27812"))] +#![cfg_attr(stage0, feature(rustc_private))] +#![cfg_attr(stage0, feature(staged_api))] + #![recursion_limit="128"] extern crate arena; diff --git a/src/librustc_back/lib.rs b/src/librustc_back/lib.rs index 6679cc73029c..69eabfe2ac0b 100644 --- a/src/librustc_back/lib.rs +++ b/src/librustc_back/lib.rs @@ -22,7 +22,6 @@ //! build speedups. #![crate_name = "rustc_back"] -#![unstable(feature = "rustc_private", issue = "27812")] #![crate_type = "dylib"] #![crate_type = "rlib"] #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", @@ -34,10 +33,12 @@ #![feature(const_fn)] #![feature(libc)] #![feature(rand)] -#![feature(rustc_private)] -#![feature(staged_api)] #![cfg_attr(test, feature(rand))] +#![cfg_attr(stage0, unstable(feature = "rustc_private", issue = "27812"))] +#![cfg_attr(stage0, feature(rustc_private))] +#![cfg_attr(stage0, feature(staged_api))] + extern crate syntax; extern crate libc; extern crate serialize; diff --git a/src/librustc_bitflags/lib.rs b/src/librustc_bitflags/lib.rs index edd474b2e9ed..23558d828834 100644 --- a/src/librustc_bitflags/lib.rs +++ b/src/librustc_bitflags/lib.rs @@ -11,11 +11,11 @@ #![crate_name = "rustc_bitflags"] #![feature(associated_consts)] -#![feature(staged_api)] #![crate_type = "rlib"] #![no_std] -#![unstable(feature = "rustc_private", issue = "27812")] #![deny(warnings)] +#![cfg_attr(stage0, unstable(feature = "rustc_private", issue = "27812"))] +#![cfg_attr(stage0, feature(staged_api))] //! A typesafe bitmask flag generator. diff --git a/src/librustc_borrowck/lib.rs b/src/librustc_borrowck/lib.rs index a1d3357faf56..617326808970 100644 --- a/src/librustc_borrowck/lib.rs +++ b/src/librustc_borrowck/lib.rs @@ -9,7 +9,6 @@ // except according to those terms. #![crate_name = "rustc_borrowck"] -#![unstable(feature = "rustc_private", issue = "27812")] #![crate_type = "dylib"] #![crate_type = "rlib"] #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", @@ -21,10 +20,13 @@ #![feature(quote)] #![feature(rustc_diagnostic_macros)] -#![feature(rustc_private)] -#![feature(staged_api)] #![feature(associated_consts)] #![feature(nonzero)] + +#![cfg_attr(stage0, unstable(feature = "rustc_private", issue = "27812"))] +#![cfg_attr(stage0, feature(rustc_private))] +#![cfg_attr(stage0, feature(staged_api))] + #[macro_use] extern crate log; #[macro_use] extern crate syntax; extern crate syntax_pos; diff --git a/src/librustc_const_eval/lib.rs b/src/librustc_const_eval/lib.rs index fa3161a86049..8142829e8160 100644 --- a/src/librustc_const_eval/lib.rs +++ b/src/librustc_const_eval/lib.rs @@ -15,7 +15,6 @@ //! This API is completely unstable and subject to change. #![crate_name = "rustc_const_eval"] -#![unstable(feature = "rustc_private", issue = "27812")] #![crate_type = "dylib"] #![crate_type = "rlib"] #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", @@ -23,8 +22,6 @@ html_root_url = "https://doc.rust-lang.org/nightly/")] #![deny(warnings)] -#![feature(rustc_private)] -#![feature(staged_api)] #![feature(rustc_diagnostic_macros)] #![feature(slice_patterns)] #![feature(box_patterns)] @@ -32,6 +29,10 @@ #![feature(const_fn)] #![feature(i128_type)] +#![cfg_attr(stage0, unstable(feature = "rustc_private", issue = "27812"))] +#![cfg_attr(stage0, feature(rustc_private))] +#![cfg_attr(stage0, feature(staged_api))] + extern crate arena; #[macro_use] extern crate syntax; #[macro_use] extern crate log; diff --git a/src/librustc_const_math/lib.rs b/src/librustc_const_math/lib.rs index b7833a544032..528170781ea7 100644 --- a/src/librustc_const_math/lib.rs +++ b/src/librustc_const_math/lib.rs @@ -15,7 +15,6 @@ //! This API is completely unstable and subject to change. #![crate_name = "rustc_const_math"] -#![unstable(feature = "rustc_private", issue = "27812")] #![crate_type = "dylib"] #![crate_type = "rlib"] #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", @@ -23,12 +22,14 @@ html_root_url = "https://doc.rust-lang.org/nightly/")] #![deny(warnings)] -#![feature(rustc_private)] -#![feature(staged_api)] #![feature(const_fn)] #![feature(i128)] #![feature(i128_type)] +#![cfg_attr(stage0, unstable(feature = "rustc_private", issue = "27812"))] +#![cfg_attr(stage0, feature(rustc_private))] +#![cfg_attr(stage0, feature(staged_api))] + extern crate syntax; extern crate serialize as rustc_serialize; // used by deriving diff --git a/src/librustc_data_structures/lib.rs b/src/librustc_data_structures/lib.rs index 00c46d992bfd..c254dfc48d22 100644 --- a/src/librustc_data_structures/lib.rs +++ b/src/librustc_data_structures/lib.rs @@ -17,7 +17,6 @@ //! This API is completely unstable and subject to change. #![crate_name = "rustc_data_structures"] -#![unstable(feature = "rustc_private", issue = "27812")] #![crate_type = "dylib"] #![crate_type = "rlib"] #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", @@ -28,8 +27,6 @@ #![feature(shared)] #![feature(collections_range)] #![feature(nonzero)] -#![feature(rustc_private)] -#![feature(staged_api)] #![feature(unboxed_closures)] #![feature(fn_traits)] #![feature(untagged_unions)] @@ -42,6 +39,10 @@ #![feature(manually_drop)] #![feature(struct_field_attributes)] +#![cfg_attr(stage0, unstable(feature = "rustc_private", issue = "27812"))] +#![cfg_attr(stage0, feature(rustc_private))] +#![cfg_attr(stage0, feature(staged_api))] + #![cfg_attr(unix, feature(libc))] #![cfg_attr(test, feature(test))] diff --git a/src/librustc_driver/lib.rs b/src/librustc_driver/lib.rs index 889f4dd4b9aa..9cee5bc0319b 100644 --- a/src/librustc_driver/lib.rs +++ b/src/librustc_driver/lib.rs @@ -15,7 +15,6 @@ //! This API is completely unstable and subject to change. #![crate_name = "rustc_driver"] -#![unstable(feature = "rustc_private", issue = "27812")] #![crate_type = "dylib"] #![crate_type = "rlib"] #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", @@ -28,9 +27,11 @@ #![feature(libc)] #![feature(quote)] #![feature(rustc_diagnostic_macros)] -#![feature(rustc_private)] #![feature(set_stdio)] -#![feature(staged_api)] + +#![cfg_attr(stage0, unstable(feature = "rustc_private", issue = "27812"))] +#![cfg_attr(stage0, feature(rustc_private))] +#![cfg_attr(stage0, feature(staged_api))] extern crate arena; extern crate getopts; diff --git a/src/librustc_errors/lib.rs b/src/librustc_errors/lib.rs index db8c9ac306bb..0f2e1669a47a 100644 --- a/src/librustc_errors/lib.rs +++ b/src/librustc_errors/lib.rs @@ -9,7 +9,6 @@ // except according to those terms. #![crate_name = "rustc_errors"] -#![unstable(feature = "rustc_private", issue = "27812")] #![crate_type = "dylib"] #![crate_type = "rlib"] #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", @@ -19,11 +18,13 @@ #![feature(custom_attribute)] #![allow(unused_attributes)] -#![feature(rustc_private)] -#![feature(staged_api)] #![feature(range_contains)] #![feature(libc)] +#![cfg_attr(stage0, unstable(feature = "rustc_private", issue = "27812"))] +#![cfg_attr(stage0, feature(rustc_private))] +#![cfg_attr(stage0, feature(staged_api))] + extern crate term; extern crate libc; extern crate serialize as rustc_serialize; diff --git a/src/librustc_incremental/lib.rs b/src/librustc_incremental/lib.rs index 95f0a96fdf96..70f967d50b0e 100644 --- a/src/librustc_incremental/lib.rs +++ b/src/librustc_incremental/lib.rs @@ -11,7 +11,6 @@ //! Support for serializing the dep-graph and reloading it. #![crate_name = "rustc_incremental"] -#![unstable(feature = "rustc_private", issue = "27812")] #![crate_type = "dylib"] #![crate_type = "rlib"] #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", @@ -19,12 +18,14 @@ html_root_url = "https://doc.rust-lang.org/nightly/")] #![deny(warnings)] -#![feature(rustc_private)] -#![feature(staged_api)] #![feature(rand)] #![feature(conservative_impl_trait)] #![feature(sort_unstable)] +#![cfg_attr(stage0, unstable(feature = "rustc_private", issue = "27812"))] +#![cfg_attr(stage0, feature(rustc_private))] +#![cfg_attr(stage0, feature(staged_api))] + extern crate graphviz; #[macro_use] extern crate rustc; extern crate rustc_data_structures; diff --git a/src/librustc_lint/lib.rs b/src/librustc_lint/lib.rs index 53ea3a8333f2..2d0b5a6a51c6 100644 --- a/src/librustc_lint/lib.rs +++ b/src/librustc_lint/lib.rs @@ -20,7 +20,6 @@ //! This API is completely unstable and subject to change. #![crate_name = "rustc_lint"] -#![unstable(feature = "rustc_private", issue = "27812")] #![crate_type = "dylib"] #![crate_type = "rlib"] #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", @@ -34,9 +33,11 @@ #![feature(i128_type)] #![feature(quote)] #![feature(rustc_diagnostic_macros)] -#![feature(rustc_private)] #![feature(slice_patterns)] -#![feature(staged_api)] + +#![cfg_attr(stage0, unstable(feature = "rustc_private", issue = "27812"))] +#![cfg_attr(stage0, feature(rustc_private))] +#![cfg_attr(stage0, feature(staged_api))] #[macro_use] extern crate syntax; diff --git a/src/librustc_llvm/lib.rs b/src/librustc_llvm/lib.rs index c9b3a7ff3f3a..790d493f1914 100644 --- a/src/librustc_llvm/lib.rs +++ b/src/librustc_llvm/lib.rs @@ -14,7 +14,6 @@ #![allow(dead_code)] #![crate_name = "rustc_llvm"] -#![unstable(feature = "rustc_private", issue = "27812")] #![crate_type = "dylib"] #![crate_type = "rlib"] #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", @@ -27,10 +26,12 @@ #![feature(concat_idents)] #![feature(libc)] #![feature(link_args)] -#![feature(staged_api)] -#![feature(rustc_private)] #![feature(static_nobundle)] +#![cfg_attr(stage0, unstable(feature = "rustc_private", issue = "27812"))] +#![cfg_attr(stage0, feature(rustc_private))] +#![cfg_attr(stage0, feature(staged_api))] + extern crate libc; #[macro_use] #[no_link] diff --git a/src/librustc_metadata/lib.rs b/src/librustc_metadata/lib.rs index 90eb2bc0f6a7..27555f49e57f 100644 --- a/src/librustc_metadata/lib.rs +++ b/src/librustc_metadata/lib.rs @@ -9,7 +9,6 @@ // except according to those terms. #![crate_name = "rustc_metadata"] -#![unstable(feature = "rustc_private", issue = "27812")] #![crate_type = "dylib"] #![crate_type = "rlib"] #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", @@ -24,10 +23,12 @@ #![feature(proc_macro_internals)] #![feature(quote)] #![feature(rustc_diagnostic_macros)] -#![feature(rustc_private)] #![feature(specialization)] -#![feature(staged_api)] #![feature(discriminant_value)] +#![feature(rustc_private)] + +#![cfg_attr(stage0, unstable(feature = "rustc_private", issue = "27812"))] +#![cfg_attr(stage0, feature(staged_api))] #[macro_use] extern crate log; diff --git a/src/librustc_mir/lib.rs b/src/librustc_mir/lib.rs index 5fa56bac1379..014705bf32fa 100644 --- a/src/librustc_mir/lib.rs +++ b/src/librustc_mir/lib.rs @@ -18,18 +18,19 @@ Rust MIR: a lowered representation of Rust. Also: an experiment! #![crate_type = "rlib"] #![crate_type = "dylib"] #![deny(warnings)] -#![unstable(feature = "rustc_private", issue = "27812")] #![feature(associated_consts)] #![feature(box_patterns)] #![feature(box_syntax)] #![feature(i128_type)] #![feature(rustc_diagnostic_macros)] -#![feature(rustc_private)] -#![feature(staged_api)] #![feature(placement_in_syntax)] #![feature(collection_placement)] +#![cfg_attr(stage0, unstable(feature = "rustc_private", issue = "27812"))] +#![cfg_attr(stage0, feature(rustc_private))] +#![cfg_attr(stage0, feature(staged_api))] + #[macro_use] extern crate log; extern crate graphviz as dot; #[macro_use] diff --git a/src/librustc_passes/lib.rs b/src/librustc_passes/lib.rs index 22566c813d86..97f0022b8db8 100644 --- a/src/librustc_passes/lib.rs +++ b/src/librustc_passes/lib.rs @@ -15,7 +15,6 @@ //! This API is completely unstable and subject to change. #![crate_name = "rustc_passes"] -#![unstable(feature = "rustc_private", issue = "27812")] #![crate_type = "dylib"] #![crate_type = "rlib"] #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", @@ -24,8 +23,10 @@ #![deny(warnings)] #![feature(rustc_diagnostic_macros)] -#![feature(staged_api)] -#![feature(rustc_private)] + +#![cfg_attr(stage0, unstable(feature = "rustc_private", issue = "27812"))] +#![cfg_attr(stage0, feature(rustc_private))] +#![cfg_attr(stage0, feature(staged_api))] #[macro_use] extern crate rustc; diff --git a/src/librustc_platform_intrinsics/lib.rs b/src/librustc_platform_intrinsics/lib.rs index dd2d60a1d22d..21dd360c9bb7 100644 --- a/src/librustc_platform_intrinsics/lib.rs +++ b/src/librustc_platform_intrinsics/lib.rs @@ -9,10 +9,10 @@ // except according to those terms. #![crate_name = "rustc_platform_intrinsics"] -#![unstable(feature = "rustc_private", issue = "27812")] +#![cfg_attr(stage0, unstable(feature = "rustc_private", issue = "27812"))] #![crate_type = "dylib"] #![crate_type = "rlib"] -#![feature(staged_api)] +#![cfg_attr(stage0, feature(staged_api))] #![deny(warnings)] #![allow(bad_style)] diff --git a/src/librustc_plugin/lib.rs b/src/librustc_plugin/lib.rs index 8aa680ca12d1..16ab593e47a7 100644 --- a/src/librustc_plugin/lib.rs +++ b/src/librustc_plugin/lib.rs @@ -51,7 +51,6 @@ //! for more examples. #![crate_name = "rustc_plugin"] -#![unstable(feature = "rustc_private", issue = "27812")] #![crate_type = "dylib"] #![crate_type = "rlib"] #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", @@ -59,9 +58,11 @@ html_root_url = "https://doc.rust-lang.org/nightly/")] #![deny(warnings)] -#![feature(staged_api)] #![feature(rustc_diagnostic_macros)] -#![feature(rustc_private)] + +#![cfg_attr(stage0, unstable(feature = "rustc_private", issue = "27812"))] +#![cfg_attr(stage0, feature(rustc_private))] +#![cfg_attr(stage0, feature(staged_api))] #[macro_use] extern crate syntax; diff --git a/src/librustc_privacy/lib.rs b/src/librustc_privacy/lib.rs index f63102433c1e..2ced61f5753a 100644 --- a/src/librustc_privacy/lib.rs +++ b/src/librustc_privacy/lib.rs @@ -9,7 +9,6 @@ // except according to those terms. #![crate_name = "rustc_privacy"] -#![unstable(feature = "rustc_private", issue = "27812")] #![crate_type = "dylib"] #![crate_type = "rlib"] #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", @@ -18,8 +17,10 @@ #![deny(warnings)] #![feature(rustc_diagnostic_macros)] -#![feature(rustc_private)] -#![feature(staged_api)] + +#![cfg_attr(stage0, unstable(feature = "rustc_private", issue = "27812"))] +#![cfg_attr(stage0, feature(rustc_private))] +#![cfg_attr(stage0, feature(staged_api))] extern crate rustc; #[macro_use] extern crate syntax; diff --git a/src/librustc_resolve/lib.rs b/src/librustc_resolve/lib.rs index ac556270886a..ee72aee042e9 100644 --- a/src/librustc_resolve/lib.rs +++ b/src/librustc_resolve/lib.rs @@ -9,7 +9,6 @@ // except according to those terms. #![crate_name = "rustc_resolve"] -#![unstable(feature = "rustc_private", issue = "27812")] #![crate_type = "dylib"] #![crate_type = "rlib"] #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", @@ -19,8 +18,10 @@ #![feature(associated_consts)] #![feature(rustc_diagnostic_macros)] -#![feature(rustc_private)] -#![feature(staged_api)] + +#![cfg_attr(stage0, unstable(feature = "rustc_private", issue = "27812"))] +#![cfg_attr(stage0, feature(rustc_private))] +#![cfg_attr(stage0, feature(staged_api))] #[macro_use] extern crate log; diff --git a/src/librustc_save_analysis/lib.rs b/src/librustc_save_analysis/lib.rs index fd6898d19d84..cc98754f6104 100644 --- a/src/librustc_save_analysis/lib.rs +++ b/src/librustc_save_analysis/lib.rs @@ -9,7 +9,6 @@ // except according to those terms. #![crate_name = "rustc_save_analysis"] -#![unstable(feature = "rustc_private", issue = "27812")] #![crate_type = "dylib"] #![crate_type = "rlib"] #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", @@ -19,8 +18,10 @@ #![feature(custom_attribute)] #![allow(unused_attributes)] -#![feature(rustc_private)] -#![feature(staged_api)] + +#![cfg_attr(stage0, unstable(feature = "rustc_private", issue = "27812"))] +#![cfg_attr(stage0, feature(rustc_private))] +#![cfg_attr(stage0, feature(staged_api))] #[macro_use] extern crate rustc; diff --git a/src/librustc_trans/lib.rs b/src/librustc_trans/lib.rs index 111c25477216..ff094d04c846 100644 --- a/src/librustc_trans/lib.rs +++ b/src/librustc_trans/lib.rs @@ -15,7 +15,6 @@ //! This API is completely unstable and subject to change. #![crate_name = "rustc_trans"] -#![unstable(feature = "rustc_private", issue = "27812")] #![crate_type = "dylib"] #![crate_type = "rlib"] #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", @@ -33,12 +32,14 @@ #![feature(libc)] #![feature(quote)] #![feature(rustc_diagnostic_macros)] -#![feature(rustc_private)] #![feature(slice_patterns)] -#![feature(staged_api)] #![feature(unicode)] #![feature(conservative_impl_trait)] +#![cfg_attr(stage0, unstable(feature = "rustc_private", issue = "27812"))] +#![cfg_attr(stage0, feature(rustc_private))] +#![cfg_attr(stage0, feature(staged_api))] + use rustc::dep_graph::WorkProduct; use syntax_pos::symbol::Symbol; diff --git a/src/librustc_typeck/lib.rs b/src/librustc_typeck/lib.rs index 84de4ff2b7b6..99ee1cff7fd2 100644 --- a/src/librustc_typeck/lib.rs +++ b/src/librustc_typeck/lib.rs @@ -64,7 +64,6 @@ This API is completely unstable and subject to change. */ #![crate_name = "rustc_typeck"] -#![unstable(feature = "rustc_private", issue = "27812")] #![crate_type = "dylib"] #![crate_type = "rlib"] #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", @@ -81,8 +80,10 @@ This API is completely unstable and subject to change. #![feature(never_type)] #![feature(quote)] #![feature(rustc_diagnostic_macros)] -#![feature(rustc_private)] -#![feature(staged_api)] + +#![cfg_attr(stage0, unstable(feature = "rustc_private", issue = "27812"))] +#![cfg_attr(stage0, feature(rustc_private))] +#![cfg_attr(stage0, feature(staged_api))] #[macro_use] extern crate log; #[macro_use] extern crate syntax; diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs index 1156fadf8c02..d89fa547a89c 100644 --- a/src/librustdoc/lib.rs +++ b/src/librustdoc/lib.rs @@ -9,7 +9,6 @@ // except according to those terms. #![crate_name = "rustdoc"] -#![unstable(feature = "rustc_private", issue = "27812")] #![crate_type = "dylib"] #![crate_type = "rlib"] #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", @@ -21,14 +20,16 @@ #![feature(box_patterns)] #![feature(box_syntax)] #![feature(libc)] -#![feature(rustc_private)] #![feature(set_stdio)] #![feature(slice_patterns)] -#![feature(staged_api)] #![feature(test)] #![feature(unicode)] #![feature(vec_remove_item)] +#![cfg_attr(stage0, unstable(feature = "rustc_private", issue = "27812"))] +#![cfg_attr(stage0, feature(rustc_private))] +#![cfg_attr(stage0, feature(staged_api))] + extern crate arena; extern crate getopts; extern crate env_logger; diff --git a/src/libserialize/lib.rs b/src/libserialize/lib.rs index 2b31e2f41080..4eb2cad5c91b 100644 --- a/src/libserialize/lib.rs +++ b/src/libserialize/lib.rs @@ -15,9 +15,9 @@ Core encoding and decoding interfaces. */ #![crate_name = "serialize"] -#![unstable(feature = "rustc_private", +#![cfg_attr(stage0, unstable(feature = "rustc_private", reason = "deprecated in favor of rustc-serialize on crates.io", - issue = "27812")] + issue = "27812"))] #![crate_type = "rlib"] #![crate_type = "dylib"] #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", @@ -32,7 +32,7 @@ Core encoding and decoding interfaces. #![feature(core_intrinsics)] #![feature(i128_type)] #![feature(specialization)] -#![feature(staged_api)] +#![cfg_attr(stage0, feature(staged_api))] #![cfg_attr(test, feature(test))] extern crate collections; diff --git a/src/libsyntax/lib.rs b/src/libsyntax/lib.rs index 89c67b88cbde..32dafcdb582f 100644 --- a/src/libsyntax/lib.rs +++ b/src/libsyntax/lib.rs @@ -15,7 +15,6 @@ //! This API is completely unstable and subject to change. #![crate_name = "syntax"] -#![unstable(feature = "rustc_private", issue = "27812")] #![crate_type = "dylib"] #![crate_type = "rlib"] #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", @@ -24,12 +23,14 @@ test(attr(deny(warnings))))] #![deny(warnings)] -#![feature(rustc_private)] -#![feature(staged_api)] #![feature(unicode)] #![feature(rustc_diagnostic_macros)] #![feature(i128_type)] +#![cfg_attr(stage0, unstable(feature = "rustc_private", issue = "27812"))] +#![cfg_attr(stage0, feature(rustc_private))] +#![cfg_attr(stage0, feature(staged_api))] + extern crate serialize; #[macro_use] extern crate log; #[macro_use] extern crate bitflags; diff --git a/src/libsyntax_ext/lib.rs b/src/libsyntax_ext/lib.rs index e35e79df5852..60f5d24ac975 100644 --- a/src/libsyntax_ext/lib.rs +++ b/src/libsyntax_ext/lib.rs @@ -11,7 +11,6 @@ //! Syntax extensions in the Rust compiler. #![crate_name = "syntax_ext"] -#![unstable(feature = "rustc_private", issue = "27812")] #![crate_type = "dylib"] #![crate_type = "rlib"] #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", @@ -20,8 +19,10 @@ #![deny(warnings)] #![feature(proc_macro_internals)] -#![feature(rustc_private)] -#![feature(staged_api)] + +#![cfg_attr(stage0, unstable(feature = "rustc_private", issue = "27812"))] +#![cfg_attr(stage0, feature(rustc_private))] +#![cfg_attr(stage0, feature(staged_api))] extern crate fmt_macros; extern crate log; diff --git a/src/libsyntax_pos/lib.rs b/src/libsyntax_pos/lib.rs index eb86a8e13797..25f74aeecf40 100644 --- a/src/libsyntax_pos/lib.rs +++ b/src/libsyntax_pos/lib.rs @@ -15,7 +15,6 @@ //! This API is completely unstable and subject to change. #![crate_name = "syntax_pos"] -#![unstable(feature = "rustc_private", issue = "27812")] #![crate_type = "dylib"] #![crate_type = "rlib"] #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", @@ -27,10 +26,12 @@ #![feature(custom_attribute)] #![feature(optin_builtin_traits)] #![allow(unused_attributes)] -#![feature(rustc_private)] -#![feature(staged_api)] #![feature(specialization)] +#![cfg_attr(stage0, unstable(feature = "rustc_private", issue = "27812"))] +#![cfg_attr(stage0, feature(rustc_private))] +#![cfg_attr(stage0, feature(staged_api))] + use std::cell::{Cell, RefCell}; use std::ops::{Add, Sub}; use std::rc::Rc; diff --git a/src/libterm/lib.rs b/src/libterm/lib.rs index 370757c06091..eb0ee6ba154a 100644 --- a/src/libterm/lib.rs +++ b/src/libterm/lib.rs @@ -41,9 +41,6 @@ //! [ti]: https://en.wikipedia.org/wiki/Terminfo #![crate_name = "term"] -#![unstable(feature = "rustc_private", - reason = "use the crates.io `term` library instead", - issue = "27812")] #![crate_type = "rlib"] #![crate_type = "dylib"] #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", @@ -54,13 +51,15 @@ #![deny(missing_docs)] #![deny(warnings)] -#![feature(box_syntax)] #![feature(staged_api)] #![cfg_attr(windows, feature(libc))] // Handle rustfmt skips #![feature(custom_attribute)] #![allow(unused_attributes)] +#![cfg_attr(stage0, unstable(feature = "rustc_private", issue = "27812"))] +#![cfg_attr(stage0, feature(staged_api))] + use std::io::prelude::*; pub use terminfo::TerminfoTerminal;