about summary refs log tree commit diff
diff options
context:
space:
mode:
authorNiko Matsakis <niko@alum.mit.edu>2018-10-18 14:26:45 -0400
committerNiko Matsakis <niko@alum.mit.edu>2018-10-19 09:34:28 -0400
commitf5cc7dba8a32c1f83f3b3102f398405dc540841f (patch)
tree3da860ab0f19487d7660a848034500aede8bb381
parent16b3ea1e2e690524796b37a4b4e2f88e60a9dc3e (diff)
downloadrust-f5cc7dba8a32c1f83f3b3102f398405dc540841f.tar.gz
rust-f5cc7dba8a32c1f83f3b3102f398405dc540841f.zip
even though we don't need it yet, fix the "fast path" code
-rw-r--r--src/librustc_typeck/check/mod.rs10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs
index ff92104d127..ffa21e1fc22 100644
--- a/src/librustc_typeck/check/mod.rs
+++ b/src/librustc_typeck/check/mod.rs
@@ -2361,9 +2361,13 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
         let ty = self.to_ty(ast_ty);
 
         // If the type given by the user has free regions, save it for
-        // later, since NLL would like to enforce those. Other sorts
-        // of things are already sufficiently enforced. =)
-        if ty.has_free_regions() {
+        // later, since NLL would like to enforce those. Also pass in
+        // types that involve projections, since those can resolve to
+        // `'static` bounds (modulo #54940, which hopefully will be
+        // fixed by the time you see this comment, dear reader,
+        // although I have my doubts). Other sorts of things are
+        // already sufficiently enforced with erased regions. =)
+        if ty.has_free_regions() || ty.has_projections() {
             let c_ty = self.infcx.canonicalize_response(&ty);
             self.tables.borrow_mut().user_provided_tys_mut().insert(ast_ty.hir_id, c_ty);
         }