internal: refactor BreakOutsideOfLoop diagnostic

This commit is contained in:
Aleksey Kladov 2021-06-13 19:51:19 +03:00
parent 7166e8549b
commit 886b66cd03
4 changed files with 36 additions and 32 deletions

View file

@ -1080,10 +1080,10 @@ impl Function {
acc.push(NoSuchField { field }.into())
}
hir_ty::InferenceDiagnostic::BreakOutsideOfLoop { expr } => {
let ptr = source_map
let expr = source_map
.expr_syntax(*expr)
.expect("break outside of loop in synthetic syntax");
sink.push(BreakOutsideOfLoop { file: ptr.file_id, expr: ptr.value })
acc.push(BreakOutsideOfLoop { expr }.into())
}
}
}