Fix macro_use_import ICE

This commit is contained in:
Jason Newcomb
2021-04-02 22:24:52 -04:00
parent 86fb0e8266
commit c05760ff90
3 changed files with 11 additions and 2 deletions
+1
View File
@@ -114,6 +114,7 @@ fn check_item(&mut self, cx: &LateContext<'_>, item: &hir::Item<'_>) {
.iter()
.find(|attr| attr.ident().map(|s| s.to_string()) == Some("macro_use".to_string()));
if let Res::Def(DefKind::Mod, id) = path.res;
if !id.is_local();
then {
for kid in cx.tcx.item_children(id).iter() {
if let Res::Def(DefKind::Macro(_mac_type), mac_id) = kid.res {
+5 -1
View File
@@ -4,7 +4,7 @@
// run-rustfix
// ignore-32bit
#![allow(unused_imports, unreachable_code, unused_variables, dead_code)]
#![allow(unused_imports, unreachable_code, unused_variables, dead_code, unused_attributes)]
#![allow(clippy::single_component_path_imports)]
#![warn(clippy::macro_use_imports)]
@@ -40,4 +40,8 @@ mod a {
}
}
// issue #7015, ICE due to calling `item_children` with local `DefId`
#[macro_use]
use a as b;
fn main() {}
+5 -1
View File
@@ -4,7 +4,7 @@
// run-rustfix
// ignore-32bit
#![allow(unused_imports, unreachable_code, unused_variables, dead_code)]
#![allow(unused_imports, unreachable_code, unused_variables, dead_code, unused_attributes)]
#![allow(clippy::single_component_path_imports)]
#![warn(clippy::macro_use_imports)]
@@ -40,4 +40,8 @@ fn test() {
}
}
// issue #7015, ICE due to calling `item_children` with local `DefId`
#[macro_use]
use a as b;
fn main() {}