Skip to content

#![no_main] & empty main fn makes test run fail unconditionally #104050

Open
@Wyvern

Description

@Wyvern
#![no_main]

#[no_mangle]
unsafe extern "C" fn main(){ /*dbg!();*/  }

#[test]
fn test(){} 
error: test failed, to rerun pass `--lib`

Caused by:
  process didn't exit successfully:

https://play.rust-lang.org/?version=nightly&mode=release&edition=2021&gist=7cf70fdc5b46dde52751bdd3a0f89a57

If add some code to main fn, such as dbg!();; then test can run normally without problem.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-libtestArea: `#[test]` / the `test` libraryC-discussionCategory: Discussion or questions that doesn't represent real issues.P-lowLow priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions