Skip to content

Commit 07effe1

Browse files
authored
Rollup merge of #67543 - JohnTitor:regression-tests, r=Centril
Add regression tests for fixed ICEs Closes #61747 (fixed from 1.41.0-nightly (4007d4e 2019-12-01)) Closes #66205 (fixed from 1.41.0-nightly (4007d4e 2019-12-01)) Closes #66270 (fixed by #66246) Closes #67424 (fixed by #67160) Also picking a minor nit up from #67071 with 101dd7b r? @Centril
2 parents 1ac8fc7 + d918319 commit 07effe1

8 files changed

+90
-1
lines changed

src/librustc/traits/error_reporting.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2373,7 +2373,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
23732373
let span = self.tcx.def_span(generator_did);
23742374

23752375
// Do not ICE on closure typeck (#66868).
2376-
if let None = self.tcx.hir().as_local_hir_id(generator_did) {
2376+
if self.tcx.hir().as_local_hir_id(generator_did).is_none() {
23772377
return false;
23782378
}
23792379

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// check-pass
2+
3+
#![feature(const_generics)]
4+
//~^ WARN the feature `const_generics` is incomplete and may cause the compiler to crash
5+
6+
struct Const<const N: usize>;
7+
8+
impl<const C: usize> Const<{C}> {
9+
fn successor() -> Const<{C + 1}> {
10+
Const
11+
}
12+
}
13+
14+
fn main() {
15+
let _x: Const::<2> = Const::<1>::successor();
16+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
warning: the feature `const_generics` is incomplete and may cause the compiler to crash
2+
--> $DIR/issue-61747.rs:3:12
3+
|
4+
LL | #![feature(const_generics)]
5+
| ^^^^^^^^^^^^^^
6+
|
7+
= note: `#[warn(incomplete_features)]` on by default
8+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// check-pass
2+
3+
#![allow(incomplete_features, dead_code, unconditional_recursion)]
4+
#![feature(const_generics)]
5+
6+
fn fact<const N: usize>() {
7+
fact::<{ N - 1 }>();
8+
}
9+
10+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// Fixed by #67160
2+
3+
trait Trait1 {
4+
type A;
5+
}
6+
7+
trait Trait2 {
8+
type Type1<B>: Trait1<A=B>;
9+
//~^ ERROR: generic associated types are unstable
10+
//~| ERROR: type-generic associated types are not yet implemented
11+
}
12+
13+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
error[E0658]: generic associated types are unstable
2+
--> $DIR/issue-67424.rs:8:5
3+
|
4+
LL | type Type1<B>: Trait1<A=B>;
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
6+
|
7+
= note: for more information, see https://github.com/rust-lang/rust/issues/44265
8+
= help: add `#![feature(generic_associated_types)]` to the crate attributes to enable
9+
10+
error: type-generic associated types are not yet implemented
11+
--> $DIR/issue-67424.rs:8:5
12+
|
13+
LL | type Type1<B>: Trait1<A=B>;
14+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
15+
|
16+
= note: for more information, see https://github.com/rust-lang/rust/issues/44265
17+
18+
error: aborting due to 2 previous errors
19+
20+
For more information about this error, try `rustc --explain E0658`.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// Regression test for #66270, fixed by #66246
2+
3+
struct Bug {
4+
incorrect_field: 0,
5+
//~^ ERROR expected type
6+
}
7+
8+
struct Empty {}
9+
10+
fn main() {
11+
let Bug {
12+
any_field: Empty {},
13+
} = Bug {};
14+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
error: expected type, found `0`
2+
--> $DIR/issue-66270-pat-struct-parser-recovery.rs:4:22
3+
|
4+
LL | incorrect_field: 0,
5+
| ^ expected type
6+
7+
error: aborting due to previous error
8+

0 commit comments

Comments
 (0)