Skip to content
This repository was archived by the owner on Sep 12, 2024. It is now read-only.
This repository was archived by the owner on Sep 12, 2024. It is now read-only.

Specialize Termination for Result<!, Box<dyn Error>> to report errors via the error trait #40

Open
@yaahc

Description

@yaahc

Currently all errors reported via the Termination impl on core::result::Result go through Debug instead of Error, which tends to be the wrong choice for errors. We have plans for fixing this via specialization but these plans are blocked on workarounds for a soundness issue and wouldn't even apply to Box<dyn Error> because it doesn't even implement the Error trait. We cannot fix this as far as we can tell, but it turns out we probably don't need to for this specific case! Specialization already works for concrete types, so we could specialize the Termination impl specifically for Box<dyn Error> today, there's nothing blocking this. That way we can confidently point people towards fn main() -> Result<(), Box<dyn Error>> knowing that it will output the right thing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions