summaryrefslogtreecommitdiffstats
path: root/src/test/ui/nll/issue-98170.rs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/test/ui/nll/issue-98170.rs25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/test/ui/nll/issue-98170.rs b/src/test/ui/nll/issue-98170.rs
new file mode 100644
index 000000000..6bb12f52d
--- /dev/null
+++ b/src/test/ui/nll/issue-98170.rs
@@ -0,0 +1,25 @@
+pub struct MyStruct<'a> {
+ field: &'a [u32],
+}
+
+impl MyStruct<'_> {
+ pub fn new<'a>(field: &'a [u32]) -> MyStruct<'a> {
+ Self { field }
+ //~^ ERROR lifetime may not live long enough
+ //~| ERROR lifetime may not live long enough
+ }
+}
+
+trait Trait<'a> {
+ fn new(field: &'a [u32]) -> MyStruct<'a>;
+}
+
+impl<'a> Trait<'a> for MyStruct<'_> {
+ fn new(field: &'a [u32]) -> MyStruct<'a> {
+ Self { field }
+ //~^ ERROR lifetime may not live long enough
+ //~| ERROR lifetime may not live long enough
+ }
+}
+
+fn main() {}