diff --git a/text/0000-main-reexport.md b/text/0000-main-reexport.md index 64cba1c7ead..cfb4f657d80 100644 --- a/text/0000-main-reexport.md +++ b/text/0000-main-reexport.md @@ -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