Skip to content

Commit c71a50d

Browse files
authored
Rollup merge of #123738 - spastorino:reuse-lower-const-param, r=compiler-errors
Call lower_const_param instead of duplicating the code Follow up of #123689 r? `@oli-obk` I had this commit in my old branch that I had forgotten about, `@fmease` pointed about this in #123689 I've left the branches that are not `Range` as do nothing as that's what we are currently doing but maybe we want to err or something.
2 parents ee73660 + d51fda8 commit c71a50d

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

compiler/rustc_hir_analysis/src/collect/resolve_bound_vars.rs

+5
Original file line numberDiff line numberDiff line change
@@ -717,6 +717,11 @@ impl<'a, 'tcx> Visitor<'tcx> for BoundVarContext<'a, 'tcx> {
717717
}
718718
}
719719

720+
#[instrument(level = "debug", skip(self))]
721+
fn visit_pattern_type_pattern(&mut self, p: &'tcx hir::Pat<'tcx>) {
722+
intravisit::walk_pat(self, p)
723+
}
724+
720725
#[instrument(level = "debug", skip(self))]
721726
fn visit_trait_item(&mut self, trait_item: &'tcx hir::TraitItem<'tcx>) {
722727
use self::hir::TraitItemKind::*;

compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs

+1-5
Original file line numberDiff line numberDiff line change
@@ -2234,11 +2234,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
22342234
.type_of(def_id)
22352235
.no_bound_vars()
22362236
.expect("const parameter types cannot be generic");
2237-
let item_def_id = tcx.parent(def_id);
2238-
let generics = tcx.generics_of(item_def_id);
2239-
let index = generics.param_def_id_to_index[&def_id];
2240-
let name = tcx.item_name(def_id);
2241-
ty::Const::new_param(tcx, ty::ParamConst::new(index, name), ty)
2237+
self.lower_const_param(expr.hir_id, ty)
22422238
}
22432239

22442240
_ => {

0 commit comments

Comments
 (0)