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

Do not ICE when encountering yield inside async block #69175

Merged
merged 1 commit into from
Feb 18, 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
4 changes: 2 additions & 2 deletions src/librustc/hir/map/hir_id_validator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use rustc_hir::intravisit;
use rustc_hir::itemlikevisit::ItemLikeVisitor;
use rustc_hir::{HirId, ItemLocalId};

pub fn check_crate(hir_map: &Map<'_>) {
pub fn check_crate(hir_map: &Map<'_>, sess: &rustc_session::Session) {
hir_map.dep_graph.assert_ignored();

let errors = Lock::new(Vec::new());
Expand All @@ -24,7 +24,7 @@ pub fn check_crate(hir_map: &Map<'_>) {

if !errors.is_empty() {
let message = errors.iter().fold(String::new(), |s1, s2| s1 + "\n" + s2);
bug!("{}", message);
sess.delay_span_bug(rustc_span::DUMMY_SP, &message);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/librustc/hir/map/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1235,7 +1235,7 @@ pub fn map_crate<'hir>(
let map = Map { krate, dep_graph, crate_hash, map, hir_to_node_id, definitions };

sess.time("validate_HIR_map", || {
hir_id_validator::check_crate(&map);
hir_id_validator::check_crate(&map, sess);
});

map
Expand Down
6 changes: 6 additions & 0 deletions src/test/ui/generator/async-generator-issue-67158.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#![feature(generators)]
// edition:2018
// Regression test for #67158.
fn main() {
async { yield print!(":C") }; //~ ERROR `async` generators are not yet supported
}
9 changes: 9 additions & 0 deletions src/test/ui/generator/async-generator-issue-67158.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
error[E0727]: `async` generators are not yet supported
--> $DIR/async-generator-issue-67158.rs:5:13
|
LL | async { yield print!(":C") };
| ^^^^^^^^^^^^^^^^^^

error: aborting due to previous error

For more information about this error, try `rustc --explain E0727`.