Giter VIP home page Giter VIP logo

Comments (3)

fmease avatar fmease commented on July 26, 2024 2

Pretty sure the underlying bug is #105495 (implied bounds from impl header are not used when checking assoc items for well-formedness)

from rust.

tgross35 avatar tgross35 commented on July 26, 2024

Error

   Compiling playground v0.0.1 (/playground)
error[E0309]: the parameter type `T` may not live long enough
 --> src/lib.rs:7:21
  |
3 | impl<'a, T> Foo<'a, T> {
  |      -- the parameter type `T` must be valid for the lifetime `'a` as defined here...
...
7 |         let a = [0; Self::X];
  |                     ^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
  |
help: consider adding an explicit lifetime bound
  |
3 | impl<'a, T: 'a> Foo<'a, T> {
  |           ++++

For more information about this error, try `rustc --explain E0309`.
error: could not compile `playground` (lib) due to 1 previous error

Playground https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=200ea30e9ca44266eca4d5aba898794f

from rust.

tgross35 avatar tgross35 commented on July 26, 2024

This is confusing but I don't think it is a bug, I am sure there is an open issue for it somewhere...

Maybe we could improve the diagnostics at least to explain "so that the type T will meet its required lifetime bounds" (what required lifetime bounds?).

from rust.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.