Skip to content

Commit

Permalink
Auto merge of #74994 - JohnTitor:rollup-eknaekv, r=JohnTitor
Browse files Browse the repository at this point in the history
Rollup of 6 pull requests

Successful merges:

 - #74644 (Remove `linked_list_extras` methods.)
 - #74968 (Run all tests if have no specified tests)
 - #74982 (1.45.2 release notes)
 - #74984 (Miri: fix ICE when unwinding past topmost stack frame)
 - #74986 (fix part of comparison that would always evaluate to "true", probably an oversight)
 - #74991 (Fix Const-Generic Cycle ICE #74199)

Failed merges:

r? @ghost
  • Loading branch information
bors committed Jul 31, 2020
2 parents 6e87bac + 3ad6fed commit b544b43
Show file tree
Hide file tree
Showing 9 changed files with 207 additions and 66 deletions.
9 changes: 9 additions & 0 deletions RELEASES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
Version 1.45.2 (2020-08-03)
==========================

* [Fix bindings in tuple struct patterns][74954]
* [Fix track_caller integration with trait objects][74784]

[74954]: https://github.com/rust-lang/rust/issues/74954
[74784]: https://github.com/rust-lang/rust/issues/74784

Version 1.45.1 (2020-07-30)
==========================

Expand Down
45 changes: 10 additions & 35 deletions library/alloc/src/collections/linked_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1110,32 +1110,17 @@ impl<T> IterMut<'_, T> {
/// Inserts the given element just after the element most recently returned by `.next()`.
/// The inserted element does not appear in the iteration.
///
/// # Examples
///
/// ```
/// #![feature(linked_list_extras)]
///
/// use std::collections::LinkedList;
///
/// let mut list: LinkedList<_> = vec![1, 3, 4].into_iter().collect();
///
/// {
/// let mut it = list.iter_mut();
/// assert_eq!(it.next().unwrap(), &1);
/// // insert `2` after `1`
/// it.insert_next(2);
/// }
/// {
/// let vec: Vec<_> = list.into_iter().collect();
/// assert_eq!(vec, [1, 2, 3, 4]);
/// }
/// ```
/// This method will be removed soon.
#[inline]
#[unstable(
feature = "linked_list_extras",
reason = "this is probably better handled by a cursor type -- we'll see",
issue = "27794"
)]
#[rustc_deprecated(
reason = "Deprecated in favor of CursorMut methods. This method will be removed soon.",
since = "1.47.0"
)]
pub fn insert_next(&mut self, element: T) {
match self.head {
// `push_back` is okay with aliasing `element` references
Expand Down Expand Up @@ -1163,27 +1148,17 @@ impl<T> IterMut<'_, T> {

/// Provides a reference to the next element, without changing the iterator.
///
/// # Examples
///
/// ```
/// #![feature(linked_list_extras)]
///
/// use std::collections::LinkedList;
///
/// let mut list: LinkedList<_> = vec![1, 2, 3].into_iter().collect();
///
/// let mut it = list.iter_mut();
/// assert_eq!(it.next().unwrap(), &1);
/// assert_eq!(it.peek_next().unwrap(), &2);
/// // We just peeked at 2, so it was not consumed from the iterator.
/// assert_eq!(it.next().unwrap(), &2);
/// ```
/// This method will be removed soon.
#[inline]
#[unstable(
feature = "linked_list_extras",
reason = "this is probably better handled by a cursor type -- we'll see",
issue = "27794"
)]
#[rustc_deprecated(
reason = "Deprecated in favor of CursorMut methods. This method will be removed soon.",
since = "1.47.0"
)]
pub fn peek_next(&mut self) -> Option<&mut T> {
if self.len == 0 {
None
Expand Down
27 changes: 0 additions & 27 deletions library/alloc/src/collections/linked_list/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,33 +153,6 @@ fn test_clone_from() {
}
}

#[test]
fn test_insert_prev() {
let mut m = list_from(&[0, 2, 4, 6, 8]);
let len = m.len();
{
let mut it = m.iter_mut();
it.insert_next(-2);
loop {
match it.next() {
None => break,
Some(elt) => {
it.insert_next(*elt + 1);
match it.peek_next() {
Some(x) => assert_eq!(*x, *elt + 2),
None => assert_eq!(8, *elt),
}
}
}
}
it.insert_next(0);
it.insert_next(1);
}
check_links(&m);
assert_eq!(m.len(), 3 + len * 2);
assert_eq!(m.into_iter().collect::<Vec<_>>(), [-2, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1]);
}

#[test]
#[cfg_attr(target_os = "emscripten", ignore)]
fn test_send() {
Expand Down
8 changes: 5 additions & 3 deletions src/etc/test-float-parse/runtests.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,10 +193,12 @@ def interact(proc, queue):

def main():
global MAILBOX
tests = [os.path.splitext(f)[0] for f in glob('*.rs')
if not f.startswith('_')]
all_tests = [os.path.splitext(f)[0] for f in glob('*.rs') if not f.startswith('_')]
args = sys.argv[1:]
tests = [test for test in tests if test in args]
if args:
tests = [test for test in all_tests if test in args]
else
tests = all_tests
if not tests:
print("Error: No tests to run")
sys.exit(1)
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_lint/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2209,7 +2209,7 @@ impl ClashingExternDeclarations {
}
(Slice(a_ty), Slice(b_ty)) => Self::structurally_same_type(cx, a_ty, b_ty, ckind),
(RawPtr(a_tymut), RawPtr(b_tymut)) => {
a_tymut.mutbl == a_tymut.mutbl
a_tymut.mutbl == b_tymut.mutbl
&& Self::structurally_same_type(cx, &a_tymut.ty, &b_tymut.ty, ckind)
}
(Ref(_a_region, a_ty, a_mut), Ref(_b_region, b_ty, b_mut)) => {
Expand Down
4 changes: 4 additions & 0 deletions src/librustc_mir/interpret/eval_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -718,6 +718,10 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
}
);

if unwinding && self.frame_idx() == 0 {
throw_ub_format!("unwinding past the topmost frame of the stack");
}

::log_settings::settings().indentation -= 1;
let frame =
self.stack_mut().pop().expect("tried to pop a stack frame, but there were none");
Expand Down
1 change: 1 addition & 0 deletions src/librustc_typeck/variance/constraints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ impl<'a, 'tcx> ConstraintContext<'a, 'tcx> {
self.add_constraints_from_sig(current_item, tcx.fn_sig(def_id), self.covariant);
}

ty::Error(_) => {}
_ => {
span_bug!(
tcx.def_span(def_id),
Expand Down
18 changes: 18 additions & 0 deletions src/test/ui/const-generics/nested-type.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#![feature(const_generics)]
#![allow(incomplete_features)]

struct Foo<const N: [u8; {
//~^ ERROR cycle detected
//~| ERROR cycle detected
struct Foo<const N: usize>;

impl<const N: usize> Foo<N> {
fn value() -> usize {
N
}
}

Foo::<17>::value()
}]>;

fn main() {}
159 changes: 159 additions & 0 deletions src/test/ui/const-generics/nested-type.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
error[E0391]: cycle detected when computing type of `Foo`
--> $DIR/nested-type.rs:4:1
|
LL | struct Foo<const N: [u8; {
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
note: ...which requires computing type of `Foo::N`...
--> $DIR/nested-type.rs:4:18
|
LL | struct Foo<const N: [u8; {
| ^
note: ...which requires const-evaluating + checking `Foo::{{constant}}#0`...
--> $DIR/nested-type.rs:4:26
|
LL | struct Foo<const N: [u8; {
| __________________________^
LL | |
LL | |
LL | | struct Foo<const N: usize>;
... |
LL | | Foo::<17>::value()
LL | | }]>;
| |_^
note: ...which requires const-evaluating + checking `Foo::{{constant}}#0`...
--> $DIR/nested-type.rs:4:26
|
LL | struct Foo<const N: [u8; {
| __________________________^
LL | |
LL | |
LL | | struct Foo<const N: usize>;
... |
LL | | Foo::<17>::value()
LL | | }]>;
| |_^
note: ...which requires const-evaluating `Foo::{{constant}}#0`...
--> $DIR/nested-type.rs:4:26
|
LL | struct Foo<const N: [u8; {
| __________________________^
LL | |
LL | |
LL | | struct Foo<const N: usize>;
... |
LL | | Foo::<17>::value()
LL | | }]>;
| |_^
note: ...which requires type-checking `Foo::{{constant}}#0`...
--> $DIR/nested-type.rs:4:26
|
LL | struct Foo<const N: [u8; {
| __________________________^
LL | |
LL | |
LL | | struct Foo<const N: usize>;
... |
LL | | Foo::<17>::value()
LL | | }]>;
| |_^
note: ...which requires computing the variances of `Foo::{{constant}}#0::Foo`...
--> $DIR/nested-type.rs:7:5
|
LL | struct Foo<const N: usize>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: ...which requires computing the variances for items in this crate...
= note: ...which again requires computing type of `Foo`, completing the cycle
note: cycle used when collecting item types in top-level module
--> $DIR/nested-type.rs:1:1
|
LL | / #![feature(const_generics)]
LL | | #![allow(incomplete_features)]
LL | |
LL | | struct Foo<const N: [u8; {
... |
LL | |
LL | | fn main() {}
| |____________^

error[E0391]: cycle detected when computing type of `Foo`
--> $DIR/nested-type.rs:4:1
|
LL | struct Foo<const N: [u8; {
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
note: ...which requires computing type of `Foo::N`...
--> $DIR/nested-type.rs:4:18
|
LL | struct Foo<const N: [u8; {
| ^
note: ...which requires const-evaluating + checking `Foo::{{constant}}#0`...
--> $DIR/nested-type.rs:4:26
|
LL | struct Foo<const N: [u8; {
| __________________________^
LL | |
LL | |
LL | | struct Foo<const N: usize>;
... |
LL | | Foo::<17>::value()
LL | | }]>;
| |_^
note: ...which requires const-evaluating + checking `Foo::{{constant}}#0`...
--> $DIR/nested-type.rs:4:26
|
LL | struct Foo<const N: [u8; {
| __________________________^
LL | |
LL | |
LL | | struct Foo<const N: usize>;
... |
LL | | Foo::<17>::value()
LL | | }]>;
| |_^
note: ...which requires const-evaluating `Foo::{{constant}}#0`...
--> $DIR/nested-type.rs:4:26
|
LL | struct Foo<const N: [u8; {
| __________________________^
LL | |
LL | |
LL | | struct Foo<const N: usize>;
... |
LL | | Foo::<17>::value()
LL | | }]>;
| |_^
note: ...which requires type-checking `Foo::{{constant}}#0`...
--> $DIR/nested-type.rs:4:26
|
LL | struct Foo<const N: [u8; {
| __________________________^
LL | |
LL | |
LL | | struct Foo<const N: usize>;
... |
LL | | Foo::<17>::value()
LL | | }]>;
| |_^
note: ...which requires computing the variances of `Foo::{{constant}}#0::Foo`...
--> $DIR/nested-type.rs:7:5
|
LL | struct Foo<const N: usize>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: ...which requires computing the variances for items in this crate...
= note: ...which again requires computing type of `Foo`, completing the cycle
note: cycle used when collecting item types in top-level module
--> $DIR/nested-type.rs:1:1
|
LL | / #![feature(const_generics)]
LL | | #![allow(incomplete_features)]
LL | |
LL | | struct Foo<const N: [u8; {
... |
LL | |
LL | | fn main() {}
| |____________^

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0391`.

0 comments on commit b544b43

Please sign in to comment.