Skip to content

A struct defined to hold a closure accepts a proc in its constructor #11515

Closed

Description

@bstrie

This seems like it shouldn't be possible:

struct Test<'s> {
    func: 's ||
}

fn main() {
    let test = ~Test { func: proc() {} };
}

...but it compiles just fine on 0.9.

Activity

  1. brson commented on Jan 15, 2014

    @brson
    Contributor

    Presumably with horrible results? Nominating.

  2. nikomatsakis commented on Jan 16, 2014

    @nikomatsakis
    Contributor

    cc me

  3. pnkfelix commented on Jan 16, 2014

    @pnkfelix
    Contributor

    Accepting for P-backcompat-lang.

  4. nikomatsakis commented on Jan 16, 2014

    @nikomatsakis
    Contributor

    presumably a symptom of the current semi-hacky integration of proc into rustc

  5. eddyb commented on Apr 11, 2014

    @eddyb
    Contributor

    Can't reproduce anymore, should we close this?

  6. alexcrichton commented on Apr 11, 2014

    @alexcrichton
    Member

    I don't think it should be closed quite yet, the error message is pretty awful:

    foo.rs:6:30: 6:39 error: borrowed value does not live long enough
    foo.rs:6     let test = ~Test { func: proc() {} };
                                          ^~~~~~~~~
    foo.rs:5:11: 7:2 note: reference must be valid for the block at 5:10...
    foo.rs:5 fn main() {
    foo.rs:6     let test = ~Test { func: proc() {} };
    foo.rs:7 }
    foo.rs:6:9: 6:41 note: ...but borrowed value is only valid for the statement at 6:8
    foo.rs:6     let test = ~Test { func: proc() {} };
                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    error: aborting due to previous error
    

    Because this no longer compiles successfully, nominating go go from 1.0 backcompat-lang to P-low

  7. pnkfelix commented on Apr 17, 2014

    @pnkfelix
    Contributor

    Recategorizing as P-low, not on 1.0 milestone.

  8. removed this from the 1.0 milestone on Apr 17, 2014
  9. added a commit that references this issue on Apr 28, 2014
    35f295d
  10. added a commit that references this issue on Apr 28, 2014
    7a19a82
  11. added a commit that references this issue on Sep 25, 2023
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

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions