Skip to content

Commit

Permalink
Add some examples and refer to the issue that led to the RFC
Browse files Browse the repository at this point in the history
  • Loading branch information
tbu- committed Aug 21, 2015
1 parent d41ee16 commit 9148a3b
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions text/0000-main-reexport.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,25 @@ not for the program entry point `main`. This RFC aims to fix this inconsistency.
The above mentioned inconsistency means that e.g. you currently cannot use a
library's exported function as your main function.

## Example

pub mod foo {
pub fn bar() {
print("Hello world!");
}
}
pub use foo::bar as main;

## Example 2

extern crate main_functions;
pub use main_functions::rmdir as main;

## See also

See also https://github.com/rust-lang/rust/issues/27640 for the corresponding
issue discussion.

# Detailed design

Use the symbol `main` at the top-level of a crate that is compiled as a program
Expand Down

0 comments on commit 9148a3b

Please sign in to comment.