mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-13 05:38:46 +00:00
Merge #8858
8858: Ignore macro import from `extern crate self` r=jonas-schievink a=ivan770 Closes #8834 Co-authored-by: ivan770 <leshenko.ivan770@gmail.com>
This commit is contained in:
commit
6aac6bcc74
2 changed files with 21 additions and 0 deletions
|
@ -481,6 +481,11 @@ impl DefCollector<'_> {
|
||||||
let res = self.def_map.resolve_name_in_extern_prelude(self.db, &extern_crate.name);
|
let res = self.def_map.resolve_name_in_extern_prelude(self.db, &extern_crate.name);
|
||||||
|
|
||||||
if let Some(ModuleDefId::ModuleId(m)) = res.take_types() {
|
if let Some(ModuleDefId::ModuleId(m)) = res.take_types() {
|
||||||
|
if m == self.def_map.module_id(current_module_id) {
|
||||||
|
cov_mark::hit!(ignore_macro_use_extern_crate_self);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
cov_mark::hit!(macro_rules_from_other_crates_are_visible_with_macro_use);
|
cov_mark::hit!(macro_rules_from_other_crates_are_visible_with_macro_use);
|
||||||
self.import_all_macros_exported(current_module_id, m.krate);
|
self.import_all_macros_exported(current_module_id, m.krate);
|
||||||
}
|
}
|
||||||
|
|
|
@ -410,6 +410,22 @@ struct Arc;
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn macro_use_extern_crate_self() {
|
||||||
|
cov_mark::check!(ignore_macro_use_extern_crate_self);
|
||||||
|
check(
|
||||||
|
r#"
|
||||||
|
//- /main.rs crate:main
|
||||||
|
#[macro_use]
|
||||||
|
extern crate self as bla;
|
||||||
|
"#,
|
||||||
|
expect![[r#"
|
||||||
|
crate
|
||||||
|
bla: t
|
||||||
|
"#]],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn reexport_across_crates() {
|
fn reexport_across_crates() {
|
||||||
check(
|
check(
|
||||||
|
|
Loading…
Reference in a new issue