From 7ceaba21dff56ea46f2327895f34a00dc558464d Mon Sep 17 00:00:00 2001 From: Jonas Schievink Date: Fri, 2 Apr 2021 19:00:26 +0200 Subject: Only populate prelude for crate-level DefMaps --- crates/ide/src/hover.rs | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) (limited to 'crates/ide/src') diff --git a/crates/ide/src/hover.rs b/crates/ide/src/hover.rs index 28e2e17dc..614433417 100644 --- a/crates/ide/src/hover.rs +++ b/crates/ide/src/hover.rs @@ -3897,4 +3897,46 @@ trait A where "#]], ); } + + #[test] + fn string_shadowed_with_inner_items() { + check( + r#" +//- /main.rs crate:main deps:alloc + +/// Custom `String` type. +struct String; + +fn f() { + let _: String$0; + + fn inner() {} +} + +//- /alloc.rs crate:alloc +#[prelude_import] +pub use string::*; + +mod string { + /// This is `alloc::String`. + pub struct String; +} + "#, + expect![[r#" + *String* + + ```rust + main + ``` + + ```rust + struct String + ``` + + --- + + Custom `String` type. + "#]], + ) + } } -- cgit v1.2.3