Skip to content

rustc should suggest using .to_owned() for ~str #14383

Closed
@limeburst

Description

@limeburst

rustc gives

error: mismatched types: expected `core::result::Result<int,~str>` but found `core::result::Result<<generic integer #0>,&'static str>` (expected box but found &-ptr)

for

fn example() -> Result<int, ~str> {
    match Some("") {
        Some("") => Ok(0),
        _ => Err("")
    }
}

rustc could suggest using to_owned().

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lints

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions