Skip to content

panic (?) with #[windows_subsystem = "windows"] on Rust nightly #214

Closed
@parasyte

Description

@parasyte

I spent an hour trying to reduce a minimal test case for this error I started experiencing with my app. I don't know if this is the right repo to track this, but so far I have produced the following:

[package]
name = "windows_explodey"
version = "0.1.0"
edition = "2018"
resolver = "2"

[dependencies]
env_logger = "0.9"

[profile.release]
panic = "abort"
#![windows_subsystem = "windows"]

fn main() {
    env_logger::init();

    println!("Hello, world!");
}

When running this on any nightly compiler since nightly-2021-08-21, I get an error like this:

$ cargo +nightly-2021-08-21 run
    Finished dev [unoptimized + debuginfo] target(s) in 0.03s
     Running `target\debug\windows_explodey.exe`
error: process didn't exit successfully: `target\debug\windows_explodey.exe` (exit code: 101)

Adjusting the profile to panic = "abort" causes an even more ominous error:

$ cargo +nightly-2021-08-21 run --release
    Finished release [optimized] target(s) in 0.03s
     Running `target\release\windows_explodey.exe`
error: process didn't exit successfully: `target\release\windows_explodey.exe` (exit code: 0xc0000409, STATUS_STACK_BUFFER_OVERRUN)

I recognize it's probably silly to use #[windows_subsystem = "windows"] with env_logger. My workaround for now is conditionally calling env_logger::init() only on macOS and Linux.

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