mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-11-13 09:11:51 +00:00
fix: unescape inline module names in module resolution
This commit is contained in:
parent
643bc02ded
commit
21ea0048cd
2 changed files with 38 additions and 1 deletions
|
|
@ -34,7 +34,7 @@ impl ModDir {
|
||||||
let path = match attr_path.map(SmolStr::as_str) {
|
let path = match attr_path.map(SmolStr::as_str) {
|
||||||
None => {
|
None => {
|
||||||
let mut path = self.dir_path.clone();
|
let mut path = self.dir_path.clone();
|
||||||
path.push(&name.to_smol_str());
|
path.push(&name.unescaped().to_smol_str());
|
||||||
path
|
path
|
||||||
}
|
}
|
||||||
Some(attr_path) => {
|
Some(attr_path) => {
|
||||||
|
|
|
||||||
|
|
@ -156,6 +156,43 @@ pub struct Baz;
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn module_resolution_works_for_inline_raw_modules() {
|
||||||
|
check(
|
||||||
|
r#"
|
||||||
|
//- /lib.rs
|
||||||
|
mod r#async {
|
||||||
|
pub mod a;
|
||||||
|
pub mod r#async;
|
||||||
|
}
|
||||||
|
use self::r#async::a::Foo;
|
||||||
|
use self::r#async::r#async::Bar;
|
||||||
|
|
||||||
|
//- /async/a.rs
|
||||||
|
pub struct Foo;
|
||||||
|
|
||||||
|
//- /async/async.rs
|
||||||
|
pub struct Bar;
|
||||||
|
"#,
|
||||||
|
expect![[r#"
|
||||||
|
crate
|
||||||
|
Bar: t v
|
||||||
|
Foo: t v
|
||||||
|
r#async: t
|
||||||
|
|
||||||
|
crate::r#async
|
||||||
|
a: t
|
||||||
|
r#async: t
|
||||||
|
|
||||||
|
crate::r#async::a
|
||||||
|
Foo: t v
|
||||||
|
|
||||||
|
crate::r#async::r#async
|
||||||
|
Bar: t v
|
||||||
|
"#]],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn module_resolution_decl_path() {
|
fn module_resolution_decl_path() {
|
||||||
check(
|
check(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue