Skip to content

Commit

Permalink
Oops: use the correct DefId
Browse files Browse the repository at this point in the history
  • Loading branch information
Nadrieril committed Jun 26, 2024
1 parent 09f3985 commit 2c67d33
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions frontend/exporter/src/constant_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ pub trait ConstantExt<'tcx>: Sized + std::fmt::Debug {
trait_refs: vec![],
}
};
let ty = s.base().tcx.type_of(s.owner_id());
let ty = s.base().tcx.type_of(ucv.def);
let cv = kind.decorate(ty.sinto(s), span.sinto(s));
TranslateUnevalRes::GlobalName(cv)
}
Expand Down Expand Up @@ -414,10 +414,9 @@ impl<'tcx, S: UnderOwnerState<'tcx>> SInto<S, ConstantExpr> for ty::Const<'tcx>
let span = self.default_span(s.base().tcx);
match self.kind() {
ty::ConstKind::Param(p) => {
let kind = ConstantExprKind::ConstRef { id: p.sinto(s) };
let tcx = s.base().tcx;
let param_env = tcx.param_env(s.owner_id());
let param_env = s.base().tcx.param_env(s.owner_id());
let ty = p.find_ty_from_env(param_env);
let kind = ConstantExprKind::ConstRef { id: p.sinto(s) };
kind.decorate(ty.sinto(s), span.sinto(s))
}
ty::ConstKind::Infer(..) => fatal!(s[span], "ty::ConstKind::Infer node? {:#?}", self),
Expand Down

0 comments on commit 2c67d33

Please sign in to comment.