From c5101404b2b58be034854e5d42ff53c417700d4a Mon Sep 17 00:00:00 2001 From: Oli Scherer Date: Fri, 19 Apr 2024 16:40:09 +0000 Subject: [PATCH] Remove some type relating logic that has no tests --- .../src/traits/auto_trait.rs | 41 ++----------------- 1 file changed, 3 insertions(+), 38 deletions(-) diff --git a/compiler/rustc_trait_selection/src/traits/auto_trait.rs b/compiler/rustc_trait_selection/src/traits/auto_trait.rs index 73e94da165fb0..bcedd81b25c1f 100644 --- a/compiler/rustc_trait_selection/src/traits/auto_trait.rs +++ b/compiler/rustc_trait_selection/src/traits/auto_trait.rs @@ -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; @@ -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,