fmt
This commit is contained in:
parent
f59b91e8a0
commit
4833ce8673
5 changed files with 8 additions and 7 deletions
|
@ -35,7 +35,7 @@ TrivialTypeTraversalAndLiftImpls! {
|
||||||
pub type BoundAbstractConst<'tcx> = Result<Option<EarlyBinder<ty::Const<'tcx>>>, ErrorGuaranteed>;
|
pub type BoundAbstractConst<'tcx> = Result<Option<EarlyBinder<ty::Const<'tcx>>>, ErrorGuaranteed>;
|
||||||
|
|
||||||
impl<'tcx> TyCtxt<'tcx> {
|
impl<'tcx> TyCtxt<'tcx> {
|
||||||
/// Returns a const with substs applied by
|
/// Returns a const without substs applied
|
||||||
fn bound_abstract_const(self, uv: ty::WithOptConstParam<DefId>) -> BoundAbstractConst<'tcx> {
|
fn bound_abstract_const(self, uv: ty::WithOptConstParam<DefId>) -> BoundAbstractConst<'tcx> {
|
||||||
let ac = if let Some((did, param_did)) = uv.as_const_arg() {
|
let ac = if let Some((did, param_did)) = uv.as_const_arg() {
|
||||||
self.thir_abstract_const_of_const_arg((did, param_did))
|
self.thir_abstract_const_of_const_arg((did, param_did))
|
||||||
|
|
|
@ -647,7 +647,7 @@ pub fn super_relate_consts<'tcx, R: TypeRelation<'tcx>>(
|
||||||
(ty::ConstKind::Placeholder(p1), ty::ConstKind::Placeholder(p2)) => p1 == p2,
|
(ty::ConstKind::Placeholder(p1), ty::ConstKind::Placeholder(p2)) => p1 == p2,
|
||||||
(ty::ConstKind::Value(a_val), ty::ConstKind::Value(b_val)) => a_val == b_val,
|
(ty::ConstKind::Value(a_val), ty::ConstKind::Value(b_val)) => a_val == b_val,
|
||||||
|
|
||||||
(ty::ConstKind::Unevaluated(_au), ty::ConstKind::Unevaluated(_bu))
|
(ty::ConstKind::Unevaluated(_), ty::ConstKind::Unevaluated(_))
|
||||||
if tcx.features().generic_const_exprs =>
|
if tcx.features().generic_const_exprs =>
|
||||||
{
|
{
|
||||||
if let (Ok(Some(a)), Ok(Some(b))) = (
|
if let (Ok(Some(a)), Ok(Some(b))) = (
|
||||||
|
@ -681,7 +681,7 @@ pub fn super_relate_consts<'tcx, R: TypeRelation<'tcx>>(
|
||||||
(ty::ConstKind::Expr(ae), ty::ConstKind::Expr(be)) => {
|
(ty::ConstKind::Expr(ae), ty::ConstKind::Expr(be)) => {
|
||||||
let r = relation;
|
let r = relation;
|
||||||
|
|
||||||
// FIXME(julianknodt): is it possible to relate two consts which are not identical
|
// FIXME(generic_const_exprs): is it possible to relate two consts which are not identical
|
||||||
// exprs? Should we care about that?
|
// exprs? Should we care about that?
|
||||||
let expr = match (ae, be) {
|
let expr = match (ae, be) {
|
||||||
(Expr::Binop(a_op, al, ar), Expr::Binop(b_op, bl, br))
|
(Expr::Binop(a_op, al, ar), Expr::Binop(b_op, bl, br))
|
||||||
|
|
|
@ -286,8 +286,9 @@ where
|
||||||
fn visit_const(&mut self, c: Const<'tcx>) -> ControlFlow<Self::BreakTy> {
|
fn visit_const(&mut self, c: Const<'tcx>) -> ControlFlow<Self::BreakTy> {
|
||||||
self.visit_ty(c.ty())?;
|
self.visit_ty(c.ty())?;
|
||||||
let tcx = self.def_id_visitor.tcx();
|
let tcx = self.def_id_visitor.tcx();
|
||||||
if let ty::ConstKind::Unevaluated(uv) = c.kind() &&
|
if let ty::ConstKind::Unevaluated(uv) = c.kind()
|
||||||
let Ok(Some(ct)) = tcx.expand_unevaluated_abstract_const(uv.def, uv.substs) {
|
&& let Ok(Some(ct)) = tcx.expand_unevaluated_abstract_const(uv.def, uv.substs)
|
||||||
|
{
|
||||||
ct.super_visit_with(self)?;
|
ct.super_visit_with(self)?;
|
||||||
}
|
}
|
||||||
ControlFlow::CONTINUE
|
ControlFlow::CONTINUE
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue