Skip to content

println! sometimes panics in drop methods - 2 #49143

Closed
@DustinByfuglien

Description

@DustinByfuglien

There was issue #29488

I don't know is it possible to reopen it. And create a new that continues that discussion.

There is another case when applications panic while using drop/TLS/println:

struct Foo {}

impl Drop for Foo {
    fn drop(&mut self) {
        println!("drop begin");
    }
}


thread_local! {
    static FOO: Foo = Foo{};
}


fn main() {
    println!("main begin");
    FOO.with(|_| {});
}

This code output is:

main begin
thread '<unnamed>' panicked at 'cannot access stdout during shutdown', libcore\option.rs:916:5

My point of view is it also must be fixed in Rust language.

rustc 1.26.0-nightly (adf2135 2018-03-17)

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