From 5264f86242b77fb91833b1c4071133f0065076af Mon Sep 17 00:00:00 2001 From: Lukas Wirth Date: Wed, 17 Jul 2024 17:35:40 +0200 Subject: [PATCH 1/7] Encode edition within FileId in the hir layer --- crates/base-db/src/input.rs | 6 +- crates/base-db/src/lib.rs | 17 +- crates/hir-def/src/attr.rs | 7 +- crates/hir-def/src/body/scope.rs | 7 +- crates/hir-def/src/db.rs | 13 +- crates/hir-def/src/nameres.rs | 18 ++- crates/hir-def/src/nameres/collector.rs | 8 +- crates/hir-def/src/nameres/mod_resolution.rs | 14 +- .../hir-def/src/nameres/tests/incremental.rs | 4 +- crates/hir-def/src/test_db.rs | 14 +- crates/hir-expand/src/builtin_derive_macro.rs | 2 +- crates/hir-expand/src/builtin_fn_macro.rs | 22 +-- crates/hir-expand/src/db.rs | 6 +- crates/hir-expand/src/files.rs | 37 ++++- crates/hir-expand/src/fixup.rs | 7 +- crates/hir-expand/src/lib.rs | 16 +- crates/hir-expand/src/quote.rs | 9 +- crates/hir-expand/src/span_map.rs | 4 +- crates/hir-ty/src/consteval/tests.rs | 6 +- crates/hir-ty/src/layout/tests.rs | 4 +- crates/hir-ty/src/mir/eval.rs | 5 +- crates/hir-ty/src/mir/eval/tests.rs | 4 +- crates/hir-ty/src/mir/lower.rs | 3 +- crates/hir-ty/src/test_db.rs | 20 ++- crates/hir-ty/src/tests.rs | 10 +- crates/hir-ty/src/tests/incremental.rs | 12 +- crates/hir/src/has_source.rs | 4 +- crates/hir/src/lib.rs | 14 +- crates/hir/src/semantics.rs | 34 ++-- crates/hir/src/semantics/source_to_def.rs | 12 +- crates/hir/src/symbols.rs | 22 +-- crates/ide-assists/src/assist_context.rs | 10 +- .../ide-assists/src/handlers/auto_import.rs | 4 +- .../src/handlers/bind_unused_param.rs | 2 +- .../ide-assists/src/handlers/bool_to_enum.rs | 2 +- .../convert_named_struct_to_tuple_struct.rs | 4 +- .../convert_tuple_return_type_to_struct.rs | 2 +- .../convert_tuple_struct_to_named_struct.rs | 4 +- .../src/handlers/destructure_tuple_binding.rs | 6 +- .../extract_expressions_from_format_string.rs | 2 +- .../src/handlers/extract_module.rs | 14 +- .../extract_struct_from_enum_variant.rs | 2 +- .../src/handlers/fix_visibility.rs | 12 +- .../src/handlers/generate_constant.rs | 7 +- .../src/handlers/generate_enum_variant.rs | 2 +- .../src/handlers/generate_function.rs | 10 +- .../ide-assists/src/handlers/inline_call.rs | 7 +- .../src/handlers/inline_local_variable.rs | 7 +- .../src/handlers/inline_type_alias.rs | 2 +- .../src/handlers/move_const_to_impl.rs | 4 +- .../src/handlers/move_from_mod_rs.rs | 2 +- .../src/handlers/move_module_to_file.rs | 2 +- .../src/handlers/move_to_mod_rs.rs | 2 +- .../src/handlers/remove_unused_imports.rs | 3 +- .../src/handlers/remove_unused_param.rs | 4 +- .../replace_named_generic_with_impl.rs | 7 +- .../src/handlers/unnecessary_async.rs | 4 +- crates/ide-assists/src/lib.rs | 9 +- crates/ide-assists/src/tests.rs | 36 ++--- crates/ide-assists/src/utils/suggest_name.rs | 4 +- crates/ide-completion/src/completions/mod_.rs | 11 +- crates/ide-completion/src/context.rs | 10 +- crates/ide-completion/src/lib.rs | 5 +- crates/ide-completion/src/snippet.rs | 9 +- crates/ide-completion/src/tests.rs | 6 +- crates/ide-db/src/helpers.rs | 3 +- crates/ide-db/src/imports/insert_use.rs | 2 +- crates/ide-db/src/lib.rs | 11 +- crates/ide-db/src/rename.rs | 22 +-- crates/ide-db/src/search.rs | 78 +++++---- crates/ide-db/src/source_change.rs | 27 ++-- crates/ide-db/src/traits.rs | 2 +- .../src/handlers/field_shorthand.rs | 19 +-- .../src/handlers/json_is_not_rust.rs | 7 +- .../src/handlers/mismatched_arg_count.rs | 2 +- .../src/handlers/no_such_field.rs | 4 +- .../src/handlers/remove_trailing_return.rs | 4 +- .../src/handlers/unlinked_file.rs | 31 ++-- .../src/handlers/unresolved_field.rs | 3 +- .../src/handlers/unresolved_method.rs | 7 +- .../src/handlers/unresolved_module.rs | 2 +- .../src/handlers/unused_variables.rs | 5 +- .../src/handlers/useless_braces.rs | 9 +- crates/ide-diagnostics/src/lib.rs | 21 ++- crates/ide-diagnostics/src/tests.rs | 126 ++++++++------- crates/ide-ssr/src/from_comment.rs | 7 +- crates/ide-ssr/src/lib.rs | 41 +++-- crates/ide-ssr/src/matching.rs | 13 +- crates/ide-ssr/src/resolving.rs | 4 +- crates/ide-ssr/src/search.rs | 12 +- crates/ide-ssr/src/tests.rs | 115 ++++++++------ crates/ide/src/annotations.rs | 6 +- crates/ide/src/annotations/fn_references.rs | 2 +- crates/ide/src/call_hierarchy.rs | 15 +- crates/ide/src/doc_links.rs | 2 +- crates/ide/src/doc_links/tests.rs | 5 +- crates/ide/src/expand_macro.rs | 6 +- crates/ide/src/extend_selection.rs | 2 +- crates/ide/src/fetch_crates.rs | 4 +- crates/ide/src/fixture.rs | 22 +-- crates/ide/src/goto_declaration.rs | 4 +- crates/ide/src/goto_definition.rs | 8 +- crates/ide/src/goto_implementation.rs | 4 +- crates/ide/src/goto_type_definition.rs | 4 +- crates/ide/src/highlight_related.rs | 15 +- crates/ide/src/hover.rs | 7 +- crates/ide/src/hover/tests.rs | 2 +- crates/ide/src/inlay_hints.rs | 11 +- crates/ide/src/inlay_hints/bind_pat.rs | 5 +- crates/ide/src/inlay_hints/chaining.rs | 5 +- crates/ide/src/inlay_hints/closing_brace.rs | 9 +- .../ide/src/inlay_hints/closure_captures.rs | 7 +- crates/ide/src/inlay_hints/closure_ret.rs | 5 +- crates/ide/src/inlay_hints/discriminant.rs | 5 +- crates/ide/src/inlay_hints/implicit_drop.rs | 18 ++- crates/ide/src/inlay_hints/param_name.rs | 8 +- crates/ide/src/interpret_function.rs | 7 +- crates/ide/src/lib.rs | 30 ++-- crates/ide/src/moniker.rs | 6 +- crates/ide/src/move_item.rs | 4 +- crates/ide/src/navigation_target.rs | 15 +- crates/ide/src/parent_module.rs | 8 +- crates/ide/src/references.rs | 12 +- crates/ide/src/rename.rs | 36 +++-- crates/ide/src/runnables.rs | 10 +- crates/ide/src/signature_help.rs | 9 +- crates/ide/src/ssr.rs | 15 +- crates/ide/src/static_index.rs | 17 +- crates/ide/src/status.rs | 7 +- crates/ide/src/syntax_highlighting.rs | 10 +- crates/ide/src/syntax_highlighting/html.rs | 15 +- crates/ide/src/syntax_highlighting/inject.rs | 11 +- crates/ide/src/syntax_tree.rs | 15 +- crates/ide/src/test_explorer.rs | 4 +- crates/ide/src/typing.rs | 12 +- crates/ide/src/typing/on_enter.rs | 5 +- crates/ide/src/view_hir.rs | 5 +- crates/ide/src/view_item_tree.rs | 10 +- crates/ide/src/view_memory_layout.rs | 2 +- crates/ide/src/view_mir.rs | 5 +- crates/mbe/src/syntax_bridge.rs | 10 +- crates/parser/src/edition.rs | 7 +- crates/proc-macro-api/src/msg.rs | 6 +- crates/proc-macro-api/src/msg/flat.rs | 6 +- .../src/server_impl/rust_analyzer_span.rs | 6 +- .../src/server_impl/token_stream.rs | 2 +- crates/proc-macro-srv/src/tests/utils.rs | 6 +- crates/project-model/src/tests.rs | 3 +- crates/project-model/src/workspace.rs | 6 +- .../rust-analyzer/src/cli/analysis_stats.rs | 47 +++--- crates/rust-analyzer/src/cli/diagnostics.rs | 9 +- crates/rust-analyzer/src/cli/scip.rs | 2 +- crates/rust-analyzer/src/cli/ssr.rs | 6 +- crates/rust-analyzer/src/lsp/from_proto.rs | 5 +- crates/span/src/lib.rs | 148 ++++++++++++++---- crates/span/src/map.rs | 11 +- crates/syntax/src/lib.rs | 6 +- crates/syntax/src/parsing/reparsing.rs | 17 +- crates/test-fixture/src/lib.rs | 26 +-- crates/vfs/src/lib.rs | 6 +- 160 files changed, 1117 insertions(+), 824 deletions(-) diff --git a/crates/base-db/src/input.rs b/crates/base-db/src/input.rs index 41b7e271b0..3936fd3555 100644 --- a/crates/base-db/src/input.rs +++ b/crates/base-db/src/input.rs @@ -12,7 +12,7 @@ use cfg::CfgOptions; use intern::Symbol; use la_arena::{Arena, Idx, RawIdx}; use rustc_hash::{FxHashMap, FxHashSet}; -use span::Edition; +use span::{Edition, EditionedFileId}; use triomphe::Arc; use vfs::{file_set::FileSet, AbsPathBuf, AnchoredPath, FileId, VfsPath}; @@ -662,6 +662,10 @@ impl CrateData { fn add_dep(&mut self, dep: Dependency) { self.dependencies.push(dep) } + + pub fn root_file_id(&self) -> EditionedFileId { + EditionedFileId::new(self.root_file_id, self.edition) + } } impl Extend<(String, String)> for Env { diff --git a/crates/base-db/src/lib.rs b/crates/base-db/src/lib.rs index 96fbbc317d..d29828fd50 100644 --- a/crates/base-db/src/lib.rs +++ b/crates/base-db/src/lib.rs @@ -6,8 +6,10 @@ mod input; use std::panic; use salsa::Durability; +use span::EditionedFileId; use syntax::{ast, Parse, SourceFile, SyntaxError}; use triomphe::Arc; +use vfs::FileId; pub use crate::{ change::FileChange, @@ -18,8 +20,7 @@ pub use crate::{ }, }; pub use salsa::{self, Cancelled}; -pub use span::{FilePosition, FileRange}; -pub use vfs::{file_set::FileSet, AnchoredPath, AnchoredPathBuf, FileId, VfsPath}; +pub use vfs::{file_set::FileSet, AnchoredPath, AnchoredPathBuf, VfsPath}; pub use semver::{BuildMetadata, Prerelease, Version, VersionReq}; @@ -58,10 +59,10 @@ pub trait FileLoader { #[salsa::query_group(SourceDatabaseStorage)] pub trait SourceDatabase: FileLoader + std::fmt::Debug { /// Parses the file into the syntax tree. - fn parse(&self, file_id: FileId) -> Parse; + fn parse(&self, file_id: EditionedFileId) -> Parse; /// Returns the set of errors obtained from parsing the file including validation errors. - fn parse_errors(&self, file_id: FileId) -> Option>; + fn parse_errors(&self, file_id: EditionedFileId) -> Option>; /// The crate graph. #[salsa::input] @@ -82,14 +83,14 @@ fn toolchain_channel(db: &dyn SourceDatabase, krate: CrateId) -> Option Parse { +fn parse(db: &dyn SourceDatabase, file_id: EditionedFileId) -> Parse { let _p = tracing::info_span!("parse", ?file_id).entered(); + let (file_id, edition) = file_id.unpack(); let text = db.file_text(file_id); - // FIXME: Edition based parsing - SourceFile::parse(&text, span::Edition::CURRENT) + SourceFile::parse(&text, edition) } -fn parse_errors(db: &dyn SourceDatabase, file_id: FileId) -> Option> { +fn parse_errors(db: &dyn SourceDatabase, file_id: EditionedFileId) -> Option> { let errors = db.parse(file_id).errors(); match &*errors { [] => None, diff --git a/crates/hir-def/src/attr.rs b/crates/hir-def/src/attr.rs index 723d675347..b0f16ad6f4 100644 --- a/crates/hir-def/src/attr.rs +++ b/crates/hir-def/src/attr.rs @@ -657,11 +657,12 @@ mod tests { //! Currently, it tests `#[doc(hidden)]` and `#[doc(alias)]`. use intern::Symbol; + use span::EditionedFileId; use triomphe::Arc; - use base_db::FileId; use hir_expand::span_map::{RealSpanMap, SpanMap}; use mbe::{syntax_node_to_token_tree, DocCommentDesugarMode}; + use span::FileId; use syntax::{ast, AstNode, TextRange}; use crate::attr::{DocAtom, DocExpr}; @@ -669,7 +670,9 @@ mod tests { fn assert_parse_result(input: &str, expected: DocExpr) { let source_file = ast::SourceFile::parse(input, span::Edition::CURRENT).ok().unwrap(); let tt = source_file.syntax().descendants().find_map(ast::TokenTree::cast).unwrap(); - let map = SpanMap::RealSpanMap(Arc::new(RealSpanMap::absolute(FileId::from_raw(0)))); + let map = SpanMap::RealSpanMap(Arc::new(RealSpanMap::absolute( + EditionedFileId::current_edition(FileId::from_raw(0)), + ))); let tt = syntax_node_to_token_tree( tt.syntax(), map.as_ref(), diff --git a/crates/hir-def/src/body/scope.rs b/crates/hir-def/src/body/scope.rs index 3fc244a1e8..404e5ba69c 100644 --- a/crates/hir-def/src/body/scope.rs +++ b/crates/hir-def/src/body/scope.rs @@ -288,8 +288,9 @@ fn compute_expr_scopes( #[cfg(test)] mod tests { - use base_db::{FileId, SourceDatabase}; + use base_db::SourceDatabase; use hir_expand::{name::AsName, InFile}; + use span::FileId; use syntax::{algo::find_node_at_offset, ast, AstNode}; use test_fixture::WithFixture; use test_utils::{assert_eq_text, extract_offset}; @@ -325,7 +326,7 @@ mod tests { let file_syntax = db.parse(file_id).syntax_node(); let marker: ast::PathExpr = find_node_at_offset(&file_syntax, offset).unwrap(); - let function = find_function(&db, file_id); + let function = find_function(&db, file_id.file_id()); let scopes = db.expr_scopes(function.into()); let (_body, source_map) = db.body_with_source_map(function.into()); @@ -480,7 +481,7 @@ fn foo() { .expect("failed to find a name at the target offset"); let name_ref: ast::NameRef = find_node_at_offset(file.syntax(), offset).unwrap(); - let function = find_function(&db, file_id); + let function = find_function(&db, file_id.file_id()); let scopes = db.expr_scopes(function.into()); let (body, source_map) = db.body_with_source_map(function.into()); diff --git a/crates/hir-def/src/db.rs b/crates/hir-def/src/db.rs index 1f728a0b38..1b83808b38 100644 --- a/crates/hir-def/src/db.rs +++ b/crates/hir-def/src/db.rs @@ -1,10 +1,10 @@ //! Defines database & queries for name resolution. -use base_db::{salsa, CrateId, FileId, SourceDatabase, Upcast}; +use base_db::{salsa, CrateId, SourceDatabase, Upcast}; use either::Either; use hir_expand::{db::ExpandDatabase, HirFileId, MacroDefId}; use intern::{sym, Interned}; use la_arena::ArenaMap; -use span::MacroCallId; +use span::{EditionedFileId, MacroCallId}; use syntax::{ast, AstPtr}; use triomphe::Arc; @@ -239,11 +239,14 @@ pub trait DefDatabase: InternDatabase + ExpandDatabase + Upcast bool; - fn include_macro_invoc(&self, crate_id: CrateId) -> Vec<(MacroCallId, FileId)>; + fn include_macro_invoc(&self, crate_id: CrateId) -> Vec<(MacroCallId, EditionedFileId)>; } // return: macro call id and include file id -fn include_macro_invoc(db: &dyn DefDatabase, krate: CrateId) -> Vec<(MacroCallId, FileId)> { +fn include_macro_invoc( + db: &dyn DefDatabase, + krate: CrateId, +) -> Vec<(MacroCallId, EditionedFileId)> { db.crate_def_map(krate) .modules .values() @@ -257,7 +260,7 @@ fn include_macro_invoc(db: &dyn DefDatabase, krate: CrateId) -> Vec<(MacroCallId } fn crate_supports_no_std(db: &dyn DefDatabase, crate_id: CrateId) -> bool { - let file = db.crate_graph()[crate_id].root_file_id; + let file = db.crate_graph()[crate_id].root_file_id(); let item_tree = db.file_item_tree(file.into()); let attrs = item_tree.raw_attrs(AttrOwner::TopLevel); for attr in &**attrs { diff --git a/crates/hir-def/src/nameres.rs b/crates/hir-def/src/nameres.rs index 6861e0f2f5..08a4eab1bc 100644 --- a/crates/hir-def/src/nameres.rs +++ b/crates/hir-def/src/nameres.rs @@ -59,7 +59,7 @@ mod tests; use std::ops::Deref; -use base_db::{CrateId, FileId}; +use base_db::CrateId; use hir_expand::{ name::Name, proc_macro::ProcMacroKind, ErasedAstId, HirFileId, InFile, MacroCallId, MacroDefId, }; @@ -67,7 +67,7 @@ use intern::Symbol; use itertools::Itertools; use la_arena::Arena; use rustc_hash::{FxHashMap, FxHashSet}; -use span::{Edition, FileAstId, ROOT_ERASED_FILE_AST_ID}; +use span::{Edition, EditionedFileId, FileAstId, FileId, ROOT_ERASED_FILE_AST_ID}; use stdx::format_to; use syntax::{ast, SmolStr}; use triomphe::Arc; @@ -244,14 +244,14 @@ impl std::ops::Index for DefMap { #[derive(Debug, PartialEq, Eq, Clone, Copy, Hash)] pub enum ModuleOrigin { CrateRoot { - definition: FileId, + definition: EditionedFileId, }, /// Note that non-inline modules, by definition, live inside non-macro file. File { is_mod_rs: bool, declaration: FileAstId, declaration_tree_id: ItemTreeId, - definition: FileId, + definition: EditionedFileId, }, Inline { definition_tree_id: ItemTreeId, @@ -277,7 +277,7 @@ impl ModuleOrigin { } } - pub fn file_id(&self) -> Option { + pub fn file_id(&self) -> Option { match self { ModuleOrigin::File { definition, .. } | ModuleOrigin::CrateRoot { definition } => { Some(*definition) @@ -339,7 +339,7 @@ impl DefMap { let _p = tracing::info_span!("crate_def_map_query", ?name).entered(); let module_data = ModuleData::new( - ModuleOrigin::CrateRoot { definition: krate.root_file_id }, + ModuleOrigin::CrateRoot { definition: krate.root_file_id() }, Visibility::Public, ); @@ -350,7 +350,7 @@ impl DefMap { None, ); let def_map = - collector::collect_defs(db, def_map, TreeId::new(krate.root_file_id.into(), None)); + collector::collect_defs(db, def_map, TreeId::new(krate.root_file_id().into(), None)); Arc::new(def_map) } @@ -433,7 +433,9 @@ impl DefMap { pub fn modules_for_file(&self, file_id: FileId) -> impl Iterator + '_ { self.modules .iter() - .filter(move |(_id, data)| data.origin.file_id() == Some(file_id)) + .filter(move |(_id, data)| { + data.origin.file_id().map(EditionedFileId::file_id) == Some(file_id) + }) .map(|(id, _data)| id) } diff --git a/crates/hir-def/src/nameres/collector.rs b/crates/hir-def/src/nameres/collector.rs index 07c408fd9e..4b35c1ae71 100644 --- a/crates/hir-def/src/nameres/collector.rs +++ b/crates/hir-def/src/nameres/collector.rs @@ -5,7 +5,7 @@ use std::{cmp::Ordering, iter, mem, ops::Not}; -use base_db::{CrateId, CrateOrigin, Dependency, FileId, LangCrateOrigin}; +use base_db::{CrateId, CrateOrigin, Dependency, LangCrateOrigin}; use cfg::{CfgExpr, CfgOptions}; use either::Either; use hir_expand::{ @@ -22,7 +22,7 @@ use itertools::{izip, Itertools}; use la_arena::Idx; use limit::Limit; use rustc_hash::{FxHashMap, FxHashSet}; -use span::{Edition, ErasedFileAstId, FileAstId, SyntaxContextId}; +use span::{Edition, EditionedFileId, ErasedFileAstId, FileAstId, SyntaxContextId}; use syntax::ast; use triomphe::Arc; @@ -272,7 +272,7 @@ impl DefCollector<'_> { let _p = tracing::info_span!("seed_with_top_level").entered(); let crate_graph = self.db.crate_graph(); - let file_id = crate_graph[self.def_map.krate].root_file_id; + let file_id = crate_graph[self.def_map.krate].root_file_id(); let item_tree = self.db.file_item_tree(file_id.into()); let attrs = item_tree.top_level_attrs(self.db, self.def_map.krate); let crate_data = Arc::get_mut(&mut self.def_map.data).unwrap(); @@ -2003,7 +2003,7 @@ impl ModCollector<'_, '_> { &mut self, name: Name, declaration: FileAstId, - definition: Option<(FileId, bool)>, + definition: Option<(EditionedFileId, bool)>, visibility: &crate::visibility::RawVisibility, mod_tree_id: FileItemTreeId, ) -> LocalModuleId { diff --git a/crates/hir-def/src/nameres/mod_resolution.rs b/crates/hir-def/src/nameres/mod_resolution.rs index 6b34fe50ca..19fdd8e33d 100644 --- a/crates/hir-def/src/nameres/mod_resolution.rs +++ b/crates/hir-def/src/nameres/mod_resolution.rs @@ -1,8 +1,9 @@ //! This module resolves `mod foo;` declaration to file. use arrayvec::ArrayVec; -use base_db::{AnchoredPath, FileId}; +use base_db::AnchoredPath; use hir_expand::{name::Name, HirFileIdExt, MacroFileIdExt}; use limit::Limit; +use span::EditionedFileId; use syntax::ToSmolStr as _; use crate::{db::DefDatabase, HirFileId}; @@ -64,7 +65,7 @@ impl ModDir { file_id: HirFileId, name: &Name, attr_path: Option<&str>, - ) -> Result<(FileId, bool, ModDir), Box<[String]>> { + ) -> Result<(EditionedFileId, bool, ModDir), Box<[String]>> { let name = name.unescaped(); let mut candidate_files = ArrayVec::<_, 2>::new(); @@ -92,7 +93,7 @@ impl ModDir { let orig_file_id = file_id.original_file_respecting_includes(db.upcast()); for candidate in candidate_files.iter() { - let path = AnchoredPath { anchor: orig_file_id, path: candidate.as_str() }; + let path = AnchoredPath { anchor: orig_file_id.file_id(), path: candidate.as_str() }; if let Some(file_id) = db.resolve_path(path) { let is_mod_rs = candidate.ends_with("/mod.rs"); @@ -103,7 +104,12 @@ impl ModDir { DirPath::new(format!("{}/", name.display(db.upcast()))) }; if let Some(mod_dir) = self.child(dir_path, !root_dir_owner) { - return Ok((file_id, is_mod_rs, mod_dir)); + return Ok(( + // FIXME: Edition, is this rightr? + EditionedFileId::new(file_id, orig_file_id.edition()), + is_mod_rs, + mod_dir, + )); } } } diff --git a/crates/hir-def/src/nameres/tests/incremental.rs b/crates/hir-def/src/nameres/tests/incremental.rs index be41634eb5..e82af31850 100644 --- a/crates/hir-def/src/nameres/tests/incremental.rs +++ b/crates/hir-def/src/nameres/tests/incremental.rs @@ -16,7 +16,7 @@ fn check_def_map_is_not_recomputed(ra_fixture_initial: &str, ra_fixture_change: }); assert!(format!("{events:?}").contains("crate_def_map"), "{events:#?}") } - db.set_file_text(pos.file_id, ra_fixture_change); + db.set_file_text(pos.file_id.file_id(), ra_fixture_change); { let events = db.log_executed(|| { @@ -266,7 +266,7 @@ fn quux() { 92 } m!(Y); m!(Z); "#; - db.set_file_text(pos.file_id, new_text); + db.set_file_text(pos.file_id.file_id(), new_text); { let events = db.log_executed(|| { diff --git a/crates/hir-def/src/test_db.rs b/crates/hir-def/src/test_db.rs index 9edb03c7ca..3f002af9d2 100644 --- a/crates/hir-def/src/test_db.rs +++ b/crates/hir-def/src/test_db.rs @@ -4,10 +4,10 @@ use std::{fmt, panic, sync::Mutex}; use base_db::{ salsa::{self, Durability}, - AnchoredPath, CrateId, FileId, FileLoader, FileLoaderDelegate, FilePosition, SourceDatabase, - Upcast, + AnchoredPath, CrateId, FileLoader, FileLoaderDelegate, SourceDatabase, Upcast, }; -use hir_expand::{db::ExpandDatabase, InFile}; +use hir_expand::{db::ExpandDatabase, files::FilePosition, InFile}; +use span::{EditionedFileId, FileId}; use syntax::{algo, ast, AstNode}; use triomphe::Arc; @@ -85,7 +85,7 @@ impl TestDB { for &krate in self.relevant_crates(file_id).iter() { let crate_def_map = self.crate_def_map(krate); for (local_id, data) in crate_def_map.modules() { - if data.origin.file_id() == Some(file_id) { + if data.origin.file_id().map(EditionedFileId::file_id) == Some(file_id) { return crate_def_map.module_id(local_id); } } @@ -94,7 +94,7 @@ impl TestDB { } pub(crate) fn module_at_position(&self, position: FilePosition) -> ModuleId { - let file_module = self.module_for_file(position.file_id); + let file_module = self.module_for_file(position.file_id.file_id()); let mut def_map = file_module.def_map(self); let module = self.mod_at_position(&def_map, position); @@ -122,7 +122,7 @@ impl TestDB { let mut res = DefMap::ROOT; for (module, data) in def_map.modules() { let src = data.definition_source(self); - if src.file_id != position.file_id.into() { + if src.file_id != position.file_id { continue; } @@ -163,7 +163,7 @@ impl TestDB { let mut fn_def = None; for (_, module) in def_map.modules() { let file_id = module.definition_source(self).file_id; - if file_id != position.file_id.into() { + if file_id != position.file_id { continue; } for decl in module.scope.declarations() { diff --git a/crates/hir-expand/src/builtin_derive_macro.rs b/crates/hir-expand/src/builtin_derive_macro.rs index b2924ae673..d168bad703 100644 --- a/crates/hir-expand/src/builtin_derive_macro.rs +++ b/crates/hir-expand/src/builtin_derive_macro.rs @@ -209,7 +209,7 @@ fn parse_adt(tt: &tt::Subtree, call_site: Span) -> Result ExpandResult { let call_site_span = span_with_call_site_ctxt(db, span, id); - let args = parse_exprs_with_sep(tt, ',', call_site_span, Edition::CURRENT); + let args = parse_exprs_with_sep(tt, ',', call_site_span, Edition::CURRENT_FIXME); let dollar_crate = dollar_crate(span); let expanded = match &*args { [cond, panic_args @ ..] => { @@ -686,8 +686,9 @@ fn relative_file( call_id: MacroCallId, path_str: &str, allow_recursion: bool, -) -> Result { - let call_site = call_id.as_macro_file().parent(db).original_file_respecting_includes(db); +) -> Result { + let call_site = + call_id.as_macro_file().parent(db).original_file_respecting_includes(db).file_id(); let path = AnchoredPath { anchor: call_site, path: path_str }; let res = db .resolve_path(path) @@ -696,7 +697,7 @@ fn relative_file( if res == call_site && !allow_recursion { Err(ExpandError::other(format!("recursive inclusion of `{path_str}`"))) } else { - Ok(res) + Ok(EditionedFileId::new(res, Edition::CURRENT_FIXME)) } } @@ -728,11 +729,10 @@ fn include_expand( } }; match parse_to_token_tree( - // FIXME - Edition::CURRENT, + file_id.edition(), SpanAnchor { file_id, ast_id: ROOT_ERASED_FILE_AST_ID }, SyntaxContextId::ROOT, - &db.file_text(file_id), + &db.file_text(file_id.file_id()), ) { Some(it) => ExpandResult::ok(it), None => ExpandResult::new( @@ -746,7 +746,7 @@ pub fn include_input_to_file_id( db: &dyn ExpandDatabase, arg_id: MacroCallId, arg: &tt::Subtree, -) -> Result { +) -> Result { relative_file(db, arg_id, parse_string(arg)?.0.as_str(), false) } @@ -793,7 +793,7 @@ fn include_str_expand( } }; - let text = db.file_text(file_id); + let text = db.file_text(file_id.file_id()); let text = &*text; ExpandResult::ok(quote!(span =>#text)) diff --git a/crates/hir-expand/src/db.rs b/crates/hir-expand/src/db.rs index fbc6e638d7..475ca865a7 100644 --- a/crates/hir-expand/src/db.rs +++ b/crates/hir-expand/src/db.rs @@ -1,11 +1,11 @@ //! Defines database & queries for macro expansion. -use base_db::{salsa, CrateId, FileId, SourceDatabase}; +use base_db::{salsa, CrateId, SourceDatabase}; use either::Either; use limit::Limit; use mbe::{syntax_node_to_token_tree, DocCommentDesugarMode, MatchedArmIndex}; use rustc_hash::FxHashSet; -use span::{AstIdMap, Span, SyntaxContextData, SyntaxContextId}; +use span::{AstIdMap, EditionedFileId, Span, SyntaxContextData, SyntaxContextId}; use syntax::{ast, AstNode, Parse, SyntaxElement, SyntaxError, SyntaxNode, SyntaxToken, T}; use triomphe::Arc; @@ -78,7 +78,7 @@ pub trait ExpandDatabase: SourceDatabase { #[salsa::invoke(crate::span_map::expansion_span_map)] fn expansion_span_map(&self, file_id: MacroFileId) -> Arc; #[salsa::invoke(crate::span_map::real_span_map)] - fn real_span_map(&self, file_id: FileId) -> Arc; + fn real_span_map(&self, file_id: EditionedFileId) -> Arc; /// Macro ids. That's probably the tricksiest bit in rust-analyzer, and the /// reason why we use salsa at all. diff --git a/crates/hir-expand/src/files.rs b/crates/hir-expand/src/files.rs index fc9fa93268..20f484f672 100644 --- a/crates/hir-expand/src/files.rs +++ b/crates/hir-expand/src/files.rs @@ -3,8 +3,8 @@ use std::borrow::Borrow; use either::Either; use span::{ - AstIdNode, ErasedFileAstId, FileAstId, FileId, FileRange, HirFileId, HirFileIdRepr, - MacroFileId, SyntaxContextId, + AstIdNode, EditionedFileId, ErasedFileAstId, FileAstId, HirFileId, HirFileIdRepr, MacroFileId, + SyntaxContextId, }; use syntax::{AstNode, AstPtr, SyntaxNode, SyntaxNodePtr, SyntaxToken, TextRange, TextSize}; @@ -27,7 +27,36 @@ pub struct InFileWrapper { } pub type InFile = InFileWrapper; pub type InMacroFile = InFileWrapper; -pub type InRealFile = InFileWrapper; +pub type InRealFile = InFileWrapper; + +#[derive(Debug, PartialEq, Eq, Clone, Copy, Hash)] +pub struct FilePositionWrapper { + pub file_id: FileKind, + pub offset: TextSize, +} +pub type HirFilePosition = FilePositionWrapper; +pub type MacroFilePosition = FilePositionWrapper; +pub type FilePosition = FilePositionWrapper; + +impl From> for FilePositionWrapper { + fn from(value: FilePositionWrapper) -> Self { + FilePositionWrapper { file_id: value.file_id.into(), offset: value.offset } + } +} +#[derive(Debug, PartialEq, Eq, Clone, Copy, Hash)] +pub struct FileRangeWrapper { + pub file_id: FileKind, + pub range: TextRange, +} +pub type HirFileRange = FileRangeWrapper; +pub type MacroFileRange = FileRangeWrapper; +pub type FileRange = FileRangeWrapper; + +impl From> for FileRangeWrapper { + fn from(value: FileRangeWrapper) -> Self { + FileRangeWrapper { file_id: value.file_id.into(), range: value.range } + } +} /// `AstId` points to an AST node in any file. /// @@ -128,7 +157,7 @@ trait FileIdToSyntax: Copy { fn file_syntax(self, db: &dyn db::ExpandDatabase) -> SyntaxNode; } -impl FileIdToSyntax for FileId { +impl FileIdToSyntax for EditionedFileId { fn file_syntax(self, db: &dyn db::ExpandDatabase) -> SyntaxNode { db.parse(self).syntax_node() } diff --git a/crates/hir-expand/src/fixup.rs b/crates/hir-expand/src/fixup.rs index cf51535630..71579d2f87 100644 --- a/crates/hir-expand/src/fixup.rs +++ b/crates/hir-expand/src/fixup.rs @@ -433,9 +433,9 @@ fn reverse_fixups_(tt: &mut Subtree, undo_info: &[Subtree]) { #[cfg(test)] mod tests { - use base_db::FileId; use expect_test::{expect, Expect}; use mbe::DocCommentDesugarMode; + use span::{Edition, EditionedFileId, FileId}; use syntax::TextRange; use triomphe::Arc; @@ -473,7 +473,10 @@ mod tests { #[track_caller] fn check(ra_fixture: &str, mut expect: Expect) { let parsed = syntax::SourceFile::parse(ra_fixture, span::Edition::CURRENT); - let span_map = SpanMap::RealSpanMap(Arc::new(RealSpanMap::absolute(FileId::from_raw(0)))); + let span_map = SpanMap::RealSpanMap(Arc::new(RealSpanMap::absolute(EditionedFileId::new( + FileId::from_raw(0), + Edition::CURRENT, + )))); let fixups = super::fixup_syntax( span_map.as_ref(), &parsed.syntax_node(), diff --git a/crates/hir-expand/src/lib.rs b/crates/hir-expand/src/lib.rs index 3460d1ca3d..67b7adaf90 100644 --- a/crates/hir-expand/src/lib.rs +++ b/crates/hir-expand/src/lib.rs @@ -30,10 +30,10 @@ use triomphe::Arc; use std::{fmt, hash::Hash}; -use base_db::{salsa::InternValueTrivial, CrateId, FileId}; +use base_db::{salsa::InternValueTrivial, CrateId}; use either::Either; use span::{ - Edition, ErasedFileAstId, FileAstId, FileRange, HirFileIdRepr, Span, SpanAnchor, + Edition, EditionedFileId, ErasedFileAstId, FileAstId, HirFileIdRepr, Span, SpanAnchor, SyntaxContextData, SyntaxContextId, }; use syntax::{ @@ -52,7 +52,7 @@ use crate::{ span_map::{ExpansionSpanMap, SpanMap}, }; -pub use crate::files::{AstId, ErasedAstId, InFile, InMacroFile, InRealFile}; +pub use crate::files::{AstId, ErasedAstId, FileRange, InFile, InMacroFile, InRealFile}; pub use mbe::{DeclarativeMacro, ValueResult}; pub use span::{HirFileId, MacroCallId, MacroFileId}; @@ -243,11 +243,11 @@ pub enum MacroCallKind { pub trait HirFileIdExt { /// Returns the original file of this macro call hierarchy. - fn original_file(self, db: &dyn ExpandDatabase) -> FileId; + fn original_file(self, db: &dyn ExpandDatabase) -> EditionedFileId; /// Returns the original file of this macro call hierarchy while going into the included file if /// one of the calls comes from an `include!``. - fn original_file_respecting_includes(self, db: &dyn ExpandDatabase) -> FileId; + fn original_file_respecting_includes(self, db: &dyn ExpandDatabase) -> EditionedFileId; /// If this is a macro call, returns the syntax node of the very first macro call this file resides in. fn original_call_node(self, db: &dyn ExpandDatabase) -> Option>; @@ -256,7 +256,7 @@ pub trait HirFileIdExt { } impl HirFileIdExt for HirFileId { - fn original_file(self, db: &dyn ExpandDatabase) -> FileId { + fn original_file(self, db: &dyn ExpandDatabase) -> EditionedFileId { let mut file_id = self; loop { match file_id.repr() { @@ -268,7 +268,7 @@ impl HirFileIdExt for HirFileId { } } - fn original_file_respecting_includes(mut self, db: &dyn ExpandDatabase) -> FileId { + fn original_file_respecting_includes(mut self, db: &dyn ExpandDatabase) -> EditionedFileId { loop { match self.repr() { HirFileIdRepr::FileId(id) => break id, @@ -568,7 +568,7 @@ impl MacroCallLoc { &self, db: &dyn ExpandDatabase, macro_call_id: MacroCallId, - ) -> Option { + ) -> Option { if self.def.is_include() { if let MacroCallKind::FnLike { eager: Some(eager), .. } = &self.kind { if let Ok(it) = diff --git a/crates/hir-expand/src/quote.rs b/crates/hir-expand/src/quote.rs index a65d46161e..da02f3aaf9 100644 --- a/crates/hir-expand/src/quote.rs +++ b/crates/hir-expand/src/quote.rs @@ -227,7 +227,6 @@ impl_to_to_tokentrees! { mod tests { use crate::tt; use ::tt::IdentIsRaw; - use base_db::FileId; use expect_test::expect; use intern::Symbol; use span::{SpanAnchor, SyntaxContextId, ROOT_ERASED_FILE_AST_ID}; @@ -235,7 +234,13 @@ mod tests { const DUMMY: tt::Span = tt::Span { range: TextRange::empty(TextSize::new(0)), - anchor: SpanAnchor { file_id: FileId::from_raw(0xe4e4e), ast_id: ROOT_ERASED_FILE_AST_ID }, + anchor: SpanAnchor { + file_id: span::EditionedFileId::new( + span::FileId::from_raw(0xe4e4e), + span::Edition::CURRENT, + ), + ast_id: ROOT_ERASED_FILE_AST_ID, + }, ctx: SyntaxContextId::ROOT, }; diff --git a/crates/hir-expand/src/span_map.rs b/crates/hir-expand/src/span_map.rs index eae2c8fb63..3be88ee9da 100644 --- a/crates/hir-expand/src/span_map.rs +++ b/crates/hir-expand/src/span_map.rs @@ -1,6 +1,6 @@ //! Span maps for real files and macro expansions. -use span::{FileId, HirFileId, HirFileIdRepr, MacroFileId, Span, SyntaxContextId}; +use span::{EditionedFileId, HirFileId, HirFileIdRepr, MacroFileId, Span, SyntaxContextId}; use stdx::TupleExt; use syntax::{ast, AstNode, TextRange}; use triomphe::Arc; @@ -79,7 +79,7 @@ impl SpanMapRef<'_> { } } -pub(crate) fn real_span_map(db: &dyn ExpandDatabase, file_id: FileId) -> Arc { +pub(crate) fn real_span_map(db: &dyn ExpandDatabase, file_id: EditionedFileId) -> Arc { use syntax::ast::HasModuleItem; let mut pairs = vec![(syntax::TextSize::new(0), span::ROOT_ERASED_FILE_AST_ID)]; let ast_id_map = db.ast_id_map(file_id.into()); diff --git a/crates/hir-ty/src/consteval/tests.rs b/crates/hir-ty/src/consteval/tests.rs index 095f2eb6c9..dc3817ce3f 100644 --- a/crates/hir-ty/src/consteval/tests.rs +++ b/crates/hir-ty/src/consteval/tests.rs @@ -1,10 +1,10 @@ -use base_db::FileId; use chalk_ir::Substitution; use hir_def::db::DefDatabase; use rustc_apfloat::{ ieee::{Half as f16, Quad as f128}, Float, }; +use span::EditionedFileId; use test_fixture::WithFixture; use test_utils::skip_slow_tests; @@ -102,8 +102,8 @@ fn pretty_print_err(e: ConstEvalError, db: TestDB) -> String { err } -fn eval_goal(db: &TestDB, file_id: FileId) -> Result { - let module_id = db.module_for_file(file_id); +fn eval_goal(db: &TestDB, file_id: EditionedFileId) -> Result { + let module_id = db.module_for_file(file_id.file_id()); let def_map = module_id.def_map(db); let scope = &def_map[module_id.local_id].scope; let const_id = scope diff --git a/crates/hir-ty/src/layout/tests.rs b/crates/hir-ty/src/layout/tests.rs index e2ddb1bb22..8cb428a610 100644 --- a/crates/hir-ty/src/layout/tests.rs +++ b/crates/hir-ty/src/layout/tests.rs @@ -35,7 +35,7 @@ fn eval_goal(ra_fixture: &str, minicore: &str) -> Result, LayoutErro let adt_or_type_alias_id = file_ids .into_iter() .find_map(|file_id| { - let module_id = db.module_for_file(file_id); + let module_id = db.module_for_file(file_id.file_id()); let def_map = module_id.def_map(&db); let scope = &def_map[module_id.local_id].scope; let adt_or_type_alias_id = scope.declarations().find_map(|x| match x { @@ -87,7 +87,7 @@ fn eval_expr(ra_fixture: &str, minicore: &str) -> Result, LayoutErro ); let (db, file_id) = TestDB::with_single_file(&ra_fixture); - let module_id = db.module_for_file(file_id); + let module_id = db.module_for_file(file_id.file_id()); let def_map = module_id.def_map(&db); let scope = &def_map[module_id.local_id].scope; let function_id = scope diff --git a/crates/hir-ty/src/mir/eval.rs b/crates/hir-ty/src/mir/eval.rs index 8c146aae97..26a49412e0 100644 --- a/crates/hir-ty/src/mir/eval.rs +++ b/crates/hir-ty/src/mir/eval.rs @@ -2,7 +2,7 @@ use std::{borrow::Cow, cell::RefCell, fmt::Write, iter, mem, ops::Range}; -use base_db::{CrateId, FileId}; +use base_db::CrateId; use chalk_ir::{cast::Cast, Mutability}; use either::Either; use hir_def::{ @@ -23,6 +23,7 @@ use rustc_apfloat::{ Float, }; use rustc_hash::{FxHashMap, FxHashSet}; +use span::FileId; use stdx::never; use syntax::{SyntaxNodePtr, TextRange}; use triomphe::Arc; @@ -395,7 +396,7 @@ impl MirEvalError { }; let file_id = span.file_id.original_file(db.upcast()); let text_range = span.value.text_range(); - writeln!(f, "{}", span_formatter(file_id, text_range))?; + writeln!(f, "{}", span_formatter(file_id.file_id(), text_range))?; } } match err { diff --git a/crates/hir-ty/src/mir/eval/tests.rs b/crates/hir-ty/src/mir/eval/tests.rs index c3b35cd553..b21a401fa7 100644 --- a/crates/hir-ty/src/mir/eval/tests.rs +++ b/crates/hir-ty/src/mir/eval/tests.rs @@ -1,5 +1,5 @@ -use base_db::FileId; use hir_def::db::DefDatabase; +use span::EditionedFileId; use syntax::{TextRange, TextSize}; use test_fixture::WithFixture; @@ -7,7 +7,7 @@ use crate::{db::HirDatabase, test_db::TestDB, Interner, Substitution}; use super::{interpret_mir, MirEvalError}; -fn eval_main(db: &TestDB, file_id: FileId) -> Result<(String, String), MirEvalError> { +fn eval_main(db: &TestDB, file_id: EditionedFileId) -> Result<(String, String), MirEvalError> { let module_id = db.module_for_file(file_id); let def_map = module_id.def_map(db); let scope = &def_map[module_id.local_id].scope; diff --git a/crates/hir-ty/src/mir/lower.rs b/crates/hir-ty/src/mir/lower.rs index 1f3c85f0fd..11c1e8ce3c 100644 --- a/crates/hir-ty/src/mir/lower.rs +++ b/crates/hir-ty/src/mir/lower.rs @@ -2,7 +2,7 @@ use std::{fmt::Write, iter, mem}; -use base_db::{salsa::Cycle, FileId}; +use base_db::salsa::Cycle; use chalk_ir::{BoundVar, ConstData, DebruijnIndex, TyKind}; use hir_def::{ body::Body, @@ -21,6 +21,7 @@ use hir_expand::name::Name; use la_arena::ArenaMap; use rustc_apfloat::Float; use rustc_hash::FxHashMap; +use span::FileId; use syntax::TextRange; use triomphe::Arc; diff --git a/crates/hir-ty/src/test_db.rs b/crates/hir-ty/src/test_db.rs index 460aabd733..108ae198d5 100644 --- a/crates/hir-ty/src/test_db.rs +++ b/crates/hir-ty/src/test_db.rs @@ -4,11 +4,12 @@ use std::{fmt, panic, sync::Mutex}; use base_db::{ salsa::{self, Durability}, - AnchoredPath, CrateId, FileId, FileLoader, FileLoaderDelegate, SourceDatabase, Upcast, + AnchoredPath, CrateId, FileLoader, FileLoaderDelegate, SourceDatabase, Upcast, }; use hir_def::{db::DefDatabase, ModuleId}; use hir_expand::db::ExpandDatabase; -use nohash_hasher::IntMap; +use rustc_hash::FxHashMap; +use span::{EditionedFileId, FileId}; use syntax::TextRange; use test_utils::extract_annotations; use triomphe::Arc; @@ -86,11 +87,12 @@ impl FileLoader for TestDB { } impl TestDB { - pub(crate) fn module_for_file_opt(&self, file_id: FileId) -> Option { + pub(crate) fn module_for_file_opt(&self, file_id: impl Into) -> Option { + let file_id = file_id.into(); for &krate in self.relevant_crates(file_id).iter() { let crate_def_map = self.crate_def_map(krate); for (local_id, data) in crate_def_map.modules() { - if data.origin.file_id() == Some(file_id) { + if data.origin.file_id().map(EditionedFileId::file_id) == Some(file_id) { return Some(crate_def_map.module_id(local_id)); } } @@ -98,11 +100,13 @@ impl TestDB { None } - pub(crate) fn module_for_file(&self, file_id: FileId) -> ModuleId { - self.module_for_file_opt(file_id).unwrap() + pub(crate) fn module_for_file(&self, file_id: impl Into) -> ModuleId { + self.module_for_file_opt(file_id.into()).unwrap() } - pub(crate) fn extract_annotations(&self) -> IntMap> { + pub(crate) fn extract_annotations( + &self, + ) -> FxHashMap> { let mut files = Vec::new(); let crate_graph = self.crate_graph(); for krate in crate_graph.iter() { @@ -115,7 +119,7 @@ impl TestDB { files .into_iter() .filter_map(|file_id| { - let text = self.file_text(file_id); + let text = self.file_text(file_id.file_id()); let annotations = extract_annotations(&text); if annotations.is_empty() { return None; diff --git a/crates/hir-ty/src/tests.rs b/crates/hir-ty/src/tests.rs index 2a46becbfd..e67124d57a 100644 --- a/crates/hir-ty/src/tests.rs +++ b/crates/hir-ty/src/tests.rs @@ -12,7 +12,7 @@ mod traits; use std::env; -use base_db::{FileRange, SourceDatabaseExt2 as _}; +use base_db::SourceDatabaseExt2 as _; use expect_test::Expect; use hir_def::{ body::{Body, BodySourceMap, SyntheticSyntax}, @@ -23,7 +23,7 @@ use hir_def::{ src::HasSource, AssocItemId, DefWithBodyId, HasModule, LocalModuleId, Lookup, ModuleDefId, }; -use hir_expand::{db::ExpandDatabase, InFile}; +use hir_expand::{db::ExpandDatabase, FileRange, InFile}; use once_cell::race::OnceBool; use rustc_hash::FxHashMap; use stdx::format_to; @@ -344,7 +344,7 @@ fn infer_with_mismatches(content: &str, include_mismatches: bool) -> String { } else { (node.value.text_range(), node.value.text().to_string().replace('\n', " ")) }; - let macro_prefix = if node.file_id != file_id.into() { "!" } else { "" }; + let macro_prefix = if node.file_id != file_id { "!" } else { "" }; format_to!( buf, "{}{:?} '{}': {}\n", @@ -361,7 +361,7 @@ fn infer_with_mismatches(content: &str, include_mismatches: bool) -> String { }); for (src_ptr, mismatch) in &mismatches { let range = src_ptr.value.text_range(); - let macro_prefix = if src_ptr.file_id != file_id.into() { "!" } else { "" }; + let macro_prefix = if src_ptr.file_id != file_id { "!" } else { "" }; format_to!( buf, "{}{:?}: expected {}, got {}\n", @@ -584,7 +584,7 @@ fn salsa_bug() { } "; - db.set_file_text(pos.file_id, new_text); + db.set_file_text(pos.file_id.file_id(), new_text); let module = db.module_for_file(pos.file_id); let crate_def_map = module.def_map(&db); diff --git a/crates/hir-ty/src/tests/incremental.rs b/crates/hir-ty/src/tests/incremental.rs index 6066ec69c9..e9c62d3416 100644 --- a/crates/hir-ty/src/tests/incremental.rs +++ b/crates/hir-ty/src/tests/incremental.rs @@ -16,7 +16,7 @@ fn foo() -> i32 { ); { let events = db.log_executed(|| { - let module = db.module_for_file(pos.file_id); + let module = db.module_for_file(pos.file_id.file_id()); let crate_def_map = module.def_map(&db); visit_module(&db, &crate_def_map, module.local_id, &mut |def| { db.infer(def); @@ -32,11 +32,11 @@ fn foo() -> i32 { 1 }"; - db.set_file_text(pos.file_id, new_text); + db.set_file_text(pos.file_id.file_id(), new_text); { let events = db.log_executed(|| { - let module = db.module_for_file(pos.file_id); + let module = db.module_for_file(pos.file_id.file_id()); let crate_def_map = module.def_map(&db); visit_module(&db, &crate_def_map, module.local_id, &mut |def| { db.infer(def); @@ -63,7 +63,7 @@ fn baz() -> i32 { ); { let events = db.log_executed(|| { - let module = db.module_for_file(pos.file_id); + let module = db.module_for_file(pos.file_id.file_id()); let crate_def_map = module.def_map(&db); visit_module(&db, &crate_def_map, module.local_id, &mut |def| { db.infer(def); @@ -84,11 +84,11 @@ fn baz() -> i32 { } "; - db.set_file_text(pos.file_id, new_text); + db.set_file_text(pos.file_id.file_id(), new_text); { let events = db.log_executed(|| { - let module = db.module_for_file(pos.file_id); + let module = db.module_for_file(pos.file_id.file_id()); let crate_def_map = module.def_map(&db); visit_module(&db, &crate_def_map, module.local_id, &mut |def| { db.infer(def); diff --git a/crates/hir/src/has_source.rs b/crates/hir/src/has_source.rs index 18e27130f3..7d52a28b91 100644 --- a/crates/hir/src/has_source.rs +++ b/crates/hir/src/has_source.rs @@ -1,6 +1,5 @@ //! Provides set of implementation for hir's objects that allows get back location in file. -use base_db::FileId; use either::Either; use hir_def::{ nameres::{ModuleOrigin, ModuleSource}, @@ -9,6 +8,7 @@ use hir_def::{ }; use hir_expand::{HirFileId, InFile}; use hir_ty::db::InternedClosure; +use span::EditionedFileId; use syntax::ast; use tt::TextRange; @@ -58,7 +58,7 @@ impl Module { } } - pub fn as_source_file_id(self, db: &dyn HirDatabase) -> Option { + pub fn as_source_file_id(self, db: &dyn HirDatabase) -> Option { let def_map = self.id.def_map(db.upcast()); match def_map[self.id.local_id].origin { ModuleOrigin::File { definition, .. } | ModuleOrigin::CrateRoot { definition, .. } => { diff --git a/crates/hir/src/lib.rs b/crates/hir/src/lib.rs index dece4edb88..2bd0008c70 100644 --- a/crates/hir/src/lib.rs +++ b/crates/hir/src/lib.rs @@ -37,7 +37,7 @@ mod display; use std::{mem::discriminant, ops::ControlFlow}; use arrayvec::ArrayVec; -use base_db::{CrateDisplayName, CrateId, CrateOrigin, FileId}; +use base_db::{CrateDisplayName, CrateId, CrateOrigin}; use either::Either; use hir_def::{ body::{BodyDiagnostic, SyntheticSyntax}, @@ -78,7 +78,7 @@ use hir_ty::{ use itertools::Itertools; use nameres::diagnostics::DefDiagnosticKind; use rustc_hash::FxHashSet; -use span::{Edition, MacroCallId}; +use span::{Edition, EditionedFileId, FileId, MacroCallId}; use stdx::{impl_from, never}; use syntax::{ ast::{self, HasAttrs as _, HasName}, @@ -129,12 +129,16 @@ pub use { hir_expand::{ attrs::{Attr, AttrId}, change::ChangeWithProcMacros, + files::{ + FilePosition, FilePositionWrapper, FileRange, FileRangeWrapper, HirFilePosition, + HirFileRange, InFile, InFileWrapper, InMacroFile, InRealFile, MacroFilePosition, + MacroFileRange, + }, hygiene::{marks_rev, SyntaxContextExt}, inert_attr_macro::AttributeTemplate, name::Name, proc_macro::ProcMacros, - tt, ExpandResult, HirFileId, HirFileIdExt, InFile, InMacroFile, InRealFile, MacroFileId, - MacroFileIdExt, + tt, ExpandResult, HirFileId, HirFileIdExt, MacroFileId, MacroFileIdExt, }, hir_ty::{ consteval::ConstEvalError, @@ -3200,7 +3204,7 @@ impl LocalSource { } } - pub fn original_file(&self, db: &dyn HirDatabase) -> FileId { + pub fn original_file(&self, db: &dyn HirDatabase) -> EditionedFileId { self.source.file_id.original_file(db.upcast()) } diff --git a/crates/hir/src/semantics.rs b/crates/hir/src/semantics.rs index f6c88edbff..c053a659b3 100644 --- a/crates/hir/src/semantics.rs +++ b/crates/hir/src/semantics.rs @@ -8,7 +8,6 @@ use std::{ ops::{self, ControlFlow, Not}, }; -use base_db::{FileId, FileRange}; use either::Either; use hir_def::{ hir::Expr, @@ -24,12 +23,12 @@ use hir_expand::{ db::ExpandDatabase, files::InRealFile, name::AsName, - InMacroFile, MacroCallId, MacroFileId, MacroFileIdExt, + FileRange, InMacroFile, MacroCallId, MacroFileId, MacroFileIdExt, }; use itertools::Itertools; use rustc_hash::{FxHashMap, FxHashSet}; use smallvec::{smallvec, SmallVec}; -use span::{Span, SyntaxContextId, ROOT_ERASED_FILE_AST_ID}; +use span::{EditionedFileId, FileId, Span, SyntaxContextId, ROOT_ERASED_FILE_AST_ID}; use stdx::TupleExt; use syntax::{ algo::skip_trivia_token, @@ -225,12 +224,12 @@ impl<'db, DB: HirDatabase> Semantics<'db, DB> { self.imp.resolve_variant(record_lit).map(VariantDef::from) } - pub fn file_to_module_def(&self, file: FileId) -> Option { - self.imp.file_to_module_defs(file).next() + pub fn file_to_module_def(&self, file: impl Into) -> Option { + self.imp.file_to_module_defs(file.into()).next() } - pub fn file_to_module_defs(&self, file: FileId) -> impl Iterator { - self.imp.file_to_module_defs(file) + pub fn file_to_module_defs(&self, file: impl Into) -> impl Iterator { + self.imp.file_to_module_defs(file.into()) } pub fn to_adt_def(&self, a: &ast::Adt) -> Option { @@ -300,7 +299,23 @@ impl<'db> SemanticsImpl<'db> { } } - pub fn parse(&self, file_id: FileId) -> ast::SourceFile { + pub fn parse(&self, file_id: EditionedFileId) -> ast::SourceFile { + let tree = self.db.parse(file_id).tree(); + self.cache(tree.syntax().clone(), file_id.into()); + tree + } + + pub fn attach_first_edition(&self, file: FileId) -> Option { + Some(EditionedFileId::new( + file, + self.file_to_module_defs(file).next()?.krate().edition(self.db), + )) + } + + pub fn parse_guess_edition(&self, file_id: FileId) -> ast::SourceFile { + let file_id = self + .attach_first_edition(file_id) + .unwrap_or_else(|| EditionedFileId::current_edition(file_id)); let tree = self.db.parse(file_id).tree(); self.cache(tree.syntax().clone(), file_id.into()); tree @@ -757,7 +772,7 @@ impl<'db> SemanticsImpl<'db> { // iterate related crates and find all include! invocations that include_file_id matches for (invoc, _) in self .db - .relevant_crates(file_id) + .relevant_crates(file_id.file_id()) .iter() .flat_map(|krate| self.db.include_macro_invoc(*krate)) .filter(|&(_, include_file_id)| include_file_id == file_id) @@ -1089,6 +1104,7 @@ impl<'db> SemanticsImpl<'db> { node.original_file_range_opt(self.db.upcast()) .filter(|(_, ctx)| ctx.is_root()) .map(TupleExt::head) + .map(Into::into) } /// Attempts to map the node out of macro expanded files. diff --git a/crates/hir/src/semantics/source_to_def.rs b/crates/hir/src/semantics/source_to_def.rs index 74ed2640f4..1376dddf67 100644 --- a/crates/hir/src/semantics/source_to_def.rs +++ b/crates/hir/src/semantics/source_to_def.rs @@ -85,7 +85,6 @@ //! active crate for a given position, and then provide an API to resolve all //! syntax nodes against this specific crate. -use base_db::FileId; use either::Either; use hir_def::{ child_by_source::ChildBySource, @@ -103,7 +102,7 @@ use hir_expand::{ }; use rustc_hash::FxHashMap; use smallvec::SmallVec; -use span::MacroFileId; +use span::{FileId, MacroFileId}; use stdx::impl_from; use syntax::{ ast::{self, HasName}, @@ -162,7 +161,7 @@ impl SourceToDefCtx<'_, '_> { } None => { let file_id = src.file_id.original_file(self.db.upcast()); - self.file_to_def(file_id).first().copied() + self.file_to_def(file_id.file_id()).first().copied() } }?; @@ -175,7 +174,7 @@ impl SourceToDefCtx<'_, '_> { pub(super) fn source_file_to_def(&mut self, src: InFile<&ast::SourceFile>) -> Option { let _p = tracing::info_span!("source_file_to_def").entered(); let file_id = src.file_id.original_file(self.db.upcast()); - self.file_to_def(file_id).first().copied() + self.file_to_def(file_id.file_id()).first().copied() } pub(super) fn trait_to_def(&mut self, src: InFile<&ast::Trait>) -> Option { @@ -412,7 +411,10 @@ impl SourceToDefCtx<'_, '_> { return Some(def); } - let def = self.file_to_def(src.file_id.original_file(self.db.upcast())).first().copied()?; + let def = self + .file_to_def(src.file_id.original_file(self.db.upcast()).file_id()) + .first() + .copied()?; Some(def.into()) } diff --git a/crates/hir/src/symbols.rs b/crates/hir/src/symbols.rs index cdfeae1b28..b1f5df681f 100644 --- a/crates/hir/src/symbols.rs +++ b/crates/hir/src/symbols.rs @@ -1,6 +1,5 @@ //! File symbol extraction. -use base_db::FileRange; use hir_def::{ db::DefDatabase, item_scope::ItemInNs, @@ -8,7 +7,7 @@ use hir_def::{ AdtId, AssocItemId, DefWithBodyId, HasModule, ImplId, Lookup, MacroId, ModuleDefId, ModuleId, TraitId, }; -use hir_expand::{HirFileId, InFile}; +use hir_expand::HirFileId; use hir_ty::{db::HirDatabase, display::HirDisplay}; use syntax::{ast::HasName, AstNode, AstPtr, SmolStr, SyntaxNode, SyntaxNodePtr, ToSmolStr}; @@ -42,25 +41,6 @@ impl DeclarationLocation { let root = sema.parse_or_expand(self.hir_file_id); self.ptr.to_node(&root) } - - pub fn original_range(&self, db: &dyn HirDatabase) -> FileRange { - if let Some(file_id) = self.hir_file_id.file_id() { - // fast path to prevent parsing - return FileRange { file_id, range: self.ptr.text_range() }; - } - let node = resolve_node(db, self.hir_file_id, &self.ptr); - node.as_ref().original_file_range_rooted(db.upcast()) - } -} - -fn resolve_node( - db: &dyn HirDatabase, - file_id: HirFileId, - ptr: &SyntaxNodePtr, -) -> InFile { - let root = db.parse_or_expand(file_id); - let node = ptr.to_node(&root); - InFile::new(file_id, node) } /// Represents an outstanding module that the symbol collector must collect symbols from. diff --git a/crates/ide-assists/src/assist_context.rs b/crates/ide-assists/src/assist_context.rs index c459cdb735..1d2d3350f7 100644 --- a/crates/ide-assists/src/assist_context.rs +++ b/crates/ide-assists/src/assist_context.rs @@ -1,8 +1,8 @@ //! See [`AssistContext`]. -use hir::Semantics; -use ide_db::base_db::{FileId, FileRange}; -use ide_db::{label::Label, RootDatabase}; +use hir::{FileRange, Semantics}; +use ide_db::EditionedFileId; +use ide_db::{label::Label, FileId, RootDatabase}; use syntax::{ algo::{self, find_node_at_offset, find_node_at_range}, AstNode, AstToken, Direction, SourceFile, SyntaxElement, SyntaxKind, SyntaxToken, TextRange, @@ -90,7 +90,7 @@ impl<'a> AssistContext<'a> { self.frange.range.start() } - pub(crate) fn file_id(&self) -> FileId { + pub(crate) fn file_id(&self) -> EditionedFileId { self.frange.file_id } @@ -139,7 +139,7 @@ impl Assists { pub(crate) fn new(ctx: &AssistContext<'_>, resolve: AssistResolveStrategy) -> Assists { Assists { resolve, - file: ctx.frange.file_id, + file: ctx.frange.file_id.file_id(), buf: Vec::new(), allowed: ctx.config.allowed.clone(), } diff --git a/crates/ide-assists/src/handlers/auto_import.rs b/crates/ide-assists/src/handlers/auto_import.rs index 37c5d7ce7e..80e80507ad 100644 --- a/crates/ide-assists/src/handlers/auto_import.rs +++ b/crates/ide-assists/src/handlers/auto_import.rs @@ -288,8 +288,8 @@ fn module_distance_heuristic(db: &dyn HirDatabase, current: &Module, item: &Modu mod tests { use super::*; - use hir::Semantics; - use ide_db::{assists::AssistResolveStrategy, base_db::FileRange, RootDatabase}; + use hir::{FileRange, Semantics}; + use ide_db::{assists::AssistResolveStrategy, RootDatabase}; use test_fixture::WithFixture; use crate::tests::{ diff --git a/crates/ide-assists/src/handlers/bind_unused_param.rs b/crates/ide-assists/src/handlers/bind_unused_param.rs index 45c1f0ccae..aba06f38ef 100644 --- a/crates/ide-assists/src/handlers/bind_unused_param.rs +++ b/crates/ide-assists/src/handlers/bind_unused_param.rs @@ -46,7 +46,7 @@ pub(crate) fn bind_unused_param(acc: &mut Assists, ctx: &AssistContext<'_>) -> O &format!("Bind as `let _ = {};`", &ident_pat), param.syntax().text_range(), |builder| { - let line_index = ctx.db().line_index(ctx.file_id()); + let line_index = ctx.db().line_index(ctx.file_id().into()); let indent = func.indent_level(); let text_indent = indent + 1; diff --git a/crates/ide-assists/src/handlers/bool_to_enum.rs b/crates/ide-assists/src/handlers/bool_to_enum.rs index c1fcb8e44d..65fd01fa51 100644 --- a/crates/ide-assists/src/handlers/bool_to_enum.rs +++ b/crates/ide-assists/src/handlers/bool_to_enum.rs @@ -208,7 +208,7 @@ fn replace_usages( delayed_mutations: &mut Vec<(ImportScope, ast::Path)>, ) { for (file_id, references) in usages { - edit.edit_file(file_id); + edit.edit_file(file_id.file_id()); let refs_with_imports = augment_references_with_imports(ctx, references, target_module); diff --git a/crates/ide-assists/src/handlers/convert_named_struct_to_tuple_struct.rs b/crates/ide-assists/src/handlers/convert_named_struct_to_tuple_struct.rs index 43ff115886..3705597927 100644 --- a/crates/ide-assists/src/handlers/convert_named_struct_to_tuple_struct.rs +++ b/crates/ide-assists/src/handlers/convert_named_struct_to_tuple_struct.rs @@ -143,7 +143,7 @@ fn edit_struct_references( let usages = strukt_def.usages(&ctx.sema).include_self_refs().all(); for (file_id, refs) in usages { - edit.edit_file(file_id); + edit.edit_file(file_id.file_id()); for r in refs { process_struct_name_reference(ctx, r, edit); } @@ -221,7 +221,7 @@ fn edit_field_references( let def = Definition::Field(field); let usages = def.usages(&ctx.sema).all(); for (file_id, refs) in usages { - edit.edit_file(file_id); + edit.edit_file(file_id.file_id()); for r in refs { if let Some(name_ref) = r.name.as_name_ref() { // Only edit the field reference if it's part of a `.field` access diff --git a/crates/ide-assists/src/handlers/convert_tuple_return_type_to_struct.rs b/crates/ide-assists/src/handlers/convert_tuple_return_type_to_struct.rs index c55ff24ae3..7432fc7709 100644 --- a/crates/ide-assists/src/handlers/convert_tuple_return_type_to_struct.rs +++ b/crates/ide-assists/src/handlers/convert_tuple_return_type_to_struct.rs @@ -105,7 +105,7 @@ fn replace_usages( target_module: &hir::Module, ) { for (file_id, references) in usages.iter() { - edit.edit_file(*file_id); + edit.edit_file(file_id.file_id()); let refs_with_imports = augment_references_with_imports(edit, ctx, references, struct_name, target_module); diff --git a/crates/ide-assists/src/handlers/convert_tuple_struct_to_named_struct.rs b/crates/ide-assists/src/handlers/convert_tuple_struct_to_named_struct.rs index a77bf403fd..44f31dcb84 100644 --- a/crates/ide-assists/src/handlers/convert_tuple_struct_to_named_struct.rs +++ b/crates/ide-assists/src/handlers/convert_tuple_struct_to_named_struct.rs @@ -188,7 +188,7 @@ fn edit_struct_references( }; for (file_id, refs) in usages { - edit.edit_file(file_id); + edit.edit_file(file_id.file_id()); for r in refs { for node in r.name.syntax().ancestors() { if edit_node(edit, node).is_some() { @@ -213,7 +213,7 @@ fn edit_field_references( let def = Definition::Field(field); let usages = def.usages(&ctx.sema).all(); for (file_id, refs) in usages { - edit.edit_file(file_id); + edit.edit_file(file_id.file_id()); for r in refs { if let Some(name_ref) = r.name.as_name_ref() { edit.replace(ctx.sema.original_range(name_ref.syntax()).range, name.text()); diff --git a/crates/ide-assists/src/handlers/destructure_tuple_binding.rs b/crates/ide-assists/src/handlers/destructure_tuple_binding.rs index 709be51799..9ecfb83ed5 100644 --- a/crates/ide-assists/src/handlers/destructure_tuple_binding.rs +++ b/crates/ide-assists/src/handlers/destructure_tuple_binding.rs @@ -224,7 +224,7 @@ fn edit_tuple_usages( // tree mutation in the same file breaks when `builder.edit_file` // is called - if let Some((_, refs)) = usages.iter().find(|(file_id, _)| **file_id == ctx.file_id()) { + if let Some((_, refs)) = usages.iter().find(|(file_id, _)| *file_id == ctx.file_id()) { current_file_usages = Some( refs.iter() .filter_map(|r| edit_tuple_usage(ctx, edit, r, data, in_sub_pattern)) @@ -233,11 +233,11 @@ fn edit_tuple_usages( } for (file_id, refs) in usages.iter() { - if *file_id == ctx.file_id() { + if file_id == ctx.file_id() { continue; } - edit.edit_file(*file_id); + edit.edit_file(file_id.file_id()); let tuple_edits = refs .iter() diff --git a/crates/ide-assists/src/handlers/extract_expressions_from_format_string.rs b/crates/ide-assists/src/handlers/extract_expressions_from_format_string.rs index 28f645171c..9180d8dfcb 100644 --- a/crates/ide-assists/src/handlers/extract_expressions_from_format_string.rs +++ b/crates/ide-assists/src/handlers/extract_expressions_from_format_string.rs @@ -110,7 +110,7 @@ pub(crate) fn extract_expressions_from_format_string( Arg::Expr(s) => { // insert arg // FIXME: use the crate's edition for parsing - let expr = ast::Expr::parse(&s, syntax::Edition::CURRENT).syntax_node(); + let expr = ast::Expr::parse(&s, syntax::Edition::CURRENT_FIXME).syntax_node(); let mut expr_tt = utils::tt_from_syntax(expr); new_tt_bits.append(&mut expr_tt); } diff --git a/crates/ide-assists/src/handlers/extract_module.rs b/crates/ide-assists/src/handlers/extract_module.rs index 42f935651c..e4cba666af 100644 --- a/crates/ide-assists/src/handlers/extract_module.rs +++ b/crates/ide-assists/src/handlers/extract_module.rs @@ -4,10 +4,9 @@ use either::Either; use hir::{HasSource, HirFileIdExt, ModuleSource}; use ide_db::{ assists::{AssistId, AssistKind}, - base_db::FileId, defs::{Definition, NameClass, NameRefClass}, search::{FileReference, SearchScope}, - FxHashMap, FxHashSet, + FileId, FxHashMap, FxHashSet, }; use itertools::Itertools; use smallvec::SmallVec; @@ -364,7 +363,7 @@ impl Module { None }); - refs_in_files.entry(file_id).or_default().extend(usages); + refs_in_files.entry(file_id.file_id()).or_default().extend(usages); } } @@ -477,8 +476,13 @@ impl Module { } } - let (def_in_mod, def_out_sel) = - check_def_in_mod_and_out_sel(def, ctx, curr_parent_module, selection_range, file_id); + let (def_in_mod, def_out_sel) = check_def_in_mod_and_out_sel( + def, + ctx, + curr_parent_module, + selection_range, + file_id.file_id(), + ); // Find use stmt that use def in current file let use_stmt: Option = usage_res diff --git a/crates/ide-assists/src/handlers/extract_struct_from_enum_variant.rs b/crates/ide-assists/src/handlers/extract_struct_from_enum_variant.rs index 54323e2928..cd483c1b57 100644 --- a/crates/ide-assists/src/handlers/extract_struct_from_enum_variant.rs +++ b/crates/ide-assists/src/handlers/extract_struct_from_enum_variant.rs @@ -72,7 +72,7 @@ pub(crate) fn extract_struct_from_enum_variant( def_file_references = Some(references); continue; } - builder.edit_file(file_id); + builder.edit_file(file_id.file_id()); let processed = process_references( ctx, builder, diff --git a/crates/ide-assists/src/handlers/fix_visibility.rs b/crates/ide-assists/src/handlers/fix_visibility.rs index 759750a550..9950f9c147 100644 --- a/crates/ide-assists/src/handlers/fix_visibility.rs +++ b/crates/ide-assists/src/handlers/fix_visibility.rs @@ -1,7 +1,7 @@ use hir::{ db::HirDatabase, HasSource, HasVisibility, HirFileIdExt, ModuleDef, PathResolution, ScopeDef, }; -use ide_db::base_db::FileId; +use ide_db::FileId; use syntax::{ ast::{self, edit_in_place::HasVisibilityEdit, make, HasVisibility as _}, AstNode, TextRange, ToSmolStr, @@ -128,7 +128,7 @@ fn add_vis_to_referenced_record_field(acc: &mut Assists, ctx: &AssistContext<'_> ); acc.add(AssistId("fix_visibility", AssistKind::QuickFix), assist_label, target, |edit| { - edit.edit_file(target_file); + edit.edit_file(target_file.file_id()); let vis_owner = edit.make_mut(vis_owner); vis_owner.set_visibility(Some(missing_visibility.clone_for_update())); @@ -155,7 +155,11 @@ fn target_data_for_def( let in_file_syntax = source.syntax(); let file_id = in_file_syntax.file_id; let range = in_file_syntax.value.text_range(); - Some((ast::AnyHasVisibility::new(source.value), range, file_id.original_file(db.upcast()))) + Some(( + ast::AnyHasVisibility::new(source.value), + range, + file_id.original_file(db.upcast()).file_id(), + )) } let target_name; @@ -197,7 +201,7 @@ fn target_data_for_def( let in_file_source = m.declaration_source(db)?; let file_id = in_file_source.file_id.original_file(db.upcast()); let range = in_file_source.value.syntax().text_range(); - (ast::AnyHasVisibility::new(in_file_source.value), range, file_id) + (ast::AnyHasVisibility::new(in_file_source.value), range, file_id.file_id()) } // FIXME hir::ModuleDef::Macro(_) => return None, diff --git a/crates/ide-assists/src/handlers/generate_constant.rs b/crates/ide-assists/src/handlers/generate_constant.rs index 4d8116a715..25076dd525 100644 --- a/crates/ide-assists/src/handlers/generate_constant.rs +++ b/crates/ide-assists/src/handlers/generate_constant.rs @@ -2,8 +2,9 @@ use crate::assist_context::{AssistContext, Assists}; use hir::{HasVisibility, HirDisplay, HirFileIdExt, Module}; use ide_db::{ assists::{AssistId, AssistKind}, - base_db::{FileId, Upcast}, + base_db::Upcast, defs::{Definition, NameRefClass}, + FileId, }; use syntax::{ ast::{self, edit::IndentLevel, NameRef}, @@ -139,9 +140,9 @@ fn target_data_for_generate_constant( .any(|it| it.kind() == SyntaxKind::WHITESPACE && it.to_string().contains('\n')); let post_string = if siblings_has_newline { format!("{indent}") } else { format!("\n{indent}") }; - Some((offset, indent + 1, Some(file_id), post_string)) + Some((offset, indent + 1, Some(file_id.file_id()), post_string)) } - _ => Some((TextSize::from(0), 0.into(), Some(file_id), "\n".into())), + _ => Some((TextSize::from(0), 0.into(), Some(file_id.file_id()), "\n".into())), } } diff --git a/crates/ide-assists/src/handlers/generate_enum_variant.rs b/crates/ide-assists/src/handlers/generate_enum_variant.rs index 7faf2d5b13..5d58459121 100644 --- a/crates/ide-assists/src/handlers/generate_enum_variant.rs +++ b/crates/ide-assists/src/handlers/generate_enum_variant.rs @@ -121,7 +121,7 @@ fn add_variant_to_accumulator( "Generate variant", target, |builder| { - builder.edit_file(file_id); + builder.edit_file(file_id.file_id()); let node = builder.make_mut(enum_node); let variant = make_variant(ctx, name_ref, parent); if let Some(it) = node.variant_list() { diff --git a/crates/ide-assists/src/handlers/generate_function.rs b/crates/ide-assists/src/handlers/generate_function.rs index 41693855be..b2980d5c63 100644 --- a/crates/ide-assists/src/handlers/generate_function.rs +++ b/crates/ide-assists/src/handlers/generate_function.rs @@ -3,13 +3,12 @@ use hir::{ StructKind, Type, TypeInfo, }; use ide_db::{ - base_db::FileId, defs::{Definition, NameRefClass}, famous_defs::FamousDefs, helpers::is_editable_crate, path_transform::PathTransform, source_change::SourceChangeBuilder, - FxHashMap, FxHashSet, RootDatabase, SnippetCap, + FileId, FxHashMap, FxHashSet, RootDatabase, SnippetCap, }; use itertools::Itertools; use stdx::to_lower_snake_case; @@ -208,7 +207,8 @@ fn get_adt_source( let file = ctx.sema.parse(range.file_id); let adt_source = ctx.sema.find_node_at_offset_with_macros(file.syntax(), range.range.start())?; - find_struct_impl(ctx, &adt_source, &[fn_name.to_owned()]).map(|impl_| (impl_, range.file_id)) + find_struct_impl(ctx, &adt_source, &[fn_name.to_owned()]) + .map(|impl_| (impl_, range.file_id.file_id())) } struct FunctionBuilder { @@ -482,7 +482,7 @@ fn get_fn_target( target_module: Option, call: CallExpr, ) -> Option<(GeneratedFunctionTarget, FileId)> { - let mut file = ctx.file_id(); + let mut file = ctx.file_id().into(); let target = match target_module { Some(target_module) => { let (in_file, target) = next_space_for_fn_in_module(ctx.db(), target_module); @@ -1168,7 +1168,7 @@ fn next_space_for_fn_in_module( } }; - (file, assist_item) + (file.file_id(), assist_item) } #[derive(Clone, Copy)] diff --git a/crates/ide-assists/src/handlers/inline_call.rs b/crates/ide-assists/src/handlers/inline_call.rs index d0382499b9..5bd204dd57 100644 --- a/crates/ide-assists/src/handlers/inline_call.rs +++ b/crates/ide-assists/src/handlers/inline_call.rs @@ -2,16 +2,15 @@ use std::collections::BTreeSet; use ast::make; use either::Either; -use hir::{db::HirDatabase, sym, PathResolution, Semantics, TypeInfo}; +use hir::{db::HirDatabase, sym, FileRange, PathResolution, Semantics, TypeInfo}; use ide_db::{ - base_db::{FileId, FileRange}, defs::Definition, imports::insert_use::remove_path_if_in_use_stmt, path_transform::PathTransform, search::{FileReference, FileReferenceNode, SearchScope}, source_change::SourceChangeBuilder, syntax_helpers::{insert_whitespace_into_node::insert_ws_into, node_ext::expr_as_name_ref}, - RootDatabase, + EditionedFileId, RootDatabase, }; use itertools::{izip, Itertools}; use syntax::{ @@ -304,7 +303,7 @@ fn get_fn_params( fn inline( sema: &Semantics<'_, RootDatabase>, - function_def_file_id: FileId, + function_def_file_id: EditionedFileId, function: hir::Function, fn_body: &ast::BlockExpr, params: &[(ast::Pat, Option, hir::Param)], diff --git a/crates/ide-assists/src/handlers/inline_local_variable.rs b/crates/ide-assists/src/handlers/inline_local_variable.rs index 5d8ba43ec8..6a1f7f26c9 100644 --- a/crates/ide-assists/src/handlers/inline_local_variable.rs +++ b/crates/ide-assists/src/handlers/inline_local_variable.rs @@ -1,9 +1,8 @@ use hir::{PathResolution, Semantics}; use ide_db::{ - base_db::FileId, defs::Definition, search::{FileReference, FileReferenceNode, UsageSearchResult}, - RootDatabase, + EditionedFileId, RootDatabase, }; use syntax::{ ast::{self, AstNode, AstToken, HasName}, @@ -150,7 +149,7 @@ fn inline_let( sema: &Semantics<'_, RootDatabase>, let_stmt: ast::LetStmt, range: TextRange, - file_id: FileId, + file_id: EditionedFileId, ) -> Option { let bind_pat = match let_stmt.pat()? { ast::Pat::IdentPat(pat) => pat, @@ -185,7 +184,7 @@ fn inline_usage( sema: &Semantics<'_, RootDatabase>, path_expr: ast::PathExpr, range: TextRange, - file_id: FileId, + file_id: EditionedFileId, ) -> Option { let path = path_expr.path()?; let name = path.as_single_name_ref()?; diff --git a/crates/ide-assists/src/handlers/inline_type_alias.rs b/crates/ide-assists/src/handlers/inline_type_alias.rs index e2f3d9edcd..f6624d6c87 100644 --- a/crates/ide-assists/src/handlers/inline_type_alias.rs +++ b/crates/ide-assists/src/handlers/inline_type_alias.rs @@ -92,7 +92,7 @@ pub(crate) fn inline_type_alias_uses(acc: &mut Assists, ctx: &AssistContext<'_>) }; for (file_id, refs) in usages.into_iter() { - inline_refs_for_file(file_id, refs); + inline_refs_for_file(file_id.file_id(), refs); } if !definition_deleted { builder.edit_file(ctx.file_id()); diff --git a/crates/ide-assists/src/handlers/move_const_to_impl.rs b/crates/ide-assists/src/handlers/move_const_to_impl.rs index 22d536b5af..3057745a97 100644 --- a/crates/ide-assists/src/handlers/move_const_to_impl.rs +++ b/crates/ide-assists/src/handlers/move_const_to_impl.rs @@ -1,5 +1,5 @@ -use hir::{AsAssocItem, AssocItemContainer, HasCrate, HasSource}; -use ide_db::{assists::AssistId, base_db::FileRange, defs::Definition, search::SearchScope}; +use hir::{AsAssocItem, AssocItemContainer, FileRange, HasCrate, HasSource}; +use ide_db::{assists::AssistId, defs::Definition, search::SearchScope}; use syntax::{ ast::{self, edit::IndentLevel, edit_in_place::Indent, AstNode}, SyntaxKind, diff --git a/crates/ide-assists/src/handlers/move_from_mod_rs.rs b/crates/ide-assists/src/handlers/move_from_mod_rs.rs index a256f60c42..14381085a7 100644 --- a/crates/ide-assists/src/handlers/move_from_mod_rs.rs +++ b/crates/ide-assists/src/handlers/move_from_mod_rs.rs @@ -41,7 +41,7 @@ pub(crate) fn move_from_mod_rs(acc: &mut Assists, ctx: &AssistContext<'_>) -> Op let target = source_file.syntax().text_range(); let module_name = module.name(ctx.db())?.display(ctx.db()).to_string(); let path = format!("../{module_name}.rs"); - let dst = AnchoredPathBuf { anchor: ctx.file_id(), path }; + let dst = AnchoredPathBuf { anchor: ctx.file_id().into(), path }; acc.add( AssistId("move_from_mod_rs", AssistKind::Refactor), format!("Convert {module_name}/mod.rs to {module_name}.rs"), diff --git a/crates/ide-assists/src/handlers/move_module_to_file.rs b/crates/ide-assists/src/handlers/move_module_to_file.rs index 802dca9fad..e679a68f44 100644 --- a/crates/ide-assists/src/handlers/move_module_to_file.rs +++ b/crates/ide-assists/src/handlers/move_module_to_file.rs @@ -104,7 +104,7 @@ pub(crate) fn move_module_to_file(acc: &mut Assists, ctx: &AssistContext<'_>) -> buf, ); - let dst = AnchoredPathBuf { anchor: ctx.file_id(), path }; + let dst = AnchoredPathBuf { anchor: ctx.file_id().into(), path }; builder.create_file(dst, contents); }, ) diff --git a/crates/ide-assists/src/handlers/move_to_mod_rs.rs b/crates/ide-assists/src/handlers/move_to_mod_rs.rs index a8a124eebb..c89d54ff03 100644 --- a/crates/ide-assists/src/handlers/move_to_mod_rs.rs +++ b/crates/ide-assists/src/handlers/move_to_mod_rs.rs @@ -41,7 +41,7 @@ pub(crate) fn move_to_mod_rs(acc: &mut Assists, ctx: &AssistContext<'_>) -> Opti let target = source_file.syntax().text_range(); let module_name = module.name(ctx.db())?.display(ctx.db()).to_string(); let path = format!("./{module_name}/mod.rs"); - let dst = AnchoredPathBuf { anchor: ctx.file_id(), path }; + let dst = AnchoredPathBuf { anchor: ctx.file_id().into(), path }; acc.add( AssistId("move_to_mod_rs", AssistKind::Refactor), format!("Convert {module_name}.rs to {module_name}/mod.rs"), diff --git a/crates/ide-assists/src/handlers/remove_unused_imports.rs b/crates/ide-assists/src/handlers/remove_unused_imports.rs index b653f3b665..d4fdc072fb 100644 --- a/crates/ide-assists/src/handlers/remove_unused_imports.rs +++ b/crates/ide-assists/src/handlers/remove_unused_imports.rs @@ -1,8 +1,7 @@ use std::collections::hash_map::Entry; -use hir::{HirFileIdExt, InFile, InRealFile, Module, ModuleSource}; +use hir::{FileRange, HirFileIdExt, InFile, InRealFile, Module, ModuleSource}; use ide_db::{ - base_db::FileRange, defs::Definition, search::{FileReference, ReferenceCategory, SearchScope}, FxHashMap, RootDatabase, diff --git a/crates/ide-assists/src/handlers/remove_unused_param.rs b/crates/ide-assists/src/handlers/remove_unused_param.rs index 0772b168d4..376243c268 100644 --- a/crates/ide-assists/src/handlers/remove_unused_param.rs +++ b/crates/ide-assists/src/handlers/remove_unused_param.rs @@ -1,4 +1,4 @@ -use ide_db::{base_db::FileId, defs::Definition, search::FileReference}; +use ide_db::{defs::Definition, search::FileReference, EditionedFileId}; use syntax::{ algo::find_node_at_range, ast::{self, HasArgList}, @@ -90,7 +90,7 @@ pub(crate) fn remove_unused_param(acc: &mut Assists, ctx: &AssistContext<'_>) -> fn process_usages( ctx: &AssistContext<'_>, builder: &mut SourceChangeBuilder, - file_id: FileId, + file_id: EditionedFileId, references: Vec, arg_to_remove: usize, is_self_present: bool, diff --git a/crates/ide-assists/src/handlers/replace_named_generic_with_impl.rs b/crates/ide-assists/src/handlers/replace_named_generic_with_impl.rs index e61ce48172..8a6c2937d9 100644 --- a/crates/ide-assists/src/handlers/replace_named_generic_with_impl.rs +++ b/crates/ide-assists/src/handlers/replace_named_generic_with_impl.rs @@ -1,9 +1,8 @@ -use hir::Semantics; +use hir::{FileRange, Semantics}; use ide_db::{ - base_db::{FileId, FileRange}, defs::Definition, search::{SearchScope, UsageSearchResult}, - RootDatabase, + EditionedFileId, RootDatabase, }; use syntax::{ ast::{ @@ -157,7 +156,7 @@ fn find_usages( sema: &Semantics<'_, RootDatabase>, fn_: &ast::Fn, type_param_def: Definition, - file_id: FileId, + file_id: EditionedFileId, ) -> UsageSearchResult { let file_range = FileRange { file_id, range: fn_.syntax().text_range() }; type_param_def.usages(sema).in_scope(&SearchScope::file_range(file_range)).all() diff --git a/crates/ide-assists/src/handlers/unnecessary_async.rs b/crates/ide-assists/src/handlers/unnecessary_async.rs index b2e8c4cf9f..a83b27867b 100644 --- a/crates/ide-assists/src/handlers/unnecessary_async.rs +++ b/crates/ide-assists/src/handlers/unnecessary_async.rs @@ -1,9 +1,9 @@ use ide_db::{ assists::{AssistId, AssistKind}, - base_db::FileId, defs::Definition, search::{FileReference, FileReferenceNode}, syntax_helpers::node_ext::full_path_of_name_ref, + EditionedFileId, }; use syntax::{ ast::{self, NameRef}, @@ -95,7 +95,7 @@ pub(crate) fn unnecessary_async(acc: &mut Assists, ctx: &AssistContext<'_>) -> O fn find_all_references( ctx: &AssistContext<'_>, def: &Definition, -) -> impl Iterator { +) -> impl Iterator { def.usages(&ctx.sema).all().into_iter().flat_map(|(file_id, references)| { references.into_iter().map(move |reference| (file_id, reference)) }) diff --git a/crates/ide-assists/src/lib.rs b/crates/ide-assists/src/lib.rs index 685d230dc6..a9399ba6b7 100644 --- a/crates/ide-assists/src/lib.rs +++ b/crates/ide-assists/src/lib.rs @@ -65,7 +65,7 @@ mod tests; pub mod utils; use hir::Semantics; -use ide_db::{base_db::FileRange, RootDatabase}; +use ide_db::{EditionedFileId, RootDatabase}; use syntax::TextRange; pub(crate) use crate::assist_context::{AssistContext, Assists}; @@ -83,10 +83,13 @@ pub fn assists( db: &RootDatabase, config: &AssistConfig, resolve: AssistResolveStrategy, - range: FileRange, + range: ide_db::FileRange, ) -> Vec { let sema = Semantics::new(db); - let ctx = AssistContext::new(sema, config, range); + let file_id = sema + .attach_first_edition(range.file_id) + .unwrap_or_else(|| EditionedFileId::current_edition(range.file_id)); + let ctx = AssistContext::new(sema, config, hir::FileRange { file_id, range: range.range }); let mut acc = Assists::new(&ctx, resolve); handlers::all().iter().for_each(|handler| { handler(&mut acc, &ctx); diff --git a/crates/ide-assists/src/tests.rs b/crates/ide-assists/src/tests.rs index 29dac4c550..e42be636d7 100644 --- a/crates/ide-assists/src/tests.rs +++ b/crates/ide-assists/src/tests.rs @@ -1,12 +1,12 @@ mod generated; use expect_test::expect; -use hir::Semantics; +use hir::{FileRange, Semantics}; use ide_db::{ - base_db::{FileId, FileRange, SourceDatabaseExt}, + base_db::SourceDatabaseExt, imports::insert_use::{ImportGranularity, InsertUseConfig}, source_change::FileSystemEdit, - RootDatabase, SnippetCap, + EditionedFileId, RootDatabase, SnippetCap, }; use stdx::{format_to, trim_indent}; use syntax::TextRange; @@ -72,7 +72,7 @@ pub(crate) const TEST_CONFIG_IMPORT_ONE: AssistConfig = AssistConfig { term_search_borrowck: true, }; -pub(crate) fn with_single_file(text: &str) -> (RootDatabase, FileId) { +pub(crate) fn with_single_file(text: &str) -> (RootDatabase, EditionedFileId) { RootDatabase::with_single_file(text) } @@ -165,17 +165,17 @@ pub(crate) fn check_assist_unresolved(assist: Handler, ra_fixture: &str) { fn check_doc_test(assist_id: &str, before: &str, after: &str) { let after = trim_indent(after); let (db, file_id, selection) = RootDatabase::with_range_or_offset(before); - let before = db.file_text(file_id).to_string(); + let before = db.file_text(file_id.file_id()).to_string(); let frange = FileRange { file_id, range: selection.into() }; - let assist = assists(&db, &TEST_CONFIG, AssistResolveStrategy::All, frange) + let assist = assists(&db, &TEST_CONFIG, AssistResolveStrategy::All, frange.into()) .into_iter() .find(|assist| assist.id.0 == assist_id) .unwrap_or_else(|| { panic!( "\n\nAssist is not applicable: {}\nAvailable assists: {}", assist_id, - assists(&db, &TEST_CONFIG, AssistResolveStrategy::None, frange) + assists(&db, &TEST_CONFIG, AssistResolveStrategy::None, frange.into()) .into_iter() .map(|assist| assist.id.0) .collect::>() @@ -190,7 +190,7 @@ fn check_doc_test(assist_id: &str, before: &str, after: &str) { .expect("Assist did not contain any source changes"); let mut actual = before; if let Some((source_file_edit, snippet_edit)) = - source_change.get_source_and_snippet_edit(file_id) + source_change.get_source_and_snippet_edit(file_id.file_id()) { source_file_edit.apply(&mut actual); if let Some(snippet_edit) = snippet_edit { @@ -224,7 +224,7 @@ fn check_with_config( ) { let (mut db, file_with_caret_id, range_or_offset) = RootDatabase::with_range_or_offset(before); db.enable_proc_attr_macros(); - let text_without_caret = db.file_text(file_with_caret_id).to_string(); + let text_without_caret = db.file_text(file_with_caret_id.into()).to_string(); let frange = FileRange { file_id: file_with_caret_id, range: range_or_offset.into() }; @@ -331,7 +331,7 @@ fn assist_order_field_struct() { let (before_cursor_pos, before) = extract_offset(before); let (db, file_id) = with_single_file(&before); let frange = FileRange { file_id, range: TextRange::empty(before_cursor_pos) }; - let assists = assists(&db, &TEST_CONFIG, AssistResolveStrategy::None, frange); + let assists = assists(&db, &TEST_CONFIG, AssistResolveStrategy::None, frange.into()); let mut assists = assists.iter(); assert_eq!(assists.next().expect("expected assist").label, "Change visibility to pub(crate)"); @@ -357,7 +357,7 @@ pub fn test_some_range(a: int) -> bool { "#, ); - let assists = assists(&db, &TEST_CONFIG, AssistResolveStrategy::None, frange); + let assists = assists(&db, &TEST_CONFIG, AssistResolveStrategy::None, frange.into()); let expected = labels(&assists); expect![[r#" @@ -386,7 +386,7 @@ pub fn test_some_range(a: int) -> bool { let mut cfg = TEST_CONFIG; cfg.allowed = Some(vec![AssistKind::Refactor]); - let assists = assists(&db, &cfg, AssistResolveStrategy::None, frange); + let assists = assists(&db, &cfg, AssistResolveStrategy::None, frange.into()); let expected = labels(&assists); expect![[r#" @@ -401,7 +401,7 @@ pub fn test_some_range(a: int) -> bool { { let mut cfg = TEST_CONFIG; cfg.allowed = Some(vec![AssistKind::RefactorExtract]); - let assists = assists(&db, &cfg, AssistResolveStrategy::None, frange); + let assists = assists(&db, &cfg, AssistResolveStrategy::None, frange.into()); let expected = labels(&assists); expect![[r#" @@ -414,7 +414,7 @@ pub fn test_some_range(a: int) -> bool { { let mut cfg = TEST_CONFIG; cfg.allowed = Some(vec![AssistKind::QuickFix]); - let assists = assists(&db, &cfg, AssistResolveStrategy::None, frange); + let assists = assists(&db, &cfg, AssistResolveStrategy::None, frange.into()); let expected = labels(&assists); expect![[r#""#]].assert_eq(&expected); @@ -439,7 +439,7 @@ pub fn test_some_range(a: int) -> bool { cfg.allowed = Some(vec![AssistKind::RefactorExtract]); { - let assists = assists(&db, &cfg, AssistResolveStrategy::None, frange); + let assists = assists(&db, &cfg, AssistResolveStrategy::None, frange.into()); assert_eq!(2, assists.len()); let mut assists = assists.into_iter(); @@ -484,7 +484,7 @@ pub fn test_some_range(a: int) -> bool { assist_id: "SOMETHING_MISMATCHING".to_owned(), assist_kind: AssistKind::RefactorExtract, }), - frange, + frange.into(), ); assert_eq!(2, assists.len()); let mut assists = assists.into_iter(); @@ -530,7 +530,7 @@ pub fn test_some_range(a: int) -> bool { assist_id: "extract_variable".to_owned(), assist_kind: AssistKind::RefactorExtract, }), - frange, + frange.into(), ); assert_eq!(2, assists.len()); let mut assists = assists.into_iter(); @@ -612,7 +612,7 @@ pub fn test_some_range(a: int) -> bool { } { - let assists = assists(&db, &cfg, AssistResolveStrategy::All, frange); + let assists = assists(&db, &cfg, AssistResolveStrategy::All, frange.into()); assert_eq!(2, assists.len()); let mut assists = assists.into_iter(); diff --git a/crates/ide-assists/src/utils/suggest_name.rs b/crates/ide-assists/src/utils/suggest_name.rs index 457e8baaca..fc43d243b3 100644 --- a/crates/ide-assists/src/utils/suggest_name.rs +++ b/crates/ide-assists/src/utils/suggest_name.rs @@ -184,7 +184,7 @@ fn normalize(name: &str) -> Option { fn is_valid_name(name: &str) -> bool { matches!( - ide_db::syntax_helpers::LexedStr::single_token(syntax::Edition::CURRENT, name), + ide_db::syntax_helpers::LexedStr::single_token(syntax::Edition::CURRENT_FIXME, name), Some((syntax::SyntaxKind::IDENT, _error)) ) } @@ -319,7 +319,7 @@ fn from_field_name(expr: &ast::Expr) -> Option { #[cfg(test)] mod tests { - use ide_db::base_db::FileRange; + use hir::FileRange; use test_fixture::WithFixture; use super::*; diff --git a/crates/ide-completion/src/completions/mod_.rs b/crates/ide-completion/src/completions/mod_.rs index c0333b1d0a..713968c1ca 100644 --- a/crates/ide-completion/src/completions/mod_.rs +++ b/crates/ide-completion/src/completions/mod_.rs @@ -7,6 +7,7 @@ use ide_db::{ base_db::{SourceDatabaseExt, VfsPath}, FxHashSet, RootDatabase, SymbolKind, }; +use stdx::IsNoneOr; use syntax::{ast, AstNode, SyntaxKind, ToSmolStr}; use crate::{context::CompletionContext, CompletionItem, Completions}; @@ -43,11 +44,11 @@ pub(crate) fn complete_mod( let module_definition_file = current_module.definition_source_file_id(ctx.db).original_file(ctx.db); - let source_root = ctx.db.source_root(ctx.db.file_source_root(module_definition_file)); + let source_root = ctx.db.source_root(ctx.db.file_source_root(module_definition_file.file_id())); let directory_to_look_for_submodules = directory_to_look_for_submodules( current_module, ctx.db, - source_root.path_for_file(&module_definition_file)?, + source_root.path_for_file(&module_definition_file.file_id())?, )?; let existing_mod_declarations = current_module @@ -63,9 +64,9 @@ pub(crate) fn complete_mod( source_root .iter() - .filter(|submodule_candidate_file| submodule_candidate_file != &module_definition_file) - .filter(|submodule_candidate_file| { - Some(submodule_candidate_file) != module_declaration_file.as_ref() + .filter(|&submodule_candidate_file| submodule_candidate_file != module_definition_file) + .filter(|&submodule_candidate_file| { + IsNoneOr::is_none_or(module_declaration_file, |it| it != submodule_candidate_file) }) .filter_map(|submodule_file| { let submodule_path = source_root.path_for_file(&submodule_file)?; diff --git a/crates/ide-completion/src/context.rs b/crates/ide-completion/src/context.rs index 55f39440ee..952d9217c7 100644 --- a/crates/ide-completion/src/context.rs +++ b/crates/ide-completion/src/context.rs @@ -10,14 +10,12 @@ use hir::{ HasAttrs, Local, Name, PathResolution, ScopeDef, Semantics, SemanticsScope, Type, TypeInfo, }; use ide_db::{ - base_db::{FilePosition, SourceDatabase}, - famous_defs::FamousDefs, - helpers::is_editable_crate, + base_db::SourceDatabase, famous_defs::FamousDefs, helpers::is_editable_crate, FilePosition, FxHashMap, FxHashSet, RootDatabase, }; use syntax::{ ast::{self, AttrKind, NameOrNameRef}, - AstNode, Edition, SmolStr, + AstNode, SmolStr, SyntaxKind::{self, *}, SyntaxToken, TextRange, TextSize, T, }; @@ -660,6 +658,7 @@ impl<'a> CompletionContext<'a> { let _p = tracing::info_span!("CompletionContext::new").entered(); let sema = Semantics::new(db); + let file_id = sema.attach_first_edition(file_id)?; let original_file = sema.parse(file_id); // Insert a fake ident to get a valid parse tree. We will use this file @@ -668,8 +667,7 @@ impl<'a> CompletionContext<'a> { let file_with_fake_ident = { let parse = db.parse(file_id); let edit = Indel::insert(offset, COMPLETION_MARKER.to_owned()); - // FIXME: Edition - parse.reparse(&edit, Edition::CURRENT).tree() + parse.reparse(&edit, file_id.edition()).tree() }; // always pick the token to the immediate left of the cursor, as that is what we are actually diff --git a/crates/ide-completion/src/lib.rs b/crates/ide-completion/src/lib.rs index 7d9c2c7c60..424f94457e 100644 --- a/crates/ide-completion/src/lib.rs +++ b/crates/ide-completion/src/lib.rs @@ -12,13 +12,12 @@ mod tests; use hir::ImportPathConfig; use ide_db::{ - base_db::FilePosition, helpers::mod_path_to_ast, imports::{ import_assets::NameToImport, insert_use::{self, ImportScope}, }, - items_locator, RootDatabase, + items_locator, FilePosition, RootDatabase, }; use syntax::algo; use text_edit::TextEdit; @@ -239,7 +238,7 @@ pub fn resolve_completion_edits( let _p = tracing::info_span!("resolve_completion_edits").entered(); let sema = hir::Semantics::new(db); - let original_file = sema.parse(file_id); + let original_file = sema.parse(sema.attach_first_edition(file_id)?); let original_token = syntax::AstNode::syntax(&original_file).token_at_offset(offset).left_biased()?; let position_for_import = &original_token.parent()?; diff --git a/crates/ide-completion/src/snippet.rs b/crates/ide-completion/src/snippet.rs index 5885b74e09..1eb8c574bd 100644 --- a/crates/ide-completion/src/snippet.rs +++ b/crates/ide-completion/src/snippet.rs @@ -206,10 +206,11 @@ fn validate_snippet( ) -> Option<(Box<[GreenNode]>, String, Option>)> { let mut imports = Vec::with_capacity(requires.len()); for path in requires.iter() { - let use_path = ast::SourceFile::parse(&format!("use {path};"), syntax::Edition::CURRENT) - .syntax_node() - .descendants() - .find_map(ast::Path::cast)?; + let use_path = + ast::SourceFile::parse(&format!("use {path};"), syntax::Edition::CURRENT_FIXME) + .syntax_node() + .descendants() + .find_map(ast::Path::cast)?; if use_path.syntax().text() != path.as_str() { return None; } diff --git a/crates/ide-completion/src/tests.rs b/crates/ide-completion/src/tests.rs index fcac6c7ce7..f6274cf537 100644 --- a/crates/ide-completion/src/tests.rs +++ b/crates/ide-completion/src/tests.rs @@ -26,9 +26,9 @@ mod visibility; use expect_test::Expect; use hir::PrefixKind; use ide_db::{ - base_db::{FileLoader, FilePosition}, + base_db::FileLoader, imports::insert_use::{ImportGranularity, InsertUseConfig}, - RootDatabase, SnippetCap, + FilePosition, RootDatabase, SnippetCap, }; use itertools::Itertools; use stdx::{format_to, trim_indent}; @@ -131,7 +131,7 @@ pub(crate) fn position(ra_fixture: &str) -> (RootDatabase, FilePosition) { database.apply_change(change_fixture.change); let (file_id, range_or_offset) = change_fixture.file_position.expect("expected a marker ($0)"); let offset = range_or_offset.expect_offset(); - (database, FilePosition { file_id, offset }) + (database, FilePosition { file_id: file_id.file_id(), offset }) } pub(crate) fn do_completion(code: &str, kind: CompletionItemKind) -> Vec { diff --git a/crates/ide-db/src/helpers.rs b/crates/ide-db/src/helpers.rs index 0e7ee13717..f6a781907d 100644 --- a/crates/ide-db/src/helpers.rs +++ b/crates/ide-db/src/helpers.rs @@ -2,8 +2,9 @@ use std::collections::VecDeque; -use base_db::{FileId, SourceDatabaseExt}; +use base_db::SourceDatabaseExt; use hir::{Crate, DescendPreference, ItemInNs, ModuleDef, Name, Semantics}; +use span::FileId; use syntax::{ ast::{self, make}, AstToken, SyntaxKind, SyntaxToken, ToSmolStr, TokenAtOffset, diff --git a/crates/ide-db/src/imports/insert_use.rs b/crates/ide-db/src/imports/insert_use.rs index 9102980677..fc86d169a2 100644 --- a/crates/ide-db/src/imports/insert_use.rs +++ b/crates/ide-db/src/imports/insert_use.rs @@ -176,7 +176,7 @@ pub fn insert_use(scope: &ImportScope, path: ast::Path, cfg: &InsertUseConfig) { pub fn insert_use_as_alias(scope: &ImportScope, path: ast::Path, cfg: &InsertUseConfig) { let text: &str = "use foo as _"; - let parse = syntax::SourceFile::parse(text, span::Edition::CURRENT); + let parse = syntax::SourceFile::parse(text, span::Edition::CURRENT_FIXME); let node = parse .tree() .syntax() diff --git a/crates/ide-db/src/lib.rs b/crates/ide-db/src/lib.rs index 8fac5baa57..e4507a983e 100644 --- a/crates/ide-db/src/lib.rs +++ b/crates/ide-db/src/lib.rs @@ -48,10 +48,13 @@ use std::{fmt, mem::ManuallyDrop}; use base_db::{ salsa::{self, Durability}, - AnchoredPath, CrateId, FileId, FileLoader, FileLoaderDelegate, SourceDatabase, Upcast, + AnchoredPath, CrateId, FileLoader, FileLoaderDelegate, SourceDatabase, Upcast, DEFAULT_FILE_TEXT_LRU_CAP, }; -use hir::db::{DefDatabase, ExpandDatabase, HirDatabase}; +use hir::{ + db::{DefDatabase, ExpandDatabase, HirDatabase}, + FilePositionWrapper, FileRangeWrapper, +}; use triomphe::Arc; use crate::{line_index::LineIndex, symbol_index::SymbolsDatabase}; @@ -61,11 +64,15 @@ pub use ::line_index; /// `base_db` is normally also needed in places where `ide_db` is used, so this re-export is for convenience. pub use base_db; +pub use span::{EditionedFileId, FileId}; pub type FxIndexSet = indexmap::IndexSet>; pub type FxIndexMap = indexmap::IndexMap>; +pub type FilePosition = FilePositionWrapper; +pub type FileRange = FileRangeWrapper; + #[salsa::database( base_db::SourceDatabaseExtStorage, base_db::SourceDatabaseStorage, diff --git a/crates/ide-db/src/rename.rs b/crates/ide-db/src/rename.rs index 7f9e08cb8a..232f242828 100644 --- a/crates/ide-db/src/rename.rs +++ b/crates/ide-db/src/rename.rs @@ -22,10 +22,10 @@ //! Our current behavior is ¯\_(ツ)_/¯. use std::fmt; -use base_db::{AnchoredPathBuf, FileId, FileRange}; +use base_db::AnchoredPathBuf; use either::Either; -use hir::{FieldSource, HirFileIdExt, InFile, ModuleSource, Semantics}; -use span::{Edition, SyntaxContextId}; +use hir::{FieldSource, FileRange, HirFileIdExt, InFile, ModuleSource, Semantics}; +use span::{Edition, EditionedFileId, FileId, SyntaxContextId}; use stdx::{never, TupleExt}; use syntax::{ ast::{self, HasName}, @@ -241,7 +241,7 @@ fn rename_mod( let InFile { file_id, value: def_source } = module.definition_source(sema.db); if let ModuleSource::SourceFile(..) = def_source { let new_name = new_name.trim_start_matches("r#"); - let anchor = file_id.original_file(sema.db); + let anchor = file_id.original_file(sema.db).file_id(); let is_mod_rs = module.is_mod_rs(sema.db); let has_detached_child = module.children(sema.db).any(|child| !child.is_inline(sema.db)); @@ -290,7 +290,7 @@ fn rename_mod( .map(TupleExt::head) { source_change.insert_source_edit( - file_id, + file_id.file_id(), TextEdit::replace(file_range.range, new_name.to_owned()), ) }; @@ -301,8 +301,8 @@ fn rename_mod( let def = Definition::Module(module); let usages = def.usages(sema).all(); - let ref_edits = usages.iter().map(|(&file_id, references)| { - (file_id, source_edit_from_references(references, def, new_name)) + let ref_edits = usages.iter().map(|(file_id, references)| { + (EditionedFileId::file_id(file_id), source_edit_from_references(references, def, new_name)) }); source_change.extend(ref_edits); @@ -350,8 +350,8 @@ fn rename_reference( bail!("Cannot rename reference to `_` as it is being referenced multiple times"); } let mut source_change = SourceChange::default(); - source_change.extend(usages.iter().map(|(&file_id, references)| { - (file_id, source_edit_from_references(references, def, new_name)) + source_change.extend(usages.iter().map(|(file_id, references)| { + (EditionedFileId::file_id(file_id), source_edit_from_references(references, def, new_name)) })); let mut insert_def_edit = |def| { @@ -584,7 +584,7 @@ fn source_edit_from_def( } } let Some(file_id) = file_id else { bail!("No file available to rename") }; - return Ok((file_id, edit.finish())); + return Ok((EditionedFileId::file_id(file_id), edit.finish())); } let FileRange { file_id, range } = def .range_for_rename(sema) @@ -600,7 +600,7 @@ fn source_edit_from_def( _ => (range, new_name.to_owned()), }; edit.replace(range, new_name); - Ok((file_id, edit.finish())) + Ok((file_id.file_id(), edit.finish())) } #[derive(Copy, Clone, Debug, PartialEq)] diff --git a/crates/ide-db/src/search.rs b/crates/ide-db/src/search.rs index b7b8c5a66f..05b32e2a85 100644 --- a/crates/ide-db/src/search.rs +++ b/crates/ide-db/src/search.rs @@ -6,15 +6,16 @@ use std::mem; -use base_db::{salsa::Database, FileId, FileRange, SourceDatabase, SourceDatabaseExt}; +use base_db::{salsa::Database, SourceDatabase, SourceDatabaseExt}; use hir::{ - sym, AsAssocItem, DefWithBody, DescendPreference, HasAttrs, HasSource, HirFileIdExt, InFile, - InRealFile, ModuleSource, PathResolution, Semantics, Visibility, + sym, AsAssocItem, DefWithBody, DescendPreference, FileRange, HasAttrs, HasSource, HirFileIdExt, + InFile, InRealFile, ModuleSource, PathResolution, Semantics, Visibility, }; use memchr::memmem::Finder; -use nohash_hasher::IntMap; use once_cell::unsync::Lazy; use parser::SyntaxKind; +use rustc_hash::FxHashMap; +use span::EditionedFileId; use syntax::{ast, match_ast, AstNode, AstToken, SyntaxElement, TextRange, TextSize, ToSmolStr}; use triomphe::Arc; @@ -26,7 +27,7 @@ use crate::{ #[derive(Debug, Default, Clone)] pub struct UsageSearchResult { - pub references: IntMap>, + pub references: FxHashMap>, } impl UsageSearchResult { @@ -38,8 +39,8 @@ impl UsageSearchResult { self.references.len() } - pub fn iter(&self) -> impl Iterator + '_ { - self.references.iter().map(|(file_id, refs)| (file_id, &**refs)) + pub fn iter(&self) -> impl Iterator + '_ { + self.references.iter().map(|(&file_id, refs)| (file_id, &**refs)) } pub fn file_ranges(&self) -> impl Iterator + '_ { @@ -50,8 +51,8 @@ impl UsageSearchResult { } impl IntoIterator for UsageSearchResult { - type Item = (FileId, Vec); - type IntoIter = > as IntoIterator>::IntoIter; + type Item = (EditionedFileId, Vec); + type IntoIter = > as IntoIterator>::IntoIter; fn into_iter(self) -> Self::IntoIter { self.references.into_iter() @@ -142,36 +143,40 @@ bitflags::bitflags! { /// e.g. for things like local variables. #[derive(Clone, Debug)] pub struct SearchScope { - entries: IntMap>, + entries: FxHashMap>, } impl SearchScope { - fn new(entries: IntMap>) -> SearchScope { + fn new(entries: FxHashMap>) -> SearchScope { SearchScope { entries } } /// Build a search scope spanning the entire crate graph of files. fn crate_graph(db: &RootDatabase) -> SearchScope { - let mut entries = IntMap::default(); + let mut entries = FxHashMap::default(); let graph = db.crate_graph(); for krate in graph.iter() { let root_file = graph[krate].root_file_id; let source_root_id = db.file_source_root(root_file); let source_root = db.source_root(source_root_id); - entries.extend(source_root.iter().map(|id| (id, None))); + entries.extend( + source_root.iter().map(|id| (EditionedFileId::new(id, graph[krate].edition), None)), + ); } SearchScope { entries } } /// Build a search scope spanning all the reverse dependencies of the given crate. fn reverse_dependencies(db: &RootDatabase, of: hir::Crate) -> SearchScope { - let mut entries = IntMap::default(); + let mut entries = FxHashMap::default(); for rev_dep in of.transitive_reverse_dependencies(db) { let root_file = rev_dep.root_file(db); let source_root_id = db.file_source_root(root_file); let source_root = db.source_root(source_root_id); - entries.extend(source_root.iter().map(|id| (id, None))); + entries.extend( + source_root.iter().map(|id| (EditionedFileId::new(id, rev_dep.edition(db)), None)), + ); } SearchScope { entries } } @@ -181,12 +186,17 @@ impl SearchScope { let root_file = of.root_file(db); let source_root_id = db.file_source_root(root_file); let source_root = db.source_root(source_root_id); - SearchScope { entries: source_root.iter().map(|id| (id, None)).collect() } + SearchScope { + entries: source_root + .iter() + .map(|id| (EditionedFileId::new(id, of.edition(db)), None)) + .collect(), + } } /// Build a search scope spanning the given module and all its submodules. pub fn module_and_children(db: &RootDatabase, module: hir::Module) -> SearchScope { - let mut entries = IntMap::default(); + let mut entries = FxHashMap::default(); let (file_id, range) = { let InFile { file_id, value } = module.definition_source_range(db); @@ -211,11 +221,11 @@ impl SearchScope { /// Build an empty search scope. pub fn empty() -> SearchScope { - SearchScope::new(IntMap::default()) + SearchScope::new(FxHashMap::default()) } /// Build a empty search scope spanning the given file. - pub fn single_file(file: FileId) -> SearchScope { + pub fn single_file(file: EditionedFileId) -> SearchScope { SearchScope::new(std::iter::once((file, None)).collect()) } @@ -225,7 +235,7 @@ impl SearchScope { } /// Build a empty search scope spanning the given files. - pub fn files(files: &[FileId]) -> SearchScope { + pub fn files(files: &[EditionedFileId]) -> SearchScope { SearchScope::new(files.iter().map(|f| (*f, None)).collect()) } @@ -256,8 +266,8 @@ impl SearchScope { } impl IntoIterator for SearchScope { - type Item = (FileId, Option); - type IntoIter = std::collections::hash_map::IntoIter>; + type Item = (EditionedFileId, Option); + type IntoIter = std::collections::hash_map::IntoIter>; fn into_iter(self) -> Self::IntoIter { self.entries.into_iter() @@ -432,7 +442,7 @@ impl<'a> FindUsages<'a> { res } - pub fn search(&self, sink: &mut dyn FnMut(FileId, FileReference) -> bool) { + pub fn search(&self, sink: &mut dyn FnMut(EditionedFileId, FileReference) -> bool) { let _p = tracing::info_span!("FindUsages:search").entered(); let sema = self.sema; @@ -497,13 +507,13 @@ impl<'a> FindUsages<'a> { }) } - // for<'a> |scope: &'a SearchScope| -> impl Iterator, FileId, TextRange)> + 'a { ... } + // for<'a> |scope: &'a SearchScope| -> impl Iterator, EditionedFileId, TextRange)> + 'a { ... } fn scope_files<'a>( sema: &'a Semantics<'_, RootDatabase>, scope: &'a SearchScope, - ) -> impl Iterator, FileId, TextRange)> + 'a { + ) -> impl Iterator, EditionedFileId, TextRange)> + 'a { scope.entries.iter().map(|(&file_id, &search_range)| { - let text = sema.db.file_text(file_id); + let text = sema.db.file_text(file_id.file_id()); let search_range = search_range.unwrap_or_else(|| TextRange::up_to(TextSize::of(&*text))); @@ -627,7 +637,7 @@ impl<'a> FindUsages<'a> { return; }; - let text = sema.db.file_text(file_id); + let text = sema.db.file_text(file_id.file_id()); let search_range = search_range.unwrap_or_else(|| TextRange::up_to(TextSize::of(&*text))); @@ -651,7 +661,7 @@ impl<'a> FindUsages<'a> { &self, self_ty: &hir::Type, name_ref: &ast::NameRef, - sink: &mut dyn FnMut(FileId, FileReference) -> bool, + sink: &mut dyn FnMut(EditionedFileId, FileReference) -> bool, ) -> bool { match NameRefClass::classify(self.sema, name_ref) { Some(NameRefClass::Definition(Definition::SelfType(impl_))) @@ -672,7 +682,7 @@ impl<'a> FindUsages<'a> { fn found_self_module_name_ref( &self, name_ref: &ast::NameRef, - sink: &mut dyn FnMut(FileId, FileReference) -> bool, + sink: &mut dyn FnMut(EditionedFileId, FileReference) -> bool, ) -> bool { match NameRefClass::classify(self.sema, name_ref) { Some(NameRefClass::Definition(def @ Definition::Module(_))) if def == self.def => { @@ -695,11 +705,11 @@ impl<'a> FindUsages<'a> { fn found_format_args_ref( &self, - file_id: FileId, + file_id: EditionedFileId, range: TextRange, token: ast::String, res: Option, - sink: &mut dyn FnMut(FileId, FileReference) -> bool, + sink: &mut dyn FnMut(EditionedFileId, FileReference) -> bool, ) -> bool { match res.map(Definition::from) { Some(def) if def == self.def => { @@ -717,7 +727,7 @@ impl<'a> FindUsages<'a> { fn found_lifetime( &self, lifetime: &ast::Lifetime, - sink: &mut dyn FnMut(FileId, FileReference) -> bool, + sink: &mut dyn FnMut(EditionedFileId, FileReference) -> bool, ) -> bool { match NameRefClass::classify_lifetime(self.sema, lifetime) { Some(NameRefClass::Definition(def)) if def == self.def => { @@ -736,7 +746,7 @@ impl<'a> FindUsages<'a> { fn found_name_ref( &self, name_ref: &ast::NameRef, - sink: &mut dyn FnMut(FileId, FileReference) -> bool, + sink: &mut dyn FnMut(EditionedFileId, FileReference) -> bool, ) -> bool { match NameRefClass::classify(self.sema, name_ref) { Some(NameRefClass::Definition(def)) @@ -810,7 +820,7 @@ impl<'a> FindUsages<'a> { fn found_name( &self, name: &ast::Name, - sink: &mut dyn FnMut(FileId, FileReference) -> bool, + sink: &mut dyn FnMut(EditionedFileId, FileReference) -> bool, ) -> bool { match NameClass::classify(self.sema, name) { Some(NameClass::PatFieldShorthand { local_def: _, field_ref }) diff --git a/crates/ide-db/src/source_change.rs b/crates/ide-db/src/source_change.rs index fba377417e..a85358098f 100644 --- a/crates/ide-db/src/source_change.rs +++ b/crates/ide-db/src/source_change.rs @@ -6,9 +6,10 @@ use std::{collections::hash_map::Entry, iter, mem}; use crate::{assists::Command, SnippetCap}; -use base_db::{AnchoredPathBuf, FileId}; +use base_db::AnchoredPathBuf; use itertools::Itertools; use nohash_hasher::IntMap; +use span::FileId; use stdx::never; use syntax::{ algo, AstNode, SyntaxElement, SyntaxNode, SyntaxNodePtr, SyntaxToken, TextRange, TextSize, @@ -32,28 +33,28 @@ impl SourceChange { SourceChange { source_file_edits, file_system_edits, is_snippet: false } } - pub fn from_text_edit(file_id: FileId, edit: TextEdit) -> Self { + pub fn from_text_edit(file_id: impl Into, edit: TextEdit) -> Self { SourceChange { - source_file_edits: iter::once((file_id, (edit, None))).collect(), + source_file_edits: iter::once((file_id.into(), (edit, None))).collect(), ..Default::default() } } /// Inserts a [`TextEdit`] for the given [`FileId`]. This properly handles merging existing /// edits for a file if some already exist. - pub fn insert_source_edit(&mut self, file_id: FileId, edit: TextEdit) { - self.insert_source_and_snippet_edit(file_id, edit, None) + pub fn insert_source_edit(&mut self, file_id: impl Into, edit: TextEdit) { + self.insert_source_and_snippet_edit(file_id.into(), edit, None) } /// Inserts a [`TextEdit`] and potentially a [`SnippetEdit`] for the given [`FileId`]. /// This properly handles merging existing edits for a file if some already exist. pub fn insert_source_and_snippet_edit( &mut self, - file_id: FileId, + file_id: impl Into, edit: TextEdit, snippet_edit: Option, ) { - match self.source_file_edits.entry(file_id) { + match self.source_file_edits.entry(file_id.into()) { Entry::Occupied(mut entry) => { let value = entry.get_mut(); never!(value.0.union(edit).is_err(), "overlapping edits for same file"); @@ -231,10 +232,10 @@ impl TreeMutator { } impl SourceChangeBuilder { - pub fn new(file_id: FileId) -> SourceChangeBuilder { + pub fn new(file_id: impl Into) -> SourceChangeBuilder { SourceChangeBuilder { edit: TextEdit::builder(), - file_id, + file_id: file_id.into(), source_change: SourceChange::default(), command: None, mutated_tree: None, @@ -242,9 +243,9 @@ impl SourceChangeBuilder { } } - pub fn edit_file(&mut self, file_id: FileId) { + pub fn edit_file(&mut self, file_id: impl Into) { self.commit(); - self.file_id = file_id; + self.file_id = file_id.into(); } fn commit(&mut self) { @@ -300,8 +301,8 @@ impl SourceChangeBuilder { let file_system_edit = FileSystemEdit::CreateFile { dst, initial_contents: content.into() }; self.source_change.push_file_system_edit(file_system_edit); } - pub fn move_file(&mut self, src: FileId, dst: AnchoredPathBuf) { - let file_system_edit = FileSystemEdit::MoveFile { src, dst }; + pub fn move_file(&mut self, src: impl Into, dst: AnchoredPathBuf) { + let file_system_edit = FileSystemEdit::MoveFile { src: src.into(), dst }; self.source_change.push_file_system_edit(file_system_edit); } diff --git a/crates/ide-db/src/traits.rs b/crates/ide-db/src/traits.rs index ee7c448bb8..48a585bf33 100644 --- a/crates/ide-db/src/traits.rs +++ b/crates/ide-db/src/traits.rs @@ -113,8 +113,8 @@ fn assoc_item_of_trait( #[cfg(test)] mod tests { - use base_db::FilePosition; use expect_test::{expect, Expect}; + use hir::FilePosition; use hir::Semantics; use syntax::ast::{self, AstNode}; use test_fixture::ChangeFixture; diff --git a/crates/ide-diagnostics/src/handlers/field_shorthand.rs b/crates/ide-diagnostics/src/handlers/field_shorthand.rs index 45fc6f8e68..c7071d1ce4 100644 --- a/crates/ide-diagnostics/src/handlers/field_shorthand.rs +++ b/crates/ide-diagnostics/src/handlers/field_shorthand.rs @@ -1,16 +1,17 @@ //! Suggests shortening `Foo { field: field }` to `Foo { field }` in both //! expressions and patterns. -use ide_db::{ - base_db::{FileId, FileRange}, - source_change::SourceChange, -}; +use ide_db::{source_change::SourceChange, EditionedFileId, FileRange}; use syntax::{ast, match_ast, AstNode, SyntaxNode}; use text_edit::TextEdit; use crate::{fix, Diagnostic, DiagnosticCode}; -pub(crate) fn field_shorthand(acc: &mut Vec, file_id: FileId, node: &SyntaxNode) { +pub(crate) fn field_shorthand( + acc: &mut Vec, + file_id: EditionedFileId, + node: &SyntaxNode, +) { match_ast! { match node { ast::RecordExpr(it) => check_expr_field_shorthand(acc, file_id, it), @@ -22,7 +23,7 @@ pub(crate) fn field_shorthand(acc: &mut Vec, file_id: FileId, node: fn check_expr_field_shorthand( acc: &mut Vec, - file_id: FileId, + file_id: EditionedFileId, record_expr: ast::RecordExpr, ) { let record_field_list = match record_expr.record_expr_field_list() { @@ -52,7 +53,7 @@ fn check_expr_field_shorthand( Diagnostic::new( DiagnosticCode::Clippy("redundant_field_names"), "Shorthand struct initialization", - FileRange { file_id, range: field_range }, + FileRange { file_id: file_id.into(), range: field_range }, ) .with_fixes(Some(vec![fix( "use_expr_field_shorthand", @@ -66,7 +67,7 @@ fn check_expr_field_shorthand( fn check_pat_field_shorthand( acc: &mut Vec, - file_id: FileId, + file_id: EditionedFileId, record_pat: ast::RecordPat, ) { let record_pat_field_list = match record_pat.record_pat_field_list() { @@ -96,7 +97,7 @@ fn check_pat_field_shorthand( Diagnostic::new( DiagnosticCode::Clippy("redundant_field_names"), "Shorthand struct pattern", - FileRange { file_id, range: field_range }, + FileRange { file_id: file_id.into(), range: field_range }, ) .with_fixes(Some(vec![fix( "use_pat_field_shorthand", diff --git a/crates/ide-diagnostics/src/handlers/json_is_not_rust.rs b/crates/ide-diagnostics/src/handlers/json_is_not_rust.rs index a9c0e3b731..117088ca09 100644 --- a/crates/ide-diagnostics/src/handlers/json_is_not_rust.rs +++ b/crates/ide-diagnostics/src/handlers/json_is_not_rust.rs @@ -3,11 +3,10 @@ use hir::{ImportPathConfig, PathResolution, Semantics}; use ide_db::{ - base_db::{FileId, FileRange}, helpers::mod_path_to_ast, imports::insert_use::{insert_use, ImportScope}, source_change::SourceChangeBuilder, - FxHashMap, RootDatabase, + EditionedFileId, FileRange, FxHashMap, RootDatabase, }; use itertools::Itertools; use stdx::{format_to, never}; @@ -102,7 +101,7 @@ impl State { pub(crate) fn json_in_items( sema: &Semantics<'_, RootDatabase>, acc: &mut Vec, - file_id: FileId, + file_id: EditionedFileId, node: &SyntaxNode, config: &DiagnosticsConfig, ) { @@ -132,7 +131,7 @@ pub(crate) fn json_in_items( Diagnostic::new( DiagnosticCode::Ra("json-is-not-rust", Severity::WeakWarning), "JSON syntax is not valid as a Rust item", - FileRange { file_id, range }, + FileRange { file_id: file_id.into(), range }, ) .with_fixes(Some(vec![{ let mut scb = SourceChangeBuilder::new(file_id); diff --git a/crates/ide-diagnostics/src/handlers/mismatched_arg_count.rs b/crates/ide-diagnostics/src/handlers/mismatched_arg_count.rs index 41c762c85b..685761e8ff 100644 --- a/crates/ide-diagnostics/src/handlers/mismatched_arg_count.rs +++ b/crates/ide-diagnostics/src/handlers/mismatched_arg_count.rs @@ -1,6 +1,6 @@ use either::Either; use hir::InFile; -use ide_db::base_db::FileRange; +use ide_db::FileRange; use syntax::{ ast::{self, HasArgList}, AstNode, AstPtr, diff --git a/crates/ide-diagnostics/src/handlers/no_such_field.rs b/crates/ide-diagnostics/src/handlers/no_such_field.rs index 5a3206445c..dfadef11fd 100644 --- a/crates/ide-diagnostics/src/handlers/no_such_field.rs +++ b/crates/ide-diagnostics/src/handlers/no_such_field.rs @@ -1,6 +1,6 @@ use either::Either; use hir::{db::ExpandDatabase, HasSource, HirDisplay, HirFileIdExt, Semantics, VariantId}; -use ide_db::{base_db::FileId, source_change::SourceChange, RootDatabase}; +use ide_db::{source_change::SourceChange, EditionedFileId, RootDatabase}; use syntax::{ ast::{self, edit::IndentLevel, make}, AstNode, @@ -51,7 +51,7 @@ fn fixes(ctx: &DiagnosticsContext<'_>, d: &hir::NoSuchField) -> Option, - usage_file_id: FileId, + usage_file_id: EditionedFileId, record_expr_field: &ast::RecordExprField, ) -> Option> { let record_lit = ast::RecordExpr::cast(record_expr_field.syntax().parent()?.parent()?)?; diff --git a/crates/ide-diagnostics/src/handlers/remove_trailing_return.rs b/crates/ide-diagnostics/src/handlers/remove_trailing_return.rs index d831878044..62bc1f3d06 100644 --- a/crates/ide-diagnostics/src/handlers/remove_trailing_return.rs +++ b/crates/ide-diagnostics/src/handlers/remove_trailing_return.rs @@ -1,5 +1,5 @@ -use hir::{db::ExpandDatabase, diagnostics::RemoveTrailingReturn}; -use ide_db::{assists::Assist, base_db::FileRange, source_change::SourceChange}; +use hir::{db::ExpandDatabase, diagnostics::RemoveTrailingReturn, FileRange}; +use ide_db::{assists::Assist, source_change::SourceChange}; use syntax::{ast, AstNode}; use text_edit::TextEdit; diff --git a/crates/ide-diagnostics/src/handlers/unlinked_file.rs b/crates/ide-diagnostics/src/handlers/unlinked_file.rs index 2c90577120..1b71a3a3e6 100644 --- a/crates/ide-diagnostics/src/handlers/unlinked_file.rs +++ b/crates/ide-diagnostics/src/handlers/unlinked_file.rs @@ -4,9 +4,9 @@ use std::iter; use hir::{db::DefDatabase, DefMap, InFile, ModuleSource}; use ide_db::{ - base_db::{FileId, FileLoader, FileRange, SourceDatabase, SourceDatabaseExt}, + base_db::{FileLoader, SourceDatabaseExt}, source_change::SourceChange, - RootDatabase, + FileId, FileRange, LineIndexDatabase, }; use paths::Utf8Component; use syntax::{ @@ -26,7 +26,8 @@ pub(crate) fn unlinked_file( acc: &mut Vec, file_id: FileId, ) { - let fixes = fixes(ctx, file_id); + let mut range = TextRange::up_to(ctx.sema.db.line_index(file_id).len()); + let fixes = fixes(ctx, file_id, range); // FIXME: This is a hack for the vscode extension to notice whether there is an autofix or not before having to resolve diagnostics. // This is to prevent project linking popups from appearing when there is an autofix. https://github.com/rust-lang/rust-analyzer/issues/14523 let message = if fixes.is_none() { @@ -37,7 +38,6 @@ pub(crate) fn unlinked_file( let message = format!("{message}\n\nIf you're intentionally working on unowned files, you can silence this warning by adding \"unlinked-file\" to rust-analyzer.diagnostics.disabled in your settings."); - let mut range = ctx.sema.db.parse(file_id).syntax_node().text_range(); let mut unused = true; if fixes.is_none() { @@ -70,7 +70,11 @@ pub(crate) fn unlinked_file( ); } -fn fixes(ctx: &DiagnosticsContext<'_>, file_id: FileId) -> Option> { +fn fixes( + ctx: &DiagnosticsContext<'_>, + file_id: FileId, + trigger_range: TextRange, +) -> Option> { // If there's an existing module that could add `mod` or `pub mod` items to include the unlinked file, // suggest that as a fix. @@ -94,7 +98,9 @@ fn fixes(ctx: &DiagnosticsContext<'_>, file_id: FileId) -> Option> { let root_module = &crate_def_map[DefMap::ROOT]; let Some(root_file_id) = root_module.origin.file_id() else { continue }; - let Some(crate_root_path) = source_root.path_for_file(&root_file_id) else { continue }; + let Some(crate_root_path) = source_root.path_for_file(&root_file_id.file_id()) else { + continue; + }; let Some(rel) = parent.strip_prefix(&crate_root_path.parent()?) else { continue }; // try resolving the relative difference of the paths as inline modules @@ -119,7 +125,7 @@ fn fixes(ctx: &DiagnosticsContext<'_>, file_id: FileId) -> Option> { let InFile { file_id: parent_file_id, value: source } = current.definition_source(ctx.sema.db); let parent_file_id = parent_file_id.file_id()?; - return make_fixes(ctx.sema.db, parent_file_id, source, &module_name, file_id); + return make_fixes(parent_file_id.file_id(), source, &module_name, trigger_range); } // if we aren't adding to a crate root, walk backwards such that we support `#[path = ...]` overrides if possible @@ -139,18 +145,17 @@ fn fixes(ctx: &DiagnosticsContext<'_>, file_id: FileId) -> Option> { 'crates: for &krate in ctx.sema.db.relevant_crates(parent_id).iter() { let crate_def_map = ctx.sema.db.crate_def_map(krate); let Some((_, module)) = crate_def_map.modules().find(|(_, module)| { - module.origin.file_id() == Some(parent_id) && !module.origin.is_inline() + module.origin.file_id().map(Into::into) == Some(parent_id) && !module.origin.is_inline() }) else { continue; }; if stack.is_empty() { return make_fixes( - ctx.sema.db, parent_id, module.definition_source(ctx.sema.db).value, &module_name, - file_id, + trigger_range, ); } else { // direct parent file is missing, @@ -174,7 +179,7 @@ fn fixes(ctx: &DiagnosticsContext<'_>, file_id: FileId) -> Option> { let InFile { file_id: parent_file_id, value: source } = current.definition_source(ctx.sema.db); let parent_file_id = parent_file_id.file_id()?; - return make_fixes(ctx.sema.db, parent_file_id, source, &module_name, file_id); + return make_fixes(parent_file_id.file_id(), source, &module_name, trigger_range); } } @@ -182,11 +187,10 @@ fn fixes(ctx: &DiagnosticsContext<'_>, file_id: FileId) -> Option> { } fn make_fixes( - db: &RootDatabase, parent_file_id: FileId, source: ModuleSource, new_mod_name: &str, - added_file_id: FileId, + trigger_range: TextRange, ) -> Option> { fn is_outline_mod(item: &ast::Item) -> bool { matches!(item, ast::Item::Module(m) if m.item_list().is_none()) @@ -257,7 +261,6 @@ fn make_fixes( } } - let trigger_range = db.parse(added_file_id).tree().syntax().text_range(); Some(vec![ fix( "add_mod_declaration", diff --git a/crates/ide-diagnostics/src/handlers/unresolved_field.rs b/crates/ide-diagnostics/src/handlers/unresolved_field.rs index 0d4aad1143..467d4edbf2 100644 --- a/crates/ide-diagnostics/src/handlers/unresolved_field.rs +++ b/crates/ide-diagnostics/src/handlers/unresolved_field.rs @@ -1,9 +1,8 @@ use std::iter; -use hir::{db::ExpandDatabase, Adt, HasSource, HirDisplay, InFile, Struct, Union}; +use hir::{db::ExpandDatabase, Adt, FileRange, HasSource, HirDisplay, InFile, Struct, Union}; use ide_db::{ assists::{Assist, AssistId, AssistKind}, - base_db::FileRange, helpers::is_editable_crate, label::Label, source_change::{SourceChange, SourceChangeBuilder}, diff --git a/crates/ide-diagnostics/src/handlers/unresolved_method.rs b/crates/ide-diagnostics/src/handlers/unresolved_method.rs index 41f4b57508..387d56b890 100644 --- a/crates/ide-diagnostics/src/handlers/unresolved_method.rs +++ b/crates/ide-diagnostics/src/handlers/unresolved_method.rs @@ -1,7 +1,6 @@ -use hir::{db::ExpandDatabase, AssocItem, HirDisplay, InFile}; +use hir::{db::ExpandDatabase, AssocItem, FileRange, HirDisplay, InFile}; use ide_db::{ assists::{Assist, AssistId, AssistKind}, - base_db::FileRange, label::Label, source_change::SourceChange, }; @@ -105,8 +104,8 @@ fn field_fix( group: None, target: range, source_change: Some(SourceChange::from_iter([ - (file_id, TextEdit::insert(range.start(), "(".to_owned())), - (file_id, TextEdit::insert(range.end(), ")".to_owned())), + (file_id.into(), TextEdit::insert(range.start(), "(".to_owned())), + (file_id.into(), TextEdit::insert(range.end(), ")".to_owned())), ])), command: None, }) diff --git a/crates/ide-diagnostics/src/handlers/unresolved_module.rs b/crates/ide-diagnostics/src/handlers/unresolved_module.rs index 1155688324..2bd8e484f8 100644 --- a/crates/ide-diagnostics/src/handlers/unresolved_module.rs +++ b/crates/ide-diagnostics/src/handlers/unresolved_module.rs @@ -43,7 +43,7 @@ fn fixes(ctx: &DiagnosticsContext<'_>, d: &hir::UnresolvedModule) -> Option, - file_id: FileId, + file_id: EditionedFileId, node: &SyntaxNode, ) -> Option<()> { let use_tree_list = ast::UseTreeList::cast(node.clone())?; @@ -41,7 +38,7 @@ pub(crate) fn useless_braces( Diagnostic::new( DiagnosticCode::RustcLint("unused_braces"), "Unnecessary braces in use statement".to_owned(), - FileRange { file_id, range: use_range }, + FileRange { file_id: file_id.into(), range: use_range }, ) .with_main_node(InFile::new(file_id.into(), SyntaxNodePtr::new(node))) .with_fixes(Some(vec![fix( diff --git a/crates/ide-diagnostics/src/lib.rs b/crates/ide-diagnostics/src/lib.rs index d30ee1a1b9..9523cc81b8 100644 --- a/crates/ide-diagnostics/src/lib.rs +++ b/crates/ide-diagnostics/src/lib.rs @@ -78,13 +78,13 @@ mod tests; use hir::{diagnostics::AnyDiagnostic, InFile, Semantics}; use ide_db::{ assists::{Assist, AssistId, AssistKind, AssistResolveStrategy}, - base_db::{FileId, FileRange, SourceDatabase}, + base_db::SourceDatabase, generated::lints::{LintGroup, CLIPPY_LINT_GROUPS, DEFAULT_LINT_GROUPS}, imports::insert_use::InsertUseConfig, label::Label, source_change::SourceChange, syntax_helpers::node_ext::parse_tt_as_comma_sep_paths, - FxHashMap, FxHashSet, RootDatabase, SnippetCap, + EditionedFileId, FileId, FileRange, FxHashMap, FxHashSet, RootDatabase, SnippetCap, }; use once_cell::sync::Lazy; use stdx::never; @@ -144,12 +144,16 @@ pub struct Diagnostic { } impl Diagnostic { - fn new(code: DiagnosticCode, message: impl Into, range: FileRange) -> Diagnostic { + fn new( + code: DiagnosticCode, + message: impl Into, + range: impl Into, + ) -> Diagnostic { let message = message.into(); Diagnostic { code, message, - range, + range: range.into(), severity: match code { DiagnosticCode::RustcHardError(_) => Severity::Error, // FIXME: Rustc lints are not always warning, but the ones that are currently implemented are all warnings. @@ -290,6 +294,7 @@ impl DiagnosticsContext<'_> { } })() .unwrap_or_else(|| sema.diagnostics_display_range(*node)) + .into() } } @@ -303,6 +308,9 @@ pub fn diagnostics( ) -> Vec { let _p = tracing::info_span!("diagnostics").entered(); let sema = Semantics::new(db); + let file_id = sema + .attach_first_edition(file_id) + .unwrap_or_else(|| EditionedFileId::current_edition(file_id)); let mut res = Vec::new(); // [#34344] Only take first 128 errors to prevent slowing down editor/ide, the number 128 is chosen arbitrarily. @@ -310,7 +318,7 @@ pub fn diagnostics( Diagnostic::new( DiagnosticCode::RustcHardError("syntax-error"), format!("Syntax Error: {err}"), - FileRange { file_id, range: err.range() }, + FileRange { file_id: file_id.into(), range: err.range() }, ) })); let parse_errors = res.len(); @@ -336,7 +344,7 @@ pub fn diagnostics( // file, so we skip semantic diagnostics so we can show these faster. Some(m) if parse_errors < 16 => m.diagnostics(db, &mut diags, config.style_lints), Some(_) => (), - None => handlers::unlinked_file::unlinked_file(&ctx, &mut res, file_id), + None => handlers::unlinked_file::unlinked_file(&ctx, &mut res, file_id.file_id()), } for diag in diags { @@ -627,4 +635,5 @@ fn adjusted_display_range( diag_ptr .with_value(adj(node).unwrap_or_else(|| diag_ptr.value.text_range())) .original_node_file_range_rooted(ctx.sema.db) + .into() } diff --git a/crates/ide-diagnostics/src/tests.rs b/crates/ide-diagnostics/src/tests.rs index cd5e95cc1e..e56fca1e50 100644 --- a/crates/ide-diagnostics/src/tests.rs +++ b/crates/ide-diagnostics/src/tests.rs @@ -60,7 +60,7 @@ fn check_nth_fix_with_config( let (db, file_position) = RootDatabase::with_position(ra_fixture_before); let diagnostic = - super::diagnostics(&db, &config, &AssistResolveStrategy::All, file_position.file_id) + super::diagnostics(&db, &config, &AssistResolveStrategy::All, file_position.file_id.into()) .pop() .expect("no diagnostics"); let fix = &diagnostic @@ -102,34 +102,37 @@ pub(crate) fn check_has_fix(ra_fixture_before: &str, ra_fixture_after: &str) { let (db, file_position) = RootDatabase::with_position(ra_fixture_before); let mut conf = DiagnosticsConfig::test_sample(); conf.expr_fill_default = ExprFillDefaultMode::Default; - let fix = super::diagnostics(&db, &conf, &AssistResolveStrategy::All, file_position.file_id) - .into_iter() - .find(|d| { - d.fixes - .as_ref() - .and_then(|fixes| { - fixes.iter().find(|fix| { - if !fix.target.contains_inclusive(file_position.offset) { - return false; - } - let actual = { - let source_change = fix.source_change.as_ref().unwrap(); - let file_id = *source_change.source_file_edits.keys().next().unwrap(); - let mut actual = db.file_text(file_id).to_string(); - - for (edit, snippet_edit) in source_change.source_file_edits.values() { - edit.apply(&mut actual); - if let Some(snippet_edit) = snippet_edit { - snippet_edit.apply(&mut actual); - } + let fix = + super::diagnostics(&db, &conf, &AssistResolveStrategy::All, file_position.file_id.into()) + .into_iter() + .find(|d| { + d.fixes + .as_ref() + .and_then(|fixes| { + fixes.iter().find(|fix| { + if !fix.target.contains_inclusive(file_position.offset) { + return false; } - actual - }; - after == actual + let actual = { + let source_change = fix.source_change.as_ref().unwrap(); + let file_id = + *source_change.source_file_edits.keys().next().unwrap(); + let mut actual = db.file_text(file_id).to_string(); + + for (edit, snippet_edit) in source_change.source_file_edits.values() + { + edit.apply(&mut actual); + if let Some(snippet_edit) = snippet_edit { + snippet_edit.apply(&mut actual); + } + } + actual + }; + after == actual + }) }) - }) - .is_some() - }); + .is_some() + }); assert!(fix.is_some(), "no diagnostic with desired fix"); } @@ -141,35 +144,38 @@ pub(crate) fn check_has_single_fix(ra_fixture_before: &str, ra_fixture_after: &s let mut conf = DiagnosticsConfig::test_sample(); conf.expr_fill_default = ExprFillDefaultMode::Default; let mut n_fixes = 0; - let fix = super::diagnostics(&db, &conf, &AssistResolveStrategy::All, file_position.file_id) - .into_iter() - .find(|d| { - d.fixes - .as_ref() - .and_then(|fixes| { - n_fixes += fixes.len(); - fixes.iter().find(|fix| { - if !fix.target.contains_inclusive(file_position.offset) { - return false; - } - let actual = { - let source_change = fix.source_change.as_ref().unwrap(); - let file_id = *source_change.source_file_edits.keys().next().unwrap(); - let mut actual = db.file_text(file_id).to_string(); - - for (edit, snippet_edit) in source_change.source_file_edits.values() { - edit.apply(&mut actual); - if let Some(snippet_edit) = snippet_edit { - snippet_edit.apply(&mut actual); - } + let fix = + super::diagnostics(&db, &conf, &AssistResolveStrategy::All, file_position.file_id.into()) + .into_iter() + .find(|d| { + d.fixes + .as_ref() + .and_then(|fixes| { + n_fixes += fixes.len(); + fixes.iter().find(|fix| { + if !fix.target.contains_inclusive(file_position.offset) { + return false; } - actual - }; - after == actual + let actual = { + let source_change = fix.source_change.as_ref().unwrap(); + let file_id = + *source_change.source_file_edits.keys().next().unwrap(); + let mut actual = db.file_text(file_id).to_string(); + + for (edit, snippet_edit) in source_change.source_file_edits.values() + { + edit.apply(&mut actual); + if let Some(snippet_edit) = snippet_edit { + snippet_edit.apply(&mut actual); + } + } + actual + }; + after == actual + }) }) - }) - .is_some() - }); + .is_some() + }); assert!(fix.is_some(), "no diagnostic with desired fix"); assert!(n_fixes == 1, "Too many fixes suggested"); } @@ -181,7 +187,7 @@ pub(crate) fn check_no_fix(ra_fixture: &str) { &db, &DiagnosticsConfig::test_sample(), &AssistResolveStrategy::All, - file_position.file_id, + file_position.file_id.into(), ) .pop() .unwrap(); @@ -209,8 +215,9 @@ pub(crate) fn check_diagnostics_with_config(config: DiagnosticsConfig, ra_fixtur .iter() .copied() .flat_map(|file_id| { - super::diagnostics(&db, &config, &AssistResolveStrategy::All, file_id).into_iter().map( - |d| { + super::diagnostics(&db, &config, &AssistResolveStrategy::All, file_id.into()) + .into_iter() + .map(|d| { let mut annotation = String::new(); if let Some(fixes) = &d.fixes { assert!(!fixes.is_empty()); @@ -225,12 +232,12 @@ pub(crate) fn check_diagnostics_with_config(config: DiagnosticsConfig, ra_fixtur annotation.push_str(": "); annotation.push_str(&d.message); (d.range, annotation) - }, - ) + }) }) .map(|(diagnostic, annotation)| (diagnostic.file_id, (diagnostic.range, annotation))) .into_group_map(); for file_id in files { + let file_id = file_id.into(); let line_index = db.line_index(file_id); let mut actual = annotations.remove(&file_id).unwrap_or_default(); @@ -268,6 +275,7 @@ fn test_disabled_diagnostics() { config.disabled.insert("E0583".into()); let (db, file_id) = RootDatabase::with_single_file(r#"mod foo;"#); + let file_id = file_id.into(); let diagnostics = super::diagnostics(&db, &config, &AssistResolveStrategy::All, file_id); assert!(diagnostics.is_empty()); diff --git a/crates/ide-ssr/src/from_comment.rs b/crates/ide-ssr/src/from_comment.rs index 5b6e016251..a14e69030e 100644 --- a/crates/ide-ssr/src/from_comment.rs +++ b/crates/ide-ssr/src/from_comment.rs @@ -1,10 +1,7 @@ //! This module allows building an SSR MatchFinder by parsing the SSR rule //! from a comment. -use ide_db::{ - base_db::{FilePosition, FileRange, SourceDatabase}, - RootDatabase, -}; +use ide_db::{base_db::SourceDatabase, EditionedFileId, FilePosition, FileRange, RootDatabase}; use syntax::{ ast::{self, AstNode, AstToken}, TextRange, @@ -20,7 +17,7 @@ pub fn ssr_from_comment( frange: FileRange, ) -> Option<(MatchFinder<'_>, TextRange)> { let comment = { - let file = db.parse(frange.file_id); + let file = db.parse(EditionedFileId::current_edition(frange.file_id)); file.tree().syntax().token_at_offset(frange.range.start()).find_map(ast::Comment::cast) }?; let comment_text_without_prefix = comment.text().strip_prefix(comment.prefix()).unwrap(); diff --git a/crates/ide-ssr/src/lib.rs b/crates/ide-ssr/src/lib.rs index 407433ed19..e62ef60433 100644 --- a/crates/ide-ssr/src/lib.rs +++ b/crates/ide-ssr/src/lib.rs @@ -83,9 +83,8 @@ mod tests; pub use crate::{errors::SsrError, from_comment::ssr_from_comment, matching::Match}; use crate::{errors::bail, matching::MatchFailureReason}; -use hir::Semantics; -use ide_db::base_db::{FileId, FilePosition, FileRange}; -use nohash_hasher::IntMap; +use hir::{FileRange, Semantics}; +use ide_db::{EditionedFileId, FileId, FxHashMap, RootDatabase}; use resolving::ResolvedRule; use syntax::{ast, AstNode, SyntaxNode, TextRange}; use text_edit::TextEdit; @@ -116,21 +115,27 @@ pub struct MatchFinder<'db> { sema: Semantics<'db, ide_db::RootDatabase>, rules: Vec, resolution_scope: resolving::ResolutionScope<'db>, - restrict_ranges: Vec, + restrict_ranges: Vec, } impl<'db> MatchFinder<'db> { /// Constructs a new instance where names will be looked up as if they appeared at /// `lookup_context`. pub fn in_context( - db: &'db ide_db::RootDatabase, - lookup_context: FilePosition, - mut restrict_ranges: Vec, + db: &'db RootDatabase, + lookup_context: ide_db::FilePosition, + mut restrict_ranges: Vec, ) -> Result, SsrError> { restrict_ranges.retain(|range| !range.range.is_empty()); let sema = Semantics::new(db); - let resolution_scope = resolving::ResolutionScope::new(&sema, lookup_context) - .ok_or_else(|| SsrError("no resolution scope for file".into()))?; + let file_id = sema + .attach_first_edition(lookup_context.file_id) + .unwrap_or_else(|| EditionedFileId::current_edition(lookup_context.file_id)); + let resolution_scope = resolving::ResolutionScope::new( + &sema, + hir::FilePosition { file_id, offset: lookup_context.offset }, + ) + .ok_or_else(|| SsrError("no resolution scope for file".into()))?; Ok(MatchFinder { sema, rules: Vec::new(), resolution_scope, restrict_ranges }) } @@ -143,7 +148,7 @@ impl<'db> MatchFinder<'db> { { MatchFinder::in_context( db, - FilePosition { file_id: first_file_id, offset: 0.into() }, + ide_db::FilePosition { file_id: first_file_id, offset: 0.into() }, vec![], ) } else { @@ -166,12 +171,12 @@ impl<'db> MatchFinder<'db> { } /// Finds matches for all added rules and returns edits for all found matches. - pub fn edits(&self) -> IntMap { + pub fn edits(&self) -> FxHashMap { use ide_db::base_db::SourceDatabaseExt; - let mut matches_by_file = IntMap::default(); + let mut matches_by_file = FxHashMap::default(); for m in self.matches().matches { matches_by_file - .entry(m.range.file_id) + .entry(m.range.file_id.file_id()) .or_insert_with(SsrMatches::default) .matches .push(m); @@ -218,11 +223,15 @@ impl<'db> MatchFinder<'db> { /// Finds all nodes in `file_id` whose text is exactly equal to `snippet` and attempts to match /// them, while recording reasons why they don't match. This API is useful for command /// line-based debugging where providing a range is difficult. - pub fn debug_where_text_equal(&self, file_id: FileId, snippet: &str) -> Vec { + pub fn debug_where_text_equal( + &self, + file_id: EditionedFileId, + snippet: &str, + ) -> Vec { use ide_db::base_db::SourceDatabaseExt; let file = self.sema.parse(file_id); let mut res = Vec::new(); - let file_text = self.sema.db.file_text(file_id); + let file_text = self.sema.db.file_text(file_id.into()); let mut remaining_text = &*file_text; let mut base = 0; let len = snippet.len() as u32; @@ -349,7 +358,7 @@ impl std::error::Error for SsrError {} #[cfg(test)] impl MatchDebugInfo { - pub(crate) fn match_failure_reason(&self) -> Option<&str> { + pub fn match_failure_reason(&self) -> Option<&str> { self.matched.as_ref().err().map(|r| r.reason.as_str()) } } diff --git a/crates/ide-ssr/src/matching.rs b/crates/ide-ssr/src/matching.rs index 7c357b3c21..5f6d77c064 100644 --- a/crates/ide-ssr/src/matching.rs +++ b/crates/ide-ssr/src/matching.rs @@ -6,8 +6,8 @@ use crate::{ resolving::{ResolvedPattern, ResolvedRule, UfcsCallInfo}, SsrMatches, }; -use hir::{ImportPathConfig, Semantics}; -use ide_db::{base_db::FileRange, FxHashMap}; +use hir::{FileRange, ImportPathConfig, Semantics}; +use ide_db::FxHashMap; use std::{cell::Cell, iter::Peekable}; use syntax::{ ast::{self, AstNode, AstToken, HasGenericArgs}, @@ -801,7 +801,12 @@ mod tests { let input = "fn foo() {} fn bar() {} fn main() { foo(1+2); }"; let (db, position, selections) = crate::tests::single_file(input); - let mut match_finder = MatchFinder::in_context(&db, position, selections).unwrap(); + let mut match_finder = MatchFinder::in_context( + &db, + position.into(), + selections.into_iter().map(Into::into).collect(), + ) + .unwrap(); match_finder.add_rule(rule).unwrap(); let matches = match_finder.matches(); assert_eq!(matches.matches.len(), 1); @@ -810,7 +815,7 @@ mod tests { let edits = match_finder.edits(); assert_eq!(edits.len(), 1); - let edit = &edits[&position.file_id]; + let edit = &edits[&position.file_id.into()]; let mut after = input.to_owned(); edit.apply(&mut after); assert_eq!(after, "fn foo() {} fn bar() {} fn main() { bar(1+2); }"); diff --git a/crates/ide-ssr/src/resolving.rs b/crates/ide-ssr/src/resolving.rs index 9feb096677..270ee0b3ec 100644 --- a/crates/ide-ssr/src/resolving.rs +++ b/crates/ide-ssr/src/resolving.rs @@ -1,7 +1,7 @@ //! This module is responsible for resolving paths within rules. use hir::AsAssocItem; -use ide_db::{base_db::FilePosition, FxHashMap}; +use ide_db::FxHashMap; use parsing::Placeholder; use syntax::{ ast::{self, HasGenericArgs}, @@ -195,7 +195,7 @@ impl Resolver<'_, '_> { impl<'db> ResolutionScope<'db> { pub(crate) fn new( sema: &hir::Semantics<'db, ide_db::RootDatabase>, - resolve_context: FilePosition, + resolve_context: hir::FilePosition, ) -> Option> { use syntax::ast::AstNode; let file = sema.parse(resolve_context.file_id); diff --git a/crates/ide-ssr/src/search.rs b/crates/ide-ssr/src/search.rs index 55a49da242..832386685d 100644 --- a/crates/ide-ssr/src/search.rs +++ b/crates/ide-ssr/src/search.rs @@ -5,11 +5,11 @@ use crate::{ resolving::{ResolvedPath, ResolvedPattern, ResolvedRule}, Match, MatchFinder, }; +use hir::FileRange; use ide_db::{ - base_db::{FileId, FileRange}, defs::Definition, search::{SearchScope, UsageSearchResult}, - FxHashSet, + EditionedFileId, FileId, FxHashSet, }; use syntax::{ast, AstNode, SyntaxKind, SyntaxNode}; @@ -136,14 +136,18 @@ impl MatchFinder<'_> { // seems to get put into a single source root. let mut files = Vec::new(); self.search_files_do(|file_id| { - files.push(file_id); + files.push( + self.sema + .attach_first_edition(file_id) + .unwrap_or_else(|| EditionedFileId::current_edition(file_id)), + ); }); SearchScope::files(&files) } fn slow_scan(&self, rule: &ResolvedRule, matches_out: &mut Vec) { self.search_files_do(|file_id| { - let file = self.sema.parse(file_id); + let file = self.sema.parse_guess_edition(file_id); let code = file.syntax(); self.slow_scan_node(code, rule, &None, matches_out); }) diff --git a/crates/ide-ssr/src/tests.rs b/crates/ide-ssr/src/tests.rs index e608b0a7c4..c5125cf42e 100644 --- a/crates/ide-ssr/src/tests.rs +++ b/crates/ide-ssr/src/tests.rs @@ -1,7 +1,8 @@ use expect_test::{expect, Expect}; +use hir::{FilePosition, FileRange}; use ide_db::{ - base_db::{salsa::Durability, FileId, FilePosition, FileRange, SourceDatabaseExt}, - FxHashSet, + base_db::{salsa::Durability, SourceDatabaseExt}, + EditionedFileId, FxHashSet, }; use test_utils::RangeOrOffset; use triomphe::Arc; @@ -97,7 +98,12 @@ fn assert_ssr_transform(rule: &str, input: &str, expected: Expect) { fn assert_ssr_transforms(rules: &[&str], input: &str, expected: Expect) { let (db, position, selections) = single_file(input); - let mut match_finder = MatchFinder::in_context(&db, position, selections).unwrap(); + let mut match_finder = MatchFinder::in_context( + &db, + position.into(), + selections.into_iter().map(Into::into).collect(), + ) + .unwrap(); for rule in rules { let rule: SsrRule = rule.parse().unwrap(); match_finder.add_rule(rule).unwrap(); @@ -108,13 +114,13 @@ fn assert_ssr_transforms(rules: &[&str], input: &str, expected: Expect) { } // Note, db.file_text is not necessarily the same as `input`, since fixture parsing alters // stuff. - let mut actual = db.file_text(position.file_id).to_string(); - edits[&position.file_id].apply(&mut actual); + let mut actual = db.file_text(position.file_id.into()).to_string(); + edits[&position.file_id.into()].apply(&mut actual); expected.assert_eq(&actual); } #[allow(clippy::print_stdout)] -fn print_match_debug_info(match_finder: &MatchFinder<'_>, file_id: FileId, snippet: &str) { +fn print_match_debug_info(match_finder: &MatchFinder<'_>, file_id: EditionedFileId, snippet: &str) { let debug_info = match_finder.debug_where_text_equal(file_id, snippet); println!( "Match debug info: {} nodes had text exactly equal to '{}'", @@ -128,7 +134,12 @@ fn print_match_debug_info(match_finder: &MatchFinder<'_>, file_id: FileId, snipp fn assert_matches(pattern: &str, code: &str, expected: &[&str]) { let (db, position, selections) = single_file(code); - let mut match_finder = MatchFinder::in_context(&db, position, selections).unwrap(); + let mut match_finder = MatchFinder::in_context( + &db, + position.into(), + selections.into_iter().map(Into::into).collect(), + ) + .unwrap(); match_finder.add_search_pattern(pattern.parse().unwrap()).unwrap(); let matched_strings: Vec = match_finder.matches().flattened().matches.iter().map(|m| m.matched_text()).collect(); @@ -140,7 +151,12 @@ fn assert_matches(pattern: &str, code: &str, expected: &[&str]) { fn assert_no_match(pattern: &str, code: &str) { let (db, position, selections) = single_file(code); - let mut match_finder = MatchFinder::in_context(&db, position, selections).unwrap(); + let mut match_finder = MatchFinder::in_context( + &db, + position.into(), + selections.into_iter().map(Into::into).collect(), + ) + .unwrap(); match_finder.add_search_pattern(pattern.parse().unwrap()).unwrap(); let matches = match_finder.matches().flattened().matches; if !matches.is_empty() { @@ -151,7 +167,12 @@ fn assert_no_match(pattern: &str, code: &str) { fn assert_match_failure_reason(pattern: &str, code: &str, snippet: &str, expected_reason: &str) { let (db, position, selections) = single_file(code); - let mut match_finder = MatchFinder::in_context(&db, position, selections).unwrap(); + let mut match_finder = MatchFinder::in_context( + &db, + position.into(), + selections.into_iter().map(Into::into).collect(), + ) + .unwrap(); match_finder.add_search_pattern(pattern.parse().unwrap()).unwrap(); let mut reasons = Vec::new(); for d in match_finder.debug_where_text_equal(position.file_id, snippet) { @@ -452,7 +473,7 @@ fn match_struct_instantiation() { fn match_path() { let code = r#" mod foo { - pub fn bar() {} + pub(crate) fn bar() {} } fn f() {foo::bar(42)}"#; assert_matches("foo::bar", code, &["foo::bar"]); @@ -471,8 +492,8 @@ fn match_pattern() { fn match_fully_qualified_fn_path() { let code = r#" mod a { - pub mod b { - pub fn c(_: i32) {} + pub(crate) mod b { + pub(crate) fn c(_: i32) {} } } use a::b::c; @@ -487,8 +508,8 @@ fn match_fully_qualified_fn_path() { fn match_resolved_type_name() { let code = r#" mod m1 { - pub mod m2 { - pub trait Foo {} + pub(crate) mod m2 { + pub(crate) trait Foo {} } } mod m3 { @@ -508,9 +529,9 @@ fn type_arguments_within_path() { cov_mark::check!(type_arguments_within_path); let code = r#" mod foo { - pub struct Bar {t: T} + pub(crate) struct Bar {t: T} impl Bar { - pub fn baz() {} + pub(crate) fn baz() {} } } fn f1() {foo::Bar::::baz();} @@ -659,9 +680,9 @@ fn replace_associated_trait_default_function_call() { "Bar2::foo() ==>> Bar2::foo2()", r#" trait Foo { fn foo() {} } - pub struct Bar {} + pub(crate) struct Bar {} impl Foo for Bar {} - pub struct Bar2 {} + pub(crate) struct Bar2 {} impl Foo for Bar2 {} impl Bar2 { fn foo2() {} } fn main() { @@ -671,9 +692,9 @@ fn replace_associated_trait_default_function_call() { "#, expect![[r#" trait Foo { fn foo() {} } - pub struct Bar {} + pub(crate) struct Bar {} impl Foo for Bar {} - pub struct Bar2 {} + pub(crate) struct Bar2 {} impl Foo for Bar2 {} impl Bar2 { fn foo2() {} } fn main() { @@ -691,9 +712,9 @@ fn replace_associated_trait_constant() { "Bar2::VALUE ==>> Bar2::VALUE_2222", r#" trait Foo { const VALUE: i32; const VALUE_2222: i32; } - pub struct Bar {} + pub(crate) struct Bar {} impl Foo for Bar { const VALUE: i32 = 1; const VALUE_2222: i32 = 2; } - pub struct Bar2 {} + pub(crate) struct Bar2 {} impl Foo for Bar2 { const VALUE: i32 = 1; const VALUE_2222: i32 = 2; } impl Bar2 { fn foo2() {} } fn main() { @@ -703,9 +724,9 @@ fn replace_associated_trait_constant() { "#, expect![[r#" trait Foo { const VALUE: i32; const VALUE_2222: i32; } - pub struct Bar {} + pub(crate) struct Bar {} impl Foo for Bar { const VALUE: i32 = 1; const VALUE_2222: i32 = 2; } - pub struct Bar2 {} + pub(crate) struct Bar2 {} impl Foo for Bar2 { const VALUE: i32 = 1; const VALUE_2222: i32 = 2; } impl Bar2 { fn foo2() {} } fn main() { @@ -726,10 +747,10 @@ fn replace_path_in_different_contexts() { "c::foo() ==>> c::bar()", r#" mod a { - pub mod b {$0 - pub mod c { - pub fn foo() {} - pub fn bar() {} + pub(crate) mod b {$0 + pub(crate) mod c { + pub(crate) fn foo() {} + pub(crate) fn bar() {} fn f1() { foo() } } fn f2() { c::foo() } @@ -741,10 +762,10 @@ fn replace_path_in_different_contexts() { "#, expect![[r#" mod a { - pub mod b { - pub mod c { - pub fn foo() {} - pub fn bar() {} + pub(crate) mod b { + pub(crate) mod c { + pub(crate) fn foo() {} + pub(crate) fn bar() {} fn f1() { bar() } } fn f2() { c::bar() } @@ -763,15 +784,15 @@ fn replace_associated_function_with_generics() { "c::Foo::<$a>::new() ==>> d::Bar::<$a>::default()", r#" mod c { - pub struct Foo {v: T} - impl Foo { pub fn new() {} } + pub(crate) struct Foo {v: T} + impl Foo { pub(crate) fn new() {} } fn f1() { Foo::::new(); } } mod d { - pub struct Bar {v: T} - impl Bar { pub fn default() {} } + pub(crate) struct Bar {v: T} + impl Bar { pub(crate) fn default() {} } fn f1() { super::c::Foo::::new(); } @@ -779,15 +800,15 @@ fn replace_associated_function_with_generics() { "#, expect![[r#" mod c { - pub struct Foo {v: T} - impl Foo { pub fn new() {} } + pub(crate) struct Foo {v: T} + impl Foo { pub(crate) fn new() {} } fn f1() { crate::d::Bar::::default(); } } mod d { - pub struct Bar {v: T} - impl Bar { pub fn default() {} } + pub(crate) struct Bar {v: T} + impl Bar { pub(crate) fn default() {} } fn f1() { Bar::::default(); } @@ -1029,14 +1050,14 @@ fn use_declaration_with_braces() { assert_ssr_transform( "foo::bar ==>> foo2::bar2", r#" - mod foo { pub fn bar() {} pub fn baz() {} } - mod foo2 { pub fn bar2() {} } + mod foo { pub(crate) fn bar() {} pub(crate) fn baz() {} } + mod foo2 { pub(crate) fn bar2() {} } use foo::{baz, bar}; fn main() { bar() } "#, expect![[" - mod foo { pub fn bar() {} pub fn baz() {} } - mod foo2 { pub fn bar2() {} } + mod foo { pub(crate) fn bar() {} pub(crate) fn baz() {} } + mod foo2 { pub(crate) fn bar2() {} } use foo::{baz, bar}; fn main() { foo2::bar2() } "]], @@ -1266,9 +1287,9 @@ fn match_trait_method_call() { // `Bar::foo` and `Bar2::foo` resolve to the same function. Make sure we only match if the type // matches what's in the pattern. Also checks that we handle autoderef. let code = r#" - pub struct Bar {} - pub struct Bar2 {} - pub trait Foo { + pub(crate) struct Bar {} + pub(crate) struct Bar2 {} + pub(crate) trait Foo { fn foo(&self, _: i32) {} } impl Foo for Bar {} diff --git a/crates/ide/src/annotations.rs b/crates/ide/src/annotations.rs index f49c5af0af..670d202411 100644 --- a/crates/ide/src/annotations.rs +++ b/crates/ide/src/annotations.rs @@ -1,9 +1,7 @@ use hir::{HasSource, InFile, InRealFile, Semantics}; use ide_db::{ - base_db::{FileId, FilePosition, FileRange}, - defs::Definition, - helpers::visit_file_defs, - FxHashSet, RootDatabase, + defs::Definition, helpers::visit_file_defs, FileId, FilePosition, FileRange, FxHashSet, + RootDatabase, }; use itertools::Itertools; use syntax::{ast::HasName, AstNode, TextRange}; diff --git a/crates/ide/src/annotations/fn_references.rs b/crates/ide/src/annotations/fn_references.rs index 2e7e230e5a..08cc10509c 100644 --- a/crates/ide/src/annotations/fn_references.rs +++ b/crates/ide/src/annotations/fn_references.rs @@ -13,7 +13,7 @@ pub(super) fn find_all_methods( file_id: FileId, ) -> Vec<(TextRange, Option)> { let sema = Semantics::new(db); - let source_file = sema.parse(file_id); + let source_file = sema.parse_guess_edition(file_id); source_file.syntax().descendants().filter_map(method_range).collect() } diff --git a/crates/ide/src/call_hierarchy.rs b/crates/ide/src/call_hierarchy.rs index 3c29f2f427..8709310485 100644 --- a/crates/ide/src/call_hierarchy.rs +++ b/crates/ide/src/call_hierarchy.rs @@ -7,9 +7,8 @@ use ide_db::{ defs::{Definition, NameClass, NameRefClass}, helpers::pick_best_token, search::FileReference, - FxIndexMap, RootDatabase, + FileRange, FxIndexMap, RootDatabase, }; -use span::FileRange; use syntax::{ast, AstNode, SyntaxKind::IDENT}; use crate::{goto_definition, FilePosition, NavigationTarget, RangeInfo, TryToNav}; @@ -33,7 +32,7 @@ pub(crate) fn incoming_calls( ) -> Option> { let sema = &Semantics::new(db); - let file = sema.parse(file_id); + let file = sema.parse_guess_edition(file_id); let file = file.syntax(); let mut calls = CallLocations::default(); @@ -63,9 +62,9 @@ pub(crate) fn incoming_calls( }); if let Some(nav) = nav { let range = sema.original_range(name.syntax()); - calls.add(nav.call_site, range); + calls.add(nav.call_site, range.into()); if let Some(other) = nav.def_site { - calls.add(other, range); + calls.add(other, range.into()); } } } @@ -79,7 +78,7 @@ pub(crate) fn outgoing_calls( FilePosition { file_id, offset }: FilePosition, ) -> Option> { let sema = Semantics::new(db); - let file = sema.parse(file_id); + let file = sema.parse_guess_edition(file_id); let file = file.syntax(); let token = pick_best_token(file.token_at_offset(offset), |kind| match kind { IDENT => 1, @@ -121,7 +120,7 @@ pub(crate) fn outgoing_calls( Some(nav_target.into_iter().zip(iter::repeat(range))) }) .flatten() - .for_each(|(nav, range)| calls.add(nav, range)); + .for_each(|(nav, range)| calls.add(nav, range.into())); Some(calls.into_items()) } @@ -144,7 +143,7 @@ impl CallLocations { #[cfg(test)] mod tests { use expect_test::{expect, Expect}; - use ide_db::base_db::FilePosition; + use ide_db::FilePosition; use itertools::Itertools; use crate::fixture; diff --git a/crates/ide/src/doc_links.rs b/crates/ide/src/doc_links.rs index 7214c89a1e..e9e5240897 100644 --- a/crates/ide/src/doc_links.rs +++ b/crates/ide/src/doc_links.rs @@ -137,7 +137,7 @@ pub(crate) fn external_docs( sysroot: Option<&str>, ) -> Option { let sema = &Semantics::new(db); - let file = sema.parse(file_id).syntax().clone(); + let file = sema.parse_guess_edition(file_id).syntax().clone(); let token = pick_best_token(file.token_at_offset(offset), |kind| match kind { IDENT | INT_NUMBER | T![self] => 3, T!['('] | T![')'] => 2, diff --git a/crates/ide/src/doc_links/tests.rs b/crates/ide/src/doc_links/tests.rs index ac44908a90..fe91c81a61 100644 --- a/crates/ide/src/doc_links/tests.rs +++ b/crates/ide/src/doc_links/tests.rs @@ -3,10 +3,9 @@ use std::iter; use expect_test::{expect, Expect}; use hir::Semantics; use ide_db::{ - base_db::{FilePosition, FileRange}, defs::Definition, documentation::{Documentation, HasDocs}, - RootDatabase, + FilePosition, FileRange, RootDatabase, }; use itertools::Itertools; use syntax::{ast, match_ast, AstNode, SyntaxNode}; @@ -80,7 +79,7 @@ fn def_under_cursor( position: &FilePosition, ) -> (Definition, Documentation) { let (docs, def) = sema - .parse(position.file_id) + .parse_guess_edition(position.file_id) .syntax() .token_at_offset(position.offset) .left_biased() diff --git a/crates/ide/src/expand_macro.rs b/crates/ide/src/expand_macro.rs index 4b54c057bf..c8fe45c9cf 100644 --- a/crates/ide/src/expand_macro.rs +++ b/crates/ide/src/expand_macro.rs @@ -1,7 +1,7 @@ use hir::{DescendPreference, InFile, MacroFileIdExt, Semantics}; use ide_db::{ - base_db::FileId, helpers::pick_best_token, - syntax_helpers::insert_whitespace_into_node::insert_ws_into, RootDatabase, + helpers::pick_best_token, syntax_helpers::insert_whitespace_into_node::insert_ws_into, FileId, + RootDatabase, }; use syntax::{ast, ted, AstNode, NodeOrToken, SyntaxKind, SyntaxNode, T}; @@ -25,7 +25,7 @@ pub struct ExpandedMacro { // image::https://user-images.githubusercontent.com/48062697/113020648-b3973180-917a-11eb-84a9-ecb921293dc5.gif[] pub(crate) fn expand_macro(db: &RootDatabase, position: FilePosition) -> Option { let sema = Semantics::new(db); - let file = sema.parse(position.file_id); + let file = sema.parse_guess_edition(position.file_id); let tok = pick_best_token(file.syntax().token_at_offset(position.offset), |kind| match kind { SyntaxKind::IDENT => 1, diff --git a/crates/ide/src/extend_selection.rs b/crates/ide/src/extend_selection.rs index e8d6dc9734..5f6aaeaabb 100644 --- a/crates/ide/src/extend_selection.rs +++ b/crates/ide/src/extend_selection.rs @@ -26,7 +26,7 @@ use crate::FileRange; // image::https://user-images.githubusercontent.com/48062697/113020651-b42fc800-917a-11eb-8a4f-cf1a07859fac.gif[] pub(crate) fn extend_selection(db: &RootDatabase, frange: FileRange) -> TextRange { let sema = Semantics::new(db); - let src = sema.parse(frange.file_id); + let src = sema.parse_guess_edition(frange.file_id); try_extend_selection(&sema, src.syntax(), frange).unwrap_or(frange.range) } diff --git a/crates/ide/src/fetch_crates.rs b/crates/ide/src/fetch_crates.rs index 712615c49a..37b3cb03b3 100644 --- a/crates/ide/src/fetch_crates.rs +++ b/crates/ide/src/fetch_crates.rs @@ -1,6 +1,6 @@ use ide_db::{ - base_db::{CrateOrigin, FileId, SourceDatabase}, - FxIndexSet, RootDatabase, + base_db::{CrateOrigin, SourceDatabase}, + FileId, FxIndexSet, RootDatabase, }; #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] diff --git a/crates/ide/src/fixture.rs b/crates/ide/src/fixture.rs index 3b19b85c4b..b16511072b 100644 --- a/crates/ide/src/fixture.rs +++ b/crates/ide/src/fixture.rs @@ -10,7 +10,7 @@ pub(crate) fn file(ra_fixture: &str) -> (Analysis, FileId) { let change_fixture = ChangeFixture::parse(ra_fixture); host.db.enable_proc_attr_macros(); host.db.apply_change(change_fixture.change); - (host.analysis(), change_fixture.files[0]) + (host.analysis(), change_fixture.files[0].into()) } /// Creates analysis from a multi-file fixture, returns positions marked with $0. @@ -21,7 +21,7 @@ pub(crate) fn position(ra_fixture: &str) -> (Analysis, FilePosition) { host.db.apply_change(change_fixture.change); let (file_id, range_or_offset) = change_fixture.file_position.expect("expected a marker ($0)"); let offset = range_or_offset.expect_offset(); - (host.analysis(), FilePosition { file_id, offset }) + (host.analysis(), FilePosition { file_id: file_id.into(), offset }) } /// Creates analysis for a single file, returns range marked with a pair of $0. @@ -32,7 +32,7 @@ pub(crate) fn range(ra_fixture: &str) -> (Analysis, FileRange) { host.db.apply_change(change_fixture.change); let (file_id, range_or_offset) = change_fixture.file_position.expect("expected a marker ($0)"); let range = range_or_offset.expect_range(); - (host.analysis(), FileRange { file_id, range }) + (host.analysis(), FileRange { file_id: file_id.into(), range }) } /// Creates analysis for a single file, returns range marked with a pair of $0 or a position marked with $0. @@ -42,7 +42,7 @@ pub(crate) fn range_or_position(ra_fixture: &str) -> (Analysis, FileId, RangeOrO host.db.enable_proc_attr_macros(); host.db.apply_change(change_fixture.change); let (file_id, range_or_offset) = change_fixture.file_position.expect("expected a marker ($0)"); - (host.analysis(), file_id, range_or_offset) + (host.analysis(), file_id.into(), range_or_offset) } /// Creates analysis from a multi-file fixture, returns positions marked with $0. @@ -58,12 +58,14 @@ pub(crate) fn annotations(ra_fixture: &str) -> (Analysis, FilePosition, Vec<(Fil .files .iter() .flat_map(|&file_id| { - let file_text = host.analysis().file_text(file_id).unwrap(); + let file_text = host.analysis().file_text(file_id.into()).unwrap(); let annotations = extract_annotations(&file_text); - annotations.into_iter().map(move |(range, data)| (FileRange { file_id, range }, data)) + annotations + .into_iter() + .map(move |(range, data)| (FileRange { file_id: file_id.into(), range }, data)) }) .collect(); - (host.analysis(), FilePosition { file_id, offset }, annotations) + (host.analysis(), FilePosition { file_id: file_id.into(), offset }, annotations) } /// Creates analysis from a multi-file fixture with annotations without $0 @@ -77,9 +79,11 @@ pub(crate) fn annotations_without_marker(ra_fixture: &str) -> (Analysis, Vec<(Fi .files .iter() .flat_map(|&file_id| { - let file_text = host.analysis().file_text(file_id).unwrap(); + let file_text = host.analysis().file_text(file_id.into()).unwrap(); let annotations = extract_annotations(&file_text); - annotations.into_iter().map(move |(range, data)| (FileRange { file_id, range }, data)) + annotations + .into_iter() + .map(move |(range, data)| (FileRange { file_id: file_id.into(), range }, data)) }) .collect(); (host.analysis(), annotations) diff --git a/crates/ide/src/goto_declaration.rs b/crates/ide/src/goto_declaration.rs index c19f19803f..6076de54eb 100644 --- a/crates/ide/src/goto_declaration.rs +++ b/crates/ide/src/goto_declaration.rs @@ -23,7 +23,7 @@ pub(crate) fn goto_declaration( position @ FilePosition { file_id, offset }: FilePosition, ) -> Option>> { let sema = Semantics::new(db); - let file = sema.parse(file_id).syntax().clone(); + let file = sema.parse_guess_edition(file_id).syntax().clone(); let original_token = file .token_at_offset(offset) .find(|it| matches!(it.kind(), IDENT | T![self] | T![super] | T![crate] | T![Self]))?; @@ -78,7 +78,7 @@ pub(crate) fn goto_declaration( #[cfg(test)] mod tests { - use ide_db::base_db::FileRange; + use ide_db::FileRange; use itertools::Itertools; use crate::fixture; diff --git a/crates/ide/src/goto_definition.rs b/crates/ide/src/goto_definition.rs index 7fecc37c4c..aa485fb63d 100644 --- a/crates/ide/src/goto_definition.rs +++ b/crates/ide/src/goto_definition.rs @@ -6,10 +6,10 @@ use crate::{ }; use hir::{AsAssocItem, AssocItem, DescendPreference, MacroFileIdExt, ModuleDef, Semantics}; use ide_db::{ - base_db::{AnchoredPath, FileId, FileLoader}, + base_db::{AnchoredPath, FileLoader}, defs::{Definition, IdentClass}, helpers::pick_best_token, - RootDatabase, + FileId, RootDatabase, }; use itertools::Itertools; use syntax::{ast, AstNode, AstToken, SyntaxKind::*, SyntaxToken, TextRange, T}; @@ -32,7 +32,7 @@ pub(crate) fn goto_definition( FilePosition { file_id, offset }: FilePosition, ) -> Option>> { let sema = &Semantics::new(db); - let file = sema.parse(file_id).syntax().clone(); + let file = sema.parse_guess_edition(file_id).syntax().clone(); let original_token = pick_best_token(file.token_at_offset(offset), |kind| match kind { IDENT | INT_NUMBER @@ -196,7 +196,7 @@ fn def_to_nav(db: &RootDatabase, def: Definition) -> Vec { #[cfg(test)] mod tests { - use ide_db::base_db::FileRange; + use ide_db::FileRange; use itertools::Itertools; use crate::fixture; diff --git a/crates/ide/src/goto_implementation.rs b/crates/ide/src/goto_implementation.rs index 76e5e9dd92..2eff7796d5 100644 --- a/crates/ide/src/goto_implementation.rs +++ b/crates/ide/src/goto_implementation.rs @@ -24,7 +24,7 @@ pub(crate) fn goto_implementation( FilePosition { file_id, offset }: FilePosition, ) -> Option>> { let sema = Semantics::new(db); - let source_file = sema.parse(file_id); + let source_file = sema.parse_guess_edition(file_id); let syntax = source_file.syntax().clone(); let original_token = pick_best_token(syntax.token_at_offset(offset), |kind| match kind { @@ -117,7 +117,7 @@ fn impls_for_trait_item( #[cfg(test)] mod tests { - use ide_db::base_db::FileRange; + use ide_db::FileRange; use itertools::Itertools; use crate::fixture; diff --git a/crates/ide/src/goto_type_definition.rs b/crates/ide/src/goto_type_definition.rs index ad393d9800..f75b8fb7d0 100644 --- a/crates/ide/src/goto_type_definition.rs +++ b/crates/ide/src/goto_type_definition.rs @@ -21,7 +21,7 @@ pub(crate) fn goto_type_definition( ) -> Option>> { let sema = hir::Semantics::new(db); - let file: ast::SourceFile = sema.parse(file_id); + let file: ast::SourceFile = sema.parse_guess_edition(file_id); let token: SyntaxToken = pick_best_token(file.syntax().token_at_offset(offset), |kind| match kind { IDENT | INT_NUMBER | T![self] => 2, @@ -113,7 +113,7 @@ pub(crate) fn goto_type_definition( #[cfg(test)] mod tests { - use ide_db::base_db::FileRange; + use ide_db::FileRange; use itertools::Itertools; use crate::fixture; diff --git a/crates/ide/src/highlight_related.rs b/crates/ide/src/highlight_related.rs index a5689403ee..9865190005 100644 --- a/crates/ide/src/highlight_related.rs +++ b/crates/ide/src/highlight_related.rs @@ -1,8 +1,7 @@ use std::iter; -use hir::{DescendPreference, Semantics}; +use hir::{DescendPreference, FilePosition, FileRange, Semantics}; use ide_db::{ - base_db::{FileId, FilePosition, FileRange}, defs::{Definition, IdentClass}, helpers::pick_best_token, search::{FileReference, ReferenceCategory, SearchScope}, @@ -11,6 +10,7 @@ use ide_db::{ }, FxHashSet, RootDatabase, }; +use span::EditionedFileId; use syntax::{ ast::{self, HasLoopBody}, match_ast, AstNode, @@ -53,9 +53,12 @@ pub struct HighlightRelatedConfig { pub(crate) fn highlight_related( sema: &Semantics<'_, RootDatabase>, config: HighlightRelatedConfig, - pos @ FilePosition { offset, file_id }: FilePosition, + ide_db::FilePosition { offset, file_id }: ide_db::FilePosition, ) -> Option> { let _p = tracing::info_span!("highlight_related").entered(); + let file_id = sema + .attach_first_edition(file_id) + .unwrap_or_else(|| EditionedFileId::current_edition(file_id)); let syntax = sema.parse(file_id).syntax().clone(); let token = pick_best_token(syntax.token_at_offset(offset), |kind| match kind { @@ -81,7 +84,9 @@ pub(crate) fn highlight_related( } T![|] if config.closure_captures => highlight_closure_captures(sema, token, file_id), T![move] if config.closure_captures => highlight_closure_captures(sema, token, file_id), - _ if config.references => highlight_references(sema, token, pos), + _ if config.references => { + highlight_references(sema, token, FilePosition { file_id, offset }) + } _ => None, } } @@ -89,7 +94,7 @@ pub(crate) fn highlight_related( fn highlight_closure_captures( sema: &Semantics<'_, RootDatabase>, token: SyntaxToken, - file_id: FileId, + file_id: EditionedFileId, ) -> Option> { let closure = token.parent_ancestors().take(2).find_map(ast::ClosureExpr::cast)?; let search_range = closure.body()?.syntax().text_range(); diff --git a/crates/ide/src/hover.rs b/crates/ide/src/hover.rs index 2006baa30a..500674e32b 100644 --- a/crates/ide/src/hover.rs +++ b/crates/ide/src/hover.rs @@ -8,11 +8,10 @@ use std::{iter, ops::Not}; use either::Either; use hir::{db::DefDatabase, DescendPreference, HasCrate, HasSource, LangItem, Semantics}; use ide_db::{ - base_db::FileRange, defs::{Definition, IdentClass, NameRefClass, OperatorClass}, famous_defs::FamousDefs, helpers::pick_best_token, - FxIndexSet, RootDatabase, + FileRange, FxIndexSet, RootDatabase, }; use itertools::{multizip, Itertools}; use syntax::{ast, AstNode, SyntaxKind::*, SyntaxNode, T}; @@ -110,7 +109,7 @@ pub(crate) fn hover( config: &HoverConfig, ) -> Option> { let sema = &hir::Semantics::new(db); - let file = sema.parse(file_id).syntax().clone(); + let file = sema.parse_guess_edition(file_id).syntax().clone(); let mut res = if range.is_empty() { hover_simple(sema, FilePosition { file_id, offset: range.start() }, file, config) } else { @@ -454,7 +453,7 @@ fn runnable_action( Definition::Module(it) => runnable_mod(sema, it).map(HoverAction::Runnable), Definition::Function(func) => { let src = func.source(sema.db)?; - if src.file_id != file_id.into() { + if src.file_id != file_id { cov_mark::hit!(hover_macro_generated_struct_fn_doc_comment); cov_mark::hit!(hover_macro_generated_struct_fn_doc_attr); return None; diff --git a/crates/ide/src/hover/tests.rs b/crates/ide/src/hover/tests.rs index 5036770fec..4a7db2d295 100644 --- a/crates/ide/src/hover/tests.rs +++ b/crates/ide/src/hover/tests.rs @@ -1,5 +1,5 @@ use expect_test::{expect, Expect}; -use ide_db::base_db::{FileLoader, FileRange}; +use ide_db::{base_db::FileLoader, FileRange}; use syntax::TextRange; use crate::{ diff --git a/crates/ide/src/inlay_hints.rs b/crates/ide/src/inlay_hints.rs index ce1a56e450..0a8d272757 100644 --- a/crates/ide/src/inlay_hints.rs +++ b/crates/ide/src/inlay_hints.rs @@ -8,9 +8,10 @@ use hir::{ sym, ClosureStyle, HasVisibility, HirDisplay, HirDisplayError, HirWrite, ModuleDef, ModuleDefId, Semantics, }; -use ide_db::{base_db::FileRange, famous_defs::FamousDefs, RootDatabase}; +use ide_db::{famous_defs::FamousDefs, FileRange, RootDatabase}; use itertools::Itertools; use smallvec::{smallvec, SmallVec}; +use span::EditionedFileId; use stdx::never; use syntax::{ ast::{self, AstNode}, @@ -493,6 +494,9 @@ pub(crate) fn inlay_hints( ) -> Vec { let _p = tracing::info_span!("inlay_hints").entered(); let sema = Semantics::new(db); + let file_id = sema + .attach_first_edition(file_id) + .unwrap_or_else(|| EditionedFileId::current_edition(file_id)); let file = sema.parse(file_id); let file = file.syntax(); @@ -527,6 +531,9 @@ pub(crate) fn inlay_hints_resolve( ) -> Option { let _p = tracing::info_span!("inlay_hints_resolve").entered(); let sema = Semantics::new(db); + let file_id = sema + .attach_first_edition(file_id) + .unwrap_or_else(|| EditionedFileId::current_edition(file_id)); let file = sema.parse(file_id); let file = file.syntax(); @@ -551,7 +558,7 @@ fn hints( hints: &mut Vec, famous_defs @ FamousDefs(sema, _): &FamousDefs<'_, '_>, config: &InlayHintsConfig, - file_id: FileId, + file_id: EditionedFileId, node: SyntaxNode, ) { closing_brace::hints(hints, sema, config, file_id, node.clone()); diff --git a/crates/ide/src/inlay_hints/bind_pat.rs b/crates/ide/src/inlay_hints/bind_pat.rs index 1118f11d99..5775abaeb1 100644 --- a/crates/ide/src/inlay_hints/bind_pat.rs +++ b/crates/ide/src/inlay_hints/bind_pat.rs @@ -4,9 +4,10 @@ //! let _x /* i32 */= f(4, 4); //! ``` use hir::Semantics; -use ide_db::{base_db::FileId, famous_defs::FamousDefs, RootDatabase}; +use ide_db::{famous_defs::FamousDefs, RootDatabase}; use itertools::Itertools; +use span::EditionedFileId; use syntax::{ ast::{self, AstNode, HasGenericArgs, HasName}, match_ast, @@ -21,7 +22,7 @@ pub(super) fn hints( acc: &mut Vec, famous_defs @ FamousDefs(sema, _): &FamousDefs<'_, '_>, config: &InlayHintsConfig, - _file_id: FileId, + _file_id: EditionedFileId, pat: &ast::IdentPat, ) -> Option<()> { if !config.type_hints { diff --git a/crates/ide/src/inlay_hints/chaining.rs b/crates/ide/src/inlay_hints/chaining.rs index d86487d4b4..01e748a8fa 100644 --- a/crates/ide/src/inlay_hints/chaining.rs +++ b/crates/ide/src/inlay_hints/chaining.rs @@ -1,11 +1,12 @@ //! Implementation of "chaining" inlay hints. use ide_db::famous_defs::FamousDefs; +use span::EditionedFileId; use syntax::{ ast::{self, AstNode}, Direction, NodeOrToken, SyntaxKind, T, }; -use crate::{FileId, InlayHint, InlayHintPosition, InlayHintsConfig, InlayKind}; +use crate::{InlayHint, InlayHintPosition, InlayHintsConfig, InlayKind}; use super::label_of_ty; @@ -13,7 +14,7 @@ pub(super) fn hints( acc: &mut Vec, famous_defs @ FamousDefs(sema, _): &FamousDefs<'_, '_>, config: &InlayHintsConfig, - _file_id: FileId, + _file_id: EditionedFileId, expr: &ast::Expr, ) -> Option<()> { if !config.chaining_hints { diff --git a/crates/ide/src/inlay_hints/closing_brace.rs b/crates/ide/src/inlay_hints/closing_brace.rs index 2cefd5acdc..d8aa4ba4e1 100644 --- a/crates/ide/src/inlay_hints/closing_brace.rs +++ b/crates/ide/src/inlay_hints/closing_brace.rs @@ -4,19 +4,20 @@ //! } /* fn g */ //! ``` use hir::{HirDisplay, Semantics}; -use ide_db::{base_db::FileRange, RootDatabase}; +use ide_db::{FileRange, RootDatabase}; +use span::EditionedFileId; use syntax::{ ast::{self, AstNode, HasName}, match_ast, SyntaxKind, SyntaxNode, T, }; -use crate::{FileId, InlayHint, InlayHintLabel, InlayHintPosition, InlayHintsConfig, InlayKind}; +use crate::{InlayHint, InlayHintLabel, InlayHintPosition, InlayHintsConfig, InlayKind}; pub(super) fn hints( acc: &mut Vec, sema: &Semantics<'_, RootDatabase>, config: &InlayHintsConfig, - file_id: FileId, + file_id: EditionedFileId, node: SyntaxNode, ) -> Option<()> { let min_lines = config.closing_brace_hints_min_lines?; @@ -107,7 +108,7 @@ pub(super) fn hints( return None; } - let linked_location = name_range.map(|range| FileRange { file_id, range }); + let linked_location = name_range.map(|range| FileRange { file_id: file_id.into(), range }); acc.push(InlayHint { range: closing_token.text_range(), kind: InlayKind::ClosingBrace, diff --git a/crates/ide/src/inlay_hints/closure_captures.rs b/crates/ide/src/inlay_hints/closure_captures.rs index f1b524e088..e87e10d850 100644 --- a/crates/ide/src/inlay_hints/closure_captures.rs +++ b/crates/ide/src/inlay_hints/closure_captures.rs @@ -1,7 +1,8 @@ //! Implementation of "closure return type" inlay hints. //! //! Tests live in [`bind_pat`][super::bind_pat] module. -use ide_db::{base_db::FileId, famous_defs::FamousDefs}; +use ide_db::famous_defs::FamousDefs; +use span::EditionedFileId; use stdx::TupleExt; use syntax::ast::{self, AstNode}; use text_edit::{TextRange, TextSize}; @@ -12,7 +13,7 @@ pub(super) fn hints( acc: &mut Vec, FamousDefs(sema, _): &FamousDefs<'_, '_>, config: &InlayHintsConfig, - _file_id: FileId, + _file_id: EditionedFileId, closure: ast::ClosureExpr, ) -> Option<()> { if !config.closure_capture_hints { @@ -73,7 +74,7 @@ pub(super) fn hints( ), None, source.name().and_then(|name| { - name.syntax().original_file_range_opt(sema.db).map(TupleExt::head) + name.syntax().original_file_range_opt(sema.db).map(TupleExt::head).map(Into::into) }), ); acc.push(InlayHint { diff --git a/crates/ide/src/inlay_hints/closure_ret.rs b/crates/ide/src/inlay_hints/closure_ret.rs index 3b41db0f13..f6bd7ca064 100644 --- a/crates/ide/src/inlay_hints/closure_ret.rs +++ b/crates/ide/src/inlay_hints/closure_ret.rs @@ -1,7 +1,8 @@ //! Implementation of "closure return type" inlay hints. //! //! Tests live in [`bind_pat`][super::bind_pat] module. -use ide_db::{base_db::FileId, famous_defs::FamousDefs}; +use ide_db::famous_defs::FamousDefs; +use span::EditionedFileId; use syntax::ast::{self, AstNode}; use crate::{ @@ -13,7 +14,7 @@ pub(super) fn hints( acc: &mut Vec, famous_defs @ FamousDefs(sema, _): &FamousDefs<'_, '_>, config: &InlayHintsConfig, - _file_id: FileId, + _file_id: EditionedFileId, closure: ast::ClosureExpr, ) -> Option<()> { if config.closure_return_type_hints == ClosureReturnTypeHints::Never { diff --git a/crates/ide/src/inlay_hints/discriminant.rs b/crates/ide/src/inlay_hints/discriminant.rs index 202954100f..eca0ebe629 100644 --- a/crates/ide/src/inlay_hints/discriminant.rs +++ b/crates/ide/src/inlay_hints/discriminant.rs @@ -5,7 +5,8 @@ //! } //! ``` use hir::Semantics; -use ide_db::{base_db::FileId, famous_defs::FamousDefs, RootDatabase}; +use ide_db::{famous_defs::FamousDefs, RootDatabase}; +use span::EditionedFileId; use syntax::ast::{self, AstNode, HasName}; use crate::{ @@ -17,7 +18,7 @@ pub(super) fn enum_hints( acc: &mut Vec, FamousDefs(sema, _): &FamousDefs<'_, '_>, config: &InlayHintsConfig, - _: FileId, + _: EditionedFileId, enum_: ast::Enum, ) -> Option<()> { if let DiscriminantHints::Never = config.discriminant_hints { diff --git a/crates/ide/src/inlay_hints/implicit_drop.rs b/crates/ide/src/inlay_hints/implicit_drop.rs index fcfbbbd626..86075bd9bb 100644 --- a/crates/ide/src/inlay_hints/implicit_drop.rs +++ b/crates/ide/src/inlay_hints/implicit_drop.rs @@ -10,7 +10,7 @@ use hir::{ mir::{MirSpan, TerminatorKind}, ChalkTyInterner, DefWithBody, Semantics, }; -use ide_db::{base_db::FileRange, RootDatabase}; +use ide_db::{FileRange, RootDatabase}; use syntax::{ ast::{self, AstNode}, @@ -81,13 +81,15 @@ pub(super) fn hints( MirSpan::Unknown => continue, }; let binding = &hir.bindings[*binding]; - let binding_source = binding - .definitions - .first() - .and_then(|d| source_map.pat_syntax(*d).ok()) - .and_then(|d| { - Some(FileRange { file_id: d.file_id.file_id()?, range: d.value.text_range() }) - }); + let binding_source = + binding.definitions.first().and_then(|d| source_map.pat_syntax(*d).ok()).and_then( + |d| { + Some(FileRange { + file_id: d.file_id.file_id()?.into(), + range: d.value.text_range(), + }) + }, + ); let name = binding.name.display_no_db().to_smolstr(); if name.starts_with(", + linked_location: Option, ) -> InlayHintLabel { let colon = if config.render_colons { ":" } else { "" }; - InlayHintLabel::simple(format!("{param_name}{colon}"), None, linked_location) + InlayHintLabel::simple(format!("{param_name}{colon}"), None, linked_location.map(Into::into)) } fn get_callable( diff --git a/crates/ide/src/interpret_function.rs b/crates/ide/src/interpret_function.rs index 7bd2da9f88..aeb3c8c1ee 100644 --- a/crates/ide/src/interpret_function.rs +++ b/crates/ide/src/interpret_function.rs @@ -1,8 +1,5 @@ use hir::Semantics; -use ide_db::{ - base_db::{FilePosition, SourceDatabaseExt}, - LineIndexDatabase, RootDatabase, -}; +use ide_db::{base_db::SourceDatabaseExt, FilePosition, LineIndexDatabase, RootDatabase}; use std::{fmt::Write, time::Instant}; use syntax::{algo::ancestors_at_offset, ast, AstNode, TextRange}; @@ -26,7 +23,7 @@ pub(crate) fn interpret_function(db: &RootDatabase, position: FilePosition) -> S fn find_and_interpret(db: &RootDatabase, position: FilePosition) -> Option { let sema = Semantics::new(db); - let source_file = sema.parse(position.file_id); + let source_file = sema.parse_guess_edition(position.file_id); let item = ancestors_at_offset(source_file.syntax(), position.offset) .filter(|it| !ast::MacroCall::can_cast(it.kind())) diff --git a/crates/ide/src/lib.rs b/crates/ide/src/lib.rs index a7073f7062..a154b644a3 100644 --- a/crates/ide/src/lib.rs +++ b/crates/ide/src/lib.rs @@ -70,6 +70,7 @@ use ide_db::{ }, prime_caches, symbol_index, FxHashMap, FxIndexSet, LineIndexDatabase, }; +use span::EditionedFileId; use syntax::SourceFile; use triomphe::Arc; use view_memory_layout::{view_memory_layout, RecursiveMemoryLayout}; @@ -120,10 +121,7 @@ pub use ide_completion::{ Snippet, SnippetScope, }; pub use ide_db::{ - base_db::{ - Cancelled, CrateGraph, CrateId, FileChange, FileId, FilePosition, FileRange, SourceRoot, - SourceRootId, - }, + base_db::{Cancelled, CrateGraph, CrateId, FileChange, SourceRoot, SourceRootId}, documentation::Documentation, label::Label, line_index::{LineCol, LineIndex}, @@ -131,7 +129,7 @@ pub use ide_db::{ search::{ReferenceCategory, SearchScope}, source_change::{FileSystemEdit, SnippetEdit, SourceChange}, symbol_index::Query, - RootDatabase, SymbolKind, + FileId, FilePosition, FileRange, RootDatabase, SymbolKind, }; pub use ide_diagnostics::{ Diagnostic, DiagnosticCode, DiagnosticsConfig, ExprFillDefaultMode, Severity, @@ -298,7 +296,8 @@ impl Analysis { /// Gets the syntax tree of the file. pub fn parse(&self, file_id: FileId) -> Cancellable { - self.with_db(|db| db.parse(file_id).tree()) + // FIXME editiojn + self.with_db(|db| db.parse(EditionedFileId::current_edition(file_id)).tree()) } /// Returns true if this file belongs to an immutable library. @@ -321,7 +320,7 @@ impl Analysis { /// supported). pub fn matching_brace(&self, position: FilePosition) -> Cancellable> { self.with_db(|db| { - let parse = db.parse(position.file_id); + let parse = db.parse(EditionedFileId::current_edition(position.file_id)); let file = parse.tree(); matching_brace::matching_brace(&file, position.offset) }) @@ -386,7 +385,7 @@ impl Analysis { /// stuff like trailing commas. pub fn join_lines(&self, config: &JoinLinesConfig, frange: FileRange) -> Cancellable { self.with_db(|db| { - let parse = db.parse(frange.file_id); + let parse = db.parse(EditionedFileId::current_edition(frange.file_id)); join_lines::join_lines(config, &parse.tree(), frange.range) }) } @@ -422,7 +421,12 @@ impl Analysis { /// Returns a tree representation of symbols in the file. Useful to draw a /// file outline. pub fn file_structure(&self, file_id: FileId) -> Cancellable> { - self.with_db(|db| file_structure::file_structure(&db.parse(file_id).tree())) + // FIXME: Edition + self.with_db(|db| { + file_structure::file_structure( + &db.parse(EditionedFileId::current_edition(file_id)).tree(), + ) + }) } /// Returns a list of the places in the file where type hints can be displayed. @@ -449,7 +453,11 @@ impl Analysis { /// Returns the set of folding ranges. pub fn folding_ranges(&self, file_id: FileId) -> Cancellable> { - self.with_db(|db| folding_ranges::folding_ranges(&db.parse(file_id).tree())) + self.with_db(|db| { + folding_ranges::folding_ranges( + &db.parse(EditionedFileId::current_edition(file_id)).tree(), + ) + }) } /// Fuzzy searches for a symbol. @@ -751,7 +759,7 @@ impl Analysis { ide_ssr::MatchFinder::in_context(db, resolve_context, selections)?; match_finder.add_rule(rule)?; let edits = if parse_only { Default::default() } else { match_finder.edits() }; - Ok(SourceChange::from(edits)) + Ok(SourceChange::from_iter(edits)) }) } diff --git a/crates/ide/src/moniker.rs b/crates/ide/src/moniker.rs index 81d5b52796..1b64bc9260 100644 --- a/crates/ide/src/moniker.rs +++ b/crates/ide/src/moniker.rs @@ -5,10 +5,10 @@ use core::fmt; use hir::{Adt, AsAssocItem, AssocItemContainer, Crate, DescendPreference, MacroKind, Semantics}; use ide_db::{ - base_db::{CrateOrigin, FilePosition, LangCrateOrigin}, + base_db::{CrateOrigin, LangCrateOrigin}, defs::{Definition, IdentClass}, helpers::pick_best_token, - RootDatabase, + FilePosition, RootDatabase, }; use itertools::Itertools; use syntax::{AstNode, SyntaxKind::*, T}; @@ -133,7 +133,7 @@ pub(crate) fn moniker( FilePosition { file_id, offset }: FilePosition, ) -> Option>> { let sema = &Semantics::new(db); - let file = sema.parse(file_id).syntax().clone(); + let file = sema.parse_guess_edition(file_id).syntax().clone(); let current_crate: hir::Crate = crates_for(db, file_id).pop()?.into(); let original_token = pick_best_token(file.token_at_offset(offset), |kind| match kind { IDENT diff --git a/crates/ide/src/move_item.rs b/crates/ide/src/move_item.rs index b955ea99f0..ea6cc9d6de 100644 --- a/crates/ide/src/move_item.rs +++ b/crates/ide/src/move_item.rs @@ -1,7 +1,7 @@ use std::{iter::once, mem}; use hir::Semantics; -use ide_db::{base_db::FileRange, helpers::pick_best_token, RootDatabase}; +use ide_db::{helpers::pick_best_token, FileRange, RootDatabase}; use itertools::Itertools; use syntax::{algo, ast, match_ast, AstNode, SyntaxElement, SyntaxKind, SyntaxNode, TextRange}; use text_edit::{TextEdit, TextEditBuilder}; @@ -30,7 +30,7 @@ pub(crate) fn move_item( direction: Direction, ) -> Option { let sema = Semantics::new(db); - let file = sema.parse(range.file_id); + let file = sema.parse_guess_edition(range.file_id); let item = if range.range.is_empty() { SyntaxElement::Token(pick_best_token( diff --git a/crates/ide/src/navigation_target.rs b/crates/ide/src/navigation_target.rs index 21b32f776d..c8803850d1 100644 --- a/crates/ide/src/navigation_target.rs +++ b/crates/ide/src/navigation_target.rs @@ -9,10 +9,9 @@ use hir::{ HirDisplay, HirFileId, InFile, LocalSource, ModuleSource, }; use ide_db::{ - base_db::{FileId, FileRange}, defs::Definition, documentation::{Documentation, HasDocs}, - RootDatabase, SymbolKind, + FileId, FileRange, RootDatabase, SymbolKind, }; use stdx::never; use syntax::{ @@ -824,8 +823,8 @@ fn orig_range_with_focus_r( UpmappingResult { call_site: ( - call_site_range, - call_site_focus.and_then(|FileRange { file_id, range }| { + call_site_range.into(), + call_site_focus.and_then(|hir::FileRange { file_id, range }| { if call_site_range.file_id == file_id && call_site_range.range.contains_range(range) { Some(range) @@ -836,8 +835,8 @@ fn orig_range_with_focus_r( ), def_site: def_site.map(|(def_site_range, def_site_focus)| { ( - def_site_range, - def_site_focus.and_then(|FileRange { file_id, range }| { + def_site_range.into(), + def_site_focus.and_then(|hir::FileRange { file_id, range }| { if def_site_range.file_id == file_id && def_site_range.range.contains_range(range) { @@ -857,7 +856,7 @@ fn orig_range( value: &SyntaxNode, ) -> UpmappingResult<(FileRange, Option)> { UpmappingResult { - call_site: (InFile::new(hir_file, value).original_file_range_rooted(db), None), + call_site: (InFile::new(hir_file, value).original_file_range_rooted(db).into(), None), def_site: None, } } @@ -868,7 +867,7 @@ fn orig_range_r( value: TextRange, ) -> UpmappingResult<(FileRange, Option)> { UpmappingResult { - call_site: (InFile::new(hir_file, value).original_node_file_range(db).0, None), + call_site: (InFile::new(hir_file, value).original_node_file_range(db).0.into(), None), def_site: None, } } diff --git a/crates/ide/src/parent_module.rs b/crates/ide/src/parent_module.rs index ce7a6779e2..74c50fcac3 100644 --- a/crates/ide/src/parent_module.rs +++ b/crates/ide/src/parent_module.rs @@ -1,7 +1,7 @@ use hir::{db::DefDatabase, Semantics}; use ide_db::{ - base_db::{CrateId, FileId, FileLoader, FilePosition}, - RootDatabase, + base_db::{CrateId, FileLoader}, + FileId, FilePosition, RootDatabase, }; use itertools::Itertools; use syntax::{ @@ -26,7 +26,7 @@ use crate::NavigationTarget; /// This returns `Vec` because a module may be included from several places. pub(crate) fn parent_module(db: &RootDatabase, position: FilePosition) -> Vec { let sema = Semantics::new(db); - let source_file = sema.parse(position.file_id); + let source_file = sema.parse_guess_edition(position.file_id); let mut module = find_node_at_offset::(source_file.syntax(), position.offset); @@ -66,7 +66,7 @@ pub(crate) fn crates_for(db: &RootDatabase, file_id: FileId) -> Vec { #[cfg(test)] mod tests { - use ide_db::base_db::FileRange; + use ide_db::FileRange; use crate::fixture; diff --git a/crates/ide/src/references.rs b/crates/ide/src/references.rs index 6f9e1b3740..6cb0225fe2 100644 --- a/crates/ide/src/references.rs +++ b/crates/ide/src/references.rs @@ -11,10 +11,9 @@ use hir::{DescendPreference, PathResolution, Semantics}; use ide_db::{ - base_db::FileId, defs::{Definition, NameClass, NameRefClass}, search::{ReferenceCategory, SearchScope, UsageSearchResult}, - RootDatabase, + FileId, RootDatabase, }; use itertools::Itertools; use nohash_hasher::IntMap; @@ -56,7 +55,7 @@ pub(crate) fn find_all_refs( search_scope: Option, ) -> Option> { let _p = tracing::info_span!("find_all_refs").entered(); - let syntax = sema.parse(position.file_id).syntax().clone(); + let syntax = sema.parse_guess_edition(position.file_id).syntax().clone(); let make_searcher = |literal_search: bool| { move |def: Definition| { let mut usages = @@ -70,7 +69,7 @@ pub(crate) fn find_all_refs( .into_iter() .map(|(file_id, refs)| { ( - file_id, + file_id.into(), refs.into_iter() .map(|file_ref| (file_ref.range, file_ref.category)) .unique() @@ -300,7 +299,8 @@ fn is_lit_name_ref(name_ref: &ast::NameRef) -> bool { #[cfg(test)] mod tests { use expect_test::{expect, Expect}; - use ide_db::base_db::FileId; + use ide_db::FileId; + use span::EditionedFileId; use stdx::format_to; use crate::{fixture, SearchScope}; @@ -941,7 +941,7 @@ pub(super) struct Foo$0 { check_with_scope( code, - Some(SearchScope::single_file(FileId::from_raw(2))), + Some(SearchScope::single_file(EditionedFileId::current_edition(FileId::from_raw(2)))), expect![[r#" quux Function FileId(0) 19..35 26..30 diff --git a/crates/ide/src/rename.rs b/crates/ide/src/rename.rs index 2527b92665..9581474ca7 100644 --- a/crates/ide/src/rename.rs +++ b/crates/ide/src/rename.rs @@ -6,11 +6,10 @@ use hir::{AsAssocItem, HirFileIdExt, InFile, Semantics}; use ide_db::{ - base_db::{FileId, FileRange}, defs::{Definition, NameClass, NameRefClass}, rename::{bail, format_err, source_edit_from_references, IdentifierKind}, source_change::SourceChangeBuilder, - RootDatabase, + FileId, FileRange, RootDatabase, }; use itertools::Itertools; use span::Edition; @@ -35,7 +34,7 @@ pub(crate) fn prepare_rename( position: FilePosition, ) -> RenameResult> { let sema = Semantics::new(db); - let source_file = sema.parse(position.file_id); + let source_file = sema.parse_guess_edition(position.file_id); let syntax = source_file.syntax(); let res = find_definitions(&sema, syntax, position)? @@ -89,7 +88,10 @@ pub(crate) fn rename( new_name: &str, ) -> RenameResult { let sema = Semantics::new(db); - let source_file = sema.parse(position.file_id); + let file_id = sema + .attach_first_edition(position.file_id) + .ok_or_else(|| format_err!("No references found at position"))?; + let source_file = sema.parse(file_id); let syntax = source_file.syntax(); let defs = find_definitions(&sema, syntax, position)?; @@ -100,7 +102,7 @@ pub(crate) fn rename( // FIXME: This can use the `ide_db::rename_reference` (or def.rename) method once we can // properly find "direct" usages/references. .map(|(.., def)| { - match IdentifierKind::classify(Edition::CURRENT, new_name)? { + match IdentifierKind::classify(Edition::CURRENT_FIXME, new_name)? { IdentifierKind::Ident => (), IdentifierKind::Lifetime => { bail!("Cannot alias reference to a lifetime identifier") @@ -111,7 +113,7 @@ pub(crate) fn rename( let mut usages = def.usages(&sema).all(); // FIXME: hack - removes the usage that triggered this rename operation. - match usages.references.get_mut(&position.file_id).and_then(|refs| { + match usages.references.get_mut(&file_id).and_then(|refs| { refs.iter() .position(|ref_| ref_.range.contains_inclusive(position.offset)) .map(|idx| refs.remove(idx)) @@ -121,9 +123,9 @@ pub(crate) fn rename( }; let mut source_change = SourceChange::default(); - source_change.extend(usages.references.get_mut(&position.file_id).iter().map( - |refs| (position.file_id, source_edit_from_references(refs, def, new_name)), - )); + source_change.extend(usages.references.get_mut(&file_id).iter().map(|refs| { + (position.file_id, source_edit_from_references(refs, def, new_name)) + })); Ok(source_change) }) @@ -302,7 +304,11 @@ fn find_definitions( Err(format_err!("No references found at position")) } else { // remove duplicates, comparing `Definition`s - Ok(v.into_iter().unique_by(|&(.., def)| def).collect::>().into_iter()) + Ok(v.into_iter() + .unique_by(|&(.., def)| def) + .map(|(a, b, c)| (a.into(), b, c)) + .collect::>() + .into_iter()) } } Err(e) => Err(e), @@ -370,8 +376,8 @@ fn rename_to_self( let def = Definition::Local(local); let usages = def.usages(sema).all(); let mut source_change = SourceChange::default(); - source_change.extend(usages.iter().map(|(&file_id, references)| { - (file_id, source_edit_from_references(references, def, "self")) + source_change.extend(usages.iter().map(|(file_id, references)| { + (file_id.into(), source_edit_from_references(references, def, "self")) })); source_change.insert_source_edit( file_id.original_file(sema.db), @@ -392,7 +398,7 @@ fn rename_self_to_param( return Ok(SourceChange::default()); } - let identifier_kind = IdentifierKind::classify(Edition::CURRENT, new_name)?; + let identifier_kind = IdentifierKind::classify(Edition::CURRENT_FIXME, new_name)?; let InFile { file_id, value: self_param } = sema.source(self_param).ok_or_else(|| format_err!("cannot find function source"))?; @@ -406,8 +412,8 @@ fn rename_self_to_param( } let mut source_change = SourceChange::default(); source_change.insert_source_edit(file_id.original_file(sema.db), edit); - source_change.extend(usages.iter().map(|(&file_id, references)| { - (file_id, source_edit_from_references(references, def, new_name)) + source_change.extend(usages.iter().map(|(file_id, references)| { + (file_id.into(), source_edit_from_references(references, def, new_name)) })); Ok(source_change) } diff --git a/crates/ide/src/runnables.rs b/crates/ide/src/runnables.rs index f309b98f58..5d4b8b3643 100644 --- a/crates/ide/src/runnables.rs +++ b/crates/ide/src/runnables.rs @@ -7,12 +7,11 @@ use hir::{ }; use ide_assists::utils::{has_test_related_attribute, test_related_attribute_syn}; use ide_db::{ - base_db::{FilePosition, FileRange}, defs::Definition, documentation::docs_from_attrs, helpers::visit_file_defs, search::{FileReferenceNode, SearchScope}, - FxHashMap, FxHashSet, RootDatabase, SymbolKind, + FilePosition, FxHashMap, FxHashSet, RootDatabase, SymbolKind, }; use itertools::Itertools; use span::TextSize; @@ -229,7 +228,7 @@ pub(crate) fn related_tests( ) -> Vec { let sema = Semantics::new(db); let mut res: FxHashSet = FxHashSet::default(); - let syntax = sema.parse(position.file_id).syntax().clone(); + let syntax = sema.parse_guess_edition(position.file_id).syntax().clone(); find_related_tests(&sema, &syntax, position, search_scope, &mut res); @@ -290,8 +289,9 @@ fn find_related_tests_in_module( let mod_source = parent_module.definition_source_range(sema.db); let file_id = mod_source.file_id.original_file(sema.db); - let mod_scope = SearchScope::file_range(FileRange { file_id, range: mod_source.value }); - let fn_pos = FilePosition { file_id, offset: fn_name.syntax().text_range().start() }; + let mod_scope = SearchScope::file_range(hir::FileRange { file_id, range: mod_source.value }); + let fn_pos = + FilePosition { file_id: file_id.into(), offset: fn_name.syntax().text_range().start() }; find_related_tests(sema, syntax, fn_pos, Some(mod_scope), tests) } diff --git a/crates/ide/src/signature_help.rs b/crates/ide/src/signature_help.rs index fe6688c053..b6c9e2f636 100644 --- a/crates/ide/src/signature_help.rs +++ b/crates/ide/src/signature_help.rs @@ -10,9 +10,8 @@ use hir::{ }; use ide_db::{ active_parameter::{callable_for_node, generic_def_for_node}, - base_db::FilePosition, documentation::{Documentation, HasDocs}, - FxIndexMap, + FilePosition, FxIndexMap, }; use stdx::format_to; use syntax::{ @@ -74,7 +73,7 @@ pub(crate) fn signature_help( FilePosition { file_id, offset }: FilePosition, ) -> Option { let sema = Semantics::new(db); - let file = sema.parse(file_id); + let file = sema.parse_guess_edition(file_id); let file = file.syntax(); let token = file .token_at_offset(offset) @@ -660,7 +659,7 @@ mod tests { use std::iter; use expect_test::{expect, Expect}; - use ide_db::base_db::FilePosition; + use ide_db::FilePosition; use stdx::format_to; use test_fixture::ChangeFixture; @@ -674,7 +673,7 @@ mod tests { let (file_id, range_or_offset) = change_fixture.file_position.expect("expected a marker ($0)"); let offset = range_or_offset.expect_offset(); - (database, FilePosition { file_id, offset }) + (database, FilePosition { file_id: file_id.into(), offset }) } #[track_caller] diff --git a/crates/ide/src/ssr.rs b/crates/ide/src/ssr.rs index 6133c33c71..41cc9c067d 100644 --- a/crates/ide/src/ssr.rs +++ b/crates/ide/src/ssr.rs @@ -3,7 +3,7 @@ //! depend on the ide_ssr crate. use ide_assists::{Assist, AssistId, AssistKind, AssistResolveStrategy, GroupLabel}; -use ide_db::{base_db::FileRange, label::Label, source_change::SourceChange, RootDatabase}; +use ide_db::{label::Label, source_change::SourceChange, FileRange, RootDatabase}; pub(crate) fn ssr_assists( db: &RootDatabase, @@ -26,7 +26,7 @@ pub(crate) fn ssr_assists( SourceChange::from_text_edit(frange.file_id, text_edit_for_file) }; - let source_change_for_workspace = SourceChange::from(match_finder.edits()); + let source_change_for_workspace = SourceChange::from_iter(match_finder.edits()); (Some(source_change_for_file), Some(source_change_for_workspace)) } else { @@ -59,9 +59,8 @@ mod tests { use expect_test::expect; use ide_assists::{Assist, AssistResolveStrategy}; use ide_db::{ - base_db::{salsa::Durability, FileRange}, - symbol_index::SymbolsDatabase, - FxHashSet, RootDatabase, + base_db::salsa::Durability, symbol_index::SymbolsDatabase, FileRange, FxHashSet, + RootDatabase, }; use test_fixture::WithFixture; use triomphe::Arc; @@ -73,7 +72,11 @@ mod tests { let mut local_roots = FxHashSet::default(); local_roots.insert(test_fixture::WORKSPACE); db.set_local_roots_with_durability(Arc::new(local_roots), Durability::HIGH); - ssr_assists(&db, &resolve, FileRange { file_id, range: range_or_offset.into() }) + ssr_assists( + &db, + &resolve, + FileRange { file_id: file_id.into(), range: range_or_offset.into() }, + ) } #[test] diff --git a/crates/ide/src/static_index.rs b/crates/ide/src/static_index.rs index 5eb5c87f13..cd9b7ae2f6 100644 --- a/crates/ide/src/static_index.rs +++ b/crates/ide/src/static_index.rs @@ -3,12 +3,9 @@ use hir::{db::HirDatabase, Crate, HirFileIdExt, Module, Semantics}; use ide_db::{ - base_db::{FileId, FileRange, SourceDatabaseExt}, - defs::Definition, - documentation::Documentation, - famous_defs::FamousDefs, - helpers::get_definition, - FxHashMap, FxHashSet, RootDatabase, + base_db::SourceDatabaseExt, defs::Definition, documentation::Documentation, + famous_defs::FamousDefs, helpers::get_definition, FileId, FileRange, FxHashMap, FxHashSet, + RootDatabase, }; use syntax::{AstNode, SyntaxKind::*, SyntaxNode, TextRange, T}; @@ -160,7 +157,7 @@ impl StaticIndex<'_> { .unwrap(); // hovers let sema = hir::Semantics::new(self.db); - let tokens_or_nodes = sema.parse(file_id).syntax().clone(); + let tokens_or_nodes = sema.parse_guess_edition(file_id).syntax().clone(); let tokens = tokens_or_nodes.descendants_with_tokens().filter_map(|it| match it { syntax::NodeOrToken::Node(_) => None, syntax::NodeOrToken::Token(it) => Some(it), @@ -234,7 +231,7 @@ impl StaticIndex<'_> { let db = &*analysis.db; let work = all_modules(db).into_iter().filter(|module| { let file_id = module.definition_source_file_id(db).original_file(db); - let source_root = db.file_source_root(file_id); + let source_root = db.file_source_root(file_id.into()); let source_root = db.source_root(source_root); !source_root.is_library }); @@ -251,7 +248,7 @@ impl StaticIndex<'_> { if visited_files.contains(&file_id) { continue; } - this.add_file(file_id); + this.add_file(file_id.into()); // mark the file visited_files.insert(file_id); } @@ -262,7 +259,7 @@ impl StaticIndex<'_> { #[cfg(test)] mod tests { use crate::{fixture, StaticIndex}; - use ide_db::{base_db::FileRange, FxHashSet}; + use ide_db::{FileRange, FxHashSet}; use syntax::TextSize; fn check_all_ranges(ra_fixture: &str) { diff --git a/crates/ide/src/status.rs b/crates/ide/src/status.rs index b998c0bfc6..67d6932da9 100644 --- a/crates/ide/src/status.rs +++ b/crates/ide/src/status.rs @@ -10,7 +10,7 @@ use ide_db::{ debug::{DebugQueryTable, TableEntry}, Query, QueryTable, }, - CompressedFileTextQuery, CrateData, FileId, ParseQuery, SourceDatabase, SourceRootId, + CompressedFileTextQuery, CrateData, ParseQuery, SourceDatabase, SourceRootId, }, symbol_index::ModuleSymbolsQuery, }; @@ -20,6 +20,7 @@ use ide_db::{ }; use itertools::Itertools; use profile::{memory_usage, Bytes}; +use span::{EditionedFileId, FileId}; use stdx::format_to; use syntax::{ast, Parse, SyntaxNode}; use triomphe::Arc; @@ -209,8 +210,8 @@ impl fmt::Display for SyntaxTreeStats { } } -impl StatCollect> for SyntaxTreeStats { - fn collect_entry(&mut self, _: FileId, value: Option>) { +impl StatCollect> for SyntaxTreeStats { + fn collect_entry(&mut self, _: EditionedFileId, value: Option>) { self.total += 1; self.retained += value.is_some() as usize; } diff --git a/crates/ide/src/syntax_highlighting.rs b/crates/ide/src/syntax_highlighting.rs index fd8e6f4046..2318592005 100644 --- a/crates/ide/src/syntax_highlighting.rs +++ b/crates/ide/src/syntax_highlighting.rs @@ -15,6 +15,7 @@ mod tests; use hir::{DescendPreference, Name, Semantics}; use ide_db::{FxHashMap, RootDatabase, SymbolKind}; +use span::EditionedFileId; use syntax::{ ast::{self, IsString}, AstNode, AstToken, NodeOrToken, @@ -188,11 +189,14 @@ pub(crate) fn highlight( ) -> Vec { let _p = tracing::info_span!("highlight").entered(); let sema = Semantics::new(db); + let file_id = sema + .attach_first_edition(file_id) + .unwrap_or_else(|| EditionedFileId::current_edition(file_id)); // Determine the root based on the given range. let (root, range_to_highlight) = { - let source_file = sema.parse(file_id); - let source_file = source_file.syntax(); + let file = sema.parse(file_id); + let source_file = file.syntax(); match range_to_highlight { Some(range) => { let node = match source_file.covering_element(range) { @@ -218,7 +222,7 @@ fn traverse( hl: &mut Highlights, sema: &Semantics<'_, RootDatabase>, config: HighlightConfig, - file_id: FileId, + file_id: EditionedFileId, root: &SyntaxNode, krate: hir::Crate, range_to_highlight: TextRange, diff --git a/crates/ide/src/syntax_highlighting/html.rs b/crates/ide/src/syntax_highlighting/html.rs index e754b702de..47ad54759a 100644 --- a/crates/ide/src/syntax_highlighting/html.rs +++ b/crates/ide/src/syntax_highlighting/html.rs @@ -1,7 +1,8 @@ //! Renders a bit of code as HTML. -use ide_db::base_db::SourceDatabase; +use hir::Semantics; use oorandom::Rand32; +use span::EditionedFileId; use stdx::format_to; use syntax::AstNode; @@ -11,8 +12,12 @@ use crate::{ }; pub(crate) fn highlight_as_html(db: &RootDatabase, file_id: FileId, rainbow: bool) -> String { - let parse = db.parse(file_id); - + let sema = Semantics::new(db); + let file_id = sema + .attach_first_edition(file_id) + .unwrap_or_else(|| EditionedFileId::current_edition(file_id)); + let file = sema.parse(file_id); + let file = file.syntax(); fn rainbowify(seed: u64) -> String { let mut rng = Rand32::new(seed); format!( @@ -35,10 +40,10 @@ pub(crate) fn highlight_as_html(db: &RootDatabase, file_id: FileId, rainbow: boo macro_bang: true, syntactic_name_ref_highlighting: false, }, - file_id, + file_id.into(), None, ); - let text = parse.tree().syntax().to_string(); + let text = file.to_string(); let mut buf = String::new(); buf.push_str(STYLE); buf.push_str("
");
diff --git a/crates/ide/src/syntax_highlighting/inject.rs b/crates/ide/src/syntax_highlighting/inject.rs
index c80bb7413f..bc1ec53007 100644
--- a/crates/ide/src/syntax_highlighting/inject.rs
+++ b/crates/ide/src/syntax_highlighting/inject.rs
@@ -3,11 +3,12 @@
 use std::mem;
 
 use either::Either;
-use hir::{sym, InFile, Semantics};
+use hir::{sym, HirFileId, InFile, Semantics};
 use ide_db::{
-    active_parameter::ActiveParameter, base_db::FileId, defs::Definition,
-    documentation::docs_with_rangemap, rust_doc::is_rust_fence, SymbolKind,
+    active_parameter::ActiveParameter, defs::Definition, documentation::docs_with_rangemap,
+    rust_doc::is_rust_fence, SymbolKind,
 };
+use span::EditionedFileId;
 use syntax::{
     ast::{self, AstNode, IsString, QuoteOffsets},
     AstToken, NodeOrToken, SyntaxNode, TextRange, TextSize,
@@ -108,14 +109,14 @@ pub(super) fn doc_comment(
     hl: &mut Highlights,
     sema: &Semantics<'_, RootDatabase>,
     config: HighlightConfig,
-    src_file_id: FileId,
+    src_file_id: EditionedFileId,
     node: &SyntaxNode,
 ) {
     let (attributes, def) = match doc_attributes(sema, node) {
         Some(it) => it,
         None => return,
     };
-    let src_file_id = src_file_id.into();
+    let src_file_id: HirFileId = src_file_id.into();
 
     // Extract intra-doc links and emit highlights for them.
     if let Some((docs, doc_mapping)) = docs_with_rangemap(sema.db, &attributes) {
diff --git a/crates/ide/src/syntax_tree.rs b/crates/ide/src/syntax_tree.rs
index 05cdf430ef..e241cb82bd 100644
--- a/crates/ide/src/syntax_tree.rs
+++ b/crates/ide/src/syntax_tree.rs
@@ -1,7 +1,5 @@
-use ide_db::{
-    base_db::{FileId, SourceDatabase},
-    RootDatabase,
-};
+use hir::Semantics;
+use ide_db::{FileId, RootDatabase};
 use syntax::{
     AstNode, NodeOrToken, SourceFile, SyntaxKind::STRING, SyntaxToken, TextRange, TextSize,
 };
@@ -22,9 +20,10 @@ pub(crate) fn syntax_tree(
     file_id: FileId,
     text_range: Option,
 ) -> String {
-    let parse = db.parse(file_id);
+    let sema = Semantics::new(db);
+    let parse = sema.parse_guess_edition(file_id);
     if let Some(text_range) = text_range {
-        let node = match parse.tree().syntax().covering_element(text_range) {
+        let node = match parse.syntax().covering_element(text_range) {
             NodeOrToken::Node(node) => node,
             NodeOrToken::Token(token) => {
                 if let Some(tree) = syntax_tree_for_string(&token, text_range) {
@@ -36,7 +35,7 @@ pub(crate) fn syntax_tree(
 
         format!("{node:#?}")
     } else {
-        format!("{:#?}", parse.tree().syntax())
+        format!("{:#?}", parse.syntax())
     }
 }
 
@@ -88,7 +87,7 @@ fn syntax_tree_for_token(node: &SyntaxToken, text_range: TextRange) -> Option Option {
-    let parse = db.parse(position.file_id);
+    let parse = db.parse(EditionedFileId::current_edition(position.file_id));
     let file = parse.tree();
     let token = file.syntax().token_at_offset(position.offset).left_biased()?;
 
diff --git a/crates/ide/src/view_hir.rs b/crates/ide/src/view_hir.rs
index 51cf45bd22..fe532f4cc5 100644
--- a/crates/ide/src/view_hir.rs
+++ b/crates/ide/src/view_hir.rs
@@ -1,6 +1,5 @@
 use hir::{DefWithBody, Semantics};
-use ide_db::base_db::FilePosition;
-use ide_db::RootDatabase;
+use ide_db::{FilePosition, RootDatabase};
 use syntax::{algo::ancestors_at_offset, ast, AstNode};
 
 // Feature: View Hir
@@ -17,7 +16,7 @@ pub(crate) fn view_hir(db: &RootDatabase, position: FilePosition) -> String {
 
 fn body_hir(db: &RootDatabase, position: FilePosition) -> Option {
     let sema = Semantics::new(db);
-    let source_file = sema.parse(position.file_id);
+    let source_file = sema.parse_guess_edition(position.file_id);
 
     let item = ancestors_at_offset(source_file.syntax(), position.offset)
         .filter(|it| !ast::MacroCall::can_cast(it.kind()))
diff --git a/crates/ide/src/view_item_tree.rs b/crates/ide/src/view_item_tree.rs
index e072df430f..dae79998dc 100644
--- a/crates/ide/src/view_item_tree.rs
+++ b/crates/ide/src/view_item_tree.rs
@@ -1,6 +1,6 @@
-use hir::db::DefDatabase;
-use ide_db::base_db::FileId;
-use ide_db::RootDatabase;
+use hir::{db::DefDatabase, Semantics};
+use ide_db::{FileId, RootDatabase};
+use span::EditionedFileId;
 
 // Feature: Debug ItemTree
 //
@@ -12,5 +12,9 @@ use ide_db::RootDatabase;
 // | VS Code | **rust-analyzer: Debug ItemTree**
 // |===
 pub(crate) fn view_item_tree(db: &RootDatabase, file_id: FileId) -> String {
+    let sema = Semantics::new(db);
+    let file_id = sema
+        .attach_first_edition(file_id)
+        .unwrap_or_else(|| EditionedFileId::current_edition(file_id));
     db.file_item_tree(file_id.into()).pretty_print(db)
 }
diff --git a/crates/ide/src/view_memory_layout.rs b/crates/ide/src/view_memory_layout.rs
index ad99c2162c..df3f2f18b4 100644
--- a/crates/ide/src/view_memory_layout.rs
+++ b/crates/ide/src/view_memory_layout.rs
@@ -84,7 +84,7 @@ pub(crate) fn view_memory_layout(
     position: FilePosition,
 ) -> Option {
     let sema = Semantics::new(db);
-    let file = sema.parse(position.file_id);
+    let file = sema.parse_guess_edition(position.file_id);
     let token =
         pick_best_token(file.syntax().token_at_offset(position.offset), |kind| match kind {
             SyntaxKind::IDENT => 3,
diff --git a/crates/ide/src/view_mir.rs b/crates/ide/src/view_mir.rs
index 5fb4703989..7a228375d5 100644
--- a/crates/ide/src/view_mir.rs
+++ b/crates/ide/src/view_mir.rs
@@ -1,6 +1,5 @@
 use hir::{DefWithBody, Semantics};
-use ide_db::base_db::FilePosition;
-use ide_db::RootDatabase;
+use ide_db::{FilePosition, RootDatabase};
 use syntax::{algo::ancestors_at_offset, ast, AstNode};
 
 // Feature: View Mir
@@ -16,7 +15,7 @@ pub(crate) fn view_mir(db: &RootDatabase, position: FilePosition) -> String {
 
 fn body_mir(db: &RootDatabase, position: FilePosition) -> Option {
     let sema = Semantics::new(db);
-    let source_file = sema.parse(position.file_id);
+    let source_file = sema.parse_guess_edition(position.file_id);
 
     let item = ancestors_at_offset(source_file.syntax(), position.offset)
         .filter(|it| !ast::MacroCall::can_cast(it.kind()))
diff --git a/crates/mbe/src/syntax_bridge.rs b/crates/mbe/src/syntax_bridge.rs
index 58edd9900a..6d943007b9 100644
--- a/crates/mbe/src/syntax_bridge.rs
+++ b/crates/mbe/src/syntax_bridge.rs
@@ -52,7 +52,10 @@ pub(crate) mod dummy_test_span_utils {
     pub const DUMMY: Span = Span {
         range: TextRange::empty(TextSize::new(0)),
         anchor: span::SpanAnchor {
-            file_id: span::FileId::from_raw(0xe4e4e),
+            file_id: span::EditionedFileId::new(
+                span::FileId::from_raw(0xe4e4e),
+                span::Edition::CURRENT,
+            ),
             ast_id: span::ROOT_ERASED_FILE_AST_ID,
         },
         ctx: SyntaxContextId::ROOT,
@@ -65,7 +68,10 @@ pub(crate) mod dummy_test_span_utils {
             Span {
                 range,
                 anchor: span::SpanAnchor {
-                    file_id: span::FileId::from_raw(0xe4e4e),
+                    file_id: span::EditionedFileId::new(
+                        span::FileId::from_raw(0xe4e4e),
+                        span::Edition::CURRENT,
+                    ),
                     ast_id: span::ROOT_ERASED_FILE_AST_ID,
                 },
                 ctx: SyntaxContextId::ROOT,
diff --git a/crates/parser/src/edition.rs b/crates/parser/src/edition.rs
index 5d3d3cbd47..be0a2c794e 100644
--- a/crates/parser/src/edition.rs
+++ b/crates/parser/src/edition.rs
@@ -4,6 +4,7 @@
 use std::fmt;
 
 #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
+#[repr(u8)]
 pub enum Edition {
     Edition2015,
     Edition2018,
@@ -12,9 +13,11 @@ pub enum Edition {
 }
 
 impl Edition {
-    /// The current latest stable edition, note this is usually not the right choice in code.
-    pub const CURRENT: Edition = Edition::Edition2021;
     pub const DEFAULT: Edition = Edition::Edition2015;
+    pub const LATEST: Edition = Edition::Edition2024;
+    pub const CURRENT: Edition = Edition::Edition2021;
+    /// The current latest stable edition, note this is usually not the right choice in code.
+    pub const CURRENT_FIXME: Edition = Edition::Edition2021;
 
     pub fn at_least_2024(self) -> bool {
         self >= Edition::Edition2024
diff --git a/crates/proc-macro-api/src/msg.rs b/crates/proc-macro-api/src/msg.rs
index 65f60a7c5b..6a99b5ed1c 100644
--- a/crates/proc-macro-api/src/msg.rs
+++ b/crates/proc-macro-api/src/msg.rs
@@ -157,7 +157,6 @@ type ProtocolWrite = for<'o, 'msg> fn(out: &'o mut W, msg: &'msg str)
 
 #[cfg(test)]
 mod tests {
-    use base_db::FileId;
     use intern::{sym, Symbol};
     use la_arena::RawIdx;
     use span::{ErasedFileAstId, Span, SpanAnchor, SyntaxContextId};
@@ -168,7 +167,10 @@ mod tests {
 
     fn fixture_token_tree() -> Subtree {
         let anchor = SpanAnchor {
-            file_id: FileId::from_raw(0),
+            file_id: span::EditionedFileId::new(
+                span::FileId::from_raw(0xe4e4e),
+                span::Edition::CURRENT,
+            ),
             ast_id: ErasedFileAstId::from_raw(RawIdx::from(0)),
         };
 
diff --git a/crates/proc-macro-api/src/msg/flat.rs b/crates/proc-macro-api/src/msg/flat.rs
index 19260bc817..a8661f59b2 100644
--- a/crates/proc-macro-api/src/msg/flat.rs
+++ b/crates/proc-macro-api/src/msg/flat.rs
@@ -41,7 +41,7 @@ use intern::Symbol;
 use la_arena::RawIdx;
 use rustc_hash::FxHashMap;
 use serde::{Deserialize, Serialize};
-use span::{ErasedFileAstId, FileId, Span, SpanAnchor, SyntaxContextId};
+use span::{EditionedFileId, ErasedFileAstId, Span, SpanAnchor, SyntaxContextId};
 use text_size::TextRange;
 
 use crate::msg::{ENCODE_CLOSE_SPAN_VERSION, EXTENDED_LEAF_DATA};
@@ -53,7 +53,7 @@ pub fn serialize_span_data_index_map(map: &SpanDataIndexMap) -> Vec {
     map.iter()
         .flat_map(|span| {
             [
-                span.anchor.file_id.index(),
+                span.anchor.file_id.as_u32(),
                 span.anchor.ast_id.into_raw().into_u32(),
                 span.range.start().into(),
                 span.range.end().into(),
@@ -70,7 +70,7 @@ pub fn deserialize_span_data_index_map(map: &[u32]) -> SpanDataIndexMap {
             let &[file_id, ast_id, start, end, e] = span else { unreachable!() };
             Span {
                 anchor: SpanAnchor {
-                    file_id: FileId::from_raw(file_id),
+                    file_id: EditionedFileId::from_raw(file_id),
                     ast_id: ErasedFileAstId::from_raw(RawIdx::from_u32(ast_id)),
                 },
                 range: TextRange::new(start.into(), end.into()),
diff --git a/crates/proc-macro-srv/src/server_impl/rust_analyzer_span.rs b/crates/proc-macro-srv/src/server_impl/rust_analyzer_span.rs
index 452ad8e083..8b9eb3beb6 100644
--- a/crates/proc-macro-srv/src/server_impl/rust_analyzer_span.rs
+++ b/crates/proc-macro-srv/src/server_impl/rust_analyzer_span.rs
@@ -469,7 +469,7 @@ impl server::Server for RaSpanServer {
 
 #[cfg(test)]
 mod tests {
-    use span::SyntaxContextId;
+    use span::{EditionedFileId, FileId, SyntaxContextId};
 
     use super::*;
 
@@ -478,7 +478,7 @@ mod tests {
         let span = Span {
             range: TextRange::empty(TextSize::new(0)),
             anchor: span::SpanAnchor {
-                file_id: span::FileId::from_raw(0),
+                file_id: EditionedFileId::current_edition(FileId::from_raw(0)),
                 ast_id: span::ErasedFileAstId::from_raw(0.into()),
             },
             ctx: SyntaxContextId::ROOT,
@@ -514,7 +514,7 @@ mod tests {
         let span = Span {
             range: TextRange::empty(TextSize::new(0)),
             anchor: span::SpanAnchor {
-                file_id: span::FileId::from_raw(0),
+                file_id: EditionedFileId::current_edition(FileId::from_raw(0)),
                 ast_id: span::ErasedFileAstId::from_raw(0.into()),
             },
             ctx: SyntaxContextId::ROOT,
diff --git a/crates/proc-macro-srv/src/server_impl/token_stream.rs b/crates/proc-macro-srv/src/server_impl/token_stream.rs
index c382a5b241..cdf93fa425 100644
--- a/crates/proc-macro-srv/src/server_impl/token_stream.rs
+++ b/crates/proc-macro-srv/src/server_impl/token_stream.rs
@@ -127,7 +127,7 @@ pub(super) mod token_stream {
     impl TokenStream {
         pub(crate) fn from_str(src: &str, call_site: S) -> Result, String> {
             let subtree =
-                mbe::parse_to_token_tree_static_span(span::Edition::CURRENT, call_site, src)
+                mbe::parse_to_token_tree_static_span(span::Edition::CURRENT_FIXME, call_site, src)
                     .ok_or("lexing error")?;
 
             Ok(TokenStream::with_subtree(subtree))
diff --git a/crates/proc-macro-srv/src/tests/utils.rs b/crates/proc-macro-srv/src/tests/utils.rs
index 1080e8c993..70eff51cad 100644
--- a/crates/proc-macro-srv/src/tests/utils.rs
+++ b/crates/proc-macro-srv/src/tests/utils.rs
@@ -2,7 +2,7 @@
 
 use expect_test::Expect;
 use proc_macro_api::msg::TokenId;
-use span::{ErasedFileAstId, FileId, Span, SpanAnchor, SyntaxContextId};
+use span::{EditionedFileId, ErasedFileAstId, FileId, Span, SpanAnchor, SyntaxContextId};
 use tt::TextRange;
 
 use crate::{dylib, proc_macro_test_dylib_path, EnvSnapshot, ProcMacroSrv};
@@ -68,7 +68,7 @@ fn assert_expand_impl(
     let def_site = Span {
         range: TextRange::new(0.into(), 150.into()),
         anchor: SpanAnchor {
-            file_id: FileId::from_raw(41),
+            file_id: EditionedFileId::current_edition(FileId::from_raw(41)),
             ast_id: ErasedFileAstId::from_raw(From::from(1)),
         },
         ctx: SyntaxContextId::ROOT,
@@ -76,7 +76,7 @@ fn assert_expand_impl(
     let call_site = Span {
         range: TextRange::new(0.into(), 100.into()),
         anchor: SpanAnchor {
-            file_id: FileId::from_raw(42),
+            file_id: EditionedFileId::current_edition(FileId::from_raw(42)),
             ast_id: ErasedFileAstId::from_raw(From::from(2)),
         },
         ctx: SyntaxContextId::ROOT,
diff --git a/crates/project-model/src/tests.rs b/crates/project-model/src/tests.rs
index 8d50d4bdfe..8f5457bf99 100644
--- a/crates/project-model/src/tests.rs
+++ b/crates/project-model/src/tests.rs
@@ -1,6 +1,6 @@
 use std::ops::Deref;
 
-use base_db::{CrateGraph, FileId, ProcMacroPaths};
+use base_db::{CrateGraph, ProcMacroPaths};
 use cargo_metadata::Metadata;
 use cfg::{CfgAtom, CfgDiff};
 use expect_test::{expect_file, ExpectFile};
@@ -8,6 +8,7 @@ use intern::sym;
 use paths::{AbsPath, AbsPathBuf, Utf8Path, Utf8PathBuf};
 use rustc_hash::FxHashMap;
 use serde::de::DeserializeOwned;
+use span::FileId;
 use triomphe::Arc;
 
 use crate::{
diff --git a/crates/project-model/src/workspace.rs b/crates/project-model/src/workspace.rs
index dd7a11ca85..c3b0802756 100644
--- a/crates/project-model/src/workspace.rs
+++ b/crates/project-model/src/workspace.rs
@@ -6,7 +6,7 @@ use std::{collections::VecDeque, fmt, fs, iter, sync};
 
 use anyhow::Context;
 use base_db::{
-    CrateDisplayName, CrateGraph, CrateId, CrateName, CrateOrigin, Dependency, Env, FileId,
+    CrateDisplayName, CrateGraph, CrateId, CrateName, CrateOrigin, Dependency, Env,
     LangCrateOrigin, ProcMacroPaths, TargetLayoutLoadResult,
 };
 use cfg::{CfgAtom, CfgDiff, CfgOptions};
@@ -14,7 +14,7 @@ use intern::{sym, Symbol};
 use paths::{AbsPath, AbsPathBuf};
 use rustc_hash::{FxHashMap, FxHashSet};
 use semver::Version;
-use span::Edition;
+use span::{Edition, FileId};
 use toolchain::Tool;
 use tracing::instrument;
 use triomphe::Arc;
@@ -1463,7 +1463,7 @@ fn sysroot_to_crate_graph(
                     let display_name = CrateDisplayName::from_canonical_name(&stitched[krate].name);
                     let crate_id = crate_graph.add_crate_root(
                         file_id,
-                        Edition::CURRENT,
+                        Edition::CURRENT_FIXME,
                         Some(display_name),
                         None,
                         cfg_options.clone(),
diff --git a/crates/rust-analyzer/src/cli/analysis_stats.rs b/crates/rust-analyzer/src/cli/analysis_stats.rs
index a0f1c941dd..f26f9abe80 100644
--- a/crates/rust-analyzer/src/cli/analysis_stats.rs
+++ b/crates/rust-analyzer/src/cli/analysis_stats.rs
@@ -25,7 +25,7 @@ use ide_db::{
         salsa::{self, debug::DebugQueryTable, ParallelDatabase},
         SourceDatabase, SourceDatabaseExt,
     },
-    LineIndexDatabase, SnippetCap,
+    EditionedFileId, LineIndexDatabase, SnippetCap,
 };
 use itertools::Itertools;
 use load_cargo::{load_workspace, LoadCargoConfig, ProcMacroServerChoice};
@@ -35,7 +35,7 @@ use project_model::{CargoConfig, ProjectManifest, ProjectWorkspace, RustLibSourc
 use rayon::prelude::*;
 use rustc_hash::{FxHashMap, FxHashSet};
 use syntax::{AstNode, SyntaxNode};
-use vfs::{AbsPathBuf, FileId, Vfs, VfsPath};
+use vfs::{AbsPathBuf, Vfs, VfsPath};
 
 use crate::cli::{
     flags::{self, OutputFormat},
@@ -120,7 +120,7 @@ impl flags::AnalysisStats {
                 for file_id in source_root.iter() {
                     if let Some(p) = source_root.path_for_file(&file_id) {
                         if let Some((_, Some("rs"))) = p.name_and_extension() {
-                            db.file_item_tree(file_id.into());
+                            db.file_item_tree(EditionedFileId::current_edition(file_id).into());
                             num_item_trees += 1;
                         }
                     }
@@ -140,7 +140,7 @@ impl flags::AnalysisStats {
             let module = krate.root_module();
             let file_id = module.definition_source_file_id(db);
             let file_id = file_id.original_file(db);
-            let source_root = db.file_source_root(file_id);
+            let source_root = db.file_source_root(file_id.into());
             let source_root = db.source_root(source_root);
             if !source_root.is_library || self.with_deps {
                 num_crates += 1;
@@ -332,7 +332,7 @@ impl flags::AnalysisStats {
         ws: &ProjectWorkspace,
         db: &RootDatabase,
         vfs: &Vfs,
-        mut file_ids: Vec,
+        mut file_ids: Vec,
         verbosity: Verbosity,
     ) {
         let cargo_config = CargoConfig {
@@ -367,11 +367,10 @@ impl flags::AnalysisStats {
 
         for &file_id in &file_ids {
             let sema = hir::Semantics::new(db);
-            let _ = db.parse(file_id);
 
-            let parse = sema.parse(file_id);
-            let file_txt = db.file_text(file_id);
-            let path = vfs.file_path(file_id).as_path().unwrap();
+            let parse = sema.parse_guess_edition(file_id.into());
+            let file_txt = db.file_text(file_id.into());
+            let path = vfs.file_path(file_id.into()).as_path().unwrap();
 
             for node in parse.syntax().descendants() {
                 let expr = match syntax::ast::Expr::cast(node.clone()) {
@@ -398,7 +397,7 @@ impl flags::AnalysisStats {
 
                 let range = sema.original_range(expected_tail.syntax()).range;
                 let original_text: String = db
-                    .file_text(file_id)
+                    .file_text(file_id.into())
                     .chars()
                     .skip(usize::from(range.start()))
                     .take(usize::from(range.end()) - usize::from(range.start()))
@@ -650,7 +649,7 @@ impl flags::AnalysisStats {
                     };
                     if let Some(src) = source {
                         let original_file = src.file_id.original_file(db);
-                        let path = vfs.file_path(original_file);
+                        let path = vfs.file_path(original_file.into());
                         let syntax_range = src.text_range();
                         format!("processing: {} ({} {:?})", full_name(), path, syntax_range)
                     } else {
@@ -944,7 +943,7 @@ impl flags::AnalysisStats {
                     };
                     if let Some(src) = source {
                         let original_file = src.file_id.original_file(db);
-                        let path = vfs.file_path(original_file);
+                        let path = vfs.file_path(original_file.into());
                         let syntax_range = src.text_range();
                         format!("processing: {} ({} {:?})", full_name(), path, syntax_range)
                     } else {
@@ -968,7 +967,7 @@ impl flags::AnalysisStats {
         report_metric("body lowering time", body_lowering_time.time.as_millis() as u64, "ms");
     }
 
-    fn run_ide_things(&self, analysis: Analysis, mut file_ids: Vec) {
+    fn run_ide_things(&self, analysis: Analysis, mut file_ids: Vec) {
         file_ids.sort();
         file_ids.dedup();
         let mut sw = self.stop_watch();
@@ -998,7 +997,7 @@ impl flags::AnalysisStats {
                     term_search_borrowck: true,
                 },
                 ide::AssistResolveStrategy::All,
-                file_id,
+                file_id.into(),
             );
         }
         for &file_id in &file_ids {
@@ -1031,7 +1030,7 @@ impl flags::AnalysisStats {
                     fields_to_resolve: InlayFieldsToResolve::empty(),
                     range_exclusive_hints: true,
                 },
-                file_id,
+                file_id.into(),
                 None,
             );
         }
@@ -1047,7 +1046,7 @@ impl flags::AnalysisStats {
                         annotate_enum_variant_references: false,
                         location: ide::AnnotationLocation::AboveName,
                     },
-                    file_id,
+                    file_id.into(),
                 )
                 .unwrap()
                 .into_iter()
@@ -1072,8 +1071,8 @@ fn location_csv_expr(db: &RootDatabase, vfs: &Vfs, sm: &BodySourceMap, expr_id:
     let root = db.parse_or_expand(src.file_id);
     let node = src.map(|e| e.to_node(&root).syntax().clone());
     let original_range = node.as_ref().original_file_range_rooted(db);
-    let path = vfs.file_path(original_range.file_id);
-    let line_index = db.line_index(original_range.file_id);
+    let path = vfs.file_path(original_range.file_id.into());
+    let line_index = db.line_index(original_range.file_id.into());
     let text_range = original_range.range;
     let (start, end) =
         (line_index.line_col(text_range.start()), line_index.line_col(text_range.end()));
@@ -1088,8 +1087,8 @@ fn location_csv_pat(db: &RootDatabase, vfs: &Vfs, sm: &BodySourceMap, pat_id: Pa
     let root = db.parse_or_expand(src.file_id);
     let node = src.map(|e| e.to_node(&root).syntax().clone());
     let original_range = node.as_ref().original_file_range_rooted(db);
-    let path = vfs.file_path(original_range.file_id);
-    let line_index = db.line_index(original_range.file_id);
+    let path = vfs.file_path(original_range.file_id.into());
+    let line_index = db.line_index(original_range.file_id.into());
     let text_range = original_range.range;
     let (start, end) =
         (line_index.line_col(text_range.start()), line_index.line_col(text_range.end()));
@@ -1107,8 +1106,8 @@ fn expr_syntax_range<'a>(
         let root = db.parse_or_expand(src.file_id);
         let node = src.map(|e| e.to_node(&root).syntax().clone());
         let original_range = node.as_ref().original_file_range_rooted(db);
-        let path = vfs.file_path(original_range.file_id);
-        let line_index = db.line_index(original_range.file_id);
+        let path = vfs.file_path(original_range.file_id.into());
+        let line_index = db.line_index(original_range.file_id.into());
         let text_range = original_range.range;
         let (start, end) =
             (line_index.line_col(text_range.start()), line_index.line_col(text_range.end()));
@@ -1128,8 +1127,8 @@ fn pat_syntax_range<'a>(
         let root = db.parse_or_expand(src.file_id);
         let node = src.map(|e| e.to_node(&root).syntax().clone());
         let original_range = node.as_ref().original_file_range_rooted(db);
-        let path = vfs.file_path(original_range.file_id);
-        let line_index = db.line_index(original_range.file_id);
+        let path = vfs.file_path(original_range.file_id.into());
+        let line_index = db.line_index(original_range.file_id.into());
         let text_range = original_range.range;
         let (start, end) =
             (line_index.line_col(text_range.start()), line_index.line_col(text_range.end()));
diff --git a/crates/rust-analyzer/src/cli/diagnostics.rs b/crates/rust-analyzer/src/cli/diagnostics.rs
index d5eac49ad3..489bb42eec 100644
--- a/crates/rust-analyzer/src/cli/diagnostics.rs
+++ b/crates/rust-analyzer/src/cli/diagnostics.rs
@@ -48,7 +48,7 @@ impl flags::Diagnostics {
 
         let work = all_modules(db).into_iter().filter(|module| {
             let file_id = module.definition_source_file_id(db).original_file(db);
-            let source_root = db.file_source_root(file_id);
+            let source_root = db.file_source_root(file_id.into());
             let source_root = db.source_root(source_root);
             !source_root.is_library
         });
@@ -58,12 +58,15 @@ impl flags::Diagnostics {
             if !visited_files.contains(&file_id) {
                 let crate_name =
                     module.krate().display_name(db).as_deref().unwrap_or("unknown").to_owned();
-                println!("processing crate: {crate_name}, module: {}", _vfs.file_path(file_id));
+                println!(
+                    "processing crate: {crate_name}, module: {}",
+                    _vfs.file_path(file_id.into())
+                );
                 for diagnostic in analysis
                     .diagnostics(
                         &DiagnosticsConfig::test_sample(),
                         AssistResolveStrategy::None,
-                        file_id,
+                        file_id.into(),
                     )
                     .unwrap()
                 {
diff --git a/crates/rust-analyzer/src/cli/scip.rs b/crates/rust-analyzer/src/cli/scip.rs
index 8f60b17b59..ee134b6c50 100644
--- a/crates/rust-analyzer/src/cli/scip.rs
+++ b/crates/rust-analyzer/src/cli/scip.rs
@@ -342,7 +342,7 @@ mod test {
         let (file_id, range_or_offset) =
             change_fixture.file_position.expect("expected a marker ()");
         let offset = range_or_offset.expect_offset();
-        (host, FilePosition { file_id, offset })
+        (host, FilePosition { file_id: file_id.into(), offset })
     }
 
     /// If expected == "", then assert that there are no symbols (this is basically local symbol)
diff --git a/crates/rust-analyzer/src/cli/ssr.rs b/crates/rust-analyzer/src/cli/ssr.rs
index 28cbd1afd8..7f24fa2835 100644
--- a/crates/rust-analyzer/src/cli/ssr.rs
+++ b/crates/rust-analyzer/src/cli/ssr.rs
@@ -1,6 +1,7 @@
 //! Applies structured search replace rules from the command line.
 
 use anyhow::Context;
+use ide_db::EditionedFileId;
 use ide_ssr::MatchFinder;
 use load_cargo::{load_workspace_at, LoadCargoConfig, ProcMacroServerChoice};
 use project_model::{CargoConfig, RustLibSource};
@@ -67,7 +68,10 @@ impl flags::Search {
             for &root in db.local_roots().iter() {
                 let sr = db.source_root(root);
                 for file_id in sr.iter() {
-                    for debug_info in match_finder.debug_where_text_equal(file_id, debug_snippet) {
+                    for debug_info in match_finder.debug_where_text_equal(
+                        EditionedFileId::current_edition(file_id),
+                        debug_snippet,
+                    ) {
                         println!("{debug_info:#?}");
                     }
                 }
diff --git a/crates/rust-analyzer/src/lsp/from_proto.rs b/crates/rust-analyzer/src/lsp/from_proto.rs
index 60fe847bb7..aea424298f 100644
--- a/crates/rust-analyzer/src/lsp/from_proto.rs
+++ b/crates/rust-analyzer/src/lsp/from_proto.rs
@@ -1,10 +1,7 @@
 //! Conversion lsp_types types to rust-analyzer specific ones.
 use anyhow::format_err;
 use ide::{Annotation, AnnotationKind, AssistKind, LineCol};
-use ide_db::{
-    base_db::{FileId, FilePosition, FileRange},
-    line_index::WideLineCol,
-};
+use ide_db::{line_index::WideLineCol, FileId, FilePosition, FileRange};
 use syntax::{TextRange, TextSize};
 use vfs::AbsPathBuf;
 
diff --git a/crates/span/src/lib.rs b/crates/span/src/lib.rs
index bbaf1b2a6d..057fab89c7 100644
--- a/crates/span/src/lib.rs
+++ b/crates/span/src/lib.rs
@@ -17,18 +17,6 @@ pub use syntax::Edition;
 pub use text_size::{TextRange, TextSize};
 pub use vfs::FileId;
 
-#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
-pub struct FilePosition {
-    pub file_id: FileId,
-    pub offset: TextSize,
-}
-
-#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash)]
-pub struct FileRange {
-    pub file_id: FileId,
-    pub range: TextRange,
-}
-
 // The first index is always the root node's AstId
 /// The root ast id always points to the encompassing file, using this in spans is discouraged as
 /// any range relative to it will be effectively absolute, ruining the entire point of anchored
@@ -63,7 +51,7 @@ pub struct SpanData {
 impl fmt::Debug for SpanData {
     fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         if f.alternate() {
-            fmt::Debug::fmt(&self.anchor.file_id.index(), f)?;
+            fmt::Debug::fmt(&self.anchor.file_id.file_id().index(), f)?;
             f.write_char(':')?;
             fmt::Debug::fmt(&self.anchor.ast_id.into_raw(), f)?;
             f.write_char('@')?;
@@ -88,7 +76,7 @@ impl SpanData {
 
 impl fmt::Display for Span {
     fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
-        fmt::Debug::fmt(&self.anchor.file_id.index(), f)?;
+        fmt::Debug::fmt(&self.anchor.file_id.file_id().index(), f)?;
         f.write_char(':')?;
         fmt::Debug::fmt(&self.anchor.ast_id.into_raw(), f)?;
         f.write_char('@')?;
@@ -100,7 +88,7 @@ impl fmt::Display for Span {
 
 #[derive(Copy, Clone, PartialEq, Eq, Hash)]
 pub struct SpanAnchor {
-    pub file_id: FileId,
+    pub file_id: EditionedFileId,
     pub ast_id: ErasedFileAstId,
 }
 
@@ -110,6 +98,81 @@ impl fmt::Debug for SpanAnchor {
     }
 }
 
+/// A [`FileId`] and [`Edition`] bundled up together.
+/// The MSB is reserved for `HirFileId` encoding, more upper bits are used to then encode the edition.
+#[derive(Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord)]
+pub struct EditionedFileId(u32);
+
+impl fmt::Debug for EditionedFileId {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+        f.debug_tuple("EditionedFileId").field(&self.file_id()).field(&self.edition()).finish()
+    }
+}
+
+impl From for FileId {
+    fn from(value: EditionedFileId) -> Self {
+        value.file_id()
+    }
+}
+
+const _: () = assert!(
+    EditionedFileId::RESERVED_HIGH_BITS
+        + EditionedFileId::EDITION_BITS
+        + EditionedFileId::FILE_ID_BITS
+        == u32::BITS
+);
+const _: () = assert!(
+    EditionedFileId::RESERVED_MASK ^ EditionedFileId::EDITION_MASK ^ EditionedFileId::FILE_ID_MASK
+        == 0xFFFF_FFFF
+);
+
+impl EditionedFileId {
+    pub const RESERVED_MASK: u32 = 0x8000_0000;
+    pub const EDITION_MASK: u32 = 0x7F80_0000;
+    pub const FILE_ID_MASK: u32 = 0x007F_FFFF;
+
+    pub const MAX_FILE_ID: u32 = Self::FILE_ID_MASK;
+
+    pub const RESERVED_HIGH_BITS: u32 = Self::RESERVED_MASK.count_ones();
+    pub const FILE_ID_BITS: u32 = Self::FILE_ID_MASK.count_ones();
+    pub const EDITION_BITS: u32 = Self::EDITION_MASK.count_ones();
+
+    pub const fn current_edition(file_id: FileId) -> Self {
+        Self::new(file_id, Edition::CURRENT)
+    }
+
+    pub const fn new(file_id: FileId, edition: Edition) -> Self {
+        let file_id = file_id.index();
+        let edition = edition as u32;
+        assert!(file_id <= Self::MAX_FILE_ID);
+        Self(file_id | (edition << Self::FILE_ID_BITS))
+    }
+
+    pub fn from_raw(u32: u32) -> Self {
+        assert!(u32 & Self::RESERVED_MASK == 0);
+        assert!((u32 & Self::EDITION_MASK) >> Self::FILE_ID_BITS <= Edition::LATEST as u32);
+        Self(u32)
+    }
+
+    pub const fn as_u32(self) -> u32 {
+        self.0
+    }
+
+    pub const fn file_id(self) -> FileId {
+        FileId::from_raw(self.0 & Self::FILE_ID_MASK)
+    }
+
+    pub const fn unpack(self) -> (FileId, Edition) {
+        (self.file_id(), self.edition())
+    }
+
+    pub const fn edition(self) -> Edition {
+        let edition = (self.0 & Self::EDITION_MASK) >> Self::FILE_ID_BITS;
+        debug_assert!(edition <= Edition::LATEST as u32);
+        unsafe { std::mem::transmute(edition as u8) }
+    }
+}
+
 /// Input to the analyzer is a set of files, where each file is identified by
 /// `FileId` and contains source code. However, another source of source code in
 /// Rust are macros: each macro can be thought of as producing a "temporary
@@ -149,6 +212,38 @@ impl fmt::Debug for HirFileId {
     }
 }
 
+impl PartialEq for HirFileId {
+    fn eq(&self, &other: &FileId) -> bool {
+        self.file_id().map(EditionedFileId::file_id) == Some(other)
+    }
+}
+impl PartialEq for FileId {
+    fn eq(&self, other: &HirFileId) -> bool {
+        other.file_id().map(EditionedFileId::file_id) == Some(*self)
+    }
+}
+
+impl PartialEq for HirFileId {
+    fn eq(&self, &other: &EditionedFileId) -> bool {
+        *self == HirFileId::from(other)
+    }
+}
+impl PartialEq for EditionedFileId {
+    fn eq(&self, &other: &HirFileId) -> bool {
+        other == HirFileId::from(*self)
+    }
+}
+impl PartialEq for FileId {
+    fn eq(&self, &other: &EditionedFileId) -> bool {
+        *self == FileId::from(other)
+    }
+}
+impl PartialEq for EditionedFileId {
+    fn eq(&self, &other: &FileId) -> bool {
+        other == FileId::from(*self)
+    }
+}
+
 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
 pub struct MacroFileId {
     pub macro_call_id: MacroCallId,
@@ -182,14 +277,14 @@ impl MacroCallId {
 
 #[derive(Clone, Copy, PartialEq, Eq, Hash)]
 pub enum HirFileIdRepr {
-    FileId(FileId),
+    FileId(EditionedFileId),
     MacroFile(MacroFileId),
 }
 
 impl fmt::Debug for HirFileIdRepr {
     fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         match self {
-            Self::FileId(arg0) => f.debug_tuple("FileId").field(&arg0.index()).finish(),
+            Self::FileId(arg0) => arg0.fmt(f),
             Self::MacroFile(arg0) => {
                 f.debug_tuple("MacroFile").field(&arg0.macro_call_id.0).finish()
             }
@@ -197,19 +292,17 @@ impl fmt::Debug for HirFileIdRepr {
     }
 }
 
-impl From for HirFileId {
+impl From for HirFileId {
     #[allow(clippy::let_unit_value)]
-    fn from(id: FileId) -> Self {
-        _ = Self::ASSERT_MAX_FILE_ID_IS_SAME;
-        assert!(id.index() <= Self::MAX_HIR_FILE_ID, "FileId index {} is too large", id.index());
-        HirFileId(id.index())
+    fn from(id: EditionedFileId) -> Self {
+        assert!(id.as_u32() <= Self::MAX_HIR_FILE_ID, "FileId index {} is too large", id.as_u32());
+        HirFileId(id.as_u32())
     }
 }
 
 impl From for HirFileId {
     #[allow(clippy::let_unit_value)]
     fn from(MacroFileId { macro_call_id: MacroCallId(id) }: MacroFileId) -> Self {
-        _ = Self::ASSERT_MAX_FILE_ID_IS_SAME;
         let id = id.as_u32();
         assert!(id <= Self::MAX_HIR_FILE_ID, "MacroCallId index {id} is too large");
         HirFileId(id | Self::MACRO_FILE_TAG_MASK)
@@ -217,9 +310,6 @@ impl From for HirFileId {
 }
 
 impl HirFileId {
-    const ASSERT_MAX_FILE_ID_IS_SAME: () =
-        [()][(Self::MAX_HIR_FILE_ID != FileId::MAX_FILE_ID) as usize];
-
     const MAX_HIR_FILE_ID: u32 = u32::MAX ^ Self::MACRO_FILE_TAG_MASK;
     const MACRO_FILE_TAG_MASK: u32 = 1 << 31;
 
@@ -239,9 +329,9 @@ impl HirFileId {
     }
 
     #[inline]
-    pub fn file_id(self) -> Option {
+    pub fn file_id(self) -> Option {
         match self.0 & Self::MACRO_FILE_TAG_MASK {
-            0 => Some(FileId::from_raw(self.0)),
+            0 => Some(EditionedFileId(self.0)),
             _ => None,
         }
     }
@@ -249,7 +339,7 @@ impl HirFileId {
     #[inline]
     pub fn repr(self) -> HirFileIdRepr {
         match self.0 & Self::MACRO_FILE_TAG_MASK {
-            0 => HirFileIdRepr::FileId(FileId::from_raw(self.0)),
+            0 => HirFileIdRepr::FileId(EditionedFileId(self.0)),
             _ => HirFileIdRepr::MacroFile(MacroFileId {
                 macro_call_id: MacroCallId(InternId::from(self.0 ^ Self::MACRO_FILE_TAG_MASK)),
             }),
diff --git a/crates/span/src/map.rs b/crates/span/src/map.rs
index 81fc56c961..6269f4c30c 100644
--- a/crates/span/src/map.rs
+++ b/crates/span/src/map.rs
@@ -4,11 +4,10 @@
 use std::{fmt, hash::Hash};
 
 use stdx::{always, itertools::Itertools};
-use vfs::FileId;
 
 use crate::{
-    ErasedFileAstId, Span, SpanAnchor, SpanData, SyntaxContextId, TextRange, TextSize,
-    ROOT_ERASED_FILE_AST_ID,
+    EditionedFileId, ErasedFileAstId, Span, SpanAnchor, SpanData, SyntaxContextId, TextRange,
+    TextSize, ROOT_ERASED_FILE_AST_ID,
 };
 
 /// Maps absolute text ranges for the corresponding file to the relevant span data.
@@ -109,7 +108,7 @@ where
 
 #[derive(PartialEq, Eq, Hash, Debug)]
 pub struct RealSpanMap {
-    file_id: FileId,
+    file_id: EditionedFileId,
     /// Invariant: Sorted vec over TextSize
     // FIXME: SortedVec<(TextSize, ErasedFileAstId)>?
     pairs: Box<[(TextSize, ErasedFileAstId)]>,
@@ -128,7 +127,7 @@ impl fmt::Display for RealSpanMap {
 
 impl RealSpanMap {
     /// Creates a real file span map that returns absolute ranges (relative ranges to the root ast id).
-    pub fn absolute(file_id: FileId) -> Self {
+    pub fn absolute(file_id: EditionedFileId) -> Self {
         RealSpanMap {
             file_id,
             pairs: Box::from([(TextSize::new(0), ROOT_ERASED_FILE_AST_ID)]),
@@ -137,7 +136,7 @@ impl RealSpanMap {
     }
 
     pub fn from_file(
-        file_id: FileId,
+        file_id: EditionedFileId,
         pairs: Box<[(TextSize, ErasedFileAstId)]>,
         end: TextSize,
     ) -> Self {
diff --git a/crates/syntax/src/lib.rs b/crates/syntax/src/lib.rs
index 6d21ca1747..b68374848b 100644
--- a/crates/syntax/src/lib.rs
+++ b/crates/syntax/src/lib.rs
@@ -150,15 +150,17 @@ impl Parse {
     }
 
     pub fn reparse(&self, indel: &Indel, edition: Edition) -> Parse {
-        self.incremental_reparse(indel).unwrap_or_else(|| self.full_reparse(indel, edition))
+        self.incremental_reparse(indel, edition)
+            .unwrap_or_else(|| self.full_reparse(indel, edition))
     }
 
-    fn incremental_reparse(&self, indel: &Indel) -> Option> {
+    fn incremental_reparse(&self, indel: &Indel, edition: Edition) -> Option> {
         // FIXME: validation errors are not handled here
         parsing::incremental_reparse(
             self.tree().syntax(),
             indel,
             self.errors.as_deref().unwrap_or_default().iter().cloned(),
+            edition,
         )
         .map(|(green_node, errors, _reparsed_range)| Parse {
             green: green_node,
diff --git a/crates/syntax/src/parsing/reparsing.rs b/crates/syntax/src/parsing/reparsing.rs
index 1e1a02f445..a895d9e274 100644
--- a/crates/syntax/src/parsing/reparsing.rs
+++ b/crates/syntax/src/parsing/reparsing.rs
@@ -21,14 +21,13 @@ pub(crate) fn incremental_reparse(
     node: &SyntaxNode,
     edit: &Indel,
     errors: impl IntoIterator,
+    edition: Edition,
 ) -> Option<(GreenNode, Vec, TextRange)> {
-    if let Some((green, new_errors, old_range)) = reparse_token(node, edit) {
+    if let Some((green, new_errors, old_range)) = reparse_token(node, edit, edition) {
         return Some((green, merge_errors(errors, new_errors, old_range, edit), old_range));
     }
 
-    if let Some((green, new_errors, old_range)) =
-        reparse_block(node, edit, parser::Edition::CURRENT)
-    {
+    if let Some((green, new_errors, old_range)) = reparse_block(node, edit, edition) {
         return Some((green, merge_errors(errors, new_errors, old_range, edit), old_range));
     }
     None
@@ -37,6 +36,7 @@ pub(crate) fn incremental_reparse(
 fn reparse_token(
     root: &SyntaxNode,
     edit: &Indel,
+    edition: Edition,
 ) -> Option<(GreenNode, Vec, TextRange)> {
     let prev_token = root.covering_element(edit.delete).as_token()?.clone();
     let prev_token_kind = prev_token.kind();
@@ -51,8 +51,7 @@ fn reparse_token(
             }
 
             let mut new_text = get_text_after_edit(prev_token.clone().into(), edit);
-            let (new_token_kind, new_err) =
-                parser::LexedStr::single_token(Edition::CURRENT, &new_text)?;
+            let (new_token_kind, new_err) = parser::LexedStr::single_token(edition, &new_text)?;
 
             if new_token_kind != prev_token_kind
                 || (new_token_kind == IDENT && is_contextual_kw(&new_text))
@@ -65,8 +64,7 @@ fn reparse_token(
             // `b` no longer remains an identifier, but becomes a part of byte string literal
             if let Some(next_char) = root.text().char_at(prev_token.text_range().end()) {
                 new_text.push(next_char);
-                let token_with_next_char =
-                    parser::LexedStr::single_token(Edition::CURRENT, &new_text);
+                let token_with_next_char = parser::LexedStr::single_token(edition, &new_text);
                 if let Some((_kind, _error)) = token_with_next_char {
                     return None;
                 }
@@ -93,7 +91,7 @@ fn reparse_block(
     let (node, reparser) = find_reparsable_node(root, edit.delete)?;
     let text = get_text_after_edit(node.clone().into(), edit);
 
-    let lexed = parser::LexedStr::new(Edition::CURRENT, text.as_str());
+    let lexed = parser::LexedStr::new(edition, text.as_str());
     let parser_input = lexed.to_input();
     if !is_balanced(&lexed) {
         return None;
@@ -201,6 +199,7 @@ mod tests {
                 before.tree().syntax(),
                 &edit,
                 before.errors.as_deref().unwrap_or_default().iter().cloned(),
+                Edition::CURRENT,
             )
             .unwrap();
             assert_eq!(range.len(), reparsed_len.into(), "reparsed fragment has wrong length");
diff --git a/crates/test-fixture/src/lib.rs b/crates/test-fixture/src/lib.rs
index d9f9fb82be..19c81a7c5f 100644
--- a/crates/test-fixture/src/lib.rs
+++ b/crates/test-fixture/src/lib.rs
@@ -9,13 +9,15 @@ use cfg::CfgOptions;
 use hir_expand::{
     change::ChangeWithProcMacros,
     db::ExpandDatabase,
+    files::FilePosition,
     proc_macro::{
         ProcMacro, ProcMacroExpander, ProcMacroExpansionError, ProcMacroKind, ProcMacros,
     },
+    FileRange,
 };
 use intern::Symbol;
 use rustc_hash::FxHashMap;
-use span::{Edition, FileId, FilePosition, FileRange, Span};
+use span::{Edition, EditionedFileId, FileId, Span};
 use test_utils::{
     extract_range_or_offset, Fixture, FixtureWithProjectMeta, RangeOrOffset, CURSOR_MARKER,
     ESCAPED_CURSOR_MARKER,
@@ -26,7 +28,7 @@ pub const WORKSPACE: base_db::SourceRootId = base_db::SourceRootId(0);
 
 pub trait WithFixture: Default + ExpandDatabase + SourceDatabaseExt + 'static {
     #[track_caller]
-    fn with_single_file(ra_fixture: &str) -> (Self, FileId) {
+    fn with_single_file(ra_fixture: &str) -> (Self, EditionedFileId) {
         let fixture = ChangeFixture::parse(ra_fixture);
         let mut db = Self::default();
         fixture.change.apply(&mut db);
@@ -35,7 +37,7 @@ pub trait WithFixture: Default + ExpandDatabase + SourceDatabaseExt + 'static {
     }
 
     #[track_caller]
-    fn with_many_files(ra_fixture: &str) -> (Self, Vec) {
+    fn with_many_files(ra_fixture: &str) -> (Self, Vec) {
         let fixture = ChangeFixture::parse(ra_fixture);
         let mut db = Self::default();
         fixture.change.apply(&mut db);
@@ -79,7 +81,7 @@ pub trait WithFixture: Default + ExpandDatabase + SourceDatabaseExt + 'static {
     }
 
     #[track_caller]
-    fn with_range_or_offset(ra_fixture: &str) -> (Self, FileId, RangeOrOffset) {
+    fn with_range_or_offset(ra_fixture: &str) -> (Self, EditionedFileId, RangeOrOffset) {
         let fixture = ChangeFixture::parse(ra_fixture);
         let mut db = Self::default();
         fixture.change.apply(&mut db);
@@ -102,8 +104,8 @@ pub trait WithFixture: Default + ExpandDatabase + SourceDatabaseExt + 'static {
 impl WithFixture for DB {}
 
 pub struct ChangeFixture {
-    pub file_position: Option<(FileId, RangeOrOffset)>,
-    pub files: Vec,
+    pub file_position: Option<(EditionedFileId, RangeOrOffset)>,
+    pub files: Vec,
     pub change: ChangeWithProcMacros,
 }
 
@@ -151,13 +153,14 @@ impl ChangeFixture {
         let mut file_position = None;
 
         for entry in fixture {
+            let mut range_or_offset = None;
             let text = if entry.text.contains(CURSOR_MARKER) {
                 if entry.text.contains(ESCAPED_CURSOR_MARKER) {
                     entry.text.replace(ESCAPED_CURSOR_MARKER, CURSOR_MARKER)
                 } else {
-                    let (range_or_offset, text) = extract_range_or_offset(&entry.text);
+                    let (roo, text) = extract_range_or_offset(&entry.text);
                     assert!(file_position.is_none());
-                    file_position = Some((file_id, range_or_offset));
+                    range_or_offset = Some(roo);
                     text
                 }
             } else {
@@ -165,6 +168,11 @@ impl ChangeFixture {
             };
 
             let meta = FileMeta::from_fixture(entry, current_source_root_kind);
+            if let Some(range_or_offset) = range_or_offset {
+                file_position =
+                    Some((EditionedFileId::new(file_id, meta.edition), range_or_offset));
+            }
+
             assert!(meta.path.starts_with(SOURCE_ROOT_PREFIX));
             if !meta.deps.is_empty() {
                 assert!(meta.krate.is_some(), "can't specify deps without naming the crate")
@@ -216,7 +224,7 @@ impl ChangeFixture {
             source_change.change_file(file_id, Some(text));
             let path = VfsPath::new_virtual_path(meta.path);
             file_set.insert(file_id, path);
-            files.push(file_id);
+            files.push(EditionedFileId::new(file_id, meta.edition));
             file_id = FileId::from_raw(file_id.index() + 1);
         }
 
diff --git a/crates/vfs/src/lib.rs b/crates/vfs/src/lib.rs
index b3aa6e2fe1..77f890fd7e 100644
--- a/crates/vfs/src/lib.rs
+++ b/crates/vfs/src/lib.rs
@@ -67,16 +67,16 @@ pub struct FileId(u32);
 // pub struct FileId(NonMaxU32);
 
 impl FileId {
-    pub const MAX_FILE_ID: u32 = 0x7fff_ffff;
+    pub const MAX: u32 = 0x7fff_ffff;
 
     #[inline]
     pub const fn from_raw(raw: u32) -> FileId {
-        assert!(raw <= Self::MAX_FILE_ID);
+        assert!(raw <= Self::MAX);
         FileId(raw)
     }
 
     #[inline]
-    pub fn index(self) -> u32 {
+    pub const fn index(self) -> u32 {
         self.0
     }
 }

From ef462ca88ef5ba6c0a7a6650b4173a83547b2de2 Mon Sep 17 00:00:00 2001
From: Lukas Wirth 
Date: Thu, 18 Jul 2024 09:09:31 +0200
Subject: [PATCH 2/7] Update test fixtures

---
 .../ide-db/src/test_data/test_doc_alias.txt   |  49 ++--
 .../test_symbol_index_collection.txt          | 210 +++++++++++++-----
 crates/ide/src/annotations.rs                 |  54 ++---
 crates/ide/src/hover/tests.rs                 | 136 ++++++------
 crates/ide/src/inlay_hints/chaining.rs        |  42 ++--
 editors/code/package.json                     |   5 -
 6 files changed, 301 insertions(+), 195 deletions(-)

diff --git a/crates/ide-db/src/test_data/test_doc_alias.txt b/crates/ide-db/src/test_data/test_doc_alias.txt
index 7c01ac0693..efcf53ded6 100644
--- a/crates/ide-db/src/test_data/test_doc_alias.txt
+++ b/crates/ide-db/src/test_data/test_doc_alias.txt
@@ -20,8 +20,11 @@
                     ),
                 ),
                 loc: DeclarationLocation {
-                    hir_file_id: FileId(
-                        0,
+                    hir_file_id: EditionedFileId(
+                        FileId(
+                            0,
+                        ),
+                        Edition2021,
                     ),
                     ptr: SyntaxNodePtr {
                         kind: STRUCT,
@@ -50,8 +53,11 @@
                     ),
                 ),
                 loc: DeclarationLocation {
-                    hir_file_id: FileId(
-                        0,
+                    hir_file_id: EditionedFileId(
+                        FileId(
+                            0,
+                        ),
+                        Edition2021,
                     ),
                     ptr: SyntaxNodePtr {
                         kind: STRUCT,
@@ -80,8 +86,11 @@
                     ),
                 ),
                 loc: DeclarationLocation {
-                    hir_file_id: FileId(
-                        0,
+                    hir_file_id: EditionedFileId(
+                        FileId(
+                            0,
+                        ),
+                        Edition2021,
                     ),
                     ptr: SyntaxNodePtr {
                         kind: STRUCT,
@@ -110,8 +119,11 @@
                     ),
                 ),
                 loc: DeclarationLocation {
-                    hir_file_id: FileId(
-                        0,
+                    hir_file_id: EditionedFileId(
+                        FileId(
+                            0,
+                        ),
+                        Edition2021,
                     ),
                     ptr: SyntaxNodePtr {
                         kind: STRUCT,
@@ -140,8 +152,11 @@
                     ),
                 ),
                 loc: DeclarationLocation {
-                    hir_file_id: FileId(
-                        0,
+                    hir_file_id: EditionedFileId(
+                        FileId(
+                            0,
+                        ),
+                        Edition2021,
                     ),
                     ptr: SyntaxNodePtr {
                         kind: STRUCT,
@@ -170,8 +185,11 @@
                     ),
                 ),
                 loc: DeclarationLocation {
-                    hir_file_id: FileId(
-                        0,
+                    hir_file_id: EditionedFileId(
+                        FileId(
+                            0,
+                        ),
+                        Edition2021,
                     ),
                     ptr: SyntaxNodePtr {
                         kind: STRUCT,
@@ -200,8 +218,11 @@
                     ),
                 ),
                 loc: DeclarationLocation {
-                    hir_file_id: FileId(
-                        0,
+                    hir_file_id: EditionedFileId(
+                        FileId(
+                            0,
+                        ),
+                        Edition2021,
                     ),
                     ptr: SyntaxNodePtr {
                         kind: STRUCT,
diff --git a/crates/ide-db/src/test_data/test_symbol_index_collection.txt b/crates/ide-db/src/test_data/test_symbol_index_collection.txt
index f0b97779c7..9d70942199 100644
--- a/crates/ide-db/src/test_data/test_symbol_index_collection.txt
+++ b/crates/ide-db/src/test_data/test_symbol_index_collection.txt
@@ -18,8 +18,11 @@
                     },
                 ),
                 loc: DeclarationLocation {
-                    hir_file_id: FileId(
-                        0,
+                    hir_file_id: EditionedFileId(
+                        FileId(
+                            0,
+                        ),
+                        Edition2021,
                     ),
                     ptr: SyntaxNodePtr {
                         kind: TYPE_ALIAS,
@@ -46,8 +49,11 @@
                     },
                 ),
                 loc: DeclarationLocation {
-                    hir_file_id: FileId(
-                        0,
+                    hir_file_id: EditionedFileId(
+                        FileId(
+                            0,
+                        ),
+                        Edition2021,
                     ),
                     ptr: SyntaxNodePtr {
                         kind: CONST,
@@ -74,8 +80,11 @@
                     },
                 ),
                 loc: DeclarationLocation {
-                    hir_file_id: FileId(
-                        0,
+                    hir_file_id: EditionedFileId(
+                        FileId(
+                            0,
+                        ),
+                        Edition2021,
                     ),
                     ptr: SyntaxNodePtr {
                         kind: CONST,
@@ -104,8 +113,11 @@
                     ),
                 ),
                 loc: DeclarationLocation {
-                    hir_file_id: FileId(
-                        0,
+                    hir_file_id: EditionedFileId(
+                        FileId(
+                            0,
+                        ),
+                        Edition2021,
                     ),
                     ptr: SyntaxNodePtr {
                         kind: ENUM,
@@ -134,8 +146,11 @@
                     },
                 ),
                 loc: DeclarationLocation {
-                    hir_file_id: FileId(
-                        0,
+                    hir_file_id: EditionedFileId(
+                        FileId(
+                            0,
+                        ),
+                        Edition2021,
                     ),
                     ptr: SyntaxNodePtr {
                         kind: USE_TREE,
@@ -164,8 +179,11 @@
                     },
                 ),
                 loc: DeclarationLocation {
-                    hir_file_id: FileId(
-                        0,
+                    hir_file_id: EditionedFileId(
+                        FileId(
+                            0,
+                        ),
+                        Edition2021,
                     ),
                     ptr: SyntaxNodePtr {
                         kind: MACRO_DEF,
@@ -192,8 +210,11 @@
                     },
                 ),
                 loc: DeclarationLocation {
-                    hir_file_id: FileId(
-                        0,
+                    hir_file_id: EditionedFileId(
+                        FileId(
+                            0,
+                        ),
+                        Edition2021,
                     ),
                     ptr: SyntaxNodePtr {
                         kind: STATIC,
@@ -222,8 +243,11 @@
                     ),
                 ),
                 loc: DeclarationLocation {
-                    hir_file_id: FileId(
-                        0,
+                    hir_file_id: EditionedFileId(
+                        FileId(
+                            0,
+                        ),
+                        Edition2021,
                     ),
                     ptr: SyntaxNodePtr {
                         kind: STRUCT,
@@ -282,8 +306,11 @@
                     ),
                 ),
                 loc: DeclarationLocation {
-                    hir_file_id: FileId(
-                        0,
+                    hir_file_id: EditionedFileId(
+                        FileId(
+                            0,
+                        ),
+                        Edition2021,
                     ),
                     ptr: SyntaxNodePtr {
                         kind: STRUCT,
@@ -314,8 +341,11 @@
                     ),
                 ),
                 loc: DeclarationLocation {
-                    hir_file_id: FileId(
-                        0,
+                    hir_file_id: EditionedFileId(
+                        FileId(
+                            0,
+                        ),
+                        Edition2021,
                     ),
                     ptr: SyntaxNodePtr {
                         kind: STRUCT,
@@ -346,8 +376,11 @@
                     ),
                 ),
                 loc: DeclarationLocation {
-                    hir_file_id: FileId(
-                        0,
+                    hir_file_id: EditionedFileId(
+                        FileId(
+                            0,
+                        ),
+                        Edition2021,
                     ),
                     ptr: SyntaxNodePtr {
                         kind: STRUCT,
@@ -376,8 +409,11 @@
                     ),
                 ),
                 loc: DeclarationLocation {
-                    hir_file_id: FileId(
-                        0,
+                    hir_file_id: EditionedFileId(
+                        FileId(
+                            0,
+                        ),
+                        Edition2021,
                     ),
                     ptr: SyntaxNodePtr {
                         kind: STRUCT,
@@ -404,8 +440,11 @@
                     },
                 ),
                 loc: DeclarationLocation {
-                    hir_file_id: FileId(
-                        0,
+                    hir_file_id: EditionedFileId(
+                        FileId(
+                            0,
+                        ),
+                        Edition2021,
                     ),
                     ptr: SyntaxNodePtr {
                         kind: TRAIT,
@@ -434,8 +473,11 @@
                     },
                 ),
                 loc: DeclarationLocation {
-                    hir_file_id: FileId(
-                        0,
+                    hir_file_id: EditionedFileId(
+                        FileId(
+                            0,
+                        ),
+                        Edition2021,
                     ),
                     ptr: SyntaxNodePtr {
                         kind: USE_TREE,
@@ -464,8 +506,11 @@
                     ),
                 ),
                 loc: DeclarationLocation {
-                    hir_file_id: FileId(
-                        0,
+                    hir_file_id: EditionedFileId(
+                        FileId(
+                            0,
+                        ),
+                        Edition2021,
                     ),
                     ptr: SyntaxNodePtr {
                         kind: UNION,
@@ -494,8 +539,11 @@
                     },
                 ),
                 loc: DeclarationLocation {
-                    hir_file_id: FileId(
-                        0,
+                    hir_file_id: EditionedFileId(
+                        FileId(
+                            0,
+                        ),
+                        Edition2021,
                     ),
                     ptr: SyntaxNodePtr {
                         kind: MODULE,
@@ -524,8 +572,11 @@
                     },
                 ),
                 loc: DeclarationLocation {
-                    hir_file_id: FileId(
-                        0,
+                    hir_file_id: EditionedFileId(
+                        FileId(
+                            0,
+                        ),
+                        Edition2021,
                     ),
                     ptr: SyntaxNodePtr {
                         kind: MODULE,
@@ -554,8 +605,11 @@
                     },
                 ),
                 loc: DeclarationLocation {
-                    hir_file_id: FileId(
-                        0,
+                    hir_file_id: EditionedFileId(
+                        FileId(
+                            0,
+                        ),
+                        Edition2021,
                     ),
                     ptr: SyntaxNodePtr {
                         kind: MACRO_RULES,
@@ -582,8 +636,11 @@
                     },
                 ),
                 loc: DeclarationLocation {
-                    hir_file_id: FileId(
-                        0,
+                    hir_file_id: EditionedFileId(
+                        FileId(
+                            0,
+                        ),
+                        Edition2021,
                     ),
                     ptr: SyntaxNodePtr {
                         kind: FN,
@@ -612,8 +669,11 @@
                     },
                 ),
                 loc: DeclarationLocation {
-                    hir_file_id: FileId(
-                        0,
+                    hir_file_id: EditionedFileId(
+                        FileId(
+                            0,
+                        ),
+                        Edition2021,
                     ),
                     ptr: SyntaxNodePtr {
                         kind: FN,
@@ -644,8 +704,11 @@
                     },
                 ),
                 loc: DeclarationLocation {
-                    hir_file_id: FileId(
-                        0,
+                    hir_file_id: EditionedFileId(
+                        FileId(
+                            0,
+                        ),
+                        Edition2021,
                     ),
                     ptr: SyntaxNodePtr {
                         kind: MACRO_RULES,
@@ -672,8 +735,11 @@
                     },
                 ),
                 loc: DeclarationLocation {
-                    hir_file_id: FileId(
-                        0,
+                    hir_file_id: EditionedFileId(
+                        FileId(
+                            0,
+                        ),
+                        Edition2021,
                     ),
                     ptr: SyntaxNodePtr {
                         kind: FN,
@@ -702,8 +768,11 @@
                     },
                 ),
                 loc: DeclarationLocation {
-                    hir_file_id: FileId(
-                        0,
+                    hir_file_id: EditionedFileId(
+                        FileId(
+                            0,
+                        ),
+                        Edition2021,
                     ),
                     ptr: SyntaxNodePtr {
                         kind: USE_TREE,
@@ -730,8 +799,11 @@
                     },
                 ),
                 loc: DeclarationLocation {
-                    hir_file_id: FileId(
-                        0,
+                    hir_file_id: EditionedFileId(
+                        FileId(
+                            0,
+                        ),
+                        Edition2021,
                     ),
                     ptr: SyntaxNodePtr {
                         kind: FN,
@@ -773,8 +845,11 @@
                     ),
                 ),
                 loc: DeclarationLocation {
-                    hir_file_id: FileId(
-                        0,
+                    hir_file_id: EditionedFileId(
+                        FileId(
+                            0,
+                        ),
+                        Edition2021,
                     ),
                     ptr: SyntaxNodePtr {
                         kind: STRUCT,
@@ -814,8 +889,11 @@
                     },
                 ),
                 loc: DeclarationLocation {
-                    hir_file_id: FileId(
-                        1,
+                    hir_file_id: EditionedFileId(
+                        FileId(
+                            1,
+                        ),
+                        Edition2021,
                     ),
                     ptr: SyntaxNodePtr {
                         kind: USE_TREE,
@@ -844,8 +922,11 @@
                     ),
                 ),
                 loc: DeclarationLocation {
-                    hir_file_id: FileId(
-                        1,
+                    hir_file_id: EditionedFileId(
+                        FileId(
+                            1,
+                        ),
+                        Edition2021,
                     ),
                     ptr: SyntaxNodePtr {
                         kind: STRUCT,
@@ -874,8 +955,11 @@
                     },
                 ),
                 loc: DeclarationLocation {
-                    hir_file_id: FileId(
-                        1,
+                    hir_file_id: EditionedFileId(
+                        FileId(
+                            1,
+                        ),
+                        Edition2021,
                     ),
                     ptr: SyntaxNodePtr {
                         kind: USE_TREE,
@@ -904,8 +988,11 @@
                     ),
                 ),
                 loc: DeclarationLocation {
-                    hir_file_id: FileId(
-                        1,
+                    hir_file_id: EditionedFileId(
+                        FileId(
+                            1,
+                        ),
+                        Edition2021,
                     ),
                     ptr: SyntaxNodePtr {
                         kind: USE_TREE,
@@ -934,8 +1021,11 @@
                     ),
                 ),
                 loc: DeclarationLocation {
-                    hir_file_id: FileId(
-                        1,
+                    hir_file_id: EditionedFileId(
+                        FileId(
+                            1,
+                        ),
+                        Edition2021,
                     ),
                     ptr: SyntaxNodePtr {
                         kind: USE_TREE,
diff --git a/crates/ide/src/annotations.rs b/crates/ide/src/annotations.rs
index 670d202411..8e0166a4a7 100644
--- a/crates/ide/src/annotations.rs
+++ b/crates/ide/src/annotations.rs
@@ -254,7 +254,7 @@ fn main() {
                     Annotation {
                         range: 6..10,
                         kind: HasReferences {
-                            pos: FilePosition {
+                            pos: FilePositionWrapper {
                                 file_id: FileId(
                                     0,
                                 ),
@@ -262,7 +262,7 @@ fn main() {
                             },
                             data: Some(
                                 [
-                                    FileRange {
+                                    FileRangeWrapper {
                                         file_id: FileId(
                                             0,
                                         ),
@@ -275,7 +275,7 @@ fn main() {
                     Annotation {
                         range: 30..36,
                         kind: HasReferences {
-                            pos: FilePosition {
+                            pos: FilePositionWrapper {
                                 file_id: FileId(
                                     0,
                                 ),
@@ -308,7 +308,7 @@ fn main() {
                     Annotation {
                         range: 53..57,
                         kind: HasReferences {
-                            pos: FilePosition {
+                            pos: FilePositionWrapper {
                                 file_id: FileId(
                                     0,
                                 ),
@@ -339,7 +339,7 @@ fn main() {
                     Annotation {
                         range: 7..11,
                         kind: HasReferences {
-                            pos: FilePosition {
+                            pos: FilePositionWrapper {
                                 file_id: FileId(
                                     0,
                                 ),
@@ -347,7 +347,7 @@ fn main() {
                             },
                             data: Some(
                                 [
-                                    FileRange {
+                                    FileRangeWrapper {
                                         file_id: FileId(
                                             0,
                                         ),
@@ -360,7 +360,7 @@ fn main() {
                     Annotation {
                         range: 7..11,
                         kind: HasImpls {
-                            pos: FilePosition {
+                            pos: FilePositionWrapper {
                                 file_id: FileId(
                                     0,
                                 ),
@@ -393,7 +393,7 @@ fn main() {
                     Annotation {
                         range: 17..21,
                         kind: HasReferences {
-                            pos: FilePosition {
+                            pos: FilePositionWrapper {
                                 file_id: FileId(
                                     0,
                                 ),
@@ -428,7 +428,7 @@ fn main() {
                     Annotation {
                         range: 7..11,
                         kind: HasReferences {
-                            pos: FilePosition {
+                            pos: FilePositionWrapper {
                                 file_id: FileId(
                                     0,
                                 ),
@@ -436,13 +436,13 @@ fn main() {
                             },
                             data: Some(
                                 [
-                                    FileRange {
+                                    FileRangeWrapper {
                                         file_id: FileId(
                                             0,
                                         ),
                                         range: 57..61,
                                     },
-                                    FileRange {
+                                    FileRangeWrapper {
                                         file_id: FileId(
                                             0,
                                         ),
@@ -455,7 +455,7 @@ fn main() {
                     Annotation {
                         range: 7..11,
                         kind: HasImpls {
-                            pos: FilePosition {
+                            pos: FilePositionWrapper {
                                 file_id: FileId(
                                     0,
                                 ),
@@ -479,7 +479,7 @@ fn main() {
                     Annotation {
                         range: 20..31,
                         kind: HasImpls {
-                            pos: FilePosition {
+                            pos: FilePositionWrapper {
                                 file_id: FileId(
                                     0,
                                 ),
@@ -503,7 +503,7 @@ fn main() {
                     Annotation {
                         range: 20..31,
                         kind: HasReferences {
-                            pos: FilePosition {
+                            pos: FilePositionWrapper {
                                 file_id: FileId(
                                     0,
                                 ),
@@ -511,7 +511,7 @@ fn main() {
                             },
                             data: Some(
                                 [
-                                    FileRange {
+                                    FileRangeWrapper {
                                         file_id: FileId(
                                             0,
                                         ),
@@ -524,7 +524,7 @@ fn main() {
                     Annotation {
                         range: 69..73,
                         kind: HasReferences {
-                            pos: FilePosition {
+                            pos: FilePositionWrapper {
                                 file_id: FileId(
                                     0,
                                 ),
@@ -589,7 +589,7 @@ fn main() {}
                     Annotation {
                         range: 3..7,
                         kind: HasReferences {
-                            pos: FilePosition {
+                            pos: FilePositionWrapper {
                                 file_id: FileId(
                                     0,
                                 ),
@@ -624,7 +624,7 @@ fn main() {
                     Annotation {
                         range: 7..11,
                         kind: HasReferences {
-                            pos: FilePosition {
+                            pos: FilePositionWrapper {
                                 file_id: FileId(
                                     0,
                                 ),
@@ -632,13 +632,13 @@ fn main() {
                             },
                             data: Some(
                                 [
-                                    FileRange {
+                                    FileRangeWrapper {
                                         file_id: FileId(
                                             0,
                                         ),
                                         range: 19..23,
                                     },
-                                    FileRange {
+                                    FileRangeWrapper {
                                         file_id: FileId(
                                             0,
                                         ),
@@ -651,7 +651,7 @@ fn main() {
                     Annotation {
                         range: 7..11,
                         kind: HasImpls {
-                            pos: FilePosition {
+                            pos: FilePositionWrapper {
                                 file_id: FileId(
                                     0,
                                 ),
@@ -675,7 +675,7 @@ fn main() {
                     Annotation {
                         range: 33..44,
                         kind: HasReferences {
-                            pos: FilePosition {
+                            pos: FilePositionWrapper {
                                 file_id: FileId(
                                     0,
                                 ),
@@ -683,7 +683,7 @@ fn main() {
                             },
                             data: Some(
                                 [
-                                    FileRange {
+                                    FileRangeWrapper {
                                         file_id: FileId(
                                             0,
                                         ),
@@ -696,7 +696,7 @@ fn main() {
                     Annotation {
                         range: 61..65,
                         kind: HasReferences {
-                            pos: FilePosition {
+                            pos: FilePositionWrapper {
                                 file_id: FileId(
                                     0,
                                 ),
@@ -747,7 +747,7 @@ mod tests {
                     Annotation {
                         range: 3..7,
                         kind: HasReferences {
-                            pos: FilePosition {
+                            pos: FilePositionWrapper {
                                 file_id: FileId(
                                     0,
                                 ),
@@ -877,7 +877,7 @@ struct Foo;
                     Annotation {
                         range: 0..71,
                         kind: HasReferences {
-                            pos: FilePosition {
+                            pos: FilePositionWrapper {
                                 file_id: FileId(
                                     0,
                                 ),
@@ -891,7 +891,7 @@ struct Foo;
                     Annotation {
                         range: 0..71,
                         kind: HasImpls {
-                            pos: FilePosition {
+                            pos: FilePositionWrapper {
                                 file_id: FileId(
                                     0,
                                 ),
diff --git a/crates/ide/src/hover/tests.rs b/crates/ide/src/hover/tests.rs
index 4a7db2d295..3257305184 100644
--- a/crates/ide/src/hover/tests.rs
+++ b/crates/ide/src/hover/tests.rs
@@ -2358,17 +2358,17 @@ fn test_hover_trait_show_qualifiers() {
     check_actions(
         r"unsafe trait foo$0() {}",
         expect![[r#"
-                [
-                    Implementation(
-                        FilePosition {
-                            file_id: FileId(
-                                0,
-                            ),
-                            offset: 13,
-                        },
-                    ),
-                ]
-            "#]],
+            [
+                Implementation(
+                    FilePositionWrapper {
+                        file_id: FileId(
+                            0,
+                        ),
+                        offset: 13,
+                    },
+                ),
+            ]
+        "#]],
     );
 }
 
@@ -2925,17 +2925,17 @@ fn test_hover_trait_has_impl_action() {
     check_actions(
         r#"trait foo$0() {}"#,
         expect![[r#"
-                [
-                    Implementation(
-                        FilePosition {
-                            file_id: FileId(
-                                0,
-                            ),
-                            offset: 6,
-                        },
-                    ),
-                ]
-            "#]],
+            [
+                Implementation(
+                    FilePositionWrapper {
+                        file_id: FileId(
+                            0,
+                        ),
+                        offset: 6,
+                    },
+                ),
+            ]
+        "#]],
     );
 }
 
@@ -2944,17 +2944,17 @@ fn test_hover_struct_has_impl_action() {
     check_actions(
         r"struct foo$0() {}",
         expect![[r#"
-                [
-                    Implementation(
-                        FilePosition {
-                            file_id: FileId(
-                                0,
-                            ),
-                            offset: 7,
-                        },
-                    ),
-                ]
-            "#]],
+            [
+                Implementation(
+                    FilePositionWrapper {
+                        file_id: FileId(
+                            0,
+                        ),
+                        offset: 7,
+                    },
+                ),
+            ]
+        "#]],
     );
 }
 
@@ -2963,17 +2963,17 @@ fn test_hover_union_has_impl_action() {
     check_actions(
         r#"union foo$0() {}"#,
         expect![[r#"
-                [
-                    Implementation(
-                        FilePosition {
-                            file_id: FileId(
-                                0,
-                            ),
-                            offset: 6,
-                        },
-                    ),
-                ]
-            "#]],
+            [
+                Implementation(
+                    FilePositionWrapper {
+                        file_id: FileId(
+                            0,
+                        ),
+                        offset: 6,
+                    },
+                ),
+            ]
+        "#]],
     );
 }
 
@@ -2982,17 +2982,17 @@ fn test_hover_enum_has_impl_action() {
     check_actions(
         r"enum foo$0() { A, B }",
         expect![[r#"
-                [
-                    Implementation(
-                        FilePosition {
-                            file_id: FileId(
-                                0,
-                            ),
-                            offset: 5,
-                        },
-                    ),
-                ]
-            "#]],
+            [
+                Implementation(
+                    FilePositionWrapper {
+                        file_id: FileId(
+                            0,
+                        ),
+                        offset: 5,
+                    },
+                ),
+            ]
+        "#]],
     );
 }
 
@@ -3001,17 +3001,17 @@ fn test_hover_self_has_impl_action() {
     check_actions(
         r#"struct foo where Self$0:;"#,
         expect![[r#"
-                [
-                    Implementation(
-                        FilePosition {
-                            file_id: FileId(
-                                0,
-                            ),
-                            offset: 7,
-                        },
-                    ),
-                ]
-            "#]],
+            [
+                Implementation(
+                    FilePositionWrapper {
+                        file_id: FileId(
+                            0,
+                        ),
+                        offset: 7,
+                    },
+                ),
+            ]
+        "#]],
     );
 }
 
@@ -3025,7 +3025,7 @@ fn foo_$0test() {}
         expect![[r#"
             [
                 Reference(
-                    FilePosition {
+                    FilePositionWrapper {
                         file_id: FileId(
                             0,
                         ),
@@ -8450,7 +8450,7 @@ impl Iterator for S {
         expect![[r#"
             [
                 Implementation(
-                    FilePosition {
+                    FilePositionWrapper {
                         file_id: FileId(
                             0,
                         ),
diff --git a/crates/ide/src/inlay_hints/chaining.rs b/crates/ide/src/inlay_hints/chaining.rs
index 01e748a8fa..4e15213b8b 100644
--- a/crates/ide/src/inlay_hints/chaining.rs
+++ b/crates/ide/src/inlay_hints/chaining.rs
@@ -143,7 +143,7 @@ fn main() {
                             InlayHintLabelPart {
                                 text: "B",
                                 linked_location: Some(
-                                    FileRange {
+                                    FileRangeWrapper {
                                         file_id: FileId(
                                             0,
                                         ),
@@ -162,7 +162,7 @@ fn main() {
                             InlayHintLabelPart {
                                 text: "A",
                                 linked_location: Some(
-                                    FileRange {
+                                    FileRangeWrapper {
                                         file_id: FileId(
                                             0,
                                         ),
@@ -226,7 +226,7 @@ fn main() {
                             InlayHintLabelPart {
                                 text: "C",
                                 linked_location: Some(
-                                    FileRange {
+                                    FileRangeWrapper {
                                         file_id: FileId(
                                             0,
                                         ),
@@ -245,7 +245,7 @@ fn main() {
                             InlayHintLabelPart {
                                 text: "B",
                                 linked_location: Some(
-                                    FileRange {
+                                    FileRangeWrapper {
                                         file_id: FileId(
                                             0,
                                         ),
@@ -293,7 +293,7 @@ fn main() {
                             InlayHintLabelPart {
                                 text: "C",
                                 linked_location: Some(
-                                    FileRange {
+                                    FileRangeWrapper {
                                         file_id: FileId(
                                             0,
                                         ),
@@ -312,7 +312,7 @@ fn main() {
                             InlayHintLabelPart {
                                 text: "B",
                                 linked_location: Some(
-                                    FileRange {
+                                    FileRangeWrapper {
                                         file_id: FileId(
                                             0,
                                         ),
@@ -361,7 +361,7 @@ fn main() {
                             InlayHintLabelPart {
                                 text: "B",
                                 linked_location: Some(
-                                    FileRange {
+                                    FileRangeWrapper {
                                         file_id: FileId(
                                             0,
                                         ),
@@ -374,7 +374,7 @@ fn main() {
                             InlayHintLabelPart {
                                 text: "X",
                                 linked_location: Some(
-                                    FileRange {
+                                    FileRangeWrapper {
                                         file_id: FileId(
                                             0,
                                         ),
@@ -393,7 +393,7 @@ fn main() {
                             InlayHintLabelPart {
                                 text: "A",
                                 linked_location: Some(
-                                    FileRange {
+                                    FileRangeWrapper {
                                         file_id: FileId(
                                             0,
                                         ),
@@ -406,7 +406,7 @@ fn main() {
                             InlayHintLabelPart {
                                 text: "X",
                                 linked_location: Some(
-                                    FileRange {
+                                    FileRangeWrapper {
                                         file_id: FileId(
                                             0,
                                         ),
@@ -457,7 +457,7 @@ fn main() {
                             InlayHintLabelPart {
                                 text: "Iterator",
                                 linked_location: Some(
-                                    FileRange {
+                                    FileRangeWrapper {
                                         file_id: FileId(
                                             1,
                                         ),
@@ -470,7 +470,7 @@ fn main() {
                             InlayHintLabelPart {
                                 text: "Item",
                                 linked_location: Some(
-                                    FileRange {
+                                    FileRangeWrapper {
                                         file_id: FileId(
                                             1,
                                         ),
@@ -489,7 +489,7 @@ fn main() {
                             InlayHintLabelPart {
                                 text: "Iterator",
                                 linked_location: Some(
-                                    FileRange {
+                                    FileRangeWrapper {
                                         file_id: FileId(
                                             1,
                                         ),
@@ -502,7 +502,7 @@ fn main() {
                             InlayHintLabelPart {
                                 text: "Item",
                                 linked_location: Some(
-                                    FileRange {
+                                    FileRangeWrapper {
                                         file_id: FileId(
                                             1,
                                         ),
@@ -521,7 +521,7 @@ fn main() {
                             InlayHintLabelPart {
                                 text: "Iterator",
                                 linked_location: Some(
-                                    FileRange {
+                                    FileRangeWrapper {
                                         file_id: FileId(
                                             1,
                                         ),
@@ -534,7 +534,7 @@ fn main() {
                             InlayHintLabelPart {
                                 text: "Item",
                                 linked_location: Some(
-                                    FileRange {
+                                    FileRangeWrapper {
                                         file_id: FileId(
                                             1,
                                         ),
@@ -553,7 +553,7 @@ fn main() {
                             InlayHintLabelPart {
                                 text: "MyIter",
                                 linked_location: Some(
-                                    FileRange {
+                                    FileRangeWrapper {
                                         file_id: FileId(
                                             0,
                                         ),
@@ -601,7 +601,7 @@ fn main() {
                             InlayHintLabelPart {
                                 text: "Struct",
                                 linked_location: Some(
-                                    FileRange {
+                                    FileRangeWrapper {
                                         file_id: FileId(
                                             0,
                                         ),
@@ -620,7 +620,7 @@ fn main() {
                             InlayHintLabelPart {
                                 text: "Struct",
                                 linked_location: Some(
-                                    FileRange {
+                                    FileRangeWrapper {
                                         file_id: FileId(
                                             0,
                                         ),
@@ -639,7 +639,7 @@ fn main() {
                             InlayHintLabelPart {
                                 text: "Struct",
                                 linked_location: Some(
-                                    FileRange {
+                                    FileRangeWrapper {
                                         file_id: FileId(
                                             0,
                                         ),
@@ -657,7 +657,7 @@ fn main() {
                             InlayHintLabelPart {
                                 text: "self",
                                 linked_location: Some(
-                                    FileRange {
+                                    FileRangeWrapper {
                                         file_id: FileId(
                                             0,
                                         ),
diff --git a/editors/code/package.json b/editors/code/package.json
index 9ddfcaa708..0bc6da9dc7 100644
--- a/editors/code/package.json
+++ b/editors/code/package.json
@@ -310,11 +310,6 @@
                 "command": "rust-analyzer.openWalkthrough",
                 "title": "Open Walkthrough",
                 "category": "rust-analyzer"
-            },
-            {
-                "command": "rust-analyzer.openFAQ",
-                "title": "Open FAQ",
-                "category": "rust-analyzer"
             }
         ],
         "keybindings": [

From 7a5bf92b89ade09e8120abe7eeeb975c3112a5c1 Mon Sep 17 00:00:00 2001
From: Lukas Wirth 
Date: Thu, 18 Jul 2024 10:03:19 +0200
Subject: [PATCH 3/7] Rewrite inline parser test infra to generated proper rust
 test cases

---
 crates/parser/src/grammar/items.rs            |   2 +-
 crates/parser/src/grammar/types.rs            |   2 +-
 crates/parser/src/tests.rs                    |  47 +-
 crates/parser/test_data/generated/runner.rs   | 810 ++++++++++++++++++
 ...ual.rast => angled_path_without_qual.rast} |   0
 ...ut_qual.rs => angled_path_without_qual.rs} |   0
 ...mous_static.rast => anonymous_static.rast} |   0
 ...nonymous_static.rs => anonymous_static.rs} |   0
 ...t_recovery.rast => arg_list_recovery.rast} |   0
 ..._list_recovery.rs => arg_list_recovery.rs} |   0
 ...semi.rast => array_type_missing_semi.rast} |   0
 ...ing_semi.rs => array_type_missing_semi.rs} |   0
 ...olon.rast => async_without_semicolon.rast} |   0
 ...emicolon.rs => async_without_semicolon.rs} |   0
 ...comma_after_functional_update_syntax.rast} |   0
 ...> comma_after_functional_update_syntax.rs} |   0
 ...st => crate_visibility_empty_recover.rast} |   0
 ...r.rs => crate_visibility_empty_recover.rs} |   0
 ..._param_slot.rast => empty_param_slot.rast} |   0
 ...mpty_param_slot.rs => empty_param_slot.rs} |   0
 ..._empty_segment.rast => empty_segment.rast} |   0
 ...0015_empty_segment.rs => empty_segment.rs} |   0
 ...n.rast => fn_pointer_type_missing_fn.rast} |   0
 ...ng_fn.rs => fn_pointer_type_missing_fn.rs} |   0
 .../{0035_gen_blocks.rast => gen_blocks.rast} |   0
 .../err/{0035_gen_blocks.rs => gen_blocks.rs} |   0
 .../err/{0036_gen_fn.rast => gen_fn.rast}     |   0
 .../inline/err/{0036_gen_fn.rs => gen_fn.rs}  |   0
 ...ver.rast => generic_arg_list_recover.rast} |   0
 ...recover.rs => generic_arg_list_recover.rs} |   0
 ...r.rast => generic_param_list_recover.rast} |   0
 ...cover.rs => generic_param_list_recover.rs} |   0
 .../{0004_impl_type.rast => impl_type.rast}   |   0
 .../err/{0004_impl_type.rs => impl_type.rs}   |   0
 ...e.rast => let_else_right_curly_brace.rast} |   0
 ...brace.rs => let_else_right_curly_brace.rs} |   0
 ...me.rast => macro_rules_as_macro_name.rast} |   0
 ...o_name.rs => macro_rules_as_macro_name.rs} |   0
 ...recovery.rast => match_arms_recovery.rast} |   0
 ...rms_recovery.rs => match_arms_recovery.rs} |   0
 ...=> method_call_missing_argument_list.rast} |   0
 ...s => method_call_missing_argument_list.rs} |   0
 ...abel_err.rast => misplaced_label_err.rast} |   0
 ...ed_label_err.rs => misplaced_label_err.rs} |   0
 ...m_type.rast => missing_fn_param_type.rast} |   0
 ...param_type.rs => missing_fn_param_type.rs} |   0
 ...y.rast => pointer_type_no_mutability.rast} |   0
 ...ility.rs => pointer_type_no_mutability.rs} |   0
 .../err/{0008_pub_expr.rast => pub_expr.rast} |   0
 .../err/{0008_pub_expr.rs => pub_expr.rs}     |   0
 ...ord_literal_before_ellipsis_recovery.rast} |   0
 ...ecord_literal_before_ellipsis_recovery.rs} |   0
 ... => record_literal_field_eq_recovery.rast} |   0
 ...rs => record_literal_field_eq_recovery.rs} |   0
 ...rd_literal_missing_ellipsis_recovery.rast} |   0
 ...cord_literal_missing_ellipsis_recovery.rs} |   0
 ...rast => record_pat_field_eq_recovery.rast} |   0
 ...ery.rs => record_pat_field_eq_recovery.rs} |   0
 ...over_from_missing_assoc_item_binding.rast} |   0
 ...ecover_from_missing_assoc_item_binding.rs} |   0
 ...> recover_from_missing_const_default.rast} |   0
 ... => recover_from_missing_const_default.rs} |   0
 ...recover.rast => struct_field_recover.rast} |   0
 ...eld_recover.rs => struct_field_recover.rs} |   0
 ..._top_level_let.rast => top_level_let.rast} |   0
 ...0024_top_level_let.rs => top_level_let.rs} |   0
 ...mma.rast => tuple_expr_leading_comma.rast} |   0
 ...g_comma.rs => tuple_expr_leading_comma.rs} |   0
 ...ry.rast => tuple_field_list_recovery.rast} |   0
 ...covery.rs => tuple_field_list_recovery.rs} |   0
 ...omma.rast => tuple_pat_leading_comma.rast} |   0
 ...ng_comma.rs => tuple_pat_leading_comma.rs} |   0
 ...k_in_mod.rast => unsafe_block_in_mod.rast} |   0
 ...block_in_mod.rs => unsafe_block_in_mod.rs} |   0
 ...y.rast => use_tree_list_err_recovery.rast} |   0
 ...overy.rs => use_tree_list_err_recovery.rs} |   0
 .../parser/inline/ok/0083_struct_items.rast   |  87 --
 ...nymous_const.rast => anonymous_const.rast} |   0
 ..._anonymous_const.rs => anonymous_const.rs} |   0
 ...rb_self_types.rast => arb_self_types.rast} |   0
 ...18_arb_self_types.rs => arb_self_types.rs} |   0
 ..._arg_with_attr.rast => arg_with_attr.rast} |   0
 ...0152_arg_with_attr.rs => arg_with_attr.rs} |   0
 ...0150_array_attrs.rast => array_attrs.rast} |   0
 .../{0150_array_attrs.rs => array_attrs.rs}   |   0
 .../{0103_array_expr.rast => array_expr.rast} |   0
 .../ok/{0103_array_expr.rs => array_expr.rs}  |   0
 .../{0017_array_type.rast => array_type.rast} |   0
 .../ok/{0017_array_type.rs => array_type.rs}  |   0
 ..._as_precedence.rast => as_precedence.rast} |   0
 ...0146_as_precedence.rs => as_precedence.rs} |   0
 ...ssoc_const_eq.rast => assoc_const_eq.rast} |   0
 ...00_assoc_const_eq.rs => assoc_const_eq.rs} |   0
 ...oc_item_list.rast => assoc_item_list.rast} |   0
 ..._assoc_item_list.rs => assoc_item_list.rs} |   0
 ....rast => assoc_item_list_inner_attrs.rast} |   0
 ...ttrs.rs => assoc_item_list_inner_attrs.rs} |   0
 ..._type_bound.rast => assoc_type_bound.rast} |   0
 ...ssoc_type_bound.rs => assoc_type_bound.rs} |   0
 ..._assoc_type_eq.rast => assoc_type_eq.rast} |   0
 ...0187_assoc_type_eq.rs => assoc_type_eq.rs} |   0
 ...ast => associated_return_type_bounds.rast} |   0
 ...ds.rs => associated_return_type_bounds.rs} |   0
 ...ounds.rast => associated_type_bounds.rast} |   0
 ...pe_bounds.rs => associated_type_bounds.rs} |   0
 ...rait_bound.rast => async_trait_bound.rast} |   0
 ...nc_trait_bound.rs => async_trait_bound.rs} |   0
 ..._expr_stmt.rast => attr_on_expr_stmt.rast} |   0
 ...r_on_expr_stmt.rs => attr_on_expr_stmt.rs} |   0
 .../{0137_await_expr.rast => await_expr.rast} |   0
 .../ok/{0137_await_expr.rs => await_expr.rs}  |   0
 ...bare_dyn_types_with_leading_lifetime.rast} |   0
 ...> bare_dyn_types_with_leading_lifetime.rs} |   0
 ...dyn_types_with_paren_as_generic_args.rast} |   0
 ...e_dyn_types_with_paren_as_generic_args.rs} |   0
 ...0209_become_expr.rast => become_expr.rast} |   0
 .../{0209_become_expr.rs => become_expr.rs}   |   0
 .../ok/{0112_bind_pat.rast => bind_pat.rast}  |   0
 .../ok/{0112_bind_pat.rs => bind_pat.rs}      |   0
 ...s.rast => binop_resets_statementness.rast} |   0
 ...tness.rs => binop_resets_statementness.rs} |   0
 .../inline/ok/{0075_block.rast => block.rast} |   0
 .../inline/ok/{0075_block.rs => block.rs}     |   0
 ...0044_block_items.rast => block_items.rast} |   0
 .../{0044_block_items.rs => block_items.rs}   |   0
 .../ok/{0143_box_pat.rast => box_pat.rast}    |   0
 .../inline/ok/{0143_box_pat.rs => box_pat.rs} |   0
 ...ak_ambiguity.rast => break_ambiguity.rast} |   0
 ..._break_ambiguity.rs => break_ambiguity.rs} |   0
 .../{0034_break_expr.rast => break_expr.rast} |   0
 .../ok/{0034_break_expr.rs => break_expr.rs}  |   0
 ...07_builtin_expr.rast => builtin_expr.rast} |   0
 .../{0207_builtin_expr.rs => builtin_expr.rs} |   0
 .../{0042_call_expr.rast => call_expr.rast}   |   0
 .../ok/{0042_call_expr.rs => call_expr.rs}    |   0
 .../{0029_cast_expr.rast => cast_expr.rast}   |   0
 .../ok/{0029_cast_expr.rs => cast_expr.rs}    |   0
 ...> closure_body_underscore_assignment.rast} |   0
 ... => closure_body_underscore_assignment.rs} |   0
 ...losure_params.rast => closure_params.rast} |   0
 ...55_closure_params.rs => closure_params.rs} |   0
 ...ll.rast => closure_range_method_call.rast} |   0
 ...d_call.rs => closure_range_method_call.rs} |   0
 .../{0184_const_arg.rast => const_arg.rast}   |   0
 .../ok/{0184_const_arg.rs => const_arg.rs}    |   0
 ...st_arg_block.rast => const_arg_block.rast} |   0
 ..._const_arg_block.rs => const_arg_block.rs} |   0
 ...teral.rast => const_arg_bool_literal.rast} |   0
 ...l_literal.rs => const_arg_bool_literal.rs} |   0
 ...rg_literal.rast => const_arg_literal.rast} |   0
 ...st_arg_literal.rs => const_arg_literal.rs} |   0
 ...er.rast => const_arg_negative_number.rast} |   0
 ...number.rs => const_arg_negative_number.rs} |   0
 ...st_block_pat.rast => const_block_pat.rast} |   0
 ..._const_block_pat.rs => const_block_pat.rs} |   0
 ..._const_closure.rast => const_closure.rast} |   0
 ...0205_const_closure.rs => const_closure.rs} |   0
 .../{0172_const_item.rast => const_item.rast} |   0
 .../ok/{0172_const_item.rs => const_item.rs}  |   0
 ...0147_const_param.rast => const_param.rast} |   0
 .../{0147_const_param.rs => const_param.rs}   |   0
 ...st => const_param_default_expression.rast} |   0
 ...n.rs => const_param_default_expression.rs} |   0
 ....rast => const_param_default_literal.rast} |   0
 ...eral.rs => const_param_default_literal.rs} |   0
 ...ath.rast => const_param_default_path.rast} |   0
 ...lt_path.rs => const_param_default_path.rs} |   0
 ...rait_bound.rast => const_trait_bound.rast} |   0
 ...st_trait_bound.rs => const_trait_bound.rs} |   0
 ..._continue_expr.rast => continue_expr.rast} |   0
 ...0015_continue_expr.rs => continue_expr.rs} |   0
 .../{0067_crate_path.rast => crate_path.rast} |   0
 .../ok/{0067_crate_path.rs => crate_path.rs}  |   0
 ..._visibility.rast => crate_visibility.rast} |   0
 ...rate_visibility.rs => crate_visibility.rs} |   0
 ...ility_in.rast => crate_visibility_in.rast} |   0
 ...isibility_in.rs => crate_visibility_in.rs} |   0
 ...lt_async_fn.rast => default_async_fn.rast} |   0
 ...efault_async_fn.rs => default_async_fn.rs} |   0
 ...e_fn.rast => default_async_unsafe_fn.rast} |   0
 ...nsafe_fn.rs => default_async_unsafe_fn.rs} |   0
 ...64_default_item.rast => default_item.rast} |   0
 .../{0164_default_item.rs => default_item.rs} |   0
 ...afe_item.rast => default_unsafe_item.rast} |   0
 ..._unsafe_item.rs => default_unsafe_item.rs} |   0
 ...uring_assignment_struct_rest_pattern.rast} |   0
 ...cturing_assignment_struct_rest_pattern.rs} |   0
 ...estructuring_assignment_wildcard_pat.rast} |   0
 ... destructuring_assignment_wildcard_pat.rs} |   0
 ...0144_dot_dot_pat.rast => dot_dot_pat.rast} |   0
 .../{0144_dot_dot_pat.rs => dot_dot_pat.rs}   |   0
 ...yn_trait_type.rast => dyn_trait_type.rast} |   0
 ...65_dyn_trait_type.rs => dyn_trait_type.rs} |   0
 ..._effect_blocks.rast => effect_blocks.rast} |   0
 ...0199_effect_blocks.rs => effect_blocks.rs} |   0
 ...ange_pat.rast => exclusive_range_pat.rast} |   0
 ...ve_range_pat.rs => exclusive_range_pat.rs} |   0
 ..._expr_literals.rast => expr_literals.rast} |   0
 ...0085_expr_literals.rs => expr_literals.rs} |   0
 ...block.rast => expression_after_block.rast} |   0
 ...ter_block.rs => expression_after_block.rs} |   0
 ...10_extern_block.rast => extern_block.rast} |   0
 .../{0010_extern_block.rs => extern_block.rs} |   0
 ...60_extern_crate.rast => extern_crate.rast} |   0
 .../{0060_extern_crate.rs => extern_crate.rs} |   0
 ...e_rename.rast => extern_crate_rename.rast} |   0
 ...crate_rename.rs => extern_crate_rename.rs} |   0
 ...crate_self.rast => extern_crate_self.rast} |   0
 ...ern_crate_self.rs => extern_crate_self.rs} |   0
 .../{0011_field_expr.rast => field_expr.rast} |   0
 .../ok/{0011_field_expr.rs => field_expr.rs}  |   0
 .../inline/ok/{0151_fn.rast => fn_.rast}      |   0
 .../parser/inline/ok/{0151_fn.rs => fn_.rs}   |   0
 .../ok/{0050_fn_decl.rast => fn_decl.rast}    |   0
 .../inline/ok/{0050_fn_decl.rs => fn_decl.rs} |   0
 ...56_fn_def_param.rast => fn_def_param.rast} |   0
 .../{0156_fn_def_param.rs => fn_def_param.rs} |   0
 ....rast => fn_pointer_param_ident_path.rast} |   0
 ...path.rs => fn_pointer_param_ident_path.rs} |   0
 ...pointer_type.rast => fn_pointer_type.rast} |   0
 ..._fn_pointer_type.rs => fn_pointer_type.rs} |   0
 ...ret.rast => fn_pointer_type_with_ret.rast} |   0
 ...ith_ret.rs => fn_pointer_type_with_ret.rs} |   0
 ...d_arg.rast => fn_pointer_unnamed_arg.rast} |   0
 ...named_arg.rs => fn_pointer_unnamed_arg.rs} |   0
 .../ok/{0100_for_expr.rast => for_expr.rast}  |   0
 .../ok/{0100_for_expr.rs => for_expr.rs}      |   0
 ...or_range_from.rast => for_range_from.rast} |   0
 ...42_for_range_from.rs => for_range_from.rs} |   0
 .../ok/{0081_for_type.rast => for_type.rast}  |   0
 .../ok/{0081_for_type.rs => for_type.rs}      |   0
 ...l_range_expr.rast => full_range_expr.rast} |   0
 ..._full_range_expr.rs => full_range_expr.rs} |   0
 ...n_ret_type.rast => function_ret_type.rast} |   0
 ...ction_ret_type.rs => function_ret_type.rs} |   0
 ..._params.rast => function_type_params.rast} |   0
 ...type_params.rs => function_type_params.rs} |   0
 ...clause.rast => function_where_clause.rast} |   0
 ...ere_clause.rs => function_where_clause.rs} |   0
 ...0190_generic_arg.rast => generic_arg.rast} |   0
 .../{0190_generic_arg.rs => generic_arg.rs}   |   0
 ...bute.rast => generic_param_attribute.rast} |   0
 ...ttribute.rs => generic_param_attribute.rs} |   0
 ...ype_param.rast => generic_param_list.rast} |   0
 ...83_type_param.rs => generic_param_list.rs} |   0
 ...ange_pat.rast => half_open_range_pat.rast} |   0
 ...en_range_pat.rs => half_open_range_pat.rs} |   0
 .../ok/{0064_if_expr.rast => if_expr.rast}    |   0
 .../inline/ok/{0064_if_expr.rs => if_expr.rs} |   0
 .../{0079_impl_item.rast => impl_item.rast}   |   0
 .../ok/{0079_impl_item.rs => impl_item.rs}    |   0
 ...l_item_const.rast => impl_item_const.rast} |   0
 ..._impl_item_const.rs => impl_item_const.rs} |   0
 ..._impl_item_neg.rast => impl_item_neg.rast} |   0
 ...0063_impl_item_neg.rs => impl_item_neg.rs} |   0
 ...l_trait_type.rast => impl_trait_type.rast} |   0
 ..._impl_trait_type.rs => impl_trait_type.rs} |   0
 ...type_params.rast => impl_type_params.rast} |   0
 ...mpl_type_params.rs => impl_type_params.rs} |   0
 .../{0093_index_expr.rast => index_expr.rast} |   0
 .../ok/{0093_index_expr.rs => index_expr.rs}  |   0
 .../inline/ok/{0109_label.rast => label.rast} |   0
 .../inline/ok/{0109_label.rs => label.rs}     |   0
 ..._labeled_block.rast => labeled_block.rast} |   0
 ...0161_labeled_block.rs => labeled_block.rs} |   0
 ...0106_lambda_expr.rast => lambda_expr.rast} |   0
 .../{0106_lambda_expr.rs => lambda_expr.rs}   |   0
 ...a_ret_block.rast => lambda_ret_block.rast} |   0
 ...ambda_ret_block.rs => lambda_ret_block.rs} |   0
 .../ok/{0194_let_else.rast => let_else.rast}  |   0
 .../ok/{0194_let_else.rs => let_else.rs}      |   0
 .../ok/{0030_let_expr.rast => let_expr.rast}  |   0
 .../ok/{0030_let_expr.rs => let_expr.rs}      |   0
 .../ok/{0130_let_stmt.rast => let_stmt.rast}  |   0
 .../ok/{0130_let_stmt.rs => let_stmt.rs}      |   0
 ...cription.rast => let_stmt_ascription.rast} |   0
 ...t_ascription.rs => let_stmt_ascription.rs} |   0
 ..._let_stmt_init.rast => let_stmt_init.rast} |   0
 ...0193_let_stmt_init.rs => let_stmt_init.rs} |   0
 ...86_lifetime_arg.rast => lifetime_arg.rast} |   0
 .../{0186_lifetime_arg.rs => lifetime_arg.rs} |   0
 ...ifetime_param.rast => lifetime_param.rast} |   0
 ...82_lifetime_param.rs => lifetime_param.rs} |   0
 ...eral_pattern.rast => literal_pattern.rast} |   0
 ..._literal_pattern.rs => literal_pattern.rs} |   0
 .../{0009_loop_expr.rast => loop_expr.rast}   |   0
 .../ok/{0009_loop_expr.rs => loop_expr.rs}    |   0
 ...ro_call_type.rast => macro_call_type.rast} |   0
 ..._macro_call_type.rs => macro_call_type.rs} |   0
 .../{0147_macro_def.rast => macro_def.rast}   |   0
 .../ok/{0147_macro_def.rs => macro_def.rs}    |   0
 ...ro_def_curly.rast => macro_def_curly.rast} |   0
 ..._macro_def_curly.rs => macro_def_curly.rs} |   0
 ...arg.rast => macro_inside_generic_arg.rast} |   0
 ...ric_arg.rs => macro_inside_generic_arg.rs} |   0
 ...me.rast => macro_rules_as_macro_name.rast} |   0
 ...o_name.rs => macro_rules_as_macro_name.rs} |   0
 ..._brace.rast => macro_rules_non_brace.rast} |   0
 ..._non_brace.rs => macro_rules_non_brace.rs} |   0
 .../{0129_marco_pat.rast => marco_pat.rast}   |   0
 .../ok/{0129_marco_pat.rs => marco_pat.rs}    |   0
 .../{0066_match_arm.rast => match_arm.rast}   |   0
 .../ok/{0066_match_arm.rs => match_arm.rs}    |   0
 ...rms_commas.rast => match_arms_commas.rast} |   0
 ...ch_arms_commas.rs => match_arms_commas.rs} |   0
 ...e.rast => match_arms_inner_attribute.rast} |   0
 ...ibute.rs => match_arms_inner_attribute.rs} |   0
 ....rast => match_arms_outer_attributes.rast} |   0
 ...utes.rs => match_arms_outer_attributes.rs} |   0
 .../{0071_match_expr.rast => match_expr.rast} |   0
 .../ok/{0071_match_expr.rs => match_expr.rs}  |   0
 ...0118_match_guard.rast => match_guard.rast} |   0
 .../{0118_match_guard.rs => match_guard.rs}   |   0
 .../inline/ok/{0213_metas.rast => metas.rast} |   0
 .../inline/ok/{0213_metas.rs => metas.rs}     |   0
 ...d_call_expr.rast => method_call_expr.rast} |   0
 ...ethod_call_expr.rs => method_call_expr.rs} |   0
 ...62_mod_contents.rast => mod_contents.rast} |   0
 .../{0062_mod_contents.rs => mod_contents.rs} |   0
 .../ok/{0169_mod_item.rast => mod_item.rast}  |   0
 .../ok/{0169_mod_item.rs => mod_item.rs}      |   0
 ...od_item_curly.rast => mod_item_curly.rast} |   0
 ...70_mod_item_curly.rs => mod_item_curly.rs} |   0
 .../{0014_never_type.rast => never_type.rast} |   0
 .../ok/{0014_never_type.rs => never_type.rs}  |   0
 ...for.rast => no_dyn_trait_leading_for.rast} |   0
 ...ing_for.rs => no_dyn_trait_leading_for.rs} |   0
 ...er_block.rast => no_semi_after_block.rast} |   0
 ..._after_block.rs => no_semi_after_block.rs} |   0
 ..._nocontentexpr.rast => nocontentexpr.rast} |   0
 ...0113_nocontentexpr.rs => nocontentexpr.rs} |   0
 ...tem.rast => nocontentexpr_after_item.rast} |   0
 ...er_item.rs => nocontentexpr_after_item.rs} |   0
 .../{0156_or_pattern.rast => or_pattern.rast} |   0
 .../ok/{0156_or_pattern.rs => or_pattern.rs}  |   0
 .../{0099_param_list.rast => param_list.rast} |   0
 .../ok/{0099_param_list.rs => param_list.rs}  |   0
 ...erns.rast => param_list_opt_patterns.rast} |   0
 ...patterns.rs => param_list_opt_patterns.rs} |   0
 ...ist_vararg.rast => param_list_vararg.rast} |   0
 ...am_list_vararg.rs => param_list_vararg.rs} |   0
 ...am_outer_arg.rast => param_outer_arg.rast} |   0
 ..._param_outer_arg.rs => param_outer_arg.rs} |   0
 .../{0084_paren_type.rast => paren_type.rast} |   0
 .../ok/{0084_paren_type.rs => paren_type.rs}  |   0
 .../{0053_path_expr.rast => path_expr.rast}   |   0
 .../ok/{0053_path_expr.rs => path_expr.rs}    |   0
 ...rait_args.rast => path_fn_trait_args.rast} |   0
 ...fn_trait_args.rs => path_fn_trait_args.rs} |   0
 .../{0008_path_part.rast => path_part.rast}   |   0
 .../ok/{0008_path_part.rs => path_part.rs}    |   0
 .../{0052_path_type.rast => path_type.rast}   |   0
 .../ok/{0052_path_type.rs => path_type.rs}    |   0
 ...bounds.rast => path_type_with_bounds.rast} |   0
 ...ith_bounds.rs => path_type_with_bounds.rs} |   0
 ...ceholder_pat.rast => placeholder_pat.rast} |   0
 ..._placeholder_pat.rs => placeholder_pat.rs} |   0
 ...holder_type.rast => placeholder_type.rast} |   0
 ...laceholder_type.rs => placeholder_type.rs} |   0
 ...er_type_mut.rast => pointer_type_mut.rast} |   0
 ...ointer_type_mut.rs => pointer_type_mut.rs} |   0
 ..._postfix_range.rast => postfix_range.rast} |   0
 ...0080_postfix_range.rs => postfix_range.rs} |   0
 ...typepath.rast => pub_parens_typepath.rast} |   0
 ...ens_typepath.rs => pub_parens_typepath.rs} |   0
 ..._tuple_field.rast => pub_tuple_field.rast} |   0
 ..._pub_tuple_field.rs => pub_tuple_field.rs} |   0
 .../{0037_qual_paths.rast => qual_paths.rast} |   0
 .../ok/{0037_qual_paths.rs => qual_paths.rs}  |   0
 ...ast => question_for_type_trait_bound.rast} |   0
 ...nd.rs => question_for_type_trait_bound.rs} |   0
 .../{0058_range_pat.rast => range_pat.rast}   |   0
 .../ok/{0058_range_pat.rs => range_pat.rs}    |   0
 ...eld_attrs.rast => record_field_attrs.rast} |   0
 ...d_field_attrs.rs => record_field_attrs.rs} |   0
 ...field_list.rast => record_field_list.rast} |   0
 ...ord_field_list.rs => record_field_list.rs} |   0
 .../{0061_record_lit.rast => record_lit.rast} |   0
 .../ok/{0061_record_lit.rs => record_lit.rs}  |   0
 ...st => record_literal_field_with_attr.rast} |   0
 ...r.rs => record_literal_field_with_attr.rs} |   0
 ...d_pat_field.rast => record_pat_field.rast} |   0
 ...ecord_pat_field.rs => record_pat_field.rs} |   0
 ...d_list.rast => record_pat_field_list.rast} |   0
 ...field_list.rs => record_pat_field_list.rs} |   0
 .../ok/{0082_ref_expr.rast => ref_expr.rast}  |   0
 .../ok/{0082_ref_expr.rs => ref_expr.rs}      |   0
 .../ok/{0027_ref_pat.rast => ref_pat.rast}    |   0
 .../inline/ok/{0027_ref_pat.rs => ref_pat.rs} |   0
 ...ference_type;.rast => reference_type.rast} |   0
 ...3_reference_type;.rs => reference_type.rs} |   0
 ...0072_return_expr.rast => return_expr.rast} |   0
 .../{0072_return_expr.rs => return_expr.rs}   |   0
 .../{0006_self_param.rast => self_param.rast} |   0
 .../ok/{0006_self_param.rs => self_param.rs}  |   0
 ...r_attr.rast => self_param_outer_attr.rast} |   0
 ...outer_attr.rs => self_param_outer_attr.rs} |   0
 ...le_type.rast => singleton_tuple_type.rast} |   0
 ..._tuple_type.rs => singleton_tuple_type.rs} |   0
 .../{0024_slice_pat.rast => slice_pat.rast}   |   0
 .../ok/{0024_slice_pat.rs => slice_pat.rs}    |   0
 .../{0025_slice_type.rast => slice_type.rast} |   0
 .../ok/{0025_slice_type.rs => slice_type.rs}  |   0
 ...uity.rast => stmt_bin_expr_ambiguity.rast} |   0
 ...mbiguity.rs => stmt_bin_expr_ambiguity.rs} |   0
 ....rast => stmt_postfix_expr_ambiguity.rast} |   0
 ...uity.rs => stmt_postfix_expr_ambiguity.rs} |   0
 ...0171_struct_item.rast => struct_item.rast} |   0
 .../{0171_struct_item.rs => struct_item.rs}   |   0
 ...0151_trait_alias.rast => trait_alias.rast} |   0
 .../{0151_trait_alias.rs => trait_alias.rs}   |   0
 ...use.rast => trait_alias_where_clause.rast} |   0
 ..._clause.rs => trait_alias_where_clause.rs} |   0
 .../{0041_trait_item.rast => trait_item.rast} |   0
 .../ok/{0041_trait_item.rs => trait_item.rs}  |   0
 ...tem_bounds.rast => trait_item_bounds.rast} |   0
 ...it_item_bounds.rs => trait_item_bounds.rs} |   0
 ...ms.rast => trait_item_generic_params.rast} |   0
 ...params.rs => trait_item_generic_params.rs} |   0
 ...ause.rast => trait_item_where_clause.rast} |   0
 ...e_clause.rs => trait_item_where_clause.rs} |   0
 ...ry_block_expr.rast => try_block_expr.rast} |   0
 ...30_try_block_expr.rs => try_block_expr.rs} |   0
 .../ok/{0077_try_expr.rast => try_expr.rast}  |   0
 .../ok/{0077_try_expr.rs => try_expr.rs}      |   0
 ..._fallback.rast => try_macro_fallback.rast} |   0
 ...acro_fallback.rs => try_macro_fallback.rs} |   0
 ..._macro_rules.rast => try_macro_rules.rast} |   0
 ..._try_macro_rules.rs => try_macro_rules.rs} |   0
 ...0154_tuple_attrs.rast => tuple_attrs.rast} |   0
 .../{0154_tuple_attrs.rs => tuple_attrs.rs}   |   0
 .../{0108_tuple_expr.rast => tuple_expr.rast} |   0
 .../ok/{0108_tuple_expr.rs => tuple_expr.rs}  |   0
 ...ield_attrs.rast => tuple_field_attrs.rast} |   0
 ...le_field_attrs.rs => tuple_field_attrs.rs} |   0
 .../{0111_tuple_pat.rast => tuple_pat.rast}   |   0
 .../ok/{0111_tuple_pat.rs => tuple_pat.rs}    |   0
 ..._pat_fields.rast => tuple_pat_fields.rast} |   0
 ...uple_pat_fields.rs => tuple_pat_fields.rs} |   0
 ...70_tuple_struct.rast => tuple_struct.rast} |   0
 .../{0170_tuple_struct.rs => tuple_struct.rs} |   0
 ...uct_where.rast => tuple_struct_where.rast} |   0
 ..._struct_where.rs => tuple_struct_where.rs} |   0
 .../{0078_type_alias.rast => type_alias.rast} |   0
 .../ok/{0078_type_alias.rs => type_alias.rs}  |   0
 ...params.rast => type_item_type_params.rast} |   0
 ...ype_params.rs => type_item_type_params.rs} |   0
 ...lause.rast => type_item_where_clause.rast} |   0
 ...re_clause.rs => type_item_where_clause.rs} |   0
 ...=> type_item_where_clause_deprecated.rast} |   0
 ...s => type_item_where_clause_deprecated.rs} |   0
 ...eneric_param_list.rast => type_param.rast} |   0
 ...84_generic_param_list.rs => type_param.rs} |   0
 ...ram_bounds.rast => type_param_bounds.rast} |   0
 ...e_param_bounds.rs => type_param_bounds.rs} |   0
 ...m_default.rast => type_param_default.rast} |   0
 ...param_default.rs => type_param_default.rs} |   0
 ...pattern.rast => type_path_in_pattern.rast} |   0
 ..._in_pattern.rs => type_path_in_pattern.rs} |   0
 ...n.rast => typepathfn_with_coloncolon.rast} |   0
 ...colon.rs => typepathfn_with_coloncolon.rs} |   0
 .../{0019_unary_expr.rast => unary_expr.rast} |   0
 .../ok/{0019_unary_expr.rs => unary_expr.rs}  |   0
 .../{0173_union_item.rast => union_item.rast} |   0
 .../ok/{0173_union_item.rs => union_item.rs}  |   0
 ...0174_unit_struct.rast => unit_struct.rast} |   0
 .../{0174_unit_struct.rs => unit_struct.rs}   |   0
 .../{0051_unit_type.rast => unit_type.rast}   |   0
 .../ok/{0051_unit_type.rs => unit_type.rs}    |   0
 .../ok/{0181_use_item.rast => use_item.rast}  |   0
 .../ok/{0181_use_item.rs => use_item.rs}      |   0
 .../ok/{0177_use_tree.rast => use_tree.rast}  |   0
 .../ok/{0177_use_tree.rs => use_tree.rs}      |   0
 ...e_abs_star.rast => use_tree_abs_star.rast} |   0
 ..._tree_abs_star.rs => use_tree_abs_star.rs} |   0
 ...se_tree_alias.rast => use_tree_alias.rast} |   0
 ...76_use_tree_alias.rs => use_tree_alias.rs} |   0
 ..._use_tree_list.rast => use_tree_list.rast} |   0
 ...0002_use_tree_list.rs => use_tree_list.rs} |   0
 ..._use_tree_path.rast => use_tree_path.rast} |   0
 ...0177_use_tree_path.rs => use_tree_path.rs} |   0
 ...path_star.rast => use_tree_path_star.rast} |   0
 ...ree_path_star.rs => use_tree_path_star.rs} |   0
 ..._tree.rast => use_tree_path_use_tree.rast} |   0
 ..._use_tree.rs => use_tree_path_use_tree.rs} |   0
 ..._use_tree_star.rast => use_tree_star.rast} |   0
 ...0174_use_tree_star.rs => use_tree_star.rs} |   0
 ...rast => value_parameters_no_patterns.rast} |   0
 ...rns.rs => value_parameters_no_patterns.rs} |   0
 ...iminant.rast => variant_discriminant.rast} |   0
 ...iscriminant.rs => variant_discriminant.rs} |   0
 ...56_where_clause.rast => where_clause.rast} |   0
 .../{0056_where_clause.rs => where_clause.rs} |   0
 ...here_pred_for.rast => where_pred_for.rast} |   0
 ...03_where_pred_for.rs => where_pred_for.rs} |   0
 .../{0031_while_expr.rast => while_expr.rast} |   0
 .../ok/{0031_while_expr.rs => while_expr.rs}  |   0
 .../{0204_yeet_expr.rast => yeet_expr.rast}   |   0
 .../ok/{0204_yeet_expr.rs => yeet_expr.rs}    |   0
 .../{0159_yield_expr.rast => yield_expr.rast} |   0
 .../ok/{0159_yield_expr.rs => yield_expr.rs}  |   0
 xtask/src/codegen.rs                          |   5 +-
 xtask/src/codegen/parser_inline_tests.rs      | 165 ++--
 503 files changed, 955 insertions(+), 163 deletions(-)
 create mode 100644 crates/parser/test_data/generated/runner.rs
 rename crates/parser/test_data/parser/inline/err/{0016_angled_path_without_qual.rast => angled_path_without_qual.rast} (100%)
 rename crates/parser/test_data/parser/inline/err/{0016_angled_path_without_qual.rs => angled_path_without_qual.rs} (100%)
 rename crates/parser/test_data/parser/inline/err/{0013_anonymous_static.rast => anonymous_static.rast} (100%)
 rename crates/parser/test_data/parser/inline/err/{0013_anonymous_static.rs => anonymous_static.rs} (100%)
 rename crates/parser/test_data/parser/inline/err/{0015_arg_list_recovery.rast => arg_list_recovery.rast} (100%)
 rename crates/parser/test_data/parser/inline/err/{0015_arg_list_recovery.rs => arg_list_recovery.rs} (100%)
 rename crates/parser/test_data/parser/inline/err/{0001_array_type_missing_semi.rast => array_type_missing_semi.rast} (100%)
 rename crates/parser/test_data/parser/inline/err/{0001_array_type_missing_semi.rs => array_type_missing_semi.rs} (100%)
 rename crates/parser/test_data/parser/inline/err/{0007_async_without_semicolon.rast => async_without_semicolon.rast} (100%)
 rename crates/parser/test_data/parser/inline/err/{0007_async_without_semicolon.rs => async_without_semicolon.rs} (100%)
 rename crates/parser/test_data/parser/inline/err/{0024_comma_after_functional_update_syntax.rast => comma_after_functional_update_syntax.rast} (100%)
 rename crates/parser/test_data/parser/inline/err/{0024_comma_after_functional_update_syntax.rs => comma_after_functional_update_syntax.rs} (100%)
 rename crates/parser/test_data/parser/inline/err/{0018_crate_visibility_empty_recover.rast => crate_visibility_empty_recover.rast} (100%)
 rename crates/parser/test_data/parser/inline/err/{0018_crate_visibility_empty_recover.rs => crate_visibility_empty_recover.rs} (100%)
 rename crates/parser/test_data/parser/inline/err/{0023_empty_param_slot.rast => empty_param_slot.rast} (100%)
 rename crates/parser/test_data/parser/inline/err/{0023_empty_param_slot.rs => empty_param_slot.rs} (100%)
 rename crates/parser/test_data/parser/inline/err/{0015_empty_segment.rast => empty_segment.rast} (100%)
 rename crates/parser/test_data/parser/inline/err/{0015_empty_segment.rs => empty_segment.rs} (100%)
 rename crates/parser/test_data/parser/inline/err/{0005_fn_pointer_type_missing_fn.rast => fn_pointer_type_missing_fn.rast} (100%)
 rename crates/parser/test_data/parser/inline/err/{0005_fn_pointer_type_missing_fn.rs => fn_pointer_type_missing_fn.rs} (100%)
 rename crates/parser/test_data/parser/inline/err/{0035_gen_blocks.rast => gen_blocks.rast} (100%)
 rename crates/parser/test_data/parser/inline/err/{0035_gen_blocks.rs => gen_blocks.rs} (100%)
 rename crates/parser/test_data/parser/inline/err/{0036_gen_fn.rast => gen_fn.rast} (100%)
 rename crates/parser/test_data/parser/inline/err/{0036_gen_fn.rs => gen_fn.rs} (100%)
 rename crates/parser/test_data/parser/inline/err/{0030_generic_arg_list_recover.rast => generic_arg_list_recover.rast} (100%)
 rename crates/parser/test_data/parser/inline/err/{0030_generic_arg_list_recover.rs => generic_arg_list_recover.rs} (100%)
 rename crates/parser/test_data/parser/inline/err/{0031_generic_param_list_recover.rast => generic_param_list_recover.rast} (100%)
 rename crates/parser/test_data/parser/inline/err/{0031_generic_param_list_recover.rs => generic_param_list_recover.rs} (100%)
 rename crates/parser/test_data/parser/inline/err/{0004_impl_type.rast => impl_type.rast} (100%)
 rename crates/parser/test_data/parser/inline/err/{0004_impl_type.rs => impl_type.rs} (100%)
 rename crates/parser/test_data/parser/inline/err/{0017_let_else_right_curly_brace.rast => let_else_right_curly_brace.rast} (100%)
 rename crates/parser/test_data/parser/inline/err/{0017_let_else_right_curly_brace.rs => let_else_right_curly_brace.rs} (100%)
 rename crates/parser/test_data/parser/inline/err/{0026_macro_rules_as_macro_name.rast => macro_rules_as_macro_name.rast} (100%)
 rename crates/parser/test_data/parser/inline/err/{0026_macro_rules_as_macro_name.rs => macro_rules_as_macro_name.rs} (100%)
 rename crates/parser/test_data/parser/inline/err/{0034_match_arms_recovery.rast => match_arms_recovery.rast} (100%)
 rename crates/parser/test_data/parser/inline/err/{0034_match_arms_recovery.rs => match_arms_recovery.rs} (100%)
 rename crates/parser/test_data/parser/inline/err/{0028_method_call_missing_argument_list.rast => method_call_missing_argument_list.rast} (100%)
 rename crates/parser/test_data/parser/inline/err/{0028_method_call_missing_argument_list.rs => method_call_missing_argument_list.rs} (100%)
 rename crates/parser/test_data/parser/inline/err/{0002_misplaced_label_err.rast => misplaced_label_err.rast} (100%)
 rename crates/parser/test_data/parser/inline/err/{0002_misplaced_label_err.rs => misplaced_label_err.rs} (100%)
 rename crates/parser/test_data/parser/inline/err/{0015_missing_fn_param_type.rast => missing_fn_param_type.rast} (100%)
 rename crates/parser/test_data/parser/inline/err/{0015_missing_fn_param_type.rs => missing_fn_param_type.rs} (100%)
 rename crates/parser/test_data/parser/inline/err/{0003_pointer_type_no_mutability.rast => pointer_type_no_mutability.rast} (100%)
 rename crates/parser/test_data/parser/inline/err/{0003_pointer_type_no_mutability.rs => pointer_type_no_mutability.rs} (100%)
 rename crates/parser/test_data/parser/inline/err/{0008_pub_expr.rast => pub_expr.rast} (100%)
 rename crates/parser/test_data/parser/inline/err/{0008_pub_expr.rs => pub_expr.rs} (100%)
 rename crates/parser/test_data/parser/inline/err/{0014_record_literal_before_ellipsis_recovery.rast => record_literal_before_ellipsis_recovery.rast} (100%)
 rename crates/parser/test_data/parser/inline/err/{0014_record_literal_before_ellipsis_recovery.rs => record_literal_before_ellipsis_recovery.rs} (100%)
 rename crates/parser/test_data/parser/inline/err/{0032_record_literal_field_eq_recovery.rast => record_literal_field_eq_recovery.rast} (100%)
 rename crates/parser/test_data/parser/inline/err/{0032_record_literal_field_eq_recovery.rs => record_literal_field_eq_recovery.rs} (100%)
 rename crates/parser/test_data/parser/inline/err/{0014_record_literal_missing_ellipsis_recovery.rast => record_literal_missing_ellipsis_recovery.rast} (100%)
 rename crates/parser/test_data/parser/inline/err/{0014_record_literal_missing_ellipsis_recovery.rs => record_literal_missing_ellipsis_recovery.rs} (100%)
 rename crates/parser/test_data/parser/inline/err/{0033_record_pat_field_eq_recovery.rast => record_pat_field_eq_recovery.rast} (100%)
 rename crates/parser/test_data/parser/inline/err/{0033_record_pat_field_eq_recovery.rs => record_pat_field_eq_recovery.rs} (100%)
 rename crates/parser/test_data/parser/inline/err/{0021_recover_from_missing_assoc_item_binding.rast => recover_from_missing_assoc_item_binding.rast} (100%)
 rename crates/parser/test_data/parser/inline/err/{0021_recover_from_missing_assoc_item_binding.rs => recover_from_missing_assoc_item_binding.rs} (100%)
 rename crates/parser/test_data/parser/inline/err/{0022_recover_from_missing_const_default.rast => recover_from_missing_const_default.rast} (100%)
 rename crates/parser/test_data/parser/inline/err/{0022_recover_from_missing_const_default.rs => recover_from_missing_const_default.rs} (100%)
 rename crates/parser/test_data/parser/inline/err/{0014_struct_field_recover.rast => struct_field_recover.rast} (100%)
 rename crates/parser/test_data/parser/inline/err/{0014_struct_field_recover.rs => struct_field_recover.rs} (100%)
 rename crates/parser/test_data/parser/inline/err/{0024_top_level_let.rast => top_level_let.rast} (100%)
 rename crates/parser/test_data/parser/inline/err/{0024_top_level_let.rs => top_level_let.rs} (100%)
 rename crates/parser/test_data/parser/inline/err/{0019_tuple_expr_leading_comma.rast => tuple_expr_leading_comma.rast} (100%)
 rename crates/parser/test_data/parser/inline/err/{0019_tuple_expr_leading_comma.rs => tuple_expr_leading_comma.rs} (100%)
 rename crates/parser/test_data/parser/inline/err/{0029_tuple_field_list_recovery.rast => tuple_field_list_recovery.rast} (100%)
 rename crates/parser/test_data/parser/inline/err/{0029_tuple_field_list_recovery.rs => tuple_field_list_recovery.rs} (100%)
 rename crates/parser/test_data/parser/inline/err/{0020_tuple_pat_leading_comma.rast => tuple_pat_leading_comma.rast} (100%)
 rename crates/parser/test_data/parser/inline/err/{0020_tuple_pat_leading_comma.rs => tuple_pat_leading_comma.rs} (100%)
 rename crates/parser/test_data/parser/inline/err/{0006_unsafe_block_in_mod.rast => unsafe_block_in_mod.rast} (100%)
 rename crates/parser/test_data/parser/inline/err/{0006_unsafe_block_in_mod.rs => unsafe_block_in_mod.rs} (100%)
 rename crates/parser/test_data/parser/inline/err/{0026_use_tree_list_err_recovery.rast => use_tree_list_err_recovery.rast} (100%)
 rename crates/parser/test_data/parser/inline/err/{0026_use_tree_list_err_recovery.rs => use_tree_list_err_recovery.rs} (100%)
 delete mode 100644 crates/parser/test_data/parser/inline/ok/0083_struct_items.rast
 rename crates/parser/test_data/parser/inline/ok/{0173_anonymous_const.rast => anonymous_const.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0173_anonymous_const.rs => anonymous_const.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0018_arb_self_types.rast => arb_self_types.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0018_arb_self_types.rs => arb_self_types.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0152_arg_with_attr.rast => arg_with_attr.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0152_arg_with_attr.rs => arg_with_attr.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0150_array_attrs.rast => array_attrs.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0150_array_attrs.rs => array_attrs.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0103_array_expr.rast => array_expr.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0103_array_expr.rs => array_expr.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0017_array_type.rast => array_type.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0017_array_type.rs => array_type.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0146_as_precedence.rast => as_precedence.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0146_as_precedence.rs => as_precedence.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0200_assoc_const_eq.rast => assoc_const_eq.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0200_assoc_const_eq.rs => assoc_const_eq.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0021_assoc_item_list.rast => assoc_item_list.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0021_assoc_item_list.rs => assoc_item_list.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0177_assoc_item_list_inner_attrs.rast => assoc_item_list_inner_attrs.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0177_assoc_item_list_inner_attrs.rs => assoc_item_list_inner_attrs.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0185_assoc_type_bound.rast => assoc_type_bound.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0185_assoc_type_bound.rs => assoc_type_bound.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0187_assoc_type_eq.rast => assoc_type_eq.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0187_assoc_type_eq.rs => assoc_type_eq.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0208_associated_return_type_bounds.rast => associated_return_type_bounds.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0208_associated_return_type_bounds.rs => associated_return_type_bounds.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0138_associated_type_bounds.rast => associated_type_bounds.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0138_associated_type_bounds.rs => associated_type_bounds.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0211_async_trait_bound.rast => async_trait_bound.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0211_async_trait_bound.rs => async_trait_bound.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0126_attr_on_expr_stmt.rast => attr_on_expr_stmt.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0126_attr_on_expr_stmt.rs => attr_on_expr_stmt.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0137_await_expr.rast => await_expr.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0137_await_expr.rs => await_expr.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0208_bare_dyn_types_with_leading_lifetime.rast => bare_dyn_types_with_leading_lifetime.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0208_bare_dyn_types_with_leading_lifetime.rs => bare_dyn_types_with_leading_lifetime.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0209_bare_dyn_types_with_paren_as_generic_args.rast => bare_dyn_types_with_paren_as_generic_args.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0209_bare_dyn_types_with_paren_as_generic_args.rs => bare_dyn_types_with_paren_as_generic_args.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0209_become_expr.rast => become_expr.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0209_become_expr.rs => become_expr.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0112_bind_pat.rast => bind_pat.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0112_bind_pat.rs => bind_pat.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0158_binop_resets_statementness.rast => binop_resets_statementness.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0158_binop_resets_statementness.rs => binop_resets_statementness.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0075_block.rast => block.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0075_block.rs => block.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0044_block_items.rast => block_items.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0044_block_items.rs => block_items.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0143_box_pat.rast => box_pat.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0143_box_pat.rs => box_pat.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0088_break_ambiguity.rast => break_ambiguity.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0088_break_ambiguity.rs => break_ambiguity.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0034_break_expr.rast => break_expr.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0034_break_expr.rs => break_expr.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0207_builtin_expr.rast => builtin_expr.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0207_builtin_expr.rs => builtin_expr.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0042_call_expr.rast => call_expr.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0042_call_expr.rs => call_expr.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0029_cast_expr.rast => cast_expr.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0029_cast_expr.rs => cast_expr.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0203_closure_body_underscore_assignment.rast => closure_body_underscore_assignment.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0203_closure_body_underscore_assignment.rs => closure_body_underscore_assignment.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0155_closure_params.rast => closure_params.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0155_closure_params.rs => closure_params.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0208_closure_range_method_call.rast => closure_range_method_call.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0208_closure_range_method_call.rs => closure_range_method_call.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0184_const_arg.rast => const_arg.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0184_const_arg.rs => const_arg.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0183_const_arg_block.rast => const_arg_block.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0183_const_arg_block.rs => const_arg_block.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0192_const_arg_bool_literal.rast => const_arg_bool_literal.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0192_const_arg_bool_literal.rs => const_arg_bool_literal.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0189_const_arg_literal.rast => const_arg_literal.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0189_const_arg_literal.rs => const_arg_literal.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0191_const_arg_negative_number.rast => const_arg_negative_number.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0191_const_arg_negative_number.rs => const_arg_negative_number.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0156_const_block_pat.rast => const_block_pat.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0156_const_block_pat.rs => const_block_pat.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0205_const_closure.rast => const_closure.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0205_const_closure.rs => const_closure.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0172_const_item.rast => const_item.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0172_const_item.rs => const_item.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0147_const_param.rast => const_param.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0147_const_param.rs => const_param.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0199_const_param_default_expression.rast => const_param_default_expression.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0199_const_param_default_expression.rs => const_param_default_expression.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0200_const_param_default_literal.rast => const_param_default_literal.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0200_const_param_default_literal.rs => const_param_default_literal.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0188_const_param_default_path.rast => const_param_default_path.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0188_const_param_default_path.rs => const_param_default_path.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0212_const_trait_bound.rast => const_trait_bound.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0212_const_trait_bound.rs => const_trait_bound.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0015_continue_expr.rast => continue_expr.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0015_continue_expr.rs => continue_expr.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0067_crate_path.rast => crate_path.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0067_crate_path.rs => crate_path.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0022_crate_visibility.rast => crate_visibility.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0022_crate_visibility.rs => crate_visibility.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0160_crate_visibility_in.rast => crate_visibility_in.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0160_crate_visibility_in.rs => crate_visibility_in.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0163_default_async_fn.rast => default_async_fn.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0163_default_async_fn.rs => default_async_fn.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0162_default_async_unsafe_fn.rast => default_async_unsafe_fn.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0162_default_async_unsafe_fn.rs => default_async_unsafe_fn.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0164_default_item.rast => default_item.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0164_default_item.rs => default_item.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0163_default_unsafe_item.rast => default_unsafe_item.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0163_default_unsafe_item.rs => default_unsafe_item.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0197_destructuring_assignment_struct_rest_pattern.rast => destructuring_assignment_struct_rest_pattern.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0197_destructuring_assignment_struct_rest_pattern.rs => destructuring_assignment_struct_rest_pattern.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0198_destructuring_assignment_wildcard_pat.rast => destructuring_assignment_wildcard_pat.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0198_destructuring_assignment_wildcard_pat.rs => destructuring_assignment_wildcard_pat.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0144_dot_dot_pat.rast => dot_dot_pat.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0144_dot_dot_pat.rs => dot_dot_pat.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0065_dyn_trait_type.rast => dyn_trait_type.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0065_dyn_trait_type.rs => dyn_trait_type.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0199_effect_blocks.rast => effect_blocks.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0199_effect_blocks.rs => effect_blocks.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0207_exclusive_range_pat.rast => exclusive_range_pat.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0207_exclusive_range_pat.rs => exclusive_range_pat.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0085_expr_literals.rast => expr_literals.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0085_expr_literals.rs => expr_literals.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0138_expression_after_block.rast => expression_after_block.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0138_expression_after_block.rs => expression_after_block.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0010_extern_block.rast => extern_block.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0010_extern_block.rs => extern_block.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0060_extern_crate.rast => extern_crate.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0060_extern_crate.rs => extern_crate.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0168_extern_crate_rename.rast => extern_crate_rename.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0168_extern_crate_rename.rs => extern_crate_rename.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0168_extern_crate_self.rast => extern_crate_self.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0168_extern_crate_self.rs => extern_crate_self.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0011_field_expr.rast => field_expr.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0011_field_expr.rs => field_expr.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0151_fn.rast => fn_.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0151_fn.rs => fn_.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0050_fn_decl.rast => fn_decl.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0050_fn_decl.rs => fn_decl.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0156_fn_def_param.rast => fn_def_param.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0156_fn_def_param.rs => fn_def_param.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0154_fn_pointer_param_ident_path.rast => fn_pointer_param_ident_path.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0154_fn_pointer_param_ident_path.rs => fn_pointer_param_ident_path.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0032_fn_pointer_type.rast => fn_pointer_type.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0032_fn_pointer_type.rs => fn_pointer_type.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0092_fn_pointer_type_with_ret.rast => fn_pointer_type_with_ret.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0092_fn_pointer_type_with_ret.rs => fn_pointer_type_with_ret.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0157_fn_pointer_unnamed_arg.rast => fn_pointer_unnamed_arg.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0157_fn_pointer_unnamed_arg.rs => fn_pointer_unnamed_arg.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0100_for_expr.rast => for_expr.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0100_for_expr.rs => for_expr.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0142_for_range_from.rast => for_range_from.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0142_for_range_from.rs => for_range_from.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0081_for_type.rast => for_type.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0081_for_type.rs => for_type.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0038_full_range_expr.rast => full_range_expr.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0038_full_range_expr.rs => full_range_expr.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0086_function_ret_type.rast => function_ret_type.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0086_function_ret_type.rs => function_ret_type.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0005_function_type_params.rast => function_type_params.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0005_function_type_params.rs => function_type_params.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0076_function_where_clause.rast => function_where_clause.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0076_function_where_clause.rs => function_where_clause.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0190_generic_arg.rast => generic_arg.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0190_generic_arg.rs => generic_arg.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0181_generic_param_attribute.rast => generic_param_attribute.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0181_generic_param_attribute.rs => generic_param_attribute.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0183_type_param.rast => generic_param_list.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0183_type_param.rs => generic_param_list.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0166_half_open_range_pat.rast => half_open_range_pat.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0166_half_open_range_pat.rs => half_open_range_pat.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0064_if_expr.rast => if_expr.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0064_if_expr.rs => if_expr.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0079_impl_item.rast => impl_item.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0079_impl_item.rs => impl_item.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0161_impl_item_const.rast => impl_item_const.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0161_impl_item_const.rs => impl_item_const.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0063_impl_item_neg.rast => impl_item_neg.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0063_impl_item_neg.rs => impl_item_neg.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0028_impl_trait_type.rast => impl_trait_type.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0028_impl_trait_type.rs => impl_trait_type.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0150_impl_type_params.rast => impl_type_params.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0150_impl_type_params.rs => impl_type_params.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0093_index_expr.rast => index_expr.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0093_index_expr.rs => index_expr.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0109_label.rast => label.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0109_label.rs => label.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0161_labeled_block.rast => labeled_block.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0161_labeled_block.rs => labeled_block.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0106_lambda_expr.rast => lambda_expr.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0106_lambda_expr.rs => lambda_expr.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0158_lambda_ret_block.rast => lambda_ret_block.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0158_lambda_ret_block.rs => lambda_ret_block.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0194_let_else.rast => let_else.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0194_let_else.rs => let_else.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0030_let_expr.rast => let_expr.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0030_let_expr.rs => let_expr.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0130_let_stmt.rast => let_stmt.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0130_let_stmt.rs => let_stmt.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0194_let_stmt_ascription.rast => let_stmt_ascription.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0194_let_stmt_ascription.rs => let_stmt_ascription.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0193_let_stmt_init.rast => let_stmt_init.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0193_let_stmt_init.rs => let_stmt_init.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0186_lifetime_arg.rast => lifetime_arg.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0186_lifetime_arg.rs => lifetime_arg.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0182_lifetime_param.rast => lifetime_param.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0182_lifetime_param.rs => lifetime_param.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0055_literal_pattern.rast => literal_pattern.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0055_literal_pattern.rs => literal_pattern.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0009_loop_expr.rast => loop_expr.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0009_loop_expr.rs => loop_expr.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0117_macro_call_type.rast => macro_call_type.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0117_macro_call_type.rs => macro_call_type.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0147_macro_def.rast => macro_def.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0147_macro_def.rs => macro_def.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0173_macro_def_curly.rast => macro_def_curly.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0173_macro_def_curly.rs => macro_def_curly.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0194_macro_inside_generic_arg.rast => macro_inside_generic_arg.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0194_macro_inside_generic_arg.rs => macro_inside_generic_arg.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0208_macro_rules_as_macro_name.rast => macro_rules_as_macro_name.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0208_macro_rules_as_macro_name.rs => macro_rules_as_macro_name.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0158_macro_rules_non_brace.rast => macro_rules_non_brace.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0158_macro_rules_non_brace.rs => macro_rules_non_brace.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0129_marco_pat.rast => marco_pat.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0129_marco_pat.rs => marco_pat.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0066_match_arm.rast => match_arm.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0066_match_arm.rs => match_arm.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0059_match_arms_commas.rast => match_arms_commas.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0059_match_arms_commas.rs => match_arms_commas.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0120_match_arms_inner_attribute.rast => match_arms_inner_attribute.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0120_match_arms_inner_attribute.rs => match_arms_inner_attribute.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0121_match_arms_outer_attributes.rast => match_arms_outer_attributes.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0121_match_arms_outer_attributes.rs => match_arms_outer_attributes.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0071_match_expr.rast => match_expr.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0071_match_expr.rs => match_expr.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0118_match_guard.rast => match_guard.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0118_match_guard.rs => match_guard.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0213_metas.rast => metas.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0213_metas.rs => metas.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0107_method_call_expr.rast => method_call_expr.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0107_method_call_expr.rs => method_call_expr.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0062_mod_contents.rast => mod_contents.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0062_mod_contents.rs => mod_contents.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0169_mod_item.rast => mod_item.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0169_mod_item.rs => mod_item.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0170_mod_item_curly.rast => mod_item_curly.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0170_mod_item_curly.rs => mod_item_curly.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0014_never_type.rast => never_type.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0014_never_type.rs => never_type.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0154_no_dyn_trait_leading_for.rast => no_dyn_trait_leading_for.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0154_no_dyn_trait_leading_for.rs => no_dyn_trait_leading_for.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0096_no_semi_after_block.rast => no_semi_after_block.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0096_no_semi_after_block.rs => no_semi_after_block.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0113_nocontentexpr.rast => nocontentexpr.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0113_nocontentexpr.rs => nocontentexpr.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0134_nocontentexpr_after_item.rast => nocontentexpr_after_item.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0134_nocontentexpr_after_item.rs => nocontentexpr_after_item.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0156_or_pattern.rast => or_pattern.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0156_or_pattern.rs => or_pattern.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0099_param_list.rast => param_list.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0099_param_list.rs => param_list.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0045_param_list_opt_patterns.rast => param_list_opt_patterns.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0045_param_list_opt_patterns.rs => param_list_opt_patterns.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0123_param_list_vararg.rast => param_list_vararg.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0123_param_list_vararg.rs => param_list_vararg.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0139_param_outer_arg.rast => param_outer_arg.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0139_param_outer_arg.rs => param_outer_arg.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0084_paren_type.rast => paren_type.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0084_paren_type.rs => paren_type.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0053_path_expr.rast => path_expr.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0053_path_expr.rs => path_expr.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0104_path_fn_trait_args.rast => path_fn_trait_args.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0104_path_fn_trait_args.rs => path_fn_trait_args.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0008_path_part.rast => path_part.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0008_path_part.rs => path_part.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0052_path_type.rast => path_type.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0052_path_type.rs => path_type.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0048_path_type_with_bounds.rast => path_type_with_bounds.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0048_path_type_with_bounds.rs => path_type_with_bounds.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0095_placeholder_pat.rast => placeholder_pat.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0095_placeholder_pat.rs => placeholder_pat.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0023_placeholder_type.rast => placeholder_type.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0023_placeholder_type.rs => placeholder_type.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0013_pointer_type_mut.rast => pointer_type_mut.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0013_pointer_type_mut.rs => pointer_type_mut.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0080_postfix_range.rast => postfix_range.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0080_postfix_range.rs => postfix_range.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0153_pub_parens_typepath.rast => pub_parens_typepath.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0153_pub_parens_typepath.rs => pub_parens_typepath.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0196_pub_tuple_field.rast => pub_tuple_field.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0196_pub_tuple_field.rs => pub_tuple_field.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0037_qual_paths.rast => qual_paths.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0037_qual_paths.rs => qual_paths.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0201_question_for_type_trait_bound.rast => question_for_type_trait_bound.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0201_question_for_type_trait_bound.rs => question_for_type_trait_bound.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0058_range_pat.rast => range_pat.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0058_range_pat.rs => range_pat.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0054_record_field_attrs.rast => record_field_attrs.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0054_record_field_attrs.rs => record_field_attrs.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0172_record_field_list.rast => record_field_list.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0172_record_field_list.rs => record_field_list.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0061_record_lit.rast => record_lit.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0061_record_lit.rs => record_lit.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0125_record_literal_field_with_attr.rast => record_literal_field_with_attr.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0125_record_literal_field_with_attr.rs => record_literal_field_with_attr.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0145_record_pat_field.rast => record_pat_field.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0145_record_pat_field.rs => record_pat_field.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0102_record_pat_field_list.rast => record_pat_field_list.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0102_record_pat_field_list.rs => record_pat_field_list.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0082_ref_expr.rast => ref_expr.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0082_ref_expr.rs => ref_expr.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0027_ref_pat.rast => ref_pat.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0027_ref_pat.rs => ref_pat.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0033_reference_type;.rast => reference_type.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0033_reference_type;.rs => reference_type.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0072_return_expr.rast => return_expr.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0072_return_expr.rs => return_expr.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0006_self_param.rast => self_param.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0006_self_param.rs => self_param.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0138_self_param_outer_attr.rast => self_param_outer_attr.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0138_self_param_outer_attr.rs => self_param_outer_attr.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0046_singleton_tuple_type.rast => singleton_tuple_type.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0046_singleton_tuple_type.rs => singleton_tuple_type.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0024_slice_pat.rast => slice_pat.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0024_slice_pat.rs => slice_pat.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0025_slice_type.rast => slice_type.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0025_slice_type.rs => slice_type.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0070_stmt_bin_expr_ambiguity.rast => stmt_bin_expr_ambiguity.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0070_stmt_bin_expr_ambiguity.rs => stmt_bin_expr_ambiguity.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0074_stmt_postfix_expr_ambiguity.rast => stmt_postfix_expr_ambiguity.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0074_stmt_postfix_expr_ambiguity.rs => stmt_postfix_expr_ambiguity.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0171_struct_item.rast => struct_item.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0171_struct_item.rs => struct_item.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0151_trait_alias.rast => trait_alias.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0151_trait_alias.rs => trait_alias.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0177_trait_alias_where_clause.rast => trait_alias_where_clause.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0177_trait_alias_where_clause.rs => trait_alias_where_clause.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0041_trait_item.rast => trait_item.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0041_trait_item.rs => trait_item.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0175_trait_item_bounds.rast => trait_item_bounds.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0175_trait_item_bounds.rs => trait_item_bounds.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0174_trait_item_generic_params.rast => trait_item_generic_params.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0174_trait_item_generic_params.rs => trait_item_generic_params.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0176_trait_item_where_clause.rast => trait_item_where_clause.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0176_trait_item_where_clause.rs => trait_item_where_clause.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0130_try_block_expr.rast => try_block_expr.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0130_try_block_expr.rs => try_block_expr.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0077_try_expr.rast => try_expr.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0077_try_expr.rs => try_expr.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0159_try_macro_fallback.rast => try_macro_fallback.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0159_try_macro_fallback.rs => try_macro_fallback.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0160_try_macro_rules.rast => try_macro_rules.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0160_try_macro_rules.rs => try_macro_rules.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0154_tuple_attrs.rast => tuple_attrs.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0154_tuple_attrs.rs => tuple_attrs.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0108_tuple_expr.rast => tuple_expr.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0108_tuple_expr.rs => tuple_expr.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0115_tuple_field_attrs.rast => tuple_field_attrs.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0115_tuple_field_attrs.rs => tuple_field_attrs.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0111_tuple_pat.rast => tuple_pat.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0111_tuple_pat.rs => tuple_pat.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0026_tuple_pat_fields.rast => tuple_pat_fields.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0026_tuple_pat_fields.rs => tuple_pat_fields.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0170_tuple_struct.rast => tuple_struct.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0170_tuple_struct.rs => tuple_struct.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0114_tuple_struct_where.rast => tuple_struct_where.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0114_tuple_struct_where.rs => tuple_struct_where.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0078_type_alias.rast => type_alias.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0078_type_alias.rs => type_alias.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0073_type_item_type_params.rast => type_item_type_params.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0073_type_item_type_params.rs => type_item_type_params.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0012_type_item_where_clause.rast => type_item_where_clause.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0012_type_item_where_clause.rs => type_item_where_clause.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0199_type_item_where_clause_deprecated.rast => type_item_where_clause_deprecated.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0199_type_item_where_clause_deprecated.rs => type_item_where_clause_deprecated.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0184_generic_param_list.rast => type_param.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0184_generic_param_list.rs => type_param.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0007_type_param_bounds.rast => type_param_bounds.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0007_type_param_bounds.rs => type_param_bounds.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0090_type_param_default.rast => type_param_default.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0090_type_param_default.rs => type_param_default.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0164_type_path_in_pattern.rast => type_path_in_pattern.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0164_type_path_in_pattern.rs => type_path_in_pattern.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0202_typepathfn_with_coloncolon.rast => typepathfn_with_coloncolon.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0202_typepathfn_with_coloncolon.rs => typepathfn_with_coloncolon.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0019_unary_expr.rast => unary_expr.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0019_unary_expr.rs => unary_expr.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0173_union_item.rast => union_item.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0173_union_item.rs => union_item.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0174_unit_struct.rast => unit_struct.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0174_unit_struct.rs => unit_struct.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0051_unit_type.rast => unit_type.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0051_unit_type.rs => unit_type.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0181_use_item.rast => use_item.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0181_use_item.rs => use_item.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0177_use_tree.rast => use_tree.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0177_use_tree.rs => use_tree.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0179_use_tree_abs_star.rast => use_tree_abs_star.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0179_use_tree_abs_star.rs => use_tree_abs_star.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0176_use_tree_alias.rast => use_tree_alias.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0176_use_tree_alias.rs => use_tree_alias.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0002_use_tree_list.rast => use_tree_list.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0002_use_tree_list.rs => use_tree_list.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0177_use_tree_path.rast => use_tree_path.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0177_use_tree_path.rs => use_tree_path.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0180_use_tree_path_star.rast => use_tree_path_star.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0180_use_tree_path_star.rs => use_tree_path_star.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0178_use_tree_path_use_tree.rast => use_tree_path_use_tree.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0178_use_tree_path_use_tree.rs => use_tree_path_use_tree.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0174_use_tree_star.rast => use_tree_star.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0174_use_tree_star.rs => use_tree_star.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0004_value_parameters_no_patterns.rast => value_parameters_no_patterns.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0004_value_parameters_no_patterns.rs => value_parameters_no_patterns.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0157_variant_discriminant.rast => variant_discriminant.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0157_variant_discriminant.rs => variant_discriminant.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0056_where_clause.rast => where_clause.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0056_where_clause.rs => where_clause.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0003_where_pred_for.rast => where_pred_for.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0003_where_pred_for.rs => where_pred_for.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0031_while_expr.rast => while_expr.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0031_while_expr.rs => while_expr.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0204_yeet_expr.rast => yeet_expr.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0204_yeet_expr.rs => yeet_expr.rs} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0159_yield_expr.rast => yield_expr.rast} (100%)
 rename crates/parser/test_data/parser/inline/ok/{0159_yield_expr.rs => yield_expr.rs} (100%)

diff --git a/crates/parser/src/grammar/items.rs b/crates/parser/src/grammar/items.rs
index d8468ba3cb..df117d7aa9 100644
--- a/crates/parser/src/grammar/items.rs
+++ b/crates/parser/src/grammar/items.rs
@@ -388,7 +388,7 @@ fn macro_def(p: &mut Parser<'_>, m: Marker) {
     m.complete(p, MACRO_DEF);
 }
 
-// test fn
+// test fn_
 // fn foo() {}
 fn fn_(p: &mut Parser<'_>, m: Marker) {
     p.bump(T![fn]);
diff --git a/crates/parser/src/grammar/types.rs b/crates/parser/src/grammar/types.rs
index 18ec570cd5..f95425824a 100644
--- a/crates/parser/src/grammar/types.rs
+++ b/crates/parser/src/grammar/types.rs
@@ -169,7 +169,7 @@ fn array_or_slice_type(p: &mut Parser<'_>) {
     m.complete(p, kind);
 }
 
-// test reference_type;
+// test reference_type
 // type A = &();
 // type B = &'static ();
 // type C = &mut ();
diff --git a/crates/parser/src/tests.rs b/crates/parser/src/tests.rs
index b837387be1..e0042fbdec 100644
--- a/crates/parser/src/tests.rs
+++ b/crates/parser/src/tests.rs
@@ -11,6 +11,9 @@ use expect_test::expect_file;
 
 use crate::{Edition, LexedStr, TopEntryPoint};
 
+#[path = "../test_data/generated/runner.rs"]
+mod runner;
+
 #[test]
 fn lex_ok() {
     for case in TestCase::list("lexer/ok") {
@@ -54,16 +57,6 @@ fn parse_ok() {
     }
 }
 
-#[test]
-fn parse_inline_ok() {
-    for case in TestCase::list("parser/inline/ok") {
-        let _guard = stdx::panic_context::enter(format!("{:?}", case.rs));
-        let (actual, errors) = parse(TopEntryPoint::SourceFile, &case.text);
-        assert!(!errors, "errors in an OK file {}:\n{actual}", case.rs.display());
-        expect_file![case.rast].assert_eq(&actual);
-    }
-}
-
 #[test]
 fn parse_err() {
     for case in TestCase::list("parser/err") {
@@ -74,16 +67,6 @@ fn parse_err() {
     }
 }
 
-#[test]
-fn parse_inline_err() {
-    for case in TestCase::list("parser/inline/err") {
-        let _guard = stdx::panic_context::enter(format!("{:?}", case.rs));
-        let (actual, errors) = parse(TopEntryPoint::SourceFile, &case.text);
-        assert!(errors, "no errors in an ERR file {}:\n{actual}", case.rs.display());
-        expect_file![case.rast].assert_eq(&actual)
-    }
-}
-
 fn parse(entry: TopEntryPoint, text: &str) -> (String, bool) {
     let lexed = LexedStr::new(Edition::CURRENT, text);
     let input = lexed.to_input();
@@ -167,3 +150,27 @@ impl TestCase {
         res
     }
 }
+
+#[track_caller]
+fn run_and_expect_no_errors(path: &str) {
+    let path = PathBuf::from(path);
+    let text = std::fs::read_to_string(&path).unwrap();
+    let (actual, errors) = parse(TopEntryPoint::SourceFile, &text);
+    assert!(!errors, "errors in an OK file {}:\n{actual}", path.display());
+    let mut p = PathBuf::from("..");
+    p.push(path);
+    p.set_extension("rast");
+    expect_file![p].assert_eq(&actual)
+}
+
+#[track_caller]
+fn run_and_expect_errors(path: &str) {
+    let path = PathBuf::from(path);
+    let text = std::fs::read_to_string(&path).unwrap();
+    let (actual, errors) = parse(TopEntryPoint::SourceFile, &text);
+    assert!(errors, "no errors in an ERR file {}:\n{actual}", path.display());
+    let mut p = PathBuf::from("..");
+    p.push(path);
+    p.set_extension("rast");
+    expect_file![p].assert_eq(&actual)
+}
diff --git a/crates/parser/test_data/generated/runner.rs b/crates/parser/test_data/generated/runner.rs
new file mode 100644
index 0000000000..f82d1ed320
--- /dev/null
+++ b/crates/parser/test_data/generated/runner.rs
@@ -0,0 +1,810 @@
+mod ok {
+    use crate::tests::run_and_expect_no_errors;
+    #[test]
+    fn anonymous_const() {
+        run_and_expect_no_errors("test_data/parser/inline/ok/anonymous_const.rs");
+    }
+    #[test]
+    fn arb_self_types() {
+        run_and_expect_no_errors("test_data/parser/inline/ok/arb_self_types.rs");
+    }
+    #[test]
+    fn arg_with_attr() { run_and_expect_no_errors("test_data/parser/inline/ok/arg_with_attr.rs"); }
+    #[test]
+    fn array_attrs() { run_and_expect_no_errors("test_data/parser/inline/ok/array_attrs.rs"); }
+    #[test]
+    fn array_expr() { run_and_expect_no_errors("test_data/parser/inline/ok/array_expr.rs"); }
+    #[test]
+    fn array_type() { run_and_expect_no_errors("test_data/parser/inline/ok/array_type.rs"); }
+    #[test]
+    fn as_precedence() { run_and_expect_no_errors("test_data/parser/inline/ok/as_precedence.rs"); }
+    #[test]
+    fn assoc_const_eq() {
+        run_and_expect_no_errors("test_data/parser/inline/ok/assoc_const_eq.rs");
+    }
+    #[test]
+    fn assoc_item_list() {
+        run_and_expect_no_errors("test_data/parser/inline/ok/assoc_item_list.rs");
+    }
+    #[test]
+    fn assoc_item_list_inner_attrs() {
+        run_and_expect_no_errors("test_data/parser/inline/ok/assoc_item_list_inner_attrs.rs");
+    }
+    #[test]
+    fn assoc_type_bound() {
+        run_and_expect_no_errors("test_data/parser/inline/ok/assoc_type_bound.rs");
+    }
+    #[test]
+    fn assoc_type_eq() { run_and_expect_no_errors("test_data/parser/inline/ok/assoc_type_eq.rs"); }
+    #[test]
+    fn associated_return_type_bounds() {
+        run_and_expect_no_errors("test_data/parser/inline/ok/associated_return_type_bounds.rs");
+    }
+    #[test]
+    fn associated_type_bounds() {
+        run_and_expect_no_errors("test_data/parser/inline/ok/associated_type_bounds.rs");
+    }
+    #[test]
+    fn async_trait_bound() {
+        run_and_expect_no_errors("test_data/parser/inline/ok/async_trait_bound.rs");
+    }
+    #[test]
+    fn attr_on_expr_stmt() {
+        run_and_expect_no_errors("test_data/parser/inline/ok/attr_on_expr_stmt.rs");
+    }
+    #[test]
+    fn await_expr() { run_and_expect_no_errors("test_data/parser/inline/ok/await_expr.rs"); }
+    #[test]
+    fn bare_dyn_types_with_leading_lifetime() {
+        run_and_expect_no_errors(
+            "test_data/parser/inline/ok/bare_dyn_types_with_leading_lifetime.rs",
+        );
+    }
+    #[test]
+    fn bare_dyn_types_with_paren_as_generic_args() {
+        run_and_expect_no_errors(
+            "test_data/parser/inline/ok/bare_dyn_types_with_paren_as_generic_args.rs",
+        );
+    }
+    #[test]
+    fn become_expr() { run_and_expect_no_errors("test_data/parser/inline/ok/become_expr.rs"); }
+    #[test]
+    fn bind_pat() { run_and_expect_no_errors("test_data/parser/inline/ok/bind_pat.rs"); }
+    #[test]
+    fn binop_resets_statementness() {
+        run_and_expect_no_errors("test_data/parser/inline/ok/binop_resets_statementness.rs");
+    }
+    #[test]
+    fn block() { run_and_expect_no_errors("test_data/parser/inline/ok/block.rs"); }
+    #[test]
+    fn block_items() { run_and_expect_no_errors("test_data/parser/inline/ok/block_items.rs"); }
+    #[test]
+    fn box_pat() { run_and_expect_no_errors("test_data/parser/inline/ok/box_pat.rs"); }
+    #[test]
+    fn break_ambiguity() {
+        run_and_expect_no_errors("test_data/parser/inline/ok/break_ambiguity.rs");
+    }
+    #[test]
+    fn break_expr() { run_and_expect_no_errors("test_data/parser/inline/ok/break_expr.rs"); }
+    #[test]
+    fn builtin_expr() { run_and_expect_no_errors("test_data/parser/inline/ok/builtin_expr.rs"); }
+    #[test]
+    fn call_expr() { run_and_expect_no_errors("test_data/parser/inline/ok/call_expr.rs"); }
+    #[test]
+    fn cast_expr() { run_and_expect_no_errors("test_data/parser/inline/ok/cast_expr.rs"); }
+    #[test]
+    fn closure_body_underscore_assignment() {
+        run_and_expect_no_errors(
+            "test_data/parser/inline/ok/closure_body_underscore_assignment.rs",
+        );
+    }
+    #[test]
+    fn closure_params() {
+        run_and_expect_no_errors("test_data/parser/inline/ok/closure_params.rs");
+    }
+    #[test]
+    fn closure_range_method_call() {
+        run_and_expect_no_errors("test_data/parser/inline/ok/closure_range_method_call.rs");
+    }
+    #[test]
+    fn const_arg() { run_and_expect_no_errors("test_data/parser/inline/ok/const_arg.rs"); }
+    #[test]
+    fn const_arg_block() {
+        run_and_expect_no_errors("test_data/parser/inline/ok/const_arg_block.rs");
+    }
+    #[test]
+    fn const_arg_bool_literal() {
+        run_and_expect_no_errors("test_data/parser/inline/ok/const_arg_bool_literal.rs");
+    }
+    #[test]
+    fn const_arg_literal() {
+        run_and_expect_no_errors("test_data/parser/inline/ok/const_arg_literal.rs");
+    }
+    #[test]
+    fn const_arg_negative_number() {
+        run_and_expect_no_errors("test_data/parser/inline/ok/const_arg_negative_number.rs");
+    }
+    #[test]
+    fn const_block_pat() {
+        run_and_expect_no_errors("test_data/parser/inline/ok/const_block_pat.rs");
+    }
+    #[test]
+    fn const_closure() { run_and_expect_no_errors("test_data/parser/inline/ok/const_closure.rs"); }
+    #[test]
+    fn const_item() { run_and_expect_no_errors("test_data/parser/inline/ok/const_item.rs"); }
+    #[test]
+    fn const_param() { run_and_expect_no_errors("test_data/parser/inline/ok/const_param.rs"); }
+    #[test]
+    fn const_param_default_expression() {
+        run_and_expect_no_errors("test_data/parser/inline/ok/const_param_default_expression.rs");
+    }
+    #[test]
+    fn const_param_default_literal() {
+        run_and_expect_no_errors("test_data/parser/inline/ok/const_param_default_literal.rs");
+    }
+    #[test]
+    fn const_param_default_path() {
+        run_and_expect_no_errors("test_data/parser/inline/ok/const_param_default_path.rs");
+    }
+    #[test]
+    fn const_trait_bound() {
+        run_and_expect_no_errors("test_data/parser/inline/ok/const_trait_bound.rs");
+    }
+    #[test]
+    fn continue_expr() { run_and_expect_no_errors("test_data/parser/inline/ok/continue_expr.rs"); }
+    #[test]
+    fn crate_path() { run_and_expect_no_errors("test_data/parser/inline/ok/crate_path.rs"); }
+    #[test]
+    fn crate_visibility() {
+        run_and_expect_no_errors("test_data/parser/inline/ok/crate_visibility.rs");
+    }
+    #[test]
+    fn crate_visibility_in() {
+        run_and_expect_no_errors("test_data/parser/inline/ok/crate_visibility_in.rs");
+    }
+    #[test]
+    fn default_async_fn() {
+        run_and_expect_no_errors("test_data/parser/inline/ok/default_async_fn.rs");
+    }
+    #[test]
+    fn default_async_unsafe_fn() {
+        run_and_expect_no_errors("test_data/parser/inline/ok/default_async_unsafe_fn.rs");
+    }
+    #[test]
+    fn default_item() { run_and_expect_no_errors("test_data/parser/inline/ok/default_item.rs"); }
+    #[test]
+    fn default_unsafe_item() {
+        run_and_expect_no_errors("test_data/parser/inline/ok/default_unsafe_item.rs");
+    }
+    #[test]
+    fn destructuring_assignment_struct_rest_pattern() {
+        run_and_expect_no_errors(
+            "test_data/parser/inline/ok/destructuring_assignment_struct_rest_pattern.rs",
+        );
+    }
+    #[test]
+    fn destructuring_assignment_wildcard_pat() {
+        run_and_expect_no_errors(
+            "test_data/parser/inline/ok/destructuring_assignment_wildcard_pat.rs",
+        );
+    }
+    #[test]
+    fn dot_dot_pat() { run_and_expect_no_errors("test_data/parser/inline/ok/dot_dot_pat.rs"); }
+    #[test]
+    fn dyn_trait_type() {
+        run_and_expect_no_errors("test_data/parser/inline/ok/dyn_trait_type.rs");
+    }
+    #[test]
+    fn effect_blocks() { run_and_expect_no_errors("test_data/parser/inline/ok/effect_blocks.rs"); }
+    #[test]
+    fn exclusive_range_pat() {
+        run_and_expect_no_errors("test_data/parser/inline/ok/exclusive_range_pat.rs");
+    }
+    #[test]
+    fn expr_literals() { run_and_expect_no_errors("test_data/parser/inline/ok/expr_literals.rs"); }
+    #[test]
+    fn expression_after_block() {
+        run_and_expect_no_errors("test_data/parser/inline/ok/expression_after_block.rs");
+    }
+    #[test]
+    fn extern_block() { run_and_expect_no_errors("test_data/parser/inline/ok/extern_block.rs"); }
+    #[test]
+    fn extern_crate() { run_and_expect_no_errors("test_data/parser/inline/ok/extern_crate.rs"); }
+    #[test]
+    fn extern_crate_rename() {
+        run_and_expect_no_errors("test_data/parser/inline/ok/extern_crate_rename.rs");
+    }
+    #[test]
+    fn extern_crate_self() {
+        run_and_expect_no_errors("test_data/parser/inline/ok/extern_crate_self.rs");
+    }
+    #[test]
+    fn field_expr() { run_and_expect_no_errors("test_data/parser/inline/ok/field_expr.rs"); }
+    #[test]
+    fn fn_() { run_and_expect_no_errors("test_data/parser/inline/ok/fn_.rs"); }
+    #[test]
+    fn fn_decl() { run_and_expect_no_errors("test_data/parser/inline/ok/fn_decl.rs"); }
+    #[test]
+    fn fn_def_param() { run_and_expect_no_errors("test_data/parser/inline/ok/fn_def_param.rs"); }
+    #[test]
+    fn fn_pointer_param_ident_path() {
+        run_and_expect_no_errors("test_data/parser/inline/ok/fn_pointer_param_ident_path.rs");
+    }
+    #[test]
+    fn fn_pointer_type() {
+        run_and_expect_no_errors("test_data/parser/inline/ok/fn_pointer_type.rs");
+    }
+    #[test]
+    fn fn_pointer_type_with_ret() {
+        run_and_expect_no_errors("test_data/parser/inline/ok/fn_pointer_type_with_ret.rs");
+    }
+    #[test]
+    fn fn_pointer_unnamed_arg() {
+        run_and_expect_no_errors("test_data/parser/inline/ok/fn_pointer_unnamed_arg.rs");
+    }
+    #[test]
+    fn for_expr() { run_and_expect_no_errors("test_data/parser/inline/ok/for_expr.rs"); }
+    #[test]
+    fn for_range_from() {
+        run_and_expect_no_errors("test_data/parser/inline/ok/for_range_from.rs");
+    }
+    #[test]
+    fn for_type() { run_and_expect_no_errors("test_data/parser/inline/ok/for_type.rs"); }
+    #[test]
+    fn full_range_expr() {
+        run_and_expect_no_errors("test_data/parser/inline/ok/full_range_expr.rs");
+    }
+    #[test]
+    fn function_ret_type() {
+        run_and_expect_no_errors("test_data/parser/inline/ok/function_ret_type.rs");
+    }
+    #[test]
+    fn function_type_params() {
+        run_and_expect_no_errors("test_data/parser/inline/ok/function_type_params.rs");
+    }
+    #[test]
+    fn function_where_clause() {
+        run_and_expect_no_errors("test_data/parser/inline/ok/function_where_clause.rs");
+    }
+    #[test]
+    fn generic_arg() { run_and_expect_no_errors("test_data/parser/inline/ok/generic_arg.rs"); }
+    #[test]
+    fn generic_param_attribute() {
+        run_and_expect_no_errors("test_data/parser/inline/ok/generic_param_attribute.rs");
+    }
+    #[test]
+    fn generic_param_list() {
+        run_and_expect_no_errors("test_data/parser/inline/ok/generic_param_list.rs");
+    }
+    #[test]
+    fn half_open_range_pat() {
+        run_and_expect_no_errors("test_data/parser/inline/ok/half_open_range_pat.rs");
+    }
+    #[test]
+    fn if_expr() { run_and_expect_no_errors("test_data/parser/inline/ok/if_expr.rs"); }
+    #[test]
+    fn impl_item() { run_and_expect_no_errors("test_data/parser/inline/ok/impl_item.rs"); }
+    #[test]
+    fn impl_item_const() {
+        run_and_expect_no_errors("test_data/parser/inline/ok/impl_item_const.rs");
+    }
+    #[test]
+    fn impl_item_neg() { run_and_expect_no_errors("test_data/parser/inline/ok/impl_item_neg.rs"); }
+    #[test]
+    fn impl_trait_type() {
+        run_and_expect_no_errors("test_data/parser/inline/ok/impl_trait_type.rs");
+    }
+    #[test]
+    fn impl_type_params() {
+        run_and_expect_no_errors("test_data/parser/inline/ok/impl_type_params.rs");
+    }
+    #[test]
+    fn index_expr() { run_and_expect_no_errors("test_data/parser/inline/ok/index_expr.rs"); }
+    #[test]
+    fn label() { run_and_expect_no_errors("test_data/parser/inline/ok/label.rs"); }
+    #[test]
+    fn labeled_block() { run_and_expect_no_errors("test_data/parser/inline/ok/labeled_block.rs"); }
+    #[test]
+    fn lambda_expr() { run_and_expect_no_errors("test_data/parser/inline/ok/lambda_expr.rs"); }
+    #[test]
+    fn lambda_ret_block() {
+        run_and_expect_no_errors("test_data/parser/inline/ok/lambda_ret_block.rs");
+    }
+    #[test]
+    fn let_else() { run_and_expect_no_errors("test_data/parser/inline/ok/let_else.rs"); }
+    #[test]
+    fn let_expr() { run_and_expect_no_errors("test_data/parser/inline/ok/let_expr.rs"); }
+    #[test]
+    fn let_stmt() { run_and_expect_no_errors("test_data/parser/inline/ok/let_stmt.rs"); }
+    #[test]
+    fn let_stmt_ascription() {
+        run_and_expect_no_errors("test_data/parser/inline/ok/let_stmt_ascription.rs");
+    }
+    #[test]
+    fn let_stmt_init() { run_and_expect_no_errors("test_data/parser/inline/ok/let_stmt_init.rs"); }
+    #[test]
+    fn lifetime_arg() { run_and_expect_no_errors("test_data/parser/inline/ok/lifetime_arg.rs"); }
+    #[test]
+    fn lifetime_param() {
+        run_and_expect_no_errors("test_data/parser/inline/ok/lifetime_param.rs");
+    }
+    #[test]
+    fn literal_pattern() {
+        run_and_expect_no_errors("test_data/parser/inline/ok/literal_pattern.rs");
+    }
+    #[test]
+    fn loop_expr() { run_and_expect_no_errors("test_data/parser/inline/ok/loop_expr.rs"); }
+    #[test]
+    fn macro_call_type() {
+        run_and_expect_no_errors("test_data/parser/inline/ok/macro_call_type.rs");
+    }
+    #[test]
+    fn macro_def() { run_and_expect_no_errors("test_data/parser/inline/ok/macro_def.rs"); }
+    #[test]
+    fn macro_def_curly() {
+        run_and_expect_no_errors("test_data/parser/inline/ok/macro_def_curly.rs");
+    }
+    #[test]
+    fn macro_inside_generic_arg() {
+        run_and_expect_no_errors("test_data/parser/inline/ok/macro_inside_generic_arg.rs");
+    }
+    #[test]
+    fn macro_rules_as_macro_name() {
+        run_and_expect_no_errors("test_data/parser/inline/ok/macro_rules_as_macro_name.rs");
+    }
+    #[test]
+    fn macro_rules_non_brace() {
+        run_and_expect_no_errors("test_data/parser/inline/ok/macro_rules_non_brace.rs");
+    }
+    #[test]
+    fn marco_pat() { run_and_expect_no_errors("test_data/parser/inline/ok/marco_pat.rs"); }
+    #[test]
+    fn match_arm() { run_and_expect_no_errors("test_data/parser/inline/ok/match_arm.rs"); }
+    #[test]
+    fn match_arms_commas() {
+        run_and_expect_no_errors("test_data/parser/inline/ok/match_arms_commas.rs");
+    }
+    #[test]
+    fn match_arms_inner_attribute() {
+        run_and_expect_no_errors("test_data/parser/inline/ok/match_arms_inner_attribute.rs");
+    }
+    #[test]
+    fn match_arms_outer_attributes() {
+        run_and_expect_no_errors("test_data/parser/inline/ok/match_arms_outer_attributes.rs");
+    }
+    #[test]
+    fn match_expr() { run_and_expect_no_errors("test_data/parser/inline/ok/match_expr.rs"); }
+    #[test]
+    fn match_guard() { run_and_expect_no_errors("test_data/parser/inline/ok/match_guard.rs"); }
+    #[test]
+    fn metas() { run_and_expect_no_errors("test_data/parser/inline/ok/metas.rs"); }
+    #[test]
+    fn method_call_expr() {
+        run_and_expect_no_errors("test_data/parser/inline/ok/method_call_expr.rs");
+    }
+    #[test]
+    fn mod_contents() { run_and_expect_no_errors("test_data/parser/inline/ok/mod_contents.rs"); }
+    #[test]
+    fn mod_item() { run_and_expect_no_errors("test_data/parser/inline/ok/mod_item.rs"); }
+    #[test]
+    fn mod_item_curly() {
+        run_and_expect_no_errors("test_data/parser/inline/ok/mod_item_curly.rs");
+    }
+    #[test]
+    fn never_type() { run_and_expect_no_errors("test_data/parser/inline/ok/never_type.rs"); }
+    #[test]
+    fn no_dyn_trait_leading_for() {
+        run_and_expect_no_errors("test_data/parser/inline/ok/no_dyn_trait_leading_for.rs");
+    }
+    #[test]
+    fn no_semi_after_block() {
+        run_and_expect_no_errors("test_data/parser/inline/ok/no_semi_after_block.rs");
+    }
+    #[test]
+    fn nocontentexpr() { run_and_expect_no_errors("test_data/parser/inline/ok/nocontentexpr.rs"); }
+    #[test]
+    fn nocontentexpr_after_item() {
+        run_and_expect_no_errors("test_data/parser/inline/ok/nocontentexpr_after_item.rs");
+    }
+    #[test]
+    fn or_pattern() { run_and_expect_no_errors("test_data/parser/inline/ok/or_pattern.rs"); }
+    #[test]
+    fn param_list() { run_and_expect_no_errors("test_data/parser/inline/ok/param_list.rs"); }
+    #[test]
+    fn param_list_opt_patterns() {
+        run_and_expect_no_errors("test_data/parser/inline/ok/param_list_opt_patterns.rs");
+    }
+    #[test]
+    fn param_list_vararg() {
+        run_and_expect_no_errors("test_data/parser/inline/ok/param_list_vararg.rs");
+    }
+    #[test]
+    fn param_outer_arg() {
+        run_and_expect_no_errors("test_data/parser/inline/ok/param_outer_arg.rs");
+    }
+    #[test]
+    fn paren_type() { run_and_expect_no_errors("test_data/parser/inline/ok/paren_type.rs"); }
+    #[test]
+    fn path_expr() { run_and_expect_no_errors("test_data/parser/inline/ok/path_expr.rs"); }
+    #[test]
+    fn path_fn_trait_args() {
+        run_and_expect_no_errors("test_data/parser/inline/ok/path_fn_trait_args.rs");
+    }
+    #[test]
+    fn path_part() { run_and_expect_no_errors("test_data/parser/inline/ok/path_part.rs"); }
+    #[test]
+    fn path_type() { run_and_expect_no_errors("test_data/parser/inline/ok/path_type.rs"); }
+    #[test]
+    fn path_type_with_bounds() {
+        run_and_expect_no_errors("test_data/parser/inline/ok/path_type_with_bounds.rs");
+    }
+    #[test]
+    fn placeholder_pat() {
+        run_and_expect_no_errors("test_data/parser/inline/ok/placeholder_pat.rs");
+    }
+    #[test]
+    fn placeholder_type() {
+        run_and_expect_no_errors("test_data/parser/inline/ok/placeholder_type.rs");
+    }
+    #[test]
+    fn pointer_type_mut() {
+        run_and_expect_no_errors("test_data/parser/inline/ok/pointer_type_mut.rs");
+    }
+    #[test]
+    fn postfix_range() { run_and_expect_no_errors("test_data/parser/inline/ok/postfix_range.rs"); }
+    #[test]
+    fn pub_parens_typepath() {
+        run_and_expect_no_errors("test_data/parser/inline/ok/pub_parens_typepath.rs");
+    }
+    #[test]
+    fn pub_tuple_field() {
+        run_and_expect_no_errors("test_data/parser/inline/ok/pub_tuple_field.rs");
+    }
+    #[test]
+    fn qual_paths() { run_and_expect_no_errors("test_data/parser/inline/ok/qual_paths.rs"); }
+    #[test]
+    fn question_for_type_trait_bound() {
+        run_and_expect_no_errors("test_data/parser/inline/ok/question_for_type_trait_bound.rs");
+    }
+    #[test]
+    fn range_pat() { run_and_expect_no_errors("test_data/parser/inline/ok/range_pat.rs"); }
+    #[test]
+    fn record_field_attrs() {
+        run_and_expect_no_errors("test_data/parser/inline/ok/record_field_attrs.rs");
+    }
+    #[test]
+    fn record_field_list() {
+        run_and_expect_no_errors("test_data/parser/inline/ok/record_field_list.rs");
+    }
+    #[test]
+    fn record_lit() { run_and_expect_no_errors("test_data/parser/inline/ok/record_lit.rs"); }
+    #[test]
+    fn record_literal_field_with_attr() {
+        run_and_expect_no_errors("test_data/parser/inline/ok/record_literal_field_with_attr.rs");
+    }
+    #[test]
+    fn record_pat_field() {
+        run_and_expect_no_errors("test_data/parser/inline/ok/record_pat_field.rs");
+    }
+    #[test]
+    fn record_pat_field_list() {
+        run_and_expect_no_errors("test_data/parser/inline/ok/record_pat_field_list.rs");
+    }
+    #[test]
+    fn ref_expr() { run_and_expect_no_errors("test_data/parser/inline/ok/ref_expr.rs"); }
+    #[test]
+    fn ref_pat() { run_and_expect_no_errors("test_data/parser/inline/ok/ref_pat.rs"); }
+    #[test]
+    fn reference_type() {
+        run_and_expect_no_errors("test_data/parser/inline/ok/reference_type.rs");
+    }
+    #[test]
+    fn return_expr() { run_and_expect_no_errors("test_data/parser/inline/ok/return_expr.rs"); }
+    #[test]
+    fn self_param() { run_and_expect_no_errors("test_data/parser/inline/ok/self_param.rs"); }
+    #[test]
+    fn self_param_outer_attr() {
+        run_and_expect_no_errors("test_data/parser/inline/ok/self_param_outer_attr.rs");
+    }
+    #[test]
+    fn singleton_tuple_type() {
+        run_and_expect_no_errors("test_data/parser/inline/ok/singleton_tuple_type.rs");
+    }
+    #[test]
+    fn slice_pat() { run_and_expect_no_errors("test_data/parser/inline/ok/slice_pat.rs"); }
+    #[test]
+    fn slice_type() { run_and_expect_no_errors("test_data/parser/inline/ok/slice_type.rs"); }
+    #[test]
+    fn stmt_bin_expr_ambiguity() {
+        run_and_expect_no_errors("test_data/parser/inline/ok/stmt_bin_expr_ambiguity.rs");
+    }
+    #[test]
+    fn stmt_postfix_expr_ambiguity() {
+        run_and_expect_no_errors("test_data/parser/inline/ok/stmt_postfix_expr_ambiguity.rs");
+    }
+    #[test]
+    fn struct_item() { run_and_expect_no_errors("test_data/parser/inline/ok/struct_item.rs"); }
+    #[test]
+    fn trait_alias() { run_and_expect_no_errors("test_data/parser/inline/ok/trait_alias.rs"); }
+    #[test]
+    fn trait_alias_where_clause() {
+        run_and_expect_no_errors("test_data/parser/inline/ok/trait_alias_where_clause.rs");
+    }
+    #[test]
+    fn trait_item() { run_and_expect_no_errors("test_data/parser/inline/ok/trait_item.rs"); }
+    #[test]
+    fn trait_item_bounds() {
+        run_and_expect_no_errors("test_data/parser/inline/ok/trait_item_bounds.rs");
+    }
+    #[test]
+    fn trait_item_generic_params() {
+        run_and_expect_no_errors("test_data/parser/inline/ok/trait_item_generic_params.rs");
+    }
+    #[test]
+    fn trait_item_where_clause() {
+        run_and_expect_no_errors("test_data/parser/inline/ok/trait_item_where_clause.rs");
+    }
+    #[test]
+    fn try_block_expr() {
+        run_and_expect_no_errors("test_data/parser/inline/ok/try_block_expr.rs");
+    }
+    #[test]
+    fn try_expr() { run_and_expect_no_errors("test_data/parser/inline/ok/try_expr.rs"); }
+    #[test]
+    fn try_macro_fallback() {
+        run_and_expect_no_errors("test_data/parser/inline/ok/try_macro_fallback.rs");
+    }
+    #[test]
+    fn try_macro_rules() {
+        run_and_expect_no_errors("test_data/parser/inline/ok/try_macro_rules.rs");
+    }
+    #[test]
+    fn tuple_attrs() { run_and_expect_no_errors("test_data/parser/inline/ok/tuple_attrs.rs"); }
+    #[test]
+    fn tuple_expr() { run_and_expect_no_errors("test_data/parser/inline/ok/tuple_expr.rs"); }
+    #[test]
+    fn tuple_field_attrs() {
+        run_and_expect_no_errors("test_data/parser/inline/ok/tuple_field_attrs.rs");
+    }
+    #[test]
+    fn tuple_pat() { run_and_expect_no_errors("test_data/parser/inline/ok/tuple_pat.rs"); }
+    #[test]
+    fn tuple_pat_fields() {
+        run_and_expect_no_errors("test_data/parser/inline/ok/tuple_pat_fields.rs");
+    }
+    #[test]
+    fn tuple_struct() { run_and_expect_no_errors("test_data/parser/inline/ok/tuple_struct.rs"); }
+    #[test]
+    fn tuple_struct_where() {
+        run_and_expect_no_errors("test_data/parser/inline/ok/tuple_struct_where.rs");
+    }
+    #[test]
+    fn type_alias() { run_and_expect_no_errors("test_data/parser/inline/ok/type_alias.rs"); }
+    #[test]
+    fn type_item_type_params() {
+        run_and_expect_no_errors("test_data/parser/inline/ok/type_item_type_params.rs");
+    }
+    #[test]
+    fn type_item_where_clause() {
+        run_and_expect_no_errors("test_data/parser/inline/ok/type_item_where_clause.rs");
+    }
+    #[test]
+    fn type_item_where_clause_deprecated() {
+        run_and_expect_no_errors("test_data/parser/inline/ok/type_item_where_clause_deprecated.rs");
+    }
+    #[test]
+    fn type_param() { run_and_expect_no_errors("test_data/parser/inline/ok/type_param.rs"); }
+    #[test]
+    fn type_param_bounds() {
+        run_and_expect_no_errors("test_data/parser/inline/ok/type_param_bounds.rs");
+    }
+    #[test]
+    fn type_param_default() {
+        run_and_expect_no_errors("test_data/parser/inline/ok/type_param_default.rs");
+    }
+    #[test]
+    fn type_path_in_pattern() {
+        run_and_expect_no_errors("test_data/parser/inline/ok/type_path_in_pattern.rs");
+    }
+    #[test]
+    fn typepathfn_with_coloncolon() {
+        run_and_expect_no_errors("test_data/parser/inline/ok/typepathfn_with_coloncolon.rs");
+    }
+    #[test]
+    fn unary_expr() { run_and_expect_no_errors("test_data/parser/inline/ok/unary_expr.rs"); }
+    #[test]
+    fn union_item() { run_and_expect_no_errors("test_data/parser/inline/ok/union_item.rs"); }
+    #[test]
+    fn unit_struct() { run_and_expect_no_errors("test_data/parser/inline/ok/unit_struct.rs"); }
+    #[test]
+    fn unit_type() { run_and_expect_no_errors("test_data/parser/inline/ok/unit_type.rs"); }
+    #[test]
+    fn use_item() { run_and_expect_no_errors("test_data/parser/inline/ok/use_item.rs"); }
+    #[test]
+    fn use_tree() { run_and_expect_no_errors("test_data/parser/inline/ok/use_tree.rs"); }
+    #[test]
+    fn use_tree_abs_star() {
+        run_and_expect_no_errors("test_data/parser/inline/ok/use_tree_abs_star.rs");
+    }
+    #[test]
+    fn use_tree_alias() {
+        run_and_expect_no_errors("test_data/parser/inline/ok/use_tree_alias.rs");
+    }
+    #[test]
+    fn use_tree_list() { run_and_expect_no_errors("test_data/parser/inline/ok/use_tree_list.rs"); }
+    #[test]
+    fn use_tree_path() { run_and_expect_no_errors("test_data/parser/inline/ok/use_tree_path.rs"); }
+    #[test]
+    fn use_tree_path_star() {
+        run_and_expect_no_errors("test_data/parser/inline/ok/use_tree_path_star.rs");
+    }
+    #[test]
+    fn use_tree_path_use_tree() {
+        run_and_expect_no_errors("test_data/parser/inline/ok/use_tree_path_use_tree.rs");
+    }
+    #[test]
+    fn use_tree_star() { run_and_expect_no_errors("test_data/parser/inline/ok/use_tree_star.rs"); }
+    #[test]
+    fn value_parameters_no_patterns() {
+        run_and_expect_no_errors("test_data/parser/inline/ok/value_parameters_no_patterns.rs");
+    }
+    #[test]
+    fn variant_discriminant() {
+        run_and_expect_no_errors("test_data/parser/inline/ok/variant_discriminant.rs");
+    }
+    #[test]
+    fn where_clause() { run_and_expect_no_errors("test_data/parser/inline/ok/where_clause.rs"); }
+    #[test]
+    fn where_pred_for() {
+        run_and_expect_no_errors("test_data/parser/inline/ok/where_pred_for.rs");
+    }
+    #[test]
+    fn while_expr() { run_and_expect_no_errors("test_data/parser/inline/ok/while_expr.rs"); }
+    #[test]
+    fn yeet_expr() { run_and_expect_no_errors("test_data/parser/inline/ok/yeet_expr.rs"); }
+    #[test]
+    fn yield_expr() { run_and_expect_no_errors("test_data/parser/inline/ok/yield_expr.rs"); }
+}
+mod err {
+    use crate::tests::run_and_expect_errors;
+    #[test]
+    fn angled_path_without_qual() {
+        run_and_expect_errors("test_data/parser/inline/err/angled_path_without_qual.rs");
+    }
+    #[test]
+    fn anonymous_static() {
+        run_and_expect_errors("test_data/parser/inline/err/anonymous_static.rs");
+    }
+    #[test]
+    fn arg_list_recovery() {
+        run_and_expect_errors("test_data/parser/inline/err/arg_list_recovery.rs");
+    }
+    #[test]
+    fn array_type_missing_semi() {
+        run_and_expect_errors("test_data/parser/inline/err/array_type_missing_semi.rs");
+    }
+    #[test]
+    fn async_without_semicolon() {
+        run_and_expect_errors("test_data/parser/inline/err/async_without_semicolon.rs");
+    }
+    #[test]
+    fn comma_after_functional_update_syntax() {
+        run_and_expect_errors(
+            "test_data/parser/inline/err/comma_after_functional_update_syntax.rs",
+        );
+    }
+    #[test]
+    fn crate_visibility_empty_recover() {
+        run_and_expect_errors("test_data/parser/inline/err/crate_visibility_empty_recover.rs");
+    }
+    #[test]
+    fn empty_param_slot() {
+        run_and_expect_errors("test_data/parser/inline/err/empty_param_slot.rs");
+    }
+    #[test]
+    fn empty_segment() { run_and_expect_errors("test_data/parser/inline/err/empty_segment.rs"); }
+    #[test]
+    fn fn_pointer_type_missing_fn() {
+        run_and_expect_errors("test_data/parser/inline/err/fn_pointer_type_missing_fn.rs");
+    }
+    #[test]
+    fn gen_blocks() { run_and_expect_errors("test_data/parser/inline/err/gen_blocks.rs"); }
+    #[test]
+    fn gen_fn() { run_and_expect_errors("test_data/parser/inline/err/gen_fn.rs"); }
+    #[test]
+    fn generic_arg_list_recover() {
+        run_and_expect_errors("test_data/parser/inline/err/generic_arg_list_recover.rs");
+    }
+    #[test]
+    fn generic_param_list_recover() {
+        run_and_expect_errors("test_data/parser/inline/err/generic_param_list_recover.rs");
+    }
+    #[test]
+    fn impl_type() { run_and_expect_errors("test_data/parser/inline/err/impl_type.rs"); }
+    #[test]
+    fn let_else_right_curly_brace() {
+        run_and_expect_errors("test_data/parser/inline/err/let_else_right_curly_brace.rs");
+    }
+    #[test]
+    fn macro_rules_as_macro_name() {
+        run_and_expect_errors("test_data/parser/inline/err/macro_rules_as_macro_name.rs");
+    }
+    #[test]
+    fn match_arms_recovery() {
+        run_and_expect_errors("test_data/parser/inline/err/match_arms_recovery.rs");
+    }
+    #[test]
+    fn method_call_missing_argument_list() {
+        run_and_expect_errors("test_data/parser/inline/err/method_call_missing_argument_list.rs");
+    }
+    #[test]
+    fn misplaced_label_err() {
+        run_and_expect_errors("test_data/parser/inline/err/misplaced_label_err.rs");
+    }
+    #[test]
+    fn missing_fn_param_type() {
+        run_and_expect_errors("test_data/parser/inline/err/missing_fn_param_type.rs");
+    }
+    #[test]
+    fn pointer_type_no_mutability() {
+        run_and_expect_errors("test_data/parser/inline/err/pointer_type_no_mutability.rs");
+    }
+    #[test]
+    fn pub_expr() { run_and_expect_errors("test_data/parser/inline/err/pub_expr.rs"); }
+    #[test]
+    fn record_literal_before_ellipsis_recovery() {
+        run_and_expect_errors(
+            "test_data/parser/inline/err/record_literal_before_ellipsis_recovery.rs",
+        );
+    }
+    #[test]
+    fn record_literal_field_eq_recovery() {
+        run_and_expect_errors("test_data/parser/inline/err/record_literal_field_eq_recovery.rs");
+    }
+    #[test]
+    fn record_literal_missing_ellipsis_recovery() {
+        run_and_expect_errors(
+            "test_data/parser/inline/err/record_literal_missing_ellipsis_recovery.rs",
+        );
+    }
+    #[test]
+    fn record_pat_field_eq_recovery() {
+        run_and_expect_errors("test_data/parser/inline/err/record_pat_field_eq_recovery.rs");
+    }
+    #[test]
+    fn recover_from_missing_assoc_item_binding() {
+        run_and_expect_errors(
+            "test_data/parser/inline/err/recover_from_missing_assoc_item_binding.rs",
+        );
+    }
+    #[test]
+    fn recover_from_missing_const_default() {
+        run_and_expect_errors("test_data/parser/inline/err/recover_from_missing_const_default.rs");
+    }
+    #[test]
+    fn struct_field_recover() {
+        run_and_expect_errors("test_data/parser/inline/err/struct_field_recover.rs");
+    }
+    #[test]
+    fn top_level_let() { run_and_expect_errors("test_data/parser/inline/err/top_level_let.rs"); }
+    #[test]
+    fn tuple_expr_leading_comma() {
+        run_and_expect_errors("test_data/parser/inline/err/tuple_expr_leading_comma.rs");
+    }
+    #[test]
+    fn tuple_field_list_recovery() {
+        run_and_expect_errors("test_data/parser/inline/err/tuple_field_list_recovery.rs");
+    }
+    #[test]
+    fn tuple_pat_leading_comma() {
+        run_and_expect_errors("test_data/parser/inline/err/tuple_pat_leading_comma.rs");
+    }
+    #[test]
+    fn unsafe_block_in_mod() {
+        run_and_expect_errors("test_data/parser/inline/err/unsafe_block_in_mod.rs");
+    }
+    #[test]
+    fn use_tree_list_err_recovery() {
+        run_and_expect_errors("test_data/parser/inline/err/use_tree_list_err_recovery.rs");
+    }
+}
diff --git a/crates/parser/test_data/parser/inline/err/0016_angled_path_without_qual.rast b/crates/parser/test_data/parser/inline/err/angled_path_without_qual.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/err/0016_angled_path_without_qual.rast
rename to crates/parser/test_data/parser/inline/err/angled_path_without_qual.rast
diff --git a/crates/parser/test_data/parser/inline/err/0016_angled_path_without_qual.rs b/crates/parser/test_data/parser/inline/err/angled_path_without_qual.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/err/0016_angled_path_without_qual.rs
rename to crates/parser/test_data/parser/inline/err/angled_path_without_qual.rs
diff --git a/crates/parser/test_data/parser/inline/err/0013_anonymous_static.rast b/crates/parser/test_data/parser/inline/err/anonymous_static.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/err/0013_anonymous_static.rast
rename to crates/parser/test_data/parser/inline/err/anonymous_static.rast
diff --git a/crates/parser/test_data/parser/inline/err/0013_anonymous_static.rs b/crates/parser/test_data/parser/inline/err/anonymous_static.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/err/0013_anonymous_static.rs
rename to crates/parser/test_data/parser/inline/err/anonymous_static.rs
diff --git a/crates/parser/test_data/parser/inline/err/0015_arg_list_recovery.rast b/crates/parser/test_data/parser/inline/err/arg_list_recovery.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/err/0015_arg_list_recovery.rast
rename to crates/parser/test_data/parser/inline/err/arg_list_recovery.rast
diff --git a/crates/parser/test_data/parser/inline/err/0015_arg_list_recovery.rs b/crates/parser/test_data/parser/inline/err/arg_list_recovery.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/err/0015_arg_list_recovery.rs
rename to crates/parser/test_data/parser/inline/err/arg_list_recovery.rs
diff --git a/crates/parser/test_data/parser/inline/err/0001_array_type_missing_semi.rast b/crates/parser/test_data/parser/inline/err/array_type_missing_semi.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/err/0001_array_type_missing_semi.rast
rename to crates/parser/test_data/parser/inline/err/array_type_missing_semi.rast
diff --git a/crates/parser/test_data/parser/inline/err/0001_array_type_missing_semi.rs b/crates/parser/test_data/parser/inline/err/array_type_missing_semi.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/err/0001_array_type_missing_semi.rs
rename to crates/parser/test_data/parser/inline/err/array_type_missing_semi.rs
diff --git a/crates/parser/test_data/parser/inline/err/0007_async_without_semicolon.rast b/crates/parser/test_data/parser/inline/err/async_without_semicolon.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/err/0007_async_without_semicolon.rast
rename to crates/parser/test_data/parser/inline/err/async_without_semicolon.rast
diff --git a/crates/parser/test_data/parser/inline/err/0007_async_without_semicolon.rs b/crates/parser/test_data/parser/inline/err/async_without_semicolon.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/err/0007_async_without_semicolon.rs
rename to crates/parser/test_data/parser/inline/err/async_without_semicolon.rs
diff --git a/crates/parser/test_data/parser/inline/err/0024_comma_after_functional_update_syntax.rast b/crates/parser/test_data/parser/inline/err/comma_after_functional_update_syntax.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/err/0024_comma_after_functional_update_syntax.rast
rename to crates/parser/test_data/parser/inline/err/comma_after_functional_update_syntax.rast
diff --git a/crates/parser/test_data/parser/inline/err/0024_comma_after_functional_update_syntax.rs b/crates/parser/test_data/parser/inline/err/comma_after_functional_update_syntax.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/err/0024_comma_after_functional_update_syntax.rs
rename to crates/parser/test_data/parser/inline/err/comma_after_functional_update_syntax.rs
diff --git a/crates/parser/test_data/parser/inline/err/0018_crate_visibility_empty_recover.rast b/crates/parser/test_data/parser/inline/err/crate_visibility_empty_recover.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/err/0018_crate_visibility_empty_recover.rast
rename to crates/parser/test_data/parser/inline/err/crate_visibility_empty_recover.rast
diff --git a/crates/parser/test_data/parser/inline/err/0018_crate_visibility_empty_recover.rs b/crates/parser/test_data/parser/inline/err/crate_visibility_empty_recover.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/err/0018_crate_visibility_empty_recover.rs
rename to crates/parser/test_data/parser/inline/err/crate_visibility_empty_recover.rs
diff --git a/crates/parser/test_data/parser/inline/err/0023_empty_param_slot.rast b/crates/parser/test_data/parser/inline/err/empty_param_slot.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/err/0023_empty_param_slot.rast
rename to crates/parser/test_data/parser/inline/err/empty_param_slot.rast
diff --git a/crates/parser/test_data/parser/inline/err/0023_empty_param_slot.rs b/crates/parser/test_data/parser/inline/err/empty_param_slot.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/err/0023_empty_param_slot.rs
rename to crates/parser/test_data/parser/inline/err/empty_param_slot.rs
diff --git a/crates/parser/test_data/parser/inline/err/0015_empty_segment.rast b/crates/parser/test_data/parser/inline/err/empty_segment.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/err/0015_empty_segment.rast
rename to crates/parser/test_data/parser/inline/err/empty_segment.rast
diff --git a/crates/parser/test_data/parser/inline/err/0015_empty_segment.rs b/crates/parser/test_data/parser/inline/err/empty_segment.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/err/0015_empty_segment.rs
rename to crates/parser/test_data/parser/inline/err/empty_segment.rs
diff --git a/crates/parser/test_data/parser/inline/err/0005_fn_pointer_type_missing_fn.rast b/crates/parser/test_data/parser/inline/err/fn_pointer_type_missing_fn.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/err/0005_fn_pointer_type_missing_fn.rast
rename to crates/parser/test_data/parser/inline/err/fn_pointer_type_missing_fn.rast
diff --git a/crates/parser/test_data/parser/inline/err/0005_fn_pointer_type_missing_fn.rs b/crates/parser/test_data/parser/inline/err/fn_pointer_type_missing_fn.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/err/0005_fn_pointer_type_missing_fn.rs
rename to crates/parser/test_data/parser/inline/err/fn_pointer_type_missing_fn.rs
diff --git a/crates/parser/test_data/parser/inline/err/0035_gen_blocks.rast b/crates/parser/test_data/parser/inline/err/gen_blocks.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/err/0035_gen_blocks.rast
rename to crates/parser/test_data/parser/inline/err/gen_blocks.rast
diff --git a/crates/parser/test_data/parser/inline/err/0035_gen_blocks.rs b/crates/parser/test_data/parser/inline/err/gen_blocks.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/err/0035_gen_blocks.rs
rename to crates/parser/test_data/parser/inline/err/gen_blocks.rs
diff --git a/crates/parser/test_data/parser/inline/err/0036_gen_fn.rast b/crates/parser/test_data/parser/inline/err/gen_fn.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/err/0036_gen_fn.rast
rename to crates/parser/test_data/parser/inline/err/gen_fn.rast
diff --git a/crates/parser/test_data/parser/inline/err/0036_gen_fn.rs b/crates/parser/test_data/parser/inline/err/gen_fn.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/err/0036_gen_fn.rs
rename to crates/parser/test_data/parser/inline/err/gen_fn.rs
diff --git a/crates/parser/test_data/parser/inline/err/0030_generic_arg_list_recover.rast b/crates/parser/test_data/parser/inline/err/generic_arg_list_recover.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/err/0030_generic_arg_list_recover.rast
rename to crates/parser/test_data/parser/inline/err/generic_arg_list_recover.rast
diff --git a/crates/parser/test_data/parser/inline/err/0030_generic_arg_list_recover.rs b/crates/parser/test_data/parser/inline/err/generic_arg_list_recover.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/err/0030_generic_arg_list_recover.rs
rename to crates/parser/test_data/parser/inline/err/generic_arg_list_recover.rs
diff --git a/crates/parser/test_data/parser/inline/err/0031_generic_param_list_recover.rast b/crates/parser/test_data/parser/inline/err/generic_param_list_recover.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/err/0031_generic_param_list_recover.rast
rename to crates/parser/test_data/parser/inline/err/generic_param_list_recover.rast
diff --git a/crates/parser/test_data/parser/inline/err/0031_generic_param_list_recover.rs b/crates/parser/test_data/parser/inline/err/generic_param_list_recover.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/err/0031_generic_param_list_recover.rs
rename to crates/parser/test_data/parser/inline/err/generic_param_list_recover.rs
diff --git a/crates/parser/test_data/parser/inline/err/0004_impl_type.rast b/crates/parser/test_data/parser/inline/err/impl_type.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/err/0004_impl_type.rast
rename to crates/parser/test_data/parser/inline/err/impl_type.rast
diff --git a/crates/parser/test_data/parser/inline/err/0004_impl_type.rs b/crates/parser/test_data/parser/inline/err/impl_type.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/err/0004_impl_type.rs
rename to crates/parser/test_data/parser/inline/err/impl_type.rs
diff --git a/crates/parser/test_data/parser/inline/err/0017_let_else_right_curly_brace.rast b/crates/parser/test_data/parser/inline/err/let_else_right_curly_brace.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/err/0017_let_else_right_curly_brace.rast
rename to crates/parser/test_data/parser/inline/err/let_else_right_curly_brace.rast
diff --git a/crates/parser/test_data/parser/inline/err/0017_let_else_right_curly_brace.rs b/crates/parser/test_data/parser/inline/err/let_else_right_curly_brace.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/err/0017_let_else_right_curly_brace.rs
rename to crates/parser/test_data/parser/inline/err/let_else_right_curly_brace.rs
diff --git a/crates/parser/test_data/parser/inline/err/0026_macro_rules_as_macro_name.rast b/crates/parser/test_data/parser/inline/err/macro_rules_as_macro_name.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/err/0026_macro_rules_as_macro_name.rast
rename to crates/parser/test_data/parser/inline/err/macro_rules_as_macro_name.rast
diff --git a/crates/parser/test_data/parser/inline/err/0026_macro_rules_as_macro_name.rs b/crates/parser/test_data/parser/inline/err/macro_rules_as_macro_name.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/err/0026_macro_rules_as_macro_name.rs
rename to crates/parser/test_data/parser/inline/err/macro_rules_as_macro_name.rs
diff --git a/crates/parser/test_data/parser/inline/err/0034_match_arms_recovery.rast b/crates/parser/test_data/parser/inline/err/match_arms_recovery.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/err/0034_match_arms_recovery.rast
rename to crates/parser/test_data/parser/inline/err/match_arms_recovery.rast
diff --git a/crates/parser/test_data/parser/inline/err/0034_match_arms_recovery.rs b/crates/parser/test_data/parser/inline/err/match_arms_recovery.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/err/0034_match_arms_recovery.rs
rename to crates/parser/test_data/parser/inline/err/match_arms_recovery.rs
diff --git a/crates/parser/test_data/parser/inline/err/0028_method_call_missing_argument_list.rast b/crates/parser/test_data/parser/inline/err/method_call_missing_argument_list.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/err/0028_method_call_missing_argument_list.rast
rename to crates/parser/test_data/parser/inline/err/method_call_missing_argument_list.rast
diff --git a/crates/parser/test_data/parser/inline/err/0028_method_call_missing_argument_list.rs b/crates/parser/test_data/parser/inline/err/method_call_missing_argument_list.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/err/0028_method_call_missing_argument_list.rs
rename to crates/parser/test_data/parser/inline/err/method_call_missing_argument_list.rs
diff --git a/crates/parser/test_data/parser/inline/err/0002_misplaced_label_err.rast b/crates/parser/test_data/parser/inline/err/misplaced_label_err.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/err/0002_misplaced_label_err.rast
rename to crates/parser/test_data/parser/inline/err/misplaced_label_err.rast
diff --git a/crates/parser/test_data/parser/inline/err/0002_misplaced_label_err.rs b/crates/parser/test_data/parser/inline/err/misplaced_label_err.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/err/0002_misplaced_label_err.rs
rename to crates/parser/test_data/parser/inline/err/misplaced_label_err.rs
diff --git a/crates/parser/test_data/parser/inline/err/0015_missing_fn_param_type.rast b/crates/parser/test_data/parser/inline/err/missing_fn_param_type.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/err/0015_missing_fn_param_type.rast
rename to crates/parser/test_data/parser/inline/err/missing_fn_param_type.rast
diff --git a/crates/parser/test_data/parser/inline/err/0015_missing_fn_param_type.rs b/crates/parser/test_data/parser/inline/err/missing_fn_param_type.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/err/0015_missing_fn_param_type.rs
rename to crates/parser/test_data/parser/inline/err/missing_fn_param_type.rs
diff --git a/crates/parser/test_data/parser/inline/err/0003_pointer_type_no_mutability.rast b/crates/parser/test_data/parser/inline/err/pointer_type_no_mutability.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/err/0003_pointer_type_no_mutability.rast
rename to crates/parser/test_data/parser/inline/err/pointer_type_no_mutability.rast
diff --git a/crates/parser/test_data/parser/inline/err/0003_pointer_type_no_mutability.rs b/crates/parser/test_data/parser/inline/err/pointer_type_no_mutability.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/err/0003_pointer_type_no_mutability.rs
rename to crates/parser/test_data/parser/inline/err/pointer_type_no_mutability.rs
diff --git a/crates/parser/test_data/parser/inline/err/0008_pub_expr.rast b/crates/parser/test_data/parser/inline/err/pub_expr.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/err/0008_pub_expr.rast
rename to crates/parser/test_data/parser/inline/err/pub_expr.rast
diff --git a/crates/parser/test_data/parser/inline/err/0008_pub_expr.rs b/crates/parser/test_data/parser/inline/err/pub_expr.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/err/0008_pub_expr.rs
rename to crates/parser/test_data/parser/inline/err/pub_expr.rs
diff --git a/crates/parser/test_data/parser/inline/err/0014_record_literal_before_ellipsis_recovery.rast b/crates/parser/test_data/parser/inline/err/record_literal_before_ellipsis_recovery.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/err/0014_record_literal_before_ellipsis_recovery.rast
rename to crates/parser/test_data/parser/inline/err/record_literal_before_ellipsis_recovery.rast
diff --git a/crates/parser/test_data/parser/inline/err/0014_record_literal_before_ellipsis_recovery.rs b/crates/parser/test_data/parser/inline/err/record_literal_before_ellipsis_recovery.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/err/0014_record_literal_before_ellipsis_recovery.rs
rename to crates/parser/test_data/parser/inline/err/record_literal_before_ellipsis_recovery.rs
diff --git a/crates/parser/test_data/parser/inline/err/0032_record_literal_field_eq_recovery.rast b/crates/parser/test_data/parser/inline/err/record_literal_field_eq_recovery.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/err/0032_record_literal_field_eq_recovery.rast
rename to crates/parser/test_data/parser/inline/err/record_literal_field_eq_recovery.rast
diff --git a/crates/parser/test_data/parser/inline/err/0032_record_literal_field_eq_recovery.rs b/crates/parser/test_data/parser/inline/err/record_literal_field_eq_recovery.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/err/0032_record_literal_field_eq_recovery.rs
rename to crates/parser/test_data/parser/inline/err/record_literal_field_eq_recovery.rs
diff --git a/crates/parser/test_data/parser/inline/err/0014_record_literal_missing_ellipsis_recovery.rast b/crates/parser/test_data/parser/inline/err/record_literal_missing_ellipsis_recovery.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/err/0014_record_literal_missing_ellipsis_recovery.rast
rename to crates/parser/test_data/parser/inline/err/record_literal_missing_ellipsis_recovery.rast
diff --git a/crates/parser/test_data/parser/inline/err/0014_record_literal_missing_ellipsis_recovery.rs b/crates/parser/test_data/parser/inline/err/record_literal_missing_ellipsis_recovery.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/err/0014_record_literal_missing_ellipsis_recovery.rs
rename to crates/parser/test_data/parser/inline/err/record_literal_missing_ellipsis_recovery.rs
diff --git a/crates/parser/test_data/parser/inline/err/0033_record_pat_field_eq_recovery.rast b/crates/parser/test_data/parser/inline/err/record_pat_field_eq_recovery.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/err/0033_record_pat_field_eq_recovery.rast
rename to crates/parser/test_data/parser/inline/err/record_pat_field_eq_recovery.rast
diff --git a/crates/parser/test_data/parser/inline/err/0033_record_pat_field_eq_recovery.rs b/crates/parser/test_data/parser/inline/err/record_pat_field_eq_recovery.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/err/0033_record_pat_field_eq_recovery.rs
rename to crates/parser/test_data/parser/inline/err/record_pat_field_eq_recovery.rs
diff --git a/crates/parser/test_data/parser/inline/err/0021_recover_from_missing_assoc_item_binding.rast b/crates/parser/test_data/parser/inline/err/recover_from_missing_assoc_item_binding.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/err/0021_recover_from_missing_assoc_item_binding.rast
rename to crates/parser/test_data/parser/inline/err/recover_from_missing_assoc_item_binding.rast
diff --git a/crates/parser/test_data/parser/inline/err/0021_recover_from_missing_assoc_item_binding.rs b/crates/parser/test_data/parser/inline/err/recover_from_missing_assoc_item_binding.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/err/0021_recover_from_missing_assoc_item_binding.rs
rename to crates/parser/test_data/parser/inline/err/recover_from_missing_assoc_item_binding.rs
diff --git a/crates/parser/test_data/parser/inline/err/0022_recover_from_missing_const_default.rast b/crates/parser/test_data/parser/inline/err/recover_from_missing_const_default.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/err/0022_recover_from_missing_const_default.rast
rename to crates/parser/test_data/parser/inline/err/recover_from_missing_const_default.rast
diff --git a/crates/parser/test_data/parser/inline/err/0022_recover_from_missing_const_default.rs b/crates/parser/test_data/parser/inline/err/recover_from_missing_const_default.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/err/0022_recover_from_missing_const_default.rs
rename to crates/parser/test_data/parser/inline/err/recover_from_missing_const_default.rs
diff --git a/crates/parser/test_data/parser/inline/err/0014_struct_field_recover.rast b/crates/parser/test_data/parser/inline/err/struct_field_recover.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/err/0014_struct_field_recover.rast
rename to crates/parser/test_data/parser/inline/err/struct_field_recover.rast
diff --git a/crates/parser/test_data/parser/inline/err/0014_struct_field_recover.rs b/crates/parser/test_data/parser/inline/err/struct_field_recover.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/err/0014_struct_field_recover.rs
rename to crates/parser/test_data/parser/inline/err/struct_field_recover.rs
diff --git a/crates/parser/test_data/parser/inline/err/0024_top_level_let.rast b/crates/parser/test_data/parser/inline/err/top_level_let.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/err/0024_top_level_let.rast
rename to crates/parser/test_data/parser/inline/err/top_level_let.rast
diff --git a/crates/parser/test_data/parser/inline/err/0024_top_level_let.rs b/crates/parser/test_data/parser/inline/err/top_level_let.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/err/0024_top_level_let.rs
rename to crates/parser/test_data/parser/inline/err/top_level_let.rs
diff --git a/crates/parser/test_data/parser/inline/err/0019_tuple_expr_leading_comma.rast b/crates/parser/test_data/parser/inline/err/tuple_expr_leading_comma.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/err/0019_tuple_expr_leading_comma.rast
rename to crates/parser/test_data/parser/inline/err/tuple_expr_leading_comma.rast
diff --git a/crates/parser/test_data/parser/inline/err/0019_tuple_expr_leading_comma.rs b/crates/parser/test_data/parser/inline/err/tuple_expr_leading_comma.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/err/0019_tuple_expr_leading_comma.rs
rename to crates/parser/test_data/parser/inline/err/tuple_expr_leading_comma.rs
diff --git a/crates/parser/test_data/parser/inline/err/0029_tuple_field_list_recovery.rast b/crates/parser/test_data/parser/inline/err/tuple_field_list_recovery.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/err/0029_tuple_field_list_recovery.rast
rename to crates/parser/test_data/parser/inline/err/tuple_field_list_recovery.rast
diff --git a/crates/parser/test_data/parser/inline/err/0029_tuple_field_list_recovery.rs b/crates/parser/test_data/parser/inline/err/tuple_field_list_recovery.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/err/0029_tuple_field_list_recovery.rs
rename to crates/parser/test_data/parser/inline/err/tuple_field_list_recovery.rs
diff --git a/crates/parser/test_data/parser/inline/err/0020_tuple_pat_leading_comma.rast b/crates/parser/test_data/parser/inline/err/tuple_pat_leading_comma.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/err/0020_tuple_pat_leading_comma.rast
rename to crates/parser/test_data/parser/inline/err/tuple_pat_leading_comma.rast
diff --git a/crates/parser/test_data/parser/inline/err/0020_tuple_pat_leading_comma.rs b/crates/parser/test_data/parser/inline/err/tuple_pat_leading_comma.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/err/0020_tuple_pat_leading_comma.rs
rename to crates/parser/test_data/parser/inline/err/tuple_pat_leading_comma.rs
diff --git a/crates/parser/test_data/parser/inline/err/0006_unsafe_block_in_mod.rast b/crates/parser/test_data/parser/inline/err/unsafe_block_in_mod.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/err/0006_unsafe_block_in_mod.rast
rename to crates/parser/test_data/parser/inline/err/unsafe_block_in_mod.rast
diff --git a/crates/parser/test_data/parser/inline/err/0006_unsafe_block_in_mod.rs b/crates/parser/test_data/parser/inline/err/unsafe_block_in_mod.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/err/0006_unsafe_block_in_mod.rs
rename to crates/parser/test_data/parser/inline/err/unsafe_block_in_mod.rs
diff --git a/crates/parser/test_data/parser/inline/err/0026_use_tree_list_err_recovery.rast b/crates/parser/test_data/parser/inline/err/use_tree_list_err_recovery.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/err/0026_use_tree_list_err_recovery.rast
rename to crates/parser/test_data/parser/inline/err/use_tree_list_err_recovery.rast
diff --git a/crates/parser/test_data/parser/inline/err/0026_use_tree_list_err_recovery.rs b/crates/parser/test_data/parser/inline/err/use_tree_list_err_recovery.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/err/0026_use_tree_list_err_recovery.rs
rename to crates/parser/test_data/parser/inline/err/use_tree_list_err_recovery.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0083_struct_items.rast b/crates/parser/test_data/parser/inline/ok/0083_struct_items.rast
deleted file mode 100644
index cdbc40fe0b..0000000000
--- a/crates/parser/test_data/parser/inline/ok/0083_struct_items.rast
+++ /dev/null
@@ -1,87 +0,0 @@
-SOURCE_FILE@0..106
-  STRUCT@0..11
-    STRUCT_KW@0..6 "struct"
-    WHITESPACE@6..7 " "
-    NAME@7..10
-      IDENT@7..10 "Foo"
-    SEMICOLON@10..11 ";"
-  WHITESPACE@11..12 "\n"
-  STRUCT@12..25
-    STRUCT_KW@12..18 "struct"
-    WHITESPACE@18..19 " "
-    NAME@19..22
-      IDENT@19..22 "Foo"
-    WHITESPACE@22..23 " "
-    RECORD_FIELD_LIST@23..25
-      L_CURLY@23..24 "{"
-      R_CURLY@24..25 "}"
-  WHITESPACE@25..26 "\n"
-  STRUCT@26..39
-    STRUCT_KW@26..32 "struct"
-    WHITESPACE@32..33 " "
-    NAME@33..36
-      IDENT@33..36 "Foo"
-    TUPLE_FIELD_LIST@36..38
-      L_PAREN@36..37 "("
-      R_PAREN@37..38 ")"
-    SEMICOLON@38..39 ";"
-  WHITESPACE@39..40 "\n"
-  STRUCT@40..66
-    STRUCT_KW@40..46 "struct"
-    WHITESPACE@46..47 " "
-    NAME@47..50
-      IDENT@47..50 "Foo"
-    TUPLE_FIELD_LIST@50..65
-      L_PAREN@50..51 "("
-      TUPLE_FIELD@51..57
-        PATH_TYPE@51..57
-          PATH@51..57
-            PATH_SEGMENT@51..57
-              NAME_REF@51..57
-                IDENT@51..57 "String"
-      COMMA@57..58 ","
-      WHITESPACE@58..59 " "
-      TUPLE_FIELD@59..64
-        PATH_TYPE@59..64
-          PATH@59..64
-            PATH_SEGMENT@59..64
-              NAME_REF@59..64
-                IDENT@59..64 "usize"
-      R_PAREN@64..65 ")"
-    SEMICOLON@65..66 ";"
-  WHITESPACE@66..67 "\n"
-  STRUCT@67..105
-    STRUCT_KW@67..73 "struct"
-    WHITESPACE@73..74 " "
-    NAME@74..77
-      IDENT@74..77 "Foo"
-    WHITESPACE@77..78 " "
-    RECORD_FIELD_LIST@78..105
-      L_CURLY@78..79 "{"
-      WHITESPACE@79..84 "\n    "
-      RECORD_FIELD@84..90
-        NAME@84..85
-          IDENT@84..85 "a"
-        COLON@85..86 ":"
-        WHITESPACE@86..87 " "
-        PATH_TYPE@87..90
-          PATH@87..90
-            PATH_SEGMENT@87..90
-              NAME_REF@87..90
-                IDENT@87..90 "i32"
-      COMMA@90..91 ","
-      WHITESPACE@91..96 "\n    "
-      RECORD_FIELD@96..102
-        NAME@96..97
-          IDENT@96..97 "b"
-        COLON@97..98 ":"
-        WHITESPACE@98..99 " "
-        PATH_TYPE@99..102
-          PATH@99..102
-            PATH_SEGMENT@99..102
-              NAME_REF@99..102
-                IDENT@99..102 "f32"
-      COMMA@102..103 ","
-      WHITESPACE@103..104 "\n"
-      R_CURLY@104..105 "}"
-  WHITESPACE@105..106 "\n"
diff --git a/crates/parser/test_data/parser/inline/ok/0173_anonymous_const.rast b/crates/parser/test_data/parser/inline/ok/anonymous_const.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0173_anonymous_const.rast
rename to crates/parser/test_data/parser/inline/ok/anonymous_const.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0173_anonymous_const.rs b/crates/parser/test_data/parser/inline/ok/anonymous_const.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0173_anonymous_const.rs
rename to crates/parser/test_data/parser/inline/ok/anonymous_const.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0018_arb_self_types.rast b/crates/parser/test_data/parser/inline/ok/arb_self_types.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0018_arb_self_types.rast
rename to crates/parser/test_data/parser/inline/ok/arb_self_types.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0018_arb_self_types.rs b/crates/parser/test_data/parser/inline/ok/arb_self_types.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0018_arb_self_types.rs
rename to crates/parser/test_data/parser/inline/ok/arb_self_types.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0152_arg_with_attr.rast b/crates/parser/test_data/parser/inline/ok/arg_with_attr.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0152_arg_with_attr.rast
rename to crates/parser/test_data/parser/inline/ok/arg_with_attr.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0152_arg_with_attr.rs b/crates/parser/test_data/parser/inline/ok/arg_with_attr.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0152_arg_with_attr.rs
rename to crates/parser/test_data/parser/inline/ok/arg_with_attr.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0150_array_attrs.rast b/crates/parser/test_data/parser/inline/ok/array_attrs.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0150_array_attrs.rast
rename to crates/parser/test_data/parser/inline/ok/array_attrs.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0150_array_attrs.rs b/crates/parser/test_data/parser/inline/ok/array_attrs.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0150_array_attrs.rs
rename to crates/parser/test_data/parser/inline/ok/array_attrs.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0103_array_expr.rast b/crates/parser/test_data/parser/inline/ok/array_expr.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0103_array_expr.rast
rename to crates/parser/test_data/parser/inline/ok/array_expr.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0103_array_expr.rs b/crates/parser/test_data/parser/inline/ok/array_expr.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0103_array_expr.rs
rename to crates/parser/test_data/parser/inline/ok/array_expr.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0017_array_type.rast b/crates/parser/test_data/parser/inline/ok/array_type.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0017_array_type.rast
rename to crates/parser/test_data/parser/inline/ok/array_type.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0017_array_type.rs b/crates/parser/test_data/parser/inline/ok/array_type.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0017_array_type.rs
rename to crates/parser/test_data/parser/inline/ok/array_type.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0146_as_precedence.rast b/crates/parser/test_data/parser/inline/ok/as_precedence.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0146_as_precedence.rast
rename to crates/parser/test_data/parser/inline/ok/as_precedence.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0146_as_precedence.rs b/crates/parser/test_data/parser/inline/ok/as_precedence.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0146_as_precedence.rs
rename to crates/parser/test_data/parser/inline/ok/as_precedence.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0200_assoc_const_eq.rast b/crates/parser/test_data/parser/inline/ok/assoc_const_eq.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0200_assoc_const_eq.rast
rename to crates/parser/test_data/parser/inline/ok/assoc_const_eq.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0200_assoc_const_eq.rs b/crates/parser/test_data/parser/inline/ok/assoc_const_eq.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0200_assoc_const_eq.rs
rename to crates/parser/test_data/parser/inline/ok/assoc_const_eq.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0021_assoc_item_list.rast b/crates/parser/test_data/parser/inline/ok/assoc_item_list.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0021_assoc_item_list.rast
rename to crates/parser/test_data/parser/inline/ok/assoc_item_list.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0021_assoc_item_list.rs b/crates/parser/test_data/parser/inline/ok/assoc_item_list.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0021_assoc_item_list.rs
rename to crates/parser/test_data/parser/inline/ok/assoc_item_list.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0177_assoc_item_list_inner_attrs.rast b/crates/parser/test_data/parser/inline/ok/assoc_item_list_inner_attrs.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0177_assoc_item_list_inner_attrs.rast
rename to crates/parser/test_data/parser/inline/ok/assoc_item_list_inner_attrs.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0177_assoc_item_list_inner_attrs.rs b/crates/parser/test_data/parser/inline/ok/assoc_item_list_inner_attrs.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0177_assoc_item_list_inner_attrs.rs
rename to crates/parser/test_data/parser/inline/ok/assoc_item_list_inner_attrs.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0185_assoc_type_bound.rast b/crates/parser/test_data/parser/inline/ok/assoc_type_bound.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0185_assoc_type_bound.rast
rename to crates/parser/test_data/parser/inline/ok/assoc_type_bound.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0185_assoc_type_bound.rs b/crates/parser/test_data/parser/inline/ok/assoc_type_bound.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0185_assoc_type_bound.rs
rename to crates/parser/test_data/parser/inline/ok/assoc_type_bound.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0187_assoc_type_eq.rast b/crates/parser/test_data/parser/inline/ok/assoc_type_eq.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0187_assoc_type_eq.rast
rename to crates/parser/test_data/parser/inline/ok/assoc_type_eq.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0187_assoc_type_eq.rs b/crates/parser/test_data/parser/inline/ok/assoc_type_eq.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0187_assoc_type_eq.rs
rename to crates/parser/test_data/parser/inline/ok/assoc_type_eq.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0208_associated_return_type_bounds.rast b/crates/parser/test_data/parser/inline/ok/associated_return_type_bounds.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0208_associated_return_type_bounds.rast
rename to crates/parser/test_data/parser/inline/ok/associated_return_type_bounds.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0208_associated_return_type_bounds.rs b/crates/parser/test_data/parser/inline/ok/associated_return_type_bounds.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0208_associated_return_type_bounds.rs
rename to crates/parser/test_data/parser/inline/ok/associated_return_type_bounds.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0138_associated_type_bounds.rast b/crates/parser/test_data/parser/inline/ok/associated_type_bounds.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0138_associated_type_bounds.rast
rename to crates/parser/test_data/parser/inline/ok/associated_type_bounds.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0138_associated_type_bounds.rs b/crates/parser/test_data/parser/inline/ok/associated_type_bounds.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0138_associated_type_bounds.rs
rename to crates/parser/test_data/parser/inline/ok/associated_type_bounds.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0211_async_trait_bound.rast b/crates/parser/test_data/parser/inline/ok/async_trait_bound.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0211_async_trait_bound.rast
rename to crates/parser/test_data/parser/inline/ok/async_trait_bound.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0211_async_trait_bound.rs b/crates/parser/test_data/parser/inline/ok/async_trait_bound.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0211_async_trait_bound.rs
rename to crates/parser/test_data/parser/inline/ok/async_trait_bound.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0126_attr_on_expr_stmt.rast b/crates/parser/test_data/parser/inline/ok/attr_on_expr_stmt.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0126_attr_on_expr_stmt.rast
rename to crates/parser/test_data/parser/inline/ok/attr_on_expr_stmt.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0126_attr_on_expr_stmt.rs b/crates/parser/test_data/parser/inline/ok/attr_on_expr_stmt.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0126_attr_on_expr_stmt.rs
rename to crates/parser/test_data/parser/inline/ok/attr_on_expr_stmt.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0137_await_expr.rast b/crates/parser/test_data/parser/inline/ok/await_expr.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0137_await_expr.rast
rename to crates/parser/test_data/parser/inline/ok/await_expr.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0137_await_expr.rs b/crates/parser/test_data/parser/inline/ok/await_expr.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0137_await_expr.rs
rename to crates/parser/test_data/parser/inline/ok/await_expr.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0208_bare_dyn_types_with_leading_lifetime.rast b/crates/parser/test_data/parser/inline/ok/bare_dyn_types_with_leading_lifetime.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0208_bare_dyn_types_with_leading_lifetime.rast
rename to crates/parser/test_data/parser/inline/ok/bare_dyn_types_with_leading_lifetime.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0208_bare_dyn_types_with_leading_lifetime.rs b/crates/parser/test_data/parser/inline/ok/bare_dyn_types_with_leading_lifetime.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0208_bare_dyn_types_with_leading_lifetime.rs
rename to crates/parser/test_data/parser/inline/ok/bare_dyn_types_with_leading_lifetime.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0209_bare_dyn_types_with_paren_as_generic_args.rast b/crates/parser/test_data/parser/inline/ok/bare_dyn_types_with_paren_as_generic_args.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0209_bare_dyn_types_with_paren_as_generic_args.rast
rename to crates/parser/test_data/parser/inline/ok/bare_dyn_types_with_paren_as_generic_args.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0209_bare_dyn_types_with_paren_as_generic_args.rs b/crates/parser/test_data/parser/inline/ok/bare_dyn_types_with_paren_as_generic_args.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0209_bare_dyn_types_with_paren_as_generic_args.rs
rename to crates/parser/test_data/parser/inline/ok/bare_dyn_types_with_paren_as_generic_args.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0209_become_expr.rast b/crates/parser/test_data/parser/inline/ok/become_expr.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0209_become_expr.rast
rename to crates/parser/test_data/parser/inline/ok/become_expr.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0209_become_expr.rs b/crates/parser/test_data/parser/inline/ok/become_expr.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0209_become_expr.rs
rename to crates/parser/test_data/parser/inline/ok/become_expr.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0112_bind_pat.rast b/crates/parser/test_data/parser/inline/ok/bind_pat.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0112_bind_pat.rast
rename to crates/parser/test_data/parser/inline/ok/bind_pat.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0112_bind_pat.rs b/crates/parser/test_data/parser/inline/ok/bind_pat.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0112_bind_pat.rs
rename to crates/parser/test_data/parser/inline/ok/bind_pat.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0158_binop_resets_statementness.rast b/crates/parser/test_data/parser/inline/ok/binop_resets_statementness.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0158_binop_resets_statementness.rast
rename to crates/parser/test_data/parser/inline/ok/binop_resets_statementness.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0158_binop_resets_statementness.rs b/crates/parser/test_data/parser/inline/ok/binop_resets_statementness.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0158_binop_resets_statementness.rs
rename to crates/parser/test_data/parser/inline/ok/binop_resets_statementness.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0075_block.rast b/crates/parser/test_data/parser/inline/ok/block.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0075_block.rast
rename to crates/parser/test_data/parser/inline/ok/block.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0075_block.rs b/crates/parser/test_data/parser/inline/ok/block.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0075_block.rs
rename to crates/parser/test_data/parser/inline/ok/block.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0044_block_items.rast b/crates/parser/test_data/parser/inline/ok/block_items.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0044_block_items.rast
rename to crates/parser/test_data/parser/inline/ok/block_items.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0044_block_items.rs b/crates/parser/test_data/parser/inline/ok/block_items.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0044_block_items.rs
rename to crates/parser/test_data/parser/inline/ok/block_items.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0143_box_pat.rast b/crates/parser/test_data/parser/inline/ok/box_pat.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0143_box_pat.rast
rename to crates/parser/test_data/parser/inline/ok/box_pat.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0143_box_pat.rs b/crates/parser/test_data/parser/inline/ok/box_pat.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0143_box_pat.rs
rename to crates/parser/test_data/parser/inline/ok/box_pat.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0088_break_ambiguity.rast b/crates/parser/test_data/parser/inline/ok/break_ambiguity.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0088_break_ambiguity.rast
rename to crates/parser/test_data/parser/inline/ok/break_ambiguity.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0088_break_ambiguity.rs b/crates/parser/test_data/parser/inline/ok/break_ambiguity.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0088_break_ambiguity.rs
rename to crates/parser/test_data/parser/inline/ok/break_ambiguity.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0034_break_expr.rast b/crates/parser/test_data/parser/inline/ok/break_expr.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0034_break_expr.rast
rename to crates/parser/test_data/parser/inline/ok/break_expr.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0034_break_expr.rs b/crates/parser/test_data/parser/inline/ok/break_expr.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0034_break_expr.rs
rename to crates/parser/test_data/parser/inline/ok/break_expr.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0207_builtin_expr.rast b/crates/parser/test_data/parser/inline/ok/builtin_expr.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0207_builtin_expr.rast
rename to crates/parser/test_data/parser/inline/ok/builtin_expr.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0207_builtin_expr.rs b/crates/parser/test_data/parser/inline/ok/builtin_expr.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0207_builtin_expr.rs
rename to crates/parser/test_data/parser/inline/ok/builtin_expr.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0042_call_expr.rast b/crates/parser/test_data/parser/inline/ok/call_expr.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0042_call_expr.rast
rename to crates/parser/test_data/parser/inline/ok/call_expr.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0042_call_expr.rs b/crates/parser/test_data/parser/inline/ok/call_expr.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0042_call_expr.rs
rename to crates/parser/test_data/parser/inline/ok/call_expr.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0029_cast_expr.rast b/crates/parser/test_data/parser/inline/ok/cast_expr.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0029_cast_expr.rast
rename to crates/parser/test_data/parser/inline/ok/cast_expr.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0029_cast_expr.rs b/crates/parser/test_data/parser/inline/ok/cast_expr.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0029_cast_expr.rs
rename to crates/parser/test_data/parser/inline/ok/cast_expr.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0203_closure_body_underscore_assignment.rast b/crates/parser/test_data/parser/inline/ok/closure_body_underscore_assignment.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0203_closure_body_underscore_assignment.rast
rename to crates/parser/test_data/parser/inline/ok/closure_body_underscore_assignment.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0203_closure_body_underscore_assignment.rs b/crates/parser/test_data/parser/inline/ok/closure_body_underscore_assignment.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0203_closure_body_underscore_assignment.rs
rename to crates/parser/test_data/parser/inline/ok/closure_body_underscore_assignment.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0155_closure_params.rast b/crates/parser/test_data/parser/inline/ok/closure_params.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0155_closure_params.rast
rename to crates/parser/test_data/parser/inline/ok/closure_params.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0155_closure_params.rs b/crates/parser/test_data/parser/inline/ok/closure_params.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0155_closure_params.rs
rename to crates/parser/test_data/parser/inline/ok/closure_params.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0208_closure_range_method_call.rast b/crates/parser/test_data/parser/inline/ok/closure_range_method_call.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0208_closure_range_method_call.rast
rename to crates/parser/test_data/parser/inline/ok/closure_range_method_call.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0208_closure_range_method_call.rs b/crates/parser/test_data/parser/inline/ok/closure_range_method_call.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0208_closure_range_method_call.rs
rename to crates/parser/test_data/parser/inline/ok/closure_range_method_call.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0184_const_arg.rast b/crates/parser/test_data/parser/inline/ok/const_arg.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0184_const_arg.rast
rename to crates/parser/test_data/parser/inline/ok/const_arg.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0184_const_arg.rs b/crates/parser/test_data/parser/inline/ok/const_arg.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0184_const_arg.rs
rename to crates/parser/test_data/parser/inline/ok/const_arg.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0183_const_arg_block.rast b/crates/parser/test_data/parser/inline/ok/const_arg_block.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0183_const_arg_block.rast
rename to crates/parser/test_data/parser/inline/ok/const_arg_block.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0183_const_arg_block.rs b/crates/parser/test_data/parser/inline/ok/const_arg_block.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0183_const_arg_block.rs
rename to crates/parser/test_data/parser/inline/ok/const_arg_block.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0192_const_arg_bool_literal.rast b/crates/parser/test_data/parser/inline/ok/const_arg_bool_literal.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0192_const_arg_bool_literal.rast
rename to crates/parser/test_data/parser/inline/ok/const_arg_bool_literal.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0192_const_arg_bool_literal.rs b/crates/parser/test_data/parser/inline/ok/const_arg_bool_literal.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0192_const_arg_bool_literal.rs
rename to crates/parser/test_data/parser/inline/ok/const_arg_bool_literal.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0189_const_arg_literal.rast b/crates/parser/test_data/parser/inline/ok/const_arg_literal.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0189_const_arg_literal.rast
rename to crates/parser/test_data/parser/inline/ok/const_arg_literal.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0189_const_arg_literal.rs b/crates/parser/test_data/parser/inline/ok/const_arg_literal.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0189_const_arg_literal.rs
rename to crates/parser/test_data/parser/inline/ok/const_arg_literal.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0191_const_arg_negative_number.rast b/crates/parser/test_data/parser/inline/ok/const_arg_negative_number.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0191_const_arg_negative_number.rast
rename to crates/parser/test_data/parser/inline/ok/const_arg_negative_number.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0191_const_arg_negative_number.rs b/crates/parser/test_data/parser/inline/ok/const_arg_negative_number.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0191_const_arg_negative_number.rs
rename to crates/parser/test_data/parser/inline/ok/const_arg_negative_number.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0156_const_block_pat.rast b/crates/parser/test_data/parser/inline/ok/const_block_pat.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0156_const_block_pat.rast
rename to crates/parser/test_data/parser/inline/ok/const_block_pat.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0156_const_block_pat.rs b/crates/parser/test_data/parser/inline/ok/const_block_pat.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0156_const_block_pat.rs
rename to crates/parser/test_data/parser/inline/ok/const_block_pat.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0205_const_closure.rast b/crates/parser/test_data/parser/inline/ok/const_closure.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0205_const_closure.rast
rename to crates/parser/test_data/parser/inline/ok/const_closure.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0205_const_closure.rs b/crates/parser/test_data/parser/inline/ok/const_closure.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0205_const_closure.rs
rename to crates/parser/test_data/parser/inline/ok/const_closure.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0172_const_item.rast b/crates/parser/test_data/parser/inline/ok/const_item.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0172_const_item.rast
rename to crates/parser/test_data/parser/inline/ok/const_item.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0172_const_item.rs b/crates/parser/test_data/parser/inline/ok/const_item.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0172_const_item.rs
rename to crates/parser/test_data/parser/inline/ok/const_item.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0147_const_param.rast b/crates/parser/test_data/parser/inline/ok/const_param.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0147_const_param.rast
rename to crates/parser/test_data/parser/inline/ok/const_param.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0147_const_param.rs b/crates/parser/test_data/parser/inline/ok/const_param.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0147_const_param.rs
rename to crates/parser/test_data/parser/inline/ok/const_param.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0199_const_param_default_expression.rast b/crates/parser/test_data/parser/inline/ok/const_param_default_expression.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0199_const_param_default_expression.rast
rename to crates/parser/test_data/parser/inline/ok/const_param_default_expression.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0199_const_param_default_expression.rs b/crates/parser/test_data/parser/inline/ok/const_param_default_expression.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0199_const_param_default_expression.rs
rename to crates/parser/test_data/parser/inline/ok/const_param_default_expression.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0200_const_param_default_literal.rast b/crates/parser/test_data/parser/inline/ok/const_param_default_literal.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0200_const_param_default_literal.rast
rename to crates/parser/test_data/parser/inline/ok/const_param_default_literal.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0200_const_param_default_literal.rs b/crates/parser/test_data/parser/inline/ok/const_param_default_literal.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0200_const_param_default_literal.rs
rename to crates/parser/test_data/parser/inline/ok/const_param_default_literal.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0188_const_param_default_path.rast b/crates/parser/test_data/parser/inline/ok/const_param_default_path.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0188_const_param_default_path.rast
rename to crates/parser/test_data/parser/inline/ok/const_param_default_path.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0188_const_param_default_path.rs b/crates/parser/test_data/parser/inline/ok/const_param_default_path.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0188_const_param_default_path.rs
rename to crates/parser/test_data/parser/inline/ok/const_param_default_path.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0212_const_trait_bound.rast b/crates/parser/test_data/parser/inline/ok/const_trait_bound.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0212_const_trait_bound.rast
rename to crates/parser/test_data/parser/inline/ok/const_trait_bound.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0212_const_trait_bound.rs b/crates/parser/test_data/parser/inline/ok/const_trait_bound.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0212_const_trait_bound.rs
rename to crates/parser/test_data/parser/inline/ok/const_trait_bound.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0015_continue_expr.rast b/crates/parser/test_data/parser/inline/ok/continue_expr.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0015_continue_expr.rast
rename to crates/parser/test_data/parser/inline/ok/continue_expr.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0015_continue_expr.rs b/crates/parser/test_data/parser/inline/ok/continue_expr.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0015_continue_expr.rs
rename to crates/parser/test_data/parser/inline/ok/continue_expr.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0067_crate_path.rast b/crates/parser/test_data/parser/inline/ok/crate_path.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0067_crate_path.rast
rename to crates/parser/test_data/parser/inline/ok/crate_path.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0067_crate_path.rs b/crates/parser/test_data/parser/inline/ok/crate_path.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0067_crate_path.rs
rename to crates/parser/test_data/parser/inline/ok/crate_path.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0022_crate_visibility.rast b/crates/parser/test_data/parser/inline/ok/crate_visibility.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0022_crate_visibility.rast
rename to crates/parser/test_data/parser/inline/ok/crate_visibility.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0022_crate_visibility.rs b/crates/parser/test_data/parser/inline/ok/crate_visibility.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0022_crate_visibility.rs
rename to crates/parser/test_data/parser/inline/ok/crate_visibility.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0160_crate_visibility_in.rast b/crates/parser/test_data/parser/inline/ok/crate_visibility_in.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0160_crate_visibility_in.rast
rename to crates/parser/test_data/parser/inline/ok/crate_visibility_in.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0160_crate_visibility_in.rs b/crates/parser/test_data/parser/inline/ok/crate_visibility_in.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0160_crate_visibility_in.rs
rename to crates/parser/test_data/parser/inline/ok/crate_visibility_in.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0163_default_async_fn.rast b/crates/parser/test_data/parser/inline/ok/default_async_fn.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0163_default_async_fn.rast
rename to crates/parser/test_data/parser/inline/ok/default_async_fn.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0163_default_async_fn.rs b/crates/parser/test_data/parser/inline/ok/default_async_fn.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0163_default_async_fn.rs
rename to crates/parser/test_data/parser/inline/ok/default_async_fn.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0162_default_async_unsafe_fn.rast b/crates/parser/test_data/parser/inline/ok/default_async_unsafe_fn.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0162_default_async_unsafe_fn.rast
rename to crates/parser/test_data/parser/inline/ok/default_async_unsafe_fn.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0162_default_async_unsafe_fn.rs b/crates/parser/test_data/parser/inline/ok/default_async_unsafe_fn.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0162_default_async_unsafe_fn.rs
rename to crates/parser/test_data/parser/inline/ok/default_async_unsafe_fn.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0164_default_item.rast b/crates/parser/test_data/parser/inline/ok/default_item.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0164_default_item.rast
rename to crates/parser/test_data/parser/inline/ok/default_item.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0164_default_item.rs b/crates/parser/test_data/parser/inline/ok/default_item.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0164_default_item.rs
rename to crates/parser/test_data/parser/inline/ok/default_item.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0163_default_unsafe_item.rast b/crates/parser/test_data/parser/inline/ok/default_unsafe_item.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0163_default_unsafe_item.rast
rename to crates/parser/test_data/parser/inline/ok/default_unsafe_item.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0163_default_unsafe_item.rs b/crates/parser/test_data/parser/inline/ok/default_unsafe_item.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0163_default_unsafe_item.rs
rename to crates/parser/test_data/parser/inline/ok/default_unsafe_item.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0197_destructuring_assignment_struct_rest_pattern.rast b/crates/parser/test_data/parser/inline/ok/destructuring_assignment_struct_rest_pattern.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0197_destructuring_assignment_struct_rest_pattern.rast
rename to crates/parser/test_data/parser/inline/ok/destructuring_assignment_struct_rest_pattern.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0197_destructuring_assignment_struct_rest_pattern.rs b/crates/parser/test_data/parser/inline/ok/destructuring_assignment_struct_rest_pattern.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0197_destructuring_assignment_struct_rest_pattern.rs
rename to crates/parser/test_data/parser/inline/ok/destructuring_assignment_struct_rest_pattern.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0198_destructuring_assignment_wildcard_pat.rast b/crates/parser/test_data/parser/inline/ok/destructuring_assignment_wildcard_pat.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0198_destructuring_assignment_wildcard_pat.rast
rename to crates/parser/test_data/parser/inline/ok/destructuring_assignment_wildcard_pat.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0198_destructuring_assignment_wildcard_pat.rs b/crates/parser/test_data/parser/inline/ok/destructuring_assignment_wildcard_pat.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0198_destructuring_assignment_wildcard_pat.rs
rename to crates/parser/test_data/parser/inline/ok/destructuring_assignment_wildcard_pat.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0144_dot_dot_pat.rast b/crates/parser/test_data/parser/inline/ok/dot_dot_pat.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0144_dot_dot_pat.rast
rename to crates/parser/test_data/parser/inline/ok/dot_dot_pat.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0144_dot_dot_pat.rs b/crates/parser/test_data/parser/inline/ok/dot_dot_pat.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0144_dot_dot_pat.rs
rename to crates/parser/test_data/parser/inline/ok/dot_dot_pat.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0065_dyn_trait_type.rast b/crates/parser/test_data/parser/inline/ok/dyn_trait_type.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0065_dyn_trait_type.rast
rename to crates/parser/test_data/parser/inline/ok/dyn_trait_type.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0065_dyn_trait_type.rs b/crates/parser/test_data/parser/inline/ok/dyn_trait_type.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0065_dyn_trait_type.rs
rename to crates/parser/test_data/parser/inline/ok/dyn_trait_type.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0199_effect_blocks.rast b/crates/parser/test_data/parser/inline/ok/effect_blocks.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0199_effect_blocks.rast
rename to crates/parser/test_data/parser/inline/ok/effect_blocks.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0199_effect_blocks.rs b/crates/parser/test_data/parser/inline/ok/effect_blocks.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0199_effect_blocks.rs
rename to crates/parser/test_data/parser/inline/ok/effect_blocks.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0207_exclusive_range_pat.rast b/crates/parser/test_data/parser/inline/ok/exclusive_range_pat.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0207_exclusive_range_pat.rast
rename to crates/parser/test_data/parser/inline/ok/exclusive_range_pat.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0207_exclusive_range_pat.rs b/crates/parser/test_data/parser/inline/ok/exclusive_range_pat.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0207_exclusive_range_pat.rs
rename to crates/parser/test_data/parser/inline/ok/exclusive_range_pat.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0085_expr_literals.rast b/crates/parser/test_data/parser/inline/ok/expr_literals.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0085_expr_literals.rast
rename to crates/parser/test_data/parser/inline/ok/expr_literals.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0085_expr_literals.rs b/crates/parser/test_data/parser/inline/ok/expr_literals.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0085_expr_literals.rs
rename to crates/parser/test_data/parser/inline/ok/expr_literals.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0138_expression_after_block.rast b/crates/parser/test_data/parser/inline/ok/expression_after_block.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0138_expression_after_block.rast
rename to crates/parser/test_data/parser/inline/ok/expression_after_block.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0138_expression_after_block.rs b/crates/parser/test_data/parser/inline/ok/expression_after_block.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0138_expression_after_block.rs
rename to crates/parser/test_data/parser/inline/ok/expression_after_block.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0010_extern_block.rast b/crates/parser/test_data/parser/inline/ok/extern_block.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0010_extern_block.rast
rename to crates/parser/test_data/parser/inline/ok/extern_block.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0010_extern_block.rs b/crates/parser/test_data/parser/inline/ok/extern_block.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0010_extern_block.rs
rename to crates/parser/test_data/parser/inline/ok/extern_block.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0060_extern_crate.rast b/crates/parser/test_data/parser/inline/ok/extern_crate.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0060_extern_crate.rast
rename to crates/parser/test_data/parser/inline/ok/extern_crate.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0060_extern_crate.rs b/crates/parser/test_data/parser/inline/ok/extern_crate.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0060_extern_crate.rs
rename to crates/parser/test_data/parser/inline/ok/extern_crate.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0168_extern_crate_rename.rast b/crates/parser/test_data/parser/inline/ok/extern_crate_rename.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0168_extern_crate_rename.rast
rename to crates/parser/test_data/parser/inline/ok/extern_crate_rename.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0168_extern_crate_rename.rs b/crates/parser/test_data/parser/inline/ok/extern_crate_rename.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0168_extern_crate_rename.rs
rename to crates/parser/test_data/parser/inline/ok/extern_crate_rename.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0168_extern_crate_self.rast b/crates/parser/test_data/parser/inline/ok/extern_crate_self.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0168_extern_crate_self.rast
rename to crates/parser/test_data/parser/inline/ok/extern_crate_self.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0168_extern_crate_self.rs b/crates/parser/test_data/parser/inline/ok/extern_crate_self.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0168_extern_crate_self.rs
rename to crates/parser/test_data/parser/inline/ok/extern_crate_self.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0011_field_expr.rast b/crates/parser/test_data/parser/inline/ok/field_expr.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0011_field_expr.rast
rename to crates/parser/test_data/parser/inline/ok/field_expr.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0011_field_expr.rs b/crates/parser/test_data/parser/inline/ok/field_expr.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0011_field_expr.rs
rename to crates/parser/test_data/parser/inline/ok/field_expr.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0151_fn.rast b/crates/parser/test_data/parser/inline/ok/fn_.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0151_fn.rast
rename to crates/parser/test_data/parser/inline/ok/fn_.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0151_fn.rs b/crates/parser/test_data/parser/inline/ok/fn_.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0151_fn.rs
rename to crates/parser/test_data/parser/inline/ok/fn_.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0050_fn_decl.rast b/crates/parser/test_data/parser/inline/ok/fn_decl.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0050_fn_decl.rast
rename to crates/parser/test_data/parser/inline/ok/fn_decl.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0050_fn_decl.rs b/crates/parser/test_data/parser/inline/ok/fn_decl.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0050_fn_decl.rs
rename to crates/parser/test_data/parser/inline/ok/fn_decl.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0156_fn_def_param.rast b/crates/parser/test_data/parser/inline/ok/fn_def_param.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0156_fn_def_param.rast
rename to crates/parser/test_data/parser/inline/ok/fn_def_param.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0156_fn_def_param.rs b/crates/parser/test_data/parser/inline/ok/fn_def_param.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0156_fn_def_param.rs
rename to crates/parser/test_data/parser/inline/ok/fn_def_param.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0154_fn_pointer_param_ident_path.rast b/crates/parser/test_data/parser/inline/ok/fn_pointer_param_ident_path.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0154_fn_pointer_param_ident_path.rast
rename to crates/parser/test_data/parser/inline/ok/fn_pointer_param_ident_path.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0154_fn_pointer_param_ident_path.rs b/crates/parser/test_data/parser/inline/ok/fn_pointer_param_ident_path.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0154_fn_pointer_param_ident_path.rs
rename to crates/parser/test_data/parser/inline/ok/fn_pointer_param_ident_path.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0032_fn_pointer_type.rast b/crates/parser/test_data/parser/inline/ok/fn_pointer_type.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0032_fn_pointer_type.rast
rename to crates/parser/test_data/parser/inline/ok/fn_pointer_type.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0032_fn_pointer_type.rs b/crates/parser/test_data/parser/inline/ok/fn_pointer_type.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0032_fn_pointer_type.rs
rename to crates/parser/test_data/parser/inline/ok/fn_pointer_type.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0092_fn_pointer_type_with_ret.rast b/crates/parser/test_data/parser/inline/ok/fn_pointer_type_with_ret.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0092_fn_pointer_type_with_ret.rast
rename to crates/parser/test_data/parser/inline/ok/fn_pointer_type_with_ret.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0092_fn_pointer_type_with_ret.rs b/crates/parser/test_data/parser/inline/ok/fn_pointer_type_with_ret.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0092_fn_pointer_type_with_ret.rs
rename to crates/parser/test_data/parser/inline/ok/fn_pointer_type_with_ret.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0157_fn_pointer_unnamed_arg.rast b/crates/parser/test_data/parser/inline/ok/fn_pointer_unnamed_arg.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0157_fn_pointer_unnamed_arg.rast
rename to crates/parser/test_data/parser/inline/ok/fn_pointer_unnamed_arg.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0157_fn_pointer_unnamed_arg.rs b/crates/parser/test_data/parser/inline/ok/fn_pointer_unnamed_arg.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0157_fn_pointer_unnamed_arg.rs
rename to crates/parser/test_data/parser/inline/ok/fn_pointer_unnamed_arg.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0100_for_expr.rast b/crates/parser/test_data/parser/inline/ok/for_expr.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0100_for_expr.rast
rename to crates/parser/test_data/parser/inline/ok/for_expr.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0100_for_expr.rs b/crates/parser/test_data/parser/inline/ok/for_expr.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0100_for_expr.rs
rename to crates/parser/test_data/parser/inline/ok/for_expr.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0142_for_range_from.rast b/crates/parser/test_data/parser/inline/ok/for_range_from.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0142_for_range_from.rast
rename to crates/parser/test_data/parser/inline/ok/for_range_from.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0142_for_range_from.rs b/crates/parser/test_data/parser/inline/ok/for_range_from.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0142_for_range_from.rs
rename to crates/parser/test_data/parser/inline/ok/for_range_from.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0081_for_type.rast b/crates/parser/test_data/parser/inline/ok/for_type.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0081_for_type.rast
rename to crates/parser/test_data/parser/inline/ok/for_type.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0081_for_type.rs b/crates/parser/test_data/parser/inline/ok/for_type.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0081_for_type.rs
rename to crates/parser/test_data/parser/inline/ok/for_type.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0038_full_range_expr.rast b/crates/parser/test_data/parser/inline/ok/full_range_expr.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0038_full_range_expr.rast
rename to crates/parser/test_data/parser/inline/ok/full_range_expr.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0038_full_range_expr.rs b/crates/parser/test_data/parser/inline/ok/full_range_expr.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0038_full_range_expr.rs
rename to crates/parser/test_data/parser/inline/ok/full_range_expr.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0086_function_ret_type.rast b/crates/parser/test_data/parser/inline/ok/function_ret_type.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0086_function_ret_type.rast
rename to crates/parser/test_data/parser/inline/ok/function_ret_type.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0086_function_ret_type.rs b/crates/parser/test_data/parser/inline/ok/function_ret_type.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0086_function_ret_type.rs
rename to crates/parser/test_data/parser/inline/ok/function_ret_type.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0005_function_type_params.rast b/crates/parser/test_data/parser/inline/ok/function_type_params.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0005_function_type_params.rast
rename to crates/parser/test_data/parser/inline/ok/function_type_params.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0005_function_type_params.rs b/crates/parser/test_data/parser/inline/ok/function_type_params.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0005_function_type_params.rs
rename to crates/parser/test_data/parser/inline/ok/function_type_params.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0076_function_where_clause.rast b/crates/parser/test_data/parser/inline/ok/function_where_clause.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0076_function_where_clause.rast
rename to crates/parser/test_data/parser/inline/ok/function_where_clause.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0076_function_where_clause.rs b/crates/parser/test_data/parser/inline/ok/function_where_clause.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0076_function_where_clause.rs
rename to crates/parser/test_data/parser/inline/ok/function_where_clause.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0190_generic_arg.rast b/crates/parser/test_data/parser/inline/ok/generic_arg.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0190_generic_arg.rast
rename to crates/parser/test_data/parser/inline/ok/generic_arg.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0190_generic_arg.rs b/crates/parser/test_data/parser/inline/ok/generic_arg.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0190_generic_arg.rs
rename to crates/parser/test_data/parser/inline/ok/generic_arg.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0181_generic_param_attribute.rast b/crates/parser/test_data/parser/inline/ok/generic_param_attribute.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0181_generic_param_attribute.rast
rename to crates/parser/test_data/parser/inline/ok/generic_param_attribute.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0181_generic_param_attribute.rs b/crates/parser/test_data/parser/inline/ok/generic_param_attribute.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0181_generic_param_attribute.rs
rename to crates/parser/test_data/parser/inline/ok/generic_param_attribute.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0183_type_param.rast b/crates/parser/test_data/parser/inline/ok/generic_param_list.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0183_type_param.rast
rename to crates/parser/test_data/parser/inline/ok/generic_param_list.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0183_type_param.rs b/crates/parser/test_data/parser/inline/ok/generic_param_list.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0183_type_param.rs
rename to crates/parser/test_data/parser/inline/ok/generic_param_list.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0166_half_open_range_pat.rast b/crates/parser/test_data/parser/inline/ok/half_open_range_pat.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0166_half_open_range_pat.rast
rename to crates/parser/test_data/parser/inline/ok/half_open_range_pat.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0166_half_open_range_pat.rs b/crates/parser/test_data/parser/inline/ok/half_open_range_pat.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0166_half_open_range_pat.rs
rename to crates/parser/test_data/parser/inline/ok/half_open_range_pat.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0064_if_expr.rast b/crates/parser/test_data/parser/inline/ok/if_expr.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0064_if_expr.rast
rename to crates/parser/test_data/parser/inline/ok/if_expr.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0064_if_expr.rs b/crates/parser/test_data/parser/inline/ok/if_expr.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0064_if_expr.rs
rename to crates/parser/test_data/parser/inline/ok/if_expr.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0079_impl_item.rast b/crates/parser/test_data/parser/inline/ok/impl_item.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0079_impl_item.rast
rename to crates/parser/test_data/parser/inline/ok/impl_item.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0079_impl_item.rs b/crates/parser/test_data/parser/inline/ok/impl_item.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0079_impl_item.rs
rename to crates/parser/test_data/parser/inline/ok/impl_item.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0161_impl_item_const.rast b/crates/parser/test_data/parser/inline/ok/impl_item_const.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0161_impl_item_const.rast
rename to crates/parser/test_data/parser/inline/ok/impl_item_const.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0161_impl_item_const.rs b/crates/parser/test_data/parser/inline/ok/impl_item_const.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0161_impl_item_const.rs
rename to crates/parser/test_data/parser/inline/ok/impl_item_const.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0063_impl_item_neg.rast b/crates/parser/test_data/parser/inline/ok/impl_item_neg.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0063_impl_item_neg.rast
rename to crates/parser/test_data/parser/inline/ok/impl_item_neg.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0063_impl_item_neg.rs b/crates/parser/test_data/parser/inline/ok/impl_item_neg.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0063_impl_item_neg.rs
rename to crates/parser/test_data/parser/inline/ok/impl_item_neg.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0028_impl_trait_type.rast b/crates/parser/test_data/parser/inline/ok/impl_trait_type.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0028_impl_trait_type.rast
rename to crates/parser/test_data/parser/inline/ok/impl_trait_type.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0028_impl_trait_type.rs b/crates/parser/test_data/parser/inline/ok/impl_trait_type.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0028_impl_trait_type.rs
rename to crates/parser/test_data/parser/inline/ok/impl_trait_type.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0150_impl_type_params.rast b/crates/parser/test_data/parser/inline/ok/impl_type_params.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0150_impl_type_params.rast
rename to crates/parser/test_data/parser/inline/ok/impl_type_params.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0150_impl_type_params.rs b/crates/parser/test_data/parser/inline/ok/impl_type_params.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0150_impl_type_params.rs
rename to crates/parser/test_data/parser/inline/ok/impl_type_params.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0093_index_expr.rast b/crates/parser/test_data/parser/inline/ok/index_expr.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0093_index_expr.rast
rename to crates/parser/test_data/parser/inline/ok/index_expr.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0093_index_expr.rs b/crates/parser/test_data/parser/inline/ok/index_expr.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0093_index_expr.rs
rename to crates/parser/test_data/parser/inline/ok/index_expr.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0109_label.rast b/crates/parser/test_data/parser/inline/ok/label.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0109_label.rast
rename to crates/parser/test_data/parser/inline/ok/label.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0109_label.rs b/crates/parser/test_data/parser/inline/ok/label.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0109_label.rs
rename to crates/parser/test_data/parser/inline/ok/label.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0161_labeled_block.rast b/crates/parser/test_data/parser/inline/ok/labeled_block.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0161_labeled_block.rast
rename to crates/parser/test_data/parser/inline/ok/labeled_block.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0161_labeled_block.rs b/crates/parser/test_data/parser/inline/ok/labeled_block.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0161_labeled_block.rs
rename to crates/parser/test_data/parser/inline/ok/labeled_block.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0106_lambda_expr.rast b/crates/parser/test_data/parser/inline/ok/lambda_expr.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0106_lambda_expr.rast
rename to crates/parser/test_data/parser/inline/ok/lambda_expr.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0106_lambda_expr.rs b/crates/parser/test_data/parser/inline/ok/lambda_expr.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0106_lambda_expr.rs
rename to crates/parser/test_data/parser/inline/ok/lambda_expr.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0158_lambda_ret_block.rast b/crates/parser/test_data/parser/inline/ok/lambda_ret_block.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0158_lambda_ret_block.rast
rename to crates/parser/test_data/parser/inline/ok/lambda_ret_block.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0158_lambda_ret_block.rs b/crates/parser/test_data/parser/inline/ok/lambda_ret_block.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0158_lambda_ret_block.rs
rename to crates/parser/test_data/parser/inline/ok/lambda_ret_block.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0194_let_else.rast b/crates/parser/test_data/parser/inline/ok/let_else.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0194_let_else.rast
rename to crates/parser/test_data/parser/inline/ok/let_else.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0194_let_else.rs b/crates/parser/test_data/parser/inline/ok/let_else.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0194_let_else.rs
rename to crates/parser/test_data/parser/inline/ok/let_else.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0030_let_expr.rast b/crates/parser/test_data/parser/inline/ok/let_expr.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0030_let_expr.rast
rename to crates/parser/test_data/parser/inline/ok/let_expr.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0030_let_expr.rs b/crates/parser/test_data/parser/inline/ok/let_expr.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0030_let_expr.rs
rename to crates/parser/test_data/parser/inline/ok/let_expr.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0130_let_stmt.rast b/crates/parser/test_data/parser/inline/ok/let_stmt.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0130_let_stmt.rast
rename to crates/parser/test_data/parser/inline/ok/let_stmt.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0130_let_stmt.rs b/crates/parser/test_data/parser/inline/ok/let_stmt.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0130_let_stmt.rs
rename to crates/parser/test_data/parser/inline/ok/let_stmt.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0194_let_stmt_ascription.rast b/crates/parser/test_data/parser/inline/ok/let_stmt_ascription.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0194_let_stmt_ascription.rast
rename to crates/parser/test_data/parser/inline/ok/let_stmt_ascription.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0194_let_stmt_ascription.rs b/crates/parser/test_data/parser/inline/ok/let_stmt_ascription.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0194_let_stmt_ascription.rs
rename to crates/parser/test_data/parser/inline/ok/let_stmt_ascription.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0193_let_stmt_init.rast b/crates/parser/test_data/parser/inline/ok/let_stmt_init.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0193_let_stmt_init.rast
rename to crates/parser/test_data/parser/inline/ok/let_stmt_init.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0193_let_stmt_init.rs b/crates/parser/test_data/parser/inline/ok/let_stmt_init.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0193_let_stmt_init.rs
rename to crates/parser/test_data/parser/inline/ok/let_stmt_init.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0186_lifetime_arg.rast b/crates/parser/test_data/parser/inline/ok/lifetime_arg.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0186_lifetime_arg.rast
rename to crates/parser/test_data/parser/inline/ok/lifetime_arg.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0186_lifetime_arg.rs b/crates/parser/test_data/parser/inline/ok/lifetime_arg.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0186_lifetime_arg.rs
rename to crates/parser/test_data/parser/inline/ok/lifetime_arg.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0182_lifetime_param.rast b/crates/parser/test_data/parser/inline/ok/lifetime_param.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0182_lifetime_param.rast
rename to crates/parser/test_data/parser/inline/ok/lifetime_param.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0182_lifetime_param.rs b/crates/parser/test_data/parser/inline/ok/lifetime_param.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0182_lifetime_param.rs
rename to crates/parser/test_data/parser/inline/ok/lifetime_param.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0055_literal_pattern.rast b/crates/parser/test_data/parser/inline/ok/literal_pattern.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0055_literal_pattern.rast
rename to crates/parser/test_data/parser/inline/ok/literal_pattern.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0055_literal_pattern.rs b/crates/parser/test_data/parser/inline/ok/literal_pattern.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0055_literal_pattern.rs
rename to crates/parser/test_data/parser/inline/ok/literal_pattern.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0009_loop_expr.rast b/crates/parser/test_data/parser/inline/ok/loop_expr.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0009_loop_expr.rast
rename to crates/parser/test_data/parser/inline/ok/loop_expr.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0009_loop_expr.rs b/crates/parser/test_data/parser/inline/ok/loop_expr.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0009_loop_expr.rs
rename to crates/parser/test_data/parser/inline/ok/loop_expr.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0117_macro_call_type.rast b/crates/parser/test_data/parser/inline/ok/macro_call_type.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0117_macro_call_type.rast
rename to crates/parser/test_data/parser/inline/ok/macro_call_type.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0117_macro_call_type.rs b/crates/parser/test_data/parser/inline/ok/macro_call_type.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0117_macro_call_type.rs
rename to crates/parser/test_data/parser/inline/ok/macro_call_type.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0147_macro_def.rast b/crates/parser/test_data/parser/inline/ok/macro_def.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0147_macro_def.rast
rename to crates/parser/test_data/parser/inline/ok/macro_def.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0147_macro_def.rs b/crates/parser/test_data/parser/inline/ok/macro_def.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0147_macro_def.rs
rename to crates/parser/test_data/parser/inline/ok/macro_def.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0173_macro_def_curly.rast b/crates/parser/test_data/parser/inline/ok/macro_def_curly.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0173_macro_def_curly.rast
rename to crates/parser/test_data/parser/inline/ok/macro_def_curly.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0173_macro_def_curly.rs b/crates/parser/test_data/parser/inline/ok/macro_def_curly.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0173_macro_def_curly.rs
rename to crates/parser/test_data/parser/inline/ok/macro_def_curly.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0194_macro_inside_generic_arg.rast b/crates/parser/test_data/parser/inline/ok/macro_inside_generic_arg.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0194_macro_inside_generic_arg.rast
rename to crates/parser/test_data/parser/inline/ok/macro_inside_generic_arg.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0194_macro_inside_generic_arg.rs b/crates/parser/test_data/parser/inline/ok/macro_inside_generic_arg.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0194_macro_inside_generic_arg.rs
rename to crates/parser/test_data/parser/inline/ok/macro_inside_generic_arg.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0208_macro_rules_as_macro_name.rast b/crates/parser/test_data/parser/inline/ok/macro_rules_as_macro_name.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0208_macro_rules_as_macro_name.rast
rename to crates/parser/test_data/parser/inline/ok/macro_rules_as_macro_name.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0208_macro_rules_as_macro_name.rs b/crates/parser/test_data/parser/inline/ok/macro_rules_as_macro_name.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0208_macro_rules_as_macro_name.rs
rename to crates/parser/test_data/parser/inline/ok/macro_rules_as_macro_name.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0158_macro_rules_non_brace.rast b/crates/parser/test_data/parser/inline/ok/macro_rules_non_brace.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0158_macro_rules_non_brace.rast
rename to crates/parser/test_data/parser/inline/ok/macro_rules_non_brace.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0158_macro_rules_non_brace.rs b/crates/parser/test_data/parser/inline/ok/macro_rules_non_brace.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0158_macro_rules_non_brace.rs
rename to crates/parser/test_data/parser/inline/ok/macro_rules_non_brace.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0129_marco_pat.rast b/crates/parser/test_data/parser/inline/ok/marco_pat.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0129_marco_pat.rast
rename to crates/parser/test_data/parser/inline/ok/marco_pat.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0129_marco_pat.rs b/crates/parser/test_data/parser/inline/ok/marco_pat.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0129_marco_pat.rs
rename to crates/parser/test_data/parser/inline/ok/marco_pat.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0066_match_arm.rast b/crates/parser/test_data/parser/inline/ok/match_arm.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0066_match_arm.rast
rename to crates/parser/test_data/parser/inline/ok/match_arm.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0066_match_arm.rs b/crates/parser/test_data/parser/inline/ok/match_arm.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0066_match_arm.rs
rename to crates/parser/test_data/parser/inline/ok/match_arm.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0059_match_arms_commas.rast b/crates/parser/test_data/parser/inline/ok/match_arms_commas.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0059_match_arms_commas.rast
rename to crates/parser/test_data/parser/inline/ok/match_arms_commas.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0059_match_arms_commas.rs b/crates/parser/test_data/parser/inline/ok/match_arms_commas.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0059_match_arms_commas.rs
rename to crates/parser/test_data/parser/inline/ok/match_arms_commas.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0120_match_arms_inner_attribute.rast b/crates/parser/test_data/parser/inline/ok/match_arms_inner_attribute.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0120_match_arms_inner_attribute.rast
rename to crates/parser/test_data/parser/inline/ok/match_arms_inner_attribute.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0120_match_arms_inner_attribute.rs b/crates/parser/test_data/parser/inline/ok/match_arms_inner_attribute.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0120_match_arms_inner_attribute.rs
rename to crates/parser/test_data/parser/inline/ok/match_arms_inner_attribute.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0121_match_arms_outer_attributes.rast b/crates/parser/test_data/parser/inline/ok/match_arms_outer_attributes.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0121_match_arms_outer_attributes.rast
rename to crates/parser/test_data/parser/inline/ok/match_arms_outer_attributes.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0121_match_arms_outer_attributes.rs b/crates/parser/test_data/parser/inline/ok/match_arms_outer_attributes.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0121_match_arms_outer_attributes.rs
rename to crates/parser/test_data/parser/inline/ok/match_arms_outer_attributes.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0071_match_expr.rast b/crates/parser/test_data/parser/inline/ok/match_expr.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0071_match_expr.rast
rename to crates/parser/test_data/parser/inline/ok/match_expr.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0071_match_expr.rs b/crates/parser/test_data/parser/inline/ok/match_expr.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0071_match_expr.rs
rename to crates/parser/test_data/parser/inline/ok/match_expr.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0118_match_guard.rast b/crates/parser/test_data/parser/inline/ok/match_guard.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0118_match_guard.rast
rename to crates/parser/test_data/parser/inline/ok/match_guard.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0118_match_guard.rs b/crates/parser/test_data/parser/inline/ok/match_guard.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0118_match_guard.rs
rename to crates/parser/test_data/parser/inline/ok/match_guard.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0213_metas.rast b/crates/parser/test_data/parser/inline/ok/metas.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0213_metas.rast
rename to crates/parser/test_data/parser/inline/ok/metas.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0213_metas.rs b/crates/parser/test_data/parser/inline/ok/metas.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0213_metas.rs
rename to crates/parser/test_data/parser/inline/ok/metas.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0107_method_call_expr.rast b/crates/parser/test_data/parser/inline/ok/method_call_expr.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0107_method_call_expr.rast
rename to crates/parser/test_data/parser/inline/ok/method_call_expr.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0107_method_call_expr.rs b/crates/parser/test_data/parser/inline/ok/method_call_expr.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0107_method_call_expr.rs
rename to crates/parser/test_data/parser/inline/ok/method_call_expr.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0062_mod_contents.rast b/crates/parser/test_data/parser/inline/ok/mod_contents.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0062_mod_contents.rast
rename to crates/parser/test_data/parser/inline/ok/mod_contents.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0062_mod_contents.rs b/crates/parser/test_data/parser/inline/ok/mod_contents.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0062_mod_contents.rs
rename to crates/parser/test_data/parser/inline/ok/mod_contents.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0169_mod_item.rast b/crates/parser/test_data/parser/inline/ok/mod_item.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0169_mod_item.rast
rename to crates/parser/test_data/parser/inline/ok/mod_item.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0169_mod_item.rs b/crates/parser/test_data/parser/inline/ok/mod_item.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0169_mod_item.rs
rename to crates/parser/test_data/parser/inline/ok/mod_item.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0170_mod_item_curly.rast b/crates/parser/test_data/parser/inline/ok/mod_item_curly.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0170_mod_item_curly.rast
rename to crates/parser/test_data/parser/inline/ok/mod_item_curly.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0170_mod_item_curly.rs b/crates/parser/test_data/parser/inline/ok/mod_item_curly.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0170_mod_item_curly.rs
rename to crates/parser/test_data/parser/inline/ok/mod_item_curly.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0014_never_type.rast b/crates/parser/test_data/parser/inline/ok/never_type.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0014_never_type.rast
rename to crates/parser/test_data/parser/inline/ok/never_type.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0014_never_type.rs b/crates/parser/test_data/parser/inline/ok/never_type.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0014_never_type.rs
rename to crates/parser/test_data/parser/inline/ok/never_type.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0154_no_dyn_trait_leading_for.rast b/crates/parser/test_data/parser/inline/ok/no_dyn_trait_leading_for.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0154_no_dyn_trait_leading_for.rast
rename to crates/parser/test_data/parser/inline/ok/no_dyn_trait_leading_for.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0154_no_dyn_trait_leading_for.rs b/crates/parser/test_data/parser/inline/ok/no_dyn_trait_leading_for.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0154_no_dyn_trait_leading_for.rs
rename to crates/parser/test_data/parser/inline/ok/no_dyn_trait_leading_for.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0096_no_semi_after_block.rast b/crates/parser/test_data/parser/inline/ok/no_semi_after_block.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0096_no_semi_after_block.rast
rename to crates/parser/test_data/parser/inline/ok/no_semi_after_block.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0096_no_semi_after_block.rs b/crates/parser/test_data/parser/inline/ok/no_semi_after_block.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0096_no_semi_after_block.rs
rename to crates/parser/test_data/parser/inline/ok/no_semi_after_block.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0113_nocontentexpr.rast b/crates/parser/test_data/parser/inline/ok/nocontentexpr.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0113_nocontentexpr.rast
rename to crates/parser/test_data/parser/inline/ok/nocontentexpr.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0113_nocontentexpr.rs b/crates/parser/test_data/parser/inline/ok/nocontentexpr.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0113_nocontentexpr.rs
rename to crates/parser/test_data/parser/inline/ok/nocontentexpr.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0134_nocontentexpr_after_item.rast b/crates/parser/test_data/parser/inline/ok/nocontentexpr_after_item.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0134_nocontentexpr_after_item.rast
rename to crates/parser/test_data/parser/inline/ok/nocontentexpr_after_item.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0134_nocontentexpr_after_item.rs b/crates/parser/test_data/parser/inline/ok/nocontentexpr_after_item.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0134_nocontentexpr_after_item.rs
rename to crates/parser/test_data/parser/inline/ok/nocontentexpr_after_item.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0156_or_pattern.rast b/crates/parser/test_data/parser/inline/ok/or_pattern.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0156_or_pattern.rast
rename to crates/parser/test_data/parser/inline/ok/or_pattern.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0156_or_pattern.rs b/crates/parser/test_data/parser/inline/ok/or_pattern.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0156_or_pattern.rs
rename to crates/parser/test_data/parser/inline/ok/or_pattern.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0099_param_list.rast b/crates/parser/test_data/parser/inline/ok/param_list.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0099_param_list.rast
rename to crates/parser/test_data/parser/inline/ok/param_list.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0099_param_list.rs b/crates/parser/test_data/parser/inline/ok/param_list.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0099_param_list.rs
rename to crates/parser/test_data/parser/inline/ok/param_list.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0045_param_list_opt_patterns.rast b/crates/parser/test_data/parser/inline/ok/param_list_opt_patterns.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0045_param_list_opt_patterns.rast
rename to crates/parser/test_data/parser/inline/ok/param_list_opt_patterns.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0045_param_list_opt_patterns.rs b/crates/parser/test_data/parser/inline/ok/param_list_opt_patterns.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0045_param_list_opt_patterns.rs
rename to crates/parser/test_data/parser/inline/ok/param_list_opt_patterns.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0123_param_list_vararg.rast b/crates/parser/test_data/parser/inline/ok/param_list_vararg.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0123_param_list_vararg.rast
rename to crates/parser/test_data/parser/inline/ok/param_list_vararg.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0123_param_list_vararg.rs b/crates/parser/test_data/parser/inline/ok/param_list_vararg.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0123_param_list_vararg.rs
rename to crates/parser/test_data/parser/inline/ok/param_list_vararg.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0139_param_outer_arg.rast b/crates/parser/test_data/parser/inline/ok/param_outer_arg.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0139_param_outer_arg.rast
rename to crates/parser/test_data/parser/inline/ok/param_outer_arg.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0139_param_outer_arg.rs b/crates/parser/test_data/parser/inline/ok/param_outer_arg.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0139_param_outer_arg.rs
rename to crates/parser/test_data/parser/inline/ok/param_outer_arg.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0084_paren_type.rast b/crates/parser/test_data/parser/inline/ok/paren_type.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0084_paren_type.rast
rename to crates/parser/test_data/parser/inline/ok/paren_type.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0084_paren_type.rs b/crates/parser/test_data/parser/inline/ok/paren_type.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0084_paren_type.rs
rename to crates/parser/test_data/parser/inline/ok/paren_type.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0053_path_expr.rast b/crates/parser/test_data/parser/inline/ok/path_expr.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0053_path_expr.rast
rename to crates/parser/test_data/parser/inline/ok/path_expr.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0053_path_expr.rs b/crates/parser/test_data/parser/inline/ok/path_expr.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0053_path_expr.rs
rename to crates/parser/test_data/parser/inline/ok/path_expr.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0104_path_fn_trait_args.rast b/crates/parser/test_data/parser/inline/ok/path_fn_trait_args.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0104_path_fn_trait_args.rast
rename to crates/parser/test_data/parser/inline/ok/path_fn_trait_args.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0104_path_fn_trait_args.rs b/crates/parser/test_data/parser/inline/ok/path_fn_trait_args.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0104_path_fn_trait_args.rs
rename to crates/parser/test_data/parser/inline/ok/path_fn_trait_args.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0008_path_part.rast b/crates/parser/test_data/parser/inline/ok/path_part.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0008_path_part.rast
rename to crates/parser/test_data/parser/inline/ok/path_part.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0008_path_part.rs b/crates/parser/test_data/parser/inline/ok/path_part.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0008_path_part.rs
rename to crates/parser/test_data/parser/inline/ok/path_part.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0052_path_type.rast b/crates/parser/test_data/parser/inline/ok/path_type.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0052_path_type.rast
rename to crates/parser/test_data/parser/inline/ok/path_type.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0052_path_type.rs b/crates/parser/test_data/parser/inline/ok/path_type.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0052_path_type.rs
rename to crates/parser/test_data/parser/inline/ok/path_type.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0048_path_type_with_bounds.rast b/crates/parser/test_data/parser/inline/ok/path_type_with_bounds.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0048_path_type_with_bounds.rast
rename to crates/parser/test_data/parser/inline/ok/path_type_with_bounds.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0048_path_type_with_bounds.rs b/crates/parser/test_data/parser/inline/ok/path_type_with_bounds.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0048_path_type_with_bounds.rs
rename to crates/parser/test_data/parser/inline/ok/path_type_with_bounds.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0095_placeholder_pat.rast b/crates/parser/test_data/parser/inline/ok/placeholder_pat.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0095_placeholder_pat.rast
rename to crates/parser/test_data/parser/inline/ok/placeholder_pat.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0095_placeholder_pat.rs b/crates/parser/test_data/parser/inline/ok/placeholder_pat.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0095_placeholder_pat.rs
rename to crates/parser/test_data/parser/inline/ok/placeholder_pat.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0023_placeholder_type.rast b/crates/parser/test_data/parser/inline/ok/placeholder_type.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0023_placeholder_type.rast
rename to crates/parser/test_data/parser/inline/ok/placeholder_type.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0023_placeholder_type.rs b/crates/parser/test_data/parser/inline/ok/placeholder_type.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0023_placeholder_type.rs
rename to crates/parser/test_data/parser/inline/ok/placeholder_type.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0013_pointer_type_mut.rast b/crates/parser/test_data/parser/inline/ok/pointer_type_mut.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0013_pointer_type_mut.rast
rename to crates/parser/test_data/parser/inline/ok/pointer_type_mut.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0013_pointer_type_mut.rs b/crates/parser/test_data/parser/inline/ok/pointer_type_mut.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0013_pointer_type_mut.rs
rename to crates/parser/test_data/parser/inline/ok/pointer_type_mut.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0080_postfix_range.rast b/crates/parser/test_data/parser/inline/ok/postfix_range.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0080_postfix_range.rast
rename to crates/parser/test_data/parser/inline/ok/postfix_range.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0080_postfix_range.rs b/crates/parser/test_data/parser/inline/ok/postfix_range.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0080_postfix_range.rs
rename to crates/parser/test_data/parser/inline/ok/postfix_range.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0153_pub_parens_typepath.rast b/crates/parser/test_data/parser/inline/ok/pub_parens_typepath.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0153_pub_parens_typepath.rast
rename to crates/parser/test_data/parser/inline/ok/pub_parens_typepath.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0153_pub_parens_typepath.rs b/crates/parser/test_data/parser/inline/ok/pub_parens_typepath.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0153_pub_parens_typepath.rs
rename to crates/parser/test_data/parser/inline/ok/pub_parens_typepath.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0196_pub_tuple_field.rast b/crates/parser/test_data/parser/inline/ok/pub_tuple_field.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0196_pub_tuple_field.rast
rename to crates/parser/test_data/parser/inline/ok/pub_tuple_field.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0196_pub_tuple_field.rs b/crates/parser/test_data/parser/inline/ok/pub_tuple_field.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0196_pub_tuple_field.rs
rename to crates/parser/test_data/parser/inline/ok/pub_tuple_field.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0037_qual_paths.rast b/crates/parser/test_data/parser/inline/ok/qual_paths.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0037_qual_paths.rast
rename to crates/parser/test_data/parser/inline/ok/qual_paths.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0037_qual_paths.rs b/crates/parser/test_data/parser/inline/ok/qual_paths.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0037_qual_paths.rs
rename to crates/parser/test_data/parser/inline/ok/qual_paths.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0201_question_for_type_trait_bound.rast b/crates/parser/test_data/parser/inline/ok/question_for_type_trait_bound.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0201_question_for_type_trait_bound.rast
rename to crates/parser/test_data/parser/inline/ok/question_for_type_trait_bound.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0201_question_for_type_trait_bound.rs b/crates/parser/test_data/parser/inline/ok/question_for_type_trait_bound.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0201_question_for_type_trait_bound.rs
rename to crates/parser/test_data/parser/inline/ok/question_for_type_trait_bound.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0058_range_pat.rast b/crates/parser/test_data/parser/inline/ok/range_pat.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0058_range_pat.rast
rename to crates/parser/test_data/parser/inline/ok/range_pat.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0058_range_pat.rs b/crates/parser/test_data/parser/inline/ok/range_pat.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0058_range_pat.rs
rename to crates/parser/test_data/parser/inline/ok/range_pat.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0054_record_field_attrs.rast b/crates/parser/test_data/parser/inline/ok/record_field_attrs.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0054_record_field_attrs.rast
rename to crates/parser/test_data/parser/inline/ok/record_field_attrs.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0054_record_field_attrs.rs b/crates/parser/test_data/parser/inline/ok/record_field_attrs.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0054_record_field_attrs.rs
rename to crates/parser/test_data/parser/inline/ok/record_field_attrs.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0172_record_field_list.rast b/crates/parser/test_data/parser/inline/ok/record_field_list.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0172_record_field_list.rast
rename to crates/parser/test_data/parser/inline/ok/record_field_list.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0172_record_field_list.rs b/crates/parser/test_data/parser/inline/ok/record_field_list.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0172_record_field_list.rs
rename to crates/parser/test_data/parser/inline/ok/record_field_list.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0061_record_lit.rast b/crates/parser/test_data/parser/inline/ok/record_lit.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0061_record_lit.rast
rename to crates/parser/test_data/parser/inline/ok/record_lit.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0061_record_lit.rs b/crates/parser/test_data/parser/inline/ok/record_lit.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0061_record_lit.rs
rename to crates/parser/test_data/parser/inline/ok/record_lit.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0125_record_literal_field_with_attr.rast b/crates/parser/test_data/parser/inline/ok/record_literal_field_with_attr.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0125_record_literal_field_with_attr.rast
rename to crates/parser/test_data/parser/inline/ok/record_literal_field_with_attr.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0125_record_literal_field_with_attr.rs b/crates/parser/test_data/parser/inline/ok/record_literal_field_with_attr.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0125_record_literal_field_with_attr.rs
rename to crates/parser/test_data/parser/inline/ok/record_literal_field_with_attr.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0145_record_pat_field.rast b/crates/parser/test_data/parser/inline/ok/record_pat_field.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0145_record_pat_field.rast
rename to crates/parser/test_data/parser/inline/ok/record_pat_field.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0145_record_pat_field.rs b/crates/parser/test_data/parser/inline/ok/record_pat_field.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0145_record_pat_field.rs
rename to crates/parser/test_data/parser/inline/ok/record_pat_field.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0102_record_pat_field_list.rast b/crates/parser/test_data/parser/inline/ok/record_pat_field_list.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0102_record_pat_field_list.rast
rename to crates/parser/test_data/parser/inline/ok/record_pat_field_list.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0102_record_pat_field_list.rs b/crates/parser/test_data/parser/inline/ok/record_pat_field_list.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0102_record_pat_field_list.rs
rename to crates/parser/test_data/parser/inline/ok/record_pat_field_list.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0082_ref_expr.rast b/crates/parser/test_data/parser/inline/ok/ref_expr.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0082_ref_expr.rast
rename to crates/parser/test_data/parser/inline/ok/ref_expr.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0082_ref_expr.rs b/crates/parser/test_data/parser/inline/ok/ref_expr.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0082_ref_expr.rs
rename to crates/parser/test_data/parser/inline/ok/ref_expr.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0027_ref_pat.rast b/crates/parser/test_data/parser/inline/ok/ref_pat.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0027_ref_pat.rast
rename to crates/parser/test_data/parser/inline/ok/ref_pat.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0027_ref_pat.rs b/crates/parser/test_data/parser/inline/ok/ref_pat.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0027_ref_pat.rs
rename to crates/parser/test_data/parser/inline/ok/ref_pat.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0033_reference_type;.rast b/crates/parser/test_data/parser/inline/ok/reference_type.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0033_reference_type;.rast
rename to crates/parser/test_data/parser/inline/ok/reference_type.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0033_reference_type;.rs b/crates/parser/test_data/parser/inline/ok/reference_type.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0033_reference_type;.rs
rename to crates/parser/test_data/parser/inline/ok/reference_type.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0072_return_expr.rast b/crates/parser/test_data/parser/inline/ok/return_expr.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0072_return_expr.rast
rename to crates/parser/test_data/parser/inline/ok/return_expr.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0072_return_expr.rs b/crates/parser/test_data/parser/inline/ok/return_expr.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0072_return_expr.rs
rename to crates/parser/test_data/parser/inline/ok/return_expr.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0006_self_param.rast b/crates/parser/test_data/parser/inline/ok/self_param.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0006_self_param.rast
rename to crates/parser/test_data/parser/inline/ok/self_param.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0006_self_param.rs b/crates/parser/test_data/parser/inline/ok/self_param.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0006_self_param.rs
rename to crates/parser/test_data/parser/inline/ok/self_param.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0138_self_param_outer_attr.rast b/crates/parser/test_data/parser/inline/ok/self_param_outer_attr.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0138_self_param_outer_attr.rast
rename to crates/parser/test_data/parser/inline/ok/self_param_outer_attr.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0138_self_param_outer_attr.rs b/crates/parser/test_data/parser/inline/ok/self_param_outer_attr.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0138_self_param_outer_attr.rs
rename to crates/parser/test_data/parser/inline/ok/self_param_outer_attr.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0046_singleton_tuple_type.rast b/crates/parser/test_data/parser/inline/ok/singleton_tuple_type.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0046_singleton_tuple_type.rast
rename to crates/parser/test_data/parser/inline/ok/singleton_tuple_type.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0046_singleton_tuple_type.rs b/crates/parser/test_data/parser/inline/ok/singleton_tuple_type.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0046_singleton_tuple_type.rs
rename to crates/parser/test_data/parser/inline/ok/singleton_tuple_type.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0024_slice_pat.rast b/crates/parser/test_data/parser/inline/ok/slice_pat.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0024_slice_pat.rast
rename to crates/parser/test_data/parser/inline/ok/slice_pat.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0024_slice_pat.rs b/crates/parser/test_data/parser/inline/ok/slice_pat.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0024_slice_pat.rs
rename to crates/parser/test_data/parser/inline/ok/slice_pat.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0025_slice_type.rast b/crates/parser/test_data/parser/inline/ok/slice_type.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0025_slice_type.rast
rename to crates/parser/test_data/parser/inline/ok/slice_type.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0025_slice_type.rs b/crates/parser/test_data/parser/inline/ok/slice_type.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0025_slice_type.rs
rename to crates/parser/test_data/parser/inline/ok/slice_type.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0070_stmt_bin_expr_ambiguity.rast b/crates/parser/test_data/parser/inline/ok/stmt_bin_expr_ambiguity.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0070_stmt_bin_expr_ambiguity.rast
rename to crates/parser/test_data/parser/inline/ok/stmt_bin_expr_ambiguity.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0070_stmt_bin_expr_ambiguity.rs b/crates/parser/test_data/parser/inline/ok/stmt_bin_expr_ambiguity.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0070_stmt_bin_expr_ambiguity.rs
rename to crates/parser/test_data/parser/inline/ok/stmt_bin_expr_ambiguity.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0074_stmt_postfix_expr_ambiguity.rast b/crates/parser/test_data/parser/inline/ok/stmt_postfix_expr_ambiguity.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0074_stmt_postfix_expr_ambiguity.rast
rename to crates/parser/test_data/parser/inline/ok/stmt_postfix_expr_ambiguity.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0074_stmt_postfix_expr_ambiguity.rs b/crates/parser/test_data/parser/inline/ok/stmt_postfix_expr_ambiguity.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0074_stmt_postfix_expr_ambiguity.rs
rename to crates/parser/test_data/parser/inline/ok/stmt_postfix_expr_ambiguity.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0171_struct_item.rast b/crates/parser/test_data/parser/inline/ok/struct_item.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0171_struct_item.rast
rename to crates/parser/test_data/parser/inline/ok/struct_item.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0171_struct_item.rs b/crates/parser/test_data/parser/inline/ok/struct_item.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0171_struct_item.rs
rename to crates/parser/test_data/parser/inline/ok/struct_item.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0151_trait_alias.rast b/crates/parser/test_data/parser/inline/ok/trait_alias.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0151_trait_alias.rast
rename to crates/parser/test_data/parser/inline/ok/trait_alias.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0151_trait_alias.rs b/crates/parser/test_data/parser/inline/ok/trait_alias.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0151_trait_alias.rs
rename to crates/parser/test_data/parser/inline/ok/trait_alias.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0177_trait_alias_where_clause.rast b/crates/parser/test_data/parser/inline/ok/trait_alias_where_clause.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0177_trait_alias_where_clause.rast
rename to crates/parser/test_data/parser/inline/ok/trait_alias_where_clause.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0177_trait_alias_where_clause.rs b/crates/parser/test_data/parser/inline/ok/trait_alias_where_clause.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0177_trait_alias_where_clause.rs
rename to crates/parser/test_data/parser/inline/ok/trait_alias_where_clause.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0041_trait_item.rast b/crates/parser/test_data/parser/inline/ok/trait_item.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0041_trait_item.rast
rename to crates/parser/test_data/parser/inline/ok/trait_item.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0041_trait_item.rs b/crates/parser/test_data/parser/inline/ok/trait_item.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0041_trait_item.rs
rename to crates/parser/test_data/parser/inline/ok/trait_item.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0175_trait_item_bounds.rast b/crates/parser/test_data/parser/inline/ok/trait_item_bounds.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0175_trait_item_bounds.rast
rename to crates/parser/test_data/parser/inline/ok/trait_item_bounds.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0175_trait_item_bounds.rs b/crates/parser/test_data/parser/inline/ok/trait_item_bounds.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0175_trait_item_bounds.rs
rename to crates/parser/test_data/parser/inline/ok/trait_item_bounds.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0174_trait_item_generic_params.rast b/crates/parser/test_data/parser/inline/ok/trait_item_generic_params.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0174_trait_item_generic_params.rast
rename to crates/parser/test_data/parser/inline/ok/trait_item_generic_params.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0174_trait_item_generic_params.rs b/crates/parser/test_data/parser/inline/ok/trait_item_generic_params.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0174_trait_item_generic_params.rs
rename to crates/parser/test_data/parser/inline/ok/trait_item_generic_params.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0176_trait_item_where_clause.rast b/crates/parser/test_data/parser/inline/ok/trait_item_where_clause.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0176_trait_item_where_clause.rast
rename to crates/parser/test_data/parser/inline/ok/trait_item_where_clause.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0176_trait_item_where_clause.rs b/crates/parser/test_data/parser/inline/ok/trait_item_where_clause.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0176_trait_item_where_clause.rs
rename to crates/parser/test_data/parser/inline/ok/trait_item_where_clause.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0130_try_block_expr.rast b/crates/parser/test_data/parser/inline/ok/try_block_expr.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0130_try_block_expr.rast
rename to crates/parser/test_data/parser/inline/ok/try_block_expr.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0130_try_block_expr.rs b/crates/parser/test_data/parser/inline/ok/try_block_expr.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0130_try_block_expr.rs
rename to crates/parser/test_data/parser/inline/ok/try_block_expr.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0077_try_expr.rast b/crates/parser/test_data/parser/inline/ok/try_expr.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0077_try_expr.rast
rename to crates/parser/test_data/parser/inline/ok/try_expr.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0077_try_expr.rs b/crates/parser/test_data/parser/inline/ok/try_expr.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0077_try_expr.rs
rename to crates/parser/test_data/parser/inline/ok/try_expr.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0159_try_macro_fallback.rast b/crates/parser/test_data/parser/inline/ok/try_macro_fallback.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0159_try_macro_fallback.rast
rename to crates/parser/test_data/parser/inline/ok/try_macro_fallback.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0159_try_macro_fallback.rs b/crates/parser/test_data/parser/inline/ok/try_macro_fallback.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0159_try_macro_fallback.rs
rename to crates/parser/test_data/parser/inline/ok/try_macro_fallback.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0160_try_macro_rules.rast b/crates/parser/test_data/parser/inline/ok/try_macro_rules.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0160_try_macro_rules.rast
rename to crates/parser/test_data/parser/inline/ok/try_macro_rules.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0160_try_macro_rules.rs b/crates/parser/test_data/parser/inline/ok/try_macro_rules.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0160_try_macro_rules.rs
rename to crates/parser/test_data/parser/inline/ok/try_macro_rules.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0154_tuple_attrs.rast b/crates/parser/test_data/parser/inline/ok/tuple_attrs.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0154_tuple_attrs.rast
rename to crates/parser/test_data/parser/inline/ok/tuple_attrs.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0154_tuple_attrs.rs b/crates/parser/test_data/parser/inline/ok/tuple_attrs.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0154_tuple_attrs.rs
rename to crates/parser/test_data/parser/inline/ok/tuple_attrs.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0108_tuple_expr.rast b/crates/parser/test_data/parser/inline/ok/tuple_expr.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0108_tuple_expr.rast
rename to crates/parser/test_data/parser/inline/ok/tuple_expr.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0108_tuple_expr.rs b/crates/parser/test_data/parser/inline/ok/tuple_expr.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0108_tuple_expr.rs
rename to crates/parser/test_data/parser/inline/ok/tuple_expr.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0115_tuple_field_attrs.rast b/crates/parser/test_data/parser/inline/ok/tuple_field_attrs.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0115_tuple_field_attrs.rast
rename to crates/parser/test_data/parser/inline/ok/tuple_field_attrs.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0115_tuple_field_attrs.rs b/crates/parser/test_data/parser/inline/ok/tuple_field_attrs.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0115_tuple_field_attrs.rs
rename to crates/parser/test_data/parser/inline/ok/tuple_field_attrs.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0111_tuple_pat.rast b/crates/parser/test_data/parser/inline/ok/tuple_pat.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0111_tuple_pat.rast
rename to crates/parser/test_data/parser/inline/ok/tuple_pat.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0111_tuple_pat.rs b/crates/parser/test_data/parser/inline/ok/tuple_pat.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0111_tuple_pat.rs
rename to crates/parser/test_data/parser/inline/ok/tuple_pat.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0026_tuple_pat_fields.rast b/crates/parser/test_data/parser/inline/ok/tuple_pat_fields.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0026_tuple_pat_fields.rast
rename to crates/parser/test_data/parser/inline/ok/tuple_pat_fields.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0026_tuple_pat_fields.rs b/crates/parser/test_data/parser/inline/ok/tuple_pat_fields.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0026_tuple_pat_fields.rs
rename to crates/parser/test_data/parser/inline/ok/tuple_pat_fields.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0170_tuple_struct.rast b/crates/parser/test_data/parser/inline/ok/tuple_struct.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0170_tuple_struct.rast
rename to crates/parser/test_data/parser/inline/ok/tuple_struct.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0170_tuple_struct.rs b/crates/parser/test_data/parser/inline/ok/tuple_struct.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0170_tuple_struct.rs
rename to crates/parser/test_data/parser/inline/ok/tuple_struct.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0114_tuple_struct_where.rast b/crates/parser/test_data/parser/inline/ok/tuple_struct_where.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0114_tuple_struct_where.rast
rename to crates/parser/test_data/parser/inline/ok/tuple_struct_where.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0114_tuple_struct_where.rs b/crates/parser/test_data/parser/inline/ok/tuple_struct_where.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0114_tuple_struct_where.rs
rename to crates/parser/test_data/parser/inline/ok/tuple_struct_where.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0078_type_alias.rast b/crates/parser/test_data/parser/inline/ok/type_alias.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0078_type_alias.rast
rename to crates/parser/test_data/parser/inline/ok/type_alias.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0078_type_alias.rs b/crates/parser/test_data/parser/inline/ok/type_alias.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0078_type_alias.rs
rename to crates/parser/test_data/parser/inline/ok/type_alias.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0073_type_item_type_params.rast b/crates/parser/test_data/parser/inline/ok/type_item_type_params.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0073_type_item_type_params.rast
rename to crates/parser/test_data/parser/inline/ok/type_item_type_params.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0073_type_item_type_params.rs b/crates/parser/test_data/parser/inline/ok/type_item_type_params.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0073_type_item_type_params.rs
rename to crates/parser/test_data/parser/inline/ok/type_item_type_params.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0012_type_item_where_clause.rast b/crates/parser/test_data/parser/inline/ok/type_item_where_clause.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0012_type_item_where_clause.rast
rename to crates/parser/test_data/parser/inline/ok/type_item_where_clause.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0012_type_item_where_clause.rs b/crates/parser/test_data/parser/inline/ok/type_item_where_clause.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0012_type_item_where_clause.rs
rename to crates/parser/test_data/parser/inline/ok/type_item_where_clause.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0199_type_item_where_clause_deprecated.rast b/crates/parser/test_data/parser/inline/ok/type_item_where_clause_deprecated.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0199_type_item_where_clause_deprecated.rast
rename to crates/parser/test_data/parser/inline/ok/type_item_where_clause_deprecated.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0199_type_item_where_clause_deprecated.rs b/crates/parser/test_data/parser/inline/ok/type_item_where_clause_deprecated.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0199_type_item_where_clause_deprecated.rs
rename to crates/parser/test_data/parser/inline/ok/type_item_where_clause_deprecated.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0184_generic_param_list.rast b/crates/parser/test_data/parser/inline/ok/type_param.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0184_generic_param_list.rast
rename to crates/parser/test_data/parser/inline/ok/type_param.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0184_generic_param_list.rs b/crates/parser/test_data/parser/inline/ok/type_param.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0184_generic_param_list.rs
rename to crates/parser/test_data/parser/inline/ok/type_param.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0007_type_param_bounds.rast b/crates/parser/test_data/parser/inline/ok/type_param_bounds.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0007_type_param_bounds.rast
rename to crates/parser/test_data/parser/inline/ok/type_param_bounds.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0007_type_param_bounds.rs b/crates/parser/test_data/parser/inline/ok/type_param_bounds.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0007_type_param_bounds.rs
rename to crates/parser/test_data/parser/inline/ok/type_param_bounds.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0090_type_param_default.rast b/crates/parser/test_data/parser/inline/ok/type_param_default.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0090_type_param_default.rast
rename to crates/parser/test_data/parser/inline/ok/type_param_default.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0090_type_param_default.rs b/crates/parser/test_data/parser/inline/ok/type_param_default.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0090_type_param_default.rs
rename to crates/parser/test_data/parser/inline/ok/type_param_default.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0164_type_path_in_pattern.rast b/crates/parser/test_data/parser/inline/ok/type_path_in_pattern.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0164_type_path_in_pattern.rast
rename to crates/parser/test_data/parser/inline/ok/type_path_in_pattern.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0164_type_path_in_pattern.rs b/crates/parser/test_data/parser/inline/ok/type_path_in_pattern.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0164_type_path_in_pattern.rs
rename to crates/parser/test_data/parser/inline/ok/type_path_in_pattern.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0202_typepathfn_with_coloncolon.rast b/crates/parser/test_data/parser/inline/ok/typepathfn_with_coloncolon.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0202_typepathfn_with_coloncolon.rast
rename to crates/parser/test_data/parser/inline/ok/typepathfn_with_coloncolon.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0202_typepathfn_with_coloncolon.rs b/crates/parser/test_data/parser/inline/ok/typepathfn_with_coloncolon.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0202_typepathfn_with_coloncolon.rs
rename to crates/parser/test_data/parser/inline/ok/typepathfn_with_coloncolon.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0019_unary_expr.rast b/crates/parser/test_data/parser/inline/ok/unary_expr.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0019_unary_expr.rast
rename to crates/parser/test_data/parser/inline/ok/unary_expr.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0019_unary_expr.rs b/crates/parser/test_data/parser/inline/ok/unary_expr.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0019_unary_expr.rs
rename to crates/parser/test_data/parser/inline/ok/unary_expr.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0173_union_item.rast b/crates/parser/test_data/parser/inline/ok/union_item.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0173_union_item.rast
rename to crates/parser/test_data/parser/inline/ok/union_item.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0173_union_item.rs b/crates/parser/test_data/parser/inline/ok/union_item.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0173_union_item.rs
rename to crates/parser/test_data/parser/inline/ok/union_item.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0174_unit_struct.rast b/crates/parser/test_data/parser/inline/ok/unit_struct.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0174_unit_struct.rast
rename to crates/parser/test_data/parser/inline/ok/unit_struct.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0174_unit_struct.rs b/crates/parser/test_data/parser/inline/ok/unit_struct.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0174_unit_struct.rs
rename to crates/parser/test_data/parser/inline/ok/unit_struct.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0051_unit_type.rast b/crates/parser/test_data/parser/inline/ok/unit_type.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0051_unit_type.rast
rename to crates/parser/test_data/parser/inline/ok/unit_type.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0051_unit_type.rs b/crates/parser/test_data/parser/inline/ok/unit_type.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0051_unit_type.rs
rename to crates/parser/test_data/parser/inline/ok/unit_type.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0181_use_item.rast b/crates/parser/test_data/parser/inline/ok/use_item.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0181_use_item.rast
rename to crates/parser/test_data/parser/inline/ok/use_item.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0181_use_item.rs b/crates/parser/test_data/parser/inline/ok/use_item.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0181_use_item.rs
rename to crates/parser/test_data/parser/inline/ok/use_item.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0177_use_tree.rast b/crates/parser/test_data/parser/inline/ok/use_tree.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0177_use_tree.rast
rename to crates/parser/test_data/parser/inline/ok/use_tree.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0177_use_tree.rs b/crates/parser/test_data/parser/inline/ok/use_tree.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0177_use_tree.rs
rename to crates/parser/test_data/parser/inline/ok/use_tree.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0179_use_tree_abs_star.rast b/crates/parser/test_data/parser/inline/ok/use_tree_abs_star.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0179_use_tree_abs_star.rast
rename to crates/parser/test_data/parser/inline/ok/use_tree_abs_star.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0179_use_tree_abs_star.rs b/crates/parser/test_data/parser/inline/ok/use_tree_abs_star.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0179_use_tree_abs_star.rs
rename to crates/parser/test_data/parser/inline/ok/use_tree_abs_star.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0176_use_tree_alias.rast b/crates/parser/test_data/parser/inline/ok/use_tree_alias.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0176_use_tree_alias.rast
rename to crates/parser/test_data/parser/inline/ok/use_tree_alias.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0176_use_tree_alias.rs b/crates/parser/test_data/parser/inline/ok/use_tree_alias.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0176_use_tree_alias.rs
rename to crates/parser/test_data/parser/inline/ok/use_tree_alias.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0002_use_tree_list.rast b/crates/parser/test_data/parser/inline/ok/use_tree_list.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0002_use_tree_list.rast
rename to crates/parser/test_data/parser/inline/ok/use_tree_list.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0002_use_tree_list.rs b/crates/parser/test_data/parser/inline/ok/use_tree_list.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0002_use_tree_list.rs
rename to crates/parser/test_data/parser/inline/ok/use_tree_list.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0177_use_tree_path.rast b/crates/parser/test_data/parser/inline/ok/use_tree_path.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0177_use_tree_path.rast
rename to crates/parser/test_data/parser/inline/ok/use_tree_path.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0177_use_tree_path.rs b/crates/parser/test_data/parser/inline/ok/use_tree_path.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0177_use_tree_path.rs
rename to crates/parser/test_data/parser/inline/ok/use_tree_path.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0180_use_tree_path_star.rast b/crates/parser/test_data/parser/inline/ok/use_tree_path_star.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0180_use_tree_path_star.rast
rename to crates/parser/test_data/parser/inline/ok/use_tree_path_star.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0180_use_tree_path_star.rs b/crates/parser/test_data/parser/inline/ok/use_tree_path_star.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0180_use_tree_path_star.rs
rename to crates/parser/test_data/parser/inline/ok/use_tree_path_star.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0178_use_tree_path_use_tree.rast b/crates/parser/test_data/parser/inline/ok/use_tree_path_use_tree.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0178_use_tree_path_use_tree.rast
rename to crates/parser/test_data/parser/inline/ok/use_tree_path_use_tree.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0178_use_tree_path_use_tree.rs b/crates/parser/test_data/parser/inline/ok/use_tree_path_use_tree.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0178_use_tree_path_use_tree.rs
rename to crates/parser/test_data/parser/inline/ok/use_tree_path_use_tree.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0174_use_tree_star.rast b/crates/parser/test_data/parser/inline/ok/use_tree_star.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0174_use_tree_star.rast
rename to crates/parser/test_data/parser/inline/ok/use_tree_star.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0174_use_tree_star.rs b/crates/parser/test_data/parser/inline/ok/use_tree_star.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0174_use_tree_star.rs
rename to crates/parser/test_data/parser/inline/ok/use_tree_star.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0004_value_parameters_no_patterns.rast b/crates/parser/test_data/parser/inline/ok/value_parameters_no_patterns.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0004_value_parameters_no_patterns.rast
rename to crates/parser/test_data/parser/inline/ok/value_parameters_no_patterns.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0004_value_parameters_no_patterns.rs b/crates/parser/test_data/parser/inline/ok/value_parameters_no_patterns.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0004_value_parameters_no_patterns.rs
rename to crates/parser/test_data/parser/inline/ok/value_parameters_no_patterns.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0157_variant_discriminant.rast b/crates/parser/test_data/parser/inline/ok/variant_discriminant.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0157_variant_discriminant.rast
rename to crates/parser/test_data/parser/inline/ok/variant_discriminant.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0157_variant_discriminant.rs b/crates/parser/test_data/parser/inline/ok/variant_discriminant.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0157_variant_discriminant.rs
rename to crates/parser/test_data/parser/inline/ok/variant_discriminant.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0056_where_clause.rast b/crates/parser/test_data/parser/inline/ok/where_clause.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0056_where_clause.rast
rename to crates/parser/test_data/parser/inline/ok/where_clause.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0056_where_clause.rs b/crates/parser/test_data/parser/inline/ok/where_clause.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0056_where_clause.rs
rename to crates/parser/test_data/parser/inline/ok/where_clause.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0003_where_pred_for.rast b/crates/parser/test_data/parser/inline/ok/where_pred_for.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0003_where_pred_for.rast
rename to crates/parser/test_data/parser/inline/ok/where_pred_for.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0003_where_pred_for.rs b/crates/parser/test_data/parser/inline/ok/where_pred_for.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0003_where_pred_for.rs
rename to crates/parser/test_data/parser/inline/ok/where_pred_for.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0031_while_expr.rast b/crates/parser/test_data/parser/inline/ok/while_expr.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0031_while_expr.rast
rename to crates/parser/test_data/parser/inline/ok/while_expr.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0031_while_expr.rs b/crates/parser/test_data/parser/inline/ok/while_expr.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0031_while_expr.rs
rename to crates/parser/test_data/parser/inline/ok/while_expr.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0204_yeet_expr.rast b/crates/parser/test_data/parser/inline/ok/yeet_expr.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0204_yeet_expr.rast
rename to crates/parser/test_data/parser/inline/ok/yeet_expr.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0204_yeet_expr.rs b/crates/parser/test_data/parser/inline/ok/yeet_expr.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0204_yeet_expr.rs
rename to crates/parser/test_data/parser/inline/ok/yeet_expr.rs
diff --git a/crates/parser/test_data/parser/inline/ok/0159_yield_expr.rast b/crates/parser/test_data/parser/inline/ok/yield_expr.rast
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0159_yield_expr.rast
rename to crates/parser/test_data/parser/inline/ok/yield_expr.rast
diff --git a/crates/parser/test_data/parser/inline/ok/0159_yield_expr.rs b/crates/parser/test_data/parser/inline/ok/yield_expr.rs
similarity index 100%
rename from crates/parser/test_data/parser/inline/ok/0159_yield_expr.rs
rename to crates/parser/test_data/parser/inline/ok/yield_expr.rs
diff --git a/xtask/src/codegen.rs b/xtask/src/codegen.rs
index 2491952f52..aeb0c00ae6 100644
--- a/xtask/src/codegen.rs
+++ b/xtask/src/codegen.rs
@@ -162,12 +162,12 @@ fn add_preamble(cg: CodegenType, mut text: String) -> String {
 /// Checks that the `file` has the specified `contents`. If that is not the
 /// case, updates the file and then fails the test.
 #[allow(clippy::print_stderr)]
-fn ensure_file_contents(cg: CodegenType, file: &Path, contents: &str, check: bool) {
+fn ensure_file_contents(cg: CodegenType, file: &Path, contents: &str, check: bool) -> bool {
     let contents = normalize_newlines(contents);
     if let Ok(old_contents) = fs::read_to_string(file) {
         if normalize_newlines(&old_contents) == contents {
             // File is already up to date.
-            return;
+            return false;
         }
     }
 
@@ -194,6 +194,7 @@ fn ensure_file_contents(cg: CodegenType, file: &Path, contents: &str, check: boo
             let _ = fs::create_dir_all(parent);
         }
         fs::write(file, contents).unwrap();
+        true
     }
 }
 
diff --git a/xtask/src/codegen/parser_inline_tests.rs b/xtask/src/codegen/parser_inline_tests.rs
index 5983b06e1b..3a9073b4e4 100644
--- a/xtask/src/codegen/parser_inline_tests.rs
+++ b/xtask/src/codegen/parser_inline_tests.rs
@@ -6,68 +6,132 @@ use std::{
     collections::HashMap,
     fs, iter,
     path::{Path, PathBuf},
+    time::SystemTime,
 };
 
+use anyhow::Result;
+use itertools::Itertools as _;
+
 use crate::{
-    codegen::{ensure_file_contents, CommentBlock},
+    codegen::{ensure_file_contents, reformat, CommentBlock},
     project_root,
     util::list_rust_files,
 };
 
+const PARSER_CRATE_ROOT: &str = "crates/parser";
+const PARSER_TEST_DATA: &str = "crates/parser/test_data";
+const PARSER_TEST_DATA_INLINE: &str = "crates/parser/test_data/parser/inline";
+
 pub(crate) fn generate(check: bool) {
-    let grammar_dir = project_root().join(Path::new("crates/parser/src/grammar"));
-    let tests = tests_from_dir(&grammar_dir);
+    let tests = tests_from_dir(
+        &project_root().join(Path::new(&format!("{PARSER_CRATE_ROOT}/src/grammar"))),
+    );
 
-    install_tests(&tests.ok, "crates/parser/test_data/parser/inline/ok", check);
-    install_tests(&tests.err, "crates/parser/test_data/parser/inline/err", check);
+    let mut some_file_was_updated = false;
+    some_file_was_updated |=
+        install_tests(&tests.ok, &format!("{PARSER_TEST_DATA_INLINE}/ok"), check).unwrap();
+    some_file_was_updated |=
+        install_tests(&tests.err, &format!("{PARSER_TEST_DATA_INLINE}/err"), check).unwrap();
 
-    fn install_tests(tests: &HashMap, into: &str, check: bool) {
-        let tests_dir = project_root().join(into);
-        if !tests_dir.is_dir() {
-            fs::create_dir_all(&tests_dir).unwrap();
-        }
-        // ok is never actually read, but it needs to be specified to create a Test in existing_tests
-        let existing = existing_tests(&tests_dir, true);
-        if let Some(t) = existing.keys().find(|&t| !tests.contains_key(t)) {
-            panic!("Test is deleted: {t}");
-        }
+    if some_file_was_updated {
+        let _ = fs::File::open(&format!("{PARSER_CRATE_ROOT}/src/tests.rs"))
+            .unwrap()
+            .set_modified(SystemTime::now());
 
-        let mut new_idx = existing.len() + 1;
-        for (name, test) in tests {
-            let path = match existing.get(name) {
-                Some((path, _test)) => path.clone(),
-                None => {
-                    let file_name = format!("{new_idx:04}_{name}.rs");
-                    new_idx += 1;
-                    tests_dir.join(file_name)
+        let ok_tests = tests.ok.keys().sorted().map(|k| {
+            let test_name = quote::format_ident!("{}", k);
+            let test_file = format!("test_data/parser/inline/ok/{test_name}.rs");
+            quote::quote! {
+                #[test]
+                fn #test_name() {
+                    run_and_expect_no_errors(#test_file);
                 }
-            };
-            ensure_file_contents(crate::flags::CodegenType::ParserTests, &path, &test.text, check);
+            }
+        });
+        let err_tests = tests.err.keys().sorted().map(|k| {
+            let test_name = quote::format_ident!("{}", k);
+            let test_file = format!("test_data/parser/inline/err/{test_name}.rs");
+            quote::quote! {
+                #[test]
+                fn #test_name() {
+                    run_and_expect_errors(#test_file);
+                }
+            }
+        });
+
+        let output = quote::quote! {
+            mod ok {
+                use crate::tests::run_and_expect_no_errors;
+                #(#ok_tests)*
+            }
+            mod err {
+                use crate::tests::run_and_expect_errors;
+                #(#err_tests)*
+            }
+        };
+
+        let pretty = reformat(output.to_string());
+        ensure_file_contents(
+            crate::flags::CodegenType::ParserTests,
+            format!("{PARSER_TEST_DATA}/generated/runner.rs").as_ref(),
+            &pretty,
+            check,
+        );
+    }
+}
+
+fn install_tests(tests: &HashMap, into: &str, check: bool) -> Result {
+    let tests_dir = project_root().join(into);
+    if !tests_dir.is_dir() {
+        fs::create_dir_all(&tests_dir)?;
+    }
+    let existing = existing_tests(&tests_dir, TestKind::Ok)?;
+    if let Some((t, (path, _))) = existing.iter().find(|&(t, _)| !tests.contains_key(t)) {
+        panic!("Test `{t}` is deleted: {}", path.display());
+    }
+
+    let mut some_file_was_updated = false;
+
+    for (name, test) in tests {
+        let path = match existing.get(name) {
+            Some((path, _test)) => path.clone(),
+            None => tests_dir.join(name).with_extension("rs"),
+        };
+        if ensure_file_contents(crate::flags::CodegenType::ParserTests, &path, &test.text, check) {
+            some_file_was_updated = true;
         }
     }
+
+    Ok(some_file_was_updated)
 }
 
 #[derive(Debug)]
 struct Test {
-    name: String,
-    text: String,
-    ok: bool,
+    pub name: String,
+    pub text: String,
+    pub kind: TestKind,
+}
+
+#[derive(Copy, Clone, Debug)]
+enum TestKind {
+    Ok,
+    Err,
 }
 
 #[derive(Default, Debug)]
 struct Tests {
-    ok: HashMap,
-    err: HashMap,
+    pub ok: HashMap,
+    pub err: HashMap,
 }
 
 fn collect_tests(s: &str) -> Vec {
     let mut res = Vec::new();
     for comment_block in CommentBlock::extract_untagged(s) {
         let first_line = &comment_block.contents[0];
-        let (name, ok) = if let Some(name) = first_line.strip_prefix("test ") {
-            (name.to_owned(), true)
+        let (name, kind) = if let Some(name) = first_line.strip_prefix("test ") {
+            (name.to_owned(), TestKind::Ok)
         } else if let Some(name) = first_line.strip_prefix("test_err ") {
-            (name.to_owned(), false)
+            (name.to_owned(), TestKind::Err)
         } else {
             continue;
         };
@@ -78,7 +142,7 @@ fn collect_tests(s: &str) -> Vec {
             .collect::>()
             .join("\n");
         assert!(!text.trim().is_empty() && text.ends_with('\n'));
-        res.push(Test { name, text, ok })
+        res.push(Test { name, text, kind })
     }
     res
 }
@@ -96,7 +160,7 @@ fn tests_from_dir(dir: &Path) -> Tests {
         let text = fs::read_to_string(path).unwrap();
 
         for test in collect_tests(&text) {
-            if test.ok {
+            if let TestKind::Ok = test.kind {
                 if let Some(old_test) = res.ok.insert(test.name.clone(), test) {
                     panic!("Duplicate test: {}", old_test.name);
                 }
@@ -107,25 +171,22 @@ fn tests_from_dir(dir: &Path) -> Tests {
     }
 }
 
-fn existing_tests(dir: &Path, ok: bool) -> HashMap {
-    let mut res = HashMap::default();
-    for file in fs::read_dir(dir).unwrap() {
-        let file = file.unwrap();
-        let path = file.path();
-        if path.extension().unwrap_or_default() != "rs" {
-            continue;
-        }
-        let name = {
-            let file_name = path.file_name().unwrap().to_str().unwrap();
-            file_name[5..file_name.len() - 3].to_string()
-        };
-        let text = fs::read_to_string(&path).unwrap();
-        let test = Test { name: name.clone(), text, ok };
-        if let Some(old) = res.insert(name, (path, test)) {
-            println!("Duplicate test: {old:?}");
+fn existing_tests(dir: &Path, ok: TestKind) -> Result> {
+    let mut res = HashMap::new();
+    for file in fs::read_dir(dir)? {
+        let path = file?.path();
+        let rust_file = path.extension().and_then(|ext| ext.to_str()) == Some("rs");
+
+        if rust_file {
+            let name = path.file_stem().map(|x| x.to_string_lossy().to_string()).unwrap();
+            let text = fs::read_to_string(&path)?;
+            let test = Test { name: name.clone(), text, kind: ok };
+            if let Some(old) = res.insert(name, (path, test)) {
+                println!("Duplicate test: {:?}", old);
+            }
         }
     }
-    res
+    Ok(res)
 }
 
 #[test]

From 713c47f25b8c4ef9ac56ad6877bfb036f87b7d67 Mon Sep 17 00:00:00 2001
From: Lukas Wirth 
Date: Thu, 18 Jul 2024 10:26:58 +0200
Subject: [PATCH 4/7] Add basic edition inline parser test support

---
 crates/parser/src/grammar/expressions/atom.rs |   2 +-
 crates/parser/src/tests.rs                    |  26 +++-
 crates/parser/src/tests/top_entries.rs        |   2 +-
 crates/parser/test_data/generated/runner.rs   |  13 +-
 .../parser/inline/err/gen_blocks.rast         | 139 ------------------
 .../parser/inline/ok/gen_blocks.rast          | 101 +++++++++++++
 .../parser/inline/{err => ok}/gen_blocks.rs   |   1 +
 xtask/src/codegen/parser_inline_tests.rs      |  73 ++++++---
 8 files changed, 185 insertions(+), 172 deletions(-)
 delete mode 100644 crates/parser/test_data/parser/inline/err/gen_blocks.rast
 create mode 100644 crates/parser/test_data/parser/inline/ok/gen_blocks.rast
 rename crates/parser/test_data/parser/inline/{err => ok}/gen_blocks.rs (94%)

diff --git a/crates/parser/src/grammar/expressions/atom.rs b/crates/parser/src/grammar/expressions/atom.rs
index 54c874d06c..3d7d85a539 100644
--- a/crates/parser/src/grammar/expressions/atom.rs
+++ b/crates/parser/src/grammar/expressions/atom.rs
@@ -145,7 +145,7 @@ pub(super) fn atom_expr(
             stmt_list(p);
             m.complete(p, BLOCK_EXPR)
         }
-        // test_err gen_blocks
+        // test gen_blocks 2024
         // pub fn main() {
         //     gen { yield ""; };
         //     async gen { yield ""; };
diff --git a/crates/parser/src/tests.rs b/crates/parser/src/tests.rs
index e0042fbdec..b4b6759e90 100644
--- a/crates/parser/src/tests.rs
+++ b/crates/parser/src/tests.rs
@@ -51,7 +51,7 @@ fn lex(text: &str) -> String {
 fn parse_ok() {
     for case in TestCase::list("parser/ok") {
         let _guard = stdx::panic_context::enter(format!("{:?}", case.rs));
-        let (actual, errors) = parse(TopEntryPoint::SourceFile, &case.text);
+        let (actual, errors) = parse(TopEntryPoint::SourceFile, &case.text, Edition::CURRENT);
         assert!(!errors, "errors in an OK file {}:\n{actual}", case.rs.display());
         expect_file![case.rast].assert_eq(&actual);
     }
@@ -61,16 +61,16 @@ fn parse_ok() {
 fn parse_err() {
     for case in TestCase::list("parser/err") {
         let _guard = stdx::panic_context::enter(format!("{:?}", case.rs));
-        let (actual, errors) = parse(TopEntryPoint::SourceFile, &case.text);
+        let (actual, errors) = parse(TopEntryPoint::SourceFile, &case.text, Edition::CURRENT);
         assert!(errors, "no errors in an ERR file {}:\n{actual}", case.rs.display());
         expect_file![case.rast].assert_eq(&actual)
     }
 }
 
-fn parse(entry: TopEntryPoint, text: &str) -> (String, bool) {
-    let lexed = LexedStr::new(Edition::CURRENT, text);
+fn parse(entry: TopEntryPoint, text: &str, edition: Edition) -> (String, bool) {
+    let lexed = LexedStr::new(edition, text);
     let input = lexed.to_input();
-    let output = entry.parse(&input, Edition::CURRENT);
+    let output = entry.parse(&input, edition);
 
     let mut buf = String::new();
     let mut errors = Vec::new();
@@ -153,9 +153,19 @@ impl TestCase {
 
 #[track_caller]
 fn run_and_expect_no_errors(path: &str) {
+    run_and_expect_no_errors_with_edition(path, Edition::CURRENT)
+}
+
+#[track_caller]
+fn run_and_expect_errors(path: &str) {
+    run_and_expect_errors_with_edition(path, Edition::CURRENT)
+}
+
+#[track_caller]
+fn run_and_expect_no_errors_with_edition(path: &str, edition: Edition) {
     let path = PathBuf::from(path);
     let text = std::fs::read_to_string(&path).unwrap();
-    let (actual, errors) = parse(TopEntryPoint::SourceFile, &text);
+    let (actual, errors) = parse(TopEntryPoint::SourceFile, &text, edition);
     assert!(!errors, "errors in an OK file {}:\n{actual}", path.display());
     let mut p = PathBuf::from("..");
     p.push(path);
@@ -164,10 +174,10 @@ fn run_and_expect_no_errors(path: &str) {
 }
 
 #[track_caller]
-fn run_and_expect_errors(path: &str) {
+fn run_and_expect_errors_with_edition(path: &str, edition: Edition) {
     let path = PathBuf::from(path);
     let text = std::fs::read_to_string(&path).unwrap();
-    let (actual, errors) = parse(TopEntryPoint::SourceFile, &text);
+    let (actual, errors) = parse(TopEntryPoint::SourceFile, &text, edition);
     assert!(errors, "no errors in an ERR file {}:\n{actual}", path.display());
     let mut p = PathBuf::from("..");
     p.push(path);
diff --git a/crates/parser/src/tests/top_entries.rs b/crates/parser/src/tests/top_entries.rs
index 49dd9e293b..c56bf0b644 100644
--- a/crates/parser/src/tests/top_entries.rs
+++ b/crates/parser/src/tests/top_entries.rs
@@ -307,6 +307,6 @@ fn expr() {
 
 #[track_caller]
 fn check(entry: TopEntryPoint, input: &str, expect: expect_test::Expect) {
-    let (parsed, _errors) = super::parse(entry, input);
+    let (parsed, _errors) = super::parse(entry, input, crate::Edition::CURRENT);
     expect.assert_eq(&parsed)
 }
diff --git a/crates/parser/test_data/generated/runner.rs b/crates/parser/test_data/generated/runner.rs
index f82d1ed320..aa8210541a 100644
--- a/crates/parser/test_data/generated/runner.rs
+++ b/crates/parser/test_data/generated/runner.rs
@@ -1,5 +1,5 @@
 mod ok {
-    use crate::tests::run_and_expect_no_errors;
+    use crate::tests::*;
     #[test]
     fn anonymous_const() {
         run_and_expect_no_errors("test_data/parser/inline/ok/anonymous_const.rs");
@@ -267,6 +267,13 @@ mod ok {
         run_and_expect_no_errors("test_data/parser/inline/ok/function_where_clause.rs");
     }
     #[test]
+    fn gen_blocks() {
+        run_and_expect_no_errors_with_edition(
+            "test_data/parser/inline/ok/gen_blocks.rs",
+            crate::Edition::Edition2024,
+        );
+    }
+    #[test]
     fn generic_arg() { run_and_expect_no_errors("test_data/parser/inline/ok/generic_arg.rs"); }
     #[test]
     fn generic_param_attribute() {
@@ -666,7 +673,7 @@ mod ok {
     fn yield_expr() { run_and_expect_no_errors("test_data/parser/inline/ok/yield_expr.rs"); }
 }
 mod err {
-    use crate::tests::run_and_expect_errors;
+    use crate::tests::*;
     #[test]
     fn angled_path_without_qual() {
         run_and_expect_errors("test_data/parser/inline/err/angled_path_without_qual.rs");
@@ -708,8 +715,6 @@ mod err {
         run_and_expect_errors("test_data/parser/inline/err/fn_pointer_type_missing_fn.rs");
     }
     #[test]
-    fn gen_blocks() { run_and_expect_errors("test_data/parser/inline/err/gen_blocks.rs"); }
-    #[test]
     fn gen_fn() { run_and_expect_errors("test_data/parser/inline/err/gen_fn.rs"); }
     #[test]
     fn generic_arg_list_recover() {
diff --git a/crates/parser/test_data/parser/inline/err/gen_blocks.rast b/crates/parser/test_data/parser/inline/err/gen_blocks.rast
deleted file mode 100644
index 08a85891ed..0000000000
--- a/crates/parser/test_data/parser/inline/err/gen_blocks.rast
+++ /dev/null
@@ -1,139 +0,0 @@
-SOURCE_FILE
-  FN
-    VISIBILITY
-      PUB_KW "pub"
-    WHITESPACE " "
-    FN_KW "fn"
-    WHITESPACE " "
-    NAME
-      IDENT "main"
-    PARAM_LIST
-      L_PAREN "("
-      R_PAREN ")"
-    WHITESPACE " "
-    BLOCK_EXPR
-      STMT_LIST
-        L_CURLY "{"
-        WHITESPACE "\n    "
-        EXPR_STMT
-          RECORD_EXPR
-            PATH
-              PATH_SEGMENT
-                NAME_REF
-                  IDENT "gen"
-            WHITESPACE " "
-            RECORD_EXPR_FIELD_LIST
-              L_CURLY "{"
-              WHITESPACE " "
-              ERROR
-                YIELD_KW "yield"
-              WHITESPACE " "
-              ERROR
-                STRING "\"\""
-              ERROR
-                SEMICOLON ";"
-              WHITESPACE " "
-              R_CURLY "}"
-          SEMICOLON ";"
-        WHITESPACE "\n    "
-        ERROR
-          ASYNC_KW "async"
-        WHITESPACE " "
-        EXPR_STMT
-          RECORD_EXPR
-            PATH
-              PATH_SEGMENT
-                NAME_REF
-                  IDENT "gen"
-            WHITESPACE " "
-            RECORD_EXPR_FIELD_LIST
-              L_CURLY "{"
-              WHITESPACE " "
-              ERROR
-                YIELD_KW "yield"
-              WHITESPACE " "
-              ERROR
-                STRING "\"\""
-              ERROR
-                SEMICOLON ";"
-              WHITESPACE " "
-              R_CURLY "}"
-          SEMICOLON ";"
-        WHITESPACE "\n    "
-        EXPR_STMT
-          PATH_EXPR
-            PATH
-              PATH_SEGMENT
-                NAME_REF
-                  IDENT "gen"
-        WHITESPACE " "
-        EXPR_STMT
-          CLOSURE_EXPR
-            MOVE_KW "move"
-        WHITESPACE " "
-        EXPR_STMT
-          BLOCK_EXPR
-            STMT_LIST
-              L_CURLY "{"
-              WHITESPACE " "
-              EXPR_STMT
-                YIELD_EXPR
-                  YIELD_KW "yield"
-                  WHITESPACE " "
-                  LITERAL
-                    STRING "\"\""
-                SEMICOLON ";"
-              WHITESPACE " "
-              R_CURLY "}"
-          SEMICOLON ";"
-        WHITESPACE "\n    "
-        ERROR
-          ASYNC_KW "async"
-        WHITESPACE " "
-        EXPR_STMT
-          PATH_EXPR
-            PATH
-              PATH_SEGMENT
-                NAME_REF
-                  IDENT "gen"
-        WHITESPACE " "
-        EXPR_STMT
-          CLOSURE_EXPR
-            MOVE_KW "move"
-        WHITESPACE " "
-        EXPR_STMT
-          BLOCK_EXPR
-            STMT_LIST
-              L_CURLY "{"
-              WHITESPACE " "
-              EXPR_STMT
-                YIELD_EXPR
-                  YIELD_KW "yield"
-                  WHITESPACE " "
-                  LITERAL
-                    STRING "\"\""
-                SEMICOLON ";"
-              WHITESPACE " "
-              R_CURLY "}"
-          SEMICOLON ";"
-        WHITESPACE "\n"
-        R_CURLY "}"
-  WHITESPACE "\n"
-error 26: expected identifier
-error 31: expected COMMA
-error 32: expected identifier
-error 34: expected COMMA
-error 34: expected identifier
-error 48: expected fn, trait or impl
-error 55: expected identifier
-error 60: expected COMMA
-error 61: expected identifier
-error 63: expected COMMA
-error 63: expected identifier
-error 75: expected SEMICOLON
-error 80: expected `|`
-error 80: expected SEMICOLON
-error 105: expected fn, trait or impl
-error 109: expected SEMICOLON
-error 114: expected `|`
-error 114: expected SEMICOLON
diff --git a/crates/parser/test_data/parser/inline/ok/gen_blocks.rast b/crates/parser/test_data/parser/inline/ok/gen_blocks.rast
new file mode 100644
index 0000000000..6e8df9897e
--- /dev/null
+++ b/crates/parser/test_data/parser/inline/ok/gen_blocks.rast
@@ -0,0 +1,101 @@
+SOURCE_FILE
+  FN
+    COMMENT "// 2024"
+    WHITESPACE "\n"
+    VISIBILITY
+      PUB_KW "pub"
+    WHITESPACE " "
+    FN_KW "fn"
+    WHITESPACE " "
+    NAME
+      IDENT "main"
+    PARAM_LIST
+      L_PAREN "("
+      R_PAREN ")"
+    WHITESPACE " "
+    BLOCK_EXPR
+      STMT_LIST
+        L_CURLY "{"
+        WHITESPACE "\n    "
+        EXPR_STMT
+          BLOCK_EXPR
+            GEN_KW "gen"
+            WHITESPACE " "
+            STMT_LIST
+              L_CURLY "{"
+              WHITESPACE " "
+              EXPR_STMT
+                YIELD_EXPR
+                  YIELD_KW "yield"
+                  WHITESPACE " "
+                  LITERAL
+                    STRING "\"\""
+                SEMICOLON ";"
+              WHITESPACE " "
+              R_CURLY "}"
+          SEMICOLON ";"
+        WHITESPACE "\n    "
+        EXPR_STMT
+          BLOCK_EXPR
+            ASYNC_KW "async"
+            WHITESPACE " "
+            GEN_KW "gen"
+            WHITESPACE " "
+            STMT_LIST
+              L_CURLY "{"
+              WHITESPACE " "
+              EXPR_STMT
+                YIELD_EXPR
+                  YIELD_KW "yield"
+                  WHITESPACE " "
+                  LITERAL
+                    STRING "\"\""
+                SEMICOLON ";"
+              WHITESPACE " "
+              R_CURLY "}"
+          SEMICOLON ";"
+        WHITESPACE "\n    "
+        EXPR_STMT
+          BLOCK_EXPR
+            GEN_KW "gen"
+            WHITESPACE " "
+            MOVE_KW "move"
+            WHITESPACE " "
+            STMT_LIST
+              L_CURLY "{"
+              WHITESPACE " "
+              EXPR_STMT
+                YIELD_EXPR
+                  YIELD_KW "yield"
+                  WHITESPACE " "
+                  LITERAL
+                    STRING "\"\""
+                SEMICOLON ";"
+              WHITESPACE " "
+              R_CURLY "}"
+          SEMICOLON ";"
+        WHITESPACE "\n    "
+        EXPR_STMT
+          BLOCK_EXPR
+            ASYNC_KW "async"
+            WHITESPACE " "
+            GEN_KW "gen"
+            WHITESPACE " "
+            MOVE_KW "move"
+            WHITESPACE " "
+            STMT_LIST
+              L_CURLY "{"
+              WHITESPACE " "
+              EXPR_STMT
+                YIELD_EXPR
+                  YIELD_KW "yield"
+                  WHITESPACE " "
+                  LITERAL
+                    STRING "\"\""
+                SEMICOLON ";"
+              WHITESPACE " "
+              R_CURLY "}"
+          SEMICOLON ";"
+        WHITESPACE "\n"
+        R_CURLY "}"
+  WHITESPACE "\n"
diff --git a/crates/parser/test_data/parser/inline/err/gen_blocks.rs b/crates/parser/test_data/parser/inline/ok/gen_blocks.rs
similarity index 94%
rename from crates/parser/test_data/parser/inline/err/gen_blocks.rs
rename to crates/parser/test_data/parser/inline/ok/gen_blocks.rs
index f7687331d6..669b434973 100644
--- a/crates/parser/test_data/parser/inline/err/gen_blocks.rs
+++ b/crates/parser/test_data/parser/inline/ok/gen_blocks.rs
@@ -1,3 +1,4 @@
+// 2024
 pub fn main() {
     gen { yield ""; };
     async gen { yield ""; };
diff --git a/xtask/src/codegen/parser_inline_tests.rs b/xtask/src/codegen/parser_inline_tests.rs
index 3a9073b4e4..f9f73df8eb 100644
--- a/xtask/src/codegen/parser_inline_tests.rs
+++ b/xtask/src/codegen/parser_inline_tests.rs
@@ -34,38 +34,60 @@ pub(crate) fn generate(check: bool) {
         install_tests(&tests.err, &format!("{PARSER_TEST_DATA_INLINE}/err"), check).unwrap();
 
     if some_file_was_updated {
-        let _ = fs::File::open(&format!("{PARSER_CRATE_ROOT}/src/tests.rs"))
+        let _ = fs::File::open(format!("{PARSER_CRATE_ROOT}/src/tests.rs"))
             .unwrap()
             .set_modified(SystemTime::now());
 
-        let ok_tests = tests.ok.keys().sorted().map(|k| {
-            let test_name = quote::format_ident!("{}", k);
+        let ok_tests = tests.ok.values().sorted_by(|a, b| a.name.cmp(&b.name)).map(|test| {
+            let test_name = quote::format_ident!("{}", test.name);
             let test_file = format!("test_data/parser/inline/ok/{test_name}.rs");
+            let (test_func, args) = match &test.edition {
+                Some(edition) => {
+                    let edition = quote::format_ident!("Edition{edition}");
+                    (
+                        quote::format_ident!("run_and_expect_no_errors_with_edition"),
+                        quote::quote! {#test_file, crate::Edition::#edition},
+                    )
+                }
+                None => {
+                    (quote::format_ident!("run_and_expect_no_errors"), quote::quote! {#test_file})
+                }
+            };
             quote::quote! {
                 #[test]
                 fn #test_name() {
-                    run_and_expect_no_errors(#test_file);
+                    #test_func(#args);
                 }
             }
         });
-        let err_tests = tests.err.keys().sorted().map(|k| {
-            let test_name = quote::format_ident!("{}", k);
+        let err_tests = tests.err.values().sorted_by(|a, b| a.name.cmp(&b.name)).map(|test| {
+            let test_name = quote::format_ident!("{}", test.name);
             let test_file = format!("test_data/parser/inline/err/{test_name}.rs");
+            let (test_func, args) = match &test.edition {
+                Some(edition) => {
+                    let edition = quote::format_ident!("Edition{edition}");
+                    (
+                        quote::format_ident!("run_and_expect_errors_with_edition"),
+                        quote::quote! {#test_file, crate::Edition::#edition},
+                    )
+                }
+                None => (quote::format_ident!("run_and_expect_errors"), quote::quote! {#test_file}),
+            };
             quote::quote! {
                 #[test]
                 fn #test_name() {
-                    run_and_expect_errors(#test_file);
+                    #test_func(#args);
                 }
             }
         });
 
         let output = quote::quote! {
             mod ok {
-                use crate::tests::run_and_expect_no_errors;
+                use crate::tests::*;
                 #(#ok_tests)*
             }
             mod err {
-                use crate::tests::run_and_expect_errors;
+                use crate::tests::*;
                 #(#err_tests)*
             }
         };
@@ -107,9 +129,10 @@ fn install_tests(tests: &HashMap, into: &str, check: bool) -> Resu
 
 #[derive(Debug)]
 struct Test {
-    pub name: String,
-    pub text: String,
-    pub kind: TestKind,
+    name: String,
+    text: String,
+    kind: TestKind,
+    edition: Option,
 }
 
 #[derive(Copy, Clone, Debug)]
@@ -120,8 +143,8 @@ enum TestKind {
 
 #[derive(Default, Debug)]
 struct Tests {
-    pub ok: HashMap,
-    pub err: HashMap,
+    ok: HashMap,
+    err: HashMap,
 }
 
 fn collect_tests(s: &str) -> Vec {
@@ -135,14 +158,24 @@ fn collect_tests(s: &str) -> Vec {
         } else {
             continue;
         };
-        let text: String = comment_block.contents[1..]
-            .iter()
-            .cloned()
+        let (name, edition) = match *name.split(' ').collect_vec().as_slice() {
+            [name, edition] => {
+                assert!(!edition.contains(' '));
+                (name.to_owned(), Some(edition.to_owned()))
+            }
+            [name] => (name.to_owned(), None),
+            _ => panic!("invalid test name: {:?}", name),
+        };
+        let text: String = edition
+            .as_ref()
+            .map(|edition| format!("// {edition}"))
+            .into_iter()
+            .chain(comment_block.contents[1..].iter().cloned())
             .chain(iter::once(String::new()))
             .collect::>()
             .join("\n");
         assert!(!text.trim().is_empty() && text.ends_with('\n'));
-        res.push(Test { name, text, kind })
+        res.push(Test { name, edition, text, kind })
     }
     res
 }
@@ -180,7 +213,9 @@ fn existing_tests(dir: &Path, ok: TestKind) -> Result
Date: Fri, 19 Jul 2024 15:26:50 +0200
Subject: [PATCH 5/7] Parse `try` as a keyword only in edition 2018 and up

---
 crates/ide-ssr/src/tests.rs                   |  6 ++---
 crates/parser/src/grammar/expressions/atom.rs | 20 ++--------------
 crates/parser/src/grammar/items.rs            | 24 ++++---------------
 crates/parser/test_data/generated/runner.rs   | 10 ++++++--
 .../parser/inline/ok/try_macro_fallback.rast  |  2 ++
 .../parser/inline/ok/try_macro_fallback.rs    |  1 +
 .../parser/inline/ok/try_macro_rules.rast     |  2 ++
 .../parser/inline/ok/try_macro_rules.rs       |  1 +
 8 files changed, 24 insertions(+), 42 deletions(-)

diff --git a/crates/ide-ssr/src/tests.rs b/crates/ide-ssr/src/tests.rs
index c5125cf42e..4477a268b2 100644
--- a/crates/ide-ssr/src/tests.rs
+++ b/crates/ide-ssr/src/tests.rs
@@ -844,9 +844,9 @@ fn f1() -> DynTrait> {foo()}
 #[test]
 fn replace_macro_invocations() {
     assert_ssr_transform(
-        "try!($a) ==>> $a?",
-        "macro_rules! try {() => {}} fn f1() -> Result<(), E> {bar(try!(foo()));}",
-        expect![["macro_rules! try {() => {}} fn f1() -> Result<(), E> {bar(foo()?);}"]],
+        "try_!($a) ==>> $a?",
+        "macro_rules! try_ {() => {}} fn f1() -> Result<(), E> {bar(try_!(foo()));}",
+        expect![["macro_rules! try_ {() => {}} fn f1() -> Result<(), E> {bar(foo()?);}"]],
     );
     // FIXME: Figure out why this doesn't work anymore
     // assert_ssr_transform(
diff --git a/crates/parser/src/grammar/expressions/atom.rs b/crates/parser/src/grammar/expressions/atom.rs
index 3d7d85a539..a678c1f3a7 100644
--- a/crates/parser/src/grammar/expressions/atom.rs
+++ b/crates/parser/src/grammar/expressions/atom.rs
@@ -101,6 +101,8 @@ pub(super) fn atom_expr(
         }
         T![loop] => loop_expr(p, None),
         T![while] => while_expr(p, None),
+        // test try_macro_fallback 2015
+        // fn foo() { try!(Ok(())); }
         T![try] => try_block_expr(p, None),
         T![match] => match_expr(p),
         T![return] => return_expr(p),
@@ -767,24 +769,6 @@ fn break_expr(p: &mut Parser<'_>, r: Restrictions) -> CompletedMarker {
 fn try_block_expr(p: &mut Parser<'_>, m: Option) -> CompletedMarker {
     assert!(p.at(T![try]));
     let m = m.unwrap_or_else(|| p.start());
-    // Special-case `try!` as macro.
-    // This is a hack until we do proper edition support
-    if p.nth_at(1, T![!]) {
-        // test try_macro_fallback
-        // fn foo() { try!(Ok(())); }
-        let macro_call = p.start();
-        let path = p.start();
-        let path_segment = p.start();
-        let name_ref = p.start();
-        p.bump_remap(IDENT);
-        name_ref.complete(p, NAME_REF);
-        path_segment.complete(p, PATH_SEGMENT);
-        path.complete(p, PATH);
-        let _block_like = items::macro_call_after_excl(p);
-        macro_call.complete(p, MACRO_CALL);
-        return m.complete(p, MACRO_EXPR);
-    }
-
     p.bump(T![try]);
     if p.at(T!['{']) {
         stmt_list(p);
diff --git a/crates/parser/src/grammar/items.rs b/crates/parser/src/grammar/items.rs
index df117d7aa9..4e2a50d7a1 100644
--- a/crates/parser/src/grammar/items.rs
+++ b/crates/parser/src/grammar/items.rs
@@ -230,13 +230,8 @@ fn opt_item_without_modifiers(p: &mut Parser<'_>, m: Marker) -> Result<(), Marke
         IDENT if p.at_contextual_kw(T![union]) && p.nth(1) == IDENT => adt::union(p, m),
 
         T![macro] => macro_def(p, m),
-        // check if current token is "macro_rules" followed by "!" followed by an identifier or "try"
-        // try is keyword since the 2018 edition and the parser is not edition aware (yet!)
-        IDENT
-            if p.at_contextual_kw(T![macro_rules])
-                && p.nth_at(1, BANG)
-                && (p.nth_at(2, IDENT) || p.nth_at(2, T![try])) =>
-        {
+        // check if current token is "macro_rules" followed by "!" followed by an identifier
+        IDENT if p.at_contextual_kw(T![macro_rules]) && p.nth_at(1, BANG) && p.nth_at(2, IDENT) => {
             macro_rules(p, m)
         }
 
@@ -334,23 +329,14 @@ pub(crate) fn extern_item_list(p: &mut Parser<'_>) {
     m.complete(p, EXTERN_ITEM_LIST);
 }
 
+// test try_macro_rules 2015
+// macro_rules! try { () => {} }
 fn macro_rules(p: &mut Parser<'_>, m: Marker) {
     assert!(p.at_contextual_kw(T![macro_rules]));
     p.bump_remap(T![macro_rules]);
     p.expect(T![!]);
 
-    // Special-case `macro_rules! try`.
-    // This is a hack until we do proper edition support
-
-    // test try_macro_rules
-    // macro_rules! try { () => {} }
-    if p.at(T![try]) {
-        let m = p.start();
-        p.bump_remap(IDENT);
-        m.complete(p, NAME);
-    } else {
-        name(p);
-    }
+    name(p);
 
     match p.current() {
         // test macro_rules_non_brace
diff --git a/crates/parser/test_data/generated/runner.rs b/crates/parser/test_data/generated/runner.rs
index aa8210541a..d0e6b3f6c9 100644
--- a/crates/parser/test_data/generated/runner.rs
+++ b/crates/parser/test_data/generated/runner.rs
@@ -559,11 +559,17 @@ mod ok {
     fn try_expr() { run_and_expect_no_errors("test_data/parser/inline/ok/try_expr.rs"); }
     #[test]
     fn try_macro_fallback() {
-        run_and_expect_no_errors("test_data/parser/inline/ok/try_macro_fallback.rs");
+        run_and_expect_no_errors_with_edition(
+            "test_data/parser/inline/ok/try_macro_fallback.rs",
+            crate::Edition::Edition2015,
+        );
     }
     #[test]
     fn try_macro_rules() {
-        run_and_expect_no_errors("test_data/parser/inline/ok/try_macro_rules.rs");
+        run_and_expect_no_errors_with_edition(
+            "test_data/parser/inline/ok/try_macro_rules.rs",
+            crate::Edition::Edition2015,
+        );
     }
     #[test]
     fn tuple_attrs() { run_and_expect_no_errors("test_data/parser/inline/ok/tuple_attrs.rs"); }
diff --git a/crates/parser/test_data/parser/inline/ok/try_macro_fallback.rast b/crates/parser/test_data/parser/inline/ok/try_macro_fallback.rast
index 0adb678fa6..38e21b845d 100644
--- a/crates/parser/test_data/parser/inline/ok/try_macro_fallback.rast
+++ b/crates/parser/test_data/parser/inline/ok/try_macro_fallback.rast
@@ -1,5 +1,7 @@
 SOURCE_FILE
   FN
+    COMMENT "// 2015"
+    WHITESPACE "\n"
     FN_KW "fn"
     WHITESPACE " "
     NAME
diff --git a/crates/parser/test_data/parser/inline/ok/try_macro_fallback.rs b/crates/parser/test_data/parser/inline/ok/try_macro_fallback.rs
index 61a6b46a0b..6ad5ea4357 100644
--- a/crates/parser/test_data/parser/inline/ok/try_macro_fallback.rs
+++ b/crates/parser/test_data/parser/inline/ok/try_macro_fallback.rs
@@ -1 +1,2 @@
+// 2015
 fn foo() { try!(Ok(())); }
diff --git a/crates/parser/test_data/parser/inline/ok/try_macro_rules.rast b/crates/parser/test_data/parser/inline/ok/try_macro_rules.rast
index e6916ae976..e95fe76258 100644
--- a/crates/parser/test_data/parser/inline/ok/try_macro_rules.rast
+++ b/crates/parser/test_data/parser/inline/ok/try_macro_rules.rast
@@ -1,5 +1,7 @@
 SOURCE_FILE
   MACRO_RULES
+    COMMENT "// 2015"
+    WHITESPACE "\n"
     MACRO_RULES_KW "macro_rules"
     BANG "!"
     WHITESPACE " "
diff --git a/crates/parser/test_data/parser/inline/ok/try_macro_rules.rs b/crates/parser/test_data/parser/inline/ok/try_macro_rules.rs
index 2e2ab6e60b..35694649ec 100644
--- a/crates/parser/test_data/parser/inline/ok/try_macro_rules.rs
+++ b/crates/parser/test_data/parser/inline/ok/try_macro_rules.rs
@@ -1 +1,2 @@
+// 2015
 macro_rules! try { () => {} }

From 2c32ee7cfa739d592bb2ed9c3f322baf488f2766 Mon Sep 17 00:00:00 2001
From: Lukas Wirth 
Date: Fri, 19 Jul 2024 16:01:47 +0200
Subject: [PATCH 6/7] Prevent generated runner module from being format checked

---
 crates/parser/src/tests.rs | 1 +
 1 file changed, 1 insertion(+)

diff --git a/crates/parser/src/tests.rs b/crates/parser/src/tests.rs
index b4b6759e90..d35d2d3b03 100644
--- a/crates/parser/src/tests.rs
+++ b/crates/parser/src/tests.rs
@@ -11,6 +11,7 @@ use expect_test::expect_file;
 
 use crate::{Edition, LexedStr, TopEntryPoint};
 
+#[rustfmt::skip]
 #[path = "../test_data/generated/runner.rs"]
 mod runner;
 

From 546eb6b530bbf1bcfd2542a943d610a24bdc4b3a Mon Sep 17 00:00:00 2001
From: Lukas Wirth 
Date: Fri, 19 Jul 2024 16:39:00 +0200
Subject: [PATCH 7/7] Test macros doing edition dependent parsing

---
 .../hir-def/src/macro_expansion_tests/mbe.rs  | 56 +++++++++++++++++++
 crates/hir-expand/src/db.rs                   |  4 +-
 crates/hir-expand/src/declarative.rs          | 24 +-------
 crates/mbe/src/benchmark.rs                   |  8 +--
 crates/mbe/src/lib.rs                         | 21 +++----
 crates/mbe/src/parser.rs                      | 29 ++++------
 crates/mbe/src/syntax_bridge.rs               |  2 +-
 crates/mbe/src/to_parser_input.rs             | 10 +++-
 8 files changed, 92 insertions(+), 62 deletions(-)

diff --git a/crates/hir-def/src/macro_expansion_tests/mbe.rs b/crates/hir-def/src/macro_expansion_tests/mbe.rs
index 4058159cef..64b37d2d06 100644
--- a/crates/hir-def/src/macro_expansion_tests/mbe.rs
+++ b/crates/hir-def/src/macro_expansion_tests/mbe.rs
@@ -1921,3 +1921,59 @@ fn f() {
  "#]],
     );
 }
+
+#[test]
+fn test_edition_handling_out() {
+    check(
+        r#"
+//- /main.rs crate:main deps:old edition:2021
+macro_rules! r#try {
+    ($it:expr) => {
+        $it?
+    };
+}
+fn f() {
+    old::invoke_bare_try!(0);
+}
+//- /old.rs crate:old edition:2015
+#[macro_export]
+macro_rules! invoke_bare_try {
+    ($it:expr) => {
+        try!($it)
+    };
+}
+ "#,
+        expect![[r#"
+macro_rules! r#try {
+    ($it:expr) => {
+        $it?
+    };
+}
+fn f() {
+    try!(0);
+}
+"#]],
+    );
+}
+
+#[test]
+fn test_edition_handling_in() {
+    check(
+        r#"
+//- /main.rs crate:main deps:old edition:2021
+fn f() {
+    old::parse_try_old!(try!{});
+}
+//- /old.rs crate:old edition:2015
+#[macro_export]
+macro_rules! parse_try_old {
+    ($it:expr) => {};
+}
+ "#,
+        expect![[r#"
+fn f() {
+    ;
+}
+"#]],
+    );
+}
diff --git a/crates/hir-expand/src/db.rs b/crates/hir-expand/src/db.rs
index 475ca865a7..8be2dcf0de 100644
--- a/crates/hir-expand/src/db.rs
+++ b/crates/hir-expand/src/db.rs
@@ -348,7 +348,7 @@ fn parse_macro_expansion(
 ) -> ExpandResult<(Parse, Arc)> {
     let _p = tracing::info_span!("parse_macro_expansion").entered();
     let loc = db.lookup_intern_macro_call(macro_file.macro_call_id);
-    let edition = loc.def.edition;
+    let def_edition = loc.def.edition;
     let expand_to = loc.expand_to();
     let mbe::ValueResult { value: (tt, matched_arm), err } =
         macro_expand(db, macro_file.macro_call_id, loc);
@@ -359,7 +359,7 @@ fn parse_macro_expansion(
             CowArc::Owned(it) => it,
         },
         expand_to,
-        edition,
+        def_edition,
     );
     rev_token_map.matched_arm = matched_arm;
 
diff --git a/crates/hir-expand/src/declarative.rs b/crates/hir-expand/src/declarative.rs
index 3d3df83361..85d7521dbc 100644
--- a/crates/hir-expand/src/declarative.rs
+++ b/crates/hir-expand/src/declarative.rs
@@ -129,20 +129,7 @@ impl DeclarativeMacroExpander {
                 _ => None,
             }
         };
-        let toolchain = db.toolchain(def_crate);
-        let new_meta_vars = toolchain.as_ref().map_or(false, |version| {
-            REQUIREMENT.get_or_init(|| VersionReq::parse(">=1.76").unwrap()).matches(
-                &base_db::Version {
-                    pre: base_db::Prerelease::EMPTY,
-                    build: base_db::BuildMetadata::EMPTY,
-                    major: version.major,
-                    minor: version.minor,
-                    patch: version.patch,
-                },
-            )
-        });
-
-        let edition = |ctx: SyntaxContextId| {
+        let ctx_edition = |ctx: SyntaxContextId| {
             let crate_graph = db.crate_graph();
             if ctx.is_root() {
                 crate_graph[def_crate].edition
@@ -165,7 +152,7 @@ impl DeclarativeMacroExpander {
                             DocCommentDesugarMode::Mbe,
                         );
 
-                        mbe::DeclarativeMacro::parse_macro_rules(&tt, edition, new_meta_vars)
+                        mbe::DeclarativeMacro::parse_macro_rules(&tt, ctx_edition)
                     }
                     None => mbe::DeclarativeMacro::from_err(mbe::ParseError::Expected(
                         "expected a token tree".into(),
@@ -193,12 +180,7 @@ impl DeclarativeMacroExpander {
                             DocCommentDesugarMode::Mbe,
                         );
 
-                        mbe::DeclarativeMacro::parse_macro2(
-                            args.as_ref(),
-                            &body,
-                            edition,
-                            new_meta_vars,
-                        )
+                        mbe::DeclarativeMacro::parse_macro2(args.as_ref(), &body, ctx_edition)
                     }
                     None => mbe::DeclarativeMacro::from_err(mbe::ParseError::Expected(
                         "expected a token tree".into(),
diff --git a/crates/mbe/src/benchmark.rs b/crates/mbe/src/benchmark.rs
index 04e78a0833..1db2789eb3 100644
--- a/crates/mbe/src/benchmark.rs
+++ b/crates/mbe/src/benchmark.rs
@@ -25,9 +25,7 @@ fn benchmark_parse_macro_rules() {
         rules
             .values()
             .map(|it| {
-                DeclarativeMacro::parse_macro_rules(it, |_| span::Edition::CURRENT, true)
-                    .rules
-                    .len()
+                DeclarativeMacro::parse_macro_rules(it, |_| span::Edition::CURRENT).rules.len()
             })
             .sum()
     };
@@ -59,9 +57,7 @@ fn benchmark_expand_macro_rules() {
 fn macro_rules_fixtures() -> FxHashMap {
     macro_rules_fixtures_tt()
         .into_iter()
-        .map(|(id, tt)| {
-            (id, DeclarativeMacro::parse_macro_rules(&tt, |_| span::Edition::CURRENT, true))
-        })
+        .map(|(id, tt)| (id, DeclarativeMacro::parse_macro_rules(&tt, |_| span::Edition::CURRENT)))
         .collect()
 }
 
diff --git a/crates/mbe/src/lib.rs b/crates/mbe/src/lib.rs
index 44b056a1ac..bd7cb3ce7a 100644
--- a/crates/mbe/src/lib.rs
+++ b/crates/mbe/src/lib.rs
@@ -144,9 +144,7 @@ impl DeclarativeMacro {
     /// The old, `macro_rules! m {}` flavor.
     pub fn parse_macro_rules(
         tt: &tt::Subtree,
-        edition: impl Copy + Fn(SyntaxContextId) -> Edition,
-        // FIXME: Remove this once we drop support for rust 1.76 (defaults to true then)
-        new_meta_vars: bool,
+        ctx_edition: impl Copy + Fn(SyntaxContextId) -> Edition,
     ) -> DeclarativeMacro {
         // Note: this parsing can be implemented using mbe machinery itself, by
         // matching against `$($lhs:tt => $rhs:tt);*` pattern, but implementing
@@ -156,7 +154,7 @@ impl DeclarativeMacro {
         let mut err = None;
 
         while src.len() > 0 {
-            let rule = match Rule::parse(edition, &mut src, new_meta_vars) {
+            let rule = match Rule::parse(ctx_edition, &mut src) {
                 Ok(it) => it,
                 Err(e) => {
                     err = Some(Box::new(e));
@@ -186,9 +184,7 @@ impl DeclarativeMacro {
     pub fn parse_macro2(
         args: Option<&tt::Subtree>,
         body: &tt::Subtree,
-        edition: impl Copy + Fn(SyntaxContextId) -> Edition,
-        // FIXME: Remove this once we drop support for rust 1.76 (defaults to true then)
-        new_meta_vars: bool,
+        ctx_edition: impl Copy + Fn(SyntaxContextId) -> Edition,
     ) -> DeclarativeMacro {
         let mut rules = Vec::new();
         let mut err = None;
@@ -197,8 +193,8 @@ impl DeclarativeMacro {
             cov_mark::hit!(parse_macro_def_simple);
 
             let rule = (|| {
-                let lhs = MetaTemplate::parse_pattern(edition, args)?;
-                let rhs = MetaTemplate::parse_template(edition, body, new_meta_vars)?;
+                let lhs = MetaTemplate::parse_pattern(ctx_edition, args)?;
+                let rhs = MetaTemplate::parse_template(ctx_edition, body)?;
 
                 Ok(crate::Rule { lhs, rhs })
             })();
@@ -211,7 +207,7 @@ impl DeclarativeMacro {
             cov_mark::hit!(parse_macro_def_rules);
             let mut src = TtIter::new(body);
             while src.len() > 0 {
-                let rule = match Rule::parse(edition, &mut src, new_meta_vars) {
+                let rule = match Rule::parse(ctx_edition, &mut src) {
                     Ok(it) => it,
                     Err(e) => {
                         err = Some(Box::new(e));
@@ -264,7 +260,6 @@ impl Rule {
     fn parse(
         edition: impl Copy + Fn(SyntaxContextId) -> Edition,
         src: &mut TtIter<'_, Span>,
-        new_meta_vars: bool,
     ) -> Result {
         let lhs = src.expect_subtree().map_err(|()| ParseError::expected("expected subtree"))?;
         src.expect_char('=').map_err(|()| ParseError::expected("expected `=`"))?;
@@ -272,7 +267,7 @@ impl Rule {
         let rhs = src.expect_subtree().map_err(|()| ParseError::expected("expected subtree"))?;
 
         let lhs = MetaTemplate::parse_pattern(edition, lhs)?;
-        let rhs = MetaTemplate::parse_template(edition, rhs, new_meta_vars)?;
+        let rhs = MetaTemplate::parse_template(edition, rhs)?;
 
         Ok(crate::Rule { lhs, rhs })
     }
@@ -367,7 +362,7 @@ fn expect_fragment(
 ) -> ExpandResult>> {
     use ::parser;
     let buffer = tt::buffer::TokenBuffer::from_tokens(tt_iter.as_slice());
-    let parser_input = to_parser_input::to_parser_input(&buffer);
+    let parser_input = to_parser_input::to_parser_input(edition, &buffer);
     let tree_traversal = entry_point.parse(&parser_input, edition);
     let mut cursor = buffer.begin();
     let mut error = false;
diff --git a/crates/mbe/src/parser.rs b/crates/mbe/src/parser.rs
index 74a2c771e2..218c04640f 100644
--- a/crates/mbe/src/parser.rs
+++ b/crates/mbe/src/parser.rs
@@ -31,15 +31,14 @@ impl MetaTemplate {
         edition: impl Copy + Fn(SyntaxContextId) -> Edition,
         pattern: &tt::Subtree,
     ) -> Result {
-        MetaTemplate::parse(edition, pattern, Mode::Pattern, false)
+        MetaTemplate::parse(edition, pattern, Mode::Pattern)
     }
 
     pub(crate) fn parse_template(
         edition: impl Copy + Fn(SyntaxContextId) -> Edition,
         template: &tt::Subtree,
-        new_meta_vars: bool,
     ) -> Result {
-        MetaTemplate::parse(edition, template, Mode::Template, new_meta_vars)
+        MetaTemplate::parse(edition, template, Mode::Template)
     }
 
     pub(crate) fn iter(&self) -> impl Iterator {
@@ -50,13 +49,12 @@ impl MetaTemplate {
         edition: impl Copy + Fn(SyntaxContextId) -> Edition,
         tt: &tt::Subtree,
         mode: Mode,
-        new_meta_vars: bool,
     ) -> Result {
         let mut src = TtIter::new(tt);
 
         let mut res = Vec::new();
         while let Some(first) = src.peek_n(0) {
-            let op = next_op(edition, first, &mut src, mode, new_meta_vars)?;
+            let op = next_op(edition, first, &mut src, mode)?;
             res.push(op);
         }
 
@@ -161,7 +159,6 @@ fn next_op(
     first_peeked: &tt::TokenTree,
     src: &mut TtIter<'_, Span>,
     mode: Mode,
-    new_meta_vars: bool,
 ) -> Result {
     let res = match first_peeked {
         tt::TokenTree::Leaf(tt::Leaf::Punct(p @ tt::Punct { char: '$', .. })) => {
@@ -181,14 +178,14 @@ fn next_op(
                 tt::TokenTree::Subtree(subtree) => match subtree.delimiter.kind {
                     tt::DelimiterKind::Parenthesis => {
                         let (separator, kind) = parse_repeat(src)?;
-                        let tokens = MetaTemplate::parse(edition, subtree, mode, new_meta_vars)?;
+                        let tokens = MetaTemplate::parse(edition, subtree, mode)?;
                         Op::Repeat { tokens, separator: separator.map(Arc::new), kind }
                     }
                     tt::DelimiterKind::Brace => match mode {
                         Mode::Template => {
-                            parse_metavar_expr(new_meta_vars, &mut TtIter::new(subtree)).map_err(
-                                |()| ParseError::unexpected("invalid metavariable expression"),
-                            )?
+                            parse_metavar_expr(&mut TtIter::new(subtree)).map_err(|()| {
+                                ParseError::unexpected("invalid metavariable expression")
+                            })?
                         }
                         Mode::Pattern => {
                             return Err(ParseError::unexpected(
@@ -260,7 +257,7 @@ fn next_op(
 
         tt::TokenTree::Subtree(subtree) => {
             src.next().expect("first token already peeked");
-            let tokens = MetaTemplate::parse(edition, subtree, mode, new_meta_vars)?;
+            let tokens = MetaTemplate::parse(edition, subtree, mode)?;
             Op::Subtree { tokens, delimiter: subtree.delimiter }
         }
     };
@@ -343,7 +340,7 @@ fn parse_repeat(src: &mut TtIter<'_, Span>) -> Result<(Option, Repeat
     Err(ParseError::InvalidRepeat)
 }
 
-fn parse_metavar_expr(new_meta_vars: bool, src: &mut TtIter<'_, Span>) -> Result {
+fn parse_metavar_expr(src: &mut TtIter<'_, Span>) -> Result {
     let func = src.expect_ident()?;
     let args = src.expect_subtree()?;
 
@@ -355,18 +352,14 @@ fn parse_metavar_expr(new_meta_vars: bool, src: &mut TtIter<'_, Span>) -> Result
 
     let op = match &func.sym {
         s if sym::ignore == *s => {
-            if new_meta_vars {
-                args.expect_dollar()?;
-            }
+            args.expect_dollar()?;
             let ident = args.expect_ident()?;
             Op::Ignore { name: ident.sym.clone(), id: ident.span }
         }
         s if sym::index == *s => Op::Index { depth: parse_depth(&mut args)? },
         s if sym::len == *s => Op::Len { depth: parse_depth(&mut args)? },
         s if sym::count == *s => {
-            if new_meta_vars {
-                args.expect_dollar()?;
-            }
+            args.expect_dollar()?;
             let ident = args.expect_ident()?;
             let depth = if try_eat_comma(&mut args) { Some(parse_depth(&mut args)?) } else { None };
             Op::Count { name: ident.sym.clone(), depth }
diff --git a/crates/mbe/src/syntax_bridge.rs b/crates/mbe/src/syntax_bridge.rs
index 6d943007b9..ee61d7a21b 100644
--- a/crates/mbe/src/syntax_bridge.rs
+++ b/crates/mbe/src/syntax_bridge.rs
@@ -153,7 +153,7 @@ where
         } => TokenBuffer::from_tokens(token_trees),
         _ => TokenBuffer::from_subtree(tt),
     };
-    let parser_input = to_parser_input(&buffer);
+    let parser_input = to_parser_input(edition, &buffer);
     let parser_output = entry_point.parse(&parser_input, edition);
     let mut tree_sink = TtTreeSink::new(buffer.begin());
     for event in parser_output.iter() {
diff --git a/crates/mbe/src/to_parser_input.rs b/crates/mbe/src/to_parser_input.rs
index 7636359805..66db525362 100644
--- a/crates/mbe/src/to_parser_input.rs
+++ b/crates/mbe/src/to_parser_input.rs
@@ -3,11 +3,15 @@
 
 use std::fmt;
 
+use span::Edition;
 use syntax::{SyntaxKind, SyntaxKind::*, T};
 
 use tt::buffer::TokenBuffer;
 
-pub(crate) fn to_parser_input(buffer: &TokenBuffer<'_, S>) -> parser::Input {
+pub(crate) fn to_parser_input(
+    edition: Edition,
+    buffer: &TokenBuffer<'_, S>,
+) -> parser::Input {
     let mut res = parser::Input::default();
 
     let mut current = buffer.begin();
@@ -60,6 +64,10 @@ pub(crate) fn to_parser_input(buffer: &TokenBuffer<'_, S>)
                         "_" => res.push(T![_]),
                         i if i.starts_with('\'') => res.push(LIFETIME_IDENT),
                         _ if ident.is_raw.yes() => res.push(IDENT),
+                        "gen" if !edition.at_least_2024() => res.push(IDENT),
+                        "async" | "await" | "dyn" | "try" if !edition.at_least_2018() => {
+                            res.push(IDENT)
+                        }
                         text => match SyntaxKind::from_keyword(text) {
                             Some(kind) => res.push(kind),
                             None => {