Skip to content

When #![no_main] is set, #[start] is silently ignored #124581

Open
@RalfJung

Description

@RalfJung

This came up in rust-lang/miri#3498: a user wrote code roughly like this

#![no_main]
#![feature(start)]

#[start]
fn main() {}

and then was surprised that the resulting program didn't have a start function.

The start attribute seems to be entirely ignored, because usually there would be an error that the signature is wrong.

The combination of no_main and the start attribute should probably emit a suitable diagnostic, instead of silently ignoring the attribute.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-enhancementCategory: An issue proposing an enhancement or a PR with one.P-lowLow priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions