Skip to content

Commit

Permalink
Remove some type relating logic that has no tests
Browse files Browse the repository at this point in the history
  • Loading branch information
oli-obk committed Apr 19, 2024
1 parent 07d0d7c commit c510140
Showing 1 changed file with 3 additions and 38 deletions.
41 changes: 3 additions & 38 deletions compiler/rustc_trait_selection/src/traits/auto_trait.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,11 @@

use super::*;

use crate::errors::UnableToConstructConstantValue;
use crate::infer::region_constraints::{Constraint, RegionConstraintData};
use crate::traits::project::ProjectAndUnifyResult;

use rustc_data_structures::fx::{FxIndexMap, FxIndexSet, IndexEntry};
use rustc_data_structures::unord::UnordSet;
use rustc_infer::infer::DefineOpaqueTypes;
use rustc_middle::mir::interpret::ErrorHandled;
use rustc_middle::ty::{Region, RegionVid};

use std::collections::VecDeque;
Expand Down Expand Up @@ -762,42 +759,10 @@ impl<'tcx> AutoTraitFinder<'tcx> {
_ => {}
};
}
ty::PredicateKind::ConstEquate(c1, c2) => {
let evaluate = |c: ty::Const<'tcx>| {
if let ty::ConstKind::Unevaluated(unevaluated) = c.kind() {
match selcx.infcx.const_eval_resolve(
obligation.param_env,
unevaluated,
obligation.cause.span,
) {
Ok(Some(valtree)) => Ok(ty::Const::new_value(selcx.tcx(),valtree, c.ty())),
Ok(None) => {
let tcx = self.tcx;
let reported =
tcx.dcx().emit_err(UnableToConstructConstantValue {
span: tcx.def_span(unevaluated.def),
unevaluated: unevaluated,
});
Err(ErrorHandled::Reported(reported.into(), tcx.def_span(unevaluated.def)))
}
Err(err) => Err(err),
}
} else {
Ok(c)
}
};

match (evaluate(c1), evaluate(c2)) {
(Ok(c1), Ok(c2)) => {
match selcx.infcx.at(&obligation.cause, obligation.param_env).eq(DefineOpaqueTypes::No,c1, c2)
{
Ok(_) => (),
Err(_) => return false,
}
}
_ => return false,
}
}
// FIXME(generic_const_exprs): This code path doesn't affect any tests if it checks for equal
// constants and avoids the early return that way.
ty::PredicateKind::ConstEquate(..) => return false,

// There's not really much we can do with these predicates -
// we start out with a `ParamEnv` with no inference variables,
Expand Down

0 comments on commit c510140

Please sign in to comment.