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:[email protected]#20480# MyTraitMap2#0:[email protected]#ROOT2021# {#0:[email protected]#20480#
38+
struct#0:[email protected]#20480# MyTraitMap2#0:[email protected]#ROOT2024# {#0:[email protected]#20480#
3939
map#0:[email protected]#20480#:#0:[email protected]#20480# #0:[email protected]#20480#::#0:[email protected]#20480#std#0:[email protected]#20480#::#0:[email protected]#20480#collections#0:[email protected]#20480#::#0:[email protected]#20480#HashSet#0:[email protected]#20480#<#0:[email protected]#20480#(#0:[email protected]#20480#)#0:[email protected]#20480#>#0:[email protected]#20480#,#0:[email protected]#20480#
4040
4141
"#]],
@@ -75,12 +75,12 @@ macro_rules! f {
7575
};
7676
}
7777
78-
fn#0:[email protected]#ROOT2021# main#0:[email protected]#ROOT2021#(#0:[email protected]#ROOT2021#)#0:[email protected]#ROOT2021# {#0:[email protected]#ROOT2021#
79-
1#0:[email protected]#ROOT2021#;#0:[email protected]#ROOT2021#
80-
1.0#0:[email protected]#ROOT2021#;#0:[email protected]#ROOT2021#
81-
(#0:[email protected]#ROOT2021#(#0:[email protected]#ROOT2021#1#0:[email protected]#ROOT2021#,#0:[email protected]#ROOT2021# )#0:[email protected]#ROOT2021#,#0:[email protected]#ROOT2021# )#0:[email protected]#ROOT2021#.#0:[email protected]#ROOT2021#0#0:[email protected]#ROOT2021#.#0:[email protected]#ROOT2021#0#0:[email protected]#ROOT2021#;#0:[email protected]#ROOT2021#
82-
let#0:[email protected]#ROOT2021# x#0:[email protected]#ROOT2021# =#0:[email protected]#ROOT2021# 1#0:[email protected]#ROOT2021#;#0:[email protected]#ROOT2021#
83-
}#0:[email protected]#ROOT2021#
78+
fn#0:[email protected]#ROOT2024# main#0:[email protected]#ROOT2024#(#0:[email protected]#ROOT2024#)#0:[email protected]#ROOT2024# {#0:[email protected]#ROOT2024#
79+
1#0:[email protected]#ROOT2024#;#0:[email protected]#ROOT2024#
80+
1.0#0:[email protected]#ROOT2024#;#0:[email protected]#ROOT2024#
81+
(#0:[email protected]#ROOT2024#(#0:[email protected]#ROOT2024#1#0:[email protected]#ROOT2024#,#0:[email protected]#ROOT2024# )#0:[email protected]#ROOT2024#,#0:[email protected]#ROOT2024# )#0:[email protected]#ROOT2024#.#0:[email protected]#ROOT2024#0#0:[email protected]#ROOT2024#.#0:[email protected]#ROOT2024#0#0:[email protected]#ROOT2024#;#0:[email protected]#ROOT2024#
82+
let#0:[email protected]#ROOT2024# x#0:[email protected]#ROOT2024# =#0:[email protected]#ROOT2024# 1#0:[email protected]#ROOT2024#;#0:[email protected]#ROOT2024#
83+
}#0:[email protected]#ROOT2024#
8484
8585
8686
"#]],
@@ -171,7 +171,7 @@ fn main(foo: ()) {
171171
}
172172
173173
fn main(foo: ()) {
174-
/* error: unresolved macro unresolved */"helloworld!"#0:[email protected]#ROOT2021#;
174+
/* error: unresolved macro unresolved */"helloworld!"#0:[email protected]#ROOT2024#;
175175
}
176176
}
177177
@@ -197,7 +197,7 @@ macro_rules! mk_struct {
197197
#[macro_use]
198198
mod foo;
199199
200-
struct#1:[email protected]#20480# Foo#0:[email protected]#ROOT2021#(#1:[email protected]#20480#u32#0:[email protected]#ROOT2021#)#1:[email protected]#20480#;#1:[email protected]#20480#
200+
struct#1:[email protected]#20480# Foo#0:[email protected]#ROOT2024#(#1:[email protected]#20480#u32#0:[email protected]#ROOT2024#)#1:[email protected]#20480#;#1:[email protected]#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:[email protected]#ROOT2021# foo#0:[email protected]#ROOT2021#(#0:[email protected]#ROOT2021#&#0:[email protected]#ROOT2021#self#0:[email protected]#ROOT2021# )#0:[email protected]#ROOT2021# {#0:[email protected]#ROOT2021#
185-
self#0:[email protected]#ROOT2021# .#0:[email protected]#ROOT2021#0#0:[email protected]#ROOT2021#.#0:[email protected]#ROOT2021#1#0:[email protected]#ROOT2021#;#0:[email protected]#ROOT2021#
186-
}#0:[email protected]#ROOT2021#"#]],
184+
fn#0:[email protected]#ROOT2024# foo#0:[email protected]#ROOT2024#(#0:[email protected]#ROOT2024#&#0:[email protected]#ROOT2024#self#0:[email protected]#ROOT2024# )#0:[email protected]#ROOT2024# {#0:[email protected]#ROOT2024#
185+
self#0:[email protected]#ROOT2024# .#0:[email protected]#ROOT2024#0#0:[email protected]#ROOT2024#.#0:[email protected]#ROOT2024#1#0:[email protected]#ROOT2024#;#0:[email protected]#ROOT2024#
186+
}#0:[email protected]#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:[email protected]#ROOT2021 937550:[email protected]#ROOT2021
281-
IDENT hello 937550:[email protected]#ROOT2021"#]]
280+
SUBTREE $$ 937550:[email protected]#ROOT2024 937550:[email protected]#ROOT2024
281+
IDENT hello 937550:[email protected]#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)