Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better diagnostics when user forgets to wrap code in main function #71901

Open
frewsxcv opened this issue May 4, 2020 · 2 comments
Open

Better diagnostics when user forgets to wrap code in main function #71901

frewsxcv opened this issue May 4, 2020 · 2 comments
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-parser Area: The parsing of Rust source code to an AST C-enhancement Category: An issue proposing an enhancement or a PR with one. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@frewsxcv
Copy link
Member

frewsxcv commented May 4, 2020

// some_third_party_crate/lib.rs

mod some_third_party_crate {
    pub fn show() {}
}

//////////////////////////////////////////
//////////////////////////////////////////
//////////////////////////////////////////

// main.rs

some_third_party_crate::show();

https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=8fca04bfa35f22c6776578d6c9fd8fbc

Screen Shot 2020-05-04 at 5 46 43 PM

We should suggest the user wrap their code in fn main() { ... }

@frewsxcv frewsxcv added C-bug Category: This is a bug. A-diagnostics Area: Messages for errors, warnings, and lints and removed C-bug Category: This is a bug. labels May 4, 2020
@jonas-schievink jonas-schievink added A-parser Area: The parsing of Rust source code to an AST C-enhancement Category: An issue proposing an enhancement or a PR with one. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels May 4, 2020
@petrochenkov
Copy link
Contributor

cc #69445

@frewsxcv
Copy link
Member Author

Triage: no change here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-parser Area: The parsing of Rust source code to an AST C-enhancement Category: An issue proposing an enhancement or a PR with one. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

3 participants