Skip to content

Commit 9148a3b

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

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

text/0000-main-reexport.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,25 @@ 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
33+
34+
See also https://github.com/rust-lang/rust/issues/27640 for the corresponding
35+
issue discussion.
36+
1837
# Detailed design
1938

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

0 commit comments

Comments
 (0)