Skip to content

#[deriving(Clone)] doesn't work for structs with borrowed pointers #18405

Closed
@stepancheg

Description

@stepancheg

Code:

#[deriving(Clone)]
struct Foo<'a> {
    s: &'a String,
}

Compiler produces the message:

tmp.rs:3:5: 3:18 error: mismatched types: expected `&collections::string::String`, found `collections::string::String` (expected &-ptr, found struct collections::string::String)
tmp.rs:3     s: &'a String,
             ^~~~~~~~~~~~~
note: in expansion of #[deriving]
tmp.rs:1:1: 1:19 note: expansion site
error: aborting due to previous error

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