Skip to content

Commit 89c91f6

Browse files
committed
Add some examples and refer to the issue that led to the RFC
1 parent d41ee16 commit 89c91f6

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

text/0000-main-reexport.md

+17
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,23 @@ not for the program entry point `main`. This RFC aims to fix this inconsistency.
1515
The above mentioned inconsistency means that e.g. you currently cannot use a
1616
library's exported function as your main function.
1717

18+
Example:
19+
20+
pub mod foo {
21+
pub fn bar() {
22+
print("Hello world!");
23+
}
24+
}
25+
pub use foo::bar as main;
26+
27+
Example 2:
28+
29+
extern crate main_functions;
30+
pub use main_functions::rmdir as main;
31+
32+
See also https://github.com/rust-lang/rust/issues/27640 for the corresponding
33+
issue discussion.
34+
1835
# Detailed design
1936

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

0 commit comments

Comments
 (0)