Skip to content

Commit e473232

Browse files
committed
Auto merge of #54907 - pietroalbini:beta-backports, r=pietroalbini
[beta] Rollup backports Merged and approved: * #54851: Fix a regression in 1.30 by reverting #53564 * #54865: Backport 1.29.2 release notes to master * #54810: Fix dead code lint for functions using impl Trait r? @ghost
2 parents 96a2298 + ebca923 commit e473232

File tree

11 files changed

+102
-49
lines changed

11 files changed

+102
-49
lines changed

RELEASES.md

+8
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
Version 1.29.2 (2018-10-11)
2+
===========================
3+
4+
- [Workaround for an aliasing-related LLVM bug, which caused miscompilation.][54639]
5+
- The `rls-preview` component on the windows-gnu targets has been restored.
6+
7+
[54639]: https://github.com/rust-lang/rust/pull/54639
8+
19
Version 1.29.1 (2018-09-25)
210
===========================
311

src/liballoc/collections/vec_deque.rs

+5-47
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919

2020
use core::cmp::Ordering;
2121
use core::fmt;
22-
use core::isize;
2322
use core::iter::{repeat, FromIterator, FusedIterator};
2423
use core::mem;
2524
use core::ops::Bound::{Excluded, Included, Unbounded};
@@ -203,33 +202,6 @@ impl<T> VecDeque<T> {
203202
len);
204203
}
205204

206-
/// Copies all values from `src` to the back of `self`, wrapping around if needed.
207-
///
208-
/// # Safety
209-
///
210-
/// The capacity must be sufficient to hold self.len() + src.len() elements.
211-
/// If so, this function never panics.
212-
#[inline]
213-
unsafe fn copy_slice(&mut self, src: &[T]) {
214-
/// This is guaranteed by `RawVec`.
215-
debug_assert!(self.capacity() <= isize::MAX as usize);
216-
217-
let expected_new_len = self.len() + src.len();
218-
debug_assert!(self.capacity() >= expected_new_len);
219-
220-
let dst_high_ptr = self.ptr().add(self.head);
221-
let dst_high_len = self.cap() - self.head;
222-
223-
let split = cmp::min(src.len(), dst_high_len);
224-
let (src_high, src_low) = src.split_at(split);
225-
226-
ptr::copy_nonoverlapping(src_high.as_ptr(), dst_high_ptr, src_high.len());
227-
ptr::copy_nonoverlapping(src_low.as_ptr(), self.ptr(), src_low.len());
228-
229-
self.head = self.wrap_add(self.head, src.len());
230-
debug_assert!(self.len() == expected_new_len);
231-
}
232-
233205
/// Copies a potentially wrapping block of memory len long from src to dest.
234206
/// (abs(dst - src) + len) must be no larger than cap() (There must be at
235207
/// most one continuous overlapping region between src and dest).
@@ -1052,7 +1024,7 @@ impl<T> VecDeque<T> {
10521024
iter: Iter {
10531025
tail: drain_tail,
10541026
head: drain_head,
1055-
ring: unsafe { self.buffer_as_slice() },
1027+
ring: unsafe { self.buffer_as_mut_slice() },
10561028
},
10571029
}
10581030
}
@@ -1862,22 +1834,8 @@ impl<T> VecDeque<T> {
18621834
#[inline]
18631835
#[stable(feature = "append", since = "1.4.0")]
18641836
pub fn append(&mut self, other: &mut Self) {
1865-
unsafe {
1866-
// Guarantees there is space in `self` for `other`.
1867-
self.reserve(other.len());
1868-
1869-
{
1870-
let (src_high, src_low) = other.as_slices();
1871-
1872-
// This is only safe because copy_slice never panics when capacity is sufficient.
1873-
self.copy_slice(src_low);
1874-
self.copy_slice(src_high);
1875-
}
1876-
1877-
// Some values now exist in both `other` and `self` but are made inaccessible
1878-
// in`other`.
1879-
other.tail = other.head;
1880-
}
1837+
// naive impl
1838+
self.extend(other.drain(..));
18811839
}
18821840

18831841
/// Retains only the elements specified by the predicate.
@@ -2635,8 +2593,8 @@ impl<T> From<VecDeque<T>> for Vec<T> {
26352593
let mut right_offset = 0;
26362594
for i in left_edge..right_edge {
26372595
right_offset = (i - left_edge) % (cap - right_edge);
2638-
let src = right_edge + right_offset;
2639-
ptr::swap(buf.add(i), buf.add(src));
2596+
let src: isize = (right_edge + right_offset) as isize;
2597+
ptr::swap(buf.add(i), buf.offset(src));
26402598
}
26412599
let n_ops = right_edge - left_edge;
26422600
left_edge += n_ops;

src/librustc/middle/dead.rs

+7-1
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,13 @@ fn create_and_seed_worklist<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
395395
krate: &hir::Crate)
396396
-> Vec<ast::NodeId>
397397
{
398-
let worklist = access_levels.map.iter().map(|(&id, _)| id).chain(
398+
let worklist = access_levels.map.iter().filter_map(|(&id, level)| {
399+
if level >= &privacy::AccessLevel::Reachable {
400+
Some(id)
401+
} else {
402+
None
403+
}
404+
}).chain(
399405
// Seed entry point
400406
tcx.sess.entry_fn.borrow().map(|(id, _, _)| id)
401407
).collect::<Vec<_>>();

src/test/run-pass/async-await.rs

+1
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@ fn main() {
183183
async_closure,
184184
async_fn,
185185
async_fn_with_internal_borrow,
186+
Foo::async_method,
186187
|x| {
187188
async move {
188189
unsafe { await!(unsafe_async_fn(x)) }
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
warning: function is never used: `foo`
2+
--> $DIR/existential-minimal.rs:15:1
3+
|
4+
LL | fn foo() -> impl std::fmt::Debug { "cake" }
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6+
|
7+
= note: #[warn(dead_code)] on by default
8+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
warning: struct is never constructed: `Foo`
2+
--> $DIR/issue-42479.rs:15:1
3+
|
4+
LL | struct Foo {
5+
| ^^^^^^^^^^
6+
|
7+
= note: #[warn(dead_code)] on by default
8+
9+
warning: method is never used: `inside`
10+
--> $DIR/issue-42479.rs:20:5
11+
|
12+
LL | fn inside(&self) -> impl Iterator<Item = &i32> {
13+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
14+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
warning: function is never used: `gen`
2+
--> $DIR/issue-49376.rs:18:1
3+
|
4+
LL | fn gen() -> impl PartialOrd + PartialEq + Debug { }
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6+
|
7+
= note: #[warn(dead_code)] on by default
8+
9+
warning: struct is never constructed: `Bar`
10+
--> $DIR/issue-49376.rs:20:1
11+
|
12+
LL | struct Bar {}
13+
| ^^^^^^^^^^
14+
15+
warning: function is never used: `foo`
16+
--> $DIR/issue-49376.rs:24:1
17+
|
18+
LL | fn foo() -> impl Foo {
19+
| ^^^^^^^^^^^^^^^^^^^^
20+
21+
warning: function is never used: `test_impl_ops`
22+
--> $DIR/issue-49376.rs:28:1
23+
|
24+
LL | fn test_impl_ops() -> impl Add + Sub + Mul + Div { 1 }
25+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
26+
27+
warning: function is never used: `test_impl_assign_ops`
28+
--> $DIR/issue-49376.rs:29:1
29+
|
30+
LL | fn test_impl_assign_ops() -> impl AddAssign + SubAssign + MulAssign + DivAssign { 1 }
31+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
32+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
warning: function is never used: `iter`
2+
--> $DIR/issue-49556.rs:12:1
3+
|
4+
LL | fn iter<'a>(data: &'a [usize]) -> impl Iterator<Item = usize> + 'a {
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6+
|
7+
= note: #[warn(dead_code)] on by default
8+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
warning: function is never used: `batches`
2+
--> $DIR/conservative_impl_trait.rs:14:1
3+
|
4+
LL | fn batches(n: &u32) -> impl Iterator<Item=&u32> {
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6+
|
7+
= note: #[warn(dead_code)] on by default
8+

src/test/ui/lint/lint-dead-code-1.rs

+4
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,10 @@ fn bar() { //~ ERROR: function is never used
109109
foo();
110110
}
111111

112+
fn baz() -> impl Copy { //~ ERROR: function is never used
113+
"I'm unused, too"
114+
}
115+
112116
// Code with #[allow(dead_code)] should be marked live (and thus anything it
113117
// calls is marked live)
114118
#[allow(dead_code)]

src/test/ui/lint/lint-dead-code-1.stderr

+7-1
Original file line numberDiff line numberDiff line change
@@ -58,5 +58,11 @@ error: function is never used: `bar`
5858
LL | fn bar() { //~ ERROR: function is never used
5959
| ^^^^^^^^
6060

61-
error: aborting due to 9 previous errors
61+
error: function is never used: `baz`
62+
--> $DIR/lint-dead-code-1.rs:112:1
63+
|
64+
LL | fn baz() -> impl Copy { //~ ERROR: function is never used
65+
| ^^^^^^^^^^^^^^^^^^^^^
66+
67+
error: aborting due to 10 previous errors
6268

0 commit comments

Comments
 (0)