From fe7216d4214c4c3c4580a74eef5534e37a944495 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Sat, 18 Apr 2020 16:07:29 -0700 Subject: [PATCH] review comment --- src/librustc_resolve/late/lifetimes.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/librustc_resolve/late/lifetimes.rs b/src/librustc_resolve/late/lifetimes.rs index fef7b49e9fb64..1dd6199a2ce25 100644 --- a/src/librustc_resolve/late/lifetimes.rs +++ b/src/librustc_resolve/late/lifetimes.rs @@ -2387,6 +2387,7 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> { let mut err = self.report_missing_lifetime_specifiers(span, lifetime_refs.len()); if let Some(params) = error { + // If there's no lifetime available, suggest `'static`. if self.report_elision_failure(&mut err, params) && lifetime_names.is_empty() { lifetime_names.insert(ast::Ident::from_str("'static")); } @@ -2405,7 +2406,7 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> { &mut self, db: &mut DiagnosticBuilder<'_>, params: &[ElisionFailureInfo], - ) -> bool { + ) -> bool /* add `'static` lifetime to lifetime list */ { let mut m = String::new(); let len = params.len();