Skip to content

Align scoping on errors for easier comprehension #18946

@mdinger

Description

@mdinger

Deeply scoped errors are difficult to compare. Align them so they're easier to compare.
This errors:

fn test() -> Option<int> {
    Ok(7) // Should be Some(7)
}
fn main(){ 
    test();
}

The error:

<anon>:2:5: 2:10 error: mismatched types: expected `core::option::Option<int>`, found `core::result::Result<_, _>` (expected enum core::option::Option, found enum core::result::Result)
<anon>:2     Ok(7)
             ^~~~~
error: aborting due to previous error
playpen: application terminated with error code 101

Change the error to this or something similar:

<anon>:2:5: 2:10 error: mismatched types: expected `core::option::Option<int>`,
                                             found `core::result::Result<_, _>`
                                     (expected enum core::option::Option,
                                         found enum core::result::Result)
<anon>:2     Ok(7)
             ^~~~~
error: aborting due to previous error
playpen: application terminated with error code 101

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions