about summary refs log tree commit diff
path: root/compiler/rustc_errors/src
diff options
context:
space:
mode:
authorRalf Jung <post@ralfj.de>2024-02-12 13:16:10 +0100
committerRalf Jung <post@ralfj.de>2024-02-12 13:16:10 +0100
commitc41d5b12b85b375b211bdcc1c265957fa0123cf2 (patch)
tree2350b52d823234323653794c979e3711420b29aa /compiler/rustc_errors/src
parentca7a4b55d7b0b3c59fdd6e4e148b7d98201be864 (diff)
parentfffcb4c8771ad1a688bf9083d948769664d5fcb0 (diff)
downloadrust-c41d5b12b85b375b211bdcc1c265957fa0123cf2.tar.gz
rust-c41d5b12b85b375b211bdcc1c265957fa0123cf2.zip
Merge from rustc
Diffstat (limited to 'compiler/rustc_errors/src')
-rw-r--r--compiler/rustc_errors/src/diagnostic.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/compiler/rustc_errors/src/diagnostic.rs b/compiler/rustc_errors/src/diagnostic.rs
index 03717a4d654..2deb18484ec 100644
--- a/compiler/rustc_errors/src/diagnostic.rs
+++ b/compiler/rustc_errors/src/diagnostic.rs
@@ -516,6 +516,17 @@ impl Diagnostic {
 
     /// Helper for pushing to `self.suggestions`, if available (not disable).
     fn push_suggestion(&mut self, suggestion: CodeSuggestion) {
+        for subst in &suggestion.substitutions {
+            for part in &subst.parts {
+                let span = part.span;
+                let call_site = span.ctxt().outer_expn_data().call_site;
+                if span.in_derive_expansion() && span.overlaps_or_adjacent(call_site) {
+                    // Ignore if spans is from derive macro.
+                    return;
+                }
+            }
+        }
+
         if let Ok(suggestions) = &mut self.suggestions {
             suggestions.push(suggestion);
         }