From 68da108d56577657135af0186826ddef93104d22 Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Thu, 11 Oct 2018 14:05:10 -0400 Subject: [PATCH] make it an error to use `'_` in outlives bounds --- src/librustc/hir/lowering.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/librustc/hir/lowering.rs b/src/librustc/hir/lowering.rs index 730935809105..16e8b8709a81 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)), + ) } } }