diff options
| author | Lukas Wirth <lukastw97@gmail.com> | 2025-03-15 16:25:13 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-03-15 16:25:13 +0000 |
| commit | 6e926fd2160a925e11f5adea1fbbc4acc00c1e92 (patch) | |
| tree | ba77cea5b991f51d3ce780a56958d91e0e92198a | |
| parent | 5528b96faa3ff7fc314ceaa4e2019201f83ab923 (diff) | |
| parent | f2d36158bc54f3828d1a7bf1bac99ec2472310c1 (diff) | |
| download | rust-6e926fd2160a925e11f5adea1fbbc4acc00c1e92.tar.gz rust-6e926fd2160a925e11f5adea1fbbc4acc00c1e92.zip | |
Merge pull request #19366 from Veykril/push-mkunlxkysssr
chore: Remove legacy `SyntaxContextId` re-export
38 files changed, 164 insertions, 228 deletions
diff --git a/src/tools/rust-analyzer/crates/hir-def/src/expander.rs b/src/tools/rust-analyzer/crates/hir-def/src/expander.rs index c5ce8c454ce..343d8aa1c9f 100644 --- a/src/tools/rust-analyzer/crates/hir-def/src/expander.rs +++ b/src/tools/rust-analyzer/crates/hir-def/src/expander.rs @@ -9,7 +9,7 @@ use hir_expand::{ attrs::RawAttrs, mod_path::ModPath, span_map::SpanMap, ExpandError, ExpandErrorKind, ExpandResult, HirFileId, InFile, Lookup, MacroCallId, }; -use span::{Edition, SyntaxContextId}; +use span::{Edition, SyntaxContext}; use syntax::{ast, Parse}; use triomphe::Arc; @@ -57,9 +57,9 @@ impl Expander { self.module.krate } - pub fn syntax_context(&self) -> SyntaxContextId { + pub fn syntax_context(&self) -> SyntaxContext { // FIXME: - SyntaxContextId::root(Edition::CURRENT) + SyntaxContext::root(Edition::CURRENT) } pub fn enter_expand<T: ast::AstNode>( diff --git a/src/tools/rust-analyzer/crates/hir-def/src/expr_store.rs b/src/tools/rust-analyzer/crates/hir-def/src/expr_store.rs index 616d2c9fd89..7e7ccbfa91a 100644 --- a/src/tools/rust-analyzer/crates/hir-def/src/expr_store.rs +++ b/src/tools/rust-analyzer/crates/hir-def/src/expr_store.rs @@ -37,13 +37,13 @@ pub use self::body::{Body, BodySourceMap}; /// A wrapper around [`span::SyntaxContextId`] that is intended only for comparisons. #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] -pub struct HygieneId(span::SyntaxContextId); +pub struct HygieneId(span::SyntaxContext); impl HygieneId { // The edition doesn't matter here, we only use this for comparisons and to lookup the macro. - pub const ROOT: Self = Self(span::SyntaxContextId::root(Edition::Edition2015)); + pub const ROOT: Self = Self(span::SyntaxContext::root(Edition::Edition2015)); - pub fn new(mut ctx: span::SyntaxContextId) -> Self { + pub fn new(mut ctx: span::SyntaxContext) -> Self { // See `Name` for why we're doing that. ctx.remove_root_edition(); Self(ctx) diff --git a/src/tools/rust-analyzer/crates/hir-def/src/hir/format_args.rs b/src/tools/rust-analyzer/crates/hir-def/src/hir/format_args.rs index 28c824fd31d..6331861a992 100644 --- a/src/tools/rust-analyzer/crates/hir-def/src/hir/format_args.rs +++ b/src/tools/rust-analyzer/crates/hir-def/src/hir/format_args.rs @@ -4,7 +4,7 @@ use either::Either; use hir_expand::name::Name; use intern::Symbol; use rustc_parse_format as parse; -use span::SyntaxContextId; +use span::SyntaxContext; use stdx::TupleExt; use syntax::{ ast::{self, IsString}, @@ -176,7 +176,7 @@ pub(crate) fn parse( is_direct_literal: bool, mut synth: impl FnMut(Name, Option<TextRange>) -> ExprId, mut record_usage: impl FnMut(Name, Option<TextRange>), - call_ctx: SyntaxContextId, + call_ctx: SyntaxContext, ) -> FormatArgs { let Ok(text) = s.value() else { return FormatArgs { diff --git a/src/tools/rust-analyzer/crates/hir-def/src/item_tree.rs b/src/tools/rust-analyzer/crates/hir-def/src/item_tree.rs index d42104faa2e..b9fc9c9489b 100644 --- a/src/tools/rust-analyzer/crates/hir-def/src/item_tree.rs +++ b/src/tools/rust-analyzer/crates/hir-def/src/item_tree.rs @@ -51,7 +51,7 @@ use intern::{Interned, Symbol}; use la_arena::{Arena, Idx, RawIdx}; use rustc_hash::FxHashMap; use smallvec::SmallVec; -use span::{AstIdNode, Edition, FileAstId, SyntaxContextId}; +use span::{AstIdNode, Edition, FileAstId, SyntaxContext}; use stdx::never; use syntax::{ast, match_ast, SyntaxKind}; use triomphe::Arc; @@ -1098,7 +1098,7 @@ pub struct MacroCall { pub path: Interned<ModPath>, pub ast_id: FileAstId<ast::MacroCall>, pub expand_to: ExpandTo, - pub ctxt: SyntaxContextId, + pub ctxt: SyntaxContext, } #[derive(Debug, Clone, Eq, PartialEq)] diff --git a/src/tools/rust-analyzer/crates/hir-def/src/item_tree/lower.rs b/src/tools/rust-analyzer/crates/hir-def/src/item_tree/lower.rs index 05b99ae31f4..b0cc7ead8c0 100644 --- a/src/tools/rust-analyzer/crates/hir-def/src/item_tree/lower.rs +++ b/src/tools/rust-analyzer/crates/hir-def/src/item_tree/lower.rs @@ -11,7 +11,7 @@ use hir_expand::{ use intern::{sym, Symbol}; use la_arena::Arena; use rustc_hash::FxHashMap; -use span::{AstIdMap, SyntaxContextId}; +use span::{AstIdMap, SyntaxContext}; use stdx::thin_vec::ThinVec; use syntax::{ ast::{self, HasModuleItem, HasName, HasTypeBounds, IsString}, @@ -968,7 +968,7 @@ impl UseTreeLowering<'_> { fn lower_use_tree( &mut self, tree: ast::UseTree, - span_for_range: &mut dyn FnMut(::tt::TextRange) -> SyntaxContextId, + span_for_range: &mut dyn FnMut(::tt::TextRange) -> SyntaxContext, ) -> Option<UseTree> { if let Some(use_tree_list) = tree.use_tree_list() { let prefix = match tree.path() { @@ -1035,7 +1035,7 @@ impl UseTreeLowering<'_> { pub(crate) fn lower_use_tree( db: &dyn DefDatabase, tree: ast::UseTree, - span_for_range: &mut dyn FnMut(::tt::TextRange) -> SyntaxContextId, + span_for_range: &mut dyn FnMut(::tt::TextRange) -> SyntaxContext, ) -> Option<(UseTree, Arena<ast::UseTree>)> { let mut lowering = UseTreeLowering { db, mapping: Arena::new() }; let tree = lowering.lower_use_tree(tree, span_for_range)?; diff --git a/src/tools/rust-analyzer/crates/hir-def/src/lib.rs b/src/tools/rust-analyzer/crates/hir-def/src/lib.rs index 5f8cd0fde04..209ed46b7a8 100644 --- a/src/tools/rust-analyzer/crates/hir-def/src/lib.rs +++ b/src/tools/rust-analyzer/crates/hir-def/src/lib.rs @@ -85,7 +85,7 @@ use hir_expand::{ use item_tree::ExternBlock; use la_arena::Idx; use nameres::DefMap; -use span::{AstIdNode, Edition, FileAstId, SyntaxContextId}; +use span::{AstIdNode, Edition, FileAstId, SyntaxContext}; use stdx::impl_from; use syntax::{ast, AstNode}; @@ -1451,7 +1451,7 @@ impl<T: AstIdNode> AstIdWithPath<T> { fn macro_call_as_call_id( db: &dyn ExpandDatabase, call: &AstIdWithPath<ast::MacroCall>, - call_site: SyntaxContextId, + call_site: SyntaxContext, expand_to: ExpandTo, krate: Crate, resolver: impl Fn(&path::ModPath) -> Option<MacroDefId> + Copy, @@ -1473,7 +1473,7 @@ fn macro_call_as_call_id_with_eager( db: &dyn ExpandDatabase, ast_id: AstId<ast::MacroCall>, path: &path::ModPath, - call_site: SyntaxContextId, + call_site: SyntaxContext, expand_to: ExpandTo, krate: Crate, resolver: impl FnOnce(&path::ModPath) -> Option<MacroDefId>, diff --git a/src/tools/rust-analyzer/crates/hir-def/src/nameres/attr_resolution.rs b/src/tools/rust-analyzer/crates/hir-def/src/nameres/attr_resolution.rs index 289b9e2fb7e..c35a7fdc96d 100644 --- a/src/tools/rust-analyzer/crates/hir-def/src/nameres/attr_resolution.rs +++ b/src/tools/rust-analyzer/crates/hir-def/src/nameres/attr_resolution.rs @@ -6,7 +6,7 @@ use hir_expand::{ inert_attr_macro::find_builtin_attr_idx, MacroCallId, MacroCallKind, MacroDefId, }; -use span::SyntaxContextId; +use span::SyntaxContext; use syntax::ast; use triomphe::Arc; @@ -137,7 +137,7 @@ pub(super) fn derive_macro_as_call_id( item_attr: &AstIdWithPath<ast::Adt>, derive_attr_index: AttrId, derive_pos: u32, - call_site: SyntaxContextId, + call_site: SyntaxContext, krate: Crate, resolver: impl Fn(&path::ModPath) -> Option<(MacroId, MacroDefId)>, derive_macro_id: MacroCallId, diff --git a/src/tools/rust-analyzer/crates/hir-def/src/nameres/collector.rs b/src/tools/rust-analyzer/crates/hir-def/src/nameres/collector.rs index 371e9943346..43b011e57f4 100644 --- a/src/tools/rust-analyzer/crates/hir-def/src/nameres/collector.rs +++ b/src/tools/rust-analyzer/crates/hir-def/src/nameres/collector.rs @@ -20,7 +20,7 @@ use intern::{sym, Interned}; use itertools::{izip, Itertools}; use la_arena::Idx; use rustc_hash::{FxHashMap, FxHashSet}; -use span::{Edition, EditionedFileId, FileAstId, SyntaxContextId}; +use span::{Edition, EditionedFileId, FileAstId, SyntaxContext}; use syntax::ast; use triomphe::Arc; @@ -192,13 +192,13 @@ enum MacroDirectiveKind { FnLike { ast_id: AstIdWithPath<ast::MacroCall>, expand_to: ExpandTo, - ctxt: SyntaxContextId, + ctxt: SyntaxContext, }, Derive { ast_id: AstIdWithPath<ast::Adt>, derive_attr: AttrId, derive_pos: usize, - ctxt: SyntaxContextId, + ctxt: SyntaxContext, /// The "parent" macro it is resolved to. derive_macro_id: MacroCallId, }, diff --git a/src/tools/rust-analyzer/crates/hir-def/src/resolver.rs b/src/tools/rust-analyzer/crates/hir-def/src/resolver.rs index 0ed26ca853e..997a12a328e 100644 --- a/src/tools/rust-analyzer/crates/hir-def/src/resolver.rs +++ b/src/tools/rust-analyzer/crates/hir-def/src/resolver.rs @@ -7,7 +7,7 @@ use intern::{sym, Symbol}; use itertools::Itertools as _; use rustc_hash::FxHashSet; use smallvec::{smallvec, SmallVec}; -use span::SyntaxContextId; +use span::SyntaxContext; use triomphe::Arc; use crate::{ @@ -903,7 +903,7 @@ impl Resolver { fn handle_macro_def_scope( db: &dyn DefDatabase, hygiene_id: &mut HygieneId, - hygiene_info: &mut Option<(SyntaxContextId, MacroDefId)>, + hygiene_info: &mut Option<(SyntaxContext, MacroDefId)>, macro_id: &MacroDefId, ) { if let Some((parent_ctx, label_macro_id)) = hygiene_info { @@ -924,7 +924,7 @@ fn handle_macro_def_scope( fn hygiene_info( db: &dyn DefDatabase, hygiene_id: HygieneId, -) -> Option<(SyntaxContextId, MacroDefId)> { +) -> Option<(SyntaxContext, MacroDefId)> { if !hygiene_id.is_root() { let ctx = hygiene_id.lookup(); ctx.outer_expn(db).map(|expansion| { diff --git a/src/tools/rust-analyzer/crates/hir-def/src/visibility.rs b/src/tools/rust-analyzer/crates/hir-def/src/visibility.rs index c4473e454a1..86a2d02a9f4 100644 --- a/src/tools/rust-analyzer/crates/hir-def/src/visibility.rs +++ b/src/tools/rust-analyzer/crates/hir-def/src/visibility.rs @@ -4,7 +4,7 @@ use std::iter; use intern::Interned; use la_arena::ArenaMap; -use span::SyntaxContextId; +use span::SyntaxContext; use syntax::ast; use triomphe::Arc; @@ -37,7 +37,7 @@ impl RawVisibility { pub(crate) fn from_ast( db: &dyn DefDatabase, node: Option<ast::Visibility>, - span_for_range: &mut dyn FnMut(::tt::TextRange) -> SyntaxContextId, + span_for_range: &mut dyn FnMut(::tt::TextRange) -> SyntaxContext, ) -> RawVisibility { let node = match node { None => return RawVisibility::private(), @@ -49,7 +49,7 @@ impl RawVisibility { fn from_ast_with_span_map( db: &dyn DefDatabase, node: ast::Visibility, - span_for_range: &mut dyn FnMut(::tt::TextRange) -> SyntaxContextId, + span_for_range: &mut dyn FnMut(::tt::TextRange) -> SyntaxContext, ) -> RawVisibility { let path = match node.kind() { ast::VisibilityKind::In(path) => { diff --git a/src/tools/rust-analyzer/crates/hir-expand/src/attrs.rs b/src/tools/rust-analyzer/crates/hir-expand/src/attrs.rs index 64b9b49b3e4..6bfef1d28b7 100644 --- a/src/tools/rust-analyzer/crates/hir-expand/src/attrs.rs +++ b/src/tools/rust-analyzer/crates/hir-expand/src/attrs.rs @@ -8,7 +8,7 @@ use intern::{sym, Interned, Symbol}; use mbe::{DelimiterKind, Punct}; use smallvec::{smallvec, SmallVec}; -use span::{Span, SyntaxContextId}; +use span::{Span, SyntaxContext}; use syntax::unescape; use syntax::{ast, match_ast, AstNode, AstToken, SyntaxNode}; use syntax_bridge::{desugar_doc_comment_text, syntax_node_to_token_tree, DocCommentDesugarMode}; @@ -210,7 +210,7 @@ pub struct Attr { pub id: AttrId, pub path: Interned<ModPath>, pub input: Option<Box<AttrInput>>, - pub ctxt: SyntaxContextId, + pub ctxt: SyntaxContext, } #[derive(Debug, Clone, PartialEq, Eq, Hash)] diff --git a/src/tools/rust-analyzer/crates/hir-expand/src/builtin/derive_macro.rs b/src/tools/rust-analyzer/crates/hir-expand/src/builtin/derive_macro.rs index 28b68121394..ff50ccef0f4 100644 --- a/src/tools/rust-analyzer/crates/hir-expand/src/builtin/derive_macro.rs +++ b/src/tools/rust-analyzer/crates/hir-expand/src/builtin/derive_macro.rs @@ -4,7 +4,7 @@ use intern::sym; use itertools::{izip, Itertools}; use parser::SyntaxKind; use rustc_hash::FxHashSet; -use span::{Edition, MacroCallId, Span, SyntaxContextId}; +use span::{Edition, MacroCallId, Span, SyntaxContext}; use stdx::never; use syntax_bridge::DocCommentDesugarMode; use tracing::debug; @@ -237,7 +237,7 @@ fn parse_adt( fn parse_adt_from_syntax( adt: &ast::Adt, - tm: &span::SpanMap<SyntaxContextId>, + tm: &span::SpanMap<SyntaxContext>, call_site: Span, ) -> Result<BasicAdtInfo, ExpandError> { let (name, generic_param_list, where_clause, shape) = match &adt { @@ -389,7 +389,7 @@ fn to_adt_syntax( db: &dyn ExpandDatabase, tt: &tt::TopSubtree, call_site: Span, -) -> Result<(ast::Adt, span::SpanMap<SyntaxContextId>), ExpandError> { +) -> Result<(ast::Adt, span::SpanMap<SyntaxContext>), ExpandError> { let (parsed, tm) = crate::db::token_tree_to_syntax_node( db, tt, diff --git a/src/tools/rust-analyzer/crates/hir-expand/src/builtin/quote.rs b/src/tools/rust-analyzer/crates/hir-expand/src/builtin/quote.rs index a961df181db..4c8eb74486b 100644 --- a/src/tools/rust-analyzer/crates/hir-expand/src/builtin/quote.rs +++ b/src/tools/rust-analyzer/crates/hir-expand/src/builtin/quote.rs @@ -226,7 +226,7 @@ mod tests { use ::tt::IdentIsRaw; use expect_test::expect; use intern::Symbol; - use span::{Edition, SpanAnchor, SyntaxContextId, ROOT_ERASED_FILE_AST_ID}; + use span::{Edition, SpanAnchor, SyntaxContext, ROOT_ERASED_FILE_AST_ID}; use syntax::{TextRange, TextSize}; use super::quote; @@ -240,7 +240,7 @@ mod tests { ), ast_id: ROOT_ERASED_FILE_AST_ID, }, - ctx: SyntaxContextId::root(Edition::CURRENT), + ctx: SyntaxContext::root(Edition::CURRENT), }; #[test] diff --git a/src/tools/rust-analyzer/crates/hir-expand/src/db.rs b/src/tools/rust-analyzer/crates/hir-expand/src/db.rs index 7e7858d15b4..85c242a790f 100644 --- a/src/tools/rust-analyzer/crates/hir-expand/src/db.rs +++ b/src/tools/rust-analyzer/crates/hir-expand/src/db.rs @@ -7,7 +7,7 @@ use rustc_hash::FxHashSet; use salsa::plumbing::AsId; use span::{ AstIdMap, Edition, EditionedFileId, HirFileId, HirFileIdRepr, MacroCallId, MacroFileId, Span, - SyntaxContextId, + SyntaxContext, }; use syntax::{ast, AstNode, Parse, SyntaxElement, SyntaxError, SyntaxNode, SyntaxToken, T}; use syntax_bridge::{syntax_node_to_token_tree, DocCommentDesugarMode}; @@ -97,10 +97,6 @@ pub trait ExpandDatabase: RootQueryDb { #[salsa::transparent] fn lookup_intern_macro_call(&self, macro_call: MacroCallId) -> MacroCallLoc; - #[salsa::transparent] - #[salsa::invoke(crate::hygiene::dump_syntax_contexts)] - fn dump_syntax_contexts(&self) -> String; - /// Lowers syntactic macro call to a token tree representation. That's a firewall /// query, only typing in the macro call itself changes the returned /// subtree. @@ -149,7 +145,7 @@ pub trait ExpandDatabase: RootQueryDb { ) -> Option<Arc<ExpandResult<Arc<[SyntaxError]>>>>; #[salsa::transparent] - fn syntax_context(&self, file: HirFileId, edition: Edition) -> SyntaxContextId; + fn syntax_context(&self, file: HirFileId, edition: Edition) -> SyntaxContext; } #[salsa::interned(no_lifetime, id = span::MacroCallId)] @@ -165,14 +161,14 @@ fn lookup_intern_macro_call(db: &dyn ExpandDatabase, macro_call: MacroCallId) -> MacroCallWrapper::ingredient(db).data(db.as_dyn_database(), macro_call.as_id()).0.clone() } -#[salsa::interned(no_lifetime, id = span::SyntaxContextId)] +#[salsa::interned(no_lifetime, id = span::SyntaxContext)] pub struct SyntaxContextWrapper { - pub data: SyntaxContextId, + pub data: SyntaxContext, } -fn syntax_context(db: &dyn ExpandDatabase, file: HirFileId, edition: Edition) -> SyntaxContextId { +fn syntax_context(db: &dyn ExpandDatabase, file: HirFileId, edition: Edition) -> SyntaxContext { match file.repr() { - HirFileIdRepr::FileId(_) => SyntaxContextId::root(edition), + HirFileIdRepr::FileId(_) => SyntaxContext::root(edition), HirFileIdRepr::MacroFile(m) => { let kind = db.lookup_intern_macro_call(m.macro_call_id).kind; db.macro_arg_considering_derives(m.macro_call_id, &kind).2.ctx diff --git a/src/tools/rust-analyzer/crates/hir-expand/src/declarative.rs b/src/tools/rust-analyzer/crates/hir-expand/src/declarative.rs index fbce3207566..a0b614add49 100644 --- a/src/tools/rust-analyzer/crates/hir-expand/src/declarative.rs +++ b/src/tools/rust-analyzer/crates/hir-expand/src/declarative.rs @@ -2,7 +2,7 @@ use base_db::Crate; use intern::sym; -use span::{Edition, HirFileIdRepr, MacroCallId, Span, SyntaxContextId}; +use span::{Edition, HirFileIdRepr, MacroCallId, Span, SyntaxContext}; use stdx::TupleExt; use syntax::{ast, AstNode}; use syntax_bridge::DocCommentDesugarMode; @@ -100,7 +100,7 @@ impl DeclarativeMacroExpander { _ => None, } }; - let ctx_edition = |ctx: SyntaxContextId| { + let ctx_edition = |ctx: SyntaxContext| { if ctx.is_root() { def_crate.data(db).edition } else { @@ -161,7 +161,7 @@ impl DeclarativeMacroExpander { }; let edition = ctx_edition(match id.file_id.repr() { HirFileIdRepr::MacroFile(macro_file) => macro_file.macro_call_id.lookup(db).ctxt, - HirFileIdRepr::FileId(file) => SyntaxContextId::root(file.edition()), + HirFileIdRepr::FileId(file) => SyntaxContext::root(file.edition()), }); Arc::new(DeclarativeMacroExpander { mac, transparency, edition }) } diff --git a/src/tools/rust-analyzer/crates/hir-expand/src/eager.rs b/src/tools/rust-analyzer/crates/hir-expand/src/eager.rs index 02dc75a4a6d..fcf3929eaab 100644 --- a/src/tools/rust-analyzer/crates/hir-expand/src/eager.rs +++ b/src/tools/rust-analyzer/crates/hir-expand/src/eager.rs @@ -19,7 +19,7 @@ //! //! See the full discussion : <https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/Eager.20expansion.20of.20built-in.20macros> use base_db::Crate; -use span::SyntaxContextId; +use span::SyntaxContext; use syntax::{ted, Parse, SyntaxElement, SyntaxNode, TextSize, WalkEvent}; use syntax_bridge::DocCommentDesugarMode; use triomphe::Arc; @@ -38,7 +38,7 @@ pub fn expand_eager_macro_input( macro_call: &ast::MacroCall, ast_id: AstId<ast::MacroCall>, def: MacroDefId, - call_site: SyntaxContextId, + call_site: SyntaxContext, resolver: &dyn Fn(&ModPath) -> Option<MacroDefId>, ) -> ExpandResult<Option<MacroCallId>> { let expand_to = ExpandTo::from_call_site(macro_call); @@ -116,7 +116,7 @@ fn lazy_expand( macro_call: &ast::MacroCall, ast_id: AstId<ast::MacroCall>, krate: Crate, - call_site: SyntaxContextId, + call_site: SyntaxContext, ) -> ExpandResult<(InFile<Parse<SyntaxNode>>, Arc<ExpansionSpanMap>)> { let expand_to = ExpandTo::from_call_site(macro_call); let id = def.make_call( @@ -138,7 +138,7 @@ fn eager_macro_recur( mut offset: TextSize, curr: InFile<SyntaxNode>, krate: Crate, - call_site: SyntaxContextId, + call_site: SyntaxContext, macro_resolver: &dyn Fn(&ModPath) -> Option<MacroDefId>, ) -> ExpandResult<Option<(SyntaxNode, TextSize)>> { let original = curr.value.clone_for_update(); diff --git a/src/tools/rust-analyzer/crates/hir-expand/src/files.rs b/src/tools/rust-analyzer/crates/hir-expand/src/files.rs index 5810d11338c..3a26c62e1f2 100644 --- a/src/tools/rust-analyzer/crates/hir-expand/src/files.rs +++ b/src/tools/rust-analyzer/crates/hir-expand/src/files.rs @@ -4,7 +4,7 @@ use std::borrow::Borrow; use either::Either; use span::{ AstIdNode, EditionedFileId, ErasedFileAstId, FileAstId, HirFileId, HirFileIdRepr, MacroFileId, - SyntaxContextId, + SyntaxContext, }; use syntax::{AstNode, AstPtr, SyntaxNode, SyntaxNodePtr, SyntaxToken, TextRange, TextSize}; @@ -311,7 +311,7 @@ impl InFile<&SyntaxNode> { pub fn original_file_range_opt( self, db: &dyn db::ExpandDatabase, - ) -> Option<(FileRange, SyntaxContextId)> { + ) -> Option<(FileRange, SyntaxContext)> { self.borrow().map(SyntaxNode::text_range).original_node_file_range_opt(db) } } @@ -376,7 +376,7 @@ impl InFile<SyntaxToken> { } impl InMacroFile<TextSize> { - pub fn original_file_range(self, db: &dyn db::ExpandDatabase) -> (FileRange, SyntaxContextId) { + pub fn original_file_range(self, db: &dyn db::ExpandDatabase) -> (FileRange, SyntaxContext) { span_for_offset(db, &db.expansion_span_map(self.file_id), self.value) } } @@ -385,17 +385,17 @@ impl InFile<TextRange> { pub fn original_node_file_range( self, db: &dyn db::ExpandDatabase, - ) -> (FileRange, SyntaxContextId) { + ) -> (FileRange, SyntaxContext) { match self.file_id.repr() { HirFileIdRepr::FileId(file_id) => { - (FileRange { file_id, range: self.value }, SyntaxContextId::root(file_id.edition())) + (FileRange { file_id, range: self.value }, SyntaxContext::root(file_id.edition())) } HirFileIdRepr::MacroFile(mac_file) => { match map_node_range_up(db, &db.expansion_span_map(mac_file), self.value) { Some(it) => it, None => { let loc = db.lookup_intern_macro_call(mac_file.macro_call_id); - (loc.kind.original_call_range(db), SyntaxContextId::root(loc.def.edition)) + (loc.kind.original_call_range(db), SyntaxContext::root(loc.def.edition)) } } } @@ -438,11 +438,11 @@ impl InFile<TextRange> { pub fn original_node_file_range_opt( self, db: &dyn db::ExpandDatabase, - ) -> Option<(FileRange, SyntaxContextId)> { + ) -> Option<(FileRange, SyntaxContext)> { match self.file_id.repr() { HirFileIdRepr::FileId(file_id) => Some(( FileRange { file_id, range: self.value }, - SyntaxContextId::root(file_id.edition()), + SyntaxContext::root(file_id.edition()), )), HirFileIdRepr::MacroFile(mac_file) => { map_node_range_up(db, &db.expansion_span_map(mac_file), self.value) diff --git a/src/tools/rust-analyzer/crates/hir-expand/src/fixup.rs b/src/tools/rust-analyzer/crates/hir-expand/src/fixup.rs index 28894537d48..076dd75cde3 100644 --- a/src/tools/rust-analyzer/crates/hir-expand/src/fixup.rs +++ b/src/tools/rust-analyzer/crates/hir-expand/src/fixup.rs @@ -4,7 +4,7 @@ use intern::sym; use rustc_hash::{FxHashMap, FxHashSet}; use span::{ - ErasedFileAstId, Span, SpanAnchor, SyntaxContextId, FIXUP_ERASED_FILE_AST_ID_MARKER, + ErasedFileAstId, Span, SpanAnchor, SyntaxContext, FIXUP_ERASED_FILE_AST_ID_MARKER, ROOT_ERASED_FILE_AST_ID, }; use stdx::never; @@ -353,7 +353,7 @@ pub(crate) fn reverse_fixups(tt: &mut TopSubtree, undo_info: &SyntaxFixupUndoInf let span = |file_id| Span { range: TextRange::empty(TextSize::new(0)), anchor: SpanAnchor { file_id, ast_id: ROOT_ERASED_FILE_AST_ID }, - ctx: SyntaxContextId::root(span::Edition::Edition2015), + ctx: SyntaxContext::root(span::Edition::Edition2015), }; delimiter.open = span(delimiter.open.anchor.file_id); delimiter.close = span(delimiter.close.anchor.file_id); diff --git a/src/tools/rust-analyzer/crates/hir-expand/src/hygiene.rs b/src/tools/rust-analyzer/crates/hir-expand/src/hygiene.rs index b53468ccacd..20694e7d6b8 100644 --- a/src/tools/rust-analyzer/crates/hir-expand/src/hygiene.rs +++ b/src/tools/rust-analyzer/crates/hir-expand/src/hygiene.rs @@ -24,9 +24,9 @@ use std::{convert::identity, iter}; -use span::{Edition, MacroCallId, Span, SyntaxContextId}; +use span::{Edition, MacroCallId, Span, SyntaxContext}; -use crate::db::{ExpandDatabase, MacroCallWrapper}; +use crate::db::ExpandDatabase; pub use span::Transparency; @@ -65,18 +65,18 @@ fn span_with_ctxt_from_mark( edition: Edition, ) -> Span { Span { - ctx: apply_mark(db, SyntaxContextId::root(edition), expn_id, transparency, edition), + ctx: apply_mark(db, SyntaxContext::root(edition), expn_id, transparency, edition), ..span } } pub(super) fn apply_mark( db: &dyn ExpandDatabase, - ctxt: span::SyntaxContextId, + ctxt: span::SyntaxContext, call_id: span::MacroCallId, transparency: Transparency, edition: Edition, -) -> SyntaxContextId { +) -> SyntaxContext { if transparency == Transparency::Opaque { return apply_mark_internal(db, ctxt, call_id, transparency, edition); } @@ -109,11 +109,11 @@ pub(super) fn apply_mark( fn apply_mark_internal( db: &dyn ExpandDatabase, - ctxt: SyntaxContextId, + ctxt: SyntaxContext, call_id: MacroCallId, transparency: Transparency, edition: Edition, -) -> SyntaxContextId { +) -> SyntaxContext { let call_id = Some(call_id); let mut opaque = ctxt.opaque(db); @@ -121,18 +121,17 @@ fn apply_mark_internal( if transparency >= Transparency::Opaque { let parent = opaque; - opaque = - SyntaxContextId::new(db, call_id, transparency, edition, parent, identity, identity); + opaque = SyntaxContext::new(db, call_id, transparency, edition, parent, identity, identity); } if transparency >= Transparency::SemiTransparent { let parent = opaque_and_semitransparent; opaque_and_semitransparent = - SyntaxContextId::new(db, call_id, transparency, edition, parent, |_| opaque, identity); + SyntaxContext::new(db, call_id, transparency, edition, parent, |_| opaque, identity); } let parent = ctxt; - SyntaxContextId::new( + SyntaxContext::new( db, call_id, transparency, @@ -144,9 +143,9 @@ fn apply_mark_internal( } pub trait SyntaxContextExt { - fn normalize_to_macro_rules(self, db: &dyn ExpandDatabase) -> span::SyntaxContextId; - fn normalize_to_macros_2_0(self, db: &dyn ExpandDatabase) -> span::SyntaxContextId; - fn parent_ctxt(self, db: &dyn ExpandDatabase) -> span::SyntaxContextId; + fn normalize_to_macro_rules(self, db: &dyn ExpandDatabase) -> span::SyntaxContext; + fn normalize_to_macros_2_0(self, db: &dyn ExpandDatabase) -> span::SyntaxContext; + fn parent_ctxt(self, db: &dyn ExpandDatabase) -> span::SyntaxContext; fn remove_mark(&mut self, db: &dyn ExpandDatabase) -> (Option<span::MacroCallId>, Transparency); fn outer_mark(self, db: &dyn ExpandDatabase) -> (Option<span::MacroCallId>, Transparency); @@ -154,14 +153,14 @@ pub trait SyntaxContextExt { fn is_opaque(self, db: &dyn ExpandDatabase) -> bool; } -impl SyntaxContextExt for SyntaxContextId { - fn normalize_to_macro_rules(self, db: &dyn ExpandDatabase) -> span::SyntaxContextId { +impl SyntaxContextExt for SyntaxContext { + fn normalize_to_macro_rules(self, db: &dyn ExpandDatabase) -> span::SyntaxContext { self.opaque_and_semitransparent(db) } - fn normalize_to_macros_2_0(self, db: &dyn ExpandDatabase) -> span::SyntaxContextId { + fn normalize_to_macros_2_0(self, db: &dyn ExpandDatabase) -> span::SyntaxContext { self.opaque(db) } - fn parent_ctxt(self, db: &dyn ExpandDatabase) -> span::SyntaxContextId { + fn parent_ctxt(self, db: &dyn ExpandDatabase) -> span::SyntaxContext { self.parent(db) } fn outer_mark(self, db: &dyn ExpandDatabase) -> (Option<span::MacroCallId>, Transparency) { @@ -188,7 +187,7 @@ impl SyntaxContextExt for SyntaxContextId { // FIXME: Make this a SyntaxContextExt method once we have RPIT pub fn marks_rev( - ctxt: SyntaxContextId, + ctxt: SyntaxContext, db: &dyn ExpandDatabase, ) -> impl Iterator<Item = (span::MacroCallId, Transparency)> + '_ { iter::successors(Some(ctxt), move |&mark| Some(mark.parent_ctxt(db))) @@ -200,53 +199,3 @@ pub fn marks_rev( (mark.0.unwrap(), mark.1) }) } - -pub(crate) fn dump_syntax_contexts(db: &dyn ExpandDatabase) -> String { - let mut s = String::from("Expansions:"); - let entries = - MacroCallWrapper::ingredient(db).entries(db.as_dyn_database()).collect::<Vec<_>>(); - for loc in entries { - let expn_data = &loc.fields().0; - - s.push_str(&format!( - "parent: {:?}, call_site_ctxt: {:?}, kind: {:?}", - expn_data.kind.file_id(), - expn_data.ctxt, - expn_data.kind.descr(), - )); - } - - s.push_str("\n\nSyntaxContexts:\n"); - let entries = SyntaxContextId::ingredient(db).entries(db.as_dyn_database()).collect::<Vec<_>>(); - for e in entries { - struct SyntaxContextDebug<'a>( - &'a dyn ExpandDatabase, - &'a span::SyntaxContextUnderlyingData, - ); - - impl std::fmt::Debug for SyntaxContextDebug<'_> { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - fancy_debug(self.1, self.0, f) - } - } - - fn fancy_debug( - this: &span::SyntaxContextUnderlyingData, - db: &dyn ExpandDatabase, - f: &mut std::fmt::Formatter<'_>, - ) -> std::fmt::Result { - write!(f, "parent: #{}, outer_mark: (", this.parent)?; - match this.outer_expn { - Some(id) => { - write!(f, "{:?}::{{{{expn{:?}}}}}", db.lookup_intern_macro_call(id).krate, id)? - } - None => write!(f, "root")?, - } - write!(f, ", {:?})", this.outer_transparency) - } - - let dbg = SyntaxContextDebug(db, e.fields()); - stdx::format_to!(s, "{:?}\n", dbg); - } - s -} diff --git a/src/tools/rust-analyzer/crates/hir-expand/src/lib.rs b/src/tools/rust-analyzer/crates/hir-expand/src/lib.rs index a1e484c08bc..ca5c40c9fac 100644 --- a/src/tools/rust-analyzer/crates/hir-expand/src/lib.rs +++ b/src/tools/rust-analyzer/crates/hir-expand/src/lib.rs @@ -37,7 +37,7 @@ use base_db::Crate; use either::Either; use span::{ Edition, EditionedFileId, ErasedFileAstId, FileAstId, HirFileIdRepr, Span, SpanAnchor, - SyntaxContextId, + SyntaxContext, }; use syntax::{ ast::{self, AstNode}, @@ -252,7 +252,7 @@ pub struct MacroCallLoc { pub def: MacroDefId, pub krate: Crate, pub kind: MacroCallKind, - pub ctxt: SyntaxContextId, + pub ctxt: SyntaxContext, } #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] @@ -527,7 +527,7 @@ impl MacroDefId { db: &dyn ExpandDatabase, krate: Crate, kind: MacroCallKind, - ctxt: SyntaxContextId, + ctxt: SyntaxContext, ) -> MacroCallId { db.intern_macro_call(MacroCallLoc { def: self, krate, kind, ctxt }) } @@ -683,7 +683,7 @@ impl MacroCallLoc { } impl MacroCallKind { - fn descr(&self) -> &'static str { + pub fn descr(&self) -> &'static str { match self { MacroCallKind::FnLike { .. } => "macro call", MacroCallKind::Derive { .. } => "derive macro", @@ -831,7 +831,7 @@ impl ExpansionInfo { pub fn map_range_down_exact( &self, span: Span, - ) -> Option<InMacroFile<impl Iterator<Item = (SyntaxToken, SyntaxContextId)> + '_>> { + ) -> Option<InMacroFile<impl Iterator<Item = (SyntaxToken, SyntaxContext)> + '_>> { let tokens = self.exp_map.ranges_with_span_exact(span).flat_map(move |(range, ctx)| { self.expanded.value.covering_element(range).into_token().zip(Some(ctx)) }); @@ -846,7 +846,7 @@ impl ExpansionInfo { pub fn map_range_down( &self, span: Span, - ) -> Option<InMacroFile<impl Iterator<Item = (SyntaxToken, SyntaxContextId)> + '_>> { + ) -> Option<InMacroFile<impl Iterator<Item = (SyntaxToken, SyntaxContext)> + '_>> { let tokens = self.exp_map.ranges_with_span(span).flat_map(move |(range, ctx)| { self.expanded.value.covering_element(range).into_token().zip(Some(ctx)) }); @@ -859,7 +859,7 @@ impl ExpansionInfo { &self, db: &dyn ExpandDatabase, offset: TextSize, - ) -> (FileRange, SyntaxContextId) { + ) -> (FileRange, SyntaxContext) { debug_assert!(self.expanded.value.text_range().contains(offset)); span_for_offset(db, &self.exp_map, offset) } @@ -869,7 +869,7 @@ impl ExpansionInfo { &self, db: &dyn ExpandDatabase, range: TextRange, - ) -> Option<(FileRange, SyntaxContextId)> { + ) -> Option<(FileRange, SyntaxContext)> { debug_assert!(self.expanded.value.text_range().contains_range(range)); map_node_range_up(db, &self.exp_map, range) } @@ -953,7 +953,7 @@ pub fn map_node_range_up( db: &dyn ExpandDatabase, exp_map: &ExpansionSpanMap, range: TextRange, -) -> Option<(FileRange, SyntaxContextId)> { +) -> Option<(FileRange, SyntaxContext)> { let mut spans = exp_map.spans_for_range(range); let Span { range, anchor, ctx } = spans.next()?; let mut start = range.start(); @@ -980,7 +980,7 @@ pub fn map_node_range_up_aggregated( db: &dyn ExpandDatabase, exp_map: &ExpansionSpanMap, range: TextRange, -) -> FxHashMap<(SpanAnchor, SyntaxContextId), TextRange> { +) -> FxHashMap<(SpanAnchor, SyntaxContext), TextRange> { let mut map = FxHashMap::default(); for span in exp_map.spans_for_range(range) { let range = map.entry((span.anchor, span.ctx)).or_insert_with(|| span.range); @@ -1002,7 +1002,7 @@ pub fn span_for_offset( db: &dyn ExpandDatabase, exp_map: &ExpansionSpanMap, offset: TextSize, -) -> (FileRange, SyntaxContextId) { +) -> (FileRange, SyntaxContext) { let span = exp_map.span_at(offset); let anchor_offset = db .ast_id_map(span.anchor.file_id.into()) diff --git a/src/tools/rust-analyzer/crates/hir-expand/src/mod_path.rs b/src/tools/rust-analyzer/crates/hir-expand/src/mod_path.rs index 40b10cb4380..5c160240a2b 100644 --- a/src/tools/rust-analyzer/crates/hir-expand/src/mod_path.rs +++ b/src/tools/rust-analyzer/crates/hir-expand/src/mod_path.rs @@ -14,7 +14,7 @@ use crate::{ use base_db::Crate; use intern::sym; use smallvec::SmallVec; -use span::{Edition, SyntaxContextId}; +use span::{Edition, SyntaxContext}; use syntax::{ast, AstNode}; #[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] @@ -44,7 +44,7 @@ impl ModPath { pub fn from_src( db: &dyn ExpandDatabase, path: ast::Path, - span_for_range: &mut dyn FnMut(::tt::TextRange) -> SyntaxContextId, + span_for_range: &mut dyn FnMut(::tt::TextRange) -> SyntaxContext, ) -> Option<ModPath> { convert_path(db, path, span_for_range) } @@ -209,7 +209,7 @@ fn display_fmt_path( fn convert_path( db: &dyn ExpandDatabase, path: ast::Path, - span_for_range: &mut dyn FnMut(::tt::TextRange) -> SyntaxContextId, + span_for_range: &mut dyn FnMut(::tt::TextRange) -> SyntaxContext, ) -> Option<ModPath> { let mut segments = path.segments(); @@ -333,7 +333,7 @@ fn convert_path_tt(db: &dyn ExpandDatabase, tt: tt::TokenTreesView<'_>) -> Optio Some(ModPath { kind, segments }) } -pub fn resolve_crate_root(db: &dyn ExpandDatabase, mut ctxt: SyntaxContextId) -> Option<Crate> { +pub fn resolve_crate_root(db: &dyn ExpandDatabase, mut ctxt: SyntaxContext) -> Option<Crate> { // When resolving `$crate` from a `macro_rules!` invoked in a `macro`, // we don't want to pretend that the `macro_rules!` definition is in the `macro` // as described in `SyntaxContextId::apply_mark`, so we ignore prepended opaque marks. diff --git a/src/tools/rust-analyzer/crates/hir-expand/src/name.rs b/src/tools/rust-analyzer/crates/hir-expand/src/name.rs index 51721effa35..79860a002af 100644 --- a/src/tools/rust-analyzer/crates/hir-expand/src/name.rs +++ b/src/tools/rust-analyzer/crates/hir-expand/src/name.rs @@ -3,7 +3,7 @@ use std::fmt; use intern::{sym, Symbol}; -use span::{Edition, SyntaxContextId}; +use span::{Edition, SyntaxContext}; use syntax::utils::is_raw_identifier; use syntax::{ast, format_smolstr}; @@ -74,7 +74,7 @@ impl Name { Name { symbol: Symbol::intern(text), ctx: () } } - pub fn new(text: &str, mut ctx: SyntaxContextId) -> Name { + pub fn new(text: &str, mut ctx: SyntaxContext) -> Name { // For comparisons etc. we remove the edition, because sometimes we search for some `Name` // and we don't know which edition it came from. // Can't do that for all `SyntaxContextId`s because it breaks Salsa. @@ -88,7 +88,7 @@ impl Name { pub fn new_root(text: &str) -> Name { // The edition doesn't matter for hygiene. - Self::new(text, SyntaxContextId::root(Edition::Edition2015)) + Self::new(text, SyntaxContext::root(Edition::Edition2015)) } pub fn new_tuple_field(idx: usize) -> Name { @@ -122,7 +122,7 @@ impl Name { } } - pub fn new_symbol(symbol: Symbol, ctx: SyntaxContextId) -> Self { + pub fn new_symbol(symbol: Symbol, ctx: SyntaxContext) -> Self { debug_assert!(!symbol.as_str().starts_with("r#")); _ = ctx; Self { symbol, ctx: () } @@ -130,7 +130,7 @@ impl Name { // FIXME: This needs to go once we have hygiene pub fn new_symbol_root(sym: Symbol) -> Self { - Self::new_symbol(sym, SyntaxContextId::root(Edition::Edition2015)) + Self::new_symbol(sym, SyntaxContext::root(Edition::Edition2015)) } /// A fake name for things missing in the source code. diff --git a/src/tools/rust-analyzer/crates/hir-expand/src/proc_macro.rs b/src/tools/rust-analyzer/crates/hir-expand/src/proc_macro.rs index cdf63e92a89..1330f6af9fd 100644 --- a/src/tools/rust-analyzer/crates/hir-expand/src/proc_macro.rs +++ b/src/tools/rust-analyzer/crates/hir-expand/src/proc_macro.rs @@ -154,7 +154,7 @@ impl CrateProcMacros { /// Fetch the [`CustomProcMacroExpander`]s and their corresponding names for the given crate. pub fn list( &self, - def_site_ctx: span::SyntaxContextId, + def_site_ctx: span::SyntaxContext, ) -> Option<Box<[(crate::name::Name, CustomProcMacroExpander, bool)]>> { match &self.0 { Ok(proc_macros) => Some( diff --git a/src/tools/rust-analyzer/crates/hir-expand/src/span_map.rs b/src/tools/rust-analyzer/crates/hir-expand/src/span_map.rs index ab99cb14f95..55fe42e271f 100644 --- a/src/tools/rust-analyzer/crates/hir-expand/src/span_map.rs +++ b/src/tools/rust-analyzer/crates/hir-expand/src/span_map.rs @@ -1,6 +1,6 @@ //! Span maps for real files and macro expansions. -use span::{EditionedFileId, HirFileId, HirFileIdRepr, MacroFileId, Span, SyntaxContextId}; +use span::{EditionedFileId, HirFileId, HirFileIdRepr, MacroFileId, Span, SyntaxContext}; use stdx::TupleExt; use syntax::{ast, AstNode, TextRange}; use triomphe::Arc; @@ -9,7 +9,7 @@ pub use span::RealSpanMap; use crate::{attrs::collect_attrs, db::ExpandDatabase}; -pub type ExpansionSpanMap = span::SpanMap<SyntaxContextId>; +pub type ExpansionSpanMap = span::SpanMap<SyntaxContext>; /// Spanmap for a macro file or a real file #[derive(Clone, Debug, PartialEq, Eq)] diff --git a/src/tools/rust-analyzer/crates/hir/src/semantics.rs b/src/tools/rust-analyzer/crates/hir/src/semantics.rs index 15cd69f320d..b971b2e9f1a 100644 --- a/src/tools/rust-analyzer/crates/hir/src/semantics.rs +++ b/src/tools/rust-analyzer/crates/hir/src/semantics.rs @@ -36,7 +36,7 @@ use intern::{sym, Symbol}; use itertools::Itertools; use rustc_hash::{FxHashMap, FxHashSet}; use smallvec::{smallvec, SmallVec}; -use span::{AstIdMap, EditionedFileId, FileId, HirFileIdRepr, SyntaxContextId}; +use span::{AstIdMap, EditionedFileId, FileId, HirFileIdRepr, SyntaxContext}; use stdx::TupleExt; use syntax::{ algo::skip_trivia_token, @@ -877,7 +877,7 @@ impl<'db> SemanticsImpl<'db> { pub fn descend_into_macros_cb( &self, token: SyntaxToken, - mut cb: impl FnMut(InFile<SyntaxToken>, SyntaxContextId), + mut cb: impl FnMut(InFile<SyntaxToken>, SyntaxContext), ) { if let Ok(token) = self.wrap_token_infile(token).into_real_file() { self.descend_into_macros_impl(token, &mut |t, ctx| { @@ -921,7 +921,7 @@ impl<'db> SemanticsImpl<'db> { pub fn descend_into_macros_breakable<T>( &self, token: InRealFile<SyntaxToken>, - mut cb: impl FnMut(InFile<SyntaxToken>, SyntaxContextId) -> ControlFlow<T>, + mut cb: impl FnMut(InFile<SyntaxToken>, SyntaxContext) -> ControlFlow<T>, ) -> Option<T> { self.descend_into_macros_impl(token.clone(), &mut cb) } @@ -979,7 +979,7 @@ impl<'db> SemanticsImpl<'db> { fn descend_into_macros_impl<T>( &self, InRealFile { value: token, file_id }: InRealFile<SyntaxToken>, - f: &mut dyn FnMut(InFile<SyntaxToken>, SyntaxContextId) -> ControlFlow<T>, + f: &mut dyn FnMut(InFile<SyntaxToken>, SyntaxContext) -> ControlFlow<T>, ) -> Option<T> { let _p = tracing::info_span!("descend_into_macros_impl").entered(); @@ -1016,7 +1016,7 @@ impl<'db> SemanticsImpl<'db> { None => { stack.push(( file_id.into(), - smallvec![(token, SyntaxContextId::root(file_id.edition()))], + smallvec![(token, SyntaxContext::root(file_id.edition()))], )); } } diff --git a/src/tools/rust-analyzer/crates/ide-db/src/rename.rs b/src/tools/rust-analyzer/crates/ide-db/src/rename.rs index a7584f67f11..902ead977e5 100644 --- a/src/tools/rust-analyzer/crates/ide-db/src/rename.rs +++ b/src/tools/rust-analyzer/crates/ide-db/src/rename.rs @@ -29,7 +29,7 @@ use crate::{ use base_db::AnchoredPathBuf; use either::Either; use hir::{FieldSource, FileRange, HirFileIdExt, InFile, ModuleSource, Semantics}; -use span::{Edition, EditionedFileId, FileId, SyntaxContextId}; +use span::{Edition, EditionedFileId, FileId, SyntaxContext}; use stdx::{never, TupleExt}; use syntax::{ ast::{self, HasName}, @@ -113,7 +113,7 @@ impl Definition { /// renamed and extern crate names will report its range, though a rename will introduce /// an alias instead. pub fn range_for_rename(self, sema: &Semantics<'_, RootDatabase>) -> Option<FileRange> { - let syn_ctx_is_root = |(range, ctx): (_, SyntaxContextId)| ctx.is_root().then_some(range); + let syn_ctx_is_root = |(range, ctx): (_, SyntaxContext)| ctx.is_root().then_some(range); let res = match self { Definition::Macro(mac) => { let src = sema.source(mac)?; @@ -220,7 +220,7 @@ impl Definition { fn name_range<D>( def: D, sema: &Semantics<'_, RootDatabase>, - ) -> Option<(FileRange, SyntaxContextId)> + ) -> Option<(FileRange, SyntaxContext)> where D: hir::HasSource, D::Ast: ast::HasName, diff --git a/src/tools/rust-analyzer/crates/ide/src/expand_macro.rs b/src/tools/rust-analyzer/crates/ide/src/expand_macro.rs index 3771efc17b6..a18eb9049ff 100644 --- a/src/tools/rust-analyzer/crates/ide/src/expand_macro.rs +++ b/src/tools/rust-analyzer/crates/ide/src/expand_macro.rs @@ -4,7 +4,7 @@ use ide_db::{ base_db::Crate, helpers::pick_best_token, syntax_helpers::prettify_macro_expansion, FileId, RootDatabase, }; -use span::{Edition, SpanMap, SyntaxContextId, TextRange, TextSize}; +use span::{Edition, SpanMap, SyntaxContext, TextRange, TextSize}; use stdx::format_to; use syntax::{ast, ted, AstNode, NodeOrToken, SyntaxKind, SyntaxNode, T}; @@ -142,7 +142,7 @@ fn expand_macro_recur( sema: &Semantics<'_, RootDatabase>, macro_call: &ast::Item, error: &mut String, - result_span_map: &mut SpanMap<SyntaxContextId>, + result_span_map: &mut SpanMap<SyntaxContext>, offset_in_original_node: TextSize, ) -> Option<SyntaxNode> { let ExpandResult { value: expanded, err } = match macro_call { @@ -170,7 +170,7 @@ fn expand( sema: &Semantics<'_, RootDatabase>, expanded: SyntaxNode, error: &mut String, - result_span_map: &mut SpanMap<SyntaxContextId>, + result_span_map: &mut SpanMap<SyntaxContext>, mut offset_in_original_node: i32, ) -> SyntaxNode { let children = expanded.descendants().filter_map(ast::Item::cast); @@ -207,7 +207,7 @@ fn format( kind: SyntaxKind, file_id: FileId, expanded: SyntaxNode, - span_map: &SpanMap<SyntaxContextId>, + span_map: &SpanMap<SyntaxContext>, krate: Crate, ) -> String { let expansion = prettify_macro_expansion(db, expanded, span_map, krate).to_string(); diff --git a/src/tools/rust-analyzer/crates/mbe/src/lib.rs b/src/tools/rust-analyzer/crates/mbe/src/lib.rs index bebd29ef747..6bc019bf333 100644 --- a/src/tools/rust-analyzer/crates/mbe/src/lib.rs +++ b/src/tools/rust-analyzer/crates/mbe/src/lib.rs @@ -21,7 +21,7 @@ mod benchmark; #[cfg(test)] mod tests; -use span::{Edition, Span, SyntaxContextId}; +use span::{Edition, Span, SyntaxContext}; use syntax_bridge::to_parser_input; use tt::iter::TtIter; use tt::DelimSpan; @@ -149,7 +149,7 @@ impl DeclarativeMacro { /// The old, `macro_rules! m {}` flavor. pub fn parse_macro_rules( tt: &tt::TopSubtree<Span>, - ctx_edition: impl Copy + Fn(SyntaxContextId) -> Edition, + ctx_edition: impl Copy + Fn(SyntaxContext) -> Edition, ) -> DeclarativeMacro { // Note: this parsing can be implemented using mbe machinery itself, by // matching against `$($lhs:tt => $rhs:tt);*` pattern, but implementing @@ -189,7 +189,7 @@ impl DeclarativeMacro { pub fn parse_macro2( args: Option<&tt::TopSubtree<Span>>, body: &tt::TopSubtree<Span>, - ctx_edition: impl Copy + Fn(SyntaxContextId) -> Edition, + ctx_edition: impl Copy + Fn(SyntaxContext) -> Edition, ) -> DeclarativeMacro { let mut rules = Vec::new(); let mut err = None; @@ -262,7 +262,7 @@ impl DeclarativeMacro { impl Rule { fn parse( - edition: impl Copy + Fn(SyntaxContextId) -> Edition, + edition: impl Copy + Fn(SyntaxContext) -> Edition, src: &mut TtIter<'_, Span>, ) -> Result<Self, ParseError> { let (_, lhs) = diff --git a/src/tools/rust-analyzer/crates/mbe/src/parser.rs b/src/tools/rust-analyzer/crates/mbe/src/parser.rs index 0a670053c98..9d91387a074 100644 --- a/src/tools/rust-analyzer/crates/mbe/src/parser.rs +++ b/src/tools/rust-analyzer/crates/mbe/src/parser.rs @@ -5,7 +5,7 @@ use std::sync::Arc; use arrayvec::ArrayVec; use intern::{sym, Symbol}; -use span::{Edition, Span, SyntaxContextId}; +use span::{Edition, Span, SyntaxContext}; use tt::iter::{TtElement, TtIter}; use crate::ParseError; @@ -28,14 +28,14 @@ pub(crate) struct MetaTemplate(pub(crate) Box<[Op]>); impl MetaTemplate { pub(crate) fn parse_pattern( - edition: impl Copy + Fn(SyntaxContextId) -> Edition, + edition: impl Copy + Fn(SyntaxContext) -> Edition, pattern: TtIter<'_, Span>, ) -> Result<Self, ParseError> { MetaTemplate::parse(edition, pattern, Mode::Pattern) } pub(crate) fn parse_template( - edition: impl Copy + Fn(SyntaxContextId) -> Edition, + edition: impl Copy + Fn(SyntaxContext) -> Edition, template: TtIter<'_, Span>, ) -> Result<Self, ParseError> { MetaTemplate::parse(edition, template, Mode::Template) @@ -46,7 +46,7 @@ impl MetaTemplate { } fn parse( - edition: impl Copy + Fn(SyntaxContextId) -> Edition, + edition: impl Copy + Fn(SyntaxContext) -> Edition, mut src: TtIter<'_, Span>, mode: Mode, ) -> Result<Self, ParseError> { @@ -179,7 +179,7 @@ enum Mode { } fn next_op( - edition: impl Copy + Fn(SyntaxContextId) -> Edition, + edition: impl Copy + Fn(SyntaxContext) -> Edition, first_peeked: TtElement<'_, Span>, src: &mut TtIter<'_, Span>, mode: Mode, @@ -287,7 +287,7 @@ fn next_op( } fn eat_fragment_kind( - edition: impl Copy + Fn(SyntaxContextId) -> Edition, + edition: impl Copy + Fn(SyntaxContext) -> Edition, src: &mut TtIter<'_, Span>, mode: Mode, ) -> Result<Option<MetaVarKind>, ParseError> { diff --git a/src/tools/rust-analyzer/crates/mbe/src/tests.rs b/src/tools/rust-analyzer/crates/mbe/src/tests.rs index 462c206bebf..7d9538a4b4d 100644 --- a/src/tools/rust-analyzer/crates/mbe/src/tests.rs +++ b/src/tools/rust-analyzer/crates/mbe/src/tests.rs @@ -3,7 +3,7 @@ // FIXME: Move more of the nameres independent tests from // crates\hir-def\src\macro_expansion_tests\mod.rs to this use expect_test::expect; -use span::{Edition, EditionedFileId, ErasedFileAstId, FileId, Span, SpanAnchor, SyntaxContextId}; +use span::{Edition, EditionedFileId, ErasedFileAstId, FileId, Span, SpanAnchor, SyntaxContext}; use stdx::format_to; use tt::{TextRange, TextSize}; @@ -26,7 +26,7 @@ fn check_( file_id: EditionedFileId::new(FileId::from_raw(0), def_edition), ast_id: ErasedFileAstId::from_raw(0), }, - SyntaxContextId::root(Edition::CURRENT), + SyntaxContext::root(Edition::CURRENT), decl, ) .unwrap(); @@ -42,7 +42,7 @@ fn check_( let arg_tt = syntax_bridge::parse_to_token_tree( call_edition, call_anchor, - SyntaxContextId::root(Edition::CURRENT), + SyntaxContext::root(Edition::CURRENT), arg, ) .unwrap(); @@ -52,7 +52,7 @@ fn check_( Span { range: TextRange::up_to(TextSize::of(arg)), anchor: call_anchor, - ctx: SyntaxContextId::root(Edition::CURRENT), + ctx: SyntaxContext::root(Edition::CURRENT), }, def_edition, ); diff --git a/src/tools/rust-analyzer/crates/proc-macro-api/src/legacy_protocol/msg.rs b/src/tools/rust-analyzer/crates/proc-macro-api/src/legacy_protocol/msg.rs index 4b831e4aceb..4178b04767a 100644 --- a/src/tools/rust-analyzer/crates/proc-macro-api/src/legacy_protocol/msg.rs +++ b/src/tools/rust-analyzer/crates/proc-macro-api/src/legacy_protocol/msg.rs @@ -159,7 +159,7 @@ type ProtocolWrite<W: Write> = for<'o, 'msg> fn(out: &'o mut W, msg: &'msg str) #[cfg(test)] mod tests { use intern::{sym, Symbol}; - use span::{Edition, ErasedFileAstId, Span, SpanAnchor, SyntaxContextId, TextRange, TextSize}; + use span::{Edition, ErasedFileAstId, Span, SpanAnchor, SyntaxContext, TextRange, TextSize}; use tt::{ Delimiter, DelimiterKind, Ident, Leaf, Literal, Punct, Spacing, TopSubtree, TopSubtreeBuilder, @@ -180,12 +180,12 @@ mod tests { open: Span { range: TextRange::empty(TextSize::new(0)), anchor, - ctx: SyntaxContextId::root(Edition::CURRENT), + ctx: SyntaxContext::root(Edition::CURRENT), }, close: Span { range: TextRange::empty(TextSize::new(19)), anchor, - ctx: SyntaxContextId::root(Edition::CURRENT), + ctx: SyntaxContext::root(Edition::CURRENT), }, kind: DelimiterKind::Invisible, }); @@ -196,7 +196,7 @@ mod tests { span: Span { range: TextRange::at(TextSize::new(0), TextSize::of("struct")), anchor, - ctx: SyntaxContextId::root(Edition::CURRENT), + ctx: SyntaxContext::root(Edition::CURRENT), }, is_raw: tt::IdentIsRaw::No, } @@ -208,7 +208,7 @@ mod tests { span: Span { range: TextRange::at(TextSize::new(5), TextSize::of("r#Foo")), anchor, - ctx: SyntaxContextId::root(Edition::CURRENT), + ctx: SyntaxContext::root(Edition::CURRENT), }, is_raw: tt::IdentIsRaw::Yes, } @@ -219,7 +219,7 @@ mod tests { span: Span { range: TextRange::at(TextSize::new(10), TextSize::of("\"Foo\"")), anchor, - ctx: SyntaxContextId::root(Edition::CURRENT), + ctx: SyntaxContext::root(Edition::CURRENT), }, kind: tt::LitKind::Str, suffix: None, @@ -229,7 +229,7 @@ mod tests { span: Span { range: TextRange::at(TextSize::new(13), TextSize::of('@')), anchor, - ctx: SyntaxContextId::root(Edition::CURRENT), + ctx: SyntaxContext::root(Edition::CURRENT), }, spacing: Spacing::Joint, })); @@ -238,7 +238,7 @@ mod tests { Span { range: TextRange::at(TextSize::new(14), TextSize::of('{')), anchor, - ctx: SyntaxContextId::root(Edition::CURRENT), + ctx: SyntaxContext::root(Edition::CURRENT), }, ); builder.push(Leaf::Literal(Literal { @@ -246,7 +246,7 @@ mod tests { span: Span { range: TextRange::at(TextSize::new(15), TextSize::of("0u32")), anchor, - ctx: SyntaxContextId::root(Edition::CURRENT), + ctx: SyntaxContext::root(Edition::CURRENT), }, kind: tt::LitKind::Integer, suffix: Some(sym::u32.clone()), @@ -254,7 +254,7 @@ mod tests { builder.close(Span { range: TextRange::at(TextSize::new(19), TextSize::of('}')), anchor, - ctx: SyntaxContextId::root(Edition::CURRENT), + ctx: SyntaxContext::root(Edition::CURRENT), }); builder.build() diff --git a/src/tools/rust-analyzer/crates/proc-macro-api/src/legacy_protocol/msg/flat.rs b/src/tools/rust-analyzer/crates/proc-macro-api/src/legacy_protocol/msg/flat.rs index c194f301714..101c4b3105a 100644 --- a/src/tools/rust-analyzer/crates/proc-macro-api/src/legacy_protocol/msg/flat.rs +++ b/src/tools/rust-analyzer/crates/proc-macro-api/src/legacy_protocol/msg/flat.rs @@ -40,9 +40,7 @@ use std::collections::VecDeque; use intern::Symbol; use rustc_hash::FxHashMap; use serde_derive::{Deserialize, Serialize}; -use span::{ - EditionedFileId, ErasedFileAstId, Span, SpanAnchor, SyntaxContextId, TextRange, TokenId, -}; +use span::{EditionedFileId, ErasedFileAstId, Span, SpanAnchor, SyntaxContext, TextRange, TokenId}; use crate::legacy_protocol::msg::{ENCODE_CLOSE_SPAN_VERSION, EXTENDED_LEAF_DATA}; @@ -74,7 +72,7 @@ pub fn deserialize_span_data_index_map(map: &[u32]) -> SpanDataIndexMap { ast_id: ErasedFileAstId::from_raw(ast_id), }, range: TextRange::new(start.into(), end.into()), - ctx: SyntaxContextId::from_u32(e), + ctx: SyntaxContext::from_u32(e), } }) .collect() diff --git a/src/tools/rust-analyzer/crates/proc-macro-srv/src/server_impl/rust_analyzer_span.rs b/src/tools/rust-analyzer/crates/proc-macro-srv/src/server_impl/rust_analyzer_span.rs index 59293ee3f96..f7cb0ab4655 100644 --- a/src/tools/rust-analyzer/crates/proc-macro-srv/src/server_impl/rust_analyzer_span.rs +++ b/src/tools/rust-analyzer/crates/proc-macro-srv/src/server_impl/rust_analyzer_span.rs @@ -428,7 +428,7 @@ impl server::Server for RaSpanServer { #[cfg(test)] mod tests { - use span::{EditionedFileId, FileId, SyntaxContextId}; + use span::{EditionedFileId, FileId, SyntaxContext}; use super::*; @@ -440,7 +440,7 @@ mod tests { file_id: EditionedFileId::current_edition(FileId::from_raw(0)), ast_id: span::ErasedFileAstId::from_raw(0), }, - ctx: SyntaxContextId::root(span::Edition::CURRENT), + ctx: SyntaxContext::root(span::Edition::CURRENT), }; let s = TokenStream { token_trees: vec![ @@ -482,7 +482,7 @@ mod tests { file_id: EditionedFileId::current_edition(FileId::from_raw(0)), ast_id: span::ErasedFileAstId::from_raw(0), }, - ctx: SyntaxContextId::root(span::Edition::CURRENT), + ctx: SyntaxContext::root(span::Edition::CURRENT), }; let subtree_paren_a = vec![ tt::TokenTree::Subtree(tt::Subtree { diff --git a/src/tools/rust-analyzer/crates/proc-macro-srv/src/tests/utils.rs b/src/tools/rust-analyzer/crates/proc-macro-srv/src/tests/utils.rs index 1b085520d56..584a27468f8 100644 --- a/src/tools/rust-analyzer/crates/proc-macro-srv/src/tests/utils.rs +++ b/src/tools/rust-analyzer/crates/proc-macro-srv/src/tests/utils.rs @@ -1,7 +1,7 @@ //! utils used in proc-macro tests use expect_test::Expect; -use span::{EditionedFileId, ErasedFileAstId, FileId, Span, SpanAnchor, SyntaxContextId, TokenId}; +use span::{EditionedFileId, ErasedFileAstId, FileId, Span, SpanAnchor, SyntaxContext, TokenId}; use tt::TextRange; use crate::{dylib, proc_macro_test_dylib_path, EnvSnapshot, ProcMacroSrv}; @@ -17,7 +17,7 @@ fn parse_string(call_site: TokenId, src: &str) -> crate::server_impl::TokenStrea fn parse_string_spanned( anchor: SpanAnchor, - call_site: SyntaxContextId, + call_site: SyntaxContext, src: &str, ) -> crate::server_impl::TokenStream<Span> { crate::server_impl::TokenStream::with_subtree(crate::server_impl::TopSubtree( @@ -81,7 +81,7 @@ fn assert_expand_impl( file_id: EditionedFileId::current_edition(FileId::from_raw(41)), ast_id: ErasedFileAstId::from_raw(1), }, - ctx: SyntaxContextId::root(span::Edition::CURRENT), + ctx: SyntaxContext::root(span::Edition::CURRENT), }; let call_site = Span { range: TextRange::new(0.into(), 100.into()), @@ -89,7 +89,7 @@ fn assert_expand_impl( file_id: EditionedFileId::current_edition(FileId::from_raw(42)), ast_id: ErasedFileAstId::from_raw(2), }, - ctx: SyntaxContextId::root(span::Edition::CURRENT), + ctx: SyntaxContext::root(span::Edition::CURRENT), }; let mixed_site = call_site; diff --git a/src/tools/rust-analyzer/crates/span/src/hygiene.rs b/src/tools/rust-analyzer/crates/span/src/hygiene.rs index a6402e87015..7cb1676a29d 100644 --- a/src/tools/rust-analyzer/crates/span/src/hygiene.rs +++ b/src/tools/rust-analyzer/crates/span/src/hygiene.rs @@ -23,9 +23,6 @@ use std::fmt; use crate::{Edition, MacroCallId}; -// Recursive expansion of interned macro -// ====================================== - /// A syntax context describes a hierarchy tracking order of macro definitions. #[derive(Copy, Clone, PartialEq, PartialOrd, Eq, Ord, Hash)] pub struct SyntaxContext( @@ -33,22 +30,21 @@ pub struct SyntaxContext( std::marker::PhantomData<&'static salsa::plumbing::interned::Value<SyntaxContext>>, ); -/// The underlying data interned by Salsa. -#[derive(Clone, Eq, Debug)] -pub struct SyntaxContextUnderlyingData { - pub outer_expn: Option<MacroCallId>, - pub outer_transparency: Transparency, - pub edition: Edition, - pub parent: SyntaxContext, - pub opaque: SyntaxContext, - pub opaque_and_semitransparent: SyntaxContext, -} - const _: () = { use salsa::plumbing as zalsa_; use salsa::plumbing::interned as zalsa_struct_; - impl PartialEq for SyntaxContextUnderlyingData { + #[derive(Clone, Eq, Debug)] + pub struct SyntaxContextData { + outer_expn: Option<MacroCallId>, + outer_transparency: Transparency, + edition: Edition, + parent: SyntaxContext, + opaque: SyntaxContext, + opaque_and_semitransparent: SyntaxContext, + } + + impl PartialEq for SyntaxContextData { fn eq(&self, other: &Self) -> bool { self.outer_expn == other.outer_expn && self.outer_transparency == other.outer_transparency @@ -57,7 +53,7 @@ const _: () = { } } - impl std::hash::Hash for SyntaxContextUnderlyingData { + impl std::hash::Hash for SyntaxContextData { fn hash<H: std::hash::Hasher>(&self, state: &mut H) { self.outer_expn.hash(state); self.outer_transparency.hash(state); @@ -71,7 +67,7 @@ const _: () = { struct StructKey<'db, T0, T1, T2, T3>(T0, T1, T2, T3, std::marker::PhantomData<&'db ()>); impl<'db, T0, T1, T2, T3> zalsa_::interned::HashEqLike<StructKey<'db, T0, T1, T2, T3>> - for SyntaxContextUnderlyingData + for SyntaxContextData where Option<MacroCallId>: zalsa_::interned::HashEqLike<T0>, Transparency: zalsa_::interned::HashEqLike<T1>, @@ -93,7 +89,7 @@ const _: () = { } impl zalsa_struct_::Configuration for SyntaxContext { const DEBUG_NAME: &'static str = "SyntaxContextData"; - type Fields<'a> = SyntaxContextUnderlyingData; + type Fields<'a> = SyntaxContextData; type Struct<'a> = SyntaxContext; fn struct_from_id<'db>(id: salsa::Id) -> Self::Struct<'db> { SyntaxContext(id, std::marker::PhantomData) @@ -189,7 +185,7 @@ const _: () = { parent, std::marker::PhantomData, ), - |id, data| SyntaxContextUnderlyingData { + |id, data| SyntaxContextData { outer_expn: zalsa_::interned::Lookup::into_owned(data.0), outer_transparency: zalsa_::interned::Lookup::into_owned(data.1), edition: zalsa_::interned::Lookup::into_owned(data.2), diff --git a/src/tools/rust-analyzer/crates/span/src/lib.rs b/src/tools/rust-analyzer/crates/span/src/lib.rs index 7abdacee2b9..fbd1b25cffc 100644 --- a/src/tools/rust-analyzer/crates/span/src/lib.rs +++ b/src/tools/rust-analyzer/crates/span/src/lib.rs @@ -11,9 +11,6 @@ pub use self::{ map::{RealSpanMap, SpanMap}, }; -// Remove this -pub use self::hygiene::{SyntaxContext as SyntaxContextId, SyntaxContextUnderlyingData}; - pub use syntax::Edition; pub use text_size::{TextRange, TextSize}; pub use vfs::FileId; @@ -31,7 +28,7 @@ pub const FIXUP_ERASED_FILE_AST_ID_MARKER: ErasedFileAstId = // is required to be stable for the proc-macro-server ErasedFileAstId::from_raw(!0 - 1); -pub type Span = SpanData<SyntaxContextId>; +pub type Span = SpanData<SyntaxContext>; impl Span { pub fn cover(self, other: Span) -> Span { diff --git a/src/tools/rust-analyzer/crates/span/src/map.rs b/src/tools/rust-analyzer/crates/span/src/map.rs index dc35de67fd8..9eb22d6e0b9 100644 --- a/src/tools/rust-analyzer/crates/span/src/map.rs +++ b/src/tools/rust-analyzer/crates/span/src/map.rs @@ -6,7 +6,7 @@ use std::{fmt, hash::Hash}; use stdx::{always, itertools::Itertools}; use crate::{ - EditionedFileId, ErasedFileAstId, Span, SpanAnchor, SpanData, SyntaxContextId, TextRange, + EditionedFileId, ErasedFileAstId, Span, SpanAnchor, SpanData, SyntaxContext, TextRange, TextSize, ROOT_ERASED_FILE_AST_ID, }; @@ -208,7 +208,7 @@ impl RealSpanMap { Span { range: range - offset, anchor: SpanAnchor { file_id: self.file_id, ast_id }, - ctx: SyntaxContextId::root(self.file_id.edition()), + ctx: SyntaxContext::root(self.file_id.edition()), } } } diff --git a/src/tools/rust-analyzer/crates/syntax-bridge/src/lib.rs b/src/tools/rust-analyzer/crates/syntax-bridge/src/lib.rs index a59a3270c9d..2dde236f0d2 100644 --- a/src/tools/rust-analyzer/crates/syntax-bridge/src/lib.rs +++ b/src/tools/rust-analyzer/crates/syntax-bridge/src/lib.rs @@ -45,7 +45,7 @@ impl<S: Copy, SM: SpanMapper<S>> SpanMapper<S> for &SM { /// Dummy things for testing where spans don't matter. pub mod dummy_test_span_utils { - use span::{Span, SyntaxContextId}; + use span::{Span, SyntaxContext}; use super::*; @@ -58,7 +58,7 @@ pub mod dummy_test_span_utils { ), ast_id: span::ROOT_ERASED_FILE_AST_ID, }, - ctx: SyntaxContextId::root(Edition::CURRENT), + ctx: SyntaxContext::root(Edition::CURRENT), }; pub struct DummyTestSpanMap; @@ -74,7 +74,7 @@ pub mod dummy_test_span_utils { ), ast_id: span::ROOT_ERASED_FILE_AST_ID, }, - ctx: SyntaxContextId::root(Edition::CURRENT), + ctx: SyntaxContext::root(Edition::CURRENT), } } } |
