diff options
| author | long-long-float <niinikazuki@yahoo.co.jp> | 2024-02-09 01:03:38 +0900 |
|---|---|---|
| committer | long-long-float <niinikazuki@yahoo.co.jp> | 2024-02-09 01:03:38 +0900 |
| commit | 4e7941c2c57441d2fe92a21c2951cab2926f5656 (patch) | |
| tree | 079d4b87a8f9475faa847006688ac135c0523548 /compiler/rustc_errors/src | |
| parent | 8cc50849500b2208a0c8faf39c31425267ecb941 (diff) | |
| download | rust-4e7941c2c57441d2fe92a21c2951cab2926f5656.tar.gz rust-4e7941c2c57441d2fe92a21c2951cab2926f5656.zip | |
Check with overlaps_or_adjacent
Diffstat (limited to 'compiler/rustc_errors/src')
| -rw-r--r-- | compiler/rustc_errors/src/diagnostic.rs | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/compiler/rustc_errors/src/diagnostic.rs b/compiler/rustc_errors/src/diagnostic.rs index b37aa4cf7c0..026b0222665 100644 --- a/compiler/rustc_errors/src/diagnostic.rs +++ b/compiler/rustc_errors/src/diagnostic.rs @@ -519,10 +519,13 @@ impl Diagnostic { /// Helper for pushing to `self.suggestions`, if available (not disable). fn push_suggestion(&mut self, suggestion: CodeSuggestion) { - let in_derive = suggestion - .substitutions - .iter() - .any(|subst| subst.parts.iter().any(|part| part.span.in_derive_expansion())); + let in_derive = suggestion.substitutions.iter().any(|subst| { + subst.parts.iter().any(|part| { + let span = part.span; + let call_site = span.ctxt().outer_expn_data().call_site; + span.in_derive_expansion() && span.overlaps_or_adjacent(call_site) + }) + }); if in_derive { // Ignore if spans is from derive macro. return; |
