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](427cf81206/compiler/rustc_builtin_macros/src/edition_panic.rs (L84)).

Co-authored-by: Chayim Refael Friedman <chayimfr@gmail.com>
This commit is contained in:
bors[bot] 2022-02-28 09:18:26 +00:00 committed by GitHub
commit 415be8bae5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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!)