When `#![no_main]` is set, `#[start]` is silently ignored
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
This came up in https://github.com/rust-lang/miri/issues/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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the provided #![no_main] and #[start] example as the first test case. Trace where these attributes are handled and where the existing signature diagnostic is produced, then add coverage verifying that the combination emits a suitable diagnostic instead of silently ignoring #[start].
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100