Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't ICE when computing a layout of a generator tainted by errors
- Loading branch information
Showing
6 changed files
with
50 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// Verifies that computing a layout of a generator tainted by type errors | ||
// doesn't ICE. Regression test for #80998. | ||
// | ||
// edition:2018 | ||
|
||
#![feature(type_alias_impl_trait)] | ||
use std::future::Future; | ||
|
||
pub struct Task<F: Future>(F); | ||
impl<F: Future> Task<F> { | ||
fn new() -> Self { | ||
todo!() | ||
} | ||
fn spawn(&self, _: impl FnOnce() -> F) { | ||
todo!() | ||
} | ||
} | ||
|
||
fn main() { | ||
async fn cb() { | ||
let a = Foo; //~ ERROR cannot find value `Foo` in this scope | ||
} | ||
|
||
type F = impl Future; | ||
// Check that statics are inhabited computes they layout. | ||
static POOL: Task<F> = Task::new(); | ||
Task::spawn(&POOL, || cb()); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
error[E0425]: cannot find value `Foo` in this scope | ||
--> $DIR/layout-error.rs:21:17 | ||
| | ||
LL | let a = Foo; | ||
| ^^^ not found in this scope | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0425`. |