Skip to content

Commit fbe5e44

Browse files
committed
Use ItemCtxt::lower_ty over <dyn HirTyLowerer<'_>>::lower_ty
Simplifies the code.
1 parent 34426ff commit fbe5e44

File tree

2 files changed

+2
-7
lines changed

2 files changed

+2
-7
lines changed

compiler/rustc_hir_analysis/src/collect/type_of.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,7 @@ fn anon_const_type_of<'tcx>(tcx: TyCtxt<'tcx>, def_id: LocalDefId) -> Ty<'tcx> {
108108
.unwrap()
109109
.0
110110
.def_id;
111-
let item_ctxt =
112-
&ItemCtxt::new(tcx, item_def_id) as &dyn crate::hir_ty_lowering::HirTyLowerer<'_>;
113-
let ty = item_ctxt.lower_ty(hir_ty);
111+
let ty = ItemCtxt::new(tcx, item_def_id).lower_ty(hir_ty);
114112

115113
// Iterate through the generics of the projection to find the one that corresponds to
116114
// the def_id that this query was called with. We filter to only type and const args here

compiler/rustc_hir_analysis/src/lib.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,6 @@ use rustc_span::{symbol::sym, Span};
109109
use rustc_target::spec::abi::Abi;
110110
use rustc_trait_selection::traits;
111111

112-
use hir_ty_lowering::HirTyLowerer;
113-
114112
rustc_fluent_macro::fluent_messages! { "../messages.ftl" }
115113

116114
fn require_c_abi_if_c_variadic(tcx: TyCtxt<'_>, decl: &hir::FnDecl<'_>, abi: Abi, span: Span) {
@@ -207,6 +205,5 @@ pub fn lower_ty<'tcx>(tcx: TyCtxt<'tcx>, hir_ty: &hir::Ty<'tcx>) -> Ty<'tcx> {
207205
// def-ID that will be used to determine the traits/predicates in
208206
// scope. This is derived from the enclosing item-like thing.
209207
let env_def_id = tcx.hir().get_parent_item(hir_ty.hir_id);
210-
let item_cx = self::collect::ItemCtxt::new(tcx, env_def_id.def_id);
211-
item_cx.lowerer().lower_ty(hir_ty)
208+
collect::ItemCtxt::new(tcx, env_def_id.def_id).lower_ty(hir_ty)
212209
}

0 commit comments

Comments
 (0)