diff options
| author | long-long-float <niinikazuki@yahoo.co.jp> | 2024-01-25 00:12:50 +0900 |
|---|---|---|
| committer | long-long-float <niinikazuki@yahoo.co.jp> | 2024-02-06 00:32:19 +0900 |
| commit | 4909258ae885a3762b6202f9f57a54d756b927ec (patch) | |
| tree | 0fd524e3e9bd3b430e9034abad7882ba66828b67 /compiler/rustc_errors | |
| parent | 87ea0d76fe1ae997a11fbc914daf33644d5c65bf (diff) | |
| download | rust-4909258ae885a3762b6202f9f57a54d756b927ec.tar.gz rust-4909258ae885a3762b6202f9f57a54d756b927ec.zip | |
Check in push_suggestion
Diffstat (limited to 'compiler/rustc_errors')
| -rw-r--r-- | compiler/rustc_errors/src/diagnostic.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/compiler/rustc_errors/src/diagnostic.rs b/compiler/rustc_errors/src/diagnostic.rs index 8ad4925cff2..b37aa4cf7c0 100644 --- a/compiler/rustc_errors/src/diagnostic.rs +++ b/compiler/rustc_errors/src/diagnostic.rs @@ -519,6 +519,15 @@ 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())); + if in_derive { + // Ignore if spans is from derive macro. + return; + } + if let Ok(suggestions) = &mut self.suggestions { suggestions.push(suggestion); } |
