]> git.lizzy.rs Git - rust.git/commitdiff
Auto merge of #74994 - JohnTitor:rollup-eknaekv, r=JohnTitor
authorbors <bors@rust-lang.org>
Fri, 31 Jul 2020 23:52:46 +0000 (23:52 +0000)
committerbors <bors@rust-lang.org>
Fri, 31 Jul 2020 23:52:46 +0000 (23:52 +0000)
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

RELEASES.md
library/alloc/src/collections/linked_list.rs
library/alloc/src/collections/linked_list/tests.rs
src/etc/test-float-parse/runtests.py
src/librustc_lint/builtin.rs
src/librustc_mir/interpret/eval_context.rs
src/librustc_typeck/variance/constraints.rs
src/test/ui/const-generics/nested-type.rs [new file with mode: 0644]
src/test/ui/const-generics/nested-type.stderr [new file with mode: 0644]

index b47f64d2fafc9abbf412863f1067f9ebde0b7b17..4859532f7a1f72505b5bf15fe1fba88e8c4b80d6 100644 (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)
 ==========================
 
index 1f875f6c5217f4897cb67711b05670b9dfae509a..02a746f0e24880893ff89f1983bada892057ae41 100644 (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 @@ pub fn insert_next(&mut self, element: 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
index b8c93a28bba815a1bfa38fea9a49e581a335c13f..ad643a7bdf1941ad15e2c65dca218cf8e0f80a9f 100644 (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() {
index 4d2902e986f5652861b0ed2942b52809f30b31d9..218552a45972d860f022ce2d86b8421b40a646bc 100644 (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)
index 06e7c2b6f36256b460cc714241ba38716195240d..e32c8fbee6852275c9d7215faddd5200ca0c81a7 100644 (file)
@@ -2209,7 +2209,7 @@ fn structurally_same_type<'tcx>(
                 }
                 (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)) => {
index 630b2890835da86feab408c66fd5f9dc2ea3d339..65736710fce1bb1d26ea14275a46ba170ec5c4ea 100644 (file)
@@ -718,6 +718,10 @@ pub(super) fn pop_stack_frame(&mut self, unwinding: bool) -> InterpResult<'tcx>
             }
         );
 
+        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");
index cae09267994e3fe94af54dc80e41d95cedb4c0a1..b810c9824ce66eb5379362cbd49857f29b7037ca 100644 (file)
@@ -161,6 +161,7 @@ fn build_constraints_for_item(&mut self, def_id: LocalDefId) {
                 self.add_constraints_from_sig(current_item, tcx.fn_sig(def_id), self.covariant);
             }
 
+            ty::Error(_) => {}
             _ => {
                 span_bug!(
                     tcx.def_span(def_id),
diff --git a/src/test/ui/const-generics/nested-type.rs b/src/test/ui/const-generics/nested-type.rs
new file mode 100644 (file)
index 0000000..12ea850
--- /dev/null
@@ -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() {}
diff --git a/src/test/ui/const-generics/nested-type.stderr b/src/test/ui/const-generics/nested-type.stderr
new file mode 100644 (file)
index 0000000..da0e803
--- /dev/null
@@ -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`.