From 69e0b10150a3a426e7796841156e788c3866b27c Mon Sep 17 00:00:00 2001 From: Lukas Wirth Date: Thu, 13 May 2021 02:17:41 +0200 Subject: Return absolute paths in find_path if crate start is ambiguous --- crates/ide_assists/src/handlers/auto_import.rs | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'crates/ide_assists/src/handlers') diff --git a/crates/ide_assists/src/handlers/auto_import.rs b/crates/ide_assists/src/handlers/auto_import.rs index a454a2af3..506cc292c 100644 --- a/crates/ide_assists/src/handlers/auto_import.rs +++ b/crates/ide_assists/src/handlers/auto_import.rs @@ -966,6 +966,32 @@ mod bar { println!("Hallo"); } } +"#, + ); + } + + #[test] + fn uses_abs_path_with_extern_crate_clash() { + check_assist( + auto_import, + r#" +//- /main.rs crate:main deps:foo +mod foo {} + +const _: () = { + Foo$0 +}; +//- /foo.rs crate:foo +pub struct Foo +"#, + r#" +use ::foo::Foo; + +mod foo {} + +const _: () = { + Foo +}; "#, ); } -- cgit v1.2.3