From 7c0d145ec1603fd7d4de2ef38a70baeffbedaad2 Mon Sep 17 00:00:00 2001 From: Andy Russell Date: Fri, 4 Jan 2019 10:19:52 -0500 Subject: improve non_snake_case diagnostics Use a structured suggestion and tighten the span to just the identifier. --- src/libsyntax/diagnostics/plugin.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/libsyntax/diagnostics') 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![], ) ]) } -- cgit 1.4.1-3-g733a5