Skip to content

Commit

Permalink
Add @pnkfelix's suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
tbu- authored and aturon committed Oct 9, 2015
1 parent f57cb49 commit fcfe2d6
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions text/0000-main-reexport.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Example:
println!("Hello world!");
}
}
pub use foo::bar as main;
use foo::bar as main;

Example 2:

Expand All @@ -32,11 +32,17 @@ Example 2:
See also https://github.com/rust-lang/rust/issues/27640 for the corresponding
issue discussion.

The `#[main]` attribute can also be used to change the entry point of the
generated binary. This is largely irrelevant for this RFC as this RFC tries to
fix an inconsistency with re-exports and directly defined functions.
Nevertheless, it can be pointed out that the `#[main]` attribute does not cover
all the above-mentioned use cases.

# Detailed design

Use the symbol `main` at the top-level of a crate that is compiled as a program
(`--crate-type=bin`) – instead of explicitly only accepting directly-defined
functions, also allow re-exports.
functions, also allow (possibly non-`pub`) re-exports.

# Drawbacks

Expand Down

0 comments on commit fcfe2d6

Please sign in to comment.