5de8e6edfc
When both `std::` and `core::` items are available, only suggest the `std::` ones. We ensure that in `no_std` crates we suggest `core::` items. Ensure that the list of items suggested to be imported are always in the order of local crate items, `std`/`core` items and finally foreign crate items. Tweak wording of import suggestion: if there are multiple items but they are all of the same kind, we use the kind name and not the generic "items". Fix #83564.
21 lines
548 B
Rust
21 lines
548 B
Rust
//@ edition:2018
|
|
//
|
|
// This is a regression test for #83564.
|
|
// For some reason, Rust 2018 or higher is required to reproduce the bug.
|
|
//@ run-rustfix
|
|
//@ revisions: no_std std
|
|
//@ [no_std]compile-flags: --cfg=no_std -C panic=abort
|
|
#![cfg_attr(no_std, no_std)]
|
|
|
|
fn main() {
|
|
//~^ HELP consider importing this struct
|
|
let _x = NonZero::new(5u32).unwrap();
|
|
//~^ ERROR failed to resolve: use of undeclared type `NonZero`
|
|
}
|
|
|
|
#[allow(dead_code)]
|
|
#[cfg_attr(no_std, panic_handler)]
|
|
fn panic(_info: &core::panic::PanicInfo) -> ! {
|
|
loop {}
|
|
}
|