mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-11-02 21:04:18 +00:00
Make edition per-token, not per-file
More correctly, *also* per-token. Because as it turns out, while the top-level edition affects parsing (I think), the per-token edition affects escaping of identifiers/keywords.
This commit is contained in:
parent
3f2bbe9fed
commit
97afb7bfba
34 changed files with 480 additions and 316 deletions
|
|
@ -399,4 +399,38 @@ fn f(s@m::Struct {
|
|||
"#,
|
||||
)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn editions_between_macros() {
|
||||
check_diagnostics(
|
||||
r#"
|
||||
//- /edition2015.rs crate:edition2015 edition:2015
|
||||
#[macro_export]
|
||||
macro_rules! pass_expr_thorough {
|
||||
($e:expr) => { $e };
|
||||
}
|
||||
|
||||
//- /edition2018.rs crate:edition2018 deps:edition2015 edition:2018
|
||||
async fn bar() {}
|
||||
async fn foo() {
|
||||
edition2015::pass_expr_thorough!(bar().await);
|
||||
}
|
||||
"#,
|
||||
);
|
||||
check_diagnostics(
|
||||
r#"
|
||||
//- /edition2018.rs crate:edition2018 edition:2018
|
||||
pub async fn bar() {}
|
||||
#[macro_export]
|
||||
macro_rules! make_await {
|
||||
() => { async { $crate::bar().await }; };
|
||||
}
|
||||
|
||||
//- /edition2015.rs crate:edition2015 deps:edition2018 edition:2015
|
||||
fn foo() {
|
||||
edition2018::make_await!();
|
||||
}
|
||||
"#,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue