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

Fix ICE on type error in async function #78739

Merged
merged 1 commit into from
Nov 5, 2020
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
1 change: 1 addition & 0 deletions compiler/rustc_typeck/src/check/closure.rs
Original file line number Diff line number Diff line change
Expand Up @@ -605,6 +605,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
let ret_ty = self.inh.infcx.shallow_resolve(ret_ty);
let ret_vid = match *ret_ty.kind() {
ty::Infer(ty::TyVar(ret_vid)) => ret_vid,
ty::Error(_) => return None,
_ => span_bug!(
self.tcx.def_span(expr_def_id),
"async fn generator return type not an inference variable"
Expand Down
19 changes: 19 additions & 0 deletions src/test/ui/async-await/issues/issue-78654.full.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
error[E0573]: expected type, found built-in attribute `feature`
--> $DIR/issue-78654.rs:10:15
|
LL | impl<const H: feature> Foo {
| ^^^^^^^ not a type

error[E0207]: the const parameter `H` is not constrained by the impl trait, self type, or predicates
--> $DIR/issue-78654.rs:10:12
|
LL | impl<const H: feature> Foo {
| ^ unconstrained const parameter
|
= note: expressions using a const parameter must map each value to a distinct output value
= note: proving the result of expressions other than the parameter are unique is not supported

error: aborting due to 2 previous errors

Some errors have detailed explanations: E0207, E0573.
For more information about an error, try `rustc --explain E0207`.
19 changes: 19 additions & 0 deletions src/test/ui/async-await/issues/issue-78654.min.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
error[E0573]: expected type, found built-in attribute `feature`
--> $DIR/issue-78654.rs:10:15
|
LL | impl<const H: feature> Foo {
| ^^^^^^^ not a type

error[E0207]: the const parameter `H` is not constrained by the impl trait, self type, or predicates
--> $DIR/issue-78654.rs:10:12
|
LL | impl<const H: feature> Foo {
| ^ unconstrained const parameter
|
= note: expressions using a const parameter must map each value to a distinct output value
= note: proving the result of expressions other than the parameter are unique is not supported

error: aborting due to 2 previous errors

Some errors have detailed explanations: E0207, E0573.
For more information about an error, try `rustc --explain E0207`.
16 changes: 16 additions & 0 deletions src/test/ui/async-await/issues/issue-78654.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// edition:2018
// revisions: full min

#![cfg_attr(full, feature(const_generics))]
#![cfg_attr(full, allow(incomplete_features))]
#![cfg_attr(min, feature(min_const_generics))]

struct Foo;

impl<const H: feature> Foo {
//~^ ERROR: expected type, found built-in attribute `feature`
//~^^ ERROR: the const parameter `H` is not constrained by the impl trait, self type, or predicates
async fn biz() {}
}

fn main() {}