extend comment further to explain why we limit wf to upvar_tys

This commit is contained in:
Niko Matsakis 2017-11-20 13:49:18 -05:00
parent 2151e482ac
commit 9af5a068a5

View File

@ -367,6 +367,15 @@ impl<'a, 'gcx, 'tcx> WfPredicates<'a, 'gcx, 'tcx> {
// probably always be WF, because it should be
// shorthand for something like `where(T: 'a) {
// fn(&'a T) }`, as discussed in #25860.
//
// Note that we are also skipping the generic
// types. This is consistent with the `outlives`
// code, but anyway doesn't matter: within the fn
// body where they are created, the generics will
// always be WF, and outside of that fn body we
// are not directly inspecting closure types
// anyway, except via auto trait matching (which
// only inspects the upvar types).
subtys.skip_current_subtree(); // subtree handled by compute_projection
for upvar_ty in substs.upvar_tys(def_id, self.infcx.tcx) {
self.compute(upvar_ty);