about summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authorAndy Russell <arussell123@gmail.com>2019-01-04 10:19:52 -0500
committerAndy Russell <arussell123@gmail.com>2019-01-08 13:24:38 -0500
commit7c0d145ec1603fd7d4de2ef38a70baeffbedaad2 (patch)
tree00d0ad68dd743ac633d76021057103eba75ffcdb /src/libsyntax
parent3dfe36d09436317e035ee3caa19c7e1d260053e1 (diff)
downloadrust-7c0d145ec1603fd7d4de2ef38a70baeffbedaad2.tar.gz
rust-7c0d145ec1603fd7d4de2ef38a70baeffbedaad2.zip
improve non_snake_case diagnostics
Use a structured suggestion and tighten the span to just the identifier.
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/diagnostics/plugin.rs12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/libsyntax/diagnostics/plugin.rs b/src/libsyntax/diagnostics/plugin.rs
index 71028ef9fc6..fa6b825f2a2 100644
--- a/src/libsyntax/diagnostics/plugin.rs
+++ b/src/libsyntax/diagnostics/plugin.rs
@@ -117,16 +117,18 @@ pub fn expand_register_diagnostic<'cx>(ecx: &'cx mut ExtCtxt,
             ));
         }
     });
-    let sym = Ident::with_empty_ctxt(Symbol::gensym(&format!(
-        "__register_diagnostic_{}", code
-    )));
+
+    let span = span.apply_mark(ecx.current_expansion.mark);
+
+    let sym = Ident::new(Symbol::gensym(&format!("__register_diagnostic_{}", code)), span);
+
     MacEager::items(smallvec![
         ecx.item_mod(
             span,
             span,
             sym,
-            Vec::new(),
-            Vec::new()
+            vec![],
+            vec![],
         )
     ])
 }