diff options
| author | Esteban Kuber <esteban@kuber.com.ar> | 2021-11-20 18:46:36 +0000 |
|---|---|---|
| committer | Esteban Kuber <esteban@kuber.com.ar> | 2021-12-03 18:41:40 +0000 |
| commit | 962b2197a5d5796ee030a05f534ee0fde8ce07bb (patch) | |
| tree | b9cec8cf9bceb90e7ad55c5f669eee43a29da822 /compiler/rustc_resolve/src/late | |
| parent | 8bee2b88c075a2f007a7d5762727a840477c0893 (diff) | |
| download | rust-962b2197a5d5796ee030a05f534ee0fde8ce07bb.tar.gz rust-962b2197a5d5796ee030a05f534ee0fde8ce07bb.zip | |
Annotate `derive`d spans and move span suggestion code
* Annotate `derive`d spans from the user's code with the appropciate context * Add `Span::can_be_used_for_suggestion` to query if the underlying span at the users' code
Diffstat (limited to 'compiler/rustc_resolve/src/late')
| -rw-r--r-- | compiler/rustc_resolve/src/late/diagnostics.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler/rustc_resolve/src/late/diagnostics.rs b/compiler/rustc_resolve/src/late/diagnostics.rs index 4e071d69e36..72ba3f7b980 100644 --- a/compiler/rustc_resolve/src/late/diagnostics.rs +++ b/compiler/rustc_resolve/src/late/diagnostics.rs @@ -1735,7 +1735,7 @@ impl<'a: 'ast, 'ast> LateResolutionVisitor<'a, '_, 'ast> { (generics.span, format!("<{}>", ident)) }; // Do not suggest if this is coming from macro expansion. - if !span.from_expansion() { + if span.can_be_used_for_suggestions() { return Some(( span.shrink_to_hi(), msg, @@ -1825,7 +1825,7 @@ impl<'tcx> LifetimeContext<'_, 'tcx> { continue; } suggested_spans.push(span); - if !span.from_expansion() { + if span.can_be_used_for_suggestions() { err.span_suggestion( span, &format!("consider introducing lifetime `{}` here", lifetime_ref), |
