From bf73d519597dcc8bcf2ac05b106afbd89deb846d Mon Sep 17 00:00:00 2001 From: Philipp Hansch Date: Sat, 25 Apr 2020 10:43:41 +0200 Subject: [PATCH] Add lifetime test case for `new_ret_no_self` --- tests/ui/new_ret_no_self.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/ui/new_ret_no_self.rs b/tests/ui/new_ret_no_self.rs index 35aaecc9ac4..2c2d1e27589 100644 --- a/tests/ui/new_ret_no_self.rs +++ b/tests/ui/new_ret_no_self.rs @@ -199,3 +199,14 @@ impl NestedReturnerOk3 { unimplemented!(); } } + +struct WithLifetime<'a> { + cat: &'a str, +} + +impl<'a> WithLifetime<'a> { + // should not trigger the lint, because the lifetimes are different + pub fn new<'b: 'a>(s: &'b str) -> WithLifetime<'b> { + unimplemented!(); + } +}