Auto merge of #43373 - alexcrichton:stabilize-1.20.0, r=aturon

Stabilize more APIs for the 1.20.0 release

In addition to the few stabilizations that have already landed, this cleans up the remaining APIs that are in `final-comment-period` right now to be stable by the 1.20.0 release
This commit is contained in:
bors 2017-07-26 23:40:48 +00:00
commit ddaab61101
23 changed files with 47 additions and 128 deletions

View File

@ -1,20 +0,0 @@
# `compile_error`
The tracking issue for this feature is: [#40872]
[#40872]: https://github.com/rust-lang/rust/issues/40872
------------------------
The `compile_error` feature adds a macro which will generate a compilation
error with the specified error message.
## Examples
```rust,compile_fail
#![feature(compile_error)]
fn main() {
compile_error!("The error message"); //ERROR The error message
}
```

View File

@ -79,11 +79,9 @@
#![cfg_attr(test, allow(deprecated))] // rand
#![cfg_attr(test, feature(placement_in))]
#![cfg_attr(not(test), feature(char_escape_debug))]
#![cfg_attr(not(test), feature(core_float))]
#![cfg_attr(not(test), feature(exact_size_is_empty))]
#![cfg_attr(not(test), feature(slice_rotate))]
#![cfg_attr(not(test), feature(str_checked_slicing))]
#![cfg_attr(test, feature(rand, test))]
#![feature(allow_internal_unstable)]
#![feature(box_patterns)]
@ -102,7 +100,6 @@
#![feature(i128_type)]
#![feature(inclusive_range)]
#![feature(lang_items)]
#![feature(manually_drop)]
#![feature(needs_allocator)]
#![feature(nonzero)]
#![feature(offset_to)]
@ -117,7 +114,6 @@
#![feature(specialization)]
#![feature(staged_api)]
#![feature(str_internals)]
#![feature(str_mut_extras)]
#![feature(trusted_len)]
#![feature(unboxed_closures)]
#![feature(unicode)]

View File

@ -290,7 +290,7 @@ impl str {
}
/// Converts a mutable string slice to a mutable byte slice.
#[unstable(feature = "str_mut_extras", issue = "41119")]
#[stable(feature = "str_mut_extras", since = "1.20.0")]
#[inline(always)]
pub unsafe fn as_bytes_mut(&mut self) -> &mut [u8] {
core_str::StrExt::as_bytes_mut(self)
@ -328,14 +328,13 @@ impl str {
/// # Examples
///
/// ```
/// # #![feature(str_checked_slicing)]
/// let v = "🗻∈🌏";
/// assert_eq!(Some("🗻"), v.get(0..4));
/// assert!(v.get(1..).is_none());
/// assert!(v.get(..8).is_none());
/// assert!(v.get(..42).is_none());
/// ```
#[unstable(feature = "str_checked_slicing", issue = "39932")]
#[stable(feature = "str_checked_slicing", since = "1.20.0")]
#[inline]
pub fn get<I: SliceIndex<str>>(&self, i: I) -> Option<&I::Output> {
core_str::StrExt::get(self, i)
@ -351,14 +350,13 @@ impl str {
/// # Examples
///
/// ```
/// # #![feature(str_checked_slicing)]
/// let mut v = String::from("🗻∈🌏");
/// assert_eq!(Some("🗻"), v.get_mut(0..4).map(|v| &*v));
/// assert!(v.get_mut(1..).is_none());
/// assert!(v.get_mut(..8).is_none());
/// assert!(v.get_mut(..42).is_none());
/// ```
#[unstable(feature = "str_checked_slicing", issue = "39932")]
#[stable(feature = "str_checked_slicing", since = "1.20.0")]
#[inline]
pub fn get_mut<I: SliceIndex<str>>(&mut self, i: I) -> Option<&mut I::Output> {
core_str::StrExt::get_mut(self, i)
@ -383,7 +381,6 @@ impl str {
/// # Examples
///
/// ```
/// # #![feature(str_checked_slicing)]
/// let v = "🗻∈🌏";
/// unsafe {
/// assert_eq!("🗻", v.get_unchecked(0..4));
@ -391,7 +388,7 @@ impl str {
/// assert_eq!("🌏", v.get_unchecked(7..11));
/// }
/// ```
#[unstable(feature = "str_checked_slicing", issue = "39932")]
#[stable(feature = "str_checked_slicing", since = "1.20.0")]
#[inline]
pub unsafe fn get_unchecked<I: SliceIndex<str>>(&self, i: I) -> &I::Output {
core_str::StrExt::get_unchecked(self, i)
@ -416,7 +413,6 @@ impl str {
/// # Examples
///
/// ```
/// # #![feature(str_checked_slicing)]
/// let mut v = String::from("🗻∈🌏");
/// unsafe {
/// assert_eq!("🗻", v.get_unchecked_mut(0..4));
@ -424,7 +420,7 @@ impl str {
/// assert_eq!("🌏", v.get_unchecked_mut(7..11));
/// }
/// ```
#[unstable(feature = "str_checked_slicing", issue = "39932")]
#[stable(feature = "str_checked_slicing", since = "1.20.0")]
#[inline]
pub unsafe fn get_unchecked_mut<I: SliceIndex<str>>(&mut self, i: I) -> &mut I::Output {
core_str::StrExt::get_unchecked_mut(self, i)
@ -1729,7 +1725,7 @@ impl str {
}
/// Converts a `Box<str>` into a `Box<[u8]>` without copying or allocating.
#[unstable(feature = "str_box_extras", issue = "41119")]
#[stable(feature = "str_box_extras", since = "1.20.0")]
pub fn into_boxed_bytes(self: Box<str>) -> Box<[u8]> {
self.into()
}
@ -1996,7 +1992,7 @@ impl str {
/// Converts a boxed slice of bytes to a boxed string slice without checking
/// that the string contains valid UTF-8.
#[unstable(feature = "str_box_extras", issue = "41119")]
#[stable(feature = "str_box_extras", since = "1.20.0")]
pub unsafe fn from_boxed_utf8_unchecked(v: Box<[u8]>) -> Box<str> {
mem::transmute(v)
}

View File

@ -24,12 +24,10 @@
#![feature(repr_align)]
#![feature(slice_rotate)]
#![feature(splice)]
#![feature(str_checked_slicing)]
#![feature(str_escape)]
#![feature(test)]
#![feature(unboxed_closures)]
#![feature(unicode)]
#![feature(utf8_error_error_len)]
extern crate alloc;
extern crate test;

View File

@ -379,7 +379,7 @@ pub trait CharExt {
fn escape_unicode(self) -> EscapeUnicode;
#[stable(feature = "core", since = "1.6.0")]
fn escape_default(self) -> EscapeDefault;
#[unstable(feature = "char_escape_debug", issue = "35068")]
#[stable(feature = "char_escape_debug", since = "1.20.0")]
fn escape_debug(self) -> EscapeDebug;
#[stable(feature = "core", since = "1.6.0")]
fn len_utf8(self) -> usize;
@ -776,24 +776,24 @@ impl fmt::Display for EscapeDefault {
///
/// [`escape_debug`]: ../../std/primitive.char.html#method.escape_debug
/// [`char`]: ../../std/primitive.char.html
#[unstable(feature = "char_escape_debug", issue = "35068")]
#[stable(feature = "char_escape_debug", since = "1.20.0")]
#[derive(Clone, Debug)]
pub struct EscapeDebug(EscapeDefault);
#[unstable(feature = "char_escape_debug", issue = "35068")]
#[stable(feature = "char_escape_debug", since = "1.20.0")]
impl Iterator for EscapeDebug {
type Item = char;
fn next(&mut self) -> Option<char> { self.0.next() }
fn size_hint(&self) -> (usize, Option<usize>) { self.0.size_hint() }
}
#[unstable(feature = "char_escape_debug", issue = "35068")]
#[stable(feature = "char_escape_debug", since = "1.20.0")]
impl ExactSizeIterator for EscapeDebug { }
#[unstable(feature = "fused", issue = "35602")]
impl FusedIterator for EscapeDebug {}
#[unstable(feature = "char_escape_debug", issue = "35068")]
#[stable(feature = "char_escape_debug", since = "1.20.0")]
impl fmt::Display for EscapeDebug {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fmt::Display::fmt(&self.0, f)

View File

@ -574,7 +574,7 @@ mod builtin {
/// For more information, see the [RFC].
///
/// [RFC]: https://github.com/rust-lang/rfcs/blob/master/text/1695-add-error-macro.md
#[unstable(feature = "compile_error_macro", issue = "40872")]
#[stable(feature = "compile_error_macro", since = "1.20.0")]
#[macro_export]
#[cfg(dox)]
macro_rules! compile_error { ($msg:expr) => ({ /* compiler built-in */ }) }

View File

@ -838,7 +838,6 @@ pub fn discriminant<T>(v: &T) -> Discriminant<T> {
/// the type:
///
/// ```rust
/// # #![feature(manually_drop)]
/// use std::mem::ManuallyDrop;
/// struct Peach;
/// struct Banana;
@ -864,7 +863,7 @@ pub fn discriminant<T>(v: &T) -> Discriminant<T> {
/// }
/// }
/// ```
#[unstable(feature = "manually_drop", issue = "40673")]
#[stable(feature = "manually_drop", since = "1.20.0")]
#[allow(unions_with_drop_fields)]
pub union ManuallyDrop<T>{ value: T }
@ -874,11 +873,10 @@ impl<T> ManuallyDrop<T> {
/// # Examples
///
/// ```rust
/// # #![feature(manually_drop)]
/// use std::mem::ManuallyDrop;
/// ManuallyDrop::new(Box::new(()));
/// ```
#[unstable(feature = "manually_drop", issue = "40673")]
#[stable(feature = "manually_drop", since = "1.20.0")]
#[inline]
pub fn new(value: T) -> ManuallyDrop<T> {
ManuallyDrop { value: value }
@ -889,12 +887,11 @@ impl<T> ManuallyDrop<T> {
/// # Examples
///
/// ```rust
/// # #![feature(manually_drop)]
/// use std::mem::ManuallyDrop;
/// let x = ManuallyDrop::new(Box::new(()));
/// let _: Box<()> = ManuallyDrop::into_inner(x);
/// ```
#[unstable(feature = "manually_drop", issue = "40673")]
#[stable(feature = "manually_drop", since = "1.20.0")]
#[inline]
pub fn into_inner(slot: ManuallyDrop<T>) -> T {
unsafe {
@ -909,14 +906,14 @@ impl<T> ManuallyDrop<T> {
/// This function runs the destructor of the contained value and thus the wrapped value
/// now represents uninitialized data. It is up to the user of this method to ensure the
/// uninitialized data is not actually used.
#[unstable(feature = "manually_drop", issue = "40673")]
#[stable(feature = "manually_drop", since = "1.20.0")]
#[inline]
pub unsafe fn drop(slot: &mut ManuallyDrop<T>) {
ptr::drop_in_place(&mut slot.value)
}
}
#[unstable(feature = "manually_drop", issue = "40673")]
#[stable(feature = "manually_drop", since = "1.20.0")]
impl<T> ::ops::Deref for ManuallyDrop<T> {
type Target = T;
#[inline]
@ -927,7 +924,7 @@ impl<T> ::ops::Deref for ManuallyDrop<T> {
}
}
#[unstable(feature = "manually_drop", issue = "40673")]
#[stable(feature = "manually_drop", since = "1.20.0")]
impl<T> ::ops::DerefMut for ManuallyDrop<T> {
#[inline]
fn deref_mut(&mut self) -> &mut Self::Target {
@ -937,7 +934,7 @@ impl<T> ::ops::DerefMut for ManuallyDrop<T> {
}
}
#[unstable(feature = "manually_drop", issue = "40673")]
#[stable(feature = "manually_drop", since = "1.20.0")]
impl<T: ::fmt::Debug> ::fmt::Debug for ManuallyDrop<T> {
fn fmt(&self, fmt: &mut ::fmt::Formatter) -> ::fmt::Result {
unsafe {

View File

@ -671,8 +671,6 @@ impl<T> Option<T> {
/// # Examples
///
/// ```
/// #![feature(option_entry)]
///
/// let mut x = None;
///
/// {
@ -685,7 +683,7 @@ impl<T> Option<T> {
/// assert_eq!(x, Some(7));
/// ```
#[inline]
#[unstable(feature = "option_entry", issue = "39288")]
#[stable(feature = "option_entry", since = "1.20.0")]
pub fn get_or_insert(&mut self, v: T) -> &mut T {
match *self {
None => *self = Some(v),
@ -706,8 +704,6 @@ impl<T> Option<T> {
/// # Examples
///
/// ```
/// #![feature(option_entry)]
///
/// let mut x = None;
///
/// {
@ -720,7 +716,7 @@ impl<T> Option<T> {
/// assert_eq!(x, Some(7));
/// ```
#[inline]
#[unstable(feature = "option_entry", issue = "39288")]
#[stable(feature = "option_entry", since = "1.20.0")]
pub fn get_or_insert_with<F: FnOnce() -> T>(&mut self, f: F) -> &mut T {
match *self {
None => *self = Some(f()),

View File

@ -207,7 +207,7 @@ impl Utf8Error {
/// that starts at the index given by `valid_up_to()`.
/// Decoding should resume after that sequence
/// (after inserting a U+FFFD REPLACEMENT CHARACTER) in case of lossy decoding.
#[unstable(feature = "utf8_error_error_len", reason ="new", issue = "40494")]
#[stable(feature = "utf8_error_error_len", since = "1.20.0")]
pub fn error_len(&self) -> Option<usize> {
self.error_len.map(|len| len as usize)
}
@ -301,7 +301,7 @@ pub fn from_utf8(v: &[u8]) -> Result<&str, Utf8Error> {
}
/// Converts a mutable slice of bytes to a mutable string slice.
#[unstable(feature = "str_mut_extras", issue = "41119")]
#[stable(feature = "str_mut_extras", since = "1.20.0")]
pub fn from_utf8_mut(v: &mut [u8]) -> Result<&mut str, Utf8Error> {
run_utf8_validation(v)?;
Ok(unsafe { from_utf8_unchecked_mut(v) })
@ -382,7 +382,7 @@ pub unsafe fn from_utf8_unchecked(v: &[u8]) -> &str {
///
/// [fromutf8]: fn.from_utf8_unchecked.html
#[inline]
#[unstable(feature = "str_mut_extras", issue = "41119")]
#[stable(feature = "str_mut_extras", since = "1.20.0")]
pub unsafe fn from_utf8_unchecked_mut(v: &mut [u8]) -> &mut str {
mem::transmute(v)
}
@ -1776,7 +1776,7 @@ mod traits {
}
}
#[unstable(feature = "str_checked_slicing", issue = "39932")]
#[stable(feature = "str_checked_slicing", since = "1.20.0")]
impl SliceIndex<str> for ops::RangeFull {
type Output = str;
#[inline]
@ -1805,7 +1805,7 @@ mod traits {
}
}
#[unstable(feature = "str_checked_slicing", issue = "39932")]
#[stable(feature = "str_checked_slicing", since = "1.20.0")]
impl SliceIndex<str> for ops::Range<usize> {
type Output = str;
#[inline]
@ -1859,7 +1859,7 @@ mod traits {
}
}
#[unstable(feature = "str_checked_slicing", issue = "39932")]
#[stable(feature = "str_checked_slicing", since = "1.20.0")]
impl SliceIndex<str> for ops::RangeTo<usize> {
type Output = str;
#[inline]
@ -1904,7 +1904,7 @@ mod traits {
}
}
#[unstable(feature = "str_checked_slicing", issue = "39932")]
#[stable(feature = "str_checked_slicing", since = "1.20.0")]
impl SliceIndex<str> for ops::RangeFrom<usize> {
type Output = str;
#[inline]
@ -1951,7 +1951,7 @@ mod traits {
}
}
#[unstable(feature = "str_checked_slicing", issue = "39932")]
#[stable(feature = "str_checked_slicing", since = "1.20.0")]
impl SliceIndex<str> for ops::RangeInclusive<usize> {
type Output = str;
#[inline]
@ -1994,7 +1994,7 @@ mod traits {
#[unstable(feature = "str_checked_slicing", issue = "39932")]
#[stable(feature = "str_checked_slicing", since = "1.20.0")]
impl SliceIndex<str> for ops::RangeToInclusive<usize> {
type Output = str;
#[inline]
@ -2094,13 +2094,13 @@ pub trait StrExt {
#[rustc_deprecated(since = "1.6.0", reason = "use lines() instead now")]
#[allow(deprecated)]
fn lines_any(&self) -> LinesAny;
#[unstable(feature = "str_checked_slicing", issue = "39932")]
#[stable(feature = "str_checked_slicing", since = "1.20.0")]
fn get<I: SliceIndex<str>>(&self, i: I) -> Option<&I::Output>;
#[unstable(feature = "str_checked_slicing", issue = "39932")]
#[stable(feature = "str_checked_slicing", since = "1.20.0")]
fn get_mut<I: SliceIndex<str>>(&mut self, i: I) -> Option<&mut I::Output>;
#[unstable(feature = "str_checked_slicing", issue = "39932")]
#[stable(feature = "str_checked_slicing", since = "1.20.0")]
unsafe fn get_unchecked<I: SliceIndex<str>>(&self, i: I) -> &I::Output;
#[unstable(feature = "str_checked_slicing", issue = "39932")]
#[stable(feature = "str_checked_slicing", since = "1.20.0")]
unsafe fn get_unchecked_mut<I: SliceIndex<str>>(&mut self, i: I) -> &mut I::Output;
#[stable(feature = "core", since = "1.6.0")]
unsafe fn slice_unchecked(&self, begin: usize, end: usize) -> &str;
@ -2123,7 +2123,7 @@ pub trait StrExt {
fn is_char_boundary(&self, index: usize) -> bool;
#[stable(feature = "core", since = "1.6.0")]
fn as_bytes(&self) -> &[u8];
#[unstable(feature = "str_mut_extras", issue = "41119")]
#[stable(feature = "str_mut_extras", since = "1.20.0")]
unsafe fn as_bytes_mut(&mut self) -> &mut [u8];
#[stable(feature = "core", since = "1.6.0")]
fn find<'a, P: Pattern<'a>>(&'a self, pat: P) -> Option<usize>;

View File

@ -11,7 +11,6 @@
#![deny(warnings)]
#![feature(box_syntax)]
#![feature(char_escape_debug)]
#![feature(const_fn)]
#![feature(core_float)]
#![feature(core_private_bignum)]

View File

@ -34,7 +34,6 @@
#![feature(conservative_impl_trait)]
#![feature(discriminant_value)]
#![feature(specialization)]
#![feature(manually_drop)]
#![cfg_attr(unix, feature(libc))]
#![cfg_attr(test, feature(test))]

View File

@ -453,8 +453,6 @@ impl CString {
/// # Examples
///
/// ```
/// #![feature(as_c_str)]
///
/// use std::ffi::{CString, CStr};
///
/// let c_string = CString::new(b"foo".to_vec()).unwrap();
@ -462,7 +460,7 @@ impl CString {
/// assert_eq!(c_str, CStr::from_bytes_with_nul(b"foo\0").unwrap());
/// ```
#[inline]
#[unstable(feature = "as_c_str", issue = "40380")]
#[stable(feature = "as_c_str", since = "1.20.0")]
pub fn as_c_str(&self) -> &CStr {
&*self
}
@ -474,15 +472,13 @@ impl CString {
/// # Examples
///
/// ```
/// #![feature(into_boxed_c_str)]
///
/// use std::ffi::{CString, CStr};
///
/// let c_string = CString::new(b"foo".to_vec()).unwrap();
/// let boxed = c_string.into_boxed_c_str();
/// assert_eq!(&*boxed, CStr::from_bytes_with_nul(b"foo\0").unwrap());
/// ```
#[unstable(feature = "into_boxed_c_str", issue = "40380")]
#[stable(feature = "into_boxed_c_str", since = "1.20.0")]
pub fn into_boxed_c_str(self) -> Box<CStr> {
unsafe { mem::transmute(self.into_inner()) }
}
@ -1001,15 +997,13 @@ impl CStr {
/// # Examples
///
/// ```
/// #![feature(into_boxed_c_str)]
///
/// use std::ffi::CString;
///
/// let c_string = CString::new(b"foo".to_vec()).unwrap();
/// let boxed = c_string.into_boxed_c_str();
/// assert_eq!(boxed.into_c_string(), CString::new("foo").unwrap());
/// ```
#[unstable(feature = "into_boxed_c_str", issue = "40380")]
#[stable(feature = "into_boxed_c_str", since = "1.20.0")]
pub fn into_c_string(self: Box<CStr>) -> CString {
unsafe { mem::transmute(self) }
}

View File

@ -252,15 +252,13 @@ impl OsString {
/// # Examples
///
/// ```
/// #![feature(into_boxed_os_str)]
///
/// use std::ffi::{OsString, OsStr};
///
/// let s = OsString::from("hello");
///
/// let b: Box<OsStr> = s.into_boxed_os_str();
/// ```
#[unstable(feature = "into_boxed_os_str", issue = "40380")]
#[stable(feature = "into_boxed_os_str", since = "1.20.0")]
pub fn into_boxed_os_str(self) -> Box<OsStr> {
unsafe { mem::transmute(self.inner.into_box()) }
}
@ -511,7 +509,7 @@ impl OsStr {
///
/// [`Box`]: ../boxed/struct.Box.html
/// [`OsString`]: struct.OsString.html
#[unstable(feature = "into_boxed_os_str", issue = "40380")]
#[stable(feature = "into_boxed_os_str", since = "1.20.0")]
pub fn into_os_string(self: Box<OsStr>) -> OsString {
let inner: Box<Slice> = unsafe { mem::transmute(self) };
OsString { inner: Buf::from_box(inner) }

View File

@ -249,7 +249,6 @@
#![feature(cfg_target_has_atomic)]
#![feature(cfg_target_thread_local)]
#![feature(cfg_target_vendor)]
#![feature(char_escape_debug)]
#![feature(char_error_internals)]
#![feature(char_internals)]
#![feature(collections_range)]
@ -304,7 +303,6 @@
#![feature(stmt_expr_attributes)]
#![feature(str_char)]
#![feature(str_internals)]
#![feature(str_mut_extras)]
#![feature(str_utf16)]
#![feature(test, rustc_private)]
#![feature(thread_local)]

View File

@ -249,7 +249,7 @@ pub mod builtin {
/// For more information, see the [RFC].
///
/// [RFC]: https://github.com/rust-lang/rfcs/blob/master/text/1695-add-error-macro.md
#[unstable(feature = "compile_error_macro", issue = "40872")]
#[stable(feature = "compile_error_macro", since = "1.20.0")]
#[macro_export]
macro_rules! compile_error { ($msg:expr) => ({ /* compiler built-in */ }) }

View File

@ -1327,7 +1327,7 @@ impl PathBuf {
///
/// [`Box`]: ../../std/boxed/struct.Box.html
/// [`Path`]: struct.Path.html
#[unstable(feature = "into_boxed_path", issue = "40380")]
#[stable(feature = "into_boxed_path", since = "1.20.0")]
pub fn into_boxed_path(self) -> Box<Path> {
unsafe { mem::transmute(self.inner.into_boxed_os_str()) }
}
@ -2300,7 +2300,7 @@ impl Path {
///
/// [`Box`]: ../../std/boxed/struct.Box.html
/// [`PathBuf`]: struct.PathBuf.html
#[unstable(feature = "into_boxed_path", issue = "40380")]
#[stable(feature = "into_boxed_path", since = "1.20.0")]
pub fn into_path_buf(self: Box<Path>) -> PathBuf {
let inner: Box<OsStr> = unsafe { mem::transmute(self) };
PathBuf { inner: OsString::from(inner) }

View File

@ -326,7 +326,6 @@ impl char {
/// As an iterator:
///
/// ```
/// # #![feature(char_escape_debug)]
/// for c in '\n'.escape_debug() {
/// print!("{}", c);
/// }
@ -336,7 +335,6 @@ impl char {
/// Using `println!` directly:
///
/// ```
/// # #![feature(char_escape_debug)]
/// println!("{}", '\n'.escape_debug());
/// ```
///
@ -349,10 +347,9 @@ impl char {
/// Using `to_string`:
///
/// ```
/// # #![feature(char_escape_debug)]
/// assert_eq!('\n'.escape_debug().to_string(), "\\n");
/// ```
#[unstable(feature = "char_escape_debug", issue = "35068")]
#[stable(feature = "char_escape_debug", since = "1.20.0")]
#[inline]
pub fn escape_debug(self) -> EscapeDebug {
C::escape_debug(self)

View File

@ -32,7 +32,6 @@
#![deny(warnings)]
#![no_std]
#![feature(char_escape_debug)]
#![feature(core_char_ext)]
#![feature(str_internals)]
#![feature(core_intrinsics)]

View File

@ -1041,7 +1041,6 @@ impl<'feat> ExpansionConfig<'feat> {
fn enable_allow_internal_unstable = allow_internal_unstable,
fn enable_custom_derive = custom_derive,
fn proc_macro_enabled = proc_macro,
fn enable_compile_error = compile_error,
}
}

View File

@ -117,7 +117,6 @@ macro_rules! declare_features {
declare_features! (
(active, asm, "1.0.0", Some(29722)),
(active, compile_error, "1.20.0", Some(40872)),
(active, concat_idents, "1.0.0", Some(29599)),
(active, link_args, "1.0.0", Some(29596)),
(active, log_syntax, "1.0.0", Some(29598)),
@ -445,6 +444,8 @@ declare_features! (
// Allows the definition of associated constants in `trait` or `impl`
// blocks.
(accepted, associated_consts, "1.20.0", Some(29646)),
// Usage of the `compile_error!` macro
(accepted, compile_error, "1.20.0", Some(40872)),
);
// If you change this, please modify src/doc/unstable-book as well. You must
@ -1040,9 +1041,6 @@ pub const EXPLAIN_LOG_SYNTAX: &'static str =
pub const EXPLAIN_CONCAT_IDENTS: &'static str =
"`concat_idents` is not stable enough for use and is subject to change";
pub const EXPLAIN_COMPILE_ERROR: &'static str =
"`compile_error` is not stable enough for use and is subject to change";
pub const EXPLAIN_TRACE_MACROS: &'static str =
"`trace_macros` is not stable enough for use and is subject to change";
pub const EXPLAIN_ALLOW_INTERNAL_UNSTABLE: &'static str =

View File

@ -12,7 +12,6 @@
use syntax::ext::base::*;
use syntax::ext::base;
use syntax::feature_gate;
use syntax_pos::Span;
use syntax::tokenstream;
@ -20,15 +19,6 @@ pub fn expand_compile_error<'cx>(cx: &'cx mut ExtCtxt,
sp: Span,
tts: &[tokenstream::TokenTree])
-> Box<base::MacResult + 'cx> {
if !cx.ecfg.enable_compile_error() {
feature_gate::emit_feature_err(&cx.parse_sess,
"compile_error",
sp,
feature_gate::GateIssue::Language,
feature_gate::EXPLAIN_COMPILE_ERROR);
return DummyResult::expr(sp);
}
let var = match get_single_str_from_tts(cx, sp, tts, "compile_error!") {
None => return DummyResult::expr(sp),
Some(v) => v,

View File

@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(compile_error)]
fn main() {
compile_error!("a very descriptive error message"); //~ ERROR: a very descriptive error message
}

View File

@ -1,13 +0,0 @@
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
fn main() {
compile_error!("test"); //~ ERROR: `compile_error` is not stable enough
}