Skip to content

Commit

Permalink
Rollup merge of #123738 - spastorino:reuse-lower-const-param, r=compi…
Browse files Browse the repository at this point in the history
…ler-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.
  • Loading branch information
matthiaskrgr authored Apr 11, 2024
2 parents ee73660 + d51fda8 commit c71a50d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
5 changes: 5 additions & 0 deletions compiler/rustc_hir_analysis/src/collect/resolve_bound_vars.rs
Original file line number Diff line number Diff line change
Expand Up @@ -717,6 +717,11 @@ impl<'a, 'tcx> Visitor<'tcx> for BoundVarContext<'a, 'tcx> {
}
}

#[instrument(level = "debug", skip(self))]
fn visit_pattern_type_pattern(&mut self, p: &'tcx hir::Pat<'tcx>) {
intravisit::walk_pat(self, p)
}

#[instrument(level = "debug", skip(self))]
fn visit_trait_item(&mut self, trait_item: &'tcx hir::TraitItem<'tcx>) {
use self::hir::TraitItemKind::*;
Expand Down
6 changes: 1 addition & 5 deletions compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2234,11 +2234,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
.type_of(def_id)
.no_bound_vars()
.expect("const parameter types cannot be generic");
let item_def_id = tcx.parent(def_id);
let generics = tcx.generics_of(item_def_id);
let index = generics.param_def_id_to_index[&def_id];
let name = tcx.item_name(def_id);
ty::Const::new_param(tcx, ty::ParamConst::new(index, name), ty)
self.lower_const_param(expr.hir_id, ty)
}

_ => {
Expand Down

0 comments on commit c71a50d

Please sign in to comment.