diff --git a/src/libcore/char/methods.rs b/src/libcore/char/methods.rs index e843303380a..99f88591eea 100644 --- a/src/libcore/char/methods.rs +++ b/src/libcore/char/methods.rs @@ -553,10 +553,12 @@ impl char { /// 'XID_Start' is a Unicode Derived Property specified in /// [UAX #31](http://unicode.org/reports/tr31/#NFKC_Modifications), /// mostly similar to `ID_Start` but modified for closure under `NFKx`. - #[unstable(feature = "rustc_private", - reason = "mainly needed for compiler internals", - issue = "27812")] - #[inline] + #[cfg_attr(bootstrap, + unstable(feature = "rustc_private", + reason = "mainly needed for compiler internals", + issue = "27812"))] + #[cfg_attr(not(bootstrap), + unstable(feature = "unicode_internals", issue = "0"))] pub fn is_xid_start(self) -> bool { derived_property::XID_Start(self) } @@ -567,9 +569,12 @@ impl char { /// 'XID_Continue' is a Unicode Derived Property specified in /// [UAX #31](http://unicode.org/reports/tr31/#NFKC_Modifications), /// mostly similar to 'ID_Continue' but modified for closure under NFKx. - #[unstable(feature = "rustc_private", - reason = "mainly needed for compiler internals", - issue = "27812")] + #[cfg_attr(bootstrap, + unstable(feature = "rustc_private", + reason = "mainly needed for compiler internals", + issue = "27812"))] + #[cfg_attr(not(bootstrap), + unstable(feature = "unicode_internals", issue = "0"))] #[inline] pub fn is_xid_continue(self) -> bool { derived_property::XID_Continue(self) diff --git a/src/libfmt_macros/lib.rs b/src/libfmt_macros/lib.rs index 39f130b82ed..f1c2b1fb871 100644 --- a/src/libfmt_macros/lib.rs +++ b/src/libfmt_macros/lib.rs @@ -13,6 +13,7 @@ #![feature(nll)] #![feature(rustc_private)] +#![feature(unicode_internals)] pub use Piece::*; pub use Position::*; diff --git a/src/librustc_lexer/src/lib.rs b/src/librustc_lexer/src/lib.rs index 12e095b8bd5..c02abe6b89f 100644 --- a/src/librustc_lexer/src/lib.rs +++ b/src/librustc_lexer/src/lib.rs @@ -1,6 +1,5 @@ // We want to be able to build this crate with a stable compiler, so feature -// flags should optional. -#![cfg_attr(not(feature = "unicode-xid"), feature(rustc_private))] +// flags should be optional. #![cfg_attr(not(feature = "unicode-xid"), feature(unicode_internals))] mod cursor; diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs index 58777130b7f..3627ce6a5aa 100644 --- a/src/librustdoc/lib.rs +++ b/src/librustdoc/lib.rs @@ -21,6 +21,7 @@ #![feature(inner_deref)] #![feature(never_type)] #![feature(mem_take)] +#![feature(unicode_internals)] #![recursion_limit="256"] diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs index 6a3f58ec89e..43f0eaae7c9 100644 --- a/src/libsyntax/feature_gate.rs +++ b/src/libsyntax/feature_gate.rs @@ -126,6 +126,9 @@ declare_features! ( // no-tracking-issue-start + // Allows using compiler's own crates. + (active, rustc_private, "1.0.0", Some(27812), None), + // Allows using the `rust-intrinsic`'s "ABI". (active, intrinsics, "1.0.0", None, None), diff --git a/src/libsyntax_ext/lib.rs b/src/libsyntax_ext/lib.rs index da0f8ca6da0..7de90278ed7 100644 --- a/src/libsyntax_ext/lib.rs +++ b/src/libsyntax_ext/lib.rs @@ -12,6 +12,7 @@ #![feature(decl_macro)] #![feature(nll)] #![feature(rustc_diagnostic_macros)] +#![feature(unicode_internals)] #![recursion_limit="256"] diff --git a/src/test/ui/feature-gate/rustc-private.rs b/src/test/ui/feature-gate/rustc-private.rs new file mode 100644 index 00000000000..7b8944bb0a0 --- /dev/null +++ b/src/test/ui/feature-gate/rustc-private.rs @@ -0,0 +1,5 @@ +// gate-test-rustc_private + +extern crate libc; //~ ERROR use of unstable library feature 'rustc_private' + +fn main() {} diff --git a/src/test/ui/feature-gate/rustc-private.stderr b/src/test/ui/feature-gate/rustc-private.stderr new file mode 100644 index 00000000000..be320718145 --- /dev/null +++ b/src/test/ui/feature-gate/rustc-private.stderr @@ -0,0 +1,12 @@ +error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? + --> $DIR/rustc-private.rs:3:1 + | +LL | extern crate libc; + | ^^^^^^^^^^^^^^^^^^ + | + = note: for more information, see https://github.com/rust-lang/rust/issues/27812 + = help: add `#![feature(rustc_private)]` to the crate attributes to enable + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0658`.