Skip to content

~Foo should auto-borrow to &Foo when casting to a trait object #10347

Closed
@sfackler

Description

@sfackler

It'd be nice if this would work:

trait Foo {}
impl<'self> Foo for &'self str {}
let a = ~"";
let b = &a as &Foo;

You currently have to manually borrow

trait Foo {}
impl<'self> Foo for &'self str {}
let a = ~"";
let b: &str = a;
let b = &b as &Foo;

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