Skip to content

"value may contain borrowed pointers" #6584

Closed

Description

@catamorphism

This error message makes me sad, since it doesn't suggest any way to fix the problem. Sorry, I don't have a self-contained example right now, but I'll try to make one later.

Activity

  1. emberian commented on Jul 12, 2013

    @emberian
    Contributor

    @catamorphism what situation is it generated, at least?

  2. huonw commented on Sep 2, 2013

    @huonw
    Contributor

    Triage: it now has a suggestion on how to fix it:

    fn foo<T> (t: T) -> @T {
        @t
    }
    
    fn main() {}
    6584.rs:2:5: 2:6 error: value may contain borrowed pointers; add `'static` bound
    6584.rs:2     @t
                   ^
    error: aborting due to previous error
    

    This appears to be the only explanation of this requirement, a quick skip of the manual (searching for 'static and @) doesn't turn up anything, so leaving this open, and tagging with docs too.

  3. alexcrichton commented on Jan 16, 2014

    @alexcrichton
    Member

    Nominating, sounds like a pretty bad error message.

  4. pnkfelix commented on Jan 22, 2014

    @pnkfelix
    Contributor

    @t is feature gated. Of course we will have it (or Gc), but its not huge for 1.0.

    Accepted for P-low.

  5. steveklabnik commented on Jun 23, 2014

    @steveklabnik
    Contributor

    I don't even think this error exists anymore:

    $ grep -ri "value may contain borrowed pointers" *
    $ 
    

    Combined with the removal of @, I think we can close this.

  6. emberian commented on Jun 23, 2014

    @emberian
    Contributor

    The error has been renamed to value may contain references

  7. emberian commented on Jun 23, 2014

    @emberian
    Contributor

    I think it still comes up with trait objects in general, especially Box<Trait>

  8. steveklabnik commented on Aug 18, 2014

    @steveklabnik
    Contributor

    Looking at the tests, there are two instances of this error. one suggests a solution, and the other seems to be specific to Gc. Still unsure what fix to suggest in that case, though.

  9. steveklabnik commented on Dec 8, 2014

    @steveklabnik
    Contributor

    triage:

    $ git grep "value may contain references"
    $
    

    Does anyone know if this is still an issue? Or have an example of how to reproduce?

  10. steveklabnik commented on Jan 12, 2015

    @steveklabnik
    Contributor

    It's been a month, and so I'm giving this a close. If someone can give me code to reproduce, we can re-open.

  11. added a commit that references this issue on Jan 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsA-lifetimesP-low

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions