diff options
author | Jonas Schievink <[email protected]> | 2021-06-01 12:39:19 +0100 |
---|---|---|
committer | Jonas Schievink <[email protected]> | 2021-06-01 12:39:19 +0100 |
commit | f96c1a0414ee302fe96503d89f2998483345c8a9 (patch) | |
tree | 6de19b3c128809cd56641f70873c35f17974aced /crates/hir_def/src/nameres/tests/macros.rs | |
parent | 71117e6812f87e014bc8e984e195a75e222ac227 (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.rs | 32 |
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 |
268 | structs!(Foo); | 268 | structs!(Foo); |
269 | structs_priv!(Bar); | 269 | structs_priv!(Bar); |
270 | structs_outside!(Out); | 270 | structs_outside!(Out); |
@@ -276,21 +276,20 @@ mod bar; | |||
276 | structs!(Baz); | 276 | structs!(Baz); |
277 | crate::structs!(MacroNotResolved3); | 277 | crate::structs!(MacroNotResolved3); |
278 | 278 | ||
279 | //- /lib.rs crate:foo | 279 | //- /lib.rs crate:std |
280 | #[prelude_import] | 280 | pub mod prelude { |
281 | use self::prelude::*; | 281 | pub mod rust_2018 { |
282 | |||
283 | mod 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() { | |||
617 | foo!(); | 616 | foo!(); |
618 | 617 | ||
619 | //- /std.rs crate:std deps:core | 618 | //- /std.rs crate:std deps:core |
620 | #[prelude_import] | ||
621 | use self::prelude::*; | ||
622 | |||
623 | pub use core::foo; | 619 | pub use core::foo; |
624 | 620 | ||
625 | mod prelude {} | 621 | pub mod prelude { |
622 | pub mod rust_2018 {} | ||
623 | } | ||
626 | 624 | ||
627 | #[macro_use] | 625 | #[macro_use] |
628 | mod std_macros; | 626 | mod std_macros; |