From f96c1a0414ee302fe96503d89f2998483345c8a9 Mon Sep 17 00:00:00 2001 From: Jonas Schievink Date: Tue, 1 Jun 2021 13:39:19 +0200 Subject: Implement per-edition preludes --- crates/hir_def/src/find_path.rs | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) (limited to 'crates/hir_def/src/find_path.rs') diff --git a/crates/hir_def/src/find_path.rs b/crates/hir_def/src/find_path.rs index ee52794aa..219ed4c07 100644 --- a/crates/hir_def/src/find_path.rs +++ b/crates/hir_def/src/find_path.rs @@ -682,9 +682,11 @@ pub struct S; //- /main.rs crate:main deps:std $0 //- /std.rs crate:std -pub mod prelude { pub struct S; } -#[prelude_import] -pub use prelude::*; +pub mod prelude { + pub mod rust_2018 { + pub struct S; + } +} "#, "S", "S", @@ -700,11 +702,11 @@ pub use prelude::*; $0 //- /std.rs crate:std pub mod prelude { - pub enum Option { Some(T), None } - pub use Option::*; + pub mod rust_2018 { + pub enum Option { Some(T), None } + pub use Option::*; + } } -#[prelude_import] -pub use prelude::*; "#; check_found_path(code, "None", "None", "None", "None"); check_found_path(code, "Some", "Some", "Some", "Some"); @@ -1080,11 +1082,11 @@ fn f() { } //- /std.rs crate:std pub mod prelude { - pub enum Option { None } - pub use Option::*; + pub mod rust_2018 { + pub enum Option { None } + pub use Option::*; + } } -#[prelude_import] -pub use prelude::*; "#, "None", "None", -- cgit v1.2.3