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:
Chayim Refael Friedman 2025-01-07 08:00:18 +02:00
parent 3f2bbe9fed
commit 97afb7bfba
34 changed files with 480 additions and 316 deletions

View file

@ -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!();
}
"#,
);
}
}