-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
Warn or error on multiple-mod
code duplication
#5765
Comments
@Kimundi testcase please? |
Well the problem is basically if you have written your source files like this:
A beginner not familiar with the module system might now think that |
Triage: still occurs, having a lint would be useful. |
Triage: this is still an issue. I believe this will caught as part of the new resolve algorithm. ( #13449 ) |
manual_async_fn: take input lifetimes into account The anonymous future returned from an `async fn` captures all input lifetimes. This was not being taken into account. See https://github.com/rust-lang/rfcs/blob/master/text/2394-async_await.md#lifetime-capture-in-the-anonymous-future changelog: Take input lifetimes into account in [`manual_async_fn`]. Fixes rust-lang#5765
Sometimes people use multiple
mod
statements that refer to the same file in order to access that files content as a module in different modules/files, thinking all those instances would be identical. But in reality that just duplicates all definitions in the file at different places in the module hierarchy, which leads to confusing errors like two presumably identical types not being identical etc.I think two
mod
statements in a crate that refer to the same file should at least emit a code duplication warning, if not an error, because it's almost never what you want.The text was updated successfully, but these errors were encountered: