1
Fork 0

Add an optional Span to BrAnon and use it to print better error for HRTB error from generator interior

This commit is contained in:
Jack Huey 2022-10-17 22:08:15 -04:00
parent 1e1e5b8d98
commit 00e314d5ed
23 changed files with 251 additions and 63 deletions

View file

@ -89,10 +89,13 @@ impl<'a> DescriptionCtx<'a> {
};
me.span = Some(sp);
}
ty::BrAnon(idx) => {
ty::BrAnon(idx, span) => {
me.kind = "anon_num_here";
me.num_arg = idx+1;
me.span = Some(tcx.def_span(scope));
me.span = match span {
Some(_) => span,
None => Some(tcx.def_span(scope)),
}
},
_ => {
me.kind = "defined_here_reg";