Skip to content

Commit 02a793b

Browse files
committed
chore: Remove legacy SyntaxContextId re-export
1 parent 60cd018 commit 02a793b

File tree

38 files changed

+164
-228
lines changed

38 files changed

+164
-228
lines changed

crates/hir-def/src/expander.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use hir_expand::{
99
attrs::RawAttrs, mod_path::ModPath, span_map::SpanMap, ExpandError, ExpandErrorKind,
1010
ExpandResult, HirFileId, InFile, Lookup, MacroCallId,
1111
};
12-
use span::{Edition, SyntaxContextId};
12+
use span::{Edition, SyntaxContext};
1313
use syntax::{ast, Parse};
1414
use triomphe::Arc;
1515

@@ -57,9 +57,9 @@ impl Expander {
5757
self.module.krate
5858
}
5959

60-
pub fn syntax_context(&self) -> SyntaxContextId {
60+
pub fn syntax_context(&self) -> SyntaxContext {
6161
// FIXME:
62-
SyntaxContextId::root(Edition::CURRENT)
62+
SyntaxContext::root(Edition::CURRENT)
6363
}
6464

6565
pub fn enter_expand<T: ast::AstNode>(

crates/hir-def/src/expr_store.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,13 @@ pub use self::body::{Body, BodySourceMap};
3737

3838
/// A wrapper around [`span::SyntaxContextId`] that is intended only for comparisons.
3939
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
40-
pub struct HygieneId(span::SyntaxContextId);
40+
pub struct HygieneId(span::SyntaxContext);
4141

4242
impl HygieneId {
4343
// The edition doesn't matter here, we only use this for comparisons and to lookup the macro.
44-
pub const ROOT: Self = Self(span::SyntaxContextId::root(Edition::Edition2015));
44+
pub const ROOT: Self = Self(span::SyntaxContext::root(Edition::Edition2015));
4545

46-
pub fn new(mut ctx: span::SyntaxContextId) -> Self {
46+
pub fn new(mut ctx: span::SyntaxContext) -> Self {
4747
// See `Name` for why we're doing that.
4848
ctx.remove_root_edition();
4949
Self(ctx)

crates/hir-def/src/hir/format_args.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use either::Either;
44
use hir_expand::name::Name;
55
use intern::Symbol;
66
use rustc_parse_format as parse;
7-
use span::SyntaxContextId;
7+
use span::SyntaxContext;
88
use stdx::TupleExt;
99
use syntax::{
1010
ast::{self, IsString},
@@ -176,7 +176,7 @@ pub(crate) fn parse(
176176
is_direct_literal: bool,
177177
mut synth: impl FnMut(Name, Option<TextRange>) -> ExprId,
178178
mut record_usage: impl FnMut(Name, Option<TextRange>),
179-
call_ctx: SyntaxContextId,
179+
call_ctx: SyntaxContext,
180180
) -> FormatArgs {
181181
let Ok(text) = s.value() else {
182182
return FormatArgs {

crates/hir-def/src/item_tree.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ use intern::{Interned, Symbol};
5151
use la_arena::{Arena, Idx, RawIdx};
5252
use rustc_hash::FxHashMap;
5353
use smallvec::SmallVec;
54-
use span::{AstIdNode, Edition, FileAstId, SyntaxContextId};
54+
use span::{AstIdNode, Edition, FileAstId, SyntaxContext};
5555
use stdx::never;
5656
use syntax::{ast, match_ast, SyntaxKind};
5757
use triomphe::Arc;
@@ -1098,7 +1098,7 @@ pub struct MacroCall {
10981098
pub path: Interned<ModPath>,
10991099
pub ast_id: FileAstId<ast::MacroCall>,
11001100
pub expand_to: ExpandTo,
1101-
pub ctxt: SyntaxContextId,
1101+
pub ctxt: SyntaxContext,
11021102
}
11031103

11041104
#[derive(Debug, Clone, Eq, PartialEq)]

crates/hir-def/src/item_tree/lower.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use hir_expand::{
1111
use intern::{sym, Symbol};
1212
use la_arena::Arena;
1313
use rustc_hash::FxHashMap;
14-
use span::{AstIdMap, SyntaxContextId};
14+
use span::{AstIdMap, SyntaxContext};
1515
use stdx::thin_vec::ThinVec;
1616
use syntax::{
1717
ast::{self, HasModuleItem, HasName, HasTypeBounds, IsString},
@@ -968,7 +968,7 @@ impl UseTreeLowering<'_> {
968968
fn lower_use_tree(
969969
&mut self,
970970
tree: ast::UseTree,
971-
span_for_range: &mut dyn FnMut(::tt::TextRange) -> SyntaxContextId,
971+
span_for_range: &mut dyn FnMut(::tt::TextRange) -> SyntaxContext,
972972
) -> Option<UseTree> {
973973
if let Some(use_tree_list) = tree.use_tree_list() {
974974
let prefix = match tree.path() {
@@ -1035,7 +1035,7 @@ impl UseTreeLowering<'_> {
10351035
pub(crate) fn lower_use_tree(
10361036
db: &dyn DefDatabase,
10371037
tree: ast::UseTree,
1038-
span_for_range: &mut dyn FnMut(::tt::TextRange) -> SyntaxContextId,
1038+
span_for_range: &mut dyn FnMut(::tt::TextRange) -> SyntaxContext,
10391039
) -> Option<(UseTree, Arena<ast::UseTree>)> {
10401040
let mut lowering = UseTreeLowering { db, mapping: Arena::new() };
10411041
let tree = lowering.lower_use_tree(tree, span_for_range)?;

crates/hir-def/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ use hir_expand::{
8585
use item_tree::ExternBlock;
8686
use la_arena::Idx;
8787
use nameres::DefMap;
88-
use span::{AstIdNode, Edition, FileAstId, SyntaxContextId};
88+
use span::{AstIdNode, Edition, FileAstId, SyntaxContext};
8989
use stdx::impl_from;
9090
use syntax::{ast, AstNode};
9191

@@ -1451,7 +1451,7 @@ impl<T: AstIdNode> AstIdWithPath<T> {
14511451
fn macro_call_as_call_id(
14521452
db: &dyn ExpandDatabase,
14531453
call: &AstIdWithPath<ast::MacroCall>,
1454-
call_site: SyntaxContextId,
1454+
call_site: SyntaxContext,
14551455
expand_to: ExpandTo,
14561456
krate: Crate,
14571457
resolver: impl Fn(&path::ModPath) -> Option<MacroDefId> + Copy,
@@ -1473,7 +1473,7 @@ fn macro_call_as_call_id_with_eager(
14731473
db: &dyn ExpandDatabase,
14741474
ast_id: AstId<ast::MacroCall>,
14751475
path: &path::ModPath,
1476-
call_site: SyntaxContextId,
1476+
call_site: SyntaxContext,
14771477
expand_to: ExpandTo,
14781478
krate: Crate,
14791479
resolver: impl FnOnce(&path::ModPath) -> Option<MacroDefId>,

crates/hir-def/src/nameres/attr_resolution.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use hir_expand::{
66
inert_attr_macro::find_builtin_attr_idx,
77
MacroCallId, MacroCallKind, MacroDefId,
88
};
9-
use span::SyntaxContextId;
9+
use span::SyntaxContext;
1010
use syntax::ast;
1111
use triomphe::Arc;
1212

@@ -137,7 +137,7 @@ pub(super) fn derive_macro_as_call_id(
137137
item_attr: &AstIdWithPath<ast::Adt>,
138138
derive_attr_index: AttrId,
139139
derive_pos: u32,
140-
call_site: SyntaxContextId,
140+
call_site: SyntaxContext,
141141
krate: Crate,
142142
resolver: impl Fn(&path::ModPath) -> Option<(MacroId, MacroDefId)>,
143143
derive_macro_id: MacroCallId,

crates/hir-def/src/nameres/collector.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use intern::{sym, Interned};
2020
use itertools::{izip, Itertools};
2121
use la_arena::Idx;
2222
use rustc_hash::{FxHashMap, FxHashSet};
23-
use span::{Edition, EditionedFileId, FileAstId, SyntaxContextId};
23+
use span::{Edition, EditionedFileId, FileAstId, SyntaxContext};
2424
use syntax::ast;
2525
use triomphe::Arc;
2626

@@ -192,13 +192,13 @@ enum MacroDirectiveKind {
192192
FnLike {
193193
ast_id: AstIdWithPath<ast::MacroCall>,
194194
expand_to: ExpandTo,
195-
ctxt: SyntaxContextId,
195+
ctxt: SyntaxContext,
196196
},
197197
Derive {
198198
ast_id: AstIdWithPath<ast::Adt>,
199199
derive_attr: AttrId,
200200
derive_pos: usize,
201-
ctxt: SyntaxContextId,
201+
ctxt: SyntaxContext,
202202
/// The "parent" macro it is resolved to.
203203
derive_macro_id: MacroCallId,
204204
},

crates/hir-def/src/resolver.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use intern::{sym, Symbol};
77
use itertools::Itertools as _;
88
use rustc_hash::FxHashSet;
99
use smallvec::{smallvec, SmallVec};
10-
use span::SyntaxContextId;
10+
use span::SyntaxContext;
1111
use triomphe::Arc;
1212

1313
use crate::{
@@ -903,7 +903,7 @@ impl Resolver {
903903
fn handle_macro_def_scope(
904904
db: &dyn DefDatabase,
905905
hygiene_id: &mut HygieneId,
906-
hygiene_info: &mut Option<(SyntaxContextId, MacroDefId)>,
906+
hygiene_info: &mut Option<(SyntaxContext, MacroDefId)>,
907907
macro_id: &MacroDefId,
908908
) {
909909
if let Some((parent_ctx, label_macro_id)) = hygiene_info {
@@ -924,7 +924,7 @@ fn handle_macro_def_scope(
924924
fn hygiene_info(
925925
db: &dyn DefDatabase,
926926
hygiene_id: HygieneId,
927-
) -> Option<(SyntaxContextId, MacroDefId)> {
927+
) -> Option<(SyntaxContext, MacroDefId)> {
928928
if !hygiene_id.is_root() {
929929
let ctx = hygiene_id.lookup();
930930
ctx.outer_expn(db).map(|expansion| {

crates/hir-def/src/visibility.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use std::iter;
44

55
use intern::Interned;
66
use la_arena::ArenaMap;
7-
use span::SyntaxContextId;
7+
use span::SyntaxContext;
88
use syntax::ast;
99
use triomphe::Arc;
1010

@@ -37,7 +37,7 @@ impl RawVisibility {
3737
pub(crate) fn from_ast(
3838
db: &dyn DefDatabase,
3939
node: Option<ast::Visibility>,
40-
span_for_range: &mut dyn FnMut(::tt::TextRange) -> SyntaxContextId,
40+
span_for_range: &mut dyn FnMut(::tt::TextRange) -> SyntaxContext,
4141
) -> RawVisibility {
4242
let node = match node {
4343
None => return RawVisibility::private(),
@@ -49,7 +49,7 @@ impl RawVisibility {
4949
fn from_ast_with_span_map(
5050
db: &dyn DefDatabase,
5151
node: ast::Visibility,
52-
span_for_range: &mut dyn FnMut(::tt::TextRange) -> SyntaxContextId,
52+
span_for_range: &mut dyn FnMut(::tt::TextRange) -> SyntaxContext,
5353
) -> RawVisibility {
5454
let path = match node.kind() {
5555
ast::VisibilityKind::In(path) => {

0 commit comments

Comments
 (0)