File tree Expand file tree Collapse file tree 3 files changed +40
-0
lines changed Expand file tree Collapse file tree 3 files changed +40
-0
lines changed Original file line number Diff line number Diff line change @@ -73,6 +73,8 @@ impl<'tcx> LateLintPass<'tcx> for UnusedTraitNames {
73
73
&& let Some ( snip) = snippet_opt ( cx, last_segment. ident . span )
74
74
&& self . msrv . meets ( cx, msrvs:: UNDERSCORE_IMPORTS )
75
75
&& !is_from_proc_macro ( cx, & last_segment. ident )
76
+ // Skip if the ident of `as` is from a macro's input
77
+ && !( last_segment. ident . span . from_expansion ( ) && !ident. span . from_expansion ( ) )
76
78
{
77
79
let complete_span = last_segment. ident . span . to ( ident. span ) ;
78
80
span_lint_and_sugg (
Original file line number Diff line number Diff line change @@ -294,3 +294,22 @@ mod allow_lint_import {
294
294
// "foo".type_id();
295
295
// }
296
296
// }
297
+
298
+ mod issue14924 {
299
+ mod m {
300
+ pub trait Tr {
301
+ fn method(&self) {}
302
+ }
303
+
304
+ impl Tr for u8 {}
305
+ }
306
+
307
+ macro gen_import($Br: ident) {
308
+ use m::Tr as $Br;
309
+ }
310
+ gen_import!(Br);
311
+
312
+ fn do_something() {
313
+ 0u8.method();
314
+ }
315
+ }
Original file line number Diff line number Diff line change @@ -294,3 +294,22 @@ mod allow_lint_import {
294
294
// "foo".type_id();
295
295
// }
296
296
// }
297
+
298
+ mod issue14924 {
299
+ mod m {
300
+ pub trait Tr {
301
+ fn method ( & self ) { }
302
+ }
303
+
304
+ impl Tr for u8 { }
305
+ }
306
+
307
+ macro gen_import( $Br: ident) {
308
+ use m:: Tr as $Br;
309
+ }
310
+ gen_import ! ( Br ) ;
311
+
312
+ fn do_something ( ) {
313
+ 0u8 . method ( ) ;
314
+ }
315
+ }
You can’t perform that action at this time.
0 commit comments