mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 08:13:41 +00:00
adjust smart_resolve_partial_mod_path_errors
This commit is contained in:
parent
9763472e2b
commit
37b40e592a
@ -335,8 +335,7 @@ impl<'a: 'ast, 'ast, 'tcx> LateResolutionVisitor<'a, '_, 'ast, 'tcx> {
|
|||||||
following_seg: Option<&Segment>,
|
following_seg: Option<&Segment>,
|
||||||
) -> Vec<ImportSuggestion> {
|
) -> Vec<ImportSuggestion> {
|
||||||
if let Some(segment) = prefix_path.last() &&
|
if let Some(segment) = prefix_path.last() &&
|
||||||
let Some(following_seg) = following_seg &&
|
let Some(following_seg) = following_seg
|
||||||
prefix_path.len() == 1
|
|
||||||
{
|
{
|
||||||
let candidates = self.r.lookup_import_candidates(
|
let candidates = self.r.lookup_import_candidates(
|
||||||
segment.ident,
|
segment.ident,
|
||||||
|
@ -13,6 +13,15 @@ LL | let _: u8 = ::core::default::Default();
|
|||||||
| ^^^^ maybe a missing crate `core`?
|
| ^^^^ maybe a missing crate `core`?
|
||||||
|
|
|
|
||||||
= help: consider adding `extern crate core` to use the `core` crate
|
= help: consider adding `extern crate core` to use the `core` crate
|
||||||
|
help: consider importing this module
|
||||||
|
|
|
||||||
|
LL + use std::default;
|
||||||
|
|
|
||||||
|
help: if you import `default`, refer to it directly
|
||||||
|
|
|
||||||
|
LL - let _: u8 = ::core::default::Default();
|
||||||
|
LL + let _: u8 = default::Default();
|
||||||
|
|
|
||||||
|
|
||||||
error: aborting due to 2 previous errors
|
error: aborting due to 2 previous errors
|
||||||
|
|
||||||
|
@ -24,6 +24,9 @@ LL | fn f() { my_core::mem::drop(0); }
|
|||||||
LL | a!();
|
LL | a!();
|
||||||
| ---- in this macro invocation
|
| ---- in this macro invocation
|
||||||
|
|
|
|
||||||
|
= help: consider importing one of these items:
|
||||||
|
std::mem
|
||||||
|
core::mem
|
||||||
= note: this error originates in the macro `a` (in Nightly builds, run with -Z macro-backtrace for more info)
|
= note: this error originates in the macro `a` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
|
||||||
error[E0433]: failed to resolve: use of undeclared crate or module `my_core`
|
error[E0433]: failed to resolve: use of undeclared crate or module `my_core`
|
||||||
@ -31,6 +34,18 @@ error[E0433]: failed to resolve: use of undeclared crate or module `my_core`
|
|||||||
|
|
|
|
||||||
LL | fn f() { my_core::mem::drop(0); }
|
LL | fn f() { my_core::mem::drop(0); }
|
||||||
| ^^^^^^^ use of undeclared crate or module `my_core`
|
| ^^^^^^^ use of undeclared crate or module `my_core`
|
||||||
|
|
|
||||||
|
help: consider importing one of these items
|
||||||
|
|
|
||||||
|
LL + use core::mem;
|
||||||
|
|
|
||||||
|
LL + use std::mem;
|
||||||
|
|
|
||||||
|
help: if you import `mem`, refer to it directly
|
||||||
|
|
|
||||||
|
LL - fn f() { my_core::mem::drop(0); }
|
||||||
|
LL + fn f() { mem::drop(0); }
|
||||||
|
|
|
||||||
|
|
||||||
error: aborting due to 4 previous errors
|
error: aborting due to 4 previous errors
|
||||||
|
|
||||||
|
@ -24,6 +24,8 @@ LL | fn f() { my_core::mem::drop(0); }
|
|||||||
LL | a!();
|
LL | a!();
|
||||||
| ---- in this macro invocation
|
| ---- in this macro invocation
|
||||||
|
|
|
|
||||||
|
= help: consider importing this module:
|
||||||
|
my_core::mem
|
||||||
= note: this error originates in the macro `a` (in Nightly builds, run with -Z macro-backtrace for more info)
|
= note: this error originates in the macro `a` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
|
||||||
error[E0433]: failed to resolve: use of undeclared crate or module `my_core`
|
error[E0433]: failed to resolve: use of undeclared crate or module `my_core`
|
||||||
@ -31,6 +33,16 @@ error[E0433]: failed to resolve: use of undeclared crate or module `my_core`
|
|||||||
|
|
|
|
||||||
LL | fn f() { my_core::mem::drop(0); }
|
LL | fn f() { my_core::mem::drop(0); }
|
||||||
| ^^^^^^^ use of undeclared crate or module `my_core`
|
| ^^^^^^^ use of undeclared crate or module `my_core`
|
||||||
|
|
|
||||||
|
help: consider importing this module
|
||||||
|
|
|
||||||
|
LL + use my_core::mem;
|
||||||
|
|
|
||||||
|
help: if you import `mem`, refer to it directly
|
||||||
|
|
|
||||||
|
LL - fn f() { my_core::mem::drop(0); }
|
||||||
|
LL + fn f() { mem::drop(0); }
|
||||||
|
|
|
||||||
|
|
||||||
error: aborting due to 4 previous errors
|
error: aborting due to 4 previous errors
|
||||||
|
|
||||||
|
@ -30,6 +30,17 @@ help: there is a crate or module with a similar name
|
|||||||
|
|
|
|
||||||
LL | bar: std::cell::Cell<bool>
|
LL | bar: std::cell::Cell<bool>
|
||||||
| ~~~
|
| ~~~
|
||||||
|
help: consider importing one of these items
|
||||||
|
|
|
||||||
|
LL + use core::cell;
|
||||||
|
|
|
||||||
|
LL + use std::cell;
|
||||||
|
|
|
||||||
|
help: if you import `cell`, refer to it directly
|
||||||
|
|
|
||||||
|
LL - bar: st::cell::Cell<bool>
|
||||||
|
LL + bar: cell::Cell<bool>
|
||||||
|
|
|
||||||
|
|
||||||
error[E0433]: failed to resolve: use of undeclared crate or module `bar`
|
error[E0433]: failed to resolve: use of undeclared crate or module `bar`
|
||||||
--> $DIR/crate-or-module-typo.rs:6:20
|
--> $DIR/crate-or-module-typo.rs:6:20
|
||||||
|
Loading…
Reference in New Issue
Block a user