Skip to content

#[deriving(ToStr)] handles generics in a surprising manner. #7180

Closed
@huonw

Description

@huonw
#[deriving(ToStr)]
struct Foo<A>(A);

struct Bar;
impl ToStr for Bar {
    fn to_str(&self) -> ~str {
        ~"some string"
    }
}

fn main() {
    println(Bar.to_str());
    println(Foo(Bar).to_str());
}

prints:

some string
{__field__: {}}

Ignoring the strange struct printing, it should probably print:

some string
{__field__: some string}

i.e. use the ToStr impl of any generics.

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