Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-def/src/macro_expansion_tests/mbe.rs')
-rw-r--r--crates/hir-def/src/macro_expansion_tests/mbe.rs56
1 files changed, 56 insertions, 0 deletions
diff --git a/crates/hir-def/src/macro_expansion_tests/mbe.rs b/crates/hir-def/src/macro_expansion_tests/mbe.rs
index 4058159cef..64b37d2d06 100644
--- a/crates/hir-def/src/macro_expansion_tests/mbe.rs
+++ b/crates/hir-def/src/macro_expansion_tests/mbe.rs
@@ -1921,3 +1921,59 @@ fn f() {
"#]],
);
}
+
+#[test]
+fn test_edition_handling_out() {
+ check(
+ r#"
+//- /main.rs crate:main deps:old edition:2021
+macro_rules! r#try {
+ ($it:expr) => {
+ $it?
+ };
+}
+fn f() {
+ old::invoke_bare_try!(0);
+}
+//- /old.rs crate:old edition:2015
+#[macro_export]
+macro_rules! invoke_bare_try {
+ ($it:expr) => {
+ try!($it)
+ };
+}
+ "#,
+ expect![[r#"
+macro_rules! r#try {
+ ($it:expr) => {
+ $it?
+ };
+}
+fn f() {
+ try!(0);
+}
+"#]],
+ );
+}
+
+#[test]
+fn test_edition_handling_in() {
+ check(
+ r#"
+//- /main.rs crate:main deps:old edition:2021
+fn f() {
+ old::parse_try_old!(try!{});
+}
+//- /old.rs crate:old edition:2015
+#[macro_export]
+macro_rules! parse_try_old {
+ ($it:expr) => {};
+}
+ "#,
+ expect![[r#"
+fn f() {
+ ;
+}
+"#]],
+ );
+}