aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_def/src/nameres/tests/macros.rs
diff options
context:
space:
mode:
authorJonas Schievink <[email protected]>2021-06-01 12:39:19 +0100
committerJonas Schievink <[email protected]>2021-06-01 12:39:19 +0100
commitf96c1a0414ee302fe96503d89f2998483345c8a9 (patch)
tree6de19b3c128809cd56641f70873c35f17974aced /crates/hir_def/src/nameres/tests/macros.rs
parent71117e6812f87e014bc8e984e195a75e222ac227 (diff)
Implement per-edition preludes
Diffstat (limited to 'crates/hir_def/src/nameres/tests/macros.rs')
-rw-r--r--crates/hir_def/src/nameres/tests/macros.rs32
1 files changed, 15 insertions, 17 deletions
diff --git a/crates/hir_def/src/nameres/tests/macros.rs b/crates/hir_def/src/nameres/tests/macros.rs
index 3065efd65..371618438 100644
--- a/crates/hir_def/src/nameres/tests/macros.rs
+++ b/crates/hir_def/src/nameres/tests/macros.rs
@@ -264,7 +264,7 @@ fn prelude_is_macro_use() {
264 cov_mark::check!(prelude_is_macro_use); 264 cov_mark::check!(prelude_is_macro_use);
265 check( 265 check(
266 r#" 266 r#"
267//- /main.rs crate:main deps:foo 267//- /main.rs crate:main deps:std
268structs!(Foo); 268structs!(Foo);
269structs_priv!(Bar); 269structs_priv!(Bar);
270structs_outside!(Out); 270structs_outside!(Out);
@@ -276,21 +276,20 @@ mod bar;
276structs!(Baz); 276structs!(Baz);
277crate::structs!(MacroNotResolved3); 277crate::structs!(MacroNotResolved3);
278 278
279//- /lib.rs crate:foo 279//- /lib.rs crate:std
280#[prelude_import] 280pub mod prelude {
281use self::prelude::*; 281 pub mod rust_2018 {
282
283mod prelude {
284 #[macro_export]
285 macro_rules! structs {
286 ($i:ident) => { struct $i; }
287 }
288
289 mod priv_mod {
290 #[macro_export] 282 #[macro_export]
291 macro_rules! structs_priv { 283 macro_rules! structs {
292 ($i:ident) => { struct $i; } 284 ($i:ident) => { struct $i; }
293 } 285 }
286
287 mod priv_mod {
288 #[macro_export]
289 macro_rules! structs_priv {
290 ($i:ident) => { struct $i; }
291 }
292 }
294 } 293 }
295} 294}
296 295
@@ -617,12 +616,11 @@ fn macro_dollar_crate_is_correct_in_indirect_deps() {
617foo!(); 616foo!();
618 617
619//- /std.rs crate:std deps:core 618//- /std.rs crate:std deps:core
620#[prelude_import]
621use self::prelude::*;
622
623pub use core::foo; 619pub use core::foo;
624 620
625mod prelude {} 621pub mod prelude {
622 pub mod rust_2018 {}
623}
626 624
627#[macro_use] 625#[macro_use]
628mod std_macros; 626mod std_macros;