diff options
| author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2022-02-28 09:18:26 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-02-28 09:18:26 +0000 |
| commit | 415be8bae52e98165e24809073d980a16e41a423 (patch) | |
| tree | be2544dddac7ba4a7007b265716ab8d97fd3ae0a | |
| parent | 4e72700e38421a12993fe5fa5c33d712652bc6c8 (diff) | |
| parent | e6a35c28cba7bb1c79285e96707dcb2050630a05 (diff) | |
| download | rust-415be8bae52e98165e24809073d980a16e41a423.tar.gz rust-415be8bae52e98165e24809073d980a16e41a423.zip | |
Merge #11579
11579: minor: Future-proof against a next edition by using `>=` and not `==` r=lnicola a=ChayimFriedman2 So that we won't have a strange bug when edition 2024 will land. rustc [also does that](https://github.com/rust-lang/rust/blob/427cf81206d3b6cf41c86c1b9ce113a33f1ce860/compiler/rustc_builtin_macros/src/edition_panic.rs#L84). Co-authored-by: Chayim Refael Friedman <chayimfr@gmail.com>
| -rw-r--r-- | crates/hir_expand/src/builtin_fn_macro.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/crates/hir_expand/src/builtin_fn_macro.rs b/crates/hir_expand/src/builtin_fn_macro.rs index 17f0caca7ac..da76b6b0804 100644 --- a/crates/hir_expand/src/builtin_fn_macro.rs +++ b/crates/hir_expand/src/builtin_fn_macro.rs @@ -344,7 +344,7 @@ fn panic_expand( let loc: MacroCallLoc = db.lookup_intern_macro_call(id); // Expand to a macro call `$crate::panic::panic_{edition}` let krate = tt::Ident { text: "$crate".into(), id: tt::TokenId::unspecified() }; - let mut call = if db.crate_graph()[loc.krate].edition == Edition::Edition2021 { + let mut call = if db.crate_graph()[loc.krate].edition >= Edition::Edition2021 { quote!(#krate::panic::panic_2021!) } else { quote!(#krate::panic::panic_2015!) @@ -363,7 +363,7 @@ fn unreachable_expand( let loc: MacroCallLoc = db.lookup_intern_macro_call(id); // Expand to a macro call `$crate::panic::unreachable_{edition}` let krate = tt::Ident { text: "$crate".into(), id: tt::TokenId::unspecified() }; - let mut call = if db.crate_graph()[loc.krate].edition == Edition::Edition2021 { + let mut call = if db.crate_graph()[loc.krate].edition >= Edition::Edition2021 { quote!(#krate::panic::unreachable_2021!) } else { quote!(#krate::panic::unreachable_2015!) |
