Fix name resolution when an import is resolved to some namespace and then later in the algorithm another namespace is added

The import is flagged as "indeterminate", and previously it was re-resolved, but only at the end of name resolution, when it's already too late for anything that depends on it.

This issue was tried to fix in https://github.com/rust-lang/rust-analyzer/pull/2466, but it was not fixed fully.
This commit is contained in:
Chayim Refael Friedman 2024-09-22 03:27:30 +03:00
parent 6dad8c5528
commit 432b2559cd
3 changed files with 82 additions and 13 deletions

View file

@ -2750,4 +2750,36 @@ fn foo() {
"#,
);
}
#[test]
fn issue_18138() {
check(
r#"
mod foo {
macro_rules! x {
() => {
pub struct Foo;
// ^^^
};
}
pub(crate) use x as m;
}
mod bar {
use crate::m;
m!();
// ^^^^^
fn qux() {
Foo$0;
}
}
mod m {}
use foo::m;
"#,
);
}
}