Merge pull request #18427 from ChayimFriedman2/cleanup-ty

Cleanup TypeRef lowering
This commit is contained in:
Lukas Wirth 2024-10-29 10:00:44 +00:00 committed by GitHub
commit 3fd6a72556
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 151 additions and 170 deletions

View file

@ -2033,7 +2033,7 @@ impl HirDisplayWithTypesMap for TypeRefId {
TypeRef::Macro(macro_call) => {
let (mut types_map, mut types_source_map) =
(TypesMap::default(), TypesSourceMap::default());
let ctx = hir_def::lower::LowerCtx::new(
let mut ctx = hir_def::lower::LowerCtx::new(
f.db.upcast(),
macro_call.file_id,
&mut types_map,
@ -2041,7 +2041,7 @@ impl HirDisplayWithTypesMap for TypeRefId {
);
let macro_call = macro_call.to_node(f.db.upcast());
match macro_call.path() {
Some(path) => match Path::from_src(&ctx, path) {
Some(path) => match Path::from_src(&mut ctx, path) {
Some(path) => path.hir_fmt(f, &types_map)?,
None => write!(f, "{{macro}}")?,
},

View file

@ -465,13 +465,13 @@ impl<'a> TyLoweringContext<'a> {
let (mut types_map, mut types_source_map) =
(TypesMap::default(), TypesSourceMap::default());
let ctx = expander.ctx(
let mut ctx = expander.ctx(
self.db.upcast(),
&mut types_map,
&mut types_source_map,
);
// FIXME: Report syntax errors in expansion here
let type_ref = TypeRef::from_ast(&ctx, expanded.tree());
let type_ref = TypeRef::from_ast(&mut ctx, expanded.tree());
drop(expander);