diff options
| author | Jack Huey <31162821+jackh726@users.noreply.github.com> | 2022-10-17 22:08:15 -0400 |
|---|---|---|
| committer | Jack Huey <31162821+jackh726@users.noreply.github.com> | 2022-11-07 17:39:29 -0500 |
| commit | 00e314d5edb735baef84c314c8c1a53587911887 (patch) | |
| tree | d49564c2d114cc498792937a80690e8511590560 /compiler/rustc_infer/src/errors | |
| parent | 1e1e5b8d98750a162335f64ec3c792ce80c9866c (diff) | |
| download | rust-00e314d5edb735baef84c314c8c1a53587911887.tar.gz rust-00e314d5edb735baef84c314c8c1a53587911887.zip | |
Add an optional Span to BrAnon and use it to print better error for HRTB error from generator interior
Diffstat (limited to 'compiler/rustc_infer/src/errors')
| -rw-r--r-- | compiler/rustc_infer/src/errors/note_and_explain.rs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/compiler/rustc_infer/src/errors/note_and_explain.rs b/compiler/rustc_infer/src/errors/note_and_explain.rs index 6a29d85627a..7aaa5ce2f42 100644 --- a/compiler/rustc_infer/src/errors/note_and_explain.rs +++ b/compiler/rustc_infer/src/errors/note_and_explain.rs @@ -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"; |
