parent
98546f8b26
commit
9ffe9bea53
5 changed files with 11 additions and 22 deletions
|
@ -855,16 +855,19 @@ fn vtable_methods<'a, 'tcx>(
|
||||||
|
|
||||||
// the method may have some early-bound lifetimes, add
|
// the method may have some early-bound lifetimes, add
|
||||||
// regions for those
|
// regions for those
|
||||||
let substs = Substs::for_item(tcx, def_id,
|
let substs = trait_ref.map_bound(|trait_ref| {
|
||||||
|_, _| tcx.types.re_erased,
|
Substs::for_item(
|
||||||
|def, _| trait_ref.substs().type_for_def(def));
|
tcx, def_id,
|
||||||
|
|_, _| tcx.types.re_erased,
|
||||||
|
|def, _| trait_ref.substs.type_for_def(def))
|
||||||
|
});
|
||||||
|
|
||||||
// the trait type may have higher-ranked lifetimes in it;
|
// the trait type may have higher-ranked lifetimes in it;
|
||||||
// so erase them if they appear, so that we get the type
|
// so erase them if they appear, so that we get the type
|
||||||
// at some particular call site
|
// at some particular call site
|
||||||
let substs = tcx.normalize_erasing_late_bound_regions(
|
let substs = tcx.normalize_erasing_late_bound_regions(
|
||||||
ty::ParamEnv::reveal_all(),
|
ty::ParamEnv::reveal_all(),
|
||||||
&ty::Binder::bind(substs),
|
&substs
|
||||||
);
|
);
|
||||||
|
|
||||||
// It's possible that the method relies on where clauses that
|
// It's possible that the method relies on where clauses that
|
||||||
|
|
|
@ -786,7 +786,8 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
|
||||||
// This suffices to allow chains like `FnMut` implemented in
|
// This suffices to allow chains like `FnMut` implemented in
|
||||||
// terms of `Fn` etc, but we could probably make this more
|
// terms of `Fn` etc, but we could probably make this more
|
||||||
// precise still.
|
// precise still.
|
||||||
let unbound_input_types = stack.fresh_trait_ref.input_types().any(|ty| ty.is_fresh());
|
let unbound_input_types =
|
||||||
|
stack.fresh_trait_ref.skip_binder().input_types().any(|ty| ty.is_fresh());
|
||||||
// this check was an imperfect workaround for a bug n the old
|
// this check was an imperfect workaround for a bug n the old
|
||||||
// intercrate mode, it should be removed when that goes away.
|
// intercrate mode, it should be removed when that goes away.
|
||||||
if unbound_input_types &&
|
if unbound_input_types &&
|
||||||
|
|
|
@ -574,16 +574,6 @@ impl<'tcx> PolyTraitRef<'tcx> {
|
||||||
self.skip_binder().def_id
|
self.skip_binder().def_id
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn substs(&self) -> &'tcx Substs<'tcx> {
|
|
||||||
// FIXME(#20664) every use of this fn is probably a bug, it should yield Binder<>
|
|
||||||
self.skip_binder().substs
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn input_types<'a>(&'a self) -> impl DoubleEndedIterator<Item=Ty<'tcx>> + 'a {
|
|
||||||
// FIXME(#20664) every use of this fn is probably a bug, it should yield Binder<>
|
|
||||||
self.skip_binder().input_types()
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn to_poly_trait_predicate(&self) -> ty::PolyTraitPredicate<'tcx> {
|
pub fn to_poly_trait_predicate(&self) -> ty::PolyTraitPredicate<'tcx> {
|
||||||
// Note that we preserve binding levels
|
// Note that we preserve binding levels
|
||||||
Binder(ty::TraitPredicate { trait_ref: self.skip_binder().clone() })
|
Binder(ty::TraitPredicate { trait_ref: self.skip_binder().clone() })
|
||||||
|
@ -635,11 +625,6 @@ impl<'tcx> PolyExistentialTraitRef<'tcx> {
|
||||||
pub fn def_id(&self) -> DefId {
|
pub fn def_id(&self) -> DefId {
|
||||||
self.skip_binder().def_id
|
self.skip_binder().def_id
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn input_types<'a>(&'a self) -> impl DoubleEndedIterator<Item=Ty<'tcx>> + 'a {
|
|
||||||
// FIXME(#20664) every use of this fn is probably a bug, it should yield Binder<>
|
|
||||||
self.skip_binder().input_types()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Binder is a binder for higher-ranked lifetimes. It is part of the
|
/// Binder is a binder for higher-ranked lifetimes. It is part of the
|
||||||
|
|
|
@ -303,7 +303,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
|
|
||||||
let arg_param_ty = trait_ref.substs().type_at(1);
|
let arg_param_ty = trait_ref.skip_binder().substs.type_at(1);
|
||||||
let arg_param_ty = self.resolve_type_vars_if_possible(&arg_param_ty);
|
let arg_param_ty = self.resolve_type_vars_if_possible(&arg_param_ty);
|
||||||
debug!(
|
debug!(
|
||||||
"deduce_sig_from_projection: arg_param_ty {:?}",
|
"deduce_sig_from_projection: arg_param_ty {:?}",
|
||||||
|
|
|
@ -1485,7 +1485,7 @@ impl<'tcx> Candidate<'tcx> {
|
||||||
// inference variables or other artifacts. This
|
// inference variables or other artifacts. This
|
||||||
// means they are safe to put into the
|
// means they are safe to put into the
|
||||||
// `WhereClausePick`.
|
// `WhereClausePick`.
|
||||||
assert!(!trait_ref.substs().needs_infer());
|
assert!(!trait_ref.skip_binder().substs.needs_infer());
|
||||||
|
|
||||||
WhereClausePick(trait_ref.clone())
|
WhereClausePick(trait_ref.clone())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue