Auto merge of #74994 - JohnTitor:rollup-eknaekv, r=JohnTitor

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
This commit is contained in:
bors 2020-07-31 23:52:46 +00:00
commit b544b43b10
9 changed files with 207 additions and 66 deletions

View File

@ -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)
==========================

View File

@ -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
@ -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

View File

@ -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() {

View File

@ -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)

View File

@ -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)) => {

View File

@ -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");

View File

@ -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),

View File

@ -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() {}

View File

@ -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`.