diff --git a/RELEASES.md b/RELEASES.md index 08470e731d8e7..9bc750ddef5db 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -1,3 +1,11 @@ +Version 1.29.2 (2018-10-11) +=========================== + +- [Workaround for an aliasing-related LLVM bug, which caused miscompilation.][54639] +- The `rls-preview` component on the windows-gnu targets has been restored. + +[54639]: https://github.com/rust-lang/rust/pull/54639 + Version 1.29.1 (2018-09-25) =========================== diff --git a/src/liballoc/collections/vec_deque.rs b/src/liballoc/collections/vec_deque.rs index c53549ab85d6d..571f35a2031d2 100644 --- a/src/liballoc/collections/vec_deque.rs +++ b/src/liballoc/collections/vec_deque.rs @@ -19,7 +19,6 @@ use core::cmp::Ordering; use core::fmt; -use core::isize; use core::iter::{repeat, FromIterator, FusedIterator}; use core::mem; use core::ops::Bound::{Excluded, Included, Unbounded}; @@ -203,33 +202,6 @@ impl VecDeque { len); } - /// Copies all values from `src` to the back of `self`, wrapping around if needed. - /// - /// # Safety - /// - /// The capacity must be sufficient to hold self.len() + src.len() elements. - /// If so, this function never panics. - #[inline] - unsafe fn copy_slice(&mut self, src: &[T]) { - /// This is guaranteed by `RawVec`. - debug_assert!(self.capacity() <= isize::MAX as usize); - - let expected_new_len = self.len() + src.len(); - debug_assert!(self.capacity() >= expected_new_len); - - let dst_high_ptr = self.ptr().add(self.head); - let dst_high_len = self.cap() - self.head; - - let split = cmp::min(src.len(), dst_high_len); - let (src_high, src_low) = src.split_at(split); - - ptr::copy_nonoverlapping(src_high.as_ptr(), dst_high_ptr, src_high.len()); - ptr::copy_nonoverlapping(src_low.as_ptr(), self.ptr(), src_low.len()); - - self.head = self.wrap_add(self.head, src.len()); - debug_assert!(self.len() == expected_new_len); - } - /// Copies a potentially wrapping block of memory len long from src to dest. /// (abs(dst - src) + len) must be no larger than cap() (There must be at /// most one continuous overlapping region between src and dest). @@ -1052,7 +1024,7 @@ impl VecDeque { iter: Iter { tail: drain_tail, head: drain_head, - ring: unsafe { self.buffer_as_slice() }, + ring: unsafe { self.buffer_as_mut_slice() }, }, } } @@ -1862,22 +1834,8 @@ impl VecDeque { #[inline] #[stable(feature = "append", since = "1.4.0")] pub fn append(&mut self, other: &mut Self) { - unsafe { - // Guarantees there is space in `self` for `other`. - self.reserve(other.len()); - - { - let (src_high, src_low) = other.as_slices(); - - // This is only safe because copy_slice never panics when capacity is sufficient. - self.copy_slice(src_low); - self.copy_slice(src_high); - } - - // Some values now exist in both `other` and `self` but are made inaccessible - // in`other`. - other.tail = other.head; - } + // naive impl + self.extend(other.drain(..)); } /// Retains only the elements specified by the predicate. @@ -2635,8 +2593,8 @@ impl From> for Vec { let mut right_offset = 0; for i in left_edge..right_edge { right_offset = (i - left_edge) % (cap - right_edge); - let src = right_edge + right_offset; - ptr::swap(buf.add(i), buf.add(src)); + let src: isize = (right_edge + right_offset) as isize; + ptr::swap(buf.add(i), buf.offset(src)); } let n_ops = right_edge - left_edge; left_edge += n_ops; diff --git a/src/librustc/middle/dead.rs b/src/librustc/middle/dead.rs index d320173f9f47d..e9e8fc5cf27c9 100644 --- a/src/librustc/middle/dead.rs +++ b/src/librustc/middle/dead.rs @@ -395,7 +395,13 @@ fn create_and_seed_worklist<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, krate: &hir::Crate) -> Vec { - let worklist = access_levels.map.iter().map(|(&id, _)| id).chain( + let worklist = access_levels.map.iter().filter_map(|(&id, level)| { + if level >= &privacy::AccessLevel::Reachable { + Some(id) + } else { + None + } + }).chain( // Seed entry point tcx.sess.entry_fn.borrow().map(|(id, _, _)| id) ).collect::>(); diff --git a/src/test/run-pass/async-await.rs b/src/test/run-pass/async-await.rs index f692f57abb9c3..2c634f3449083 100644 --- a/src/test/run-pass/async-await.rs +++ b/src/test/run-pass/async-await.rs @@ -183,6 +183,7 @@ fn main() { async_closure, async_fn, async_fn_with_internal_borrow, + Foo::async_method, |x| { async move { unsafe { await!(unsafe_async_fn(x)) } diff --git a/src/test/run-pass/impl-trait/existential-minimal.stderr b/src/test/run-pass/impl-trait/existential-minimal.stderr new file mode 100644 index 0000000000000..dd1f749788674 --- /dev/null +++ b/src/test/run-pass/impl-trait/existential-minimal.stderr @@ -0,0 +1,8 @@ +warning: function is never used: `foo` + --> $DIR/existential-minimal.rs:15:1 + | +LL | fn foo() -> impl std::fmt::Debug { "cake" } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: #[warn(dead_code)] on by default + diff --git a/src/test/run-pass/impl-trait/issue-42479.stderr b/src/test/run-pass/impl-trait/issue-42479.stderr new file mode 100644 index 0000000000000..5a6a3031d0b01 --- /dev/null +++ b/src/test/run-pass/impl-trait/issue-42479.stderr @@ -0,0 +1,14 @@ +warning: struct is never constructed: `Foo` + --> $DIR/issue-42479.rs:15:1 + | +LL | struct Foo { + | ^^^^^^^^^^ + | + = note: #[warn(dead_code)] on by default + +warning: method is never used: `inside` + --> $DIR/issue-42479.rs:20:5 + | +LL | fn inside(&self) -> impl Iterator { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + diff --git a/src/test/run-pass/impl-trait/issue-49376.stderr b/src/test/run-pass/impl-trait/issue-49376.stderr new file mode 100644 index 0000000000000..f5f36002b4222 --- /dev/null +++ b/src/test/run-pass/impl-trait/issue-49376.stderr @@ -0,0 +1,32 @@ +warning: function is never used: `gen` + --> $DIR/issue-49376.rs:18:1 + | +LL | fn gen() -> impl PartialOrd + PartialEq + Debug { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: #[warn(dead_code)] on by default + +warning: struct is never constructed: `Bar` + --> $DIR/issue-49376.rs:20:1 + | +LL | struct Bar {} + | ^^^^^^^^^^ + +warning: function is never used: `foo` + --> $DIR/issue-49376.rs:24:1 + | +LL | fn foo() -> impl Foo { + | ^^^^^^^^^^^^^^^^^^^^ + +warning: function is never used: `test_impl_ops` + --> $DIR/issue-49376.rs:28:1 + | +LL | fn test_impl_ops() -> impl Add + Sub + Mul + Div { 1 } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: function is never used: `test_impl_assign_ops` + --> $DIR/issue-49376.rs:29:1 + | +LL | fn test_impl_assign_ops() -> impl AddAssign + SubAssign + MulAssign + DivAssign { 1 } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + diff --git a/src/test/run-pass/issues/issue-49556.stderr b/src/test/run-pass/issues/issue-49556.stderr new file mode 100644 index 0000000000000..8657d4ac2f290 --- /dev/null +++ b/src/test/run-pass/issues/issue-49556.stderr @@ -0,0 +1,8 @@ +warning: function is never used: `iter` + --> $DIR/issue-49556.rs:12:1 + | +LL | fn iter<'a>(data: &'a [usize]) -> impl Iterator + 'a { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: #[warn(dead_code)] on by default + diff --git a/src/test/run-pass/traits/conservative_impl_trait.stderr b/src/test/run-pass/traits/conservative_impl_trait.stderr new file mode 100644 index 0000000000000..26c29bf2bb2b5 --- /dev/null +++ b/src/test/run-pass/traits/conservative_impl_trait.stderr @@ -0,0 +1,8 @@ +warning: function is never used: `batches` + --> $DIR/conservative_impl_trait.rs:14:1 + | +LL | fn batches(n: &u32) -> impl Iterator { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: #[warn(dead_code)] on by default + diff --git a/src/test/ui/lint/lint-dead-code-1.rs b/src/test/ui/lint/lint-dead-code-1.rs index 2fe72365bab1c..944d57b5ba8f5 100644 --- a/src/test/ui/lint/lint-dead-code-1.rs +++ b/src/test/ui/lint/lint-dead-code-1.rs @@ -109,6 +109,10 @@ fn bar() { //~ ERROR: function is never used foo(); } +fn baz() -> impl Copy { //~ ERROR: function is never used + "I'm unused, too" +} + // Code with #[allow(dead_code)] should be marked live (and thus anything it // calls is marked live) #[allow(dead_code)] diff --git a/src/test/ui/lint/lint-dead-code-1.stderr b/src/test/ui/lint/lint-dead-code-1.stderr index 9802b7e8f383b..9d8e44c25d87e 100644 --- a/src/test/ui/lint/lint-dead-code-1.stderr +++ b/src/test/ui/lint/lint-dead-code-1.stderr @@ -58,5 +58,11 @@ error: function is never used: `bar` LL | fn bar() { //~ ERROR: function is never used | ^^^^^^^^ -error: aborting due to 9 previous errors +error: function is never used: `baz` + --> $DIR/lint-dead-code-1.rs:112:1 + | +LL | fn baz() -> impl Copy { //~ ERROR: function is never used + | ^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 10 previous errors