Skip to content

Can not borrow a &Trait from a & &mut Trait #9953

Closed
@Kimundi

Description

@Kimundi

Maybe I'm missing something, but afaik the only way to do this is with automatic coercion at the moment, which does not work here:

trait Bar{}
impl Bar for uint {};

let x = &mut 7u as &mut Bar;
let y = &x; 
let z: &Bar = *y;
<anon>:9:97: 9:99 error: cannot borrow an `&mut` in a `&` pointer; try an `&mut` instead
<anon>:9         trait Bar{} impl Bar for uint {}; let x = &mut 7u as &mut Bar; let y = &x; let z: &Bar = *y;
                                                                                                          ^~

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