about summary refs log tree commit diff
diff options
context:
space:
mode:
authorNiko Matsakis <niko@alum.mit.edu>2017-11-20 13:49:18 -0500
committerNiko Matsakis <niko@alum.mit.edu>2017-11-20 13:49:18 -0500
commit9af5a068a5b7fc682c962b83a1783df6ae65f3e8 (patch)
tree878ae94baeafc355bcc1384072fac35056df5aca
parent2151e482acee9a8715a4bde3cfd477c4ecc20b0b (diff)
downloadrust-9af5a068a5b7fc682c962b83a1783df6ae65f3e8.tar.gz
rust-9af5a068a5b7fc682c962b83a1783df6ae65f3e8.zip
extend comment further to explain why we limit wf to `upvar_tys`
-rw-r--r--src/librustc/ty/wf.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/librustc/ty/wf.rs b/src/librustc/ty/wf.rs
index 2dd694501ed..a851ccc34bf 100644
--- a/src/librustc/ty/wf.rs
+++ b/src/librustc/ty/wf.rs
@@ -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);