Skip to content

Deriving fails with 'self lifetimes #6149

Closed
@huonw

Description

@huonw
#[deriving(Eq)]
struct A<'self> {
    a: &'self int
}

fn main() {}
deriving-lifetime.rs:2:11: 2:14 error: Illegal anonymous lifetime: anonymous lifetimes are not permitted here
deriving-lifetime.rs:2 #[deriving(Eq)]
                                  ^~~
deriving-lifetime.rs:2:11: 2:14 error: mismatched types: expected `&int` but found `&&int` (expected int but found &-ptr)
deriving-lifetime.rs:2 #[deriving(Eq)]
                                  ^~~
deriving-lifetime.rs:2:11: 2:14 error: mismatched types: expected `&int` but found `&&int` (expected int but found &-ptr)
deriving-lifetime.rs:2 #[deriving(Eq)]
                                  ^~~
error: aborting due to 3 previous errors

(I'm almost certain is a problem in the work I started in #5640 (although it's also present in the IterBytes and Encodable deriving code), since there are no lifetime considerations in any of that code at all; I'm currently working on finishing that work which will fix this.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions