mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-03 15:15:24 +00:00
Move Expander and LowerCtx into separate modules
This commit is contained in:
parent
fd4bbcabe8
commit
bca8029a6e
25 changed files with 487 additions and 402 deletions
|
@ -7,7 +7,6 @@ use std::fmt::{self, Debug};
|
|||
use base_db::CrateId;
|
||||
use chalk_ir::{BoundVar, TyKind};
|
||||
use hir_def::{
|
||||
body,
|
||||
data::adt::VariantData,
|
||||
db::DefDatabase,
|
||||
find_path,
|
||||
|
@ -1552,7 +1551,10 @@ impl HirDisplay for TypeRef {
|
|||
}
|
||||
TypeRef::Macro(macro_call) => {
|
||||
let macro_call = macro_call.to_node(f.db.upcast());
|
||||
let ctx = body::LowerCtx::with_hygiene(f.db.upcast(), &Hygiene::new_unhygienic());
|
||||
let ctx = hir_def::lower::LowerCtx::with_hygiene(
|
||||
f.db.upcast(),
|
||||
&Hygiene::new_unhygienic(),
|
||||
);
|
||||
match macro_call.path() {
|
||||
Some(path) => match Path::from_src(path, &ctx) {
|
||||
Some(path) => path.hir_fmt(f)?,
|
||||
|
|
|
@ -43,7 +43,7 @@ impl_internable!(
|
|||
);
|
||||
|
||||
impl chalk_ir::interner::Interner for Interner {
|
||||
type InternedType = Interned<InternedWrapper<chalk_ir::TyData<Interner>>>;
|
||||
type InternedType = Interned<InternedWrapper<chalk_ir::TyData<Self>>>;
|
||||
type InternedLifetime = Interned<InternedWrapper<chalk_ir::LifetimeData<Self>>>;
|
||||
type InternedConst = Interned<InternedWrapper<chalk_ir::ConstData<Self>>>;
|
||||
type InternedConcreteConst = ConstScalar;
|
||||
|
|
|
@ -18,9 +18,9 @@ use chalk_ir::{
|
|||
|
||||
use either::Either;
|
||||
use hir_def::{
|
||||
body::Expander,
|
||||
builtin_type::BuiltinType,
|
||||
data::adt::StructKind,
|
||||
expander::Expander,
|
||||
generics::{
|
||||
TypeOrConstParamData, TypeParamProvenance, WherePredicate, WherePredicateTypeTarget,
|
||||
},
|
||||
|
@ -378,7 +378,9 @@ impl<'a> TyLoweringContext<'a> {
|
|||
};
|
||||
let ty = {
|
||||
let macro_call = macro_call.to_node(self.db.upcast());
|
||||
match expander.enter_expand::<ast::Type>(self.db.upcast(), macro_call) {
|
||||
match expander.enter_expand::<ast::Type>(self.db.upcast(), macro_call, |path| {
|
||||
self.resolver.resolve_path_as_macro(self.db.upcast(), &path)
|
||||
}) {
|
||||
Ok(ExpandResult { value: Some((mark, expanded)), .. }) => {
|
||||
let ctx = expander.ctx(self.db.upcast());
|
||||
// FIXME: Report syntax errors in expansion here
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue