From e56fa2471a6668261dd3b0428ebfb5babe851230 Mon Sep 17 00:00:00 2001 From: est31 Date: Tue, 8 Aug 2017 11:24:30 +0200 Subject: [PATCH 01/15] Avoid calling the column!() macro in panic --- src/libcore/macros.rs | 14 ++++++++++++-- src/libstd/macros.rs | 16 ++++++++++++++-- src/libsyntax_ext/lib.rs | 1 + src/test/run-pass/issue-43057.rs | 23 +++++++++++++++++++++++ 4 files changed, 50 insertions(+), 4 deletions(-) create mode 100644 src/test/run-pass/issue-43057.rs diff --git a/src/libcore/macros.rs b/src/libcore/macros.rs index ae74016ad7449..b09e6ea3328b8 100644 --- a/src/libcore/macros.rs +++ b/src/libcore/macros.rs @@ -8,6 +8,16 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#[macro_export] +// This stability attribute is totally useless. +#[stable(feature = "rust1", since = "1.0.0")] +#[cfg(stage0)] +macro_rules! __rust_unstable_column { + () => { + column!() + } +} + /// Entry point of thread panic, for details, see std::macros #[macro_export] #[allow_internal_unstable] @@ -18,7 +28,7 @@ macro_rules! panic { ); ($msg:expr) => ({ static _MSG_FILE_LINE_COL: (&'static str, &'static str, u32, u32) = - ($msg, file!(), line!(), column!()); + ($msg, file!(), line!(), __rust_unstable_column!()); $crate::panicking::panic(&_MSG_FILE_LINE_COL) }); ($fmt:expr, $($arg:tt)*) => ({ @@ -27,7 +37,7 @@ macro_rules! panic { // insufficient, since the user may have // `#[forbid(dead_code)]` and which cannot be overridden. static _MSG_FILE_LINE_COL: (&'static str, u32, u32) = - (file!(), line!(), column!()); + (file!(), line!(), __rust_unstable_column!()); $crate::panicking::panic_fmt(format_args!($fmt, $($arg)*), &_MSG_FILE_LINE_COL) }); } diff --git a/src/libstd/macros.rs b/src/libstd/macros.rs index 6ad22820a7d90..43c4ba48b1bcc 100644 --- a/src/libstd/macros.rs +++ b/src/libstd/macros.rs @@ -14,6 +14,16 @@ //! library. Each macro is available for use when linking against the standard //! library. +#[macro_export] +// This stability attribute is totally useless. +#[stable(feature = "rust1", since = "1.0.0")] +#[cfg(stage0)] +macro_rules! __rust_unstable_column { + () => { + column!() + } +} + /// The entry point for panic of Rust threads. /// /// This macro is used to inject panic into a Rust thread, causing the thread to @@ -48,7 +58,8 @@ macro_rules! panic { ($msg:expr) => ({ $crate::rt::begin_panic_new($msg, { // static requires less code at runtime, more constant data - static _FILE_LINE_COL: (&'static str, u32, u32) = (file!(), line!(), column!()); + static _FILE_LINE_COL: (&'static str, u32, u32) = (file!(), line!(), + __rust_unstable_column!()); &_FILE_LINE_COL }) }); @@ -58,7 +69,8 @@ macro_rules! panic { // used inside a dead function. Just `#[allow(dead_code)]` is // insufficient, since the user may have // `#[forbid(dead_code)]` and which cannot be overridden. - static _FILE_LINE_COL: (&'static str, u32, u32) = (file!(), line!(), column!()); + static _FILE_LINE_COL: (&'static str, u32, u32) = (file!(), line!(), + __rust_unstable_column!()); &_FILE_LINE_COL }) }); diff --git a/src/libsyntax_ext/lib.rs b/src/libsyntax_ext/lib.rs index 8ba07c35b0543..558d2e90310fb 100644 --- a/src/libsyntax_ext/lib.rs +++ b/src/libsyntax_ext/lib.rs @@ -89,6 +89,7 @@ pub fn register_builtins(resolver: &mut syntax::ext::base::Resolver, use syntax::ext::source_util::*; register! { line: expand_line, + __rust_unstable_column: expand_column, column: expand_column, file: expand_file, stringify: expand_stringify, diff --git a/src/test/run-pass/issue-43057.rs b/src/test/run-pass/issue-43057.rs new file mode 100644 index 0000000000000..152ddfb193fc5 --- /dev/null +++ b/src/test/run-pass/issue-43057.rs @@ -0,0 +1,23 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![allow(unused)] + +macro_rules! column { + ($i:ident) => { + $i + }; +} + +fn foo() -> ! { + panic!(); +} + +fn main() {} From c51b709ae6ca2c009f3c59d2e3b677b6174cffe7 Mon Sep 17 00:00:00 2001 From: est31 Date: Thu, 10 Aug 2017 01:42:36 +0200 Subject: [PATCH 02/15] Add a feature gate @alexcrichton figured out a way how to do it :) --- src/libsyntax/ext/source_util.rs | 10 ++++++++++ src/libsyntax_ext/lib.rs | 2 +- .../compile-fail/rust-unstable-column-gated.rs | 14 ++++++++++++++ 3 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 src/test/compile-fail/rust-unstable-column-gated.rs diff --git a/src/libsyntax/ext/source_util.rs b/src/libsyntax/ext/source_util.rs index 3cdd3a4b2c31d..b293aa8de38b2 100644 --- a/src/libsyntax/ext/source_util.rs +++ b/src/libsyntax/ext/source_util.rs @@ -52,6 +52,16 @@ pub fn expand_column(cx: &mut ExtCtxt, sp: Span, tts: &[tokenstream::TokenTree]) base::MacEager::expr(cx.expr_u32(topmost, loc.col.to_usize() as u32)) } +/* __rust_unstable_column!(): expands to the current column number */ +pub fn expand_column_gated(cx: &mut ExtCtxt, sp: Span, tts: &[tokenstream::TokenTree]) + -> Box { + if sp.allows_unstable() { + expand_column(cx, sp, tts) + } else { + cx.span_fatal(sp, "the __rust_unstable_column macro is unstable"); + } +} + /// file!(): expands to the current filename */ /// The filemap (`loc.file`) contains a bunch more information we could spit /// out if we wanted. diff --git a/src/libsyntax_ext/lib.rs b/src/libsyntax_ext/lib.rs index 558d2e90310fb..5eab81dd28fc4 100644 --- a/src/libsyntax_ext/lib.rs +++ b/src/libsyntax_ext/lib.rs @@ -89,7 +89,7 @@ pub fn register_builtins(resolver: &mut syntax::ext::base::Resolver, use syntax::ext::source_util::*; register! { line: expand_line, - __rust_unstable_column: expand_column, + __rust_unstable_column: expand_column_gated, column: expand_column, file: expand_file, stringify: expand_stringify, diff --git a/src/test/compile-fail/rust-unstable-column-gated.rs b/src/test/compile-fail/rust-unstable-column-gated.rs new file mode 100644 index 0000000000000..abc92c86eec6a --- /dev/null +++ b/src/test/compile-fail/rust-unstable-column-gated.rs @@ -0,0 +1,14 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +fn main() { + println!("{}", __rust_unstable_column!()); + //~^ERROR the __rust_unstable_column macro is unstable +} From 309ab478d31a699493fdb1593d9cb133705f51f0 Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Sat, 29 Jul 2017 21:40:37 +0300 Subject: [PATCH 03/15] save the subobligations as well --- src/librustc/traits/project.rs | 18 +++++--- src/test/run-pass/issue-43132.rs | 74 ++++++++++++++++++++++++++++++++ 2 files changed, 86 insertions(+), 6 deletions(-) create mode 100644 src/test/run-pass/issue-43132.rs diff --git a/src/librustc/traits/project.rs b/src/librustc/traits/project.rs index b5284852747f9..9e095945624cf 100644 --- a/src/librustc/traits/project.rs +++ b/src/librustc/traits/project.rs @@ -462,13 +462,19 @@ fn opt_normalize_projection_type<'a, 'b, 'gcx, 'tcx>( selcx.infcx().report_overflow_error(&obligation, false); } Err(ProjectionCacheEntry::NormalizedTy(ty)) => { - // If we find the value in the cache, then the obligations - // have already been returned from the previous entry (and - // should therefore have been honored). + // If we find the value in the cache, then return it along + // with the obligations that went along with it. Note + // that, when using a fulfillment context, these + // obligations could in principle be ignored: they have + // already been registered when the cache entry was + // created (and hence the new ones will quickly be + // discarded as duplicated). But when doing trait + // evaluation this is not the case, and dropping the trait + // evaluations can causes ICEs (e.g. #43132). debug!("opt_normalize_projection_type: \ found normalized ty `{:?}`", ty); - return Some(NormalizedTy { value: ty, obligations: vec![] }); + return Some(ty); } Err(ProjectionCacheEntry::Error) => { debug!("opt_normalize_projection_type: \ @@ -1336,7 +1342,7 @@ enum ProjectionCacheEntry<'tcx> { InProgress, Ambiguous, Error, - NormalizedTy(Ty<'tcx>), + NormalizedTy(NormalizedTy<'tcx>), } // NB: intentionally not Clone @@ -1389,7 +1395,7 @@ impl<'tcx> ProjectionCache<'tcx> { let fresh_key = if cacheable { debug!("ProjectionCacheEntry::complete: adding cache entry: key={:?}, value={:?}", key, value); - self.map.insert(key, ProjectionCacheEntry::NormalizedTy(value.value)) + self.map.insert(key, ProjectionCacheEntry::NormalizedTy(value.clone())) } else { debug!("ProjectionCacheEntry::complete: cannot cache: key={:?}, value={:?}", key, value); diff --git a/src/test/run-pass/issue-43132.rs b/src/test/run-pass/issue-43132.rs new file mode 100644 index 0000000000000..64b3b092b8936 --- /dev/null +++ b/src/test/run-pass/issue-43132.rs @@ -0,0 +1,74 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![allow(unused)] + +fn main() { +} + +fn foo() { + let b = mk::< + Forward<(Box>,)>, + >(); + b.map_err(|_| ()).join(); +} + +fn mk() -> T { + loop {} +} + +impl, E> Future for (I,) { + type Error = E; +} + +struct Forward { + _a: T, +} + +impl Future for Forward +where + T::Error: From, +{ + type Error = T::Error; +} + +trait Future { + type Error; + + fn map_err(self, _: F) -> (Self, F) + where + F: FnOnce(Self::Error) -> E, + Self: Sized, + { + loop {} + } + + fn join(self) -> (MaybeDone, ()) + where + Self: Sized, + { + loop {} + } +} + +impl Future for Box { + type Error = S::Error; +} + +enum MaybeDone { + _Done(A::Error), +} + +impl Future for (A, F) +where + F: FnOnce(A::Error) -> U, +{ + type Error = U; +} From 086f9e497fae515f7149848c5ccf78dfb6fbecad Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Thu, 27 Jul 2017 14:53:44 -0700 Subject: [PATCH 04/15] std: Mark `Layout::repeat` as `#[inline]` This fixes an optimization regression by allowing LLVM to see through more functions. Closes #43272 --- src/liballoc/allocator.rs | 1 + src/test/codegen/vec-optimizes-away.rs | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 src/test/codegen/vec-optimizes-away.rs diff --git a/src/liballoc/allocator.rs b/src/liballoc/allocator.rs index ca5388b470147..23a005cbaf788 100644 --- a/src/liballoc/allocator.rs +++ b/src/liballoc/allocator.rs @@ -207,6 +207,7 @@ impl Layout { /// of each element in the array. /// /// On arithmetic overflow, returns `None`. + #[inline] pub fn repeat(&self, n: usize) -> Option<(Self, usize)> { let padded_size = match self.size.checked_add(self.padding_needed_for(self.align)) { None => return None, diff --git a/src/test/codegen/vec-optimizes-away.rs b/src/test/codegen/vec-optimizes-away.rs new file mode 100644 index 0000000000000..261564ed51aed --- /dev/null +++ b/src/test/codegen/vec-optimizes-away.rs @@ -0,0 +1,21 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. +// +// no-system-llvm +// compile-flags: -O +#![crate_type="lib"] + +#[no_mangle] +pub fn sum_me() -> i32 { + // CHECK-LABEL: @sum_me + // CHECK-NEXT: {{^.*:$}} + // CHECK-NEXT: ret i32 6 + vec![1, 2, 3].iter().sum::() +} From 1206c808a63fa99d039657a61a1515c3a734e5b2 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Thu, 20 Jul 2017 15:38:59 -0700 Subject: [PATCH 05/15] std: Stabilize `char_escape_debug` Stabilizes: * `::escape_debug` * `std::char::EscapeDebug` Closes #35068 --- src/liballoc/lib.rs | 1 - src/libcore/char.rs | 10 +++++----- src/libcore/tests/lib.rs | 1 - src/libstd/lib.rs | 1 - src/libstd_unicode/char.rs | 5 +---- src/libstd_unicode/lib.rs | 1 - 6 files changed, 6 insertions(+), 13 deletions(-) diff --git a/src/liballoc/lib.rs b/src/liballoc/lib.rs index b419aeb5ab593..9dc3d5390c707 100644 --- a/src/liballoc/lib.rs +++ b/src/liballoc/lib.rs @@ -79,7 +79,6 @@ #![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))] diff --git a/src/libcore/char.rs b/src/libcore/char.rs index bb4cb0ac3b215..e8b81db07067c 100644 --- a/src/libcore/char.rs +++ b/src/libcore/char.rs @@ -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 { self.0.next() } fn size_hint(&self) -> (usize, Option) { 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) diff --git a/src/libcore/tests/lib.rs b/src/libcore/tests/lib.rs index 26e4c21dc8f4d..a85c347146b05 100644 --- a/src/libcore/tests/lib.rs +++ b/src/libcore/tests/lib.rs @@ -11,7 +11,6 @@ #![deny(warnings)] #![feature(box_syntax)] -#![feature(char_escape_debug)] #![feature(const_fn)] #![feature(core_float)] #![feature(core_private_bignum)] diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs index a012f2f42c19c..8fe0ecfcf5397 100644 --- a/src/libstd/lib.rs +++ b/src/libstd/lib.rs @@ -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)] diff --git a/src/libstd_unicode/char.rs b/src/libstd_unicode/char.rs index d6836418b4b5c..5cf05bff8c5b1 100644 --- a/src/libstd_unicode/char.rs +++ b/src/libstd_unicode/char.rs @@ -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) diff --git a/src/libstd_unicode/lib.rs b/src/libstd_unicode/lib.rs index 98624800b4c6c..698210e83f3e3 100644 --- a/src/libstd_unicode/lib.rs +++ b/src/libstd_unicode/lib.rs @@ -32,7 +32,6 @@ #![deny(warnings)] #![no_std] -#![feature(char_escape_debug)] #![feature(core_char_ext)] #![feature(str_internals)] #![feature(core_intrinsics)] From d85df50da0522c26ed7fd5c09254dc7afb4c7687 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Thu, 20 Jul 2017 15:40:23 -0700 Subject: [PATCH 06/15] std: Stabilize `option_entry` feature Stabilized: * `Option::get_or_insert` * `Option::get_or_insert_with` Closes #39288 --- src/libcore/option.rs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/libcore/option.rs b/src/libcore/option.rs index e825acad4713e..ef41b6794105d 100644 --- a/src/libcore/option.rs +++ b/src/libcore/option.rs @@ -671,8 +671,6 @@ impl Option { /// # Examples /// /// ``` - /// #![feature(option_entry)] - /// /// let mut x = None; /// /// { @@ -685,7 +683,7 @@ impl Option { /// 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 Option { /// # Examples /// /// ``` - /// #![feature(option_entry)] - /// /// let mut x = None; /// /// { @@ -720,7 +716,7 @@ impl Option { /// 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 T>(&mut self, f: F) -> &mut T { match *self { None => *self = Some(f()), From b20d248b08bef08c681fd2d7404970520c0d4fee Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Thu, 20 Jul 2017 15:42:14 -0700 Subject: [PATCH 07/15] std: Stabilize `str_checked_slicing` feature Stabilized * `::get` * `::get_mut` * `::get_unchecked` * `::get_unchecked_mut` Closes #39932 --- src/liballoc/lib.rs | 1 - src/liballoc/str.rs | 12 ++++-------- src/liballoc/tests/lib.rs | 1 - src/libcore/str/mod.rs | 20 ++++++++++---------- 4 files changed, 14 insertions(+), 20 deletions(-) diff --git a/src/liballoc/lib.rs b/src/liballoc/lib.rs index 9dc3d5390c707..605302ec71ee6 100644 --- a/src/liballoc/lib.rs +++ b/src/liballoc/lib.rs @@ -82,7 +82,6 @@ #![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))] #![cfg_attr(stage0, feature(allocator))] #![feature(allow_internal_unstable)] diff --git a/src/liballoc/str.rs b/src/liballoc/str.rs index f56288c30132c..e4953988c5c12 100644 --- a/src/liballoc/str.rs +++ b/src/liballoc/str.rs @@ -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>(&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>(&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>(&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>(&mut self, i: I) -> &mut I::Output { core_str::StrExt::get_unchecked_mut(self, i) diff --git a/src/liballoc/tests/lib.rs b/src/liballoc/tests/lib.rs index c6d70ee7575f8..75ff781113722 100644 --- a/src/liballoc/tests/lib.rs +++ b/src/liballoc/tests/lib.rs @@ -24,7 +24,6 @@ #![feature(repr_align)] #![feature(slice_rotate)] #![feature(splice)] -#![feature(str_checked_slicing)] #![feature(str_escape)] #![feature(test)] #![feature(unboxed_closures)] diff --git a/src/libcore/str/mod.rs b/src/libcore/str/mod.rs index 3862b4a2eb046..af95bc41731b6 100644 --- a/src/libcore/str/mod.rs +++ b/src/libcore/str/mod.rs @@ -1776,7 +1776,7 @@ mod traits { } } - #[unstable(feature = "str_checked_slicing", issue = "39932")] + #[stable(feature = "str_checked_slicing", since = "1.20.0")] impl SliceIndex 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 for ops::Range { 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 for ops::RangeTo { 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 for ops::RangeFrom { 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 for ops::RangeInclusive { 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 for ops::RangeToInclusive { 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>(&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>(&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>(&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>(&mut self, i: I) -> &mut I::Output; #[stable(feature = "core", since = "1.6.0")] unsafe fn slice_unchecked(&self, begin: usize, end: usize) -> &str; From 9ec2b5b1220bbccba9bb7f9b5f1daf574d6ac71b Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Thu, 20 Jul 2017 15:44:35 -0700 Subject: [PATCH 08/15] std: Stabilize CString/OsString/PathBuf extra methods Stabilizes: * `CString::as_c_str` * `CString::into_boxed_c_str` * `CStr::into_c_string` * `OsString::into_boxed_os_str` * `OsStr::into_os_string` * `PathBuf::into_boxed_path` * `PathBuf::into_path_buf` Closes #40380 --- src/libstd/ffi/c_str.rs | 6 +++--- src/libstd/ffi/os_str.rs | 4 ++-- src/libstd/path.rs | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/libstd/ffi/c_str.rs b/src/libstd/ffi/c_str.rs index 5f0b11a616eb0..5dd7bb1c0c1d9 100644 --- a/src/libstd/ffi/c_str.rs +++ b/src/libstd/ffi/c_str.rs @@ -462,7 +462,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 } @@ -482,7 +482,7 @@ impl CString { /// 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 { unsafe { mem::transmute(self.into_inner()) } } @@ -1009,7 +1009,7 @@ impl CStr { /// 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) -> CString { unsafe { mem::transmute(self) } } diff --git a/src/libstd/ffi/os_str.rs b/src/libstd/ffi/os_str.rs index 02a13ed7a5a03..6f147ea0eeccb 100644 --- a/src/libstd/ffi/os_str.rs +++ b/src/libstd/ffi/os_str.rs @@ -260,7 +260,7 @@ impl OsString { /// /// let b: Box = 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 { unsafe { mem::transmute(self.inner.into_box()) } } @@ -511,7 +511,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) -> OsString { let inner: Box = unsafe { mem::transmute(self) }; OsString { inner: Buf::from_box(inner) } diff --git a/src/libstd/path.rs b/src/libstd/path.rs index 432605cf3b25b..a1a1825ffbf8e 100644 --- a/src/libstd/path.rs +++ b/src/libstd/path.rs @@ -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 { 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) -> PathBuf { let inner: Box = unsafe { mem::transmute(self) }; PathBuf { inner: OsString::from(inner) } From 59ccb2f27768ac5af46f843f0e6476a60bbec0ab Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Thu, 20 Jul 2017 15:46:46 -0700 Subject: [PATCH 09/15] std: Stabilize `utf8_error_error_len` feature Stabilizes: * `Utf8Error::error_len` Closes #40494 --- src/liballoc/tests/lib.rs | 1 - src/libcore/str/mod.rs | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/liballoc/tests/lib.rs b/src/liballoc/tests/lib.rs index 75ff781113722..27b23d14059f8 100644 --- a/src/liballoc/tests/lib.rs +++ b/src/liballoc/tests/lib.rs @@ -28,7 +28,6 @@ #![feature(test)] #![feature(unboxed_closures)] #![feature(unicode)] -#![feature(utf8_error_error_len)] extern crate alloc; extern crate test; diff --git a/src/libcore/str/mod.rs b/src/libcore/str/mod.rs index af95bc41731b6..10cf3bd29c6ba 100644 --- a/src/libcore/str/mod.rs +++ b/src/libcore/str/mod.rs @@ -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 { self.error_len.map(|len| len as usize) } From 7e22e241a857945537ac9d1678119b272c2eddb0 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Thu, 20 Jul 2017 15:48:15 -0700 Subject: [PATCH 10/15] std: Stabilize `manually_drop` feature Stabilizes * `core::mem::ManuallyDrop` * `std::mem::ManuallyDrop` * `ManuallyDrop::new` * `ManuallyDrop::into_inner` * `ManuallyDrop::drop` * `Deref for ManuallyDrop` * `DerefMut for ManuallyDrop` Closes #40673 --- src/liballoc/lib.rs | 1 - src/libcore/mem.rs | 17 +++++++---------- src/librustc_data_structures/lib.rs | 1 - 3 files changed, 7 insertions(+), 12 deletions(-) diff --git a/src/liballoc/lib.rs b/src/liballoc/lib.rs index 605302ec71ee6..789c548238f53 100644 --- a/src/liballoc/lib.rs +++ b/src/liballoc/lib.rs @@ -101,7 +101,6 @@ #![feature(i128_type)] #![feature(inclusive_range)] #![feature(lang_items)] -#![feature(manually_drop)] #![feature(needs_allocator)] #![feature(nonzero)] #![feature(offset_to)] diff --git a/src/libcore/mem.rs b/src/libcore/mem.rs index 6c1e8e8960f75..d891796c1d359 100644 --- a/src/libcore/mem.rs +++ b/src/libcore/mem.rs @@ -795,7 +795,6 @@ pub fn discriminant(v: &T) -> Discriminant { /// the type: /// /// ```rust -/// # #![feature(manually_drop)] /// use std::mem::ManuallyDrop; /// struct Peach; /// struct Banana; @@ -821,7 +820,7 @@ pub fn discriminant(v: &T) -> Discriminant { /// } /// } /// ``` -#[unstable(feature = "manually_drop", issue = "40673")] +#[stable(feature = "manually_drop", since = "1.20.0")] #[allow(unions_with_drop_fields)] pub union ManuallyDrop{ value: T } @@ -831,11 +830,10 @@ impl ManuallyDrop { /// # 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 { ManuallyDrop { value: value } @@ -846,12 +844,11 @@ impl ManuallyDrop { /// # 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 { unsafe { @@ -866,14 +863,14 @@ impl ManuallyDrop { /// 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) { ptr::drop_in_place(&mut slot.value) } } -#[unstable(feature = "manually_drop", issue = "40673")] +#[stable(feature = "manually_drop", since = "1.20.0")] impl ::ops::Deref for ManuallyDrop { type Target = T; #[inline] @@ -884,7 +881,7 @@ impl ::ops::Deref for ManuallyDrop { } } -#[unstable(feature = "manually_drop", issue = "40673")] +#[stable(feature = "manually_drop", since = "1.20.0")] impl ::ops::DerefMut for ManuallyDrop { #[inline] fn deref_mut(&mut self) -> &mut Self::Target { @@ -894,7 +891,7 @@ impl ::ops::DerefMut for ManuallyDrop { } } -#[unstable(feature = "manually_drop", issue = "40673")] +#[stable(feature = "manually_drop", since = "1.20.0")] impl ::fmt::Debug for ManuallyDrop { fn fmt(&self, fmt: &mut ::fmt::Formatter) -> ::fmt::Result { unsafe { diff --git a/src/librustc_data_structures/lib.rs b/src/librustc_data_structures/lib.rs index 5d856597cad53..eb766e71bf297 100644 --- a/src/librustc_data_structures/lib.rs +++ b/src/librustc_data_structures/lib.rs @@ -34,7 +34,6 @@ #![feature(conservative_impl_trait)] #![feature(discriminant_value)] #![feature(specialization)] -#![feature(manually_drop)] #![cfg_attr(stage0, feature(associated_consts))] #![cfg_attr(stage0, feature(struct_field_attributes))] From febb25540d6a9c86d34f564f02c8682273562e89 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Thu, 20 Jul 2017 15:50:33 -0700 Subject: [PATCH 11/15] Stabilize the `compile_error_macro` feature Stabilizes: * `compile_error!` as a macro defined by rustc Closes #40872 --- .../src/language-features/compile-error.md | 20 ------------------- src/libcore/macros.rs | 2 +- src/libstd/macros.rs | 2 +- src/libsyntax/ext/expand.rs | 1 - src/libsyntax/feature_gate.rs | 6 ++---- src/libsyntax_ext/compile_error.rs | 10 ---------- src/test/compile-fail/compile_error_macro.rs | 2 -- .../feature-gate-compile_error.rs | 13 ------------ 8 files changed, 4 insertions(+), 52 deletions(-) delete mode 100644 src/doc/unstable-book/src/language-features/compile-error.md delete mode 100644 src/test/compile-fail/feature-gate-compile_error.rs diff --git a/src/doc/unstable-book/src/language-features/compile-error.md b/src/doc/unstable-book/src/language-features/compile-error.md deleted file mode 100644 index 4de631e1fb307..0000000000000 --- a/src/doc/unstable-book/src/language-features/compile-error.md +++ /dev/null @@ -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 -} -``` diff --git a/src/libcore/macros.rs b/src/libcore/macros.rs index b09e6ea3328b8..684b81a27f82e 100644 --- a/src/libcore/macros.rs +++ b/src/libcore/macros.rs @@ -584,7 +584,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 */ }) } diff --git a/src/libstd/macros.rs b/src/libstd/macros.rs index 43c4ba48b1bcc..1545c1f9ab152 100644 --- a/src/libstd/macros.rs +++ b/src/libstd/macros.rs @@ -261,7 +261,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 */ }) } diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs index d2e51c9cb4868..352b0e5327f2a 100644 --- a/src/libsyntax/ext/expand.rs +++ b/src/libsyntax/ext/expand.rs @@ -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, } } diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs index 448f95c93a087..e8de8cf41c970 100644 --- a/src/libsyntax/feature_gate.rs +++ b/src/libsyntax/feature_gate.rs @@ -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 = diff --git a/src/libsyntax_ext/compile_error.rs b/src/libsyntax_ext/compile_error.rs index bb496716d8c46..7bc7afba63cb4 100644 --- a/src/libsyntax_ext/compile_error.rs +++ b/src/libsyntax_ext/compile_error.rs @@ -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 { - 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, diff --git a/src/test/compile-fail/compile_error_macro.rs b/src/test/compile-fail/compile_error_macro.rs index 2a2c3fd809232..e9c5993098c3e 100644 --- a/src/test/compile-fail/compile_error_macro.rs +++ b/src/test/compile-fail/compile_error_macro.rs @@ -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 } diff --git a/src/test/compile-fail/feature-gate-compile_error.rs b/src/test/compile-fail/feature-gate-compile_error.rs deleted file mode 100644 index 545c6852961c7..0000000000000 --- a/src/test/compile-fail/feature-gate-compile_error.rs +++ /dev/null @@ -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 or the MIT license -// , 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 -} From a2b855652cbf2de0caa2fae6240730d2db4a18de Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Thu, 20 Jul 2017 15:52:12 -0700 Subject: [PATCH 12/15] std: Stabilize the `str_{mut,box}_extras` feature Stabilizes * `<&mut str>::as_bytes_mut` * `>::into_boxed_bytes` * `std::str::from_boxed_utf8_unchecked` * `std::str::from_utf8_mut` * `std::str::from_utf8_unchecked_mut` Closes #41119 --- src/liballoc/lib.rs | 1 - src/liballoc/str.rs | 6 +++--- src/libcore/str/mod.rs | 8 ++++---- src/libstd/ffi/c_str.rs | 6 ------ src/libstd/ffi/os_str.rs | 2 -- src/libstd/lib.rs | 1 - 6 files changed, 7 insertions(+), 17 deletions(-) diff --git a/src/liballoc/lib.rs b/src/liballoc/lib.rs index 789c548238f53..7a5acb1856528 100644 --- a/src/liballoc/lib.rs +++ b/src/liballoc/lib.rs @@ -115,7 +115,6 @@ #![feature(specialization)] #![feature(staged_api)] #![feature(str_internals)] -#![feature(str_mut_extras)] #![feature(trusted_len)] #![feature(unboxed_closures)] #![feature(unicode)] diff --git a/src/liballoc/str.rs b/src/liballoc/str.rs index e4953988c5c12..4df13c509a835 100644 --- a/src/liballoc/str.rs +++ b/src/liballoc/str.rs @@ -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) @@ -1725,7 +1725,7 @@ impl str { } /// Converts a `Box` 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) -> Box<[u8]> { self.into() } @@ -1992,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 { mem::transmute(v) } diff --git a/src/libcore/str/mod.rs b/src/libcore/str/mod.rs index 10cf3bd29c6ba..cc18222815c3b 100644 --- a/src/libcore/str/mod.rs +++ b/src/libcore/str/mod.rs @@ -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) }) @@ -381,8 +381,8 @@ pub unsafe fn from_utf8_unchecked(v: &[u8]) -> &str { /// See the immutable version, [`from_utf8_unchecked()`][fromutf8], for more information. /// /// [fromutf8]: fn.from_utf8_unchecked.html -#[inline(always)] -#[unstable(feature = "str_mut_extras", issue = "41119")] +#[inline] +#[stable(feature = "str_mut_extras", since = "1.20.0")] pub unsafe fn from_utf8_unchecked_mut(v: &mut [u8]) -> &mut str { mem::transmute(v) } @@ -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; diff --git a/src/libstd/ffi/c_str.rs b/src/libstd/ffi/c_str.rs index 5dd7bb1c0c1d9..db64d41011c6b 100644 --- a/src/libstd/ffi/c_str.rs +++ b/src/libstd/ffi/c_str.rs @@ -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(); @@ -474,8 +472,6 @@ impl CString { /// # Examples /// /// ``` - /// #![feature(into_boxed_c_str)] - /// /// use std::ffi::{CString, CStr}; /// /// let c_string = CString::new(b"foo".to_vec()).unwrap(); @@ -1001,8 +997,6 @@ impl CStr { /// # Examples /// /// ``` - /// #![feature(into_boxed_c_str)] - /// /// use std::ffi::CString; /// /// let c_string = CString::new(b"foo".to_vec()).unwrap(); diff --git a/src/libstd/ffi/os_str.rs b/src/libstd/ffi/os_str.rs index 6f147ea0eeccb..d62e3e905e3ca 100644 --- a/src/libstd/ffi/os_str.rs +++ b/src/libstd/ffi/os_str.rs @@ -252,8 +252,6 @@ impl OsString { /// # Examples /// /// ``` - /// #![feature(into_boxed_os_str)] - /// /// use std::ffi::{OsString, OsStr}; /// /// let s = OsString::from("hello"); diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs index 8fe0ecfcf5397..82262f1551ac0 100644 --- a/src/libstd/lib.rs +++ b/src/libstd/lib.rs @@ -303,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)] From 808f8ea9379cf8412fdaef60fbf2fb4b24c3a659 Mon Sep 17 00:00:00 2001 From: est31 Date: Tue, 18 Jul 2017 05:16:46 +0200 Subject: [PATCH 13/15] float_bits_conv made it into 1.20 --- src/libstd/f32.rs | 4 ++-- src/libstd/f64.rs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/libstd/f32.rs b/src/libstd/f32.rs index 9bacfee055385..0135cd0a588cf 100644 --- a/src/libstd/f32.rs +++ b/src/libstd/f32.rs @@ -1094,7 +1094,7 @@ impl f32 { /// assert_eq!((12.5f32).to_bits(), 0x41480000); /// /// ``` - #[stable(feature = "float_bits_conv", since = "1.21.0")] + #[stable(feature = "float_bits_conv", since = "1.20.0")] #[inline] pub fn to_bits(self) -> u32 { unsafe { ::mem::transmute(self) } @@ -1125,7 +1125,7 @@ impl f32 { /// let snan = 0x7F800001; /// assert_ne!(f32::from_bits(snan).to_bits(), snan); /// ``` - #[stable(feature = "float_bits_conv", since = "1.21.0")] + #[stable(feature = "float_bits_conv", since = "1.20.0")] #[inline] pub fn from_bits(mut v: u32) -> Self { const EXP_MASK: u32 = 0x7F800000; diff --git a/src/libstd/f64.rs b/src/libstd/f64.rs index 5236048ade43f..d73d7cd2c7bd1 100644 --- a/src/libstd/f64.rs +++ b/src/libstd/f64.rs @@ -1009,7 +1009,7 @@ impl f64 { /// assert_eq!((12.5f64).to_bits(), 0x4029000000000000); /// /// ``` - #[stable(feature = "float_bits_conv", since = "1.21.0")] + #[stable(feature = "float_bits_conv", since = "1.20.0")] #[inline] pub fn to_bits(self) -> u64 { unsafe { ::mem::transmute(self) } @@ -1040,7 +1040,7 @@ impl f64 { /// let snan = 0x7FF0000000000001; /// assert_ne!(f64::from_bits(snan).to_bits(), snan); /// ``` - #[stable(feature = "float_bits_conv", since = "1.21.0")] + #[stable(feature = "float_bits_conv", since = "1.20.0")] #[inline] pub fn from_bits(mut v: u64) -> Self { const EXP_MASK: u64 = 0x7FF0000000000000; From 44a6d0ba3e9f24a51f15787602536fe2b391321e Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Sat, 12 Aug 2017 19:28:19 -0700 Subject: [PATCH 14/15] Update cargo submodule --- src/Cargo.lock | 13 +++++++++++-- src/tools/cargo | 2 +- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/Cargo.lock b/src/Cargo.lock index 33eae1ca982ed..bcec823403d0e 100644 --- a/src/Cargo.lock +++ b/src/Cargo.lock @@ -160,7 +160,7 @@ dependencies = [ "curl 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", "docopt 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", - "error-chain 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", + "error-chain 0.11.0-rc.2 (registry+https://github.com/rust-lang/crates.io-index)", "filetime 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", "flate2 0.2.19 (registry+https://github.com/rust-lang/crates.io-index)", "fs2 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -290,7 +290,7 @@ name = "crates-io" version = "0.10.0" dependencies = [ "curl 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", - "error-chain 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", + "error-chain 0.11.0-rc.2 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -377,6 +377,14 @@ dependencies = [ "backtrace 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "error-chain" +version = "0.11.0-rc.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "backtrace 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "error_index_generator" version = "0.0.0" @@ -1791,6 +1799,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum dtoa 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "80c8b71fd71146990a9742fc06dcbbde19161a267e0ad4e572c35162f4578c90" "checksum env_logger 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3ddf21e73e016298f5cb37d6ef8e8da8e39f91f9ec8b0df44b7deb16a9f8cd5b" "checksum error-chain 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d9435d864e017c3c6afeac1654189b06cdb491cf2ff73dbf0d73b0f292f42ff8" +"checksum error-chain 0.11.0-rc.2 (registry+https://github.com/rust-lang/crates.io-index)" = "38d3a55d9a7a456748f2a3912c0941a5d9a68006eb15b3c3c9836b8420dc102d" "checksum filetime 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "5363ab8e4139b8568a6237db5248646e5a8a2f89bd5ccb02092182b11fd3e922" "checksum flate2 0.2.19 (registry+https://github.com/rust-lang/crates.io-index)" = "36df0166e856739905cd3d7e0b210fe818592211a008862599845e012d8d304c" "checksum foreign-types 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3e4056b9bd47f8ac5ba12be771f77a0dae796d1bbaaf5fd0b9c2d38b69b8a29d" diff --git a/src/tools/cargo b/src/tools/cargo index 7e00b82d96d3b..5b4b8b2ae3f6a 160000 --- a/src/tools/cargo +++ b/src/tools/cargo @@ -1 +1 @@ -Subproject commit 7e00b82d96d3b78241e2b95acdecb28551813b15 +Subproject commit 5b4b8b2ae3f6a884099544ce66dbb41626110ece From 5f554ed507d70b51a6a86df987ccced43206d806 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Sat, 12 Aug 2017 19:28:43 -0700 Subject: [PATCH 15/15] Bump beta to .2 --- src/bootstrap/channel.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bootstrap/channel.rs b/src/bootstrap/channel.rs index 1153acfa57d39..aae02761708f7 100644 --- a/src/bootstrap/channel.rs +++ b/src/bootstrap/channel.rs @@ -28,7 +28,7 @@ pub const CFG_RELEASE_NUM: &str = "1.20.0"; // An optional number to put after the label, e.g. '.2' -> '-beta.2' // Be sure to make this starts with a dot to conform to semver pre-release // versions (section 9) -pub const CFG_PRERELEASE_VERSION: &str = ".1"; +pub const CFG_PRERELEASE_VERSION: &str = ".2"; pub struct GitInfo { inner: Option,