Skip to content

Commit a505420

Browse files
committed
chore: Bump Edition::CURRENT to 2024
1 parent 23e8d13 commit a505420

File tree

24 files changed

+277
-244
lines changed

24 files changed

+277
-244
lines changed

bench_data/numerous_macro_rules

+1-1
Original file line numberDiff line numberDiff line change
@@ -528,7 +528,7 @@ macro_rules! __ra_macro_fixture526 {($expr : expr )=>{|| -> _ { Some ($expr )}(
528528
macro_rules! __ra_macro_fixture527 {($($arg : tt )*)=>($crate :: io :: _print ($crate :: format_args ! ($($arg )*))); }
529529
macro_rules! __ra_macro_fixture528 {($fmt : literal , $($tt : tt ),*)=>{ mbe :: ExpandError :: ProcMacroError ( tt :: ExpansionError :: Unknown ( format ! ($fmt , $($tt ),*)))}; ($fmt : literal )=>{ mbe :: ExpandError :: ProcMacroError ( tt :: ExpansionError :: Unknown ($fmt . to_string ()))}}
530530
macro_rules! __ra_macro_fixture529 {($($tt : tt )* )=>{$crate :: quote :: IntoTt :: to_subtree ($crate :: __quote ! ($($tt )*))}}
531-
macro_rules! __ra_macro_fixture530 {()=>{ Vec ::< tt :: TokenTree >:: new ()}; (@ SUBTREE $delim : ident $($tt : tt )* )=>{{ let children = $crate :: __quote ! ($($tt )*); tt :: Subtree { delimiter : Some ( tt :: Delimiter { kind : tt :: DelimiterKind ::$delim , id : tt :: TokenId :: unspecified (), }), token_trees : $crate :: quote :: IntoTt :: to_tokens ( children ), }}}; (@ PUNCT $first : literal )=>{{ vec ! [ tt :: Leaf :: Punct ( tt :: Punct { char : $first , spacing : tt :: Spacing :: Alone , id : tt :: TokenId :: unspecified (), }). into ()]}}; (@ PUNCT $first : literal , $sec : literal )=>{{ vec ! [ tt :: Leaf :: Punct ( tt :: Punct { char : $first , spacing : tt :: Spacing :: Joint , id : tt :: TokenId :: unspecified (), }). into (), tt :: Leaf :: Punct ( tt :: Punct { char : $sec , spacing : tt :: Spacing :: Alone , id : tt :: TokenId :: unspecified (), }). into ()]}}; (# $first : ident $($tail : tt )* )=>{{ let token = $crate :: quote :: ToTokenTree :: to_token ($first ); let mut tokens = vec ! [ token . into ()]; let mut tail_tokens = $crate :: quote :: IntoTt :: to_tokens ($crate :: __quote ! ($($tail )*)); tokens . append (& mut tail_tokens ); tokens }}; (## $first : ident $($tail : tt )* )=>{{ let mut tokens = $first . into_iter (). map ($crate :: quote :: ToTokenTree :: to_token ). collect ::< Vec < tt :: TokenTree >> (); let mut tail_tokens = $crate :: quote :: IntoTt :: to_tokens ($crate :: __quote ! ($($tail )*)); tokens . append (& mut tail_tokens ); tokens }}; ({$($tt : tt )* })=>{$crate :: __quote ! (@ SUBTREE Brace $($tt )*)}; ([$($tt : tt )* ])=>{$crate :: __quote ! (@ SUBTREE Bracket $($tt )*)}; (($($tt : tt )* ))=>{$crate :: __quote ! (@ SUBTREE Parenthesis $($tt )*)}; ($tt : literal )=>{ vec ! [$crate :: quote :: ToTokenTree :: to_token ($tt ). into ()]}; ($tt : ident )=>{ vec ! [{ tt :: Leaf :: Ident ( tt :: Ident { text : stringify ! ($tt ). into (), id : tt :: TokenId :: unspecified (), }). into ()}]}; (-> )=>{$crate :: __quote ! (@ PUNCT '-' , '>' )}; (& )=>{$crate :: __quote ! (@ PUNCT '&' )}; (, )=>{$crate :: __quote ! (@ PUNCT ',' )}; (: )=>{$crate :: __quote ! (@ PUNCT ':' )}; (; )=>{$crate :: __quote ! (@ PUNCT ';' )}; (:: )=>{$crate :: __quote ! (@ PUNCT ':' , ':' )}; (. )=>{$crate :: __quote ! (@ PUNCT '.' )}; (< )=>{$crate :: __quote ! (@ PUNCT '<' )}; (> )=>{$crate :: __quote ! (@ PUNCT '>' )}; ($first : tt $($tail : tt )+ )=>{{ let mut tokens = $crate :: quote :: IntoTt :: to_tokens ($crate :: __quote ! ($first )); let mut tail_tokens = $crate :: quote :: IntoTt :: to_tokens ($crate :: __quote ! ($($tail )*)); tokens . append (& mut tail_tokens ); tokens }}; }
531+
macro_rules! __ra_macro_fixture530 {()=>{ Vec ::< tt :: TokenTree >:: new ()}; (@ SUBTREE $delim : ident $($tt : tt )* )=>{{ let children = $crate :: __quote ! ($($tt )*); tt :: Subtree { delimiter : Some ( tt :: Delimiter { kind : tt :: DelimiterKind ::$delim , id : tt :: TokenId :: unspecified (), }), token_trees : $crate :: quote :: IntoTt :: to_tokens ( children ), }}}; (@ PUNCT $first : literal )=>{{ vec ! [ tt :: Leaf :: Punct ( tt :: Punct { char : $first , spacing : tt :: Spacing :: Alone , id : tt :: TokenId :: unspecified (), }). into ()]}}; (@ PUNCT $first : literal , $sec : literal )=>{{ vec ! [ tt :: Leaf :: Punct ( tt :: Punct { char : $first , spacing : tt :: Spacing :: Joint , id : tt :: TokenId :: unspecified (), }). into (), tt :: Leaf :: Punct ( tt :: Punct { char : $sec , spacing : tt :: Spacing :: Alone , id : tt :: TokenId :: unspecified (), }). into ()]}}; (# $first : ident $($tail : tt )* )=>{{ let token = $crate :: quote :: ToTokenTree :: to_token ($first ); let mut tokens = vec ! [ token . into ()]; let mut tail_tokens = $crate :: quote :: IntoTt :: to_tokens ($crate :: __quote ! ($($tail )*)); tokens . append (& mut tail_tokens ); tokens }}; (# # $first : ident $($tail : tt )* )=>{{ let mut tokens = $first . into_iter (). map ($crate :: quote :: ToTokenTree :: to_token ). collect ::< Vec < tt :: TokenTree >> (); let mut tail_tokens = $crate :: quote :: IntoTt :: to_tokens ($crate :: __quote ! ($($tail )*)); tokens . append (& mut tail_tokens ); tokens }}; ({$($tt : tt )* })=>{$crate :: __quote ! (@ SUBTREE Brace $($tt )*)}; ([$($tt : tt )* ])=>{$crate :: __quote ! (@ SUBTREE Bracket $($tt )*)}; (($($tt : tt )* ))=>{$crate :: __quote ! (@ SUBTREE Parenthesis $($tt )*)}; ($tt : literal )=>{ vec ! [$crate :: quote :: ToTokenTree :: to_token ($tt ). into ()]}; ($tt : ident )=>{ vec ! [{ tt :: Leaf :: Ident ( tt :: Ident { text : stringify ! ($tt ). into (), id : tt :: TokenId :: unspecified (), }). into ()}]}; (-> )=>{$crate :: __quote ! (@ PUNCT '-' , '>' )}; (& )=>{$crate :: __quote ! (@ PUNCT '&' )}; (, )=>{$crate :: __quote ! (@ PUNCT ',' )}; (: )=>{$crate :: __quote ! (@ PUNCT ':' )}; (; )=>{$crate :: __quote ! (@ PUNCT ';' )}; (:: )=>{$crate :: __quote ! (@ PUNCT ':' , ':' )}; (. )=>{$crate :: __quote ! (@ PUNCT '.' )}; (< )=>{$crate :: __quote ! (@ PUNCT '<' )}; (> )=>{$crate :: __quote ! (@ PUNCT '>' )}; ($first : tt $($tail : tt )+ )=>{{ let mut tokens = $crate :: quote :: IntoTt :: to_tokens ($crate :: __quote ! ($first )); let mut tail_tokens = $crate :: quote :: IntoTt :: to_tokens ($crate :: __quote ! ($($tail )*)); tokens . append (& mut tail_tokens ); tokens }}; }
532532
macro_rules! __ra_macro_fixture531 {($($name : ident )*)=>{$(if let Some ( it )= & self .$name { f . field ( stringify ! ($name ), it ); })*}}
533533
macro_rules! __ra_macro_fixture532 {($fmt : expr )=>{ RenameError ( format ! ($fmt ))}; ($fmt : expr , $($arg : tt )+)=>{ RenameError ( format ! ($fmt , $($arg )+))}}
534534
macro_rules! __ra_macro_fixture533 {($($tokens : tt )*)=>{ return Err ( format_err ! ($($tokens )*))}}

crates/edition/src/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ pub enum Edition {
1515
impl Edition {
1616
pub const DEFAULT: Edition = Edition::Edition2015;
1717
pub const LATEST: Edition = Edition::Edition2024;
18-
pub const CURRENT: Edition = Edition::Edition2021;
18+
pub const CURRENT: Edition = Edition::Edition2024;
1919
/// The current latest stable edition, note this is usually not the right choice in code.
20-
pub const CURRENT_FIXME: Edition = Edition::Edition2021;
20+
pub const CURRENT_FIXME: Edition = Edition::Edition2024;
2121

2222
pub fn from_u32(u32: u32) -> Edition {
2323
match u32 {

crates/hir-def/src/expander.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ impl Expander {
5656

5757
pub fn syntax_context(&self) -> SyntaxContext {
5858
// FIXME:
59-
SyntaxContext::root(Edition::CURRENT)
59+
SyntaxContext::root(Edition::CURRENT_FIXME)
6060
}
6161

6262
pub fn enter_expand<T: ast::AstNode>(

crates/hir-def/src/item_tree/tests.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ m!();
270270
// AstId: 2
271271
pub macro m2 { ... }
272272
273-
// AstId: 3, SyntaxContextId: ROOT2021, ExpandTo: Items
273+
// AstId: 3, SyntaxContextId: ROOT2024, ExpandTo: Items
274274
m!(...);
275275
"#]],
276276
);

crates/hir-def/src/macro_expansion_tests/mbe.rs

+12-12
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ macro_rules! f {
3535
};
3636
}
3737
38-
struct#0:1@58..64#20480# MyTraitMap2#0:2@31..42#ROOT2021# {#0:1@72..73#20480#
38+
struct#0:1@58..64#20480# MyTraitMap2#0:2@31..42#ROOT2024# {#0:1@72..73#20480#
3939
map#0:1@86..89#20480#:#0:1@89..90#20480# #0:1@89..90#20480#::#0:1@91..93#20480#std#0:1@93..96#20480#::#0:1@96..98#20480#collections#0:1@98..109#20480#::#0:1@109..111#20480#HashSet#0:1@111..118#20480#<#0:1@118..119#20480#(#0:1@119..120#20480#)#0:1@120..121#20480#>#0:1@121..122#20480#,#0:1@122..123#20480#
4040
}#0:1@132..133#20480#
4141
"#]],
@@ -75,12 +75,12 @@ macro_rules! f {
7575
};
7676
}
7777
78-
fn#0:2@30..32#ROOT2021# main#0:2@33..37#ROOT2021#(#0:2@37..38#ROOT2021#)#0:2@38..39#ROOT2021# {#0:2@40..41#ROOT2021#
79-
1#0:2@50..51#ROOT2021#;#0:2@51..52#ROOT2021#
80-
1.0#0:2@61..64#ROOT2021#;#0:2@64..65#ROOT2021#
81-
(#0:2@74..75#ROOT2021#(#0:2@75..76#ROOT2021#1#0:2@76..77#ROOT2021#,#0:2@77..78#ROOT2021# )#0:2@78..79#ROOT2021#,#0:2@79..80#ROOT2021# )#0:2@80..81#ROOT2021#.#0:2@81..82#ROOT2021#0#0:2@82..85#ROOT2021#.#0:2@82..85#ROOT2021#0#0:2@82..85#ROOT2021#;#0:2@85..86#ROOT2021#
82-
let#0:2@95..98#ROOT2021# x#0:2@99..100#ROOT2021# =#0:2@101..102#ROOT2021# 1#0:2@103..104#ROOT2021#;#0:2@104..105#ROOT2021#
83-
}#0:2@110..111#ROOT2021#
78+
fn#0:2@30..32#ROOT2024# main#0:2@33..37#ROOT2024#(#0:2@37..38#ROOT2024#)#0:2@38..39#ROOT2024# {#0:2@40..41#ROOT2024#
79+
1#0:2@50..51#ROOT2024#;#0:2@51..52#ROOT2024#
80+
1.0#0:2@61..64#ROOT2024#;#0:2@64..65#ROOT2024#
81+
(#0:2@74..75#ROOT2024#(#0:2@75..76#ROOT2024#1#0:2@76..77#ROOT2024#,#0:2@77..78#ROOT2024# )#0:2@78..79#ROOT2024#,#0:2@79..80#ROOT2024# )#0:2@80..81#ROOT2024#.#0:2@81..82#ROOT2024#0#0:2@82..85#ROOT2024#.#0:2@82..85#ROOT2024#0#0:2@82..85#ROOT2024#;#0:2@85..86#ROOT2024#
82+
let#0:2@95..98#ROOT2024# x#0:2@99..100#ROOT2024# =#0:2@101..102#ROOT2024# 1#0:2@103..104#ROOT2024#;#0:2@104..105#ROOT2024#
83+
}#0:2@110..111#ROOT2024#
8484
8585
8686
"#]],
@@ -171,7 +171,7 @@ fn main(foo: ()) {
171171
}
172172
173173
fn main(foo: ()) {
174-
/* error: unresolved macro unresolved */"helloworld!"#0:3@236..321#ROOT2021#;
174+
/* error: unresolved macro unresolved */"helloworld!"#0:3@236..321#ROOT2024#;
175175
}
176176
}
177177
@@ -197,7 +197,7 @@ macro_rules! mk_struct {
197197
#[macro_use]
198198
mod foo;
199199
200-
struct#1:1@59..65#20480# Foo#0:2@32..35#ROOT2021#(#1:1@70..71#20480#u32#0:2@41..44#ROOT2021#)#1:1@74..75#20480#;#1:1@75..76#20480#
200+
struct#1:1@59..65#20480# Foo#0:2@32..35#ROOT2024#(#1:1@70..71#20480#u32#0:2@41..44#ROOT2024#)#1:1@74..75#20480#;#1:1@75..76#20480#
201201
"#]],
202202
);
203203
}
@@ -424,8 +424,8 @@ macro_rules! m {
424424
($($i:ident),*) => ( impl Bar { $(fn $i() {})* } );
425425
}
426426
impl#\20480# Bar#\20480# {#\20480#
427-
fn#\20480# foo#\ROOT2021#(#\20480#)#\20480# {#\20480#}#\20480#
428-
fn#\20480# bar#\ROOT2021#(#\20480#)#\20480# {#\20480#}#\20480#
427+
fn#\20480# foo#\ROOT2024#(#\20480#)#\20480# {#\20480#}#\20480#
428+
fn#\20480# bar#\ROOT2024#(#\20480#)#\20480# {#\20480#}#\20480#
429429
}#\20480#
430430
"#]],
431431
);
@@ -1408,7 +1408,7 @@ ok!();
14081408
macro_rules! m2 {
14091409
($($a:expr => $b:ident)* _ => $c:expr) => { ok!(); }
14101410
}
1411-
ok!();
1411+
/* error: unexpected token in input */ok!();
14121412
"#]],
14131413
);
14141414
}

crates/hir-def/src/macro_expansion_tests/mbe/matching.rs

+26-1
Original file line numberDiff line numberDiff line change
@@ -162,9 +162,10 @@ fn test() {
162162
}
163163

164164
#[test]
165-
fn expr_dont_match_inline_const() {
165+
fn expr_inline_const() {
166166
check(
167167
r#"
168+
//- /lib.rs edition:2021
168169
macro_rules! foo {
169170
($e:expr) => { $e }
170171
}
@@ -181,6 +182,30 @@ macro_rules! foo {
181182
fn test() {
182183
/* error: no rule matches input tokens */missing;
183184
}
185+
"#]],
186+
);
187+
check(
188+
r#"
189+
//- /lib.rs edition:2024
190+
macro_rules! foo {
191+
($e:expr) => { $e }
192+
}
193+
194+
fn test() {
195+
foo!(const { 3 });
196+
}
197+
"#,
198+
expect![[r#"
199+
macro_rules! foo {
200+
($e:expr) => { $e }
201+
}
202+
203+
fn test() {
204+
(const {
205+
3
206+
}
207+
);
208+
}
184209
"#]],
185210
);
186211
}

crates/hir-def/src/macro_expansion_tests/proc_macros.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -181,9 +181,9 @@ fn foo(&self) {
181181
self.0. 1;
182182
}
183183
184-
fn#0:1@45..47#ROOT2021# foo#0:1@48..51#ROOT2021#(#0:1@51..52#ROOT2021#&#0:1@52..53#ROOT2021#self#0:1@53..57#ROOT2021# )#0:1@57..58#ROOT2021# {#0:1@59..60#ROOT2021#
185-
self#0:1@65..69#ROOT2021# .#0:1@69..70#ROOT2021#0#0:1@70..71#ROOT2021#.#0:1@71..72#ROOT2021#1#0:1@73..74#ROOT2021#;#0:1@74..75#ROOT2021#
186-
}#0:1@76..77#ROOT2021#"#]],
184+
fn#0:1@45..47#ROOT2024# foo#0:1@48..51#ROOT2024#(#0:1@51..52#ROOT2024#&#0:1@52..53#ROOT2024#self#0:1@53..57#ROOT2024# )#0:1@57..58#ROOT2024# {#0:1@59..60#ROOT2024#
185+
self#0:1@65..69#ROOT2024# .#0:1@69..70#ROOT2024#0#0:1@70..71#ROOT2024#.#0:1@71..72#ROOT2024#1#0:1@73..74#ROOT2024#;#0:1@74..75#ROOT2024#
186+
}#0:1@76..77#ROOT2024#"#]],
187187
);
188188
}
189189

crates/hir-expand/src/builtin/quote.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -277,8 +277,8 @@ mod tests {
277277
assert_eq!(quoted.to_string(), "hello");
278278
let t = format!("{quoted:#?}");
279279
expect![[r#"
280-
SUBTREE $$ 937550:0@0..0#ROOT2021 937550:0@0..0#ROOT2021
281-
IDENT hello 937550:0@0..0#ROOT2021"#]]
280+
SUBTREE $$ 937550:0@0..0#ROOT2024 937550:0@0..0#ROOT2024
281+
IDENT hello 937550:0@0..0#ROOT2024"#]]
282282
.assert_eq(&t);
283283
}
284284

crates/hir-ty/src/tests/coercion.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ struct S<T> { a: T }
2222
fn f<T>(_: &[T]) -> T { loop {} }
2323
fn g<T>(_: S<&[T]>) -> T { loop {} }
2424
25-
fn gen<T>() -> *mut [T; 2] { loop {} }
25+
fn generate<T>() -> *mut [T; 2] { loop {} }
2626
fn test1<U>() -> *mut [U] {
27-
gen()
27+
generate()
2828
}
2929
3030
fn test2() {

crates/ide-completion/src/tests/special.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ mod macros {
105105
fn completes_std_prelude_if_core_is_defined() {
106106
check_no_kw(
107107
r#"
108-
//- /main.rs crate:main deps:core,std
108+
//- /main.rs crate:main deps:core,std edition:2021
109109
fn foo() { let x: $0 }
110110
111111
//- /core/lib.rs crate:core

crates/ide-db/src/test_data/test_doc_alias.txt

+7-7
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
FileId(
2727
0,
2828
),
29-
Edition2021,
29+
Edition2024,
3030
),
3131
ptr: SyntaxNodePtr {
3232
kind: STRUCT,
@@ -59,7 +59,7 @@
5959
FileId(
6060
0,
6161
),
62-
Edition2021,
62+
Edition2024,
6363
),
6464
ptr: SyntaxNodePtr {
6565
kind: STRUCT,
@@ -92,7 +92,7 @@
9292
FileId(
9393
0,
9494
),
95-
Edition2021,
95+
Edition2024,
9696
),
9797
ptr: SyntaxNodePtr {
9898
kind: STRUCT,
@@ -125,7 +125,7 @@
125125
FileId(
126126
0,
127127
),
128-
Edition2021,
128+
Edition2024,
129129
),
130130
ptr: SyntaxNodePtr {
131131
kind: STRUCT,
@@ -158,7 +158,7 @@
158158
FileId(
159159
0,
160160
),
161-
Edition2021,
161+
Edition2024,
162162
),
163163
ptr: SyntaxNodePtr {
164164
kind: STRUCT,
@@ -191,7 +191,7 @@
191191
FileId(
192192
0,
193193
),
194-
Edition2021,
194+
Edition2024,
195195
),
196196
ptr: SyntaxNodePtr {
197197
kind: STRUCT,
@@ -224,7 +224,7 @@
224224
FileId(
225225
0,
226226
),
227-
Edition2021,
227+
Edition2024,
228228
),
229229
ptr: SyntaxNodePtr {
230230
kind: STRUCT,

0 commit comments

Comments
 (0)