Skip to content
This repository was archived by the owner on May 23, 2024. It is now read-only.

ices/98170.rs: fixed with errors #1318

Merged
merged 1 commit into from
Jun 25, 2022
Merged

ices/98170.rs: fixed with errors #1318

merged 1 commit into from
Jun 25, 2022

Conversation

github-actions[bot]
Copy link
Contributor

Issue: rust-lang/rust#98170

pub struct MyStruct<'a> {
    field: &'a [u32],
}

impl MyStruct<'_> {
    pub fn new<'a>(field: &'a[u32]) -> MyStruct<'a> {
    Self{field}
    }
}

fn main() {}
=== stdout ===
=== stderr ===
error: lifetime may not live long enough
 --> /home/runner/work/glacier/glacier/ices/98170.rs:7:5
  |
5 | impl MyStruct<'_> {
  |               -- lifetime `'1` appears in the `impl`'s self type
6 |     pub fn new<'a>(field: &'a[u32]) -> MyStruct<'a> {
  |                -- lifetime `'a` defined here
7 |     Self{field}
  |     ^^^^^^^^^^^ associated function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'1`

error: lifetime may not live long enough
 --> /home/runner/work/glacier/glacier/ices/98170.rs:7:10
  |
5 | impl MyStruct<'_> {
  |               -- lifetime `'1` appears in the `impl`'s self type
6 |     pub fn new<'a>(field: &'a[u32]) -> MyStruct<'a> {
  |                -- lifetime `'a` defined here
7 |     Self{field}
  |          ^^^^^ this usage requires that `'a` must outlive `'1`

error: aborting due to 2 previous errors

==============

=== stdout ===
=== stderr ===
error: lifetime may not live long enough
 --> /home/runner/work/glacier/glacier/ices/98170.rs:7:5
  |
5 | impl MyStruct<'_> {
  |               -- lifetime `'1` appears in the `impl`'s self type
6 |     pub fn new<'a>(field: &'a[u32]) -> MyStruct<'a> {
  |                -- lifetime `'a` defined here
7 |     Self{field}
  |     ^^^^^^^^^^^ associated function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'1`

error: lifetime may not live long enough
 --> /home/runner/work/glacier/glacier/ices/98170.rs:7:10
  |
5 | impl MyStruct<'_> {
  |               -- lifetime `'1` appears in the `impl`'s self type
6 |     pub fn new<'a>(field: &'a[u32]) -> MyStruct<'a> {
  |                -- lifetime `'a` defined here
7 |     Self{field}
  |          ^^^^^ this usage requires that `'a` must outlive `'1`

error: aborting due to 2 previous errors

==============
@JohnTitor JohnTitor merged commit 8473366 into master Jun 25, 2022
@JohnTitor JohnTitor deleted the autofix/ices/98170.rs branch June 25, 2022 09:54
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants