Skip to content

Commit

Permalink
extend comment further to explain why we limit wf to upvar_tys
Browse files Browse the repository at this point in the history
  • Loading branch information
nikomatsakis committed Nov 20, 2017
1 parent 2151e48 commit 9af5a06
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/librustc/ty/wf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 9af5a06

Please sign in to comment.