-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
edition idioms lints: unused_extern_crate
false positives
#53964
Comments
…crates` fixes the *first* false positive reported in rust-lang#53964
crates that provide a `panic_handler` are exempt from the `unused_extern_crates` lint fixes the *first* false positive reported in rust-lang#53964
crates that provide a `panic_handler` are exempt from the `unused_extern_crates` lint fixes the *first* false positive reported in rust-lang#53964
I forgot to comment but that PR only fixed this for the 2015 edition. If you use |
I think it's probably the same warning but in two modes, probably saying it's unidiomatic in the 2018 edition. That being said it's probably a simple-ish bug fix as well! |
STR
Removing the
extern crate
as per the suggestion breaks compilation:$ cat src/main.rs
Removing the
extern crate
as suggested breaks linking.The error above is a custom assertion that checks that the binary has the right memory layout. Removing
extern crate rt
produces an invalid (empty) binary.Metadata
(2) seems unfixable, or at least very hard to properly fix, to me since it requires knowing the dependencies between symbols and symbol information is only complete / exact after optimization, plus linker scripts can make some symbols required. A good enough fix could be to not warn about crates that expose public, reachable
#[no_mangle]
/#[export_name]
symbols. In any case, I expect that in practice not many people will encounter this warning.(1) should be fixable and should be fixed. The compiler should be able to determine if a crate contains lang items. This scenario I expect to be much more common since some of us, embedded devs, like to pack
panic_handler
s in crates as that makes it easy to switch between them.The text was updated successfully, but these errors were encountered: