fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #72883 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum49cae55760d

1.44.0
1016 B39 linesraw
1// run-rustfix
2// edition:2018
3// build-pass (FIXME(62277): could be check-pass?)
4// aux-build:remove-extern-crate.rs
5// compile-flags:--extern remove_extern_crate
6
7#![warn(rust_2018_idioms)]
8
9 //~ WARNING unused extern crate
10// Shouldn't suggest changing to `use`, as `another_name`
11// would no longer be added to the prelude which could cause
12// compilation errors for imports that use `another_name` in other
13// modules. See #57672.
14extern crate core as another_name;
15use remove_extern_crate;
16#[macro_use]
17extern crate remove_extern_crate as something_else;
18
19// Shouldn't suggest changing to `use`, as the `alloc`
20// crate is not in the extern prelude - see #54381.
21extern crate alloc;
22
23fn main() {
24    another_name::mem::drop(3);
25    another::foo();
26    remove_extern_crate::foo!();
27    bar!();
28    alloc::vec![5];
29}
30
31mod another {
32    use core; //~ WARNING `extern crate` is not idiomatic
33    use remove_extern_crate;
34
35    pub fn foo() {
36        core::mem::drop(4);
37        remove_extern_crate::foo!();
38    }
39}