mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-27 18:26:19 +00:00
chore: Remove legacy SyntaxContextId re-export
This commit is contained in:
parent
60cd01864a
commit
02a793bd59
38 changed files with 164 additions and 228 deletions
|
|
@ -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>(
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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)]
|
||||
|
|
|
|||
|
|
@ -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)?;
|
||||
|
|
|
|||
|
|
@ -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>,
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
},
|
||||
|
|
|
|||
|
|
@ -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| {
|
||||
|
|
|
|||
|
|
@ -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) => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue