]> git.lizzy.rs Git - rust.git/commitdiff
make it an error to use `'_` in outlives bounds
authorNiko Matsakis <niko@alum.mit.edu>
Thu, 11 Oct 2018 18:05:10 +0000 (14:05 -0400)
committerNiko Matsakis <niko@alum.mit.edu>
Thu, 11 Oct 2018 18:05:10 +0000 (14:05 -0400)
src/librustc/hir/lowering.rs

index 7309358091056e32bc512e7536d5b0d05b6681fe..16e8b8709a81c19a7bdeb9b250465490fd6583f3 100644 (file)
@@ -2299,7 +2299,11 @@ fn lower_param_bound(
                 self.lower_trait_bound_modifier(modifier),
             ),
             GenericBound::Outlives(ref lifetime) => {
-                hir::GenericBound::Outlives(self.lower_lifetime(lifetime))
+                // We don't want to accept `'a: '_`:
+                self.with_anonymous_lifetime_mode(
+                    AnonymousLifetimeMode::PassThrough,
+                    |this| hir::GenericBound::Outlives(this.lower_lifetime(lifetime)),
+                )
             }
         }
     }