From a4757225d72b9c7f46bc90630126eb000974ffaf Mon Sep 17 00:00:00 2001 From: Lzu Tao Date: Fri, 31 Jul 2020 04:20:27 +0000 Subject: [PATCH 1/7] Run all tests if have no specified tests --- src/etc/test-float-parse/runtests.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/etc/test-float-parse/runtests.py b/src/etc/test-float-parse/runtests.py index 4d2902e986f..218552a4597 100644 --- a/src/etc/test-float-parse/runtests.py +++ b/src/etc/test-float-parse/runtests.py @@ -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) From f173a4b8ecb1f7673e9f5df19dd2f9287f461364 Mon Sep 17 00:00:00 2001 From: Mark Rousskov Date: Thu, 30 Jul 2020 16:12:02 -0400 Subject: [PATCH 2/7] 1.45.2 release notes --- RELEASES.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/RELEASES.md b/RELEASES.md index b47f64d2faf..4859532f7a1 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -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) ========================== From dc21178830a0ae6e70101ffff8ef4843990cd902 Mon Sep 17 00:00:00 2001 From: Charles Lew Date: Thu, 23 Jul 2020 01:30:54 +0800 Subject: [PATCH 3/7] Remove `linked_list_extras` methods. --- library/alloc/src/collections/linked_list.rs | 45 +++++-------------- .../src/collections/linked_list/tests.rs | 27 ----------- 2 files changed, 10 insertions(+), 62 deletions(-) diff --git a/library/alloc/src/collections/linked_list.rs b/library/alloc/src/collections/linked_list.rs index 1f875f6c521..02a746f0e24 100644 --- a/library/alloc/src/collections/linked_list.rs +++ b/library/alloc/src/collections/linked_list.rs @@ -1110,32 +1110,17 @@ impl 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 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 diff --git a/library/alloc/src/collections/linked_list/tests.rs b/library/alloc/src/collections/linked_list/tests.rs index b8c93a28bba..ad643a7bdf1 100644 --- a/library/alloc/src/collections/linked_list/tests.rs +++ b/library/alloc/src/collections/linked_list/tests.rs @@ -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::>(), [-2, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1]); -} - #[test] #[cfg_attr(target_os = "emscripten", ignore)] fn test_send() { From 73ba4e7abe0ada4c187aee4576bffe6024b5098a Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Fri, 31 Jul 2020 20:46:05 +0200 Subject: [PATCH 4/7] Miri: fix ICE when unwinding past topmost stack frame --- src/librustc_mir/interpret/eval_context.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/librustc_mir/interpret/eval_context.rs b/src/librustc_mir/interpret/eval_context.rs index 630b2890835..65736710fce 100644 --- a/src/librustc_mir/interpret/eval_context.rs +++ b/src/librustc_mir/interpret/eval_context.rs @@ -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"); From 8a5654f53c434466d913e18f50e661098e0c3e9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Kr=C3=BCger?= Date: Fri, 31 Jul 2020 21:23:39 +0200 Subject: [PATCH 5/7] fix part of comparison that would always evaluate to "true", probably an oversight --- src/librustc_lint/builtin.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/librustc_lint/builtin.rs b/src/librustc_lint/builtin.rs index 06e7c2b6f36..e32c8fbee68 100644 --- a/src/librustc_lint/builtin.rs +++ b/src/librustc_lint/builtin.rs @@ -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)) => { From 011e0ef6362b59a5f8719dbee0a9b603c506f6d5 Mon Sep 17 00:00:00 2001 From: kadmin Date: Fri, 31 Jul 2020 21:12:05 +0000 Subject: [PATCH 6/7] Removed error check in order to prevent ICE --- src/librustc_typeck/variance/constraints.rs | 7 +- src/test/ui/const-generics/nested-type.rs | 18 ++ src/test/ui/const-generics/nested-type.stderr | 159 ++++++++++++++++++ 3 files changed, 178 insertions(+), 6 deletions(-) create mode 100644 src/test/ui/const-generics/nested-type.rs create mode 100644 src/test/ui/const-generics/nested-type.stderr diff --git a/src/librustc_typeck/variance/constraints.rs b/src/librustc_typeck/variance/constraints.rs index cae09267994..08a12797a1b 100644 --- a/src/librustc_typeck/variance/constraints.rs +++ b/src/librustc_typeck/variance/constraints.rs @@ -161,12 +161,7 @@ impl<'a, 'tcx> ConstraintContext<'a, 'tcx> { self.add_constraints_from_sig(current_item, tcx.fn_sig(def_id), self.covariant); } - _ => { - span_bug!( - tcx.def_span(def_id), - "`build_constraints_for_item` unsupported for this item" - ); - } + _ => {} } } diff --git a/src/test/ui/const-generics/nested-type.rs b/src/test/ui/const-generics/nested-type.rs new file mode 100644 index 00000000000..12ea850c8f6 --- /dev/null +++ b/src/test/ui/const-generics/nested-type.rs @@ -0,0 +1,18 @@ +#![feature(const_generics)] +#![allow(incomplete_features)] + +struct Foo; + + impl Foo { + 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 index 00000000000..da0e8032404 --- /dev/null +++ b/src/test/ui/const-generics/nested-type.stderr @@ -0,0 +1,159 @@ +error[E0391]: cycle detected when computing type of `Foo` + --> $DIR/nested-type.rs:4:1 + | +LL | struct Foo $DIR/nested-type.rs:4:18 + | +LL | struct Foo $DIR/nested-type.rs:4:26 + | +LL | struct Foo; +... | +LL | | Foo::<17>::value() +LL | | }]>; + | |_^ +note: ...which requires const-evaluating + checking `Foo::{{constant}}#0`... + --> $DIR/nested-type.rs:4:26 + | +LL | struct Foo; +... | +LL | | Foo::<17>::value() +LL | | }]>; + | |_^ +note: ...which requires const-evaluating `Foo::{{constant}}#0`... + --> $DIR/nested-type.rs:4:26 + | +LL | struct Foo; +... | +LL | | Foo::<17>::value() +LL | | }]>; + | |_^ +note: ...which requires type-checking `Foo::{{constant}}#0`... + --> $DIR/nested-type.rs:4:26 + | +LL | struct Foo; +... | +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; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = 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 $DIR/nested-type.rs:4:1 + | +LL | struct Foo $DIR/nested-type.rs:4:18 + | +LL | struct Foo $DIR/nested-type.rs:4:26 + | +LL | struct Foo; +... | +LL | | Foo::<17>::value() +LL | | }]>; + | |_^ +note: ...which requires const-evaluating + checking `Foo::{{constant}}#0`... + --> $DIR/nested-type.rs:4:26 + | +LL | struct Foo; +... | +LL | | Foo::<17>::value() +LL | | }]>; + | |_^ +note: ...which requires const-evaluating `Foo::{{constant}}#0`... + --> $DIR/nested-type.rs:4:26 + | +LL | struct Foo; +... | +LL | | Foo::<17>::value() +LL | | }]>; + | |_^ +note: ...which requires type-checking `Foo::{{constant}}#0`... + --> $DIR/nested-type.rs:4:26 + | +LL | struct Foo; +... | +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; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = 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 Date: Fri, 31 Jul 2020 21:33:55 +0000 Subject: [PATCH 7/7] Added in explicit check for the type being matched --- src/librustc_typeck/variance/constraints.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/librustc_typeck/variance/constraints.rs b/src/librustc_typeck/variance/constraints.rs index 08a12797a1b..b810c9824ce 100644 --- a/src/librustc_typeck/variance/constraints.rs +++ b/src/librustc_typeck/variance/constraints.rs @@ -161,7 +161,13 @@ 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), + "`build_constraints_for_item` unsupported for this item" + ); + } } }