Skip to content

Conversation

ILyoan
Copy link
Contributor

@ILyoan ILyoan commented Jan 14, 2013

fixed #4207

giving a function the attribute #[main] makes the function main.

  • if there is no function with #[main], the function named 'main' will be the main.
  • when --test is given, all function with #[main] will be stripped out and the main function for testing will be the only function having #[main] attribute.

@brson
Copy link
Contributor

brson commented Jan 14, 2013

This looks excellent. Thanks! Merged to incoming.

@brson
Copy link
Contributor

brson commented Jan 14, 2013

I filed a minor followup issue: #4488. It looks to me like this code preserves the behavior of deleting existing functions marked #[main] when building with --test. That isn't strictly necessary now since we can just remove the #[main] attribute.

@brson
Copy link
Contributor

brson commented Jan 14, 2013

Also, thanks for providing comprehensive test cases. That makes patches very easy to accept.

@brson brson closed this Jan 14, 2013
bors pushed a commit to rust-lang-ci/rust that referenced this pull request May 15, 2021
* Fixed comment dropped between & and type issue

* Reduced nesting levels and avoided duplications

* Removed extra allocations
RalfJung added a commit to RalfJung/rust that referenced this pull request Jul 20, 2025
Muscraft pushed a commit to Muscraft/rust that referenced this pull request Jul 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants