mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-02 06:41:48 +00:00
Test macros doing edition dependent parsing
This commit is contained in:
parent
2c32ee7cfa
commit
546eb6b530
8 changed files with 92 additions and 62 deletions
|
@ -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() {
|
||||
;
|
||||
}
|
||||
"#]],
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue