Skip to content

#![no_main] breaks compiling with --test #137292

Open
@bjorn3

Description

@bjorn3

I tried this code:

See title

I expected to see this happen: #![no_main] gets ignored as libtest can't possibly work with it.
Instead, this happened: A linker error complaining that main doesn't exist.

Meta

Someone hit this at https://users.rust-lang.org/t/error-when-testing-library/125842

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-libtestArea: `#[test]` / the `test` libraryC-bugCategory: This is a bug.T-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