Skip to content

Commit a3c91ce

Browse files
Fix wrong suggestion for async gen block
1 parent 40dacd5 commit a3c91ce

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3376,9 +3376,12 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
33763376

33773377
let (sugg_span, suggestion) = match tcx.sess.source_map().span_to_snippet(args_span) {
33783378
Ok(string) => {
3379-
let coro_prefix = if string.starts_with("async") {
3380-
// `async` is 5 chars long. Not using `.len()` to avoid the cast from `usize`
3381-
// to `u32`.
3379+
let coro_prefix = if string.starts_with("async gen") {
3380+
// `async gen` is 5 chars long. Not using `.len()` to avoid the cast from
3381+
// `usize` to `u32`.
3382+
Some(9)
3383+
} else if string.starts_with("async") {
3384+
// `async` is 5 chars long.
33823385
Some(5)
33833386
} else if string.starts_with("gen") {
33843387
// `gen` is 3 chars long

0 commit comments

Comments
 (0)