diff options
| author | bors <bors@rust-lang.org> | 2020-07-31 23:52:46 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2020-07-31 23:52:46 +0000 |
| commit | b544b43b10fa64f2f09e7e265a2bb7c624535c8e (patch) | |
| tree | 26942eb99a26384da18915d2efee52b3eea548a1 /src | |
| parent | 6e87bacd37539b7e7cd75152dffd225047fa983a (diff) | |
| parent | 3ad6feda56d4033a498e20c2d385147fe411678f (diff) | |
| download | rust-b544b43b10fa64f2f09e7e265a2bb7c624535c8e.tar.gz rust-b544b43b10fa64f2f09e7e265a2bb7c624535c8e.zip | |
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
Diffstat (limited to 'src')
| -rw-r--r-- | src/etc/test-float-parse/runtests.py | 8 | ||||
| -rw-r--r-- | src/librustc_lint/builtin.rs | 2 | ||||
| -rw-r--r-- | src/librustc_mir/interpret/eval_context.rs | 4 | ||||
| -rw-r--r-- | src/librustc_typeck/variance/constraints.rs | 1 | ||||
| -rw-r--r-- | src/test/ui/const-generics/nested-type.rs | 18 | ||||
| -rw-r--r-- | src/test/ui/const-generics/nested-type.stderr | 159 |
6 files changed, 188 insertions, 4 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) 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)) => { 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"); diff --git a/src/librustc_typeck/variance/constraints.rs b/src/librustc_typeck/variance/constraints.rs index cae09267994..b810c9824ce 100644 --- a/src/librustc_typeck/variance/constraints.rs +++ b/src/librustc_typeck/variance/constraints.rs @@ -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), 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<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 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<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`. |
