Skip to content

Commit 5ba1dd7

Browse files
authored
Rollup merge of rust-lang#69175 - estebank:shall-not-ice, r=petrochenkov
Do not ICE when encountering `yield` inside `async` block Fix rust-lang#67158.
2 parents a70b757 + e5b2c66 commit 5ba1dd7

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
@@ -7,7 +7,7 @@ use rustc_hir::intravisit;
77
use rustc_hir::itemlikevisit::ItemLikeVisitor;
88
use rustc_hir::{HirId, ItemLocalId};
99

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

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

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

src/librustc/hir/map/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1235,7 +1235,7 @@ pub fn map_crate<'hir>(
12351235
let map = Map { krate, dep_graph, crate_hash, map, hir_to_node_id, definitions };
12361236

12371237
sess.time("validate_HIR_map", || {
1238-
hir_id_validator::check_crate(&map);
1238+
hir_id_validator::check_crate(&map, sess);
12391239
});
12401240

12411241
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)