Skip to content

Commit 9af5a06

Browse files
committed
extend comment further to explain why we limit wf to upvar_tys
1 parent 2151e48 commit 9af5a06

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/librustc/ty/wf.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,15 @@ impl<'a, 'gcx, 'tcx> WfPredicates<'a, 'gcx, 'tcx> {
367367
// probably always be WF, because it should be
368368
// shorthand for something like `where(T: 'a) {
369369
// fn(&'a T) }`, as discussed in #25860.
370+
//
371+
// Note that we are also skipping the generic
372+
// types. This is consistent with the `outlives`
373+
// code, but anyway doesn't matter: within the fn
374+
// body where they are created, the generics will
375+
// always be WF, and outside of that fn body we
376+
// are not directly inspecting closure types
377+
// anyway, except via auto trait matching (which
378+
// only inspects the upvar types).
370379
subtys.skip_current_subtree(); // subtree handled by compute_projection
371380
for upvar_ty in substs.upvar_tys(def_id, self.infcx.tcx) {
372381
self.compute(upvar_ty);

0 commit comments

Comments
 (0)