Skip to content

Commit a978a97

Browse files
estebankMark-Simulacrum
authored andcommitted
Do not ICE when encountering yield inside async block
1 parent aaa142a commit a978a97

File tree

4 files changed

+18
-3
lines changed

4 files changed

+18
-3
lines changed

src/librustc/hir/map/hir_id_validator.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use crate::hir::{self, intravisit, HirId, ItemLocalId};
44
use rustc_data_structures::fx::FxHashSet;
55
use rustc_data_structures::sync::{par_iter, Lock, ParallelIterator};
66

7-
pub fn check_crate(hir_map: &hir::map::Map<'_>) {
7+
pub fn check_crate(hir_map: &hir::map::Map<'_>, sess: &rustc_session::Session) {
88
hir_map.dep_graph.assert_ignored();
99

1010
let errors = Lock::new(Vec::new());
@@ -21,7 +21,7 @@ pub fn check_crate(hir_map: &hir::map::Map<'_>) {
2121

2222
if !errors.is_empty() {
2323
let message = errors.iter().fold(String::new(), |s1, s2| s1 + "\n" + s2);
24-
bug!("{}", message);
24+
sess.delay_span_bug(syntax_pos::DUMMY_SP, &message);
2525
}
2626
}
2727

src/librustc/hir/map/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1245,7 +1245,7 @@ pub fn map_crate<'hir>(
12451245
};
12461246

12471247
time(sess, "validate HIR map", || {
1248-
hir_id_validator::check_crate(&map);
1248+
hir_id_validator::check_crate(&map, sess);
12491249
});
12501250

12511251
map
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#![feature(generators)]
2+
// edition:2018
3+
// Regression test for #67158.
4+
fn main() {
5+
async { yield print!(":C") }; //~ ERROR `async` generators are not yet supported
6+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
error[E0727]: `async` generators are not yet supported
2+
--> $DIR/async-generator-issue-67158.rs:5:13
3+
|
4+
LL | async { yield print!(":C") };
5+
| ^^^^^^^^^^^^^^^^^^
6+
7+
error: aborting due to previous error
8+
9+
For more information about this error, try `rustc --explain E0727`.

0 commit comments

Comments
 (0)