mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 04:19:13 +00:00
Use Edition::CURRENT
This commit is contained in:
parent
9c75e9fa7d
commit
83370fe5d7
16 changed files with 17 additions and 19 deletions
1
Cargo.lock
generated
1
Cargo.lock
generated
|
@ -521,7 +521,6 @@ dependencies = [
|
||||||
"limit",
|
"limit",
|
||||||
"mbe",
|
"mbe",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
"parser",
|
|
||||||
"profile",
|
"profile",
|
||||||
"ra-ap-rustc_abi",
|
"ra-ap-rustc_abi",
|
||||||
"ra-ap-rustc_parse_format",
|
"ra-ap-rustc_parse_format",
|
||||||
|
|
|
@ -44,7 +44,6 @@ cfg.workspace = true
|
||||||
tt.workspace = true
|
tt.workspace = true
|
||||||
limit.workspace = true
|
limit.workspace = true
|
||||||
span.workspace = true
|
span.workspace = true
|
||||||
parser.workspace = true
|
|
||||||
|
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
|
|
|
@ -319,7 +319,7 @@ impl ProcMacroExpander for IdentityWhenValidProcMacroExpander {
|
||||||
let (parse, _) = ::mbe::token_tree_to_syntax_node(
|
let (parse, _) = ::mbe::token_tree_to_syntax_node(
|
||||||
subtree,
|
subtree,
|
||||||
::mbe::TopEntryPoint::MacroItems,
|
::mbe::TopEntryPoint::MacroItems,
|
||||||
parser::Edition::Edition2021,
|
span::Edition::CURRENT,
|
||||||
);
|
);
|
||||||
if parse.errors().is_empty() {
|
if parse.errors().is_empty() {
|
||||||
Ok(subtree.clone())
|
Ok(subtree.clone())
|
||||||
|
|
|
@ -534,8 +534,7 @@ impl DefCollector<'_> {
|
||||||
Edition::Edition2015 => name![rust_2015],
|
Edition::Edition2015 => name![rust_2015],
|
||||||
Edition::Edition2018 => name![rust_2018],
|
Edition::Edition2018 => name![rust_2018],
|
||||||
Edition::Edition2021 => name![rust_2021],
|
Edition::Edition2021 => name![rust_2021],
|
||||||
// FIXME: update this when rust_2024 exists
|
Edition::Edition2024 => name![rust_2024],
|
||||||
Edition::Edition2024 => name![rust_2021],
|
|
||||||
};
|
};
|
||||||
|
|
||||||
let path_kind = match self.def_map.data.edition {
|
let path_kind = match self.def_map.data.edition {
|
||||||
|
|
|
@ -207,7 +207,7 @@ fn parse_adt(tt: &tt::Subtree, call_site: Span) -> Result<BasicAdtInfo, ExpandEr
|
||||||
let (parsed, tm) = &mbe::token_tree_to_syntax_node(
|
let (parsed, tm) = &mbe::token_tree_to_syntax_node(
|
||||||
tt,
|
tt,
|
||||||
mbe::TopEntryPoint::MacroItems,
|
mbe::TopEntryPoint::MacroItems,
|
||||||
parser::Edition::Edition2021,
|
parser::Edition::CURRENT,
|
||||||
);
|
);
|
||||||
let macro_items = ast::MacroItems::cast(parsed.syntax_node())
|
let macro_items = ast::MacroItems::cast(parsed.syntax_node())
|
||||||
.ok_or_else(|| ExpandError::other("invalid item definition"))?;
|
.ok_or_else(|| ExpandError::other("invalid item definition"))?;
|
||||||
|
|
|
@ -676,7 +676,7 @@ fn token_tree_to_syntax_node(
|
||||||
ExpandTo::Type => mbe::TopEntryPoint::Type,
|
ExpandTo::Type => mbe::TopEntryPoint::Type,
|
||||||
ExpandTo::Expr => mbe::TopEntryPoint::Expr,
|
ExpandTo::Expr => mbe::TopEntryPoint::Expr,
|
||||||
};
|
};
|
||||||
mbe::token_tree_to_syntax_node(tt, entry_point, parser::Edition::Edition2021)
|
mbe::token_tree_to_syntax_node(tt, entry_point, parser::Edition::CURRENT)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn check_tt_count(tt: &tt::Subtree) -> Result<(), ExpandResult<()>> {
|
fn check_tt_count(tt: &tt::Subtree) -> Result<(), ExpandResult<()>> {
|
||||||
|
|
|
@ -420,7 +420,7 @@ mod tests {
|
||||||
let (parse, _) = mbe::token_tree_to_syntax_node(
|
let (parse, _) = mbe::token_tree_to_syntax_node(
|
||||||
&tt,
|
&tt,
|
||||||
::mbe::TopEntryPoint::MacroItems,
|
::mbe::TopEntryPoint::MacroItems,
|
||||||
parser::Edition::Edition2021,
|
parser::Edition::CURRENT,
|
||||||
);
|
);
|
||||||
assert!(
|
assert!(
|
||||||
parse.errors().is_empty(),
|
parse.errors().is_empty(),
|
||||||
|
|
|
@ -303,6 +303,7 @@ pub mod known {
|
||||||
rust_2015,
|
rust_2015,
|
||||||
rust_2018,
|
rust_2018,
|
||||||
rust_2021,
|
rust_2021,
|
||||||
|
rust_2024,
|
||||||
v1,
|
v1,
|
||||||
new_display,
|
new_display,
|
||||||
new_debug,
|
new_debug,
|
||||||
|
|
|
@ -1157,7 +1157,7 @@ fn iterate_trait_method_candidates(
|
||||||
{
|
{
|
||||||
// FIXME: this should really be using the edition of the method name's span, in case it
|
// FIXME: this should really be using the edition of the method name's span, in case it
|
||||||
// comes from a macro
|
// comes from a macro
|
||||||
if db.crate_graph()[krate].edition < Edition::Edition2021 {
|
if db.crate_graph()[krate].edition < Edition::CURRENT {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -744,7 +744,7 @@ fn match_meta_var(
|
||||||
let fragment = match kind {
|
let fragment = match kind {
|
||||||
MetaVarKind::Path => {
|
MetaVarKind::Path => {
|
||||||
return input
|
return input
|
||||||
.expect_fragment(parser::PrefixEntryPoint::Path, parser::Edition::Edition2021)
|
.expect_fragment(parser::PrefixEntryPoint::Path, parser::Edition::CURRENT)
|
||||||
.map(|it| {
|
.map(|it| {
|
||||||
it.map(|it| tt::TokenTree::subtree_or_wrap(it, delim_span)).map(Fragment::Path)
|
it.map(|it| tt::TokenTree::subtree_or_wrap(it, delim_span)).map(Fragment::Path)
|
||||||
});
|
});
|
||||||
|
@ -773,7 +773,7 @@ fn match_meta_var(
|
||||||
_ => {}
|
_ => {}
|
||||||
};
|
};
|
||||||
return input
|
return input
|
||||||
.expect_fragment(parser::PrefixEntryPoint::Expr, parser::Edition::Edition2021)
|
.expect_fragment(parser::PrefixEntryPoint::Expr, parser::Edition::CURRENT)
|
||||||
.map(|tt| {
|
.map(|tt| {
|
||||||
tt.map(|tt| match tt {
|
tt.map(|tt| match tt {
|
||||||
tt::TokenTree::Leaf(leaf) => tt::Subtree {
|
tt::TokenTree::Leaf(leaf) => tt::Subtree {
|
||||||
|
@ -823,7 +823,7 @@ fn match_meta_var(
|
||||||
return tt_result.map(|it| Some(Fragment::Tokens(it))).into();
|
return tt_result.map(|it| Some(Fragment::Tokens(it))).into();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
input.expect_fragment(fragment, parser::Edition::Edition2021).map(|it| it.map(Fragment::Tokens))
|
input.expect_fragment(fragment, parser::Edition::CURRENT).map(|it| it.map(Fragment::Tokens))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn collect_vars(collector_fun: &mut impl FnMut(SmolStr), pattern: &MetaTemplate) {
|
fn collect_vars(collector_fun: &mut impl FnMut(SmolStr), pattern: &MetaTemplate) {
|
||||||
|
|
|
@ -196,7 +196,7 @@ where
|
||||||
|
|
||||||
while iter.peek_n(0).is_some() {
|
while iter.peek_n(0).is_some() {
|
||||||
let expanded =
|
let expanded =
|
||||||
iter.expect_fragment(parser::PrefixEntryPoint::Expr, parser::Edition::Edition2021);
|
iter.expect_fragment(parser::PrefixEntryPoint::Expr, parser::Edition::CURRENT);
|
||||||
|
|
||||||
res.push(match expanded.value {
|
res.push(match expanded.value {
|
||||||
None => break,
|
None => break,
|
||||||
|
|
|
@ -88,7 +88,7 @@ fn parse_inline_err() {
|
||||||
fn parse(entry: TopEntryPoint, text: &str) -> (String, bool) {
|
fn parse(entry: TopEntryPoint, text: &str) -> (String, bool) {
|
||||||
let lexed = LexedStr::new(text);
|
let lexed = LexedStr::new(text);
|
||||||
let input = lexed.to_input();
|
let input = lexed.to_input();
|
||||||
let output = entry.parse(&input, crate::Edition::Edition2021);
|
let output = entry.parse(&input, crate::Edition::CURRENT);
|
||||||
|
|
||||||
let mut buf = String::new();
|
let mut buf = String::new();
|
||||||
let mut errors = Vec::new();
|
let mut errors = Vec::new();
|
||||||
|
|
|
@ -86,7 +86,7 @@ fn check(entry: PrefixEntryPoint, input: &str, prefix: &str) {
|
||||||
let input = lexed.to_input();
|
let input = lexed.to_input();
|
||||||
|
|
||||||
let mut n_tokens = 0;
|
let mut n_tokens = 0;
|
||||||
for step in entry.parse(&input, crate::Edition::Edition2021).iter() {
|
for step in entry.parse(&input, crate::Edition::CURRENT).iter() {
|
||||||
match step {
|
match step {
|
||||||
Step::Token { n_input_tokens, .. } => n_tokens += n_input_tokens as usize,
|
Step::Token { n_input_tokens, .. } => n_tokens += n_input_tokens as usize,
|
||||||
Step::FloatSplit { .. } => n_tokens += 1,
|
Step::FloatSplit { .. } => n_tokens += 1,
|
||||||
|
|
|
@ -172,7 +172,7 @@ pub use crate::ast::SourceFile;
|
||||||
impl SourceFile {
|
impl SourceFile {
|
||||||
pub fn parse(text: &str) -> Parse<SourceFile> {
|
pub fn parse(text: &str) -> Parse<SourceFile> {
|
||||||
let _p = tracing::span!(tracing::Level::INFO, "SourceFile::parse").entered();
|
let _p = tracing::span!(tracing::Level::INFO, "SourceFile::parse").entered();
|
||||||
let (green, errors) = parsing::parse_text(text, parser::Edition::Edition2021);
|
let (green, errors) = parsing::parse_text(text, parser::Edition::CURRENT);
|
||||||
let root = SyntaxNode::new_root(green.clone());
|
let root = SyntaxNode::new_root(green.clone());
|
||||||
|
|
||||||
assert_eq!(root.kind(), SyntaxKind::SOURCE_FILE);
|
assert_eq!(root.kind(), SyntaxKind::SOURCE_FILE);
|
||||||
|
|
|
@ -27,7 +27,7 @@ pub(crate) fn incremental_reparse(
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some((green, new_errors, old_range)) =
|
if let Some((green, new_errors, old_range)) =
|
||||||
reparse_block(node, edit, parser::Edition::Edition2021)
|
reparse_block(node, edit, parser::Edition::CURRENT)
|
||||||
{
|
{
|
||||||
return Some((green, merge_errors(errors, new_errors, old_range, edit), old_range));
|
return Some((green, merge_errors(errors, new_errors, old_range, edit), old_range));
|
||||||
}
|
}
|
||||||
|
|
|
@ -260,7 +260,7 @@ impl ChangeFixture {
|
||||||
|
|
||||||
let core_crate = crate_graph.add_crate_root(
|
let core_crate = crate_graph.add_crate_root(
|
||||||
core_file,
|
core_file,
|
||||||
Edition::Edition2021,
|
Edition::CURRENT,
|
||||||
Some(CrateDisplayName::from_canonical_name("core".to_owned())),
|
Some(CrateDisplayName::from_canonical_name("core".to_owned())),
|
||||||
None,
|
None,
|
||||||
Default::default(),
|
Default::default(),
|
||||||
|
@ -299,7 +299,7 @@ impl ChangeFixture {
|
||||||
|
|
||||||
let proc_macros_crate = crate_graph.add_crate_root(
|
let proc_macros_crate = crate_graph.add_crate_root(
|
||||||
proc_lib_file,
|
proc_lib_file,
|
||||||
Edition::Edition2021,
|
Edition::CURRENT,
|
||||||
Some(CrateDisplayName::from_canonical_name("proc_macros".to_owned())),
|
Some(CrateDisplayName::from_canonical_name("proc_macros".to_owned())),
|
||||||
None,
|
None,
|
||||||
Default::default(),
|
Default::default(),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue