Skip to content

failure with non-UTF8 formatting leads to hard-to-debug error #16877

@huonw

Description

@huonw
struct Foo;
impl std::fmt::Show for Foo {
    fn fmt(&self, fmtr:&mut std::fmt::Formatter) -> std::fmt::Result { 
        fmtr.write(&[0xFF])
    }
}
fn main() {
    fail!("{}", Foo)
}
task '<main>' failed at 'called `Result::unwrap()` on an `Err` value: [255]', /build/rust-git/src/rust/src/libcore/result.rs:548
playpen: application terminated with error code 101

At the very least it could mention the failure was caused by bad formatting while trying to unwind, or could use from_utf8_lossy.

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