about summary refs log tree commit diff
path: root/src/libsyntax/diagnostics/plugin.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2019-01-14 06:35:51 +0000
committerbors <bors@rust-lang.org>2019-01-14 06:35:51 +0000
commit1d029c67e22b272ecc7a32044710600bfa3578e5 (patch)
treed3f7419b858bce0bff4919cb06d3c946d5c118b2 /src/libsyntax/diagnostics/plugin.rs
parent0bc0015f20d95a676359273259a6c07a85edf4b0 (diff)
parent1b28f5aa668504fd84ce4ab7298f20696b9ffb5a (diff)
downloadrust-1d029c67e22b272ecc7a32044710600bfa3578e5.tar.gz
rust-1d029c67e22b272ecc7a32044710600bfa3578e5.zip
Auto merge of #57387 - euclio:nonstandard-style-suggestions, r=oli-obk
Use structured suggestions for nonstandard style lints

This PR modifies the lints in the nonstandard_style group to use structured suggestions. Note that there's a bit of tricky span calculation going on for the `crate_name` attribute. It also simplifies the code a bit: I don't think the "fallback" suggestions for these lints can actually be triggered.

Fixes #48103.
Fixes #52414.
Diffstat (limited to 'src/libsyntax/diagnostics/plugin.rs')
-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![],
         )
     ])
 }