Remove dead codes

This commit is contained in:
r01and 2023-12-27 07:33:43 +00:00 committed by GitHub
parent eee93d8396
commit 33867834bc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 17 deletions

View File

@ -335,7 +335,7 @@ fn unify_const_variable(
// constants and generic expressions are not yet handled correctly. // constants and generic expressions are not yet handled correctly.
let Generalization { value_may_be_infer: value, needs_wf: _ } = generalize::generalize( let Generalization { value_may_be_infer: value, needs_wf: _ } = generalize::generalize(
self, self,
&mut CombineDelegate { infcx: self, span, param_env }, &mut CombineDelegate { infcx: self, span },
ct, ct,
target_vid, target_vid,
ty::Variance::Invariant, ty::Variance::Invariant,
@ -454,11 +454,7 @@ pub fn instantiate(
// adding constraints like `'x: '?2` and `?1 <: ?3`.) // adding constraints like `'x: '?2` and `?1 <: ?3`.)
let Generalization { value_may_be_infer: b_ty, needs_wf } = generalize::generalize( let Generalization { value_may_be_infer: b_ty, needs_wf } = generalize::generalize(
self.infcx, self.infcx,
&mut CombineDelegate { &mut CombineDelegate { infcx: self.infcx, span: self.trace.span() },
infcx: self.infcx,
param_env: self.param_env,
span: self.trace.span(),
},
a_ty, a_ty,
b_vid, b_vid,
ambient_variance, ambient_variance,

View File

@ -55,8 +55,6 @@ pub fn generalize<'tcx, D: GeneralizerDelegate<'tcx>, T: Into<Term<'tcx>> + Rela
/// Abstracts the handling of region vars between HIR and MIR/NLL typechecking /// Abstracts the handling of region vars between HIR and MIR/NLL typechecking
/// in the generalizer code. /// in the generalizer code.
pub trait GeneralizerDelegate<'tcx> { pub trait GeneralizerDelegate<'tcx> {
fn param_env(&self) -> ty::ParamEnv<'tcx>;
fn forbid_inference_vars() -> bool; fn forbid_inference_vars() -> bool;
fn span(&self) -> Span; fn span(&self) -> Span;
@ -66,15 +64,10 @@ pub trait GeneralizerDelegate<'tcx> {
pub struct CombineDelegate<'cx, 'tcx> { pub struct CombineDelegate<'cx, 'tcx> {
pub infcx: &'cx InferCtxt<'tcx>, pub infcx: &'cx InferCtxt<'tcx>,
pub param_env: ty::ParamEnv<'tcx>,
pub span: Span, pub span: Span,
} }
impl<'tcx> GeneralizerDelegate<'tcx> for CombineDelegate<'_, 'tcx> { impl<'tcx> GeneralizerDelegate<'tcx> for CombineDelegate<'_, 'tcx> {
fn param_env(&self) -> ty::ParamEnv<'tcx> {
self.param_env
}
fn forbid_inference_vars() -> bool { fn forbid_inference_vars() -> bool {
false false
} }
@ -95,10 +88,6 @@ impl<'tcx, T> GeneralizerDelegate<'tcx> for T
where where
T: TypeRelatingDelegate<'tcx>, T: TypeRelatingDelegate<'tcx>,
{ {
fn param_env(&self) -> ty::ParamEnv<'tcx> {
<Self as TypeRelatingDelegate<'tcx>>::param_env(self)
}
fn forbid_inference_vars() -> bool { fn forbid_inference_vars() -> bool {
<Self as TypeRelatingDelegate<'tcx>>::forbid_inference_vars() <Self as TypeRelatingDelegate<'tcx>>::forbid_inference_vars()
} }