提交 9ffe9bea 编写于 作者: T Tyler Mandry

Remove methods with implicit Binder::skip_bound

Fixes #20664.
上级 98546f8b
......@@ -855,16 +855,19 @@ fn vtable_methods<'a, 'tcx>(
// the method may have some early-bound lifetimes, add
// regions for those
let substs = Substs::for_item(tcx, def_id,
|_, _| tcx.types.re_erased,
|def, _| trait_ref.substs().type_for_def(def));
let substs = trait_ref.map_bound(|trait_ref| {
Substs::for_item(
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;
// so erase them if they appear, so that we get the type
// at some particular call site
let substs = tcx.normalize_erasing_late_bound_regions(
ty::ParamEnv::reveal_all(),
&ty::Binder::bind(substs),
&substs
);
// It's possible that the method relies on where clauses that
......
......@@ -786,7 +786,8 @@ fn evaluate_stack<'o>(&mut self,
// This suffices to allow chains like `FnMut` implemented in
// terms of `Fn` etc, but we could probably make this more
// 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
// intercrate mode, it should be removed when that goes away.
if unbound_input_types &&
......
......@@ -574,16 +574,6 @@ pub fn def_id(&self) -> DefId {
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> {
// Note that we preserve binding levels
Binder(ty::TraitPredicate { trait_ref: self.skip_binder().clone() })
......@@ -635,11 +625,6 @@ impl<'tcx> PolyExistentialTraitRef<'tcx> {
pub fn def_id(&self) -> DefId {
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
......
......@@ -303,7 +303,7 @@ fn deduce_sig_from_projection(
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);
debug!(
"deduce_sig_from_projection: arg_param_ty {:?}",
......
......@@ -1485,7 +1485,7 @@ fn to_unadjusted_pick(&self) -> Pick<'tcx> {
// inference variables or other artifacts. This
// means they are safe to put into the
// `WhereClausePick`.
assert!(!trait_ref.substs().needs_infer());
assert!(!trait_ref.skip_binder().substs.needs_infer());
WhereClausePick(trait_ref.clone())
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册