Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add regression tests for fixed ICEs #67543

Merged
merged 6 commits into from
Dec 24, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/librustc/traits/error_reporting.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2289,7 +2289,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
let span = self.tcx.def_span(generator_did);

// Do not ICE on closure typeck (#66868).
if let None = self.tcx.hir().as_local_hir_id(generator_did) {
if self.tcx.hir().as_local_hir_id(generator_did).is_none() {
return false;
}

Expand Down
16 changes: 16 additions & 0 deletions src/test/ui/const-generics/issues/issue-61747.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// check-pass

#![feature(const_generics)]
//~^ WARN the feature `const_generics` is incomplete and may cause the compiler to crash

struct Const<const N: usize>;

impl<const C: usize> Const<{C}> {
fn successor() -> Const<{C + 1}> {
Const
}
}

fn main() {
let _x: Const::<2> = Const::<1>::successor();
}
8 changes: 8 additions & 0 deletions src/test/ui/const-generics/issues/issue-61747.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
warning: the feature `const_generics` is incomplete and may cause the compiler to crash
--> $DIR/issue-61747.rs:3:12
|
LL | #![feature(const_generics)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default

10 changes: 10 additions & 0 deletions src/test/ui/const-generics/issues/issue-66205.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// check-pass

#![allow(incomplete_features, dead_code, unconditional_recursion)]
#![feature(const_generics)]

fn fact<const N: usize>() {
fact::<{ N - 1 }>();
}

fn main() {}
13 changes: 13 additions & 0 deletions src/test/ui/generic-associated-types/issue-67424.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// Fixed by #67160

trait Trait1 {
type A;
}

trait Trait2 {
type Type1<B>: Trait1<A=B>;
//~^ ERROR: generic associated types are unstable
//~| ERROR: type-generic associated types are not yet implemented
}

fn main() {}
20 changes: 20 additions & 0 deletions src/test/ui/generic-associated-types/issue-67424.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
error[E0658]: generic associated types are unstable
--> $DIR/issue-67424.rs:8:5
|
LL | type Type1<B>: Trait1<A=B>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: for more information, see https://github.com/rust-lang/rust/issues/44265
= help: add `#![feature(generic_associated_types)]` to the crate attributes to enable

error: type-generic associated types are not yet implemented
--> $DIR/issue-67424.rs:8:5
|
LL | type Type1<B>: Trait1<A=B>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: for more information, see https://github.com/rust-lang/rust/issues/44265

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0658`.
14 changes: 14 additions & 0 deletions src/test/ui/pattern/issue-66270-pat-struct-parser-recovery.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Regression test for #66270, fixed by #66246

struct Bug {
incorrect_field: 0,
//~^ ERROR expected type
}

struct Empty {}

fn main() {
let Bug {
any_field: Empty {},
} = Bug {};
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
error: expected type, found `0`
--> $DIR/issue-66270-pat-struct-parser-recovery.rs:4:22
|
LL | incorrect_field: 0,
| ^ expected type

error: aborting due to previous error