Skip to content

Consider producing more friendly output with runtime drop flag checking #35101

Closed
@eefriedman

Description

@eefriedman
struct C;
impl Drop for C {
    fn drop(&mut self) {}
}
fn main() {
    {
        let mut c = C;
        unsafe { *(&mut c as *mut C as *mut u8) = 1; }
    }
    println!("Hello World");
}

This produces absolutely zero output in the playground because it generates a SIGTRAP and kills the program. Of course, it's hard to do much at this point because the program is in an unknown, probably-corrupt state, but we could at least print a message to stderr noting what happened.

Originally reported at https://internals.rust-lang.org/t/im-moving-away-heres-my-two-cents/3767 .

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