mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-07-07 13:15:27 +00:00
chore: Bump Edition::CURRENT
to 2024
This commit is contained in:
parent
23e8d13531
commit
a505420751
24 changed files with 277 additions and 244 deletions
|
@ -528,7 +528,7 @@ macro_rules! __ra_macro_fixture526 {($expr : expr )=>{|| -> _ { Some ($expr )}(
|
|||
macro_rules! __ra_macro_fixture527 {($($arg : tt )*)=>($crate :: io :: _print ($crate :: format_args ! ($($arg )*))); }
|
||||
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 ()))}}
|
||||
macro_rules! __ra_macro_fixture529 {($($tt : tt )* )=>{$crate :: quote :: IntoTt :: to_subtree ($crate :: __quote ! ($($tt )*))}}
|
||||
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 }}; }
|
||||
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 }}; }
|
||||
macro_rules! __ra_macro_fixture531 {($($name : ident )*)=>{$(if let Some ( it )= & self .$name { f . field ( stringify ! ($name ), it ); })*}}
|
||||
macro_rules! __ra_macro_fixture532 {($fmt : expr )=>{ RenameError ( format ! ($fmt ))}; ($fmt : expr , $($arg : tt )+)=>{ RenameError ( format ! ($fmt , $($arg )+))}}
|
||||
macro_rules! __ra_macro_fixture533 {($($tokens : tt )*)=>{ return Err ( format_err ! ($($tokens )*))}}
|
||||
|
|
|
@ -15,9 +15,9 @@ pub enum Edition {
|
|||
impl Edition {
|
||||
pub const DEFAULT: Edition = Edition::Edition2015;
|
||||
pub const LATEST: Edition = Edition::Edition2024;
|
||||
pub const CURRENT: Edition = Edition::Edition2021;
|
||||
pub const CURRENT: Edition = Edition::Edition2024;
|
||||
/// The current latest stable edition, note this is usually not the right choice in code.
|
||||
pub const CURRENT_FIXME: Edition = Edition::Edition2021;
|
||||
pub const CURRENT_FIXME: Edition = Edition::Edition2024;
|
||||
|
||||
pub fn from_u32(u32: u32) -> Edition {
|
||||
match u32 {
|
||||
|
|
|
@ -56,7 +56,7 @@ impl Expander {
|
|||
|
||||
pub fn syntax_context(&self) -> SyntaxContext {
|
||||
// FIXME:
|
||||
SyntaxContext::root(Edition::CURRENT)
|
||||
SyntaxContext::root(Edition::CURRENT_FIXME)
|
||||
}
|
||||
|
||||
pub fn enter_expand<T: ast::AstNode>(
|
||||
|
|
|
@ -270,7 +270,7 @@ m!();
|
|||
// AstId: 2
|
||||
pub macro m2 { ... }
|
||||
|
||||
// AstId: 3, SyntaxContextId: ROOT2021, ExpandTo: Items
|
||||
// AstId: 3, SyntaxContextId: ROOT2024, ExpandTo: Items
|
||||
m!(...);
|
||||
"#]],
|
||||
);
|
||||
|
|
|
@ -35,7 +35,7 @@ macro_rules! f {
|
|||
};
|
||||
}
|
||||
|
||||
struct#0:1@58..64#20480# MyTraitMap2#0:2@31..42#ROOT2021# {#0:1@72..73#20480#
|
||||
struct#0:1@58..64#20480# MyTraitMap2#0:2@31..42#ROOT2024# {#0:1@72..73#20480#
|
||||
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#
|
||||
}#0:1@132..133#20480#
|
||||
"#]],
|
||||
|
@ -75,12 +75,12 @@ macro_rules! f {
|
|||
};
|
||||
}
|
||||
|
||||
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#
|
||||
1#0:2@50..51#ROOT2021#;#0:2@51..52#ROOT2021#
|
||||
1.0#0:2@61..64#ROOT2021#;#0:2@64..65#ROOT2021#
|
||||
(#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#
|
||||
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#
|
||||
}#0:2@110..111#ROOT2021#
|
||||
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#
|
||||
1#0:2@50..51#ROOT2024#;#0:2@51..52#ROOT2024#
|
||||
1.0#0:2@61..64#ROOT2024#;#0:2@64..65#ROOT2024#
|
||||
(#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#
|
||||
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#
|
||||
}#0:2@110..111#ROOT2024#
|
||||
|
||||
|
||||
"#]],
|
||||
|
@ -171,7 +171,7 @@ fn main(foo: ()) {
|
|||
}
|
||||
|
||||
fn main(foo: ()) {
|
||||
/* error: unresolved macro unresolved */"helloworld!"#0:3@236..321#ROOT2021#;
|
||||
/* error: unresolved macro unresolved */"helloworld!"#0:3@236..321#ROOT2024#;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -197,7 +197,7 @@ macro_rules! mk_struct {
|
|||
#[macro_use]
|
||||
mod foo;
|
||||
|
||||
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#
|
||||
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#
|
||||
"#]],
|
||||
);
|
||||
}
|
||||
|
@ -424,8 +424,8 @@ macro_rules! m {
|
|||
($($i:ident),*) => ( impl Bar { $(fn $i() {})* } );
|
||||
}
|
||||
impl#\20480# Bar#\20480# {#\20480#
|
||||
fn#\20480# foo#\ROOT2021#(#\20480#)#\20480# {#\20480#}#\20480#
|
||||
fn#\20480# bar#\ROOT2021#(#\20480#)#\20480# {#\20480#}#\20480#
|
||||
fn#\20480# foo#\ROOT2024#(#\20480#)#\20480# {#\20480#}#\20480#
|
||||
fn#\20480# bar#\ROOT2024#(#\20480#)#\20480# {#\20480#}#\20480#
|
||||
}#\20480#
|
||||
"#]],
|
||||
);
|
||||
|
@ -1408,7 +1408,7 @@ ok!();
|
|||
macro_rules! m2 {
|
||||
($($a:expr => $b:ident)* _ => $c:expr) => { ok!(); }
|
||||
}
|
||||
ok!();
|
||||
/* error: unexpected token in input */ok!();
|
||||
"#]],
|
||||
);
|
||||
}
|
||||
|
|
|
@ -162,9 +162,10 @@ fn test() {
|
|||
}
|
||||
|
||||
#[test]
|
||||
fn expr_dont_match_inline_const() {
|
||||
fn expr_inline_const() {
|
||||
check(
|
||||
r#"
|
||||
//- /lib.rs edition:2021
|
||||
macro_rules! foo {
|
||||
($e:expr) => { $e }
|
||||
}
|
||||
|
@ -181,6 +182,30 @@ macro_rules! foo {
|
|||
fn test() {
|
||||
/* error: no rule matches input tokens */missing;
|
||||
}
|
||||
"#]],
|
||||
);
|
||||
check(
|
||||
r#"
|
||||
//- /lib.rs edition:2024
|
||||
macro_rules! foo {
|
||||
($e:expr) => { $e }
|
||||
}
|
||||
|
||||
fn test() {
|
||||
foo!(const { 3 });
|
||||
}
|
||||
"#,
|
||||
expect![[r#"
|
||||
macro_rules! foo {
|
||||
($e:expr) => { $e }
|
||||
}
|
||||
|
||||
fn test() {
|
||||
(const {
|
||||
3
|
||||
}
|
||||
);
|
||||
}
|
||||
"#]],
|
||||
);
|
||||
}
|
||||
|
|
|
@ -181,9 +181,9 @@ fn foo(&self) {
|
|||
self.0. 1;
|
||||
}
|
||||
|
||||
fn#0:1@45..47#ROOT2021# foo#0:1@48..51#ROOT2021#(#0:1@51..52#ROOT2021#�:1@52..53#ROOT2021#self#0:1@53..57#ROOT2021# )#0:1@57..58#ROOT2021# {#0:1@59..60#ROOT2021#
|
||||
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#
|
||||
}#0:1@76..77#ROOT2021#"#]],
|
||||
fn#0:1@45..47#ROOT2024# foo#0:1@48..51#ROOT2024#(#0:1@51..52#ROOT2024#�:1@52..53#ROOT2024#self#0:1@53..57#ROOT2024# )#0:1@57..58#ROOT2024# {#0:1@59..60#ROOT2024#
|
||||
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#
|
||||
}#0:1@76..77#ROOT2024#"#]],
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -277,8 +277,8 @@ mod tests {
|
|||
assert_eq!(quoted.to_string(), "hello");
|
||||
let t = format!("{quoted:#?}");
|
||||
expect![[r#"
|
||||
SUBTREE $$ 937550:0@0..0#ROOT2021 937550:0@0..0#ROOT2021
|
||||
IDENT hello 937550:0@0..0#ROOT2021"#]]
|
||||
SUBTREE $$ 937550:0@0..0#ROOT2024 937550:0@0..0#ROOT2024
|
||||
IDENT hello 937550:0@0..0#ROOT2024"#]]
|
||||
.assert_eq(&t);
|
||||
}
|
||||
|
||||
|
|
|
@ -22,9 +22,9 @@ struct S<T> { a: T }
|
|||
fn f<T>(_: &[T]) -> T { loop {} }
|
||||
fn g<T>(_: S<&[T]>) -> T { loop {} }
|
||||
|
||||
fn gen<T>() -> *mut [T; 2] { loop {} }
|
||||
fn generate<T>() -> *mut [T; 2] { loop {} }
|
||||
fn test1<U>() -> *mut [U] {
|
||||
gen()
|
||||
generate()
|
||||
}
|
||||
|
||||
fn test2() {
|
||||
|
|
|
@ -105,7 +105,7 @@ mod macros {
|
|||
fn completes_std_prelude_if_core_is_defined() {
|
||||
check_no_kw(
|
||||
r#"
|
||||
//- /main.rs crate:main deps:core,std
|
||||
//- /main.rs crate:main deps:core,std edition:2021
|
||||
fn foo() { let x: $0 }
|
||||
|
||||
//- /core/lib.rs crate:core
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
FileId(
|
||||
0,
|
||||
),
|
||||
Edition2021,
|
||||
Edition2024,
|
||||
),
|
||||
ptr: SyntaxNodePtr {
|
||||
kind: STRUCT,
|
||||
|
@ -59,7 +59,7 @@
|
|||
FileId(
|
||||
0,
|
||||
),
|
||||
Edition2021,
|
||||
Edition2024,
|
||||
),
|
||||
ptr: SyntaxNodePtr {
|
||||
kind: STRUCT,
|
||||
|
@ -92,7 +92,7 @@
|
|||
FileId(
|
||||
0,
|
||||
),
|
||||
Edition2021,
|
||||
Edition2024,
|
||||
),
|
||||
ptr: SyntaxNodePtr {
|
||||
kind: STRUCT,
|
||||
|
@ -125,7 +125,7 @@
|
|||
FileId(
|
||||
0,
|
||||
),
|
||||
Edition2021,
|
||||
Edition2024,
|
||||
),
|
||||
ptr: SyntaxNodePtr {
|
||||
kind: STRUCT,
|
||||
|
@ -158,7 +158,7 @@
|
|||
FileId(
|
||||
0,
|
||||
),
|
||||
Edition2021,
|
||||
Edition2024,
|
||||
),
|
||||
ptr: SyntaxNodePtr {
|
||||
kind: STRUCT,
|
||||
|
@ -191,7 +191,7 @@
|
|||
FileId(
|
||||
0,
|
||||
),
|
||||
Edition2021,
|
||||
Edition2024,
|
||||
),
|
||||
ptr: SyntaxNodePtr {
|
||||
kind: STRUCT,
|
||||
|
@ -224,7 +224,7 @@
|
|||
FileId(
|
||||
0,
|
||||
),
|
||||
Edition2021,
|
||||
Edition2024,
|
||||
),
|
||||
ptr: SyntaxNodePtr {
|
||||
kind: STRUCT,
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
FileId(
|
||||
0,
|
||||
),
|
||||
Edition2021,
|
||||
Edition2024,
|
||||
),
|
||||
ptr: SyntaxNodePtr {
|
||||
kind: TYPE_ALIAS,
|
||||
|
@ -55,7 +55,7 @@
|
|||
FileId(
|
||||
0,
|
||||
),
|
||||
Edition2021,
|
||||
Edition2024,
|
||||
),
|
||||
ptr: SyntaxNodePtr {
|
||||
kind: CONST,
|
||||
|
@ -86,7 +86,7 @@
|
|||
FileId(
|
||||
0,
|
||||
),
|
||||
Edition2021,
|
||||
Edition2024,
|
||||
),
|
||||
ptr: SyntaxNodePtr {
|
||||
kind: CONST,
|
||||
|
@ -119,7 +119,7 @@
|
|||
FileId(
|
||||
0,
|
||||
),
|
||||
Edition2021,
|
||||
Edition2024,
|
||||
),
|
||||
ptr: SyntaxNodePtr {
|
||||
kind: ENUM,
|
||||
|
@ -152,7 +152,7 @@
|
|||
FileId(
|
||||
0,
|
||||
),
|
||||
Edition2021,
|
||||
Edition2024,
|
||||
),
|
||||
ptr: SyntaxNodePtr {
|
||||
kind: USE_TREE,
|
||||
|
@ -185,7 +185,7 @@
|
|||
FileId(
|
||||
0,
|
||||
),
|
||||
Edition2021,
|
||||
Edition2024,
|
||||
),
|
||||
ptr: SyntaxNodePtr {
|
||||
kind: MACRO_DEF,
|
||||
|
@ -216,7 +216,7 @@
|
|||
FileId(
|
||||
0,
|
||||
),
|
||||
Edition2021,
|
||||
Edition2024,
|
||||
),
|
||||
ptr: SyntaxNodePtr {
|
||||
kind: STATIC,
|
||||
|
@ -249,7 +249,7 @@
|
|||
FileId(
|
||||
0,
|
||||
),
|
||||
Edition2021,
|
||||
Edition2024,
|
||||
),
|
||||
ptr: SyntaxNodePtr {
|
||||
kind: STRUCT,
|
||||
|
@ -312,7 +312,7 @@
|
|||
FileId(
|
||||
0,
|
||||
),
|
||||
Edition2021,
|
||||
Edition2024,
|
||||
),
|
||||
ptr: SyntaxNodePtr {
|
||||
kind: STRUCT,
|
||||
|
@ -347,7 +347,7 @@
|
|||
FileId(
|
||||
0,
|
||||
),
|
||||
Edition2021,
|
||||
Edition2024,
|
||||
),
|
||||
ptr: SyntaxNodePtr {
|
||||
kind: STRUCT,
|
||||
|
@ -382,7 +382,7 @@
|
|||
FileId(
|
||||
0,
|
||||
),
|
||||
Edition2021,
|
||||
Edition2024,
|
||||
),
|
||||
ptr: SyntaxNodePtr {
|
||||
kind: STRUCT,
|
||||
|
@ -415,7 +415,7 @@
|
|||
FileId(
|
||||
0,
|
||||
),
|
||||
Edition2021,
|
||||
Edition2024,
|
||||
),
|
||||
ptr: SyntaxNodePtr {
|
||||
kind: STRUCT,
|
||||
|
@ -446,7 +446,7 @@
|
|||
FileId(
|
||||
0,
|
||||
),
|
||||
Edition2021,
|
||||
Edition2024,
|
||||
),
|
||||
ptr: SyntaxNodePtr {
|
||||
kind: TRAIT,
|
||||
|
@ -479,7 +479,7 @@
|
|||
FileId(
|
||||
0,
|
||||
),
|
||||
Edition2021,
|
||||
Edition2024,
|
||||
),
|
||||
ptr: SyntaxNodePtr {
|
||||
kind: USE_TREE,
|
||||
|
@ -512,7 +512,7 @@
|
|||
FileId(
|
||||
0,
|
||||
),
|
||||
Edition2021,
|
||||
Edition2024,
|
||||
),
|
||||
ptr: SyntaxNodePtr {
|
||||
kind: UNION,
|
||||
|
@ -547,7 +547,7 @@
|
|||
FileId(
|
||||
0,
|
||||
),
|
||||
Edition2021,
|
||||
Edition2024,
|
||||
),
|
||||
ptr: SyntaxNodePtr {
|
||||
kind: MODULE,
|
||||
|
@ -582,7 +582,7 @@
|
|||
FileId(
|
||||
0,
|
||||
),
|
||||
Edition2021,
|
||||
Edition2024,
|
||||
),
|
||||
ptr: SyntaxNodePtr {
|
||||
kind: MODULE,
|
||||
|
@ -615,7 +615,7 @@
|
|||
FileId(
|
||||
0,
|
||||
),
|
||||
Edition2021,
|
||||
Edition2024,
|
||||
),
|
||||
ptr: SyntaxNodePtr {
|
||||
kind: MACRO_RULES,
|
||||
|
@ -646,7 +646,7 @@
|
|||
FileId(
|
||||
0,
|
||||
),
|
||||
Edition2021,
|
||||
Edition2024,
|
||||
),
|
||||
ptr: SyntaxNodePtr {
|
||||
kind: FN,
|
||||
|
@ -679,7 +679,7 @@
|
|||
FileId(
|
||||
0,
|
||||
),
|
||||
Edition2021,
|
||||
Edition2024,
|
||||
),
|
||||
ptr: SyntaxNodePtr {
|
||||
kind: FN,
|
||||
|
@ -714,7 +714,7 @@
|
|||
FileId(
|
||||
0,
|
||||
),
|
||||
Edition2021,
|
||||
Edition2024,
|
||||
),
|
||||
ptr: SyntaxNodePtr {
|
||||
kind: MACRO_RULES,
|
||||
|
@ -745,7 +745,7 @@
|
|||
FileId(
|
||||
0,
|
||||
),
|
||||
Edition2021,
|
||||
Edition2024,
|
||||
),
|
||||
ptr: SyntaxNodePtr {
|
||||
kind: FN,
|
||||
|
@ -778,7 +778,7 @@
|
|||
FileId(
|
||||
0,
|
||||
),
|
||||
Edition2021,
|
||||
Edition2024,
|
||||
),
|
||||
ptr: SyntaxNodePtr {
|
||||
kind: USE_TREE,
|
||||
|
@ -809,7 +809,7 @@
|
|||
FileId(
|
||||
0,
|
||||
),
|
||||
Edition2021,
|
||||
Edition2024,
|
||||
),
|
||||
ptr: SyntaxNodePtr {
|
||||
kind: FN,
|
||||
|
@ -857,7 +857,7 @@
|
|||
FileId(
|
||||
0,
|
||||
),
|
||||
Edition2021,
|
||||
Edition2024,
|
||||
),
|
||||
ptr: SyntaxNodePtr {
|
||||
kind: STRUCT,
|
||||
|
@ -901,7 +901,7 @@
|
|||
FileId(
|
||||
1,
|
||||
),
|
||||
Edition2021,
|
||||
Edition2024,
|
||||
),
|
||||
ptr: SyntaxNodePtr {
|
||||
kind: USE_TREE,
|
||||
|
@ -934,7 +934,7 @@
|
|||
FileId(
|
||||
1,
|
||||
),
|
||||
Edition2021,
|
||||
Edition2024,
|
||||
),
|
||||
ptr: SyntaxNodePtr {
|
||||
kind: USE_TREE,
|
||||
|
@ -967,7 +967,7 @@
|
|||
FileId(
|
||||
1,
|
||||
),
|
||||
Edition2021,
|
||||
Edition2024,
|
||||
),
|
||||
ptr: SyntaxNodePtr {
|
||||
kind: STRUCT,
|
||||
|
@ -1000,7 +1000,7 @@
|
|||
FileId(
|
||||
1,
|
||||
),
|
||||
Edition2021,
|
||||
Edition2024,
|
||||
),
|
||||
ptr: SyntaxNodePtr {
|
||||
kind: USE_TREE,
|
||||
|
@ -1033,7 +1033,7 @@
|
|||
FileId(
|
||||
1,
|
||||
),
|
||||
Edition2021,
|
||||
Edition2024,
|
||||
),
|
||||
ptr: SyntaxNodePtr {
|
||||
kind: USE_TREE,
|
||||
|
|
|
@ -137,13 +137,13 @@ struct HasUnsafe;
|
|||
impl HasUnsafe {
|
||||
unsafe fn unsafe_fn(&self) {
|
||||
let x = &5_usize as *const usize;
|
||||
let _y = *x;
|
||||
let _y = unsafe {*x};
|
||||
}
|
||||
}
|
||||
|
||||
unsafe fn unsafe_fn() {
|
||||
let x = &5_usize as *const usize;
|
||||
let _y = *x;
|
||||
let _y = unsafe {*x};
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
@ -337,7 +337,7 @@ struct S(usize);
|
|||
impl S {
|
||||
unsafe fn func(&self) {
|
||||
let x = &self.0 as *const usize;
|
||||
let _z = *x;
|
||||
let _z = unsafe { *x };
|
||||
}
|
||||
}
|
||||
fn main() {
|
||||
|
@ -350,7 +350,7 @@ struct S(usize);
|
|||
impl S {
|
||||
unsafe fn func(&self) {
|
||||
let x = &self.0 as *const usize;
|
||||
let _z = *x;
|
||||
let _z = unsafe { *x };
|
||||
}
|
||||
}
|
||||
fn main() {
|
||||
|
|
|
@ -1258,7 +1258,7 @@ fn foo(mut foo: Foo) {
|
|||
|
||||
pub struct A {}
|
||||
pub unsafe fn foo(a: *mut A) {
|
||||
let mut b = || -> *mut A { &mut *a };
|
||||
let mut b = || -> *mut A { unsafe { &mut *a } };
|
||||
//^^^^^ 💡 warn: variable does not need to be mutable
|
||||
let _ = b();
|
||||
}
|
||||
|
|
|
@ -2192,8 +2192,8 @@ where T : Bound
|
|||
struct A;
|
||||
impl Bound for A{}
|
||||
fn f() {
|
||||
let gen = Gen::<A>(A);
|
||||
gen.g$0();
|
||||
let g = Gen::<A>(A);
|
||||
g.g$0();
|
||||
}
|
||||
"#,
|
||||
);
|
||||
|
@ -2218,8 +2218,8 @@ where T : Bound
|
|||
struct A;
|
||||
impl Bound for A{}
|
||||
fn f() {
|
||||
let gen = Gen::<A>(A);
|
||||
gen.g$0();
|
||||
let g = Gen::<A>(A);
|
||||
g.g$0();
|
||||
}
|
||||
"#,
|
||||
);
|
||||
|
|
|
@ -1210,13 +1210,13 @@ impl Foo {
|
|||
r#"
|
||||
//- /lib.rs
|
||||
$0
|
||||
macro_rules! gen {
|
||||
macro_rules! generate {
|
||||
() => {
|
||||
#[test]
|
||||
fn foo_test() {}
|
||||
}
|
||||
}
|
||||
macro_rules! gen2 {
|
||||
macro_rules! generate2 {
|
||||
() => {
|
||||
mod tests2 {
|
||||
#[test]
|
||||
|
@ -1224,25 +1224,25 @@ macro_rules! gen2 {
|
|||
}
|
||||
}
|
||||
}
|
||||
macro_rules! gen_main {
|
||||
macro_rules! generate_main {
|
||||
() => {
|
||||
fn main() {}
|
||||
}
|
||||
}
|
||||
mod tests {
|
||||
gen!();
|
||||
generate!();
|
||||
}
|
||||
gen2!();
|
||||
gen_main!();
|
||||
generate2!();
|
||||
generate_main!();
|
||||
"#,
|
||||
expect![[r#"
|
||||
[
|
||||
"(TestMod, NavigationTarget { file_id: FileId(0), full_range: 0..315, name: \"\", kind: Module })",
|
||||
"(TestMod, NavigationTarget { file_id: FileId(0), full_range: 267..292, focus_range: 271..276, name: \"tests\", kind: Module, description: \"mod tests\" })",
|
||||
"(Test, NavigationTarget { file_id: FileId(0), full_range: 283..290, name: \"foo_test\", kind: Function })",
|
||||
"(TestMod, NavigationTarget { file_id: FileId(0), full_range: 293..301, name: \"tests2\", kind: Module, description: \"mod tests2\" }, true)",
|
||||
"(Test, NavigationTarget { file_id: FileId(0), full_range: 293..301, name: \"foo_test2\", kind: Function }, true)",
|
||||
"(Bin, NavigationTarget { file_id: FileId(0), full_range: 302..314, name: \"main\", kind: Function })",
|
||||
"(TestMod, NavigationTarget { file_id: FileId(0), full_range: 0..345, name: \"\", kind: Module })",
|
||||
"(TestMod, NavigationTarget { file_id: FileId(0), full_range: 282..312, focus_range: 286..291, name: \"tests\", kind: Module, description: \"mod tests\" })",
|
||||
"(Test, NavigationTarget { file_id: FileId(0), full_range: 298..310, name: \"foo_test\", kind: Function })",
|
||||
"(TestMod, NavigationTarget { file_id: FileId(0), full_range: 313..326, name: \"tests2\", kind: Module, description: \"mod tests2\" }, true)",
|
||||
"(Test, NavigationTarget { file_id: FileId(0), full_range: 313..326, name: \"foo_test2\", kind: Function }, true)",
|
||||
"(Bin, NavigationTarget { file_id: FileId(0), full_range: 327..344, name: \"main\", kind: Function })",
|
||||
]
|
||||
"#]],
|
||||
);
|
||||
|
|
|
@ -109,8 +109,8 @@ fn unbalanced_brace() {
|
|||
"#,
|
||||
r#""#,
|
||||
expect![[r#"
|
||||
SUBTREE $$ 1:0@0..0#ROOT2021 1:0@0..0#ROOT2021
|
||||
SUBTREE {} 0:0@9..10#ROOT2021 0:0@11..12#ROOT2021
|
||||
SUBTREE $$ 1:0@0..0#ROOT2024 1:0@0..0#ROOT2024
|
||||
SUBTREE {} 0:0@9..10#ROOT2024 0:0@11..12#ROOT2024
|
||||
|
||||
{}"#]],
|
||||
);
|
||||
|
@ -132,25 +132,25 @@ fn token_mapping_smoke_test() {
|
|||
struct MyTraitMap2
|
||||
"#,
|
||||
expect![[r#"
|
||||
SUBTREE $$ 1:0@0..20#ROOT2021 1:0@0..20#ROOT2021
|
||||
IDENT struct 0:0@34..40#ROOT2021
|
||||
IDENT MyTraitMap2 1:0@8..19#ROOT2021
|
||||
SUBTREE {} 0:0@48..49#ROOT2021 0:0@100..101#ROOT2021
|
||||
IDENT map 0:0@58..61#ROOT2021
|
||||
PUNCH : [alone] 0:0@61..62#ROOT2021
|
||||
PUNCH : [joint] 0:0@63..64#ROOT2021
|
||||
PUNCH : [alone] 0:0@64..65#ROOT2021
|
||||
IDENT std 0:0@65..68#ROOT2021
|
||||
PUNCH : [joint] 0:0@68..69#ROOT2021
|
||||
PUNCH : [alone] 0:0@69..70#ROOT2021
|
||||
IDENT collections 0:0@70..81#ROOT2021
|
||||
PUNCH : [joint] 0:0@81..82#ROOT2021
|
||||
PUNCH : [alone] 0:0@82..83#ROOT2021
|
||||
IDENT HashSet 0:0@83..90#ROOT2021
|
||||
PUNCH < [alone] 0:0@90..91#ROOT2021
|
||||
SUBTREE () 0:0@91..92#ROOT2021 0:0@92..93#ROOT2021
|
||||
PUNCH > [joint] 0:0@93..94#ROOT2021
|
||||
PUNCH , [alone] 0:0@94..95#ROOT2021
|
||||
SUBTREE $$ 1:0@0..20#ROOT2024 1:0@0..20#ROOT2024
|
||||
IDENT struct 0:0@34..40#ROOT2024
|
||||
IDENT MyTraitMap2 1:0@8..19#ROOT2024
|
||||
SUBTREE {} 0:0@48..49#ROOT2024 0:0@100..101#ROOT2024
|
||||
IDENT map 0:0@58..61#ROOT2024
|
||||
PUNCH : [alone] 0:0@61..62#ROOT2024
|
||||
PUNCH : [joint] 0:0@63..64#ROOT2024
|
||||
PUNCH : [alone] 0:0@64..65#ROOT2024
|
||||
IDENT std 0:0@65..68#ROOT2024
|
||||
PUNCH : [joint] 0:0@68..69#ROOT2024
|
||||
PUNCH : [alone] 0:0@69..70#ROOT2024
|
||||
IDENT collections 0:0@70..81#ROOT2024
|
||||
PUNCH : [joint] 0:0@81..82#ROOT2024
|
||||
PUNCH : [alone] 0:0@82..83#ROOT2024
|
||||
IDENT HashSet 0:0@83..90#ROOT2024
|
||||
PUNCH < [alone] 0:0@90..91#ROOT2024
|
||||
SUBTREE () 0:0@91..92#ROOT2024 0:0@92..93#ROOT2024
|
||||
PUNCH > [joint] 0:0@93..94#ROOT2024
|
||||
PUNCH , [alone] 0:0@94..95#ROOT2024
|
||||
|
||||
struct MyTraitMap2 {
|
||||
map: ::std::collections::HashSet<()>,
|
||||
|
@ -179,28 +179,28 @@ fn main() {
|
|||
}
|
||||
"#,
|
||||
expect![[r#"
|
||||
SUBTREE $$ 1:0@0..63#ROOT2021 1:0@0..63#ROOT2021
|
||||
IDENT fn 1:0@1..3#ROOT2021
|
||||
IDENT main 1:0@4..8#ROOT2021
|
||||
SUBTREE () 1:0@8..9#ROOT2021 1:0@9..10#ROOT2021
|
||||
SUBTREE {} 1:0@11..12#ROOT2021 1:0@61..62#ROOT2021
|
||||
LITERAL Integer 1 1:0@17..18#ROOT2021
|
||||
PUNCH ; [alone] 1:0@18..19#ROOT2021
|
||||
LITERAL Float 1.0 1:0@24..27#ROOT2021
|
||||
PUNCH ; [alone] 1:0@27..28#ROOT2021
|
||||
SUBTREE () 1:0@33..34#ROOT2021 1:0@39..40#ROOT2021
|
||||
SUBTREE () 1:0@34..35#ROOT2021 1:0@37..38#ROOT2021
|
||||
LITERAL Integer 1 1:0@35..36#ROOT2021
|
||||
PUNCH , [alone] 1:0@36..37#ROOT2021
|
||||
PUNCH , [alone] 1:0@38..39#ROOT2021
|
||||
PUNCH . [alone] 1:0@40..41#ROOT2021
|
||||
LITERAL Float 0.0 1:0@41..44#ROOT2021
|
||||
PUNCH ; [alone] 1:0@44..45#ROOT2021
|
||||
IDENT let 1:0@50..53#ROOT2021
|
||||
IDENT x 1:0@54..55#ROOT2021
|
||||
PUNCH = [alone] 1:0@56..57#ROOT2021
|
||||
LITERAL Integer 1 1:0@58..59#ROOT2021
|
||||
PUNCH ; [alone] 1:0@59..60#ROOT2021
|
||||
SUBTREE $$ 1:0@0..63#ROOT2024 1:0@0..63#ROOT2024
|
||||
IDENT fn 1:0@1..3#ROOT2024
|
||||
IDENT main 1:0@4..8#ROOT2024
|
||||
SUBTREE () 1:0@8..9#ROOT2024 1:0@9..10#ROOT2024
|
||||
SUBTREE {} 1:0@11..12#ROOT2024 1:0@61..62#ROOT2024
|
||||
LITERAL Integer 1 1:0@17..18#ROOT2024
|
||||
PUNCH ; [alone] 1:0@18..19#ROOT2024
|
||||
LITERAL Float 1.0 1:0@24..27#ROOT2024
|
||||
PUNCH ; [alone] 1:0@27..28#ROOT2024
|
||||
SUBTREE () 1:0@33..34#ROOT2024 1:0@39..40#ROOT2024
|
||||
SUBTREE () 1:0@34..35#ROOT2024 1:0@37..38#ROOT2024
|
||||
LITERAL Integer 1 1:0@35..36#ROOT2024
|
||||
PUNCH , [alone] 1:0@36..37#ROOT2024
|
||||
PUNCH , [alone] 1:0@38..39#ROOT2024
|
||||
PUNCH . [alone] 1:0@40..41#ROOT2024
|
||||
LITERAL Float 0.0 1:0@41..44#ROOT2024
|
||||
PUNCH ; [alone] 1:0@44..45#ROOT2024
|
||||
IDENT let 1:0@50..53#ROOT2024
|
||||
IDENT x 1:0@54..55#ROOT2024
|
||||
PUNCH = [alone] 1:0@56..57#ROOT2024
|
||||
LITERAL Integer 1 1:0@58..59#ROOT2024
|
||||
PUNCH ; [alone] 1:0@59..60#ROOT2024
|
||||
|
||||
fn main(){
|
||||
1;
|
||||
|
@ -226,14 +226,14 @@ fn expr_2021() {
|
|||
const { 1 },
|
||||
"#,
|
||||
expect![[r#"
|
||||
SUBTREE $$ 1:0@0..25#ROOT2021 1:0@0..25#ROOT2021
|
||||
IDENT _ 1:0@5..6#ROOT2021
|
||||
PUNCH ; [joint] 0:0@36..37#ROOT2021
|
||||
SUBTREE () 0:0@34..35#ROOT2021 0:0@34..35#ROOT2021
|
||||
IDENT const 1:0@12..17#ROOT2021
|
||||
SUBTREE {} 1:0@18..19#ROOT2021 1:0@22..23#ROOT2021
|
||||
LITERAL Integer 1 1:0@20..21#ROOT2021
|
||||
PUNCH ; [alone] 0:0@39..40#ROOT2021
|
||||
SUBTREE $$ 1:0@0..25#ROOT2024 1:0@0..25#ROOT2024
|
||||
IDENT _ 1:0@5..6#ROOT2024
|
||||
PUNCH ; [joint] 0:0@36..37#ROOT2024
|
||||
SUBTREE () 0:0@34..35#ROOT2024 0:0@34..35#ROOT2024
|
||||
IDENT const 1:0@12..17#ROOT2024
|
||||
SUBTREE {} 1:0@18..19#ROOT2024 1:0@22..23#ROOT2024
|
||||
LITERAL Integer 1 1:0@20..21#ROOT2024
|
||||
PUNCH ; [alone] 0:0@39..40#ROOT2024
|
||||
|
||||
_;
|
||||
(const {
|
||||
|
@ -254,13 +254,13 @@ fn expr_2021() {
|
|||
expect![[r#"
|
||||
ExpandError {
|
||||
inner: (
|
||||
1:0@5..6#ROOT2021,
|
||||
1:0@5..6#ROOT2024,
|
||||
NoMatchingRule,
|
||||
),
|
||||
}
|
||||
|
||||
SUBTREE $$ 1:0@0..8#ROOT2021 1:0@0..8#ROOT2021
|
||||
PUNCH ; [alone] 0:0@39..40#ROOT2021
|
||||
SUBTREE $$ 1:0@0..8#ROOT2024 1:0@0..8#ROOT2024
|
||||
PUNCH ; [alone] 0:0@39..40#ROOT2024
|
||||
|
||||
;"#]],
|
||||
);
|
||||
|
@ -278,13 +278,13 @@ fn expr_2021() {
|
|||
expect![[r#"
|
||||
ExpandError {
|
||||
inner: (
|
||||
1:0@5..10#ROOT2021,
|
||||
1:0@5..10#ROOT2024,
|
||||
NoMatchingRule,
|
||||
),
|
||||
}
|
||||
|
||||
SUBTREE $$ 1:0@0..18#ROOT2021 1:0@0..18#ROOT2021
|
||||
PUNCH ; [alone] 0:0@39..40#ROOT2021
|
||||
SUBTREE $$ 1:0@0..18#ROOT2024 1:0@0..18#ROOT2024
|
||||
PUNCH ; [alone] 0:0@39..40#ROOT2024
|
||||
|
||||
;"#]],
|
||||
);
|
||||
|
@ -304,26 +304,26 @@ fn expr_2021() {
|
|||
break 'foo bar,
|
||||
"#,
|
||||
expect![[r#"
|
||||
SUBTREE $$ 1:0@0..76#ROOT2021 1:0@0..76#ROOT2021
|
||||
LITERAL Integer 4 1:0@5..6#ROOT2021
|
||||
PUNCH ; [joint] 0:0@41..42#ROOT2021
|
||||
LITERAL Str literal 1:0@12..21#ROOT2021
|
||||
PUNCH ; [joint] 0:0@41..42#ROOT2021
|
||||
SUBTREE () 0:0@39..40#ROOT2021 0:0@39..40#ROOT2021
|
||||
IDENT funcall 1:0@27..34#ROOT2021
|
||||
SUBTREE () 1:0@34..35#ROOT2021 1:0@35..36#ROOT2021
|
||||
PUNCH ; [joint] 0:0@41..42#ROOT2021
|
||||
SUBTREE () 0:0@39..40#ROOT2021 0:0@39..40#ROOT2021
|
||||
IDENT future 1:0@42..48#ROOT2021
|
||||
PUNCH . [alone] 1:0@48..49#ROOT2021
|
||||
IDENT await 1:0@49..54#ROOT2021
|
||||
PUNCH ; [joint] 0:0@41..42#ROOT2021
|
||||
SUBTREE () 0:0@39..40#ROOT2021 0:0@39..40#ROOT2021
|
||||
IDENT break 1:0@60..65#ROOT2021
|
||||
PUNCH ' [joint] 1:0@66..67#ROOT2021
|
||||
IDENT foo 1:0@67..70#ROOT2021
|
||||
IDENT bar 1:0@71..74#ROOT2021
|
||||
PUNCH ; [alone] 0:0@44..45#ROOT2021
|
||||
SUBTREE $$ 1:0@0..76#ROOT2024 1:0@0..76#ROOT2024
|
||||
LITERAL Integer 4 1:0@5..6#ROOT2024
|
||||
PUNCH ; [joint] 0:0@41..42#ROOT2024
|
||||
LITERAL Str literal 1:0@12..21#ROOT2024
|
||||
PUNCH ; [joint] 0:0@41..42#ROOT2024
|
||||
SUBTREE () 0:0@39..40#ROOT2024 0:0@39..40#ROOT2024
|
||||
IDENT funcall 1:0@27..34#ROOT2024
|
||||
SUBTREE () 1:0@34..35#ROOT2024 1:0@35..36#ROOT2024
|
||||
PUNCH ; [joint] 0:0@41..42#ROOT2024
|
||||
SUBTREE () 0:0@39..40#ROOT2024 0:0@39..40#ROOT2024
|
||||
IDENT future 1:0@42..48#ROOT2024
|
||||
PUNCH . [alone] 1:0@48..49#ROOT2024
|
||||
IDENT await 1:0@49..54#ROOT2024
|
||||
PUNCH ; [joint] 0:0@41..42#ROOT2024
|
||||
SUBTREE () 0:0@39..40#ROOT2024 0:0@39..40#ROOT2024
|
||||
IDENT break 1:0@60..65#ROOT2024
|
||||
PUNCH ' [joint] 1:0@66..67#ROOT2024
|
||||
IDENT foo 1:0@67..70#ROOT2024
|
||||
IDENT bar 1:0@71..74#ROOT2024
|
||||
PUNCH ; [alone] 0:0@44..45#ROOT2024
|
||||
|
||||
4;
|
||||
"literal";
|
||||
|
@ -345,13 +345,13 @@ fn expr_2021() {
|
|||
expect![[r#"
|
||||
ExpandError {
|
||||
inner: (
|
||||
1:0@5..6#ROOT2021,
|
||||
1:0@5..6#ROOT2024,
|
||||
NoMatchingRule,
|
||||
),
|
||||
}
|
||||
|
||||
SUBTREE $$ 1:0@0..8#ROOT2021 1:0@0..8#ROOT2021
|
||||
PUNCH ; [alone] 0:0@44..45#ROOT2021
|
||||
SUBTREE $$ 1:0@0..8#ROOT2024 1:0@0..8#ROOT2024
|
||||
PUNCH ; [alone] 0:0@44..45#ROOT2024
|
||||
|
||||
;"#]],
|
||||
);
|
||||
|
|
|
@ -132,7 +132,7 @@ pub(super) fn opt_item(p: &mut Parser<'_>, m: Marker, is_in_extern: bool) -> Res
|
|||
has_mods = true;
|
||||
}
|
||||
|
||||
// test_err gen_fn
|
||||
// test_err gen_fn 2021
|
||||
// gen fn gen_fn() {}
|
||||
// async gen fn async_gen_fn() {}
|
||||
if p.at(T![gen]) && p.nth(1) == T![fn] {
|
||||
|
|
|
@ -745,7 +745,12 @@ mod err {
|
|||
run_and_expect_errors("test_data/parser/inline/err/fn_pointer_type_missing_fn.rs");
|
||||
}
|
||||
#[test]
|
||||
fn gen_fn() { run_and_expect_errors("test_data/parser/inline/err/gen_fn.rs"); }
|
||||
fn gen_fn() {
|
||||
run_and_expect_errors_with_edition(
|
||||
"test_data/parser/inline/err/gen_fn.rs",
|
||||
crate::Edition::Edition2021,
|
||||
);
|
||||
}
|
||||
#[test]
|
||||
fn generic_arg_list_recover() {
|
||||
run_and_expect_errors("test_data/parser/inline/err/generic_arg_list_recover.rs");
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
SOURCE_FILE
|
||||
COMMENT "// 2021"
|
||||
WHITESPACE "\n"
|
||||
ERROR
|
||||
PATH
|
||||
PATH_SEGMENT
|
||||
|
@ -42,6 +44,6 @@ SOURCE_FILE
|
|||
L_CURLY "{"
|
||||
R_CURLY "}"
|
||||
WHITESPACE "\n"
|
||||
error 3: expected an item
|
||||
error 24: expected fn, trait or impl
|
||||
error 28: expected an item
|
||||
error 11: expected an item
|
||||
error 32: expected fn, trait or impl
|
||||
error 36: expected an item
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
// 2021
|
||||
gen fn gen_fn() {}
|
||||
async gen fn async_gen_fn() {}
|
||||
|
|
|
@ -12,7 +12,7 @@ fn test_derive_empty() {
|
|||
"DeriveEmpty",
|
||||
r#"struct S;"#,
|
||||
expect!["SUBTREE $$ 1 1"],
|
||||
expect!["SUBTREE $$ 42:2@0..100#ROOT2021 42:2@0..100#ROOT2021"],
|
||||
expect!["SUBTREE $$ 42:2@0..100#ROOT2024 42:2@0..100#ROOT2024"],
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -29,12 +29,12 @@ fn test_derive_error() {
|
|||
LITERAL Str #[derive(DeriveError)] struct S ; 1
|
||||
PUNCH ; [alone] 1"#]],
|
||||
expect![[r#"
|
||||
SUBTREE $$ 42:2@0..100#ROOT2021 42:2@0..100#ROOT2021
|
||||
IDENT compile_error 42:2@0..100#ROOT2021
|
||||
PUNCH ! [alone] 42:2@0..100#ROOT2021
|
||||
SUBTREE () 42:2@0..100#ROOT2021 42:2@0..100#ROOT2021
|
||||
LITERAL Str #[derive(DeriveError)] struct S ; 42:2@0..100#ROOT2021
|
||||
PUNCH ; [alone] 42:2@0..100#ROOT2021"#]],
|
||||
SUBTREE $$ 42:2@0..100#ROOT2024 42:2@0..100#ROOT2024
|
||||
IDENT compile_error 42:2@0..100#ROOT2024
|
||||
PUNCH ! [alone] 42:2@0..100#ROOT2024
|
||||
SUBTREE () 42:2@0..100#ROOT2024 42:2@0..100#ROOT2024
|
||||
LITERAL Str #[derive(DeriveError)] struct S ; 42:2@0..100#ROOT2024
|
||||
PUNCH ; [alone] 42:2@0..100#ROOT2024"#]],
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -53,14 +53,14 @@ fn test_fn_like_macro_noop() {
|
|||
PUNCH , [alone] 1
|
||||
SUBTREE [] 1 1"#]],
|
||||
expect![[r#"
|
||||
SUBTREE $$ 42:2@0..100#ROOT2021 42:2@0..100#ROOT2021
|
||||
IDENT ident 42:2@0..5#ROOT2021
|
||||
PUNCH , [alone] 42:2@5..6#ROOT2021
|
||||
LITERAL Integer 0 42:2@7..8#ROOT2021
|
||||
PUNCH , [alone] 42:2@8..9#ROOT2021
|
||||
LITERAL Integer 1 42:2@10..11#ROOT2021
|
||||
PUNCH , [alone] 42:2@11..12#ROOT2021
|
||||
SUBTREE [] 42:2@13..14#ROOT2021 42:2@14..15#ROOT2021"#]],
|
||||
SUBTREE $$ 42:2@0..100#ROOT2024 42:2@0..100#ROOT2024
|
||||
IDENT ident 42:2@0..5#ROOT2024
|
||||
PUNCH , [alone] 42:2@5..6#ROOT2024
|
||||
LITERAL Integer 0 42:2@7..8#ROOT2024
|
||||
PUNCH , [alone] 42:2@8..9#ROOT2024
|
||||
LITERAL Integer 1 42:2@10..11#ROOT2024
|
||||
PUNCH , [alone] 42:2@11..12#ROOT2024
|
||||
SUBTREE [] 42:2@13..14#ROOT2024 42:2@14..15#ROOT2024"#]],
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -75,10 +75,10 @@ fn test_fn_like_macro_clone_ident_subtree() {
|
|||
PUNCH , [alone] 1
|
||||
SUBTREE [] 1 1"#]],
|
||||
expect![[r#"
|
||||
SUBTREE $$ 42:2@0..100#ROOT2021 42:2@0..100#ROOT2021
|
||||
IDENT ident 42:2@0..5#ROOT2021
|
||||
PUNCH , [alone] 42:2@5..6#ROOT2021
|
||||
SUBTREE [] 42:2@7..8#ROOT2021 42:2@7..8#ROOT2021"#]],
|
||||
SUBTREE $$ 42:2@0..100#ROOT2024 42:2@0..100#ROOT2024
|
||||
IDENT ident 42:2@0..5#ROOT2024
|
||||
PUNCH , [alone] 42:2@5..6#ROOT2024
|
||||
SUBTREE [] 42:2@7..8#ROOT2024 42:2@7..8#ROOT2024"#]],
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -91,8 +91,8 @@ fn test_fn_like_macro_clone_raw_ident() {
|
|||
SUBTREE $$ 1 1
|
||||
IDENT r#async 1"#]],
|
||||
expect![[r#"
|
||||
SUBTREE $$ 42:2@0..100#ROOT2021 42:2@0..100#ROOT2021
|
||||
IDENT r#async 42:2@0..7#ROOT2021"#]],
|
||||
SUBTREE $$ 42:2@0..100#ROOT2024 42:2@0..100#ROOT2024
|
||||
IDENT r#async 42:2@0..7#ROOT2024"#]],
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -105,8 +105,8 @@ fn test_fn_like_fn_like_span_join() {
|
|||
SUBTREE $$ 1 1
|
||||
IDENT r#joined 1"#]],
|
||||
expect![[r#"
|
||||
SUBTREE $$ 42:2@0..100#ROOT2021 42:2@0..100#ROOT2021
|
||||
IDENT r#joined 42:2@0..11#ROOT2021"#]],
|
||||
SUBTREE $$ 42:2@0..100#ROOT2024 42:2@0..100#ROOT2024
|
||||
IDENT r#joined 42:2@0..11#ROOT2024"#]],
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -121,10 +121,10 @@ fn test_fn_like_fn_like_span_ops() {
|
|||
IDENT resolved_at_def_site 1
|
||||
IDENT start_span 1"#]],
|
||||
expect![[r#"
|
||||
SUBTREE $$ 42:2@0..100#ROOT2021 42:2@0..100#ROOT2021
|
||||
IDENT set_def_site 41:1@0..150#ROOT2021
|
||||
IDENT resolved_at_def_site 42:2@13..33#ROOT2021
|
||||
IDENT start_span 42:2@34..34#ROOT2021"#]],
|
||||
SUBTREE $$ 42:2@0..100#ROOT2024 42:2@0..100#ROOT2024
|
||||
IDENT set_def_site 41:1@0..150#ROOT2024
|
||||
IDENT resolved_at_def_site 42:2@13..33#ROOT2024
|
||||
IDENT start_span 42:2@34..34#ROOT2024"#]],
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -143,14 +143,14 @@ fn test_fn_like_mk_literals() {
|
|||
LITERAL Integer 123i64 1
|
||||
LITERAL Integer 123 1"#]],
|
||||
expect![[r#"
|
||||
SUBTREE $$ 42:2@0..100#ROOT2021 42:2@0..100#ROOT2021
|
||||
LITERAL ByteStr byte_string 42:2@0..100#ROOT2021
|
||||
LITERAL Char c 42:2@0..100#ROOT2021
|
||||
LITERAL Str string 42:2@0..100#ROOT2021
|
||||
LITERAL Float 3.14f64 42:2@0..100#ROOT2021
|
||||
LITERAL Float 3.14 42:2@0..100#ROOT2021
|
||||
LITERAL Integer 123i64 42:2@0..100#ROOT2021
|
||||
LITERAL Integer 123 42:2@0..100#ROOT2021"#]],
|
||||
SUBTREE $$ 42:2@0..100#ROOT2024 42:2@0..100#ROOT2024
|
||||
LITERAL ByteStr byte_string 42:2@0..100#ROOT2024
|
||||
LITERAL Char c 42:2@0..100#ROOT2024
|
||||
LITERAL Str string 42:2@0..100#ROOT2024
|
||||
LITERAL Float 3.14f64 42:2@0..100#ROOT2024
|
||||
LITERAL Float 3.14 42:2@0..100#ROOT2024
|
||||
LITERAL Integer 123i64 42:2@0..100#ROOT2024
|
||||
LITERAL Integer 123 42:2@0..100#ROOT2024"#]],
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -164,9 +164,9 @@ fn test_fn_like_mk_idents() {
|
|||
IDENT standard 1
|
||||
IDENT r#raw 1"#]],
|
||||
expect![[r#"
|
||||
SUBTREE $$ 42:2@0..100#ROOT2021 42:2@0..100#ROOT2021
|
||||
IDENT standard 42:2@0..100#ROOT2021
|
||||
IDENT r#raw 42:2@0..100#ROOT2021"#]],
|
||||
SUBTREE $$ 42:2@0..100#ROOT2024 42:2@0..100#ROOT2024
|
||||
IDENT standard 42:2@0..100#ROOT2024
|
||||
IDENT r#raw 42:2@0..100#ROOT2024"#]],
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -198,27 +198,27 @@ fn test_fn_like_macro_clone_literals() {
|
|||
PUNCH , [alone] 1
|
||||
LITERAL CStr null 1"#]],
|
||||
expect![[r#"
|
||||
SUBTREE $$ 42:2@0..100#ROOT2021 42:2@0..100#ROOT2021
|
||||
LITERAL Integer 1u16 42:2@0..4#ROOT2021
|
||||
PUNCH , [alone] 42:2@4..5#ROOT2021
|
||||
LITERAL Integer 2_u32 42:2@6..11#ROOT2021
|
||||
PUNCH , [alone] 42:2@11..12#ROOT2021
|
||||
PUNCH - [alone] 42:2@13..14#ROOT2021
|
||||
LITERAL Integer 4i64 42:2@14..18#ROOT2021
|
||||
PUNCH , [alone] 42:2@18..19#ROOT2021
|
||||
LITERAL Float 3.14f32 42:2@20..27#ROOT2021
|
||||
PUNCH , [alone] 42:2@27..28#ROOT2021
|
||||
LITERAL Str hello bridge 42:2@29..43#ROOT2021
|
||||
PUNCH , [alone] 42:2@43..44#ROOT2021
|
||||
LITERAL Str suffixedsuffix 42:2@45..61#ROOT2021
|
||||
PUNCH , [alone] 42:2@61..62#ROOT2021
|
||||
LITERAL StrRaw(2) raw 42:2@63..73#ROOT2021
|
||||
PUNCH , [alone] 42:2@73..74#ROOT2021
|
||||
LITERAL Char a 42:2@75..78#ROOT2021
|
||||
PUNCH , [alone] 42:2@78..79#ROOT2021
|
||||
LITERAL Byte b 42:2@80..84#ROOT2021
|
||||
PUNCH , [alone] 42:2@84..85#ROOT2021
|
||||
LITERAL CStr null 42:2@86..93#ROOT2021"#]],
|
||||
SUBTREE $$ 42:2@0..100#ROOT2024 42:2@0..100#ROOT2024
|
||||
LITERAL Integer 1u16 42:2@0..4#ROOT2024
|
||||
PUNCH , [alone] 42:2@4..5#ROOT2024
|
||||
LITERAL Integer 2_u32 42:2@6..11#ROOT2024
|
||||
PUNCH , [alone] 42:2@11..12#ROOT2024
|
||||
PUNCH - [alone] 42:2@13..14#ROOT2024
|
||||
LITERAL Integer 4i64 42:2@14..18#ROOT2024
|
||||
PUNCH , [alone] 42:2@18..19#ROOT2024
|
||||
LITERAL Float 3.14f32 42:2@20..27#ROOT2024
|
||||
PUNCH , [alone] 42:2@27..28#ROOT2024
|
||||
LITERAL Str hello bridge 42:2@29..43#ROOT2024
|
||||
PUNCH , [alone] 42:2@43..44#ROOT2024
|
||||
LITERAL Str suffixedsuffix 42:2@45..61#ROOT2024
|
||||
PUNCH , [alone] 42:2@61..62#ROOT2024
|
||||
LITERAL StrRaw(2) raw 42:2@63..73#ROOT2024
|
||||
PUNCH , [alone] 42:2@73..74#ROOT2024
|
||||
LITERAL Char a 42:2@75..78#ROOT2024
|
||||
PUNCH , [alone] 42:2@78..79#ROOT2024
|
||||
LITERAL Byte b 42:2@80..84#ROOT2024
|
||||
PUNCH , [alone] 42:2@84..85#ROOT2024
|
||||
LITERAL CStr null 42:2@86..93#ROOT2024"#]],
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -239,12 +239,12 @@ fn test_attr_macro() {
|
|||
LITERAL Str #[attr_error(some arguments)] mod m {} 1
|
||||
PUNCH ; [alone] 1"#]],
|
||||
expect![[r#"
|
||||
SUBTREE $$ 42:2@0..100#ROOT2021 42:2@0..100#ROOT2021
|
||||
IDENT compile_error 42:2@0..100#ROOT2021
|
||||
PUNCH ! [alone] 42:2@0..100#ROOT2021
|
||||
SUBTREE () 42:2@0..100#ROOT2021 42:2@0..100#ROOT2021
|
||||
LITERAL Str #[attr_error(some arguments)] mod m {} 42:2@0..100#ROOT2021
|
||||
PUNCH ; [alone] 42:2@0..100#ROOT2021"#]],
|
||||
SUBTREE $$ 42:2@0..100#ROOT2024 42:2@0..100#ROOT2024
|
||||
IDENT compile_error 42:2@0..100#ROOT2024
|
||||
PUNCH ! [alone] 42:2@0..100#ROOT2024
|
||||
SUBTREE () 42:2@0..100#ROOT2024 42:2@0..100#ROOT2024
|
||||
LITERAL Str #[attr_error(some arguments)] mod m {} 42:2@0..100#ROOT2024
|
||||
PUNCH ; [alone] 42:2@0..100#ROOT2024"#]],
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -145,6 +145,7 @@ impl ChangeFixture {
|
|||
let mut crates = FxHashMap::default();
|
||||
let mut crate_deps = Vec::new();
|
||||
let mut default_crate_root: Option<FileId> = None;
|
||||
let mut default_edition = Edition::CURRENT;
|
||||
let mut default_cfg = CfgOptions::default();
|
||||
let mut default_env = Env::from_iter([(
|
||||
String::from("__ra_is_test_fixture"),
|
||||
|
@ -228,6 +229,7 @@ impl ChangeFixture {
|
|||
} else if meta.path == "/main.rs" || meta.path == "/lib.rs" {
|
||||
assert!(default_crate_root.is_none());
|
||||
default_crate_root = Some(file_id);
|
||||
default_edition = meta.edition;
|
||||
default_cfg.extend(meta.cfg.into_iter());
|
||||
default_env.extend_from_other(&meta.env);
|
||||
}
|
||||
|
@ -244,7 +246,7 @@ impl ChangeFixture {
|
|||
.expect("missing default crate root, specify a main.rs or lib.rs");
|
||||
crate_graph.add_crate_root(
|
||||
crate_root,
|
||||
Edition::CURRENT,
|
||||
default_edition,
|
||||
Some(CrateName::new("ra_test_fixture").unwrap().into()),
|
||||
None,
|
||||
default_cfg.clone(),
|
||||
|
|
|
@ -423,10 +423,12 @@ pub mod ptr {
|
|||
unsafe { drop_in_place(to_drop) }
|
||||
}
|
||||
pub const unsafe fn read<T>(src: *const T) -> T {
|
||||
*src
|
||||
unsafe { *src }
|
||||
}
|
||||
pub const unsafe fn write<T>(dst: *mut T, src: T) {
|
||||
*dst = src;
|
||||
unsafe {
|
||||
*dst = src;
|
||||
}
|
||||
}
|
||||
// endregion:drop
|
||||
|
||||
|
@ -1480,9 +1482,9 @@ pub mod iter {
|
|||
}
|
||||
}
|
||||
}
|
||||
pub use self::repeat::{repeat, Repeat};
|
||||
pub use self::repeat::{Repeat, repeat};
|
||||
}
|
||||
pub use self::sources::{repeat, Repeat};
|
||||
pub use self::sources::{Repeat, repeat};
|
||||
// endregion:iterators
|
||||
|
||||
mod traits {
|
||||
|
@ -1811,11 +1813,7 @@ pub mod num {
|
|||
#[lang = "bool"]
|
||||
impl bool {
|
||||
pub fn then<T, F: FnOnce() -> T>(self, f: F) -> Option<T> {
|
||||
if self {
|
||||
Some(f())
|
||||
} else {
|
||||
None
|
||||
}
|
||||
if self { Some(f()) } else { None }
|
||||
}
|
||||
}
|
||||
// endregion:bool_impl
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue