about summary refs log tree commit diff
diff options
context:
space:
mode:
authorNiko Matsakis <niko@alum.mit.edu>2018-10-11 14:05:10 -0400
committerNiko Matsakis <niko@alum.mit.edu>2018-10-11 14:05:10 -0400
commit68da108d56577657135af0186826ddef93104d22 (patch)
tree4b827bd429198ce065c31a842fbc3f46cb030a68
parenta534216fa6d518088ae4468f1cdc519cd79e6247 (diff)
downloadrust-68da108d56577657135af0186826ddef93104d22.tar.gz
rust-68da108d56577657135af0186826ddef93104d22.zip
make it an error to use `'_` in outlives bounds
-rw-r--r--src/librustc/hir/lowering.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/librustc/hir/lowering.rs b/src/librustc/hir/lowering.rs
index 73093580910..16e8b8709a8 100644
--- a/src/librustc/hir/lowering.rs
+++ b/src/librustc/hir/lowering.rs
@@ -2299,7 +2299,11 @@ impl<'a> LoweringContext<'a> {
                 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)),
+                )
             }
         }
     }