]> git.lizzy.rs Git - rust.git/commitdiff
Rollup merge of #42091 - maccoda:maccoda/env_docs, r=frewsxcv
authorMark Simulacrum <mark.simulacrum@gmail.com>
Sat, 20 May 2017 23:48:13 +0000 (17:48 -0600)
committerGitHub <noreply@github.com>
Sat, 20 May 2017 23:48:13 +0000 (17:48 -0600)
Improving std::env docs

Addresses #29351.
Hopefully this addresses the following points:
> -  iterators should use the standard iterator boilerplate like https://doc.rust-lang.org/std/iter/struct.Map.html, this applies to all structs except for JoinPathsError
> -  JoinPathsError should properly link the function it comes from and use language similar to https://doc.rust-lang.org/std/io/struct.Error.html
> -  same wording issues with VarError
> - functions need to ensure linkage to things they refer to in their descriptions
> - Explain the difference between `os` and non-`os` structs and methods

43 files changed:
src/bootstrap/config.rs
src/bootstrap/config.toml.example
src/bootstrap/job.rs
src/bootstrap/lib.rs
src/doc/unstable-book/src/library-features/needs-drop.md [new file with mode: 0644]
src/liballoc/boxed.rs
src/libarena/lib.rs
src/libcollections/string.rs
src/libcollections/vec.rs
src/libcore/cell.rs
src/libcore/iter/mod.rs
src/libcore/mem.rs
src/libcore/num/mod.rs
src/libcore/slice/mod.rs
src/libcore/str/mod.rs
src/librustc/infer/error_reporting/mod.rs
src/librustc_borrowck/borrowck/mod.rs
src/librustc_llvm/build.rs
src/libstd/collections/hash/table.rs
src/libstd/env.rs
src/libstd/error.rs
src/libstd/ffi/c_str.rs
src/libstd/ffi/os_str.rs
src/libstd/lib.rs
src/libstd/macros.rs
src/libstd/net/ip.rs
src/libstd/path.rs
src/libstd/sync/condvar.rs
src/libstd/sync/mpsc/mod.rs
src/libstd/sync/mutex.rs
src/libstd/sync/rwlock.rs
src/libstd/sys/redox/fast_thread_local.rs
src/libstd/sys/unix/fast_thread_local.rs
src/libsyntax/feature_gate.rs
src/test/compile-fail/issue-27942.rs
src/test/ui/fn_once-moved.rs [new file with mode: 0644]
src/test/ui/fn_once-moved.stderr [new file with mode: 0644]
src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else.stderr
src/test/ui/lifetime-errors/ex2a-push-one-existing-name.stderr
src/test/ui/lifetime-errors/ex2b-push-no-existing-names.stderr
src/test/ui/lifetime-errors/ex2c-push-inference-variable.stderr
src/test/ui/lifetime-errors/ex2d-push-inference-variable-2.stderr
src/test/ui/lifetime-errors/ex2e-push-inference-variable-3.stderr

index 0fb597564e33de15c2bc6defc8fd35273dfb43df..abad216d89be48c78482ca82fb6d67ee016bf1c6 100644 (file)
@@ -94,6 +94,7 @@ pub struct Config {
     pub backtrace: bool, // support for RUST_BACKTRACE
 
     // misc
+    pub low_priority: bool,
     pub channel: String,
     pub quiet_tests: bool,
     // Fallback musl-root for all targets
@@ -148,6 +149,7 @@ struct Build {
     target: Vec<String>,
     cargo: Option<String>,
     rustc: Option<String>,
+    low_priority: Option<bool>,
     compiler_docs: Option<bool>,
     docs: Option<bool>,
     submodules: Option<bool>,
@@ -306,6 +308,7 @@ pub fn parse(build: &str, file: Option<PathBuf>) -> Config {
         config.nodejs = build.nodejs.map(PathBuf::from);
         config.gdb = build.gdb.map(PathBuf::from);
         config.python = build.python.map(PathBuf::from);
+        set(&mut config.low_priority, build.low_priority);
         set(&mut config.compiler_docs, build.compiler_docs);
         set(&mut config.docs, build.docs);
         set(&mut config.submodules, build.submodules);
index df180be4e27ab0836b6df75d4b939aeac3c4fe7d..95cca96f7fcc027f1143a2f0a79393f6a651f7de 100644 (file)
 # known-good version of OpenSSL, compile it, and link it to Cargo.
 #openssl-static = false
 
+# Run the build with low priority, by setting the process group's "nice" value
+# to +10 on Unix platforms, and by using a "low priority" job object on Windows.
+#low-priority = false
+
 # =============================================================================
 # General install configuration options
 # =============================================================================
index c3859275e6fb4d3b9eb86c1ba860f3a4aad45e54..72a5d1338b8d05b1067f36e7c9998e6a29b43fd8 100644 (file)
@@ -42,6 +42,7 @@
 use std::env;
 use std::io;
 use std::mem;
+use Build;
 
 type HANDLE = *mut u8;
 type BOOL = i32;
 const PROCESS_DUP_HANDLE: DWORD = 0x40;
 const JobObjectExtendedLimitInformation: JOBOBJECTINFOCLASS = 9;
 const JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE: DWORD = 0x2000;
+const JOB_OBJECT_LIMIT_PRIORITY_CLASS: DWORD = 0x00000020;
 const SEM_FAILCRITICALERRORS: UINT = 0x0001;
 const SEM_NOGPFAULTERRORBOX: UINT = 0x0002;
+const BELOW_NORMAL_PRIORITY_CLASS: DWORD = 0x00004000;
 
 extern "system" {
     fn CreateJobObjectW(lpJobAttributes: *mut u8, lpName: *const u8) -> HANDLE;
@@ -118,7 +121,7 @@ struct JOBOBJECT_BASIC_LIMIT_INFORMATION {
     SchedulingClass: DWORD,
 }
 
-pub unsafe fn setup() {
+pub unsafe fn setup(build: &mut Build) {
     // Tell Windows to not show any UI on errors (such as not finding a required dll
     // during startup or terminating abnormally).  This is important for running tests,
     // since some of them use abnormal termination by design.
@@ -136,6 +139,10 @@ pub unsafe fn setup() {
     // children will reside in the job by default.
     let mut info = mem::zeroed::<JOBOBJECT_EXTENDED_LIMIT_INFORMATION>();
     info.BasicLimitInformation.LimitFlags = JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE;
+    if build.config.low_priority {
+        info.BasicLimitInformation.LimitFlags |= JOB_OBJECT_LIMIT_PRIORITY_CLASS;
+        info.BasicLimitInformation.PriorityClass = BELOW_NORMAL_PRIORITY_CLASS;
+    }
     let r = SetInformationJobObject(job,
                                     JobObjectExtendedLimitInformation,
                                     &mut info as *mut _ as LPVOID,
index ca9de43f542193364b1806fe62f8f78be35ebb07..7eccc2a49c0ea230b2e6e6945f4fb6a9d5ec42a8 100644 (file)
@@ -76,6 +76,9 @@
 extern crate rustc_serialize;
 extern crate toml;
 
+#[cfg(unix)]
+extern crate libc;
+
 use std::cmp;
 use std::collections::HashMap;
 use std::env;
 #[cfg(windows)]
 mod job;
 
-#[cfg(not(windows))]
+#[cfg(unix)]
+mod job {
+    use libc;
+
+    pub unsafe fn setup(build: &mut ::Build) {
+        if build.config.low_priority {
+            libc::setpriority(libc::PRIO_PGRP as _, 0, 10);
+        }
+    }
+}
+
+#[cfg(not(any(unix, windows)))]
 mod job {
-    pub unsafe fn setup() {}
+    pub unsafe fn setup(_build: &mut ::Build) {
+    }
 }
 
 pub use config::Config;
@@ -263,7 +278,7 @@ pub fn new(flags: Flags, config: Config) -> Build {
     /// Executes the entire build, as configured by the flags and configuration.
     pub fn build(&mut self) {
         unsafe {
-            job::setup();
+            job::setup(self);
         }
 
         if let Subcommand::Clean = self.flags.cmd {
diff --git a/src/doc/unstable-book/src/library-features/needs-drop.md b/src/doc/unstable-book/src/library-features/needs-drop.md
new file mode 100644 (file)
index 0000000..10ae956
--- /dev/null
@@ -0,0 +1,7 @@
+# `needs_drop`
+
+The tracking issue for this feature is: [#41890]
+
+[#41890]: https://github.com/rust-lang/rust/issues/41890
+
+------------------------
index fc6929f896ecbaa70870751f9c59007cc1024983..8a39be8fae8a5210452d4acdaf02a9dfff85f776 100644 (file)
@@ -445,7 +445,7 @@ fn from(s: &'a str) -> Box<str> {
     }
 }
 
-#[stable(feature = "boxed_str_conv", since = "1.18.0")]
+#[stable(feature = "boxed_str_conv", since = "1.19.0")]
 impl From<Box<str>> for Box<[u8]> {
     fn from(s: Box<str>) -> Self {
         unsafe {
index c4c1635aa2a5a34cdfeae7b881536d008823f049..4338ac7fd022c362f1065147fad6ecc8eb445b67 100644 (file)
@@ -32,6 +32,7 @@
 #![feature(core_intrinsics)]
 #![feature(dropck_eyepatch)]
 #![feature(generic_param_attrs)]
+#![feature(needs_drop)]
 #![cfg_attr(stage0, feature(staged_api))]
 #![cfg_attr(test, feature(test))]
 
@@ -82,7 +83,7 @@ unsafe fn new(capacity: usize) -> TypedArenaChunk<T> {
     unsafe fn destroy(&mut self, len: usize) {
         // The branch on needs_drop() is an -O1 performance optimization.
         // Without the branch, dropping TypedArena<u8> takes linear time.
-        if intrinsics::needs_drop::<T>() {
+        if mem::needs_drop::<T>() {
             let mut start = self.start();
             // Destroy all allocated objects.
             for _ in 0..len {
@@ -350,7 +351,7 @@ fn grow<T>(&self, n: usize) {
     #[inline]
     pub fn alloc<T>(&self, object: T) -> &mut T {
         unsafe {
-            assert!(!intrinsics::needs_drop::<T>());
+            assert!(!mem::needs_drop::<T>());
             assert!(mem::size_of::<T>() != 0);
 
             self.align_for::<T>();
@@ -379,9 +380,7 @@ pub fn alloc<T>(&self, object: T) -> &mut T {
     #[inline]
     pub fn alloc_slice<T>(&self, slice: &[T]) -> &mut [T]
         where T: Copy {
-        unsafe {
-            assert!(!intrinsics::needs_drop::<T>());
-        }
+        assert!(!mem::needs_drop::<T>());
         assert!(mem::size_of::<T>() != 0);
         assert!(slice.len() != 0);
         self.align_for::<T>();
index 31ab04e9f3b74f049098a2e19aed23ec67f35df2..55f0e01548fee05a1e83a7a50349947491f8cb3a 100644 (file)
@@ -1869,28 +1869,28 @@ fn index(&self, index: ops::RangeToInclusive<usize>) -> &str {
     }
 }
 
-#[stable(feature = "derefmut_for_string", since = "1.2.0")]
+#[stable(feature = "derefmut_for_string", since = "1.3.0")]
 impl ops::IndexMut<ops::Range<usize>> for String {
     #[inline]
     fn index_mut(&mut self, index: ops::Range<usize>) -> &mut str {
         &mut self[..][index]
     }
 }
-#[stable(feature = "derefmut_for_string", since = "1.2.0")]
+#[stable(feature = "derefmut_for_string", since = "1.3.0")]
 impl ops::IndexMut<ops::RangeTo<usize>> for String {
     #[inline]
     fn index_mut(&mut self, index: ops::RangeTo<usize>) -> &mut str {
         &mut self[..][index]
     }
 }
-#[stable(feature = "derefmut_for_string", since = "1.2.0")]
+#[stable(feature = "derefmut_for_string", since = "1.3.0")]
 impl ops::IndexMut<ops::RangeFrom<usize>> for String {
     #[inline]
     fn index_mut(&mut self, index: ops::RangeFrom<usize>) -> &mut str {
         &mut self[..][index]
     }
 }
-#[stable(feature = "derefmut_for_string", since = "1.2.0")]
+#[stable(feature = "derefmut_for_string", since = "1.3.0")]
 impl ops::IndexMut<ops::RangeFull> for String {
     #[inline]
     fn index_mut(&mut self, _index: ops::RangeFull) -> &mut str {
@@ -1922,7 +1922,7 @@ fn deref(&self) -> &str {
     }
 }
 
-#[stable(feature = "derefmut_for_string", since = "1.2.0")]
+#[stable(feature = "derefmut_for_string", since = "1.3.0")]
 impl ops::DerefMut for String {
     #[inline]
     fn deref_mut(&mut self) -> &mut str {
@@ -2080,14 +2080,14 @@ fn from(s: &'a str) -> String {
 
 // note: test pulls in libstd, which causes errors here
 #[cfg(not(test))]
-#[stable(feature = "string_from_box", since = "1.17.0")]
+#[stable(feature = "string_from_box", since = "1.18.0")]
 impl From<Box<str>> for String {
     fn from(s: Box<str>) -> String {
         s.into_string()
     }
 }
 
-#[stable(feature = "box_from_str", since = "1.17.0")]
+#[stable(feature = "box_from_str", since = "1.18.0")]
 impl Into<Box<str>> for String {
     fn into(self) -> Box<str> {
         self.into_boxed_str()
index 1cf713290d8e8b7e7ea65b6b9af21f961a73c337..3ef8438bc0bd23c6cea5bd2a0fe41b42f3da0a4a 100644 (file)
@@ -2096,7 +2096,7 @@ fn from(s: &'a [T]) -> Vec<T> {
     }
 }
 
-#[stable(feature = "vec_from_mut", since = "1.21.0")]
+#[stable(feature = "vec_from_mut", since = "1.19.0")]
 impl<'a, T: Clone> From<&'a mut [T]> for Vec<T> {
     #[cfg(not(test))]
     fn from(s: &'a mut [T]) -> Vec<T> {
@@ -2117,14 +2117,14 @@ fn from(s: Cow<'a, [T]>) -> Vec<T> {
 
 // note: test pulls in libstd, which causes errors here
 #[cfg(not(test))]
-#[stable(feature = "vec_from_box", since = "1.17.0")]
+#[stable(feature = "vec_from_box", since = "1.18.0")]
 impl<T> From<Box<[T]>> for Vec<T> {
     fn from(s: Box<[T]>) -> Vec<T> {
         s.into_vec()
     }
 }
 
-#[stable(feature = "box_from_vec", since = "1.17.0")]
+#[stable(feature = "box_from_vec", since = "1.18.0")]
 impl<T> Into<Box<[T]>> for Vec<T> {
     fn into(self) -> Box<[T]> {
         self.into_boxed_slice()
@@ -2142,14 +2142,14 @@ fn from(s: &'a str) -> Vec<u8> {
 // Clone-on-write
 ////////////////////////////////////////////////////////////////////////////////
 
-#[stable(feature = "cow_from_vec", since = "1.7.0")]
+#[stable(feature = "cow_from_vec", since = "1.8.0")]
 impl<'a, T: Clone> From<&'a [T]> for Cow<'a, [T]> {
     fn from(s: &'a [T]) -> Cow<'a, [T]> {
         Cow::Borrowed(s)
     }
 }
 
-#[stable(feature = "cow_from_vec", since = "1.7.0")]
+#[stable(feature = "cow_from_vec", since = "1.8.0")]
 impl<'a, T: Clone> From<Vec<T>> for Cow<'a, [T]> {
     fn from(v: Vec<T>) -> Cow<'a, [T]> {
         Cow::Owned(v)
index 7886f90b66e85b64baa56590c174d0ba199fb8f0..ea480f38947f982b9804ac8418be117ef6605e78 100644 (file)
@@ -1145,7 +1145,7 @@ pub fn get(&self) -> *mut T {
     }
 }
 
-#[stable(feature = "unsafe_cell_default", since = "1.9.0")]
+#[stable(feature = "unsafe_cell_default", since = "1.10.0")]
 impl<T: Default> Default for UnsafeCell<T> {
     /// Creates an `UnsafeCell`, with the `Default` value for T.
     fn default() -> UnsafeCell<T> {
index 420ff0f71193b47bdcf843db68558b27836c8e90..f9b818f5bff357dbac3615b396eb48e1a43305cf 100644 (file)
@@ -1690,7 +1690,7 @@ fn size_hint(&self) -> (usize, Option<usize>) {
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<I> ExactSizeIterator for Skip<I> where I: ExactSizeIterator {}
 
-#[stable(feature = "double_ended_skip_iterator", since = "1.8.0")]
+#[stable(feature = "double_ended_skip_iterator", since = "1.9.0")]
 impl<I> DoubleEndedIterator for Skip<I> where I: DoubleEndedIterator + ExactSizeIterator {
     fn next_back(&mut self) -> Option<Self::Item> {
         if self.len() > 0 {
index b397aba6b92df3630aded3369571a114f322f079..18428d378e3d24fde213900059110830111ccd7e 100644 (file)
@@ -302,6 +302,58 @@ pub fn align_of_val<T: ?Sized>(val: &T) -> usize {
     unsafe { intrinsics::min_align_of_val(val) }
 }
 
+/// Returns whether dropping values of type `T` matters.
+///
+/// This is purely an optimization hint, and may be implemented conservatively.
+/// For instance, always returning `true` would be a valid implementation of
+/// this function.
+///
+/// Low level implementations of things like collections, which need to manually
+/// drop their data, should use this function to avoid unnecessarily
+/// trying to drop all their contents when they are destroyed. This might not
+/// make a difference in release builds (where a loop that has no side-effects
+/// is easily detected and eliminated), but is often a big win for debug builds.
+///
+/// Note that `ptr::drop_in_place` already performs this check, so if your workload
+/// can be reduced to some small number of drop_in_place calls, using this is
+/// unnecessary. In particular note that you can drop_in_place a slice, and that
+/// will do a single needs_drop check for all the values.
+///
+/// Types like Vec therefore just `drop_in_place(&mut self[..])` without using
+/// needs_drop explicitly. Types like HashMap, on the other hand, have to drop
+/// values one at a time and should use this API.
+///
+///
+/// # Examples
+///
+/// Here's an example of how a collection might make use of needs_drop:
+///
+/// ```ignore
+/// #![feature(needs_drop)]
+/// use std::{mem, ptr};
+///
+/// pub struct MyCollection<T> { /* ... */ }
+///
+/// impl<T> Drop for MyCollection<T> {
+///     fn drop(&mut self) {
+///         unsafe {
+///             // drop the data
+///             if mem::needs_drop::<T>() {
+///                 for x in self.iter_mut() {
+///                     ptr::drop_in_place(x);
+///                 }
+///             }
+///             self.free_buffer();
+///         }
+///     }
+/// }
+/// ```
+#[inline]
+#[unstable(feature = "needs_drop", issue = "41890")]
+pub fn needs_drop<T>() -> bool {
+    unsafe { intrinsics::needs_drop::<T>() }
+}
+
 /// Creates a value whose bytes are all zero.
 ///
 /// This has the same effect as allocating space with
index 8b4002fe9af244e585adc451e65c8ffdbae26406..be093cca6a1b9b3ea851ecbac1448d1be72384bf 100644 (file)
@@ -2682,8 +2682,8 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
 // Conversions T -> T are covered by a blanket impl and therefore excluded
 // Some conversions from and to usize/isize are not implemented due to portability concerns
 macro_rules! impl_from {
-    ($Small: ty, $Large: ty) => {
-        #[stable(feature = "lossless_prim_conv", since = "1.5.0")]
+    ($Small: ty, $Large: ty, #[$attr:meta]) => {
+        #[$attr]
         impl From<$Small> for $Large {
             #[inline]
             fn from(small: $Small) -> $Large {
@@ -2694,60 +2694,60 @@ fn from(small: $Small) -> $Large {
 }
 
 // Unsigned -> Unsigned
-impl_from! { u8, u16 }
-impl_from! { u8, u32 }
-impl_from! { u8, u64 }
-impl_from! { u8, u128 }
-impl_from! { u8, usize }
-impl_from! { u16, u32 }
-impl_from! { u16, u64 }
-impl_from! { u16, u128 }
-impl_from! { u32, u64 }
-impl_from! { u32, u128 }
-impl_from! { u64, u128 }
+impl_from! { u8, u16, #[stable(feature = "lossless_int_conv", since = "1.5.0")] }
+impl_from! { u8, u32, #[stable(feature = "lossless_int_conv", since = "1.5.0")] }
+impl_from! { u8, u64, #[stable(feature = "lossless_int_conv", since = "1.5.0")] }
+impl_from! { u8, u128, #[unstable(feature = "i128", issue = "35118")] }
+impl_from! { u8, usize, #[stable(feature = "lossless_int_conv", since = "1.5.0")] }
+impl_from! { u16, u32, #[stable(feature = "lossless_int_conv", since = "1.5.0")] }
+impl_from! { u16, u64, #[stable(feature = "lossless_int_conv", since = "1.5.0")] }
+impl_from! { u16, u128, #[unstable(feature = "i128", issue = "35118")] }
+impl_from! { u32, u64, #[stable(feature = "lossless_int_conv", since = "1.5.0")] }
+impl_from! { u32, u128, #[unstable(feature = "i128", issue = "35118")] }
+impl_from! { u64, u128, #[unstable(feature = "i128", issue = "35118")] }
 
 // Signed -> Signed
-impl_from! { i8, i16 }
-impl_from! { i8, i32 }
-impl_from! { i8, i64 }
-impl_from! { i8, i128 }
-impl_from! { i8, isize }
-impl_from! { i16, i32 }
-impl_from! { i16, i64 }
-impl_from! { i16, i128 }
-impl_from! { i32, i64 }
-impl_from! { i32, i128 }
-impl_from! { i64, i128 }
+impl_from! { i8, i16, #[stable(feature = "lossless_int_conv", since = "1.5.0")] }
+impl_from! { i8, i32, #[stable(feature = "lossless_int_conv", since = "1.5.0")] }
+impl_from! { i8, i64, #[stable(feature = "lossless_int_conv", since = "1.5.0")] }
+impl_from! { i8, i128, #[unstable(feature = "i128", issue = "35118")] }
+impl_from! { i8, isize, #[stable(feature = "lossless_int_conv", since = "1.5.0")] }
+impl_from! { i16, i32, #[stable(feature = "lossless_int_conv", since = "1.5.0")] }
+impl_from! { i16, i64, #[stable(feature = "lossless_int_conv", since = "1.5.0")] }
+impl_from! { i16, i128, #[unstable(feature = "i128", issue = "35118")] }
+impl_from! { i32, i64, #[stable(feature = "lossless_int_conv", since = "1.5.0")] }
+impl_from! { i32, i128, #[unstable(feature = "i128", issue = "35118")] }
+impl_from! { i64, i128, #[unstable(feature = "i128", issue = "35118")] }
 
 // Unsigned -> Signed
-impl_from! { u8, i16 }
-impl_from! { u8, i32 }
-impl_from! { u8, i64 }
-impl_from! { u8, i128 }
-impl_from! { u16, i32 }
-impl_from! { u16, i64 }
-impl_from! { u16, i128 }
-impl_from! { u32, i64 }
-impl_from! { u32, i128 }
-impl_from! { u64, i128 }
+impl_from! { u8, i16, #[stable(feature = "lossless_int_conv", since = "1.5.0")] }
+impl_from! { u8, i32, #[stable(feature = "lossless_int_conv", since = "1.5.0")] }
+impl_from! { u8, i64, #[stable(feature = "lossless_int_conv", since = "1.5.0")] }
+impl_from! { u8, i128, #[unstable(feature = "i128", issue = "35118")] }
+impl_from! { u16, i32, #[stable(feature = "lossless_int_conv", since = "1.5.0")] }
+impl_from! { u16, i64, #[stable(feature = "lossless_int_conv", since = "1.5.0")] }
+impl_from! { u16, i128, #[unstable(feature = "i128", issue = "35118")] }
+impl_from! { u32, i64, #[stable(feature = "lossless_int_conv", since = "1.5.0")] }
+impl_from! { u32, i128, #[unstable(feature = "i128", issue = "35118")] }
+impl_from! { u64, i128, #[unstable(feature = "i128", issue = "35118")] }
 
 // Note: integers can only be represented with full precision in a float if
 // they fit in the significand, which is 24 bits in f32 and 53 bits in f64.
 // Lossy float conversions are not implemented at this time.
 
 // Signed -> Float
-impl_from! { i8, f32 }
-impl_from! { i8, f64 }
-impl_from! { i16, f32 }
-impl_from! { i16, f64 }
-impl_from! { i32, f64 }
+impl_from! { i8, f32, #[stable(feature = "lossless_float_conv", since = "1.6.0")] }
+impl_from! { i8, f64, #[stable(feature = "lossless_float_conv", since = "1.6.0")] }
+impl_from! { i16, f32, #[stable(feature = "lossless_float_conv", since = "1.6.0")] }
+impl_from! { i16, f64, #[stable(feature = "lossless_float_conv", since = "1.6.0")] }
+impl_from! { i32, f64, #[stable(feature = "lossless_float_conv", since = "1.6.0")] }
 
 // Unsigned -> Float
-impl_from! { u8, f32 }
-impl_from! { u8, f64 }
-impl_from! { u16, f32 }
-impl_from! { u16, f64 }
-impl_from! { u32, f64 }
+impl_from! { u8, f32, #[stable(feature = "lossless_float_conv", since = "1.6.0")] }
+impl_from! { u8, f64, #[stable(feature = "lossless_float_conv", since = "1.6.0")] }
+impl_from! { u16, f32, #[stable(feature = "lossless_float_conv", since = "1.6.0")] }
+impl_from! { u16, f64, #[stable(feature = "lossless_float_conv", since = "1.6.0")] }
+impl_from! { u32, f64, #[stable(feature = "lossless_float_conv", since = "1.6.0")] }
 
 // Float -> Float
-impl_from! { f32, f64 }
+impl_from! { f32, f64, #[stable(feature = "lossless_float_conv", since = "1.6.0")] }
index e15eb8f24440956b5e1ff88e48b794ecca1194c6..24ebfeb62e2eec23eec5fe573fa01ed819ace068 100644 (file)
@@ -1450,7 +1450,7 @@ impl<'a, T> Clone for Iter<'a, T> {
     fn clone(&self) -> Iter<'a, T> { Iter { ptr: self.ptr, end: self.end, _marker: self._marker } }
 }
 
-#[stable(feature = "slice_iter_as_ref", since = "1.12.0")]
+#[stable(feature = "slice_iter_as_ref", since = "1.13.0")]
 impl<'a, T> AsRef<[T]> for Iter<'a, T> {
     fn as_ref(&self) -> &[T] {
         self.as_slice()
index 6b627430904847199b42ef7ef6490b41406c7d44..7fb941c091fbc4fab90ed623b90ff54db4bb3142 100644 (file)
@@ -1597,7 +1597,7 @@ fn index(&self, index: ops::Range<usize>) -> &str {
     /// byte offset of a character (as defined by `is_char_boundary`).
     /// Requires that `begin <= end` and `end <= len` where `len` is the
     /// length of the string.
-    #[stable(feature = "derefmut_for_string", since = "1.2.0")]
+    #[stable(feature = "derefmut_for_string", since = "1.3.0")]
     impl ops::IndexMut<ops::Range<usize>> for str {
         #[inline]
         fn index_mut(&mut self, index: ops::Range<usize>) -> &mut str {
@@ -1632,7 +1632,7 @@ fn index(&self, index: ops::RangeTo<usize>) -> &str {
     /// `end`.
     ///
     /// Equivalent to `&mut self[0 .. end]`.
-    #[stable(feature = "derefmut_for_string", since = "1.2.0")]
+    #[stable(feature = "derefmut_for_string", since = "1.3.0")]
     impl ops::IndexMut<ops::RangeTo<usize>> for str {
         #[inline]
         fn index_mut(&mut self, index: ops::RangeTo<usize>) -> &mut str {
@@ -1672,7 +1672,7 @@ fn index(&self, index: ops::RangeFrom<usize>) -> &str {
     /// to the end of the string.
     ///
     /// Equivalent to `&mut self[begin .. len]`.
-    #[stable(feature = "derefmut_for_string", since = "1.2.0")]
+    #[stable(feature = "derefmut_for_string", since = "1.3.0")]
     impl ops::IndexMut<ops::RangeFrom<usize>> for str {
         #[inline]
         fn index_mut(&mut self, index: ops::RangeFrom<usize>) -> &mut str {
@@ -1708,7 +1708,7 @@ fn index(&self, _index: ops::RangeFull) -> &str {
     /// never panic.
     ///
     /// Equivalent to `&mut self[0 .. len]`.
-    #[stable(feature = "derefmut_for_string", since = "1.2.0")]
+    #[stable(feature = "derefmut_for_string", since = "1.3.0")]
     impl ops::IndexMut<ops::RangeFull> for str {
         #[inline]
         fn index_mut(&mut self, _index: ops::RangeFull) -> &mut str {
index c07b3b3c4be90bd445a407d1d901ef1289ce843b..0515e1cc304356f738a5c009e7d266d2ac164b59 100644 (file)
@@ -113,7 +113,7 @@ fn explain_span<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>,
                                         heading: &str, span: Span)
                                         -> (String, Option<Span>) {
             let lo = tcx.sess.codemap().lookup_char_pos_adj(span.lo);
-            (format!("the {} at {}:{}", heading, lo.line, lo.col.to_usize()),
+            (format!("the {} at {}:{}", heading, lo.line, lo.col.to_usize() + 1),
              Some(span))
         }
 
index 99df1431265084b80f8307a2c3734f1f28b922dd..c28d45be18d9e754ec9cdd7a93b20064f22de517 100644 (file)
@@ -39,6 +39,8 @@
 use rustc::ty::{self, TyCtxt};
 use rustc::ty::maps::Providers;
 
+use syntax_pos::DUMMY_SP;
+
 use std::fmt;
 use std::rc::Rc;
 use std::hash::{Hash, Hasher};
@@ -539,7 +541,7 @@ pub fn report_use_of_moved_value(&self,
             MovedInCapture => ("capture", "captured"),
         };
 
-        let (_ol, _moved_lp_msg, mut err) = match the_move.kind {
+        let (_ol, _moved_lp_msg, mut err, need_note) = match the_move.kind {
             move_data::Declared => {
                 // If this is an uninitialized variable, just emit a simple warning
                 // and return.
@@ -586,11 +588,24 @@ pub fn report_use_of_moved_value(&self,
                 let msg = if !has_fork && partial { "partially " }
                           else if has_fork && !has_common { "collaterally "}
                           else { "" };
-                let err = struct_span_err!(
+                let mut err = struct_span_err!(
                     self.tcx.sess, use_span, E0382,
                     "{} of {}moved value: `{}`",
                     verb, msg, nl);
-                (ol, moved_lp_msg, err)}
+                let need_note = match lp.ty.sty {
+                    ty::TypeVariants::TyClosure(id, _) => {
+                        if let Ok(ty::ClosureKind::FnOnce) =
+                           ty::queries::closure_kind::try_get(self.tcx, DUMMY_SP, id) {
+                            err.help("closure was moved because it only implements `FnOnce`");
+                            false
+                        } else {
+                            true
+                        }
+                    }
+                    _ => true,
+                };
+                (ol, moved_lp_msg, err, need_note)
+            }
         };
 
         // Get type of value and span where it was previously
@@ -627,10 +642,12 @@ pub fn report_use_of_moved_value(&self,
             err
         };
 
-        err.note(&format!("move occurs because `{}` has type `{}`, \
-                           which does not implement the `Copy` trait",
-                          self.loan_path_to_string(moved_lp),
-                          moved_lp.ty));
+        if need_note {
+            err.note(&format!("move occurs because `{}` has type `{}`, \
+                               which does not implement the `Copy` trait",
+                              self.loan_path_to_string(moved_lp),
+                              moved_lp.ty));
+        }
 
         // Note: we used to suggest adding a `ref binding` or calling
         // `clone` but those suggestions have been removed because
index 3fd75146193e75e7712098c6022b5ded840be514..ba568857959f881eccb8cc31ea96e62c35850d52 100644 (file)
@@ -273,11 +273,8 @@ fn main() {
         }
     }
 
-    // LLVM requires symbols from this library, but apparently they're not printeds
+    // LLVM requires symbols from this library, but apparently they're not printed
     // during llvm-config?
-    if target.contains("windows") {
-        println!("cargo:rustc-link-lib=ole32");
-    }
     if target.contains("windows-gnu") {
         println!("cargo:rustc-link-lib=static-nobundle=gcc_s");
         println!("cargo:rustc-link-lib=static-nobundle=pthread");
index a15269cc87c5da08f9e0acd973f628ba83240bda..50c721db849aa7307eeb18430e1eca93e4570fa5 100644 (file)
@@ -12,9 +12,8 @@
 
 use cmp;
 use hash::{BuildHasher, Hash, Hasher};
-use intrinsics::needs_drop;
 use marker;
-use mem::{align_of, size_of};
+use mem::{align_of, size_of, needs_drop};
 use mem;
 use ops::{Deref, DerefMut};
 use ptr::{self, Unique, Shared};
index 5d2bb9daf17ef1c893d83430da940f737fe5b345..27b40793ff64a7c8034e959fc623b708cee0eab7 100644 (file)
@@ -700,7 +700,7 @@ fn len(&self) -> usize { self.inner.len() }
     fn is_empty(&self) -> bool { self.inner.is_empty() }
 }
 
-#[stable(feature = "env_iterators", since = "1.11.0")]
+#[stable(feature = "env_iterators", since = "1.12.0")]
 impl DoubleEndedIterator for Args {
     fn next_back(&mut self) -> Option<String> {
         self.inner.next_back().map(|s| s.into_string().unwrap())
@@ -727,7 +727,7 @@ fn len(&self) -> usize { self.inner.len() }
     fn is_empty(&self) -> bool { self.inner.is_empty() }
 }
 
-#[stable(feature = "env_iterators", since = "1.11.0")]
+#[stable(feature = "env_iterators", since = "1.12.0")]
 impl DoubleEndedIterator for ArgsOs {
     fn next_back(&mut self) -> Option<OsString> { self.inner.next_back() }
 }
index 9ff7d7467338bfd3bd607e8a6ad1a1e7bd3f0114..f56e3a5d780c06133626413008098a6e0274a4dc 100644 (file)
@@ -193,7 +193,7 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
     }
 }
 
-#[stable(feature = "string_box_error", since = "1.7.0")]
+#[stable(feature = "string_box_error", since = "1.6.0")]
 impl From<String> for Box<Error> {
     fn from(str_err: String) -> Box<Error> {
         let err1: Box<Error + Send + Sync> = From::from(str_err);
@@ -209,7 +209,7 @@ fn from(err: &'b str) -> Box<Error + Send + Sync + 'a> {
     }
 }
 
-#[stable(feature = "string_box_error", since = "1.7.0")]
+#[stable(feature = "string_box_error", since = "1.6.0")]
 impl<'a> From<&'a str> for Box<Error> {
     fn from(err: &'a str) -> Box<Error> {
         From::from(String::from(err))
@@ -282,7 +282,7 @@ fn description(&self) -> &str {
     }
 }
 
-#[stable(feature = "box_error", since = "1.7.0")]
+#[stable(feature = "box_error", since = "1.8.0")]
 impl<T: Error> Error for Box<T> {
     fn description(&self) -> &str {
         Error::description(&**self)
index 44b62593fa3a69add0ce5065004b12fca4098f77..f40475a41422bb9dc726480c3db4fbc9ea5459f4 100644 (file)
@@ -419,14 +419,14 @@ fn from(s: &'a CStr) -> Box<CStr> {
     }
 }
 
-#[stable(feature = "c_string_from_box", since = "1.17.0")]
+#[stable(feature = "c_string_from_box", since = "1.18.0")]
 impl From<Box<CStr>> for CString {
     fn from(s: Box<CStr>) -> CString {
         s.into_c_string()
     }
 }
 
-#[stable(feature = "box_from_c_string", since = "1.17.0")]
+#[stable(feature = "box_from_c_string", since = "1.18.0")]
 impl Into<Box<CStr>> for CString {
     fn into(self) -> Box<CStr> {
         self.into_boxed_c_str()
index b90192dd8af24ba2cd78569e1778091c90b2587b..eaf0502a577d941569a1e95a88ddc51c8cf8057f 100644 (file)
@@ -529,14 +529,14 @@ fn from(s: &'a OsStr) -> Box<OsStr> {
     }
 }
 
-#[stable(feature = "os_string_from_box", since = "1.17.0")]
+#[stable(feature = "os_string_from_box", since = "1.18.0")]
 impl<'a> From<Box<OsStr>> for OsString {
     fn from(boxed: Box<OsStr>) -> OsString {
         boxed.into_os_string()
     }
 }
 
-#[stable(feature = "box_from_c_string", since = "1.17.0")]
+#[stable(feature = "box_from_os_string", since = "1.18.0")]
 impl Into<Box<OsStr>> for OsString {
     fn into(self) -> Box<OsStr> {
         self.into_boxed_os_str()
index a4c3b276efdd2b2446b8e93c2f7774364f7c1f11..b0820d6f05a0533c4471d4b7157e63af7f403de2 100644 (file)
 #![feature(linkage)]
 #![feature(macro_reexport)]
 #![feature(needs_panic_runtime)]
+#![feature(needs_drop)]
 #![feature(never_type)]
 #![feature(num_bits_bytes)]
 #![feature(old_wrapping)]
index ef78ea6dfe8ee72c047315f07e3b2be4e96a8739..df3fce0da765dc72b191ed41fe84814b3ebc1ba7 100644 (file)
@@ -143,7 +143,7 @@ macro_rules! println {
 ///
 /// Panics if writing to `io::stderr` fails.
 #[macro_export]
-#[stable(feature = "eprint", since="1.18.0")]
+#[stable(feature = "eprint", since = "1.19.0")]
 #[allow_internal_unstable]
 macro_rules! eprint {
     ($($arg:tt)*) => ($crate::io::_eprint(format_args!($($arg)*)));
@@ -162,7 +162,7 @@ macro_rules! eprint {
 ///
 /// Panics if writing to `io::stderr` fails.
 #[macro_export]
-#[stable(feature = "eprint", since="1.18.0")]
+#[stable(feature = "eprint", since = "1.19.0")]
 macro_rules! eprintln {
     () => (eprint!("\n"));
     ($fmt:expr) => (eprint!(concat!($fmt, "\n")));
index c46fe4a58c7e246f919c74ec28afb9b679f63948..1e5368896af9100ff44819bb3f8d34c4ffc84920 100644 (file)
@@ -657,7 +657,7 @@ fn eq(&self, other: &Ipv4Addr) -> bool {
     }
 }
 
-#[stable(feature = "ip_cmp", since = "1.15.0")]
+#[stable(feature = "ip_cmp", since = "1.16.0")]
 impl PartialEq<Ipv4Addr> for IpAddr {
     fn eq(&self, other: &Ipv4Addr) -> bool {
         match *self {
@@ -667,7 +667,7 @@ fn eq(&self, other: &Ipv4Addr) -> bool {
     }
 }
 
-#[stable(feature = "ip_cmp", since = "1.15.0")]
+#[stable(feature = "ip_cmp", since = "1.16.0")]
 impl PartialEq<IpAddr> for Ipv4Addr {
     fn eq(&self, other: &IpAddr) -> bool {
         match *other {
@@ -694,7 +694,7 @@ fn partial_cmp(&self, other: &Ipv4Addr) -> Option<Ordering> {
     }
 }
 
-#[stable(feature = "ip_cmp", since = "1.15.0")]
+#[stable(feature = "ip_cmp", since = "1.16.0")]
 impl PartialOrd<Ipv4Addr> for IpAddr {
     fn partial_cmp(&self, other: &Ipv4Addr) -> Option<Ordering> {
         match *self {
@@ -704,7 +704,7 @@ fn partial_cmp(&self, other: &Ipv4Addr) -> Option<Ordering> {
     }
 }
 
-#[stable(feature = "ip_cmp", since = "1.15.0")]
+#[stable(feature = "ip_cmp", since = "1.16.0")]
 impl PartialOrd<IpAddr> for Ipv4Addr {
     fn partial_cmp(&self, other: &IpAddr) -> Option<Ordering> {
         match *other {
@@ -1200,7 +1200,7 @@ fn eq(&self, other: &Ipv6Addr) -> bool {
     }
 }
 
-#[stable(feature = "ip_cmp", since = "1.15.0")]
+#[stable(feature = "ip_cmp", since = "1.16.0")]
 impl PartialEq<IpAddr> for Ipv6Addr {
     fn eq(&self, other: &IpAddr) -> bool {
         match *other {
@@ -1210,7 +1210,7 @@ fn eq(&self, other: &IpAddr) -> bool {
     }
 }
 
-#[stable(feature = "ip_cmp", since = "1.15.0")]
+#[stable(feature = "ip_cmp", since = "1.16.0")]
 impl PartialEq<Ipv6Addr> for IpAddr {
     fn eq(&self, other: &Ipv6Addr) -> bool {
         match *self {
@@ -1237,7 +1237,7 @@ fn partial_cmp(&self, other: &Ipv6Addr) -> Option<Ordering> {
     }
 }
 
-#[stable(feature = "ip_cmp", since = "1.15.0")]
+#[stable(feature = "ip_cmp", since = "1.16.0")]
 impl PartialOrd<Ipv6Addr> for IpAddr {
     fn partial_cmp(&self, other: &Ipv6Addr) -> Option<Ordering> {
         match *self {
@@ -1247,7 +1247,7 @@ fn partial_cmp(&self, other: &Ipv6Addr) -> Option<Ordering> {
     }
 }
 
-#[stable(feature = "ip_cmp", since = "1.15.0")]
+#[stable(feature = "ip_cmp", since = "1.16.0")]
 impl PartialOrd<IpAddr> for Ipv6Addr {
     fn partial_cmp(&self, other: &IpAddr) -> Option<Ordering> {
         match *other {
@@ -1302,7 +1302,7 @@ fn from(ip: u128) -> Ipv6Addr {
     }
 }
 
-#[stable(feature = "ipv6_from_segments", since = "1.15.0")]
+#[stable(feature = "ipv6_from_segments", since = "1.16.0")]
 impl From<[u16; 8]> for Ipv6Addr {
     fn from(segments: [u16; 8]) -> Ipv6Addr {
         let [a, b, c, d, e, f, g, h] = segments;
index f4b9a8972e3abb93f8dcfbceead1a6096d76d509..e7d8c3007f6927da8c5481ae08bea7d6bc647e92 100644 (file)
@@ -1341,14 +1341,14 @@ fn from(path: &'a Path) -> Box<Path> {
     }
 }
 
-#[stable(feature = "path_buf_from_box", since = "1.17.0")]
+#[stable(feature = "path_buf_from_box", since = "1.18.0")]
 impl<'a> From<Box<Path>> for PathBuf {
     fn from(boxed: Box<Path>) -> PathBuf {
         boxed.into_path_buf()
     }
 }
 
-#[stable(feature = "box_from_path_buf", since = "1.17.0")]
+#[stable(feature = "box_from_path_buf", since = "1.18.0")]
 impl Into<Box<Path>> for PathBuf {
     fn into(self) -> Box<Path> {
         self.into_boxed_path()
@@ -1424,7 +1424,7 @@ fn borrow(&self) -> &Path {
     }
 }
 
-#[stable(feature = "default_for_pathbuf", since = "1.16.0")]
+#[stable(feature = "default_for_pathbuf", since = "1.17.0")]
 impl Default for PathBuf {
     fn default() -> Self {
         PathBuf::new()
index 7ad9d9ee37ce60e83dc8a4a6b74407d3aafc1def..c120a3045e4bbc72686a199ccac878759080cd74 100644 (file)
@@ -461,7 +461,7 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
     }
 }
 
-#[stable(feature = "condvar_default", since = "1.9.0")]
+#[stable(feature = "condvar_default", since = "1.10.0")]
 impl Default for Condvar {
     /// Creates a `Condvar` which is ready to be waited on and notified.
     fn default() -> Condvar {
index 284a5fbd9d5066dcc87353daca96e9e2dbaee58e..69507cada2b4ee1a62116cd111515a3fe1c6b065 100644 (file)
@@ -921,7 +921,7 @@ fn drop(&mut self) {
     }
 }
 
-#[stable(feature = "mpsc_debug", since = "1.7.0")]
+#[stable(feature = "mpsc_debug", since = "1.8.0")]
 impl<T> fmt::Debug for Sender<T> {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         write!(f, "Sender {{ .. }}")
@@ -1051,7 +1051,7 @@ fn drop(&mut self) {
     }
 }
 
-#[stable(feature = "mpsc_debug", since = "1.7.0")]
+#[stable(feature = "mpsc_debug", since = "1.8.0")]
 impl<T> fmt::Debug for SyncSender<T> {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         write!(f, "SyncSender {{ .. }}")
@@ -1517,7 +1517,7 @@ fn drop(&mut self) {
     }
 }
 
-#[stable(feature = "mpsc_debug", since = "1.7.0")]
+#[stable(feature = "mpsc_debug", since = "1.8.0")]
 impl<T> fmt::Debug for Receiver<T> {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         write!(f, "Receiver {{ .. }}")
@@ -1644,7 +1644,7 @@ fn cause(&self) -> Option<&error::Error> {
     }
 }
 
-#[stable(feature = "mpsc_recv_timeout_error", since = "1.14.0")]
+#[stable(feature = "mpsc_recv_timeout_error", since = "1.15.0")]
 impl fmt::Display for RecvTimeoutError {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         match *self {
@@ -1658,7 +1658,7 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
     }
 }
 
-#[stable(feature = "mpsc_recv_timeout_error", since = "1.14.0")]
+#[stable(feature = "mpsc_recv_timeout_error", since = "1.15.0")]
 impl error::Error for RecvTimeoutError {
     fn description(&self) -> &str {
         match *self {
index 5c3eaa4668d28c091560eff631d8b2edc61df2e8..9a242a96d46e3cf36307dc475ec701b2c5191ea8 100644 (file)
@@ -153,7 +153,7 @@ pub struct MutexGuard<'a, T: ?Sized + 'a> {
 
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<'a, T: ?Sized> !Send for MutexGuard<'a, T> { }
-#[stable(feature = "mutexguard", since = "1.18.0")]
+#[stable(feature = "mutexguard", since = "1.19.0")]
 unsafe impl<'a, T: ?Sized + Sync> Sync for MutexGuard<'a, T> { }
 
 impl<T> Mutex<T> {
@@ -372,7 +372,7 @@ fn drop(&mut self) {
     }
 }
 
-#[stable(feature = "mutex_default", since = "1.9.0")]
+#[stable(feature = "mutex_default", since = "1.10.0")]
 impl<T: ?Sized + Default> Default for Mutex<T> {
     /// Creates a `Mutex<T>`, with the `Default` value for T.
     fn default() -> Mutex<T> {
index d26f2f7bb7e3c7222ec6694254860ddaa9be2d01..95bc8d3093286cd57a511f392175e5c1bcf5a1d0 100644 (file)
@@ -330,7 +330,7 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
     }
 }
 
-#[stable(feature = "rw_lock_default", since = "1.9.0")]
+#[stable(feature = "rw_lock_default", since = "1.10.0")]
 impl<T: Default> Default for RwLock<T> {
     /// Creates a new `RwLock<T>`, with the `Default` value for T.
     fn default() -> RwLock<T> {
index f6414673dace13634300ab2c626e89620e053377..7dc61ce6654b9253673d3a9d857b2a557553b7d0 100644 (file)
 #![unstable(feature = "thread_local_internals", issue = "0")]
 
 use cell::{Cell, UnsafeCell};
-use intrinsics;
+use mem;
 use ptr;
 
+
 pub struct Key<T> {
     inner: UnsafeCell<Option<T>>,
 
@@ -37,7 +38,7 @@ pub const fn new() -> Key<T> {
 
     pub fn get(&'static self) -> Option<&'static UnsafeCell<Option<T>>> {
         unsafe {
-            if intrinsics::needs_drop::<T>() && self.dtor_running.get() {
+            if mem::needs_drop::<T>() && self.dtor_running.get() {
                 return None
             }
             self.register_dtor();
@@ -46,7 +47,7 @@ pub fn get(&'static self) -> Option<&'static UnsafeCell<Option<T>>> {
     }
 
     unsafe fn register_dtor(&self) {
-        if !intrinsics::needs_drop::<T>() || self.dtor_registered.get() {
+        if !mem::needs_drop::<T>() || self.dtor_registered.get() {
             return
         }
 
index 07d76a93dd150d12d13f539376716eda10e5df07..6b3973de84c97d940a575ff1ea78561fb3954348 100644 (file)
@@ -13,7 +13,7 @@
 
 use cell::{Cell, UnsafeCell};
 use fmt;
-use intrinsics;
+use mem;
 use ptr;
 
 pub struct Key<T> {
@@ -44,7 +44,7 @@ pub const fn new() -> Key<T> {
 
     pub fn get(&'static self) -> Option<&'static UnsafeCell<Option<T>>> {
         unsafe {
-            if intrinsics::needs_drop::<T>() && self.dtor_running.get() {
+            if mem::needs_drop::<T>() && self.dtor_running.get() {
                 return None
             }
             self.register_dtor();
@@ -53,7 +53,7 @@ pub fn get(&'static self) -> Option<&'static UnsafeCell<Option<T>>> {
     }
 
     unsafe fn register_dtor(&self) {
-        if !intrinsics::needs_drop::<T>() || self.dtor_registered.get() {
+        if !mem::needs_drop::<T>() || self.dtor_registered.get() {
             return
         }
 
index 09090ab87313087ac393082c21f6f95a0c335a83..bebb26afb540f10f8a069fa4cab94031acf1c820 100644 (file)
@@ -410,7 +410,7 @@ pub fn new() -> Features {
     (accepted, question_mark, "1.13.0", Some(31436)),
     // Allows `..` in tuple (struct) patterns
     (accepted, dotdot_in_tuple_patterns, "1.14.0", Some(33627)),
-    (accepted, item_like_imports, "1.14.0", Some(35120)),
+    (accepted, item_like_imports, "1.15.0", Some(35120)),
     // Allows using `Self` and associated types in struct expressions and patterns.
     (accepted, more_struct_aliases, "1.16.0", Some(37544)),
     // elide `'static` lifetimes in `static`s and `const`s
index 22e7de3838dc153a89f3bde569ef2ebcb45eb2c6..0fa4184606e452b348205688ad9f851853711bde 100644 (file)
@@ -11,7 +11,7 @@
 pub trait Resources<'a> {}
 
 pub trait Buffer<'a, R: Resources<'a>> {
-    //~^ NOTE the lifetime 'a as defined on the trait at 13:0...
+    //~^ NOTE the lifetime 'a as defined on the trait at 13:1...
     //~| NOTE ...does not necessarily outlive the lifetime 'a as defined on the trait
 
     fn select(&self) -> BufferViewHandle<R>;
@@ -22,7 +22,7 @@ pub trait Buffer<'a, R: Resources<'a>> {
     //~| ERROR mismatched types
     //~| lifetime mismatch
     //~| NOTE expected type `Resources<'_>`
-    //~| NOTE the anonymous lifetime #1 defined on the method body at 17:4...
+    //~| NOTE the anonymous lifetime #1 defined on the method body at 17:5...
 }
 
 pub struct BufferViewHandle<'a, R: 'a+Resources<'a>>(&'a R);
diff --git a/src/test/ui/fn_once-moved.rs b/src/test/ui/fn_once-moved.rs
new file mode 100644 (file)
index 0000000..781d388
--- /dev/null
@@ -0,0 +1,24 @@
+// 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.
+
+use std::collections::HashMap;
+
+fn main() {
+    let dict: HashMap<i32, i32> = HashMap::new();
+    let debug_dump_dict = || {
+        for (key, value) in dict {
+            println!("{:?} - {:?}", key, value);
+        }
+    };
+    debug_dump_dict();
+    debug_dump_dict();
+    //~^ ERROR use of moved value: `debug_dump_dict`
+    //~| NOTE closure was moved because it only implements `FnOnce`
+}
diff --git a/src/test/ui/fn_once-moved.stderr b/src/test/ui/fn_once-moved.stderr
new file mode 100644 (file)
index 0000000..322ab64
--- /dev/null
@@ -0,0 +1,12 @@
+error[E0382]: use of moved value: `debug_dump_dict`
+  --> $DIR/fn_once-moved.rs:21:5
+   |
+20 |     debug_dump_dict();
+   |     --------------- value moved here
+21 |     debug_dump_dict();
+   |     ^^^^^^^^^^^^^^^ value used here after move
+   |
+   = help: closure was moved because it only implements `FnOnce`
+
+error: aborting due to previous error
+
index 55723ee8cd96416c7bcc572eff46b387c77519a4..f325d10b548735ca04af219b6f7a044777fd9786 100644 (file)
@@ -4,14 +4,14 @@ error[E0312]: lifetime of reference outlives lifetime of borrowed content...
 12 |     if x > y { x } else { y }
    |                           ^
    |
-note: ...the reference is valid for the lifetime 'a as defined on the function body at 11:0...
+note: ...the reference is valid for the lifetime 'a as defined on the function body at 11:1...
   --> $DIR/ex1-return-one-existing-name-if-else.rs:11:1
    |
 11 | / fn foo<'a>(x: &'a i32, y: &i32) -> &'a i32 {
 12 | |     if x > y { x } else { y }
 13 | | }
    | |_^
-note: ...but the borrowed content is only valid for the anonymous lifetime #1 defined on the function body at 11:0
+note: ...but the borrowed content is only valid for the anonymous lifetime #1 defined on the function body at 11:1
   --> $DIR/ex1-return-one-existing-name-if-else.rs:11:1
    |
 11 | / fn foo<'a>(x: &'a i32, y: &i32) -> &'a i32 {
index b7d985feca9f27dfd29ebd6556b4d2184677976d..df484a14927c737ce514e9ab27e550585b7a6330 100644 (file)
@@ -6,14 +6,14 @@ error[E0308]: mismatched types
    |
    = note: expected type `Ref<'a, _>`
               found type `Ref<'_, _>`
-note: the anonymous lifetime #2 defined on the function body at 15:0...
+note: the anonymous lifetime #2 defined on the function body at 15:1...
   --> $DIR/ex2a-push-one-existing-name.rs:15:1
    |
 15 | / fn foo<'a>(x: &mut Vec<Ref<'a, i32>>, y: Ref<i32>) {
 16 | |     x.push(y);
 17 | | }
    | |_^
-note: ...does not necessarily outlive the lifetime 'a as defined on the function body at 15:0
+note: ...does not necessarily outlive the lifetime 'a as defined on the function body at 15:1
   --> $DIR/ex2a-push-one-existing-name.rs:15:1
    |
 15 | / fn foo<'a>(x: &mut Vec<Ref<'a, i32>>, y: Ref<i32>) {
index 3a6e94f2b1c2e2da70127c5a631a22516b19a026..6764c58f4bb59aeb1b9b345eab5f840ba0032c48 100644 (file)
@@ -6,14 +6,14 @@ error[E0308]: mismatched types
    |
    = note: expected type `Ref<'_, _>`
               found type `Ref<'_, _>`
-note: the anonymous lifetime #3 defined on the function body at 15:0...
+note: the anonymous lifetime #3 defined on the function body at 15:1...
   --> $DIR/ex2b-push-no-existing-names.rs:15:1
    |
 15 | / fn foo(x: &mut Vec<Ref<i32>>, y: Ref<i32>) {
 16 | |     x.push(y);
 17 | | }
    | |_^
-note: ...does not necessarily outlive the anonymous lifetime #2 defined on the function body at 15:0
+note: ...does not necessarily outlive the anonymous lifetime #2 defined on the function body at 15:1
   --> $DIR/ex2b-push-no-existing-names.rs:15:1
    |
 15 | / fn foo(x: &mut Vec<Ref<i32>>, y: Ref<i32>) {
index 3d7064a4f71a3b45423590caebeabea3619316ae..7356fc11862f6e104d004cd642852161b18e5e1b 100644 (file)
@@ -4,7 +4,7 @@ error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'a` d
 16 |     let z = Ref { data: y.data };
    |             ^^^
    |
-note: first, the lifetime cannot outlive the lifetime 'c as defined on the function body at 15:0...
+note: first, the lifetime cannot outlive the lifetime 'c as defined on the function body at 15:1...
   --> $DIR/ex2c-push-inference-variable.rs:15:1
    |
 15 | / fn foo<'a, 'b, 'c>(x: &'a mut Vec<Ref<'b, i32>>, y: Ref<'c, i32>) {
@@ -17,7 +17,7 @@ note: ...so that reference does not outlive borrowed content
    |
 16 |     let z = Ref { data: y.data };
    |                         ^^^^^^
-note: but, the lifetime must be valid for the lifetime 'b as defined on the function body at 15:0...
+note: but, the lifetime must be valid for the lifetime 'b as defined on the function body at 15:1...
   --> $DIR/ex2c-push-inference-variable.rs:15:1
    |
 15 | / fn foo<'a, 'b, 'c>(x: &'a mut Vec<Ref<'b, i32>>, y: Ref<'c, i32>) {
index aced855bf669bdca7e839fe0bdebb45f939827cb..38b0acf9339e0e89595a6c0ee889abca1f2c221e 100644 (file)
@@ -4,7 +4,7 @@ error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'a` d
 17 |     let b = Ref { data: y.data };
    |             ^^^
    |
-note: first, the lifetime cannot outlive the lifetime 'c as defined on the function body at 15:0...
+note: first, the lifetime cannot outlive the lifetime 'c as defined on the function body at 15:1...
   --> $DIR/ex2d-push-inference-variable-2.rs:15:1
    |
 15 | / fn foo<'a, 'b, 'c>(x: &'a mut Vec<Ref<'b, i32>>, y: Ref<'c, i32>) {
@@ -18,7 +18,7 @@ note: ...so that reference does not outlive borrowed content
    |
 17 |     let b = Ref { data: y.data };
    |                         ^^^^^^
-note: but, the lifetime must be valid for the lifetime 'b as defined on the function body at 15:0...
+note: but, the lifetime must be valid for the lifetime 'b as defined on the function body at 15:1...
   --> $DIR/ex2d-push-inference-variable-2.rs:15:1
    |
 15 | / fn foo<'a, 'b, 'c>(x: &'a mut Vec<Ref<'b, i32>>, y: Ref<'c, i32>) {
index 07e2316b63d8c61a8a1ed90b9cf59cbcd9cbe345..035e516e8628e9b933157645e651ef281f272c01 100644 (file)
@@ -4,7 +4,7 @@ error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'a` d
 17 |     let b = Ref { data: y.data };
    |             ^^^
    |
-note: first, the lifetime cannot outlive the lifetime 'c as defined on the function body at 15:0...
+note: first, the lifetime cannot outlive the lifetime 'c as defined on the function body at 15:1...
   --> $DIR/ex2e-push-inference-variable-3.rs:15:1
    |
 15 | / fn foo<'a, 'b, 'c>(x: &'a mut Vec<Ref<'b, i32>>, y: Ref<'c, i32>) {
@@ -18,7 +18,7 @@ note: ...so that reference does not outlive borrowed content
    |
 17 |     let b = Ref { data: y.data };
    |                         ^^^^^^
-note: but, the lifetime must be valid for the lifetime 'b as defined on the function body at 15:0...
+note: but, the lifetime must be valid for the lifetime 'b as defined on the function body at 15:1...
   --> $DIR/ex2e-push-inference-variable-3.rs:15:1
    |
 15 | / fn foo<'a, 'b, 'c>(x: &'a mut Vec<Ref<'b, i32>>, y: Ref<'c, i32>) {