Skip to content

Asking for a 'static bound when not needed #14901

Closed
@carllerche

Description

@carllerche

Repro:

use std::io::{Reader,MemReader};

enum Wrapper<'a> {
  WrapReader(&'a Reader)
}

trait Wrap<'a> {
  fn wrap(self) -> Wrapper<'a>;
}

impl<'a, R: Reader> Wrap<'a> for &'a mut R {
  fn wrap(self) -> Wrapper<'a> {
    WrapReader(self as &'a mut Reader)
  }
}
pub fn main() {
  println!("Zomg!");
}

Error:

repro.rs:13:16: 13:20 error: value may contain references; add `'static` bound to `R`
repro.rs:13     WrapReader(self as &'a mut Reader)
                           ^~~~
error: aborting due to previous error

Metadata

Metadata

Assignees

No one assigned

    Labels

    E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions